Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

pull/3446/head
Yannick Warnier 5 years ago
commit aeb0508a7d
  1. 2
      main/course_progress/thematic_controller.php
  2. 11
      main/inc/introductionSection.inc.php
  3. 8
      main/inc/lib/plugin.class.php
  4. 7
      main/inc/lib/thematic.lib.php
  5. 9
      main/install/configuration.dist.php
  6. 1
      plugin/zoom/Entity/Meeting.php
  7. 5
      plugin/zoom/Entity/MeetingActivity.php
  8. 4
      plugin/zoom/Entity/Recording.php
  9. 35
      plugin/zoom/lib/ZoomPlugin.php

@ -366,7 +366,7 @@ class ThematicController
$thematic_plan_data = $thematic->get_thematic_plan_data(); $thematic_plan_data = $thematic->get_thematic_plan_data();
// Third column // 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_plan_div'] = $thematic->get_thematic_plan_array($thematic_plan_data);
$data['thematic_advance_div'] = $thematic->get_thematic_advance_div($thematic_advance_data); $data['thematic_advance_div'] = $thematic->get_thematic_advance_div($thematic_advance_data);

@ -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 = $thematic->get_thematic_list($thematic_advance_info['thematic_id']);
$thematic_info['title'] = isset($thematic_info['title']) ? $thematic_info['title'] : ''; $thematic_info['title'] = isset($thematic_info['title']) ? $thematic_info['title'] : '';
/* if (!empty($thematic_advance_info['start_date'])) {
$thematic_advance_info['start_date'] = api_get_local_time( $thematic_advance_info['start_date'] = api_get_local_time(
$thematic_advance_info['start_date'] $thematic_advance_info['start_date']
); );
*/ }
$thematic_advance_info['start_date'] = api_format_date( $thematic_advance_info['start_date'] = api_format_date(
$thematic_advance_info['start_date'], $thematic_advance_info['start_date'],
DATE_TIME_FORMAT_LONG DATE_TIME_FORMAT_LONG

@ -475,7 +475,7 @@ class Plugin
* *
* @return bool|null False on error, null otherwise * @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(); $plugin_name = $this->get_name();
$t_course = Database::get_course_table(TABLE_COURSE_SETTING); $t_course = Database::get_course_table(TABLE_COURSE_SETTING);
@ -552,7 +552,7 @@ class Plugin
} }
// Add an icon in the table tool list // 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 * @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 // Update existing courses to add plugin settings
$table = Database::get_main_table(TABLE_MAIN_COURSE); $table = Database::get_main_table(TABLE_MAIN_COURSE);
$sql = "SELECT id FROM $table ORDER BY id"; $sql = "SELECT id FROM $table ORDER BY id";
$res = Database::query($sql); $res = Database::query($sql);
while ($row = Database::fetch_assoc($res)) { 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);
} }
} }

