From 621fefae922bef53a35adcfc9847d4d9c2a67d3f Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Mon, 9 May 2016 16:31:25 +0200 Subject: [PATCH 01/12] WIP: Add group conference support see BT#11014 --- main/inc/lib/database.lib.php | 9 +++ plugin/bbb/changelog.md | 21 ++++-- plugin/bbb/lib/bbb.lib.php | 105 +++++++++++++++++++++++----- plugin/bbb/lib/bbb_plugin.class.php | 3 +- plugin/bbb/listing.php | 1 + 5 files changed, 115 insertions(+), 24 deletions(-) diff --git a/main/inc/lib/database.lib.php b/main/inc/lib/database.lib.php index 8db2d76600..a4b0eef8d2 100755 --- a/main/inc/lib/database.lib.php +++ b/main/inc/lib/database.lib.php @@ -672,4 +672,13 @@ $connection->executeQuery('set sql_mode=""'); { return self::getManager()->getConnection()->getSchemaManager()->tablesExist($table); } + + /** + * @param $table + * @return \Doctrine\DBAL\Schema\Column[] + */ + public static function listTableColumns($table) + { + return self::getManager()->getConnection()->getSchemaManager()->listTableColumns($table); + } } diff --git a/plugin/bbb/changelog.md b/plugin/bbb/changelog.md index 6d94acb6b7..86ed797e33 100644 --- a/plugin/bbb/changelog.md +++ b/plugin/bbb/changelog.md @@ -1,10 +1,18 @@ -version 2.3 - 2015-05-18 +Version 2.4 +------------------------ +Changes: + +* Global conference support (Requires to turn on, in plugin settings) +* Course group conference support. + * Requires a DB change: "ALTER TABLE plugin_bbb_meeting ADD COLUMN group_id INT DEFAULT 0" + +Version 2.3 - 2015-05-18 ------------------------ Changes: * Added support for variable voiceBridge to be sent on meeting creation. See https://code.google.com/p/bigbluebutton/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Component%20Summary&groupby=&sort=&id=1186 and https://support.chamilo.org/issues/7669 for details. -* Requires you to "ALTER TABLE plugin_bbb_meeting ADD COLUMN voice_bridge INT NOT NULL DEFAULT 1;" +* Requires a DB change: "ALTER TABLE plugin_bbb_meeting ADD COLUMN voice_bridge INT NOT NULL DEFAULT 1;" -version 2.2 - 2014-10-15 +Version 2.2 - 2014-10-15 ------------------------ Changes: * Add a pseudo-random guid to avoid clashing conferences when several Chamilo portals use the same server. If you were using this plugin before, you will have to update the plugin_bbb_meeting table to "alter table plugin_bbb_meeting add column remote_id char(36);". @@ -13,16 +21,15 @@ Changes: * Hide the ID of the meeting (this was an internal ID, useless to the final user). It is still in the HTML source, however * Show number of minutes of the recording (in the recordings list) -version 2.1 +Version 2.1 ----------- Released with: Chamilo LMS 1.9.8 Changes: * now supports sessions (requires you to "alter table plugin_bbb_meeting add column session_id int default 0;") -version 2.0 +Version 2.0 ----------- -(to be described) -version 1.0 +Version 1.0 ----------- Released with: Chamilo LMS 1.9.0 diff --git a/plugin/bbb/lib/bbb.lib.php b/plugin/bbb/lib/bbb.lib.php index 418fd58721..10b35ac0f4 100755 --- a/plugin/bbb/lib/bbb.lib.php +++ b/plugin/bbb/lib/bbb.lib.php @@ -27,6 +27,7 @@ class bbb public $pluginEnabled = false; public $enableGlobalConference = false; public $isGlobalConference = false; + public $groupSupport = false; /** * Constructor (generates a connection to the API and the Chamilo settings @@ -49,6 +50,9 @@ class bbb $this->enableGlobalConference = $plugin->get('enable_global_conference'); $this->isGlobalConference = (bool) $isGlobalConference; + $columns = Database::listTableColumns($this->table); + $this->groupSupport = isset($columns['group_id']) ? true : false; + if ($bbbPlugin === true) { $userInfo = api_get_user_info(); $this->user_complete_name = $userInfo['complete_name']; @@ -90,6 +94,14 @@ class bbb return (bool) $this->isGlobalConference; } + /** + * @return bool + */ + public function hasGroupSupport() + { + return $this->groupSupport; + } + /** * Checks whether a user is teacher in the current course * @return bool True if the user can be considered a teacher in this course, false otherwise @@ -137,6 +149,10 @@ class bbb $params['c_id'] = api_get_course_int_id(); $params['session_id'] = api_get_session_id(); + if ($this->hasGroupSupport()) { + $params['group_id'] = api_get_group_id(); + } + $params['attendee_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : $courseCode; $attendeePassword = $params['attendee_pw']; $params['moderator_pw'] = isset($params['moderator_pw']) ? $params['moderator_pw'] : $this->getModMeetingPassword(); @@ -166,7 +182,7 @@ class bbb error_log("create_meeting: $id "); } - $meetingName = isset($params['meeting_name']) ? $params['meeting_name'] : api_get_course_id().'-'.api_get_session_id(); + $meetingName = isset($params['meeting_name']) ? $params['meeting_name'] : $this->getCurrentVideoConferenceName(); $welcomeMessage = isset($params['welcome_msg']) ? $params['welcome_msg'] : null; $record = isset($params['record']) && $params['record'] ? 'true' : 'false'; $duration = isset($params['duration']) ? intval($params['duration']) : 0; @@ -235,17 +251,31 @@ class bbb $courseId = api_get_course_int_id(); $sessionId = api_get_session_id(); + $conditions = array( + 'where' => array( + 'c_id = ? AND session_id = ? AND meeting_name = ? AND status = 1 ' => + array($courseId, $sessionId, $meetingName) + ) + ); + + if ($this->hasGroupSupport()) { + $groupId = api_get_group_id(); + $conditions = array( + 'where' => array( + 'c_id = ? AND session_id = ? AND meeting_name = ? AND group_id = ? AND status = 1 ' => + array($courseId, $sessionId, $meetingName, $groupId) + ) + ); + } + $meetingData = Database::select( '*', $this->table, - array( - 'where' => array( - 'c_id = ? AND session_id = ? AND meeting_name = ? AND status = 1 ' => - array($courseId, $sessionId, $meetingName) - ) - ), + $conditions, 'first' ); + + if ($this->debug) { error_log("meeting_exists ".print_r($meetingData, 1)); } @@ -396,17 +426,32 @@ class bbb public function getMeetings() { $pass = $this->getUserMeetingPassword(); + $courseId = api_get_course_int_id(); + $sessionId = api_get_session_id(); + + $conditions = array( + 'where' => array( + 'c_id = ? AND session_id = ? ' => array( + $courseId, + $sessionId, + ), + ), + ); + + if ($this->hasGroupSupport()) { + $groupId = api_get_group_id(); + $conditions = array( + 'where' => array( + 'c_id = ? AND session_id = ? AND group_id = ? ' => + array($courseId, $sessionId, $groupId) + ) + ); + } + $meetingList = Database::select( '*', $this->table, - array( - 'where' => array( - 'c_id = ? AND session_id = ? ' => array( - api_get_course_int_id(), - api_get_session_id(), - ), - ), - ) + $conditions ); $isGlobal = $this->isGlobalConference(); $newMeetingList = array(); @@ -732,12 +777,35 @@ class bbb { $courseId = api_get_course_int_id(); $sessionId = api_get_session_id(); + + $conditions = array( + 'where' => array( + 'c_id = ? AND session_id = ? AND status = 1 ' => array( + $courseId, + $sessionId, + ), + ), + ); + + if ($this->hasGroupSupport()) { + $groupId = api_get_group_id(); + $conditions = array( + 'where' => array( + 'c_id = ? AND session_id = ? AND group_id = ? AND status = 1 ' => array( + $courseId, + $sessionId, + $groupId + ), + ), + ); + } $meetingData = Database::select( '*', $this->table, - array('where' => array('c_id = ? AND session_id = ? AND status = 1 ' => array($courseId, $sessionId))), + $conditions, 'first' ); + if (empty($meetingData)) { return 0; } @@ -926,6 +994,11 @@ class bbb return 'url_'.api_get_current_access_url_id(); } + if ($this->hasGroupSupport()) { + + return api_get_course_id().'-'.api_get_session_id().'-'.api_get_group_id(); + } + return api_get_course_id().'-'.api_get_session_id(); } diff --git a/plugin/bbb/lib/bbb_plugin.class.php b/plugin/bbb/lib/bbb_plugin.class.php index 8ad9fb41fd..9e7ff4e75a 100755 --- a/plugin/bbb/lib/bbb_plugin.class.php +++ b/plugin/bbb/lib/bbb_plugin.class.php @@ -30,7 +30,7 @@ class BBBPlugin extends Plugin protected function __construct() { parent::__construct( - '2.3', + '2.4', 'Julio Montoya, Yannick Warnier', [ 'tool_enable' => 'boolean', @@ -59,6 +59,7 @@ class BBBPlugin extends Plugin $sql = "CREATE TABLE IF NOT EXISTS $table ( id INT unsigned NOT NULL auto_increment PRIMARY KEY, c_id INT unsigned NOT NULL DEFAULT 0, + group_id INT unsigned NOT NULL DEFAULT 0, meeting_name VARCHAR(255) NOT NULL DEFAULT '', attendee_pw VARCHAR(255) NOT NULL DEFAULT '', moderator_pw VARCHAR(255) NOT NULL DEFAULT '', diff --git a/plugin/bbb/listing.php b/plugin/bbb/listing.php index 195e7d9854..b059157a93 100755 --- a/plugin/bbb/listing.php +++ b/plugin/bbb/listing.php @@ -105,6 +105,7 @@ if ($conferenceManager) { break; } } + $meetings = $bbb->getMeetings(); if (!empty($meetings)) { From 45a64220ef6839ae79f584ba5ca58422b2d84a89 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Mon, 9 May 2016 10:19:51 -0500 Subject: [PATCH 02/12] Fix display issue in forum category style when adding an image aligned left - refs CT#8214 --- app/Resources/public/css/base.css | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index eb2042a429..8722e9a3f4 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -2964,6 +2964,9 @@ a:active{ tr.forum_category_header a { color: #fff; } +.forum-description { + display: inline-block; +} /* **** FORUM **** */ .forum_header { background-color: #EEF; @@ -5880,4 +5883,4 @@ a.sessionView { border: 2px dashed #bbbbbb; font-size: 120%; margin-bottom: 0; -} \ No newline at end of file +} From 911a81e0201b648ef39756c24794ace8d61d6e46 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Mon, 9 May 2016 10:33:52 -0500 Subject: [PATCH 03/12] Fix table when exporting gradebook tool to PDf - refs #8218 --- main/gradebook/gradebook_flatview.php | 12 +++- main/gradebook/lib/fe/displaygradebook.php | 71 ++++++++++++++++++---- 2 files changed, 68 insertions(+), 15 deletions(-) diff --git a/main/gradebook/gradebook_flatview.php b/main/gradebook/gradebook_flatview.php index c334a28396..08840df90b 100755 --- a/main/gradebook/gradebook_flatview.php +++ b/main/gradebook/gradebook_flatview.php @@ -154,9 +154,15 @@ if (isset($_GET['exportpdf'])) { 'name' => get_lang('FlatView') ); - $pageNum = isset($_GET['flatviewlist_page_nr']) ? intval($_GET['flatviewlist_page_nr']) : ''; - $perPage = isset($_GET['flatviewlist_per_page']) ? intval($_GET['flatviewlist_per_page']) : ''; - $url = api_get_self().'?exportpdf=&offset='.$offset.'&selectcat='.intval($_GET['selectcat']).'&'.api_get_cidreq().'&flatviewlist_page_nr='.$pageNum.'&flatviewlist_per_page='.$perPage; + $pageNum = isset($_GET['flatviewlist_page_nr']) ? intval($_GET['flatviewlist_page_nr']) : null; + $perPage = isset($_GET['flatviewlist_per_page']) ? intval($_GET['flatviewlist_per_page']) : null; + $url = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ + 'exportpdf' => '', + 'offset' => $offset, + 'selectcat' => intval($_GET['selectcat']), + 'flatviewlist_page_nr' => $pageNum, + 'flatviewlist_per_page' => $perPage + ]); $export_pdf_form = new DataForm( DataForm::TYPE_EXPORT_PDF, diff --git a/main/gradebook/lib/fe/displaygradebook.php b/main/gradebook/lib/fe/displaygradebook.php index 6b2af301e1..4a6654a62d 100755 --- a/main/gradebook/lib/fe/displaygradebook.php +++ b/main/gradebook/lib/fe/displaygradebook.php @@ -189,20 +189,67 @@ class DisplayGradebook $header .= '' . Display::return_icon('back.png', get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . ''; - $pageNum = isset($_GET['flatviewlist_page_nr']) ? intval($_GET['flatviewlist_page_nr']) : ''; - $perPage = isset($_GET['flatviewlist_per_page']) ? intval($_GET['flatviewlist_per_page']) : ''; + $pageNum = isset($_GET['flatviewlist_page_nr']) ? intval($_GET['flatviewlist_page_nr']) : null; + $perPage = isset($_GET['flatviewlist_per_page']) ? intval($_GET['flatviewlist_per_page']) : null; $offset = isset($_GET['offset']) ? $_GET['offset'] : '0'; - $header .= '' . - Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM) . ''; - $header .= '' . - Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM) . ''; - $header .= '' . - Display::return_icon('export_doc.png', get_lang('ExportAsDOC'), '', ICON_SIZE_MEDIUM) . ''; - $header .= '' . - Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM) . ''; - $header .= '' . - Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM) . ''; + $exportCsvUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ + 'export_format' => 'csv', + 'export_report' => 'export_report', + 'selectcat' => $catobj->get_id() + ]); + + $header .= Display::url( + Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM), + $exportCsvUrl + ); + + $exportXlsUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ + 'export_format' => 'xls', + 'export_report' => 'export_report', + 'selectcat' => $catobj->get_id() + ]); + + $header .= Display::url( + Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM), + $exportXlsUrl + ); + + $exportDocUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ + 'export_format' => 'doc', + 'export_report' => 'export_report', + 'selectcat' => $catobj->get_id() + ]); + + $header .= Display::url( + Display::return_icon('export_doc.png', get_lang('ExportAsDOC'), '', ICON_SIZE_MEDIUM), + $exportDocUrl + ); + + $exportPrintUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ + 'print' => '', + 'selectcat' => $catobj->get_id(), + ]); + + $header .= Display::url( + Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM), + $exportPrintUrl, + ['target' => '_blank'] + ); + + $exportPdfUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ + 'exportpdf' => '', + 'selectcat' => $catobj->get_id(), + 'offset' => $offset, + 'flatviewlist_page_nr' => $pageNum, + 'flatviewlist_per_page' => $perPage + ]); + + $header .= Display::url( + Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM), + $exportPdfUrl + ); + $header .= ''; echo $header; } From 91ebd4677be9f6ebd7965dd3d84cd3cb3ece50b4 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Mon, 9 May 2016 17:06:08 -0500 Subject: [PATCH 04/12] Add section about PHP limits to optimization guide - refs CT#8225 --- documentation/optimization.html | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/documentation/optimization.html b/documentation/optimization.html index 84fb71dcb7..e0c23cbea0 100755 --- a/documentation/optimization.html +++ b/documentation/optimization.html @@ -56,6 +56,7 @@
  • IGBinary for faster courses backups and better sessions
  • Removing files download permissions check
  • MySQL/MariaDB compression
  • +
  • Increasing PHP limits
  • 1. Using opcaches

    @@ -598,13 +599,42 @@ In 1.10.0, we have added the possibility to enable this compression very This should have an immediate effect on the load average on your server.


    +

    Increasing PHP limits

    +

    + As your use of Chamilo increases and you get above the thousands of users, + you're likely to hit a few milestones set by PHP to avoid hacks. + One of them is PHP5.4's Suhosin extension limit post_max_vars, which was + extended into PHP5.5 and above through the max_input_vars limit. This limit + is usually set to 1000. What does it mean?
    + It means that, when you manipulate any list greater than 1000 items, PHP will + automatically remove anything sent above the first 1000 registers (usually + a little bit less because it needs to add the other input fields of the page). + For example, if subscribing 5 new users to a course where you already have + 1000 users subscribed, you will remain at 1000, although the 1000 will not + necessarily be the 1000 that were there in the first place (they are sent + in order of the elements inside the form, so probably alphabetically, + depending on the page).

    + Increasing this limit to a higher level (say 10,000 instead of 1000) should + be relatively safe, considering your application is normally not open to + the public (and so also open to the evil kind of users). So, in your + php.ini, this limit should now look like this:
    +

    +    max_input_vars = 10000
    +    


    + A number of other limits might also become an issue in the long run, like + memory_limit, post_max_size, etc. We have given reasonnable recommendations + in the installation process for these values, but remember that if you + have a larger portal than anyone else, you probably need to give it more + care than anyone else. +

    +

    Authors


    Don't have time or resources to optimize your Chamilo installation - yourself? Hire an official Chamilo provider and get it sorted out professionally by specialists. + yourself? Hire an official Chamilo provider and get it sorted out professionally by specialists.
    Valid XHTML 1.0 Transitional Valid CSS From 0111ccbc6b3aff96fac56cf64fe209d035f655a8 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 10 May 2016 10:23:11 +0200 Subject: [PATCH 05/12] Update function api_get_cidreq typos --- main/exercice/admin.php | 6 +++--- main/exercice/exercise_admin.php | 2 +- main/exercice/question_pool.php | 2 +- main/exercice/upload_exercise.php | 4 ++-- main/gradebook/gradebook_display_certificate.php | 6 +++--- main/gradebook/gradebook_display_summary.php | 2 +- main/group/group_category.php | 4 ++-- main/group/group_edit.php | 4 ++-- main/group/group_overview.php | 2 +- main/group/group_space.php | 3 +-- main/group/member_settings.php | 2 +- main/group/settings.php | 4 ++-- main/group/tutor_settings.php | 4 ++-- main/newscorm/index.php | 2 +- main/survey/index.php | 2 +- main/survey/survey_invite.php | 2 +- 16 files changed, 25 insertions(+), 26 deletions(-) diff --git a/main/exercice/admin.php b/main/exercice/admin.php index 828b9df3fb..095a2c2865 100755 --- a/main/exercice/admin.php +++ b/main/exercice/admin.php @@ -363,11 +363,11 @@ $inATest = isset($exerciseId) && $exerciseId > 0; if ($inATest) { echo '
    '; if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) - echo ''. + echo ''. Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).''; if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) { - echo ''. + echo ''. Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).''; } echo ''. @@ -375,7 +375,7 @@ if ($inATest) { echo Display::url( Display::return_icon('test_results.png', get_lang('Results'),'',ICON_SIZE_MEDIUM), - api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidReq().'&exerciseId='.$objExercise->id + api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id ); echo ''. diff --git a/main/exercice/exercise_admin.php b/main/exercice/exercise_admin.php index 69905a7d64..8606d97210 100755 --- a/main/exercice/exercise_admin.php +++ b/main/exercice/exercise_admin.php @@ -187,7 +187,7 @@ if ($form->validate()) { echo '
    '; if ($objExercise->id != 0) { - echo '' . + echo '' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).''; } else { if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])){ diff --git a/main/exercice/question_pool.php b/main/exercice/question_pool.php index ace1c07a52..190fcf563b 100755 --- a/main/exercice/question_pool.php +++ b/main/exercice/question_pool.php @@ -219,7 +219,7 @@ if (isset($fromExercise) && $fromExercise > 0) { Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).''; $titleAdd = get_lang('AddQuestionToTest'); } else { - echo ''. + echo ''. Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).''; echo "".Display::return_icon('add_question.gif', get_lang('NewQu'), '', ICON_SIZE_MEDIUM).""; $titleAdd = get_lang('ManageAllQuestions'); diff --git a/main/exercice/upload_exercise.php b/main/exercice/upload_exercise.php index 11da44db4f..aac9a6d76e 100755 --- a/main/exercice/upload_exercise.php +++ b/main/exercice/upload_exercise.php @@ -58,7 +58,7 @@ lp_upload_quiz_main(); function lp_upload_quiz_actions() { - $return = ''. + $return = ''. Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).''; return $return; } @@ -622,7 +622,7 @@ function lp_upload_quiz_action_handling() { exit; } else { // header('location: exercice.php?' . api_get_cidreq()); - echo ''; + echo ''; } } } diff --git a/main/gradebook/gradebook_display_certificate.php b/main/gradebook/gradebook_display_certificate.php index 802f47ca13..0e58fe362b 100755 --- a/main/gradebook/gradebook_display_certificate.php +++ b/main/gradebook/gradebook_display_certificate.php @@ -181,15 +181,15 @@ if ($filter === 'true') { } echo '
    '; -$url = api_get_self().'?action=generate_all_certificates'.'&'.api_get_cidReq().'&cat_id='.$cat_id.'&filter='.$filterOfficialCode; +$url = api_get_self().'?action=generate_all_certificates'.'&'.api_get_cidreq().'&cat_id='.$cat_id.'&filter='.$filterOfficialCode; echo Display::url(get_lang('GenerateCertificates'), $url, array('class' => 'btn btn-default')); -$url = api_get_self().'?action=delete_all_certificates'.'&'.api_get_cidReq().'&cat_id='.$cat_id.'&filter='.$filterOfficialCode; +$url = api_get_self().'?action=delete_all_certificates'.'&'.api_get_cidreq().'&cat_id='.$cat_id.'&filter='.$filterOfficialCode; echo Display::url(get_lang('DeleteAllCertificates'), $url, array('class' => 'btn btn-default')); $hideCertificateExport = api_get_setting('hide_certificate_export_link'); if (count($certificate_list) > 0 && $hideCertificateExport !== 'true') { - $url = api_get_self().'?action=export_all_certificates'.'&'.api_get_cidReq().'&cat_id='.$cat_id.'&filter='.$filterOfficialCode; + $url = api_get_self().'?action=export_all_certificates'.'&'.api_get_cidreq().'&cat_id='.$cat_id.'&filter='.$filterOfficialCode; echo Display::url(get_lang('ExportAllCertificatesToPDF'), $url, array('class' => 'btn btn-default')); } echo '
    '; diff --git a/main/gradebook/gradebook_display_summary.php b/main/gradebook/gradebook_display_summary.php index c531be4e62..9ad2f63543 100644 --- a/main/gradebook/gradebook_display_summary.php +++ b/main/gradebook/gradebook_display_summary.php @@ -126,7 +126,7 @@ echo Display::page_header(get_lang('GradebookListOfStudentsReports')); echo '
    '; if (count($userList) > 0) { - $url = api_get_self().'?action=export_all&'.api_get_cidReq().'&selectcat='.$cat_id; + $url = api_get_self().'?action=export_all&'.api_get_cidreq().'&selectcat='.$cat_id; echo Display::url(get_lang('ExportAllToPDF'), $url, array('class' => 'btn btn-default')); } echo '
    '; diff --git a/main/group/group_category.php b/main/group/group_category.php index f7dc335439..ae54ebf406 100755 --- a/main/group/group_category.php +++ b/main/group/group_category.php @@ -80,7 +80,7 @@ $(document).ready( function() { }); '; -$interbreadcrumb[] = array('url' => 'group.php?'.api_get_cidReq(), 'name' => get_lang('Groups')); +$interbreadcrumb[] = array('url' => 'group.php?'.api_get_cidreq(), 'name' => get_lang('Groups')); $course_id = api_get_course_int_id(); @@ -91,7 +91,7 @@ if (isset($_GET['id'])) { $form = new FormValidator( 'group_category', 'post', - api_get_self().'?id='.$category['id'].'&'.api_get_cidReq() + api_get_self().'?id='.$category['id'].'&'.api_get_cidreq() ); $form->addElement('hidden', 'id'); } else { diff --git a/main/group/group_edit.php b/main/group/group_edit.php index 9cbd454fd8..99892cbaf2 100755 --- a/main/group/group_edit.php +++ b/main/group/group_edit.php @@ -22,8 +22,8 @@ $group_id = api_get_group_id(); $current_group = GroupManager :: get_group_properties($group_id); $nameTools = get_lang('EditGroup'); -$interbreadcrumb[] = array ('url' => 'group.php?'.api_get_cidReq(), 'name' => get_lang('Groups')); -$interbreadcrumb[] = array ('url' => 'group_space.php?'.api_get_cidReq(), 'name' => $current_group['name']); +$interbreadcrumb[] = array ('url' => 'group.php?'.api_get_cidreq(), 'name' => get_lang('Groups')); +$interbreadcrumb[] = array ('url' => 'group_space.php?'.api_get_cidreq(), 'name' => $current_group['name']); $is_group_member = GroupManager :: is_tutor_of_group(api_get_user_id(), $group_id); diff --git a/main/group/group_overview.php b/main/group/group_overview.php index 683822ca49..3dc8ea9707 100755 --- a/main/group/group_overview.php +++ b/main/group/group_overview.php @@ -64,7 +64,7 @@ if (isset($_GET['action'])) { } /* Header */ -$interbreadcrumb[] = array('url' => 'group.php?'.api_get_cidReq(), 'name' => get_lang('Groups')); +$interbreadcrumb[] = array('url' => 'group.php?'.api_get_cidreq(), 'name' => get_lang('Groups')); if (!isset ($_GET['origin']) || $_GET['origin'] != 'learnpath') { // So we are not in learnpath tool if (!$is_allowed_in_course) { diff --git a/main/group/group_space.php b/main/group/group_space.php index dc05184b86..9187178cb5 100755 --- a/main/group/group_space.php +++ b/main/group/group_space.php @@ -20,7 +20,6 @@ require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php'; require_once api_get_path(SYS_CODE_PATH).'forum/forumconfig.inc.php'; /* MAIN CODE */ - $group_id = api_get_group_id(); $user_id = api_get_user_id(); $current_group = GroupManager::get_group_properties($group_id); @@ -30,7 +29,7 @@ if (empty($current_group)) { $this_section = SECTION_COURSES; $nameTools = get_lang('GroupSpace'); -$interbreadcrumb[] = array('url' => 'group.php?'.api_get_cidReq(), 'name' => get_lang('Groups')); +$interbreadcrumb[] = array('url' => 'group.php?'.api_get_cidreq(), 'name' => get_lang('Groups')); /* Ensure all private groups // Juan Carlos Raña Trabado */ diff --git a/main/group/member_settings.php b/main/group/member_settings.php index c4ce3bf299..5fd9b66ddb 100755 --- a/main/group/member_settings.php +++ b/main/group/member_settings.php @@ -23,7 +23,7 @@ $current_group = GroupManager::get_group_properties($group_id); $nameTools = get_lang('EditGroup'); $interbreadcrumb[] = array('url' => 'group.php', 'name' => get_lang('Groups')); -$interbreadcrumb[] = array('url' => 'group_space.php?'.api_get_cidReq(), 'name' => $current_group['name']); +$interbreadcrumb[] = array('url' => 'group_space.php?'.api_get_cidreq(), 'name' => $current_group['name']); $is_group_member = GroupManager::is_tutor_of_group(api_get_user_id(), $group_id); diff --git a/main/group/settings.php b/main/group/settings.php index b477e0e13f..c6316e0434 100755 --- a/main/group/settings.php +++ b/main/group/settings.php @@ -21,8 +21,8 @@ $group_id = api_get_group_id(); $current_group = GroupManager::get_group_properties($group_id); $nameTools = get_lang('EditGroup'); -$interbreadcrumb[] = array('url' => 'group.php?'.api_get_cidReq(), 'name' => get_lang('Groups')); -$interbreadcrumb[] = array('url' => 'group_space.php?'.api_get_cidReq(), 'name' => $current_group['name']); +$interbreadcrumb[] = array('url' => 'group.php?'.api_get_cidreq(), 'name' => get_lang('Groups')); +$interbreadcrumb[] = array('url' => 'group_space.php?'.api_get_cidreq(), 'name' => $current_group['name']); $is_group_member = GroupManager::is_tutor_of_group(api_get_user_id(), $group_id); if (!api_is_allowed_to_edit(false, true) && !$is_group_member) { diff --git a/main/group/tutor_settings.php b/main/group/tutor_settings.php index ea2e934d18..1dff16728d 100755 --- a/main/group/tutor_settings.php +++ b/main/group/tutor_settings.php @@ -22,8 +22,8 @@ $group_id = api_get_group_id(); $current_group = GroupManager :: get_group_properties($group_id); $nameTools = get_lang('EditGroup'); -$interbreadcrumb[] = array ('url' => 'group.php?'.api_get_cidReq(), 'name' => get_lang('Groups')); -$interbreadcrumb[] = array ('url' => 'group_space.php?'.api_get_cidReq(), 'name' => $current_group['name']); +$interbreadcrumb[] = array ('url' => 'group.php?'.api_get_cidreq(), 'name' => get_lang('Groups')); +$interbreadcrumb[] = array ('url' => 'group_space.php?'.api_get_cidreq(), 'name' => $current_group['name']); $is_group_member = GroupManager :: is_tutor_of_group(api_get_user_id(), $group_id); diff --git a/main/newscorm/index.php b/main/newscorm/index.php index 0f74a29f4a..a00496b590 100755 --- a/main/newscorm/index.php +++ b/main/newscorm/index.php @@ -10,4 +10,4 @@ $use_anonymous = true; require_once '../inc/global.inc.php'; -header('location: lp_controller.php?'.api_get_cidReq().'&action=list'); +header('location: lp_controller.php?'.api_get_cidreq().'&action=list'); diff --git a/main/survey/index.php b/main/survey/index.php index b1ca097541..174342ce24 100755 --- a/main/survey/index.php +++ b/main/survey/index.php @@ -1,4 +1,4 @@ 0 && !isset($_POST['submit'])) { $form = new FormValidator( 'publish_form', 'post', - api_get_self().'?survey_id='.$survey_id.'&'.api_get_cidReq() + api_get_self().'?survey_id='.$survey_id.'&'.api_get_cidreq() ); $form->addElement('header', '', $tool_name); From 92218a89a43e1e08a2fa5a999377e60842cfcf93 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 10 May 2016 10:47:07 +0200 Subject: [PATCH 06/12] Add link in group_space if tool is enabled + group setting is on. BT#11014 Added bbb plugin setting "enable_conference_in_course_groups". --- main/group/group_space.php | 11 +++++++++ main/img/icons/32/bbb.png | Bin 0 -> 1793 bytes main/img/icons/32/bbb_na.png | Bin 0 -> 946 bytes plugin/bbb/changelog.md | 11 +++++---- plugin/bbb/lib/bbb.lib.php | 6 ++++- plugin/bbb/lib/bbb_plugin.class.php | 36 +++++++++++++++------------- 6 files changed, 41 insertions(+), 23 deletions(-) create mode 100644 main/img/icons/32/bbb.png create mode 100644 main/img/icons/32/bbb_na.png diff --git a/main/group/group_space.php b/main/group/group_space.php index 9187178cb5..84b5a27433 100755 --- a/main/group/group_space.php +++ b/main/group/group_space.php @@ -204,6 +204,17 @@ if (api_is_allowed_to_edit(false, true) || } } + $enabled = api_get_plugin_setting('bbb', 'tool_enable'); + if ($enabled === 'true') { + $bbb = new bbb(); + if ($bbb->hasGroupSupport()) { + $actions_array[] = array( + 'url' => api_get_path(WEB_PLUGIN_PATH)."bbb/start.php?".api_get_cidreq(), + 'content' => Display::return_icon('bbb.png', get_lang('VideoConference'), array(), 32) + ); + } + } + if (!empty($actions_array)) { echo Display::actions($actions_array); } diff --git a/main/img/icons/32/bbb.png b/main/img/icons/32/bbb.png new file mode 100644 index 0000000000000000000000000000000000000000..6810a03756a474e1b86ebe389fe2194550bec2d8 GIT binary patch literal 1793 zcmV+c2mbhpP)o)4y%&5x{{L?+_Ja4dibh{Lc76PnZ+!bb^AZ2-0LI40I-@VV7%LVElnOZt#Uhz(wi=7YuPVf3*LBD0&E~~=qcz@aHYdvq zi?fe^_S4P(3c%OD^S$&(5A3d;S<-NNdYPM>V{T@eTBS_TZDJFUwhgjLn|wM+Z#F}^ zrw2P0ZwOtV4W*p)ykOi5f{Ri{W16l{=JTa12lw1tTNA(w$9{2VJ{3PVWesA+lej^I z8%q38;YZ*pffp)Tu1Bp_W3e(%y;8<+ETDT0;>x4PkYpV}Heu7(-$$f$_U${EKCt)R z#)^-z8bEI*JzTHXFb9(aQW46CP%5N~2xUau4O!|2v^lCCLM@Cq z=Xx}oZSJ2wP12obWb@WO;PwDL$>gS)xp_>(BNIbg*HtuBvJ}-LlHFr zhOXfl8kVl135X&^WIE&xgKD+Qj_r3Z-RQF_Kq3(zX}JMC3Tke^=;;||>K-G7IJ<{4 z#7!LlUq-lrr0q+ZZb;J$Y59_d7Z61t1o&Y{IuTKclsDYpzpy3%$FfFRfucO$fJu80(jl- z;Mv8HPaPWMjma8+nW6&~t%hX!JM+J+^@m5JZYFT85A^0wATjbh}*~+nQJt zz?Z)EO}o0ZnA^R1h#&r8g87z@t}Tac<-VdoMpWBAm6nff2ojcoyao{|KxkxzOTF15 znM#bW31H`k?&z!4YK&e`cxLh@(_2Xs5J*L>8?Z8669T0PvYJP;)n@(1p^LW#_|bDe zBOZ6wO;2A%WHyi#8ZuHu*Gj4)P$-nTHHe`JQjS5=(lK?75Q9R?!*e}KeWeMd6hesA z0Y3BS5nlfFs~gLW4(m4-P=SvO6=4`HUs54MNf<`RYn#&woULn=Qa1UxManU-bPX?p z?5sx>*t})S)Q#q=wm=9r*CNT#P==t}T{a4q(=KI%3>1Ns%j0WsC`Bn|QA$|k9g~!; zV+ujDn4BjiBNp!vM>+%D2qSyI;KY%i|n=_|Wsf z^8jZj%GUY6y}6~+>FlyBdtYOzvcp_-x0TQRDIS_JDxQnX=J5(e!hv-->(-IWq$xQD zY2aL^f$w?PiR8?h01iKV=pUXxxS`|&Z!4wFKKcD0v}R|o&JGWM;9FByXTCdq^-ABs zx*_s`PwnlusHS?D3ni}$L2tgq(9kgRm3dsZOTKU5!kPeXrJuiieAg47f8uz%*~m>z zUE$Qp-!3o12$mKX5ePI*$1qJa%i`$KqhGBwr|zDbJ-f@T`Wr0UVPxxF&-}~3WB^Z( zzPSC=?_ND!U09%6tzz32&1Q>sr-SSHNGUN4lTro25V&rKR3b(u zoxpWHYPB|V0*N4Epnr&;JpCMp9(w4{zVAPJ;`l2U0rj5(+!SEbvU`tw z;*)p9V%C1!w)Uq}$$Jv<*uXpQj3LpU8h!SeFF)|$gNv`7IPsnzq{OuqmD#yx@AgLy jA9(;synnv@ztGkdg00002VoOIv0RM-N z%)bBt010qNS#tmY3ljhU3ljkVnw%H_000McNliru-~|c@Di@z-#$f;e14BtfK~zY` z-IYsh8$}q$f3v$@uh;81kGf4Apl>UsJW`a3lt{hs5QrXlTncBzwHHnt5T~Btg18`Y zLqNmOsv_st9b zQ}!hQ7w$_Vc6NVy%c|68%5#^?AN&6bP;7mX%8_F){VVnYCI4n)x>0mX)#W$be*kzt zd!|;wq0AChJTxpaWErH7R6|>qrJxv2%bR*>&)k!>9)PcoXa59?h>!?LOhk(sRaS6m zBQQzfuph-lcA^1bYzOo|daEc zM|DCJXe2NY#OP#LU~FwevjgB9^@wTl3v2A-FeVTY65!(z;Gqz-$q@(nY7c;Uv`v}s z8RZEg0zyInG!h6BgtTcBVn9Wx9)S2joifiLy4gcaOpHVlAv+$0HovLa0q{m{^CCs& zaEUv)8>FxhL`WiHK;V;{?E!cRCg0MR!WgXM^VFNcy@EF3wWLH4%InG z)X6sLmMtR2Ad7>Afn*&h%!}PM5XagS@H@io7)1sLha`d)Gw7VI^eAFjP^@AzK$4iC za~~uT3DRV+u`swzj9C+{UVyJpXu-+ak&+f-Vc{@H27?GeiWD|!bXJHk%Uh~0;2X|P zF$FW`?}gU5Ik9#!e&m|1)52khJQ)T^W8f2DFZBSN?X-v5TvLC1*j!pZ@ZS6fi^C%* zZjm7Z_V6GTeD+=M0obx{$IoAMhvvD0La~ZKkig*FJGI9a#_I=@6h8gSCk>{?e)z4* z3Q63~eMsOi#4M+7<$mnD^3?TwbM)#x0B$5c5xc@cYtn*&B0e6PEDGV*~jht4b(@Uzy0j$rThM{1P1-5#$I}wH2+7t19)Xr U&bGy3m;e9(07*qoM6N<$g4C3zjsO4v literal 0 HcmV?d00001 diff --git a/plugin/bbb/changelog.md b/plugin/bbb/changelog.md index 86ed797e33..edf37fe39f 100644 --- a/plugin/bbb/changelog.md +++ b/plugin/bbb/changelog.md @@ -1,16 +1,17 @@ -Version 2.4 +Version 2.4 2016-05 ------------------------ Changes: -* Global conference support (Requires to turn on, in plugin settings) -* Course group conference support. - * Requires a DB change: "ALTER TABLE plugin_bbb_meeting ADD COLUMN group_id INT DEFAULT 0" +* Global conference support (Requires to update the plugin settings). +* Course group conference support + * Requires a database change: "ALTER TABLE plugin_bbb_meeting ADD COLUMN group_id INT DEFAULT 0" + * Requires to update the plugin settings. Version 2.3 - 2015-05-18 ------------------------ Changes: * Added support for variable voiceBridge to be sent on meeting creation. See https://code.google.com/p/bigbluebutton/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Component%20Summary&groupby=&sort=&id=1186 and https://support.chamilo.org/issues/7669 for details. -* Requires a DB change: "ALTER TABLE plugin_bbb_meeting ADD COLUMN voice_bridge INT NOT NULL DEFAULT 1;" +* Requires a database change: "ALTER TABLE plugin_bbb_meeting ADD COLUMN voice_bridge INT NOT NULL DEFAULT 1;" Version 2.2 - 2014-10-15 ------------------------ diff --git a/plugin/bbb/lib/bbb.lib.php b/plugin/bbb/lib/bbb.lib.php index 10b35ac0f4..8c7597521a 100755 --- a/plugin/bbb/lib/bbb.lib.php +++ b/plugin/bbb/lib/bbb.lib.php @@ -53,6 +53,10 @@ class bbb $columns = Database::listTableColumns($this->table); $this->groupSupport = isset($columns['group_id']) ? true : false; + if ($this->groupSupport) { + $this->groupSupport = (bool) $plugin->get('enable_conference_in_course_groups'); + } + if ($bbbPlugin === true) { $userInfo = api_get_user_info(); $this->user_complete_name = $userInfo['complete_name']; @@ -998,7 +1002,7 @@ class bbb return api_get_course_id().'-'.api_get_session_id().'-'.api_get_group_id(); } - + return api_get_course_id().'-'.api_get_session_id(); } diff --git a/plugin/bbb/lib/bbb_plugin.class.php b/plugin/bbb/lib/bbb_plugin.class.php index 9e7ff4e75a..fd7bb6df51 100755 --- a/plugin/bbb/lib/bbb_plugin.class.php +++ b/plugin/bbb/lib/bbb_plugin.class.php @@ -37,6 +37,7 @@ class BBBPlugin extends Plugin 'host' => 'text', 'salt' => 'text', 'enable_global_conference' => 'boolean', + 'enable_conference_in_course_groups' => 'boolean', ] ); } @@ -76,7 +77,7 @@ class BBBPlugin extends Plugin )"; Database::query($sql); - //Installing course settings + // Installing course settings $this->install_course_fields_in_all_courses(); } @@ -89,25 +90,26 @@ class BBBPlugin extends Plugin $t_options = Database::get_main_table(TABLE_MAIN_SETTINGS_OPTIONS); $t_tool = Database::get_course_table(TABLE_TOOL_LIST); - // New settings - $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_tool_enable'"; - Database::query($sql); - $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_salt'"; - Database::query($sql); - $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_host'"; - Database::query($sql); + $variables = [ + 'bbb_salt', + 'bbb_host', + 'bbb_tool_enable', + 'enable_global_conference', + 'enable_conference_in_course_groups', + 'bbb_plugin', + 'bbb_plugin_host', + 'bbb_plugin_salt' + ]; + + foreach ($variables as $variable) { + $sql = "DELETE FROM $t_settings WHERE variable = '$variable'"; + Database::query($sql); + } - //Old settings deleting just in case - $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_plugin'"; - Database::query($sql); $sql = "DELETE FROM $t_options WHERE variable = 'bbb_plugin'"; Database::query($sql); - $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_plugin_host'"; - Database::query($sql); - $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_plugin_salt'"; - Database::query($sql); - //hack to get rid of Database::query warning (please add c_id...) + // hack to get rid of Database::query warning (please add c_id...) $sql = "DELETE FROM $t_tool WHERE name = 'bbb' AND c_id != 0"; Database::query($sql); @@ -115,7 +117,7 @@ class BBBPlugin extends Plugin $sql = "DROP TABLE IF EXISTS $t"; Database::query($sql); - //Deleting course settings + // Deleting course settings $this->uninstall_course_fields_in_all_courses($this->course_settings); } } From 123d3dc396ec9a1069bd6b32790ca25d3f9e0992 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 10 May 2016 10:47:20 +0200 Subject: [PATCH 07/12] Remove unused function --- main/inc/lib/api.lib.php | 15 --------------- main/inc/lib/plugin.lib.php | 3 +-- tests/main/inc/lib/main_api.lib.test.php | 7 ------- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index a091f7360c..4b20060228 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -4535,21 +4535,6 @@ function api_number_of_plugins($location) { return isset($_plugins[$location]) && is_array($_plugins[$location]) ? count($_plugins[$location]) : 0; } -/** - * Checks to see wether a certain plugin is installed. - * @return boolean true if the plugin is installed, false otherwise. - */ -function api_is_plugin_installed($plugin_list, $plugin_name) { - if (is_array($plugin_list)) { - foreach ($plugin_list as $plugin_location) { - if (array_search($plugin_name, $plugin_location) !== false) { - return true; - } - } - } - return false; -} - /** * Transforms a number of seconds in hh:mm:ss format * @author Julian Prud'homme diff --git a/main/inc/lib/plugin.lib.php b/main/inc/lib/plugin.lib.php index f1ae10cadb..2eb3ca9a55 100755 --- a/main/inc/lib/plugin.lib.php +++ b/main/inc/lib/plugin.lib.php @@ -372,8 +372,7 @@ class AppPlugin $_template['plugin_info'] = $plugin_info; } - // Setting the plugin info available in the template if exists - + // Setting the plugin info available in the template if exists. $template->assign($plugin_name, $_template); // Loading the Twig template plugin files if exists diff --git a/tests/main/inc/lib/main_api.lib.test.php b/tests/main/inc/lib/main_api.lib.test.php index ff900a334a..96838aceaf 100755 --- a/tests/main/inc/lib/main_api.lib.test.php +++ b/tests/main/inc/lib/main_api.lib.test.php @@ -491,13 +491,6 @@ class TestMainApi extends UnitTestCase { $this->assertTrue($_plugins[$location]); } - function testApiIsPluginInstalled(){ - $plugin_name = false; - $plugin_list = true; - $res = api_is_plugin_installed($plugin_list, $plugin_name); - $this->assertTrue(is_bool($res)); - } - function testApiTimeToHms(){ $seconds = -1; ob_start(); From c88a5e9ea16027daeef1e6588b1beb2af63e8d99 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 10 May 2016 11:04:36 +0200 Subject: [PATCH 08/12] Fix infocourse when using checkbox --- main/course_info/infocours.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main/course_info/infocours.php b/main/course_info/infocours.php index c695750e6a..adcbbccc35 100755 --- a/main/course_info/infocours.php +++ b/main/course_info/infocours.php @@ -483,7 +483,7 @@ $form->setDefaults($values); // Validate form if ($form->validate() && is_settings_editable()) { - $updateValues = $form->exportValues(); + $updateValues = $form->getSubmitValues(); // update course picture $picture = $_FILES['picture']; @@ -571,7 +571,6 @@ if ($form->validate() && is_settings_editable()) { ]; Database::update($table_course, $params, ['id = ?' => $courseId]); - // Insert/Updates course_settings table foreach ($courseSettings as $setting) { $value = isset($updateValues[$setting]) ? $updateValues[$setting] : null; From b39334d0c6ac96cf9e4c8ed02f5add7157ff5cc0 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 10 May 2016 11:04:46 +0200 Subject: [PATCH 09/12] Fix constructor --- main/inc/lib/formvalidator/Element/SelectTheme.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/inc/lib/formvalidator/Element/SelectTheme.php b/main/inc/lib/formvalidator/Element/SelectTheme.php index 9bc0433109..7a31c0546b 100644 --- a/main/inc/lib/formvalidator/Element/SelectTheme.php +++ b/main/inc/lib/formvalidator/Element/SelectTheme.php @@ -9,14 +9,15 @@ class SelectTheme extends HTML_QuickForm_select /** * Class constructor */ - function SelectTheme($elementName=null, $elementLabel=null, $options=null, $attributes=null) { + public function __construct($elementName = null, $elementLabel = null, $options = null, $attributes = null) + { parent::__construct($elementName, $elementLabel, $options, $attributes); // Get all languages $themes = api_get_themes(); $this->_options = array(); $this->_values = array(); $this->addOption('--',''); // no theme select - for ($i=0; $i< count($themes[0]);$i++) { + for ($i=0; $i < count($themes[0]); $i++) { $this->addOption($themes[1][$i],$themes[0][$i]); } } From 1c76446ff2967542afc9f1ec963f6444593b3c5e Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 10 May 2016 11:05:08 +0200 Subject: [PATCH 10/12] Add course setting "bbb_enable_conference_in_groups" --- plugin/bbb/lib/bbb.lib.php | 3 +++ plugin/bbb/lib/bbb_plugin.class.php | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/plugin/bbb/lib/bbb.lib.php b/plugin/bbb/lib/bbb.lib.php index 8c7597521a..827df0fe0f 100755 --- a/plugin/bbb/lib/bbb.lib.php +++ b/plugin/bbb/lib/bbb.lib.php @@ -55,6 +55,9 @@ class bbb if ($this->groupSupport) { $this->groupSupport = (bool) $plugin->get('enable_conference_in_course_groups'); + if ($this->groupSupport) { + $this->groupSupport = api_get_course_setting('bbb_enable_conference_in_groups') === '1'; + } } if ($bbbPlugin === true) { diff --git a/plugin/bbb/lib/bbb_plugin.class.php b/plugin/bbb/lib/bbb_plugin.class.php index fd7bb6df51..846bada9f6 100755 --- a/plugin/bbb/lib/bbb_plugin.class.php +++ b/plugin/bbb/lib/bbb_plugin.class.php @@ -17,12 +17,16 @@ class BBBPlugin extends Plugin public $isCoursePlugin = true; // When creating a new course this settings are added to the course - public $course_settings = array( - array( + public $course_settings = [ + [ 'name' => 'big_blue_button_record_and_store', - 'type' => 'checkbox' - ) - ); + 'type' => 'checkbox', + ], + [ + 'name' => 'bbb_enable_conference_in_groups', + 'type' => 'checkbox', + ] + ]; /** * BBBPlugin constructor. From a32a3a251bd9b0a806f7671507fce0b07833a271 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 10 May 2016 11:46:52 +0200 Subject: [PATCH 11/12] Add validateCourseSetting function to show/hide course plugin settings. --- main/inc/lib/course.lib.php | 2 +- main/inc/lib/plugin.class.php | 9 +++++++++ main/inc/lib/plugin.lib.php | 3 +++ plugin/bbb/lang/english.php | 4 ++++ plugin/bbb/lang/french.php | 12 +----------- plugin/bbb/lang/spanish.php | 3 ++- plugin/bbb/lib/bbb.lib.php | 7 +++++-- plugin/bbb/lib/bbb_plugin.class.php | 18 ++++++++++++++++++ 8 files changed, 43 insertions(+), 15 deletions(-) diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index 4f2fe296e0..ed2822bdb5 100755 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -5024,11 +5024,11 @@ class CourseManager $settingList = self::getCourseSettingVariables($appPlugin); if (!in_array($variable, $settingList)) { + return false; } $courseSettingTable = Database::get_course_table(TABLE_COURSE_SETTING); - if (self::hasCourseSetting($variable, $courseId)) { // Update Database::update( diff --git a/main/inc/lib/plugin.class.php b/main/inc/lib/plugin.class.php index 1f6a6151b0..8f1c856013 100755 --- a/main/inc/lib/plugin.class.php +++ b/main/inc/lib/plugin.class.php @@ -746,4 +746,13 @@ class Plugin } } } + + /** + * @param string $variable + * @return bool + */ + public function validateCourseSetting($variable) + { + return true; + } } diff --git a/main/inc/lib/plugin.lib.php b/main/inc/lib/plugin.lib.php index 2eb3ca9a55..916d51b83e 100755 --- a/main/inc/lib/plugin.lib.php +++ b/main/inc/lib/plugin.lib.php @@ -547,6 +547,9 @@ class AppPlugin $groups = array(); foreach ($obj->course_settings as $setting) { + if ($obj->validateCourseSetting($setting['name']) === false) { + continue; + } if ($setting['type'] != 'checkbox') { $form->addElement($setting['type'], $setting['name'], $obj->get_lang($setting['name'])); } else { diff --git a/plugin/bbb/lang/english.php b/plugin/bbb/lang/english.php index 5ff171edec..1846866483 100755 --- a/plugin/bbb/lang/english.php +++ b/plugin/bbb/lang/english.php @@ -45,7 +45,11 @@ $strings['tool_enable_help'] = "Choose whether you want to enable the BigBlueBut Once enabled, it will show as an additional course tool in all courses' homepage, and teachers will be able to launch a conference at any time. Students will not be able to launch a conference, only join one. If you don't have a BigBlueButton server, please set one up or ask the Chamilo official providers for a quote. BigBlueButton is a free (as in freedom *and* beer), but its installation requires a set of technical skills that might not be immediately available to all. You can install it on your own or seek professional help to assist you or do it for you. This help, however, will generate a certain cost. In the pure logic of the free software, we offer you the tools to make your work easier and recommend professionals (the Chamilo Official Providers) that will be able to help you if this were too difficult.
    "; $strings['big_blue_button_welcome_message'] = 'Welcome message'; +$strings['enable_global_conference'] = 'Enable global conference'; +$strings['enable_conference_in_course_groups'] = 'Enable conference in course groups'; + $strings['big_blue_button_record_and_store'] = 'Record and store sessions'; +$strings['bbb_enable_conference_in_groups'] = 'Allow conference in groups'; $strings['plugin_tool_bbb'] = 'Video'; diff --git a/plugin/bbb/lang/french.php b/plugin/bbb/lang/french.php index 5f271382e9..38ec3e6edd 100755 --- a/plugin/bbb/lang/french.php +++ b/plugin/bbb/lang/french.php @@ -13,38 +13,28 @@ $strings['CloseMeeting'] = "Fermer la session"; $strings['VideoConferenceXCourseX'] = "Vidéoconférence #%s, cours %s"; $strings['VideoConferenceAddedToTheCalendar'] = "Vidéoconférence ajoutée au calendrier"; $strings['VideoConferenceAddedToTheLinkTool'] = "Vidéoconférence ajoutée comme lien. Vous pouvez éditer et publier le lien sur la page principale du cours depuis l'outil liens."; - $strings['GoToTheVideoConference'] = "Entrer dans la salle de conférence"; - $strings['Records'] = "Enregistrement"; $strings['Meeting'] = "Salle de conférence"; - $strings['ViewRecord'] = "Voir l'enregistrement"; $strings['CopyToLinkTool'] = "Ajouter comme lien du cours"; - $strings['EnterConference'] = "Entrer dans la salle de conférence"; $strings['RecordList'] = "Liste des enregistrements"; $strings['ServerIsNotRunning'] = "Le serveur de vidéoconférence ne fonctionne pas"; $strings['ServerIsNotConfigured'] = "Le serveur de vidéoconférence n'est pas configuré correctement"; - $strings['XUsersOnLine'] = "%s utilisateurs dans la salle"; - $strings['host'] = 'Hôte de BigBlueButton'; $strings['host_help'] = "C'est le nom du serveur où le serveur de vidéoconférence a été habilité. Cela peut être localhost, une adresse IP (du genre 192.168.13.54) ou un nom de domaine (du genre ma.video.com)."; - $strings['salt'] = 'Clef BigBlueButton'; $strings['salt_help'] = "C'est la clef de sécurité de votre serveur BigBlueButton (appelée 'salt' en anglais) qui permet à votre serveur de vérifier l'identité de votre installation de Chamilo et ainsi l'autoriser à se connecter. Veuillez vous référer à la documentation de BigBlueButton pour la localiser, ou utilisez la commande 'bbb-conf --salt' si vous disposez d'un accès en ligne de commande au serveur de vidéoconférence."; - $strings['tool_enable'] = 'Outil de vidéoconférence BigBlueButton activé'; $strings['tool_enable_help'] = "Choisissez si vous souhaitez activer l'outil de vidéoconférence BigBlueButton. Une fois activé, il apparaîtra comme un outil additionnel sur toutes les pages principales de cours, et les enseignants pourront démarrer une conférence à n'importe quel moment. Les étudiants ne pourront pas lancer de nouvelle session de conférence, seulement se joindre à une session existante. Si vous ne disposez pas d'un serveur de vidéoconférence BigBlueButton, veuillez en installer un avant de poursuivre, ou demander un devis à l'un des fournisseurs officiels de Chamilo. BigBlueButton est un outil de logiciel libre (et gratuit), mais son installation pourrait présenter une certaine complexité et demander des compétences qui ne sont peut-être pas à la portée de tous. Vous pouvez l'installer vous-même à partir de la documentation (disponible publiquement) de BigBlueButton, ou recherchez un soutien professionnel. Ce soutien pourrait générer certains coûts (au moins le temps de la personne qui vous assiste dans l'opération). Dans le plus pur esprit du logiciel libre, nous vous fournissons les outils pour simplifier votre travail dans la mesure de nos possibilités, et nous vous recommandons des professionnels (les fournisseurs officiels de Chamilo) pour vous venir en aide au cas où ceux-ci seraient insuffisants.
    "; $strings['big_blue_button_welcome_message'] = 'Message de bienvenue de BigBlueButton'; $strings['big_blue_button_record_and_store'] = 'Enregistrer les sessions de vidéoconférence'; - +$strings['bbb_enable_conference_in_groups'] = 'Permettre la création de vidéoconférence pour les groupes'; $strings['plugin_tool_bbb'] = 'Vidéo'; - $strings['ThereAreNotRecordingsForTheMeetings'] = 'Aucun enregistrement disponible'; $strings['NoRecording'] = "Pas d'enregistrement"; - $strings['ClickToContinue'] = 'Cliquez pour continuer'; diff --git a/plugin/bbb/lang/spanish.php b/plugin/bbb/lang/spanish.php index 1ab48767d1..6cacc628bf 100755 --- a/plugin/bbb/lang/spanish.php +++ b/plugin/bbb/lang/spanish.php @@ -40,7 +40,8 @@ $strings['tool_enable_help'] = "Escoja si desea activar la herramienta de videoc Una vez activada, se mostrará como una herramienta adicional en todas las páginas principales de cursos, y los profesores podrán iniciar una conferencia en cualquier momento. Los estudiantes no podrían lanzar una conferencia, solo juntarse a una existente. Si no tiene un servidor de videoconferencia BigBlueButton, por favor configure uno antes de seguir, o pida una cotización a uno de los proveedores oficiales de Chamilo. BigBlueButton es una herramienta de software libre (y gratuita), pero su instalación requiere de competencias que quizás no sean inmediatamente disponibles para todos. Puede instalarla usted mismo o buscar ayuda profesional. Esta ayuda podría no obstante generar algunos costos (por lo menos el tiempo de la persona quien lo ayude). En el puro espíritu del software libre, le ofrecemos las herramientas para hacer su trabajo más simple, en la medida de nuestras posibilidades, y le recomendamos profesionales (los proveedores oficiales de Chamilo) para ayudarlo en caso esto fuera demasiado complicado.
    "; $strings['big_blue_button_welcome_message'] = 'Mensaje de bienvenida de BigBlueButton'; -$strings['big_blue_button_record_and_store'] = 'Grabar las sesiones de videoconferencia'; +$strings['big_blue_button_record_and_store'] = 'Grabar las sesiones de videoconferencia.'; +$strings['bbb_enable_conference_in_groups'] = 'Activar la creación de videoconferencia en los grupos.'; $strings['plugin_tool_bbb'] = 'Video'; diff --git a/plugin/bbb/lib/bbb.lib.php b/plugin/bbb/lib/bbb.lib.php index 827df0fe0f..f6464a08c6 100755 --- a/plugin/bbb/lib/bbb.lib.php +++ b/plugin/bbb/lib/bbb.lib.php @@ -56,7 +56,10 @@ class bbb if ($this->groupSupport) { $this->groupSupport = (bool) $plugin->get('enable_conference_in_course_groups'); if ($this->groupSupport) { - $this->groupSupport = api_get_course_setting('bbb_enable_conference_in_groups') === '1'; + $courseInfo = api_get_course_info(); + if ($courseInfo) { + $this->groupSupport = api_get_course_setting('bbb_enable_conference_in_groups') === '1'; + } } } @@ -79,7 +82,7 @@ class bbb $this->pluginEnabled = true; } } - + /** * @return bool */ diff --git a/plugin/bbb/lib/bbb_plugin.class.php b/plugin/bbb/lib/bbb_plugin.class.php index 846bada9f6..dc83bf43f9 100755 --- a/plugin/bbb/lib/bbb_plugin.class.php +++ b/plugin/bbb/lib/bbb_plugin.class.php @@ -46,6 +46,24 @@ class BBBPlugin extends Plugin ); } + /** + * @param string $variable + * @return bool + */ + public function validateCourseSetting($variable) + { + if ($variable == 'bbb_enable_conference_in_groups') { + if ($this->get('enable_conference_in_course_groups') === 'true') { + + return true; + } else { + return false; + } + } + + return true; + } + /** * @return BBBPlugin|null */ From 6ee2856479cb34b9a32930ee335e01582a5d6f5d Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 10 May 2016 13:14:08 +0200 Subject: [PATCH 12/12] Minor - format code, update comments --- main/inc/lib/internationalization.lib.php | 23 +++++++++++++++------- main/inc/lib/pear/PEAR.php | 8 +------- plugin/bbb/lib/bbb.lib.php | 24 ++++++++++------------- 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/main/inc/lib/internationalization.lib.php b/main/inc/lib/internationalization.lib.php index afd69f5793..b331057d5b 100755 --- a/main/inc/lib/internationalization.lib.php +++ b/main/inc/lib/internationalization.lib.php @@ -3,7 +3,7 @@ /** * File: internationalization.lib.php - * Internationalization library for Chamilo 1.8.7 LMS + * Internationalization library for Chamilo 1.x LMS * A library implementing internationalization related functions. * License: GNU General Public License Version 3 (Free Software Foundation)ww * @author Ivan Tcholakov, , 2009, 2010 @@ -275,7 +275,7 @@ function api_get_language_isocode($language = null, $default_code = 'en') } /** - * Gets language isocode column from the language table + * Gets language iso code column from the language table * * @return array An array with the current isocodes * @@ -283,7 +283,8 @@ function api_get_language_isocode($language = null, $default_code = 'en') function api_get_platform_isocodes() { $iso_code = array(); - $sql_result = Database::query("SELECT isocode FROM ".Database::get_main_table(TABLE_MAIN_LANGUAGE)." ORDER BY isocode "); + $sql = "SELECT isocode FROM ".Database::get_main_table(TABLE_MAIN_LANGUAGE)." ORDER BY isocode "; + $sql_result = Database::query($sql); if (Database::num_rows($sql_result)) { while ($row = Database::fetch_array($sql_result)) {; $iso_code[] = trim($row['isocode']); @@ -348,6 +349,7 @@ function api_get_timezones() } $null_option = array('' => ''); $result = array_merge($null_option, $out); + return $result; } @@ -439,8 +441,12 @@ function api_get_utc_datetime($time = null, $return_null_if_invalid_date = false * * @author Guillaume Viguier */ -function api_get_local_time($time = null, $to_timezone = null, $from_timezone = null, $return_null_if_invalid_date = false) -{ +function api_get_local_time( + $time = null, + $to_timezone = null, + $from_timezone = null, + $return_null_if_invalid_date = false +) { // Determining the timezone to be converted from if (is_null($from_timezone)) { $from_timezone = 'UTC'; @@ -471,8 +477,10 @@ function api_get_local_time($time = null, $to_timezone = null, $from_timezone = try { $date = new DateTime($time, new DateTimezone($from_timezone)); $date->setTimezone(new DateTimeZone($to_timezone)); + return $date->format('Y-m-d H:i:s'); } catch (Exception $e) { + return null; } } @@ -480,8 +488,8 @@ function api_get_local_time($time = null, $to_timezone = null, $from_timezone = /** * Converts a string into a timestamp safely (handling timezones), using strtotime * - * @param string String to be converted - * @param string Timezone (if null, the timezone will be determined based + * @param string $time to be converted + * @param string $timezone (if null, the timezone will be determined based * on user preference, or timezone chosen by the admin for the platform) * @return int Timestamp * @@ -494,6 +502,7 @@ function api_strtotime($time, $timezone = null) { } $timestamp = strtotime($time); date_default_timezone_set($system_timezone); + return $timestamp; } diff --git a/main/inc/lib/pear/PEAR.php b/main/inc/lib/pear/PEAR.php index 005954069e..b794dc9aec 100755 --- a/main/inc/lib/pear/PEAR.php +++ b/main/inc/lib/pear/PEAR.php @@ -253,7 +253,7 @@ class PEAR $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args); } - // }}} + // }}} // {{{ isError() /** @@ -558,12 +558,6 @@ class PEAR $ec = 'PEAR_Error'; } - if (intval(PHP_VERSION) < 5) { - // little non-eval hack to fix bug #12147 - include 'PEAR/FixPHP5PEARWarnings.php'; - return $a; - } - if ($skipmsg) { $a = new $ec($code, $mode, $options, $userinfo); } else { diff --git a/plugin/bbb/lib/bbb.lib.php b/plugin/bbb/lib/bbb.lib.php index f6464a08c6..c85f09f5d9 100755 --- a/plugin/bbb/lib/bbb.lib.php +++ b/plugin/bbb/lib/bbb.lib.php @@ -20,7 +20,7 @@ class bbb public $url; public $salt; public $api; - public $user_complete_name = ''; + public $userCompleteName = ''; public $protocol = 'http://'; public $debug = false; public $logoutUrl = ''; @@ -34,6 +34,7 @@ class bbb * required for the connection to the video conference server) * @param string $host * @param string $salt + * @param bool $isGlobalConference */ public function __construct($host = '', $salt = '', $isGlobalConference = false) { @@ -65,7 +66,7 @@ class bbb if ($bbbPlugin === true) { $userInfo = api_get_user_info(); - $this->user_complete_name = $userInfo['complete_name']; + $this->userCompleteName = $userInfo['complete_name']; $this->salt = $bbb_salt; $info = parse_url($bbb_host); $this->url = $bbb_host.'/bigbluebutton/'; @@ -82,7 +83,7 @@ class bbb $this->pluginEnabled = true; } } - + /** * @return bool */ @@ -151,7 +152,8 @@ class bbb # a user joins. If after this period, a user hasn't joined, the meeting is # removed from memory. defaultMeetingCreateJoinDuration=5 - * + * + * @return mixed */ public function createMeeting($params) { @@ -385,7 +387,7 @@ class bbb if ($meetingInfoExists) { $joinParams = array( 'meetingId' => $meetingData['remote_id'], // -- REQUIRED - A unique id for the meeting - 'username' => $this->user_complete_name, //-- REQUIRED - The name that will display for the user in the meeting + 'username' => $this->userCompleteName, //-- REQUIRED - The name that will display for the user in the meeting 'password' => $pass, //-- REQUIRED - The attendee or moderator password, depending on what's passed here //'createTime' => api_get_utc_datetime(), //-- OPTIONAL - string. Leave blank ('') unless you set this correctly. 'userID' => api_get_user_id(), //-- OPTIONAL - string @@ -437,7 +439,7 @@ class bbb { $pass = $this->getUserMeetingPassword(); $courseId = api_get_course_int_id(); - $sessionId = api_get_session_id(); + $sessionId = api_get_session_id(); $conditions = array( 'where' => array( @@ -669,7 +671,7 @@ class bbb if ($meetingDB['status'] == 1) { $joinParams = array( 'meetingId' => $meetingDB['remote_id'], //-- REQUIRED - A unique id for the meeting - 'username' => $this->user_complete_name, //-- REQUIRED - The name that will display for the user in the meeting + 'username' => $this->userCompleteName, //-- REQUIRED - The name that will display for the user in the meeting 'password' => $pass, //-- REQUIRED - The attendee or moderator password, depending on what's passed here 'createTime' => '', //-- OPTIONAL - string. Leave blank ('') unless you set this correctly. 'userID' => '', // -- OPTIONAL - string @@ -928,7 +930,7 @@ class bbb } /** - * Checks if the videoconference server is running. + * Checks if the video conference server is running. * Function currently disabled (always returns 1) * @return bool True if server is running, false otherwise * @assert () === false @@ -968,12 +970,6 @@ class bbb header("Location: $url"); exit; } - - // js - /*echo ''; - exit;*/ } /**