From 16f291e42b5cac668433f8a48e659fd881545e91 Mon Sep 17 00:00:00 2001 From: carlos alvarado Date: Tue, 11 Aug 2020 12:46:03 -0500 Subject: [PATCH 1/7] Course description: Show correct time about the last thematic advance made and the next one to do. - refs #3008 --- main/inc/introductionSection.inc.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main/inc/introductionSection.inc.php b/main/inc/introductionSection.inc.php index 7e46bdaa0f..c7a1e291ad 100755 --- a/main/inc/introductionSection.inc.php +++ b/main/inc/introductionSection.inc.php @@ -219,11 +219,12 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) { $thematic_info = $thematic->get_thematic_list($thematic_advance_info['thematic_id']); $thematic_info['title'] = isset($thematic_info['title']) ? $thematic_info['title'] : ''; - /* - $thematic_advance_info['start_date'] = api_get_local_time( - $thematic_advance_info['start_date'] - ); - */ + if (!empty($thematic_advance_info['start_date'])) { + $thematic_advance_info['start_date'] = api_get_local_time( + $thematic_advance_info['start_date'] + ); + } + $thematic_advance_info['start_date'] = api_format_date( $thematic_advance_info['start_date'], DATE_TIME_FORMAT_LONG From 84b59b97c56a6dd0af56f770cbdd94b3c0bdab79 Mon Sep 17 00:00:00 2001 From: carlos alvarado Date: Tue, 11 Aug 2020 12:49:12 -0500 Subject: [PATCH 2/7] Thematic advance: Show correct time into Temporalization of the didactic unit - refs #3008 --- main/course_progress/thematic_controller.php | 2 +- main/inc/lib/thematic.lib.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/main/course_progress/thematic_controller.php b/main/course_progress/thematic_controller.php index b3ac86fa62..96966f3b3e 100755 --- a/main/course_progress/thematic_controller.php +++ b/main/course_progress/thematic_controller.php @@ -366,7 +366,7 @@ class ThematicController $thematic_plan_data = $thematic->get_thematic_plan_data(); // Third column - $thematic_advance_data = $thematic->get_thematic_advance_list(null, null, true); + $thematic_advance_data = $thematic->get_thematic_advance_list(null, null, true, true); $data['thematic_plan_div'] = $thematic->get_thematic_plan_array($thematic_plan_data); $data['thematic_advance_div'] = $thematic->get_thematic_advance_div($thematic_advance_data); diff --git a/main/inc/lib/thematic.lib.php b/main/inc/lib/thematic.lib.php index dee18d7527..1df880b9b1 100755 --- a/main/inc/lib/thematic.lib.php +++ b/main/inc/lib/thematic.lib.php @@ -702,13 +702,15 @@ class Thematic * @param int $thematic_advance_id Thematic advance id (optional), get data by thematic advance list * @param string $course_code Course code (optional) * @param bool $force_session_id Force to have a session id + * @param bool $withLocalTime Force start_date to local time * * @return array $data */ public function get_thematic_advance_list( $thematic_advance_id = null, $course_code = null, - $force_session_id = false + $force_session_id = false, + $withLocalTime = false ) { $course_info = api_get_course_info($course_code); $tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE); @@ -746,6 +748,9 @@ class Thematic // group all data group by thematic id $tmp = []; while ($row = Database::fetch_array($res, 'ASSOC')) { + if($withLocalTime == true) { + $row['start_date'] = api_get_local_time($row['start_date']); + } $tmp[] = $row['thematic_id']; if (in_array($row['thematic_id'], $tmp)) { if ($force_session_id) { From 1589992659afa4a0c6b59b97de1109a3852e0000 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Tue, 11 Aug 2020 20:20:50 -0500 Subject: [PATCH 3/7] Minor - Flint fixes --- main/inc/lib/thematic.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/inc/lib/thematic.lib.php b/main/inc/lib/thematic.lib.php index 1df880b9b1..2249c819f4 100755 --- a/main/inc/lib/thematic.lib.php +++ b/main/inc/lib/thematic.lib.php @@ -702,7 +702,7 @@ class Thematic * @param int $thematic_advance_id Thematic advance id (optional), get data by thematic advance list * @param string $course_code Course code (optional) * @param bool $force_session_id Force to have a session id - * @param bool $withLocalTime Force start_date to local time + * @param bool $withLocalTime Force start_date to local time * * @return array $data */ @@ -748,7 +748,7 @@ class Thematic // group all data group by thematic id $tmp = []; while ($row = Database::fetch_array($res, 'ASSOC')) { - if($withLocalTime == true) { + if ($withLocalTime == true) { $row['start_date'] = api_get_local_time($row['start_date']); } $tmp[] = $row['thematic_id']; From 5ea9f7edb4fbf09d30981017157774cdc10834bf Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 12 Aug 2020 09:28:00 +0200 Subject: [PATCH 4/7] Minor - Plugins - Zoom - comment approval_type cannot be change BT#17288 --- plugin/zoom/lib/ZoomPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/zoom/lib/ZoomPlugin.php b/plugin/zoom/lib/ZoomPlugin.php index 68b1fb1722..8d7f6a37a5 100644 --- a/plugin/zoom/lib/ZoomPlugin.php +++ b/plugin/zoom/lib/ZoomPlugin.php @@ -1223,7 +1223,7 @@ class ZoomPlugin extends Plugin private function startInstantMeeting($topic, $user = null, $course = null, $group = null, $session = null) { $meetingInfoGet = MeetingInfoGet::fromTopicAndType($topic, MeetingInfoGet::TYPE_INSTANT); - $meetingInfoGet->settings->approval_type = MeetingSettings::APPROVAL_TYPE_AUTOMATICALLY_APPROVE; + //$meetingInfoGet->settings->approval_type = MeetingSettings::APPROVAL_TYPE_AUTOMATICALLY_APPROVE; $meeting = $this->createMeetingFromMeeting( (new Meeting()) ->setMeetingInfoGet($meetingInfoGet) From 30d31f75445b19c36522631d226e604ffcc0e590 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 12 Aug 2020 09:41:38 +0200 Subject: [PATCH 5/7] Minor - format code --- main/install/configuration.dist.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main/install/configuration.dist.php b/main/install/configuration.dist.php index 4685bed1b4..1058a6770c 100755 --- a/main/install/configuration.dist.php +++ b/main/install/configuration.dist.php @@ -1114,9 +1114,12 @@ $_configuration['profile_fields_visibility'] = [ // Add a minimum time limit to be in the learning path // in order to get the last item completed // Requires a DB change: -// ALTER TABLE c_lp ADD accumulate_work_time INT NOT NULL; -// CREATE TABLE track_e_access_complete (id int(11) NOT NULL AUTO_INCREMENT, user_id int(11) NOT NULL, date_reg datetime NOT NULL, tool varchar(255) NOT NULL, tool_id int(11) NOT NULL, tool_id_detail int(11) NOT NULL, action varchar(255) NOT NULL, action_details varchar(255) NOT NULL, current_id int(11) NOT NULL, ip_user varchar(255) NOT NULL, user_agent varchar(255) NOT NULL, session_id int(11) NOT NULL, c_id int(11) NOT NULL, ch_sid varchar(255) NOT NULL, login_as int(11) NOT NULL, info longtext NOT NULL, url text NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB AUTO_INCREMENT=13989 DEFAULT CHARSET=utf8; -// CREATE INDEX user_course_session ON track_e_access_complete (user_id, c_id, session_id); +/* + ALTER TABLE c_lp ADD accumulate_work_time INT NOT NULL; + CREATE TABLE track_e_access_complete (id int(11) NOT NULL AUTO_INCREMENT, user_id int(11) NOT NULL, date_reg datetime NOT NULL, tool varchar(255) NOT NULL, tool_id int(11) NOT NULL, tool_id_detail int(11) NOT NULL, action varchar(255) NOT NULL, action_details varchar(255) NOT NULL, current_id int(11) NOT NULL, ip_user varchar(255) NOT NULL, user_agent varchar(255) NOT NULL, session_id int(11) NOT NULL, c_id int(11) NOT NULL, ch_sid varchar(255) NOT NULL, login_as int(11) NOT NULL, info longtext NOT NULL, url text NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB AUTO_INCREMENT=13989 DEFAULT CHARSET=utf8; + CREATE INDEX user_course_session ON track_e_access_complete (user_id, c_id, session_id); +*/ + // Add course checkbox extra field "new_tracking_system" // Add session checkbox extra field "new_tracking_system" // Only applied for courses/sessions with extra field "new_tracking_system" to "1" From 2bc2fd7aab0e26f84394f43371f054e2c51cb582 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 12 Aug 2020 11:22:00 +0200 Subject: [PATCH 6/7] 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'), From a6723de22aeb95b8aad2f5f66cfa3cb6a91644b1 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 12 Aug 2020 11:25:46 +0200 Subject: [PATCH 7/7] Minor - Plugins - Zoom - fix add/delete recording to session/group BT#17288 --- plugin/zoom/lib/ZoomPlugin.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/plugin/zoom/lib/ZoomPlugin.php b/plugin/zoom/lib/ZoomPlugin.php index 73e16a39cf..f457d67e3e 100644 --- a/plugin/zoom/lib/ZoomPlugin.php +++ b/plugin/zoom/lib/ZoomPlugin.php @@ -610,6 +610,19 @@ class ZoomPlugin extends Plugin if (false === curl_exec($curl)) { throw new Exception("curl_exec failed: ".curl_error($curl)); } + + $sessionId = 0; + $session = $meeting->getSession(); + if (null !== $session) { + $sessionId = $session->getId(); + } + + $groupId = 0; + $group = $meeting->getGroup(); + if (null !== $group) { + $groupId = $group->getIid(); + } + $newPath = handle_uploaded_document( $courseInfo, [ @@ -622,19 +635,20 @@ class ZoomPlugin extends Plugin '/', api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document', api_get_user_id(), - 0, + $groupId, null, 0, '', true, false, null, - $meeting->getSession()->getId(), + $sessionId, true ); + fclose($tmpFile); if (false === $newPath) { - throw new Exception('could not handle uploaded document'); + throw new Exception('Could not handle uploaded document'); } }