diff --git a/assets/css/scss/atoms/_form.scss b/assets/css/scss/atoms/_form.scss index dd1a2d9a4a..895c1bac0a 100644 --- a/assets/css/scss/atoms/_form.scss +++ b/assets/css/scss/atoms/_form.scss @@ -75,16 +75,21 @@ input:focus, input.p-filled, + .html-editor-container, textarea:focus, textarea.p-filled, .p-inputwrapper-focus, .p-inputwrapper-filled { ~ label { - @apply bg-white px-1 text-primary top-0 left-2; + @apply bg-white px-1 text-primary top-0 left-2 text-tiny; top: 0 !important; } } + .html-editor-container > div { + @apply pt-2 border-support-3 rounded-lg; + } + .p-invalid ~ label { @apply text-error; } diff --git a/assets/vue/components/documents/FormNewDocument.vue b/assets/vue/components/documents/FormNewDocument.vue index 63df8743ed..e32029b87b 100644 --- a/assets/vue/components/documents/FormNewDocument.vue +++ b/assets/vue/components/documents/FormNewDocument.vue @@ -7,36 +7,44 @@ :label="$t('Title')" /> - +
+
+ + }" + required + /> +
+
+ + diff --git a/public/main/inc/lib/formvalidator/Element/HtmlEditor.php b/public/main/inc/lib/formvalidator/Element/HtmlEditor.php index 2eeafaa766..ae739f7f3c 100644 --- a/public/main/inc/lib/formvalidator/Element/HtmlEditor.php +++ b/public/main/inc/lib/formvalidator/Element/HtmlEditor.php @@ -104,4 +104,36 @@ class HtmlEditor extends HTML_QuickForm_textarea return $result; } + + public function getTemplate(string $layout): string + { + if (FormValidator::LAYOUT_HORIZONTAL === $layout) { + return ' +
+
+
+ {element} + {icon} +
+ +
+ + {label_2} + + + + {label_3} + + + + {error} + +
'; + } + + return parent::getTemplate($layout); + } } diff --git a/public/main/session/session_add.php b/public/main/session/session_add.php index 4874178622..6aacf0e916 100644 --- a/public/main/session/session_add.php +++ b/public/main/session/session_add.php @@ -253,7 +253,7 @@ $form->setDefaults($formDefaults); if ($form->validate()) { $params = $form->getSubmitValues(); - $name = $params['name']; + $title = $params['title']; $startDate = $params['access_start_date']; $endDate = $params['access_end_date']; $displayStartDate = $params['display_start_date']; @@ -309,7 +309,7 @@ if ($form->validate()) { } $return = SessionManager::create_session( - $name, + $title, $startDate, $endDate, $displayStartDate, diff --git a/src/CoreBundle/Controller/CourseController.php b/src/CoreBundle/Controller/CourseController.php index 5f2a4105e1..ebe9d29813 100644 --- a/src/CoreBundle/Controller/CourseController.php +++ b/src/CoreBundle/Controller/CourseController.php @@ -22,7 +22,6 @@ use Chamilo\CoreBundle\Repository\Node\IllustrationRepository; use Chamilo\CoreBundle\Repository\TagRepository; use Chamilo\CoreBundle\Security\Authorization\Voter\CourseVoter; use Chamilo\CoreBundle\Settings\SettingsManager; -use Chamilo\CoreBundle\Tool\AbstractTool; use Chamilo\CoreBundle\Tool\ToolChain; use Chamilo\CourseBundle\Controller\ToolBaseController; use Chamilo\CourseBundle\Entity\CCourseDescription; @@ -129,9 +128,7 @@ class CourseController extends ToolBaseController #[Entity('course', expr: 'repository.find(cid)')] public function indexJson( Request $request, - CToolRepository $toolRepository, CShortcutRepository $shortcutRepository, - ToolChain $toolChain, EntityManagerInterface $em, ): Response { $requestData = json_decode($request->getContent(), true); @@ -851,19 +848,6 @@ class CourseController extends ToolBaseController } } - private function generateToolUrl(AbstractTool $tool): string - { - $link = $tool->getLink(); - $course = $this->getCourse(); - - if (strpos($link, 'nodeId')) { - $nodeId = (string) $course->getResourceNode()->getId(); - $link = str_replace(':nodeId', $nodeId, $link); - } - - return $link.'?'.$this->getCourseUrlQuery(); - } - // Implement the real logic to check course enrollment private function isUserEnrolledInAnyCourse(User $user, EntityManagerInterface $em): bool { diff --git a/src/CoreBundle/Entity/CourseRelUser.php b/src/CoreBundle/Entity/CourseRelUser.php index bb3baff792..7a9e3356a9 100644 --- a/src/CoreBundle/Entity/CourseRelUser.php +++ b/src/CoreBundle/Entity/CourseRelUser.php @@ -60,12 +60,12 @@ class CourseRelUser implements Stringable protected ?int $id = null; #[Groups(['course:read', 'user:read', 'course_rel_user:read'])] - #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'courses', cascade: ['persist'])] - #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')] + #[ORM\ManyToOne(targetEntity: User::class, cascade: ['persist'], inversedBy: 'courses')] + #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected User $user; #[Groups(['course_rel_user:read'])] - #[ORM\ManyToOne(targetEntity: Course::class, inversedBy: 'users', cascade: ['persist'])] + #[ORM\ManyToOne(targetEntity: Course::class, cascade: ['persist'], inversedBy: 'users')] #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', onDelete: 'CASCADE')] protected Course $course; diff --git a/src/CoreBundle/Entity/TrackEAttemptQualify.php b/src/CoreBundle/Entity/TrackEAttemptQualify.php index 0582f61f01..27b670d634 100644 --- a/src/CoreBundle/Entity/TrackEAttemptQualify.php +++ b/src/CoreBundle/Entity/TrackEAttemptQualify.php @@ -53,7 +53,7 @@ class TrackEAttemptQualify protected ?string $answer; #[ORM\ManyToOne(inversedBy: 'revisedAttempts')] - #[ORM\JoinColumn(name: 'exe_id', referencedColumnName: 'exe_id', nullable: false)] + #[ORM\JoinColumn(name: 'exe_id', referencedColumnName: 'exe_id', nullable: false, onDelete: 'CASCADE')] private ?TrackEExercise $trackExercise = null; public function __construct() diff --git a/src/CoreBundle/EventSubscriber/AnonymousUserSubscriber.php b/src/CoreBundle/EventSubscriber/AnonymousUserSubscriber.php index 7948785e1b..d7c49f4fa0 100644 --- a/src/CoreBundle/EventSubscriber/AnonymousUserSubscriber.php +++ b/src/CoreBundle/EventSubscriber/AnonymousUserSubscriber.php @@ -6,8 +6,6 @@ declare(strict_types=1); namespace Chamilo\CoreBundle\EventSubscriber; -use Chamilo\CoreBundle\Entity\TrackEAttemptQualify; -use Chamilo\CoreBundle\Entity\TrackEExercise; use Chamilo\CoreBundle\Entity\TrackELogin; use Chamilo\CoreBundle\Entity\User; use Chamilo\CoreBundle\Settings\SettingsManager; @@ -125,8 +123,6 @@ class AnonymousUserSubscriber implements EventSubscriberInterface if ($oldestAnonymousUser) { error_log('Deleting oldest anonymous user: '.$oldestAnonymousUser->getId()); - $this->handleRelatedEntities($oldestAnonymousUser); - $this->entityManager->remove($oldestAnonymousUser); $this->entityManager->flush(); } @@ -158,30 +154,4 @@ class AnonymousUserSubscriber implements EventSubscriberInterface return $anonymousUser->getId(); } - - private function handleRelatedEntities(User $user): void - { - $trackEExercisesRepository = $this->entityManager->getRepository(TrackEExercise::class); - - $exercises = $trackEExercisesRepository->findBy(['user' => $user->getId()]); - - foreach ($exercises as $exercise) { - $this->handleAttemptRecordings($exercise); - - $this->entityManager->remove($exercise); - } - - $this->entityManager->flush(); - } - - private function handleAttemptRecordings(TrackEExercise $exercise): void - { - $trackEAttemptRecordingRepository = $this->entityManager->getRepository(TrackEAttemptQualify::class); - - $attemptRecordings = $trackEAttemptRecordingRepository->findBy(['trackExercise' => $exercise->getExeId()]); - - foreach ($attemptRecordings as $attemptRecording) { - $this->entityManager->remove($attemptRecording); - } - } } diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20230622150000.php b/src/CoreBundle/Migrations/Schema/V200/Version20170524130000.php similarity index 91% rename from src/CoreBundle/Migrations/Schema/V200/Version20230622150000.php rename to src/CoreBundle/Migrations/Schema/V200/Version20170524130000.php index 50f459871b..e9877823e5 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20230622150000.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20170524130000.php @@ -7,7 +7,7 @@ namespace Chamilo\CoreBundle\Migrations\Schema\V200; use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo; use Doctrine\DBAL\Schema\Schema; -final class Version20230622150000 extends AbstractMigrationChamilo +final class Version20170524130000 extends AbstractMigrationChamilo { public function getDescription(): string {