Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into chamiloGH-6048
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbeeznest committed Jan 30, 2025
2 parents 05e9fab + b508679 commit e39cb6c
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 38 deletions.
29 changes: 21 additions & 8 deletions assets/css/scss/atoms/_buttons.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.btn {
@apply cursor-default font-semibold gap-2 inline-flex justify-center px-6 py-2 rounded-md transition flex-none;
font-size: 16px;
@apply cursor-default font-semibold gap-2 inline-flex justify-center px-6 py-2 rounded-md transition flex-none text-base;

.mdi {
@apply text-base;
}

&--primary {
@apply bg-primary text-white;
Expand Down Expand Up @@ -231,8 +234,6 @@ $border-color_12: #9333EA;
@include filled-style('primary', 'support-4');
@apply cursor-pointer font-semibold gap-2 inline-flex justify-center items-center px-4 py-2 rounded-md transition;

font-size: 16px;

&:focus {
@apply outline-none;
}
Expand All @@ -259,16 +260,28 @@ $border-color_12: #9333EA;

&.p-button-sm {
@apply px-2 py-1;
font-size: 13px;

.p-button-icon,
.p-button-label {
font-size: 13px;
}
}

&.p-button-lg {
@apply px-8 py-4;
font-size: 18px;

.p-button-icon,
.p-button-label {
font-size: 18px;
}
}

.p-button-icon {
@apply text-base;
}

.p-button-label {
@apply align-middle font-semibold;
@apply align-middle font-semibold text-base;
}

&.p-button-icon-only {
Expand All @@ -289,7 +302,7 @@ $border-color_12: #9333EA;
@apply bg-gray-10;

.p-button-label {
text-decoration: underline;
@apply underline;
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions assets/css/scss/molecules/_course_tool.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@
&__icon {
@apply text-transparent bg-clip-text bg-gradient-to-br from-primary to-primary-gradient leading-none;

&,
&.mdi {
font-size: 52px;
}

&::before {
}
}

&__title {
Expand Down
6 changes: 5 additions & 1 deletion assets/css/scss/molecules/_empty_state.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
}

&__icon {
@apply mb-4 text-9xl text-transparent bg-clip-text bg-gradient-to-br from-primary to-primary-gradient w-32 h-32;
@apply mb-4 text-transparent bg-clip-text bg-gradient-to-br from-primary to-primary-gradient w-32 h-32;

&.mdi {
font-size: 8rem;
}
}

&__summary {
Expand Down
2 changes: 1 addition & 1 deletion assets/css/scss/molecules/_toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

&-group-left,
&-group-right {
@apply flex flex-row flex-wrap gap-2;
@apply flex flex-row flex-wrap gap-2 items-center;
}

&-separator {
Expand Down
10 changes: 7 additions & 3 deletions public/main/admin/course_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
use Chamilo\CoreBundle\Component\Utils\StateIcon;
use Chamilo\CoreBundle\Component\Utils\ToolIcon;
use Chamilo\CoreBundle\Framework\Container;

$cidReset = true;

Expand Down Expand Up @@ -416,9 +417,12 @@ function get_course_visibility_icon(int $visibility): string
['id' => 'course-search-keyword', 'aria-label' => get_lang('Search courses')]
);
$form->addButtonSearch(get_lang('Search courses'));
$advanced = '<a class="btn btn--plain" href="'.api_get_path(WEB_CODE_PATH).'admin/course_list.php?search=advanced">
<em class="pi pi-search"></em> '.
get_lang('Advanced search').'</a>';
$advanced = Display::toolbarButton(
get_lang('Advanced search'),
Container::getRouter()->generate('legacy_main', ['name' => 'admin/course_list.php', 'search' => 'advanced']),
ActionIcon::SEARCH,
'plain'
);

// Create a filter by session
$sessionFilter = new FormValidator(
Expand Down
4 changes: 1 addition & 3 deletions public/main/inc/lib/formvalidator/FormValidator.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ public function __construct(

switch ($layout) {
case self::LAYOUT_BOX_SEARCH:
$attributes['class'] = 'form--search';
break;
case self::LAYOUT_INLINE:
$attributes['class'] = 'flex flex-row gap-3 ';
$attributes['class'] = 'flex flex-row gap-3 items-center ';
break;
case self::LAYOUT_BOX:
$attributes['class'] = 'ch flex gap-1 ';
Expand Down
6 changes: 5 additions & 1 deletion public/main/inc/lib/javascript/record_audio/record_audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ window.RecordAudio = (function () {
if (btnSave) {
btnSave.prop('disabled', true).text(btnSave.data('loadingtext'));
}

$('.exercise_save_now_button button, .exercise_actions button').prop('disabled', true);
}
}).done(function (response) {
$(response.message).insertAfter($(rtcInfo.blockId).find('.well'));
Expand All @@ -97,6 +99,8 @@ window.RecordAudio = (function () {
btnStop.prop('disabled', true).addClass('hidden');
btnPause.prop('disabled', true).addClass('hidden');
btnStart.prop('disabled', false).removeClass('hidden');

$('.exercise_save_now_button button, .exercise_actions button').prop('disabled', false);
});
}

Expand Down Expand Up @@ -127,7 +131,7 @@ window.RecordAudio = (function () {
alert(error);
}

if(!!(navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia)) {
if(navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia) {
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
navigator.getUserMedia(mediaConstraints, successCallback, errorCallback);
return;
Expand Down
7 changes: 7 additions & 0 deletions src/CoreBundle/Controller/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ public function edit(Request $request, UserRepository $userRepository, Illustrat
}
}

if ($form->has('password')) {
$password = $form['password']->getData();
if ($password) {
$user->setPlainPassword($password);
}
}

$showTermsIfProfileCompleted = ('true' === $settingsManager->getSetting('show_terms_if_profile_completed'));
$user->setProfileCompleted($showTermsIfProfileCompleted);

Expand Down
13 changes: 12 additions & 1 deletion src/CoreBundle/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ public function getPlainPassword(): ?string
return $this->plainPassword;
}

public function setPlainPassword(string $password): self
public function setPlainPassword(?string $password): self
{
$this->plainPassword = $password;
// forces the object to look "dirty" to Doctrine. Avoids
Expand Down Expand Up @@ -2210,6 +2210,17 @@ public function setSurveyInvitations(Collection $surveyInvitations): self
return $this;
}

public function getLogin(): string
{
return $this->username;
}

public function setLogin(string $login): self
{
$this->username = $login;
return $this;
}

/**
* @return Collection<int, TrackELogin>
*/
Expand Down
4 changes: 4 additions & 0 deletions src/CoreBundle/EventListener/LoginSuccessHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ public function __invoke(InteractiveLoginEvent $event): ?RedirectResponse
$trackELoginRepository->createLoginRecord($user, new DateTime(), $userIp);
$trackEOnlineRepository->createOnlineSession($user, $userIp);

$user->setLastLogin(new DateTime());
$this->entityManager->persist($user);
$this->entityManager->flush();

// Log of connection attempts
$trackELoginRecordRepository->addTrackLogin($user->getUsername(), $userIp, true);
$this->loginAttemptLogger->logAttempt(true, $user->getUsername(), $userIp);
Expand Down
32 changes: 18 additions & 14 deletions src/CoreBundle/Form/ProfileType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
use Chamilo\CoreBundle\Repository\LanguageRepository;
use Chamilo\CoreBundle\Settings\SettingsManager;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\LocaleType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TimezoneType;
use Symfony\Component\Form\FormBuilderInterface;
Expand All @@ -23,20 +24,16 @@
*/
class ProfileType extends AbstractType
{
private LanguageRepository $languageRepository;

public function __construct(
LanguageRepository $languageRepository,
private readonly SettingsManager $settingsManager
) {
$this->languageRepository = $languageRepository;
}
private readonly LanguageRepository $languageRepository,
private readonly SettingsManager $settingsManager,
) {}

public function buildForm(FormBuilderInterface $builder, array $options): void
{
$changeableOptions = $this->settingsManager->getSetting('profile.changeable_options') ?? [];
$visibleOptions = $this->settingsManager->getSetting('profile.visible_options') ?? [];
$languages = array_flip($this->languageRepository->getAllAvailableToArray());
$changeableOptions = $this->settingsManager->getSetting('profile.changeable_options', true) ?? [];
$visibleOptions = $this->settingsManager->getSetting('profile.visible_options', true) ?? [];
$languages = array_flip($this->languageRepository->getAllAvailableToArray(true));

$fieldsMap = [
'name' => ['field' => 'firstname', 'type' => TextType::class, 'label' => 'Firstname'],
Expand All @@ -49,10 +46,16 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'mapped' => false,
],
'login' => ['field' => 'login', 'type' => TextType::class, 'label' => 'Login'],
'password' => ['field' => 'password', 'type' => TextType::class, 'label' => 'Password'],
'password' => [
'field' => 'password',
'type' => PasswordType::class,
'label' => 'Password',
'mapped' => false,
'required' => false,
],
'language' => [
'field' => 'locale',
'type' => LocaleType::class,
'type' => ChoiceType::class,
'label' => 'Language',
'choices' => $languages,
],
Expand All @@ -69,7 +72,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
array_merge(
[
'label' => $fieldConfig['label'],
'required' => false,
'required' => $fieldConfig['required'] ?? false,
'mapped' => $fieldConfig['mapped'] ?? true,
'attr' => !$isEditable ? ['readonly' => true] : [],
],
isset($fieldConfig['choices']) ? ['choices' => $fieldConfig['choices']] : []
Expand Down
10 changes: 8 additions & 2 deletions src/CoreBundle/Repository/LanguageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,15 @@ public function getAllAvailable($excludeDefaultLocale = false): QueryBuilder
return $qb;
}

public function getAllAvailableToArray(): array
public function getAllAvailableToArray(bool $onlyActive = false): array
{
$languages = $this->getAllAvailable()->getQuery()->getResult();
$queryBuilder = $this->getAllAvailable();

if (!$onlyActive) {
$queryBuilder->resetDQLPart('where');
}

$languages = $queryBuilder->getQuery()->getResult();

$list = [];

Expand Down

0 comments on commit e39cb6c

Please sign in to comment.