From 2bc2fd7aab0e26f84394f43371f054e2c51cb582 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 12 Aug 2020 11:22:00 +0200 Subject: [PATCH] Minor - Plugins - Zoom - fix course add/delete recording to course BT#17288 --- main/inc/lib/plugin.class.php | 8 ++++---- plugin/zoom/Entity/Meeting.php | 1 + plugin/zoom/Entity/MeetingActivity.php | 5 +++++ plugin/zoom/Entity/Recording.php | 4 ++++ plugin/zoom/lib/ZoomPlugin.php | 13 ++++++++----- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/main/inc/lib/plugin.class.php b/main/inc/lib/plugin.class.php index dbb8ac0ac6..3f3e29de4a 100755 --- a/main/inc/lib/plugin.class.php +++ b/main/inc/lib/plugin.class.php @@ -475,7 +475,7 @@ class Plugin * * @return bool|null False on error, null otherwise */ - public function install_course_fields($courseId, $add_tool_link = true) + public function install_course_fields($courseId, $add_tool_link = true, $iconName = '') { $plugin_name = $this->get_name(); $t_course = Database::get_course_table(TABLE_COURSE_SETTING); @@ -552,7 +552,7 @@ class Plugin } // Add an icon in the table tool list - $this->createLinkToCourseTool($plugin_name, $courseId); + $this->createLinkToCourseTool($plugin_name, $courseId, $iconName); } /** @@ -606,14 +606,14 @@ class Plugin * * @param bool $add_tool_link Whether we want to add a plugin link on the course homepage */ - public function install_course_fields_in_all_courses($add_tool_link = true) + public function install_course_fields_in_all_courses($add_tool_link = true, $iconName = '') { // Update existing courses to add plugin settings $table = Database::get_main_table(TABLE_MAIN_COURSE); $sql = "SELECT id FROM $table ORDER BY id"; $res = Database::query($sql); while ($row = Database::fetch_assoc($res)) { - $this->install_course_fields($row['id'], $add_tool_link); + $this->install_course_fields($row['id'], $add_tool_link, $iconName); } } diff --git a/plugin/zoom/Entity/Meeting.php b/plugin/zoom/Entity/Meeting.php index 583da90ce7..fab212883c 100644 --- a/plugin/zoom/Entity/Meeting.php +++ b/plugin/zoom/Entity/Meeting.php @@ -131,6 +131,7 @@ class Meeting /** * @var Recording[]|ArrayCollection + * * @ORM\OneToMany(targetEntity="Recording", mappedBy="meeting", cascade={"persist"}, orphanRemoval=true) */ protected $recordings; diff --git a/plugin/zoom/Entity/MeetingActivity.php b/plugin/zoom/Entity/MeetingActivity.php index 093f438bc2..fdeaf84c5e 100644 --- a/plugin/zoom/Entity/MeetingActivity.php +++ b/plugin/zoom/Entity/MeetingActivity.php @@ -26,6 +26,7 @@ class MeetingActivity /** * @var Meeting + * * @ORM\ManyToOne(targetEntity="Meeting", inversedBy="activities") * @ORM\JoinColumn(name="meeting_id") */ @@ -33,6 +34,7 @@ class MeetingActivity /** * @var Meeting + * * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User") * @ORM\JoinColumn(name="user_id", referencedColumnName="id") */ @@ -40,18 +42,21 @@ class MeetingActivity /** * @var string + * * @ORM\Column(type="string", name="name", length=255, nullable=false) */ protected $name; /** * @var string + * * @ORM\Column(type="string", name="type", length=255, nullable=false) */ protected $type; /** * @var string + * * @ORM\Column(type="text", name="event", nullable=true) */ protected $event; diff --git a/plugin/zoom/Entity/Recording.php b/plugin/zoom/Entity/Recording.php index cdbb8fa14a..8a5dd27fe8 100644 --- a/plugin/zoom/Entity/Recording.php +++ b/plugin/zoom/Entity/Recording.php @@ -40,6 +40,7 @@ class Recording /** * @var string + * * @ORM\Column(type="integer") * @ORM\Id * @ORM\GeneratedValue() @@ -48,12 +49,14 @@ class Recording /** * @var string + * * @ORM\Column(type="string") */ protected $uuid; /** * @var Meeting + * * @ORM\ManyToOne(targetEntity="Meeting", inversedBy="recordings") * @ORM\JoinColumn(name="meeting_id") */ @@ -61,6 +64,7 @@ class Recording /** * @var string + * * @ORM\Column(type="text", name="recording_meeting_json", nullable=true) */ protected $recordingMeetingJson; diff --git a/plugin/zoom/lib/ZoomPlugin.php b/plugin/zoom/lib/ZoomPlugin.php index 8d7f6a37a5..73e16a39cf 100644 --- a/plugin/zoom/lib/ZoomPlugin.php +++ b/plugin/zoom/lib/ZoomPlugin.php @@ -123,7 +123,7 @@ class ZoomPlugin extends Plugin $items[] = [ 'class' => 'video-conference', 'icon' => Display::return_icon( - 'zoom.png', + 'bbb.png', get_lang('VideoConference') ), 'link' => $link, @@ -450,10 +450,12 @@ class ZoomPlugin extends Plugin if (!$meeting->getRecordings()->isEmpty()) { $fileIdSelect = $form->addSelect('fileIds', get_lang('Files')); $fileIdSelect->setMultiple(true); - foreach ($meeting->getRecordings() as &$recording) { + $recordingList = $meeting->getRecordings(); + foreach ($recordingList as &$recording) { // $recording->instanceDetails = $plugin->getPastMeetingInstanceDetails($instance->uuid); $options = []; - foreach ($recording->getRecordingMeeting()->recording_files as $file) { + $recordings = $recording->getRecordingMeeting()->recording_files; + foreach ($recordings as $file) { $options[] = [ 'text' => sprintf( '%s.%s (%s)', @@ -482,8 +484,9 @@ class ZoomPlugin extends Plugin ); $form->addButtonUpdate($this->get_lang('DoIt')); if ($form->validate()) { - foreach ($meeting->getRecordings() as $recording) { - foreach ($recording->files as $file) { + foreach ($recordingList as $recording) { + $recordings = $recording->getRecordingMeeting()->recording_files; + foreach ($recordings as $file) { if (in_array($file->id, $form->getSubmitValue('fileIds'))) { $name = sprintf( $this->get_lang('XRecordingOfMeetingXFromXDurationXDotX'),