@ -702,13 +702,15 @@ class Thematic
* @param int $thematic_advance_id Thematic advance id (optional), get data by thematic advance list * @param int $thematic_advance_id Thematic advance id (optional), get data by thematic advance list
* @param string $course_code Course code (optional) * @param string $course_code Course code (optional)
* @param bool $force_session_id Force to have a session id * @param bool $force_session_id Force to have a session id
* @param bool $withLocalTime Force start_date to local time
* *
* @return array $data * @return array $data
*/ */
public function get_thematic_advance_list( public function get_thematic_advance_list(
$thematic_advance_id = null, $thematic_advance_id = null,
$course_code = null, $course_code = null,
$force_session_id = false $force_session_id = false,
$withLocalTime = false
) { ) {
$course_info = api_get_course_info($course_code); $course_info = api_get_course_info($course_code);
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE); $tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
@ -746,6 +748,9 @@ class Thematic
// group all data group by thematic id // group all data group by thematic id
$tmp = []; $tmp = [];
while ($row = Database::fetch_array($res, 'ASSOC')) { while ($row = Database::fetch_array($res, 'ASSOC')) {
if ($withLocalTime == true) {
$row['start_date'] = api_get_local_time($row['start_date']);
}
$tmp[] = $row['thematic_id']; $tmp[] = $row['thematic_id'];
if (in_array($row['thematic_id'], $tmp)) { if (in_array($row['thematic_id'], $tmp)) {
if ($force_session_id) { if ($force_session_id) {

@ -1114,9 +1114,12 @@ $_configuration['profile_fields_visibility'] = [
// Add a minimum time limit to be in the learning path // Add a minimum time limit to be in the learning path
// in order to get the last item completed // in order to get the last item completed
// Requires a DB change: // 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; ALTER TABLE c_lp ADD accumulate_work_time INT NOT NULL;
// CREATE INDEX user_course_session ON track_e_access_complete (user_id, c_id, session_id); 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 course checkbox extra field "new_tracking_system"
// Add session 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" // Only applied for courses/sessions with extra field "new_tracking_system" to "1"

@ -131,6 +131,7 @@ class Meeting
/** /**
* @var Recording[]|ArrayCollection * @var Recording[]|ArrayCollection
*
* @ORM\OneToMany(targetEntity="Recording", mappedBy="meeting", cascade={"persist"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="Recording", mappedBy="meeting", cascade={"persist"}, orphanRemoval=true)
*/ */
protected $recordings; protected $recordings;

@ -26,6 +26,7 @@ class MeetingActivity
/** /**
* @var Meeting * @var Meeting
*
* @ORM\ManyToOne(targetEntity="Meeting", inversedBy="activities") * @ORM\ManyToOne(targetEntity="Meeting", inversedBy="activities")
* @ORM\JoinColumn(name="meeting_id") * @ORM\JoinColumn(name="meeting_id")
*/ */
@ -33,6 +34,7 @@ class MeetingActivity
/** /**
* @var Meeting * @var Meeting
*
* @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User") * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id") * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/ */
@ -40,18 +42,21 @@ class MeetingActivity
/** /**
* @var string * @var string
*
* @ORM\Column(type="string", name="name", length=255, nullable=false) * @ORM\Column(type="string", name="name", length=255, nullable=false)
*/ */
protected $name; protected $name;
/** /**
* @var string * @var string
*
* @ORM\Column(type="string", name="type", length=255, nullable=false) * @ORM\Column(type="string", name="type", length=255, nullable=false)
*/ */
protected $type; protected $type;
/** /**
* @var string * @var string
*
* @ORM\Column(type="text", name="event", nullable=true) * @ORM\Column(type="text", name="event", nullable=true)
*/ */
protected $event; protected $event;

@ -40,6 +40,7 @@ class Recording
/** /**
* @var string * @var string
*
* @ORM\Column(type="integer") * @ORM\Column(type="integer")
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue() * @ORM\GeneratedValue()
@ -48,12 +49,14 @@ class Recording
/** /**
* @var string * @var string
*
* @ORM\Column(type="string") * @ORM\Column(type="string")
*/ */
protected $uuid; protected $uuid;
/** /**
* @var Meeting * @var Meeting
*
* @ORM\ManyToOne(targetEntity="Meeting", inversedBy="recordings") * @ORM\ManyToOne(targetEntity="Meeting", inversedBy="recordings")
* @ORM\JoinColumn(name="meeting_id") * @ORM\JoinColumn(name="meeting_id")
*/ */
@ -61,6 +64,7 @@ class Recording
/** /**
* @var string * @var string
*
* @ORM\Column(type="text", name="recording_meeting_json", nullable=true) * @ORM\Column(type="text", name="recording_meeting_json", nullable=true)
*/ */
protected $recordingMeetingJson; protected $recordingMeetingJson;

@ -123,7 +123,7 @@ class ZoomPlugin extends Plugin
$items[] = [ $items[] = [
'class' => 'video-conference', 'class' => 'video-conference',
'icon' => Display::return_icon( 'icon' => Display::return_icon(
'zoom.png', 'bbb.png',
get_lang('VideoConference') get_lang('VideoConference')
), ),
'link' => $link, 'link' => $link,
@ -450,10 +450,12 @@ class ZoomPlugin extends Plugin
if (!$meeting->getRecordings()->isEmpty()) { if (!$meeting->getRecordings()->isEmpty()) {
$fileIdSelect = $form->addSelect('fileIds', get_lang('Files')); $fileIdSelect = $form->addSelect('fileIds', get_lang('Files'));
$fileIdSelect->setMultiple(true); $fileIdSelect->setMultiple(true);
foreach ($meeting->getRecordings() as &$recording) { $recordingList = $meeting->getRecordings();
foreach ($recordingList as &$recording) {
// $recording->instanceDetails = $plugin->getPastMeetingInstanceDetails($instance->uuid); // $recording->instanceDetails = $plugin->getPastMeetingInstanceDetails($instance->uuid);
$options = []; $options = [];
foreach ($recording->getRecordingMeeting()->recording_files as $file) { $recordings = $recording->getRecordingMeeting()->recording_files;
foreach ($recordings as $file) {
$options[] = [ $options[] = [
'text' => sprintf( 'text' => sprintf(
'%s.%s (%s)', '%s.%s (%s)',
@ -482,8 +484,9 @@ class ZoomPlugin extends Plugin
); );
$form->addButtonUpdate($this->get_lang('DoIt')); $form->addButtonUpdate($this->get_lang('DoIt'));
if ($form->validate()) { if ($form->validate()) {
foreach ($meeting->getRecordings() as $recording) { foreach ($recordingList as $recording) {
foreach ($recording->files as $file) { $recordings = $recording->getRecordingMeeting()->recording_files;
foreach ($recordings as $file) {
if (in_array($file->id, $form->getSubmitValue('fileIds'))) { if (in_array($file->id, $form->getSubmitValue('fileIds'))) {
$name = sprintf( $name = sprintf(
$this->get_lang('XRecordingOfMeetingXFromXDurationXDotX'), $this->get_lang('XRecordingOfMeetingXFromXDurationXDotX'),
@ -607,6 +610,19 @@ class ZoomPlugin extends Plugin
if (false === curl_exec($curl)) { if (false === curl_exec($curl)) {
throw new Exception("curl_exec failed: ".curl_error($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( $newPath = handle_uploaded_document(
$courseInfo, $courseInfo,
[ [
@ -619,19 +635,20 @@ class ZoomPlugin extends Plugin
'/', '/',
api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document', api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document',
api_get_user_id(), api_get_user_id(),
0, $groupId,
null, null,
0, 0,
'', '',
true, true,
false, false,
null, null,
$meeting->getSession()->getId(), $sessionId,
true true
); );
fclose($tmpFile); fclose($tmpFile);
if (false === $newPath) { if (false === $newPath) {
throw new Exception('could not handle uploaded document'); throw new Exception('Could not handle uploaded document');
} }
} }
@ -1223,7 +1240,7 @@ class ZoomPlugin extends Plugin
private function startInstantMeeting($topic, $user = null, $course = null, $group = null, $session = null) private function startInstantMeeting($topic, $user = null, $course = null, $group = null, $session = null)
{ {
$meetingInfoGet = MeetingInfoGet::fromTopicAndType($topic, MeetingInfoGet::TYPE_INSTANT); $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( $meeting = $this->createMeetingFromMeeting(
(new Meeting()) (new Meeting())
->setMeetingInfoGet($meetingInfoGet) ->setMeetingInfoGet($meetingInfoGet)

Loading…
Cancel
Save