From 06c15644a8f091b74470e0bdedfcdbe2faf5342d Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Thu, 14 Apr 2016 12:43:43 -0500 Subject: [PATCH 01/11] Add Classes to Reporting fields - refs BT#11073 --- main/inc/lib/tracking.lib.php | 3 +++ main/inc/lib/usergroup.lib.php | 40 +++++++++++++++++++++++++++++++++- main/mySpace/myStudents.php | 4 ++-- main/tracking/courseLog.php | 24 ++++++++++---------- 4 files changed, 57 insertions(+), 14 deletions(-) diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php index bd57320546..2d90e6e368 100755 --- a/main/inc/lib/tracking.lib.php +++ b/main/inc/lib/tracking.lib.php @@ -6498,6 +6498,9 @@ class TrackingCourseLog $user_row[]= $user['count_assignments']; $user_row[]= $user['count_messages']; + $userGroupManager = new UserGroup(); + $user_row[] = $userGroupManager->getLabelsFromNameList($user['user_id'], UserGroup::NORMAL_CLASS); + if (empty($session_id)) { $user_row[]= $user['survey']; } diff --git a/main/inc/lib/usergroup.lib.php b/main/inc/lib/usergroup.lib.php index cbbf9bb591..413393264b 100755 --- a/main/inc/lib/usergroup.lib.php +++ b/main/inc/lib/usergroup.lib.php @@ -516,7 +516,7 @@ class UserGroup extends Model * Get the group list for a user * @param int $userId The user ID * @param int $filterByType Optional. The type of group - * @return type + * @return array */ public function getUserGroupListByUser($userId, $filterByType = null) { @@ -2356,5 +2356,43 @@ class UserGroup extends Model $res = Database::query($sql); return $res; } + + /** + * Filter the groups/classes info to get a name list only + * @param int $userId The user ID + * @param int $filterByType Optional. The type of group + * @return array + */ + public function getNameListByUser($userId, $filterByType = null) + { + $userClasses = $this->getUserGroupListByUser($userId, $filterByType); + + return array_column($userClasses, 'name'); + } + + /** + * Get the HTML necessary for display the groups/classes name list + * @param int $userId The user ID + * @param int $filterByType Optional. The type of group + * @return string + */ + public function getLabelsFromNameList($userId, $filterByType = null) + { + $groupsNameListParsed = $this->getNameListByUser($userId, $filterByType); + + if (empty($groupsNameListParsed)) { + return ''; + } + + $nameList = ''; + + return $nameList; + } } diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php index 69cb3917ab..e3506b1ec7 100755 --- a/main/mySpace/myStudents.php +++ b/main/mySpace/myStudents.php @@ -463,7 +463,7 @@ if (!empty($student_id)) { $userPicture = UserManager::getUserPicture($user_info['user_id']); $userGroupManager = new UserGroup(); - $userGroups = $userGroupManager->getUserGroupListByUser($user_info['user_id'], UserGroup::NORMAL_CLASS); + $userGroups = $userGroupManager->getNameListByUser($user_info['user_id'], UserGroup::NORMAL_CLASS); ?>
@@ -592,7 +592,7 @@ if (!empty($student_id)) { - + diff --git a/main/tracking/courseLog.php b/main/tracking/courseLog.php index e7e9c19a48..40118605e2 100755 --- a/main/tracking/courseLog.php +++ b/main/tracking/courseLog.php @@ -425,36 +425,38 @@ if (count($a_students) > 0) { $headers['student_publication'] = get_lang('Student_publication'); $table->set_header(10, get_lang('Messages'), false); $headers['messages'] = get_lang('Messages'); + $table->set_header(11, get_lang('Classes')); + $headers['clasess'] = get_lang('Classes'); if (empty($session_id)) { - $table->set_header(11, get_lang('Survey'), false); + $table->set_header(12, get_lang('Survey'), false); $headers['survey'] = get_lang('Survey'); - $table->set_header(12, get_lang('FirstLoginInCourse'), false); + $table->set_header(13, get_lang('FirstLoginInCourse'), false); $headers['first_login'] = get_lang('FirstLoginInCourse'); - $table->set_header(13, get_lang('LatestLoginInCourse'), false); + $table->set_header(14, get_lang('LatestLoginInCourse'), false); $headers['latest_login'] = get_lang('LatestLoginInCourse'); if (isset($_GET['additional_profile_field']) and is_numeric($_GET['additional_profile_field'])) { - $table->set_header(14, $extra_info['display_text'], false); + $table->set_header(15, $extra_info['display_text'], false); $headers['display_text'] = $extra_info['display_text']; - $table->set_header(15, get_lang('Details'), false); + $table->set_header(16, get_lang('Details'), false); $headers['details'] = get_lang('Details'); } else { - $table->set_header(14, get_lang('Details'), false); + $table->set_header(15, get_lang('Details'), false); $headers['details'] = get_lang('Details'); } } else { - $table->set_header(11, get_lang('FirstLoginInCourse'), false); + $table->set_header(12, get_lang('FirstLoginInCourse'), false); $headers['first_login'] = get_lang('FirstLoginInCourse'); - $table->set_header(12, get_lang('LatestLoginInCourse'), false); + $table->set_header(13, get_lang('LatestLoginInCourse'), false); $headers['latest_login'] = get_lang('LatestLoginInCourse'); if (isset($_GET['additional_profile_field']) and is_numeric($_GET['additional_profile_field'])) { - $table->set_header(13, $extra_info['display_text'], false); + $table->set_header(14, $extra_info['display_text'], false); $headers['display_text'] = $extra_info['display_text']; - $table->set_header(14, get_lang('Details'), false); + $table->set_header(15, get_lang('Details'), false); $headers['Details'] = get_lang('Details'); } else { - $table->set_header(13, get_lang('Details'), false); + $table->set_header(14, get_lang('Details'), false); $headers['Details'] = get_lang('Details'); } } From 91150cfe5cbf061de682d3dd581bd049950d02dc Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Thu, 14 Apr 2016 16:09:43 -0500 Subject: [PATCH 02/11] Fix translation for custom icon on course homepage - refs #8194 --- main/course_info/tools.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/main/course_info/tools.php b/main/course_info/tools.php index 41d0c51978..0e096484c8 100644 --- a/main/course_info/tools.php +++ b/main/course_info/tools.php @@ -118,12 +118,8 @@ switch ($action) { $iconsTools .= Display::page_header(get_lang('CustomizeIcons'), null, 'h4'); $iconsTools .= '
'; foreach ($toolList as $tool) { - - if ($tool['id']>20) { - $toolIconName = $tool['name']; - } else { - $toolIconName = get_lang('Tool'.api_underscore_to_camel_case($tool['name'])); - } + $toolIconName = 'Tool' . api_underscore_to_camel_case($tool['name']); + $toolIconName = isset($$toolIconName) ? get_lang($toolIconName) : $tool['name']; $iconsTools .= '
'; $iconsTools .= '
'; From 5d85e2a36f71b74c2b72e05c86b451b119ff641a Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Thu, 14 Apr 2016 16:23:41 -0500 Subject: [PATCH 03/11] Add required rules when editon custom icon on course homepage - refs #8194 --- main/course_info/tools.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/main/course_info/tools.php b/main/course_info/tools.php index 0e096484c8..6369c976e1 100644 --- a/main/course_info/tools.php +++ b/main/course_info/tools.php @@ -49,15 +49,14 @@ switch ($action) { $currentUrl = api_get_self().'?action=edit_icon&id=' . $id.'&'.api_get_cidreq(); $form = new FormValidator('icon_edit', 'post', $currentUrl); - $form->addElement('header', get_lang('EditIcon')); + $form->addHeader(get_lang('EditIcon')); $form->addHtml('
'); - $form->addElement('text', 'name', get_lang('Name')); - $form->addElement('text', 'link', get_lang('Links')); + $form->addText('name', get_lang('Name')); + $form->addText('link', get_lang('Links')); $allowed_picture_types = array ('jpg', 'jpeg', 'png'); - $form->addElement('file', 'icon', get_lang('CustomIcon')); + $form->addFile('icon', get_lang('CustomIcon')); $form->addRule('icon', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types); - $form->addElement( - 'select', + $form->addSelect( 'target', get_lang('LinkTarget'), [ @@ -65,14 +64,12 @@ switch ($action) { '_blank' => get_lang('LinkOpenBlank') ] ); - $form->addElement( - 'select', + $form->addSelect( 'visibility', get_lang('Visibility'), array(1 => get_lang('Visible'), 0 => get_lang('Invisible')) ); - $form->addElement( - 'textarea', + $form->addTextarea( 'description', get_lang('Description'), array('rows' => '3', 'cols' => '40') From ff8290cb87eced2991d8919fa086eeba5a2fb304 Mon Sep 17 00:00:00 2001 From: Nicolas Ducoulombier Date: Fri, 15 Apr 2016 12:12:02 +0200 Subject: [PATCH 04/11] Fix table name --- main/exercice/exercise.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php index 18a011ac3e..33a61274bc 100755 --- a/main/exercice/exercise.class.php +++ b/main/exercice/exercise.class.php @@ -1718,7 +1718,7 @@ class Exercise Database::query($sql); if ($this->specialCategoryOrders) { - $sql = "UPDATE $TBL_EXERCICES + $sql = "UPDATE $TBL_EXERCISES SET question_selection_type= ".intval($this->getQuestionSelectionType())." WHERE id = ".$this->id." AND c_id = ".$this->course_id; Database::query($sql); From f1db277f1ac8565266006ceba4309710af1d8d6d Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Fri, 15 Apr 2016 12:22:37 -0500 Subject: [PATCH 05/11] Fix logout with facebook - refs #8156 --- main/auth/external_login/facebook.init.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/auth/external_login/facebook.init.php b/main/auth/external_login/facebook.init.php index ad73ec7b3b..c20afc91f1 100755 --- a/main/auth/external_login/facebook.init.php +++ b/main/auth/external_login/facebook.init.php @@ -22,5 +22,5 @@ * See facebook section of the auth.conf.php file */ -require_once dirname(__FILE__) . '/../../../app/config/auth.conf.php'; +require dirname(__FILE__) . '/../../../app/config/auth.conf.php'; From 9c952de7420ccfc484277f956d14904b20ae2402 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Fri, 15 Apr 2016 14:33:30 -0500 Subject: [PATCH 06/11] Show course description when course_catalog_hide_private is false --- main/inc/ajax/course_home.ajax.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/main/inc/ajax/course_home.ajax.php b/main/inc/ajax/course_home.ajax.php index 475e1a3052..f7fda44643 100755 --- a/main/inc/ajax/course_home.ajax.php +++ b/main/inc/ajax/course_home.ajax.php @@ -70,11 +70,13 @@ switch ($action) { $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); $course_info = api_get_course_info($_GET['code']); - if ($course_info['visibility'] != COURSE_VISIBILITY_OPEN_WORLD) { - if (api_is_anonymous()) { - exit; - } - } + if ( + api_get_setting('course_catalog_hide_private') === 'true' && + $course_info['visibility'] == COURSE_VISIBILITY_REGISTERED + ) { + echo get_lang('PrivateAccess'); + break; + } //echo Display::tag('h2', $course_info['name']); //echo '
'; From 652538011f33cb4ebef14455adfbbd30f0b704cf Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Fri, 15 Apr 2016 10:49:52 -0500 Subject: [PATCH 07/11] Fix login with Facebook - refs #8156 --- main/auth/external_login/facebook.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/auth/external_login/facebook.inc.php b/main/auth/external_login/facebook.inc.php index 42b8771c68..7e229461b8 100755 --- a/main/auth/external_login/facebook.inc.php +++ b/main/auth/external_login/facebook.inc.php @@ -48,10 +48,10 @@ function facebookConnect() // see if we have a session if (isset($session)) { // graph api request for user data - $request = new FacebookRequest($session, 'GET', '/me'); + $request = new FacebookRequest($session, 'GET', '/me?fields=id,first_name,last_name,email,locale'); $response = $request->execute(); // get response - $graphObject = $response->getGraphObject(); + $graphObject = $response->getGraphObject(Facebook\GraphUser::className()); $username = changeToValidChamiloLogin($graphObject->getProperty('email')); $email = $graphObject->getProperty('email'); $locale = $graphObject->getProperty('locale'); From 12d243269e40cf82531124846c437a3f389c1a1c Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Fri, 15 Apr 2016 16:08:50 -0500 Subject: [PATCH 08/11] Update changelog for 1.10.6 --- documentation/changelog.html | 86 ++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/documentation/changelog.html b/documentation/changelog.html index bdc658e9c8..a9cdd201a4 100755 --- a/documentation/changelog.html +++ b/documentation/changelog.html @@ -46,6 +46,92 @@

Note: most #wxyz references are issue numbers you can find in our public bug tracking system. Some references marked BT#xyz are developments made externally for BeezNest customers and integrated into Chamilo. The details of these tasks cannot be seen for confidentiality reasons, but the code change is public and can be reviewed by anyone.

 

+ + +

Chamilo 1.10.6 - ???, ?? of April 2016

+

Release notes - summary

+

Chamilo 1.10.6 is a minor, bugfix release of the 1.10.x branch, with a few new features and bugfixes on top of 1.10.4.

+

Release name

+

NNNh .....

+

Security fixes

+
    +
  • None that we know of.
  • +
+

Possibly breaking changes

+
    +
  • None that we know of.
  • +
+

Notable new Features

+

For end-users, teachers and Chamilo admins

+ +

For developers and sysadmins

+ + +

Improvements (minor features) and debug

+ +

Stylesheets and theming

+
    +
  • None that we know of.
  • +
+

Web services

+
    +
  • None that we know of.
  • +
+

Removals

+
    +
  • None that we know of.
  • +
+

Known issues

+
    +
  • IMS/QTI import/export has issues
  • +
  • In Internet Explorer 9, learning paths might not show other pages than the first to be opened. We lacked computers with IE9 at the time of release of 1.10.4. Guaranteeing IE9 support will likely require additional services. See the corresponding bug report
  • +
+ +

Chamilo 1.10.4 - Bath, 22th of March 2016

From 30648a5154d2e3b31217ef8baeaccd722ddff36e Mon Sep 17 00:00:00 2001 From: Julio Date: Sun, 17 Apr 2016 13:51:26 +0200 Subject: [PATCH 09/11] adding hasColumn conditions see BT#8200 --- app/Migrations/Schema/V110/Version20150603181728.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Migrations/Schema/V110/Version20150603181728.php b/app/Migrations/Schema/V110/Version20150603181728.php index 891fc83fff..6916233b85 100644 --- a/app/Migrations/Schema/V110/Version20150603181728.php +++ b/app/Migrations/Schema/V110/Version20150603181728.php @@ -28,7 +28,16 @@ class Version20150603181728 extends AbstractMigrationChamilo */ public function up(Schema $schema) { - $this->addSql('ALTER TABLE c_lp ADD max_attempts INT NOT NULL, ADD subscribe_users INT NOT NULL DEFAULT 0'); + $table = $schema->getTable('c_lp'); + if (!$table->hasColumn('max_attempts')) { + $this->addSql('ALTER TABLE c_lp ADD max_attempts INT NOT NULL'); + + } + + if (!$table->hasColumn('subscribe_users')) { + $this->addSql('ALTER TABLE c_lp ADD subscribe_users INT NOT NULL DEFAULT 0'); + } + $this->addSql(' ALTER TABLE c_item_property MODIFY c_id INT DEFAULT NULL, From 82dce71bf5b427b123a77da806096e3b90fc5bec Mon Sep 17 00:00:00 2001 From: Julio Date: Sun, 17 Apr 2016 13:56:18 +0200 Subject: [PATCH 10/11] fix missing lib see #8201 --- main/install/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/main/install/index.php b/main/install/index.php index 081f547bf2..33bd9dcccb 100755 --- a/main/install/index.php +++ b/main/install/index.php @@ -27,6 +27,7 @@ define('MAX_FORM_FIELD_LENGTH', 80); // Including necessary libraries. require_once '../inc/lib/api.lib.php'; +require_once '../inc/lib/text.lib.php'; api_check_php_version('../inc/'); From b3b5ac409b355ce833014bac763f27933447253f Mon Sep 17 00:00:00 2001 From: Julio Date: Sun, 17 Apr 2016 15:31:22 +0200 Subject: [PATCH 11/11] Minor - format code --- plugin/ticket/config.install.php | 2 -- plugin/ticket/config.php | 1 + plugin/ticket/database.php | 11 +++++---- plugin/ticket/install.php | 2 +- plugin/ticket/plugin.php | 2 +- plugin/ticket/src/assign_tickets.php | 4 +++- plugin/ticket/src/course_user_list.php | 3 +-- plugin/ticket/src/myticket.php | 3 ++- plugin/ticket/src/report.php | 8 +++++-- plugin/ticket/src/ticket.class.php | 29 +++++++++++++---------- plugin/ticket/src/ticket_assign_log.php | 14 ++++++++--- plugin/ticket/src/ticket_plugin.class.php | 2 +- plugin/ticket/src/tutor_report.lib.php | 7 +++--- plugin/ticket/start.php | 2 +- plugin/ticket/uninstall.php | 2 +- 15 files changed, 56 insertions(+), 36 deletions(-) diff --git a/plugin/ticket/config.install.php b/plugin/ticket/config.install.php index a6fabf492f..58d0405348 100755 --- a/plugin/ticket/config.install.php +++ b/plugin/ticket/config.install.php @@ -8,7 +8,5 @@ */ require_once '../../main/inc/global.inc.php'; -require_once api_get_path(LIBRARY_PATH).'plugin.class.php'; - require_once 'src/ticket.class.php'; require_once 'src/ticket_plugin.class.php'; diff --git a/plugin/ticket/config.php b/plugin/ticket/config.php index 3f3d4057d4..f1ece63787 100755 --- a/plugin/ticket/config.php +++ b/plugin/ticket/config.php @@ -4,6 +4,7 @@ /** * @package chamilo.plugin.ticket */ + /* Tables names constants */ define('PLUGIN_NAME', 'ticket'); define('TABLE_TICKET_ASSIGNED_LOG', 'plugin_ticket_assigned_log'); diff --git a/plugin/ticket/database.php b/plugin/ticket/database.php index f2ea36daab..d789b4ca08 100755 --- a/plugin/ticket/database.php +++ b/plugin/ticket/database.php @@ -1,4 +1,6 @@ get_lang('VirtualCampus') => $objPlugin->get_lang('TicketsAboutVirtualCampus'), $objPlugin->get_lang('OnlineEvaluation') => $objPlugin->get_lang('TicketsAboutOnlineEvaluation') ); + $i = 1; foreach ($categoRow as $category => $description) { //Online evaluation requires a course @@ -67,7 +70,7 @@ foreach ($categoRow as $category => $description) { Database::insert($table, $attributes); $i++; } -//END default categories + $table = Database::get_main_table(TABLE_TICKET_MESSAGE); $sql = "CREATE TABLE IF NOT EXISTS ".$table." ( id int UNSIGNED NOT NULL AUTO_INCREMENT, @@ -117,6 +120,7 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." ( sys_lastedit_datetime datetime DEFAULT NULL, PRIMARY KEY (id))"; Database::query($sql); + //Default Priorities $defaultPriorities = array( 'NRM' => $objPlugin->get_lang('PriorityNormal'), @@ -134,7 +138,6 @@ foreach ($defaultPriorities as $pId => $priority) { Database::insert($table, $attributes); $i++; } -//End $table = Database::get_main_table(TABLE_TICKET_PROJECT); $sql = "CREATE TABLE IF NOT EXISTS ".$table." ( @@ -150,6 +153,7 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." ( sys_lastedit_datetime datetime DEFAULT NULL, PRIMARY KEY (id))"; Database::query($sql); + //Default Project Table Ticket $attributes = array( 'id' => 1, @@ -157,7 +161,6 @@ $attributes = array( 'name' => 'Ticket System' ); Database::insert($table, $attributes); -//END //STATUS $table = Database::get_main_table(TABLE_TICKET_STATUS); @@ -168,6 +171,7 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." ( description varchar(255) DEFAULT NULL, PRIMARY KEY (id))"; Database::query($sql); + //Default status $defaultStatus = array( 'NAT' => $objPlugin->get_lang('StatusNew'), @@ -187,7 +191,6 @@ foreach ($defaultStatus as $abr => $status) { Database::insert($table, $attributes); $i ++; } -//END $table = Database::get_main_table(TABLE_TICKET_TICKET); $sql = "CREATE TABLE IF NOT EXISTS ".$table." ( diff --git a/plugin/ticket/install.php b/plugin/ticket/install.php index 16533a6095..fefafb02ea 100755 --- a/plugin/ticket/install.php +++ b/plugin/ticket/install.php @@ -7,5 +7,5 @@ * @package chamilo.plugin.ticket */ -require_once dirname(__FILE__).'/config.php'; +require_once __DIR__.'/config.php'; TicketPlugin::create()->install(); diff --git a/plugin/ticket/plugin.php b/plugin/ticket/plugin.php index b7fd73d518..6e0031b148 100755 --- a/plugin/ticket/plugin.php +++ b/plugin/ticket/plugin.php @@ -4,5 +4,5 @@ /** * @package chamilo.plugin.ticket */ -require_once dirname(__FILE__).'/config.php'; +require_once __DIR__.'/config.php'; $plugin_info = TicketPlugin::create()->get_info(); diff --git a/plugin/ticket/src/assign_tickets.php b/plugin/ticket/src/assign_tickets.php index 8c1bad5af7..1ac6ed098e 100755 --- a/plugin/ticket/src/assign_tickets.php +++ b/plugin/ticket/src/assign_tickets.php @@ -1,5 +1,6 @@
'; echo '
- +
'; echo ''; diff --git a/plugin/ticket/src/course_user_list.php b/plugin/ticket/src/course_user_list.php index 272ed8ce36..af80af6c42 100755 --- a/plugin/ticket/src/course_user_list.php +++ b/plugin/ticket/src/course_user_list.php @@ -18,8 +18,6 @@ foreach ($coursesList as $key => $course) { $courseInfo = CourseManager::get_course_information($course['code']); $arrCourseList[$courseInfo['code']] = $courseInfo['title']; } -//End Course List - $userLabel = Display::tag('label', get_lang('User'), array('class' => 'control-label')); $personName = api_get_person_name($userInfo['firstname'], $userInfo['lastname']); @@ -40,6 +38,7 @@ $courseControl = Display::div($courseSelect, array('class' => 'controls')); $userDiv = Display::div($userLabel . " " . $userControl, array('class' => 'control-group')); $courseDiv = Display::div($courseLabel . " " . $courseControl, array('class' => 'control-group')); + echo $userDiv; echo $courseDiv; diff --git a/plugin/ticket/src/myticket.php b/plugin/ticket/src/myticket.php index 64621805ca..daef5b510a 100755 --- a/plugin/ticket/src/myticket.php +++ b/plugin/ticket/src/myticket.php @@ -194,7 +194,8 @@ if (isset($_GET['action'])) { break; } } -//$nameTools = api_xml_http_response_encode($plugin->get_lang('MyTickets')); + +// $nameTools = api_xml_http_response_encode($plugin->get_lang('MyTickets')); $user_id = api_get_user_id(); $isAdmin = api_is_platform_admin(); diff --git a/plugin/ticket/src/report.php b/plugin/ticket/src/report.php index 9a4f1ab527..6878fbce1b 100755 --- a/plugin/ticket/src/report.php +++ b/plugin/ticket/src/report.php @@ -4,6 +4,7 @@ /** * @package chamilo.plugin.ticket */ + $language_file = array('trad4all'); $cidReset = true; require_once '../config.php'; @@ -14,7 +15,7 @@ api_block_anonymous_users(); if (!api_is_allowed_to_edit()) { api_not_allowed(); } -//$nameTools = api_xml_http_response_encode(get_lang('Soporte Virtual')); + $this_section = 'Reports'; unset($_SESSION['this_section']); @@ -24,7 +25,8 @@ $(document).ready(function(){ $( "#keyword_start_date_start" ).datepicker({ dateFormat: ' . "'yy-mm-dd'" . ' }); $( "#keyword_start_date_end" ).datepicker({ dateFormat: ' . "'yy-mm-dd'" . ' }); }); -function validate(){ + +function validate() { if( $("#keyword_start_date_start").val() != "" && $("#keyword_start_date_end").val() != ""){ datestart = $("#keyword_start_date_start").val(); dateend = $("#keyword_start_date_end").val(); @@ -35,6 +37,7 @@ function validate(){ } } } + function load_course_list (div_course,my_user_id) { $.ajax({ contentType: "application/x-www-form-urlencoded", @@ -84,6 +87,7 @@ $tools['quiz'] = array('id' => 'quiz', 'name' => get_lang('Quiz')); $tools['student_publication'] = array('id' => 'student_publication', 'name' => get_lang('Student_publication')); $tools['user'] = array('id' => 'user', 'name' => get_lang('User')); $tools['forum'] = array('id' => 'forum', 'name' => get_lang('Forum')); + /** * Returns the escaped string. * @param string $s diff --git a/plugin/ticket/src/ticket.class.php b/plugin/ticket/src/ticket.class.php index a0d6a7eb05..ce56838db3 100755 --- a/plugin/ticket/src/ticket.class.php +++ b/plugin/ticket/src/ticket.class.php @@ -336,8 +336,8 @@ class TicketManager $obj = Database::fetch_object($result); $message_id = $obj->total_messages + 1; $now = api_get_utc_datetime(); - - $sql_insert_message = "INSERT INTO $table_support_messages ( + // insert msg + $sql = "INSERT INTO $table_support_messages ( ticket_id, message_id, subject, @@ -360,16 +360,19 @@ class TicketManager '" . $now . "', '$status' )"; - Database::query($sql_insert_message); - $sql_update_total_message = "UPDATE $table_support_tickets - SET sys_lastedit_user_id ='$user_id', - sys_lastedit_datetime ='$now', - total_messages = ( - SELECT COUNT(*) as total_messages - FROM $table_support_messages - WHERE ticket_id ='$ticket_id' - ) WHERE ticket_id ='$ticket_id' "; - Database::query($sql_update_total_message); + Database::query($sql); + + // update_total_message + $sql = "UPDATE $table_support_tickets + SET sys_lastedit_user_id ='$user_id', + sys_lastedit_datetime ='$now', + total_messages = ( + SELECT COUNT(*) as total_messages + FROM $table_support_messages + WHERE ticket_id ='$ticket_id' + ) + WHERE ticket_id ='$ticket_id' "; + Database::query($sql); $sql_message_att_id = "SELECT COUNT(*) as total_attach FROM $table_support_message_attachments @@ -1239,6 +1242,7 @@ class TicketManager $sql .= " AND ticket.project_id != '' "; $res = Database::query($sql); $obj = Database::fetch_object($res); + return $obj->unread; } @@ -1512,7 +1516,6 @@ class TicketManager } } - //$sql .= " ORDER BY col$column $direction"; $sql .= " LIMIT $from,$number_of_items"; $result = Database::query($sql); diff --git a/plugin/ticket/src/ticket_assign_log.php b/plugin/ticket/src/ticket_assign_log.php index fe01de8a23..2c678e759b 100755 --- a/plugin/ticket/src/ticket_assign_log.php +++ b/plugin/ticket/src/ticket_assign_log.php @@ -4,7 +4,9 @@ /** * @package chamilo.plugin.ticket */ + require_once '../config.php'; + $plugin = TicketPlugin::create(); $ticket_id = intval($_POST['ticket_id']); @@ -22,9 +24,15 @@ $history = TicketManager::get_assign_log($ticket_id); ?> - - - + + + + + + + + + diff --git a/plugin/ticket/src/ticket_plugin.class.php b/plugin/ticket/src/ticket_plugin.class.php index 04ae7dd18c..baf83f6e5b 100755 --- a/plugin/ticket/src/ticket_plugin.class.php +++ b/plugin/ticket/src/ticket_plugin.class.php @@ -58,7 +58,7 @@ class TicketPlugin extends Plugin $settings = $this->get_settings(); $plugSetting = current($settings); - //Delete settings + // Delete settings $sql = "DELETE FROM $tblSettings WHERE variable = 'ticket_tool_enable'"; Database::query($sql); diff --git a/plugin/ticket/src/tutor_report.lib.php b/plugin/ticket/src/tutor_report.lib.php index c8473ec5d2..0885c190b9 100755 --- a/plugin/ticket/src/tutor_report.lib.php +++ b/plugin/ticket/src/tutor_report.lib.php @@ -32,8 +32,9 @@ function initializeReport($course_code) if (intval($obj->cant) != $weeksCount) { if (intval($obj->cant) > $weeksCount) { - $sql = "DELETE FROM $table_reporte_semanas WHERE week_id > $weeksCount AND course_code = '$course_code'"; - Database::query("DELETE FROM $table_reporte_semanas WHERE week_id > $weeksCount AND course_code = '$course_code'"); + $sql = "DELETE FROM $table_reporte_semanas + WHERE week_id > $weeksCount AND course_code = '$course_code'"; + Database::query($sql); } else { for ($i = $obj->cant + 1; $i <= $weeksCount; $i++) { if (!Database::query("INSERT INTO $table_reporte_semanas (week_id, course_code, forum_id, work_id, quiz_id, pc_id) @@ -139,7 +140,6 @@ function showResults($courseInfo, $weeksCount, $page) '; - if ($weeksCount == 14) { $html .= '' . (($page == 1) ? "Siguiente" : "Anterior") . ''; } @@ -196,6 +196,7 @@ function showStudentResult($datos, $pagina) $fila.= '' . (($dato['thread_ok'] == 1) ? Display::return_icon('check.png') : Display::return_icon('aspa.png')) . ''; } $fila.= ''; + return $fila; } diff --git a/plugin/ticket/start.php b/plugin/ticket/start.php index b533c68ebe..d344a38fba 100755 --- a/plugin/ticket/start.php +++ b/plugin/ticket/start.php @@ -6,7 +6,7 @@ * @package chamilo.plugin.ticket */ $course_plugin = 'ticket'; //needed in order to load the plugin lang variables -require_once dirname(__FILE__).'/config.php'; +require_once __DIR__.'/config.php'; $tool_name = get_lang('Ticket'); $tpl = new Template($tool_name); diff --git a/plugin/ticket/uninstall.php b/plugin/ticket/uninstall.php index 8b2c5e6424..809d515dbb 100755 --- a/plugin/ticket/uninstall.php +++ b/plugin/ticket/uninstall.php @@ -7,5 +7,5 @@ * the global database and the courses tables * @package chamilo.plugin.ticket */ -require_once dirname(__FILE__).'/config.php'; +require_once __DIR.'/config.php'; TicketPlugin::create()->uninstall();