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. 5
      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();
// 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);

@ -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'] : '';
/*
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

@ -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);
}
}

@ -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) {

@ -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"

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

@ -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;

@ -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;

@ -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'),
@ -607,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,
[
@ -619,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');
}
}
@ -1223,7 +1240,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)

Loading…
Cancel
Save