diff --git a/.travis.yml b/.travis.yml
index 9a9f94b6b4..f518025e2e 100755
--- a/.travis.yml
+++ b/.travis.yml
@@ -49,3 +49,7 @@ script:
# - phpunit -c tests/phpunit
# pwd shows /home/travis/build/chamilo/chamilo-lms
- cd tests && ../vendor/behat/behat/bin/behat -v
+
+# configure notifications (email, IRC, campfire etc)
+notifications:
+ irc: "irc.freenode.org#chamilo"
\ No newline at end of file
diff --git a/custompages/registration-dist.php b/custompages/registration-dist.php
index 1f6a52258e..aeb4fc0f83 100644
--- a/custompages/registration-dist.php
+++ b/custompages/registration-dist.php
@@ -7,10 +7,14 @@
* Copyright: CBlue SPRL, 20XX (GNU/GPLv3)
* @package chamilo.custompages
**/
-
+/**
+ * Initialization
+ */
require_once('language.php');
require_once('../inc/global.inc.php');
-
+require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
+require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
+require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php';
/**
* Removes some unwanted elementend of the form object
*/
@@ -24,6 +28,7 @@ if (isset($content['form']->_elementIndex['status'])) {
$content['form']->removeElement('status');
$content['form']->removeElement('status');
}
+// Deprecated since 2015-03-26
/**
* Code to change the way QuickForm render html
*/
@@ -79,41 +84,54 @@ EOT;
?>
- Registration
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-

-
-
-
-
';
- }?>
- display();
- ?>
-
-
-
-
-
-
-
-
-
+
+
diff --git a/custompages/registration-feedback-dist.php b/custompages/registration-feedback-dist.php
index 57775f231b..dfd7a1a310 100644
--- a/custompages/registration-feedback-dist.php
+++ b/custompages/registration-feedback-dist.php
@@ -3,39 +3,50 @@
/**
* Quick display for user registration
* @package chamilo.custompages
- */
+ */
/**
* HTML output
*/
+require_once('language.php');
?>
- Registration
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-

-
-
+
+
diff --git a/main/admin/course_edit.php b/main/admin/course_edit.php
index 468c5477e0..c322e089b0 100755
--- a/main/admin/course_edit.php
+++ b/main/admin/course_edit.php
@@ -218,10 +218,16 @@ if (!empty($specialCourseFieldInfo)) {
$specialCourseAttributes['checked'] = '';
}
- $form->addElement('hidden', '_extra_special_course', 0);
- $form->addElement('checkbox', 'extra_special_course', array(
- null, get_lang('AllUsersAreAutomaticallyRegistered')
- ), get_lang('SpecialCourse'), $specialCourseAttributes);
+ $form->addElement(
+ 'checkbox',
+ 'extra_special_course',
+ array(
+ null,
+ get_lang('AllUsersAreAutomaticallyRegistered')
+ ),
+ get_lang('SpecialCourse'),
+ $specialCourseAttributes
+ );
}
//Extra fields
diff --git a/main/admin/course_list.php b/main/admin/course_list.php
index 58ff98be65..fe51f8be5c 100755
--- a/main/admin/course_list.php
+++ b/main/admin/course_list.php
@@ -338,7 +338,7 @@ if (isset ($_GET['search']) && $_GET['search'] == 'advanced') {
}
// Create a search-box
$form = new FormValidator('search_simple', 'get', '', '', array(), FormValidator::LAYOUT_INLINE);
- $form->addElement('text', 'keyword', null);
+ $form->addElement('text', 'keyword', null, array('id' => 'course-search-keyword'));
$form->addButtonSearch(get_lang('SearchCourse'));
$form->addElement('static', 'search_advanced_link', null, ''.get_lang('AdvancedSearch').'');
diff --git a/main/admin/teacher_time_report.php b/main/admin/teacher_time_report.php
index 94934dca98..3084d897da 100644
--- a/main/admin/teacher_time_report.php
+++ b/main/admin/teacher_time_report.php
@@ -61,7 +61,7 @@ if (!empty($selectedCourse)) {
$selectedFrom,
$selectedUntil
);
- $formatedTime = api_format_time($totalTime);
+ $formattedTime = api_format_time($totalTime);
$timeReport->data[] = array(
'session' => null,
@@ -76,7 +76,7 @@ if (!empty($selectedCourse)) {
'username' => $teacher['username'],
'completeName' => api_get_person_name($teacher['firstname'], $teacher['lastname'])
),
- 'totalTime' => $formatedTime
+ 'totalTime' => $formattedTime
);
}
@@ -94,7 +94,7 @@ if (!empty($selectedCourse)) {
$selectedFrom,
$selectedUntil
);
- $formatedTime = api_format_time($totalTime);
+ $formattedTime = api_format_time($totalTime);
$timeReport->data[] = array(
'session' => array(
@@ -112,7 +112,7 @@ if (!empty($selectedCourse)) {
'username' => $coach['username'],
'completeName' => api_get_person_name($coach['firstname'], $coach['lastname'])
),
- 'totalTime' => $formatedTime
+ 'totalTime' => $formattedTime
);
}
}
@@ -149,7 +149,7 @@ if (!empty($selectedSession)) {
$selectedFrom,
$selectedUntil
);
- $formatedTime = api_format_time($totalTime);
+ $formattedTime = api_format_time($totalTime);
$timeReport->data[] = array(
'session' => $sessionData,
@@ -161,7 +161,7 @@ if (!empty($selectedSession)) {
'username' => $coach['username'],
'completeName' => api_get_person_name($coach['firstname'], $coach['lastname'])
),
- 'totalTime' => $formatedTime
+ 'totalTime' => $formattedTime
);
}
}
@@ -196,7 +196,7 @@ if (!empty($selectedTeacher)) {
$selectedFrom,
$selectedUntil
);
- $formatedTime = api_format_time($totalTime);
+ $formattedTime = api_format_time($totalTime);
$timeReport->data[] = array(
'session' => null,
@@ -205,7 +205,7 @@ if (!empty($selectedTeacher)) {
'name' => $courseInfo['title']
),
'coach' => $teacherData,
- 'totalTime' => $formatedTime
+ 'totalTime' => $formattedTime
);
}
}
@@ -228,7 +228,7 @@ if (!empty($selectedTeacher)) {
$selectedFrom,
$selectedUntil
);
- $formatedTime = api_format_time($totalTime);
+ $formattedTime = api_format_time($totalTime);
$timeReport->data[] = array(
'session' => $sessionData,
@@ -237,7 +237,7 @@ if (!empty($selectedTeacher)) {
'name' => $courseInfo['title']
),
'coach' => $teacherData,
- 'totalTime' => $formatedTime
+ 'totalTime' => $formattedTime
);
}
}
diff --git a/main/admin/user_add.php b/main/admin/user_add.php
index da04805dcd..319cb4f984 100755
--- a/main/admin/user_add.php
+++ b/main/admin/user_add.php
@@ -233,7 +233,7 @@ $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'),
$group = array ();
$group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('On'), 1);
$group[] = $form->createElement(
- 'DatePicker',
+ 'DateTimePicker',
'expiration_date',
null,
array(
@@ -263,7 +263,7 @@ $defaults['mail']['send_mail'] = 1;
$defaults['password']['password_auto'] = 1;
$defaults['active'] = 1;
$days = api_get_setting('account_valid_duration');
-$defaults['expiration_date'] = date('Y-m-d', api_strtotime('+'.$days.' day'));
+$defaults['expiration_date'] = api_get_local_time('+'.$days.' day');
$defaults['radio_expiration_date'] = 0;
$defaults['status'] = STUDENT;
diff --git a/main/admin/user_edit.php b/main/admin/user_edit.php
index eab15e29c3..1862abdb93 100755
--- a/main/admin/user_edit.php
+++ b/main/admin/user_edit.php
@@ -269,7 +269,7 @@ if (!$user_data['platform_admin']) {
$form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0);
$group = array ();
$group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('On'), 1);
- $group[] = $form->createElement('DatePicker', 'expiration_date', null, array('onchange' => 'javascript: enable_expiration_date();'));
+ $group[] = $form->createElement('DateTimePicker', 'expiration_date', null, array('onchange' => 'javascript: enable_expiration_date();'));
$form->addGroup($group, 'max_member_group', null, '', false);
// Active account or inactive account
@@ -298,10 +298,10 @@ $expiration_date = $user_data['expiration_date'];
if (empty($expiration_date)) {
$user_data['radio_expiration_date'] = 0;
- $user_data['expiration_date'] = date('Y-m-d');
+ $user_data['expiration_date'] = api_get_local_time();
} else {
$user_data['radio_expiration_date'] = 1;
- $user_data['expiration_date'] = $expiration_date;
+ $user_data['expiration_date'] = api_get_local_time($expiration_date);
}
$form->setDefaults($user_data);
diff --git a/main/auth/inscription.php b/main/auth/inscription.php
index 7be7751fa1..b68efbabe0 100755
--- a/main/auth/inscription.php
+++ b/main/auth/inscription.php
@@ -408,7 +408,7 @@ if ($form->validate()) {
}
}
- $status = isset($values['status']) ? $values['status'] : null;
+ $status = isset($values['status']) ? $values['status'] : STUDENT;
$phone = isset($values['phone']) ? $values['phone'] : null;
// Creates a new user
@@ -482,14 +482,6 @@ if ($form->validate()) {
Database::query($sql);
}
- // if there is a default duration of a valid account then we have to change the expiration_date accordingly
- if (api_get_setting('account_valid_duration') != '') {
- $sql = "UPDATE ".Database::get_main_table(TABLE_MAIN_USER)."
- SET expiration_date='registration_date+1'
- WHERE user_id='".$user_id."'";
- Database::query($sql);
- }
-
$course_code_redirect = Session::read('course_redirect');
// Saving user to course if it was set.
diff --git a/main/gradebook/gradebook.php b/main/gradebook/gradebook.php
index 2286df9e6a..4b16dff5df 100755
--- a/main/gradebook/gradebook.php
+++ b/main/gradebook/gradebook.php
@@ -576,7 +576,7 @@ if (((empty ($allcat)) && (empty ($alleval)) && (empty ($alllink)) && (!$is_plat
}
// Here we are in a sub category
if ($category != '0') {
- DisplayGradebook:: display_header_gradebook(
+ DisplayGradebook:: header(
$cats[0],
1,
$_GET['selectcat'],
@@ -586,7 +586,7 @@ if ($category != '0') {
);
} else {
// This is the root category
- DisplayGradebook:: display_header_gradebook(
+ DisplayGradebook:: header(
$cats[0],
(((count($allcat) == '0') && (!isset ($_GET['search']))) ? 0 : 1),
0,
diff --git a/main/gradebook/gradebook_display_certificate.php b/main/gradebook/gradebook_display_certificate.php
index 50332dd72c..f1c5fda21f 100755
--- a/main/gradebook/gradebook_display_certificate.php
+++ b/main/gradebook/gradebook_display_certificate.php
@@ -43,7 +43,11 @@ switch ($action) {
Category::exportAllCertificates($cat_id, $userList);
break;
case 'generate_all_certificates':
- $user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), api_get_session_id());
+ $user_list = CourseManager::get_user_list_from_course_code(
+ api_get_course_id(),
+ api_get_session_id()
+ );
+
if (!empty($user_list)) {
foreach ($user_list as $user_info) {
if ($user_info['status'] == INVITEE) {
@@ -171,14 +175,14 @@ if ($filter) {
echo '';
$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'));
+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;
-echo Display::url(get_lang('DeleteAllCertificates'), $url, array('class' => 'btn'));
+echo Display::url(get_lang('DeleteAllCertificates'), $url, array('class' => 'btn btn-default'));
if (count($certificate_list) > 0) {
$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'));
+ echo Display::url(get_lang('ExportAllCertificatesToPDF'), $url, array('class' => 'btn btn-default'));
}
echo '
';
@@ -204,7 +208,7 @@ if (count($certificate_list) == 0 ) {
echo ''.get_lang('Date').' : '.api_convert_and_format_date($value_certificate['created_at']).' | ';
echo '';
$url = api_get_path(WEB_PATH).'certificates/index.php?id='.$value_certificate['id'];
- $certificates = Display::url(get_lang('Certificate'), $url, array('target'=>'_blank', 'class' => 'btn'));
+ $certificates = Display::url(get_lang('Certificate'), $url, array('target'=>'_blank', 'class' => 'btn btn-default'));
echo $certificates;
echo '
'.Display::return_icon('delete.png',get_lang('Delete')).'
diff --git a/main/gradebook/index.php b/main/gradebook/index.php
index f292f718c2..054bbfa58a 100755
--- a/main/gradebook/index.php
+++ b/main/gradebook/index.php
@@ -96,6 +96,7 @@ $filter_confirm_msg = true;
$filter_warning_msg = true;
$cats = Category :: load(null, null, $course_code, null, null, $session_id, false);
+
$first_time = null;
if (empty($cats)) {
@@ -151,7 +152,7 @@ if ((isset($_GET['selectcat']) && $_GET['selectcat']>0) &&
// ACTIONS
//this is called when there is no data for the course admin
-if (isset ($_GET['createallcategories'])) {
+if (isset($_GET['createallcategories'])) {
GradebookUtils::block_students();
$coursecat= Category :: get_not_created_course_categories($stud_id);
if (!count($coursecat) == 0) {
@@ -173,13 +174,13 @@ if (isset ($_GET['createallcategories'])) {
}
//show logs evaluations
-if (isset ($_GET['visiblelog'])) {
+if (isset($_GET['visiblelog'])) {
header('Location: ' . api_get_self().'/gradebook_showlog_eval.php');
exit;
}
//move a category
-if (isset ($_GET['movecat'])) {
+if (isset($_GET['movecat'])) {
GradebookUtils::block_students();
$cats= Category :: load($_GET['movecat']);
if (!isset ($_GET['targetcat'])) {
@@ -196,7 +197,7 @@ if (isset ($_GET['movecat'])) {
exit;
}
} else {
- $targetcat= Category :: load($_GET['targetcat']);
+ $targetcat = Category :: load($_GET['targetcat']);
$course_to_crsind = ($cats[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
if (!($course_to_crsind && !isset($_GET['confirm']))) {
@@ -210,7 +211,7 @@ if (isset ($_GET['movecat'])) {
}
//move an evaluation
-if (isset ($_GET['moveeval'])) {
+if (isset($_GET['moveeval'])) {
GradebookUtils::block_students();
$evals= Evaluation :: load($_GET['moveeval']);
if (!isset ($_GET['targetcat'])) {
@@ -244,7 +245,7 @@ if (isset ($_GET['moveeval'])) {
}
//move a link
-if (isset ($_GET['movelink'])) {
+if (isset($_GET['movelink'])) {
GradebookUtils::block_students();
$link= LinkFactory :: load($_GET['movelink']);
$move_form = new LinkForm(
@@ -266,7 +267,7 @@ if (isset ($_GET['movelink'])) {
}
//parameters for categories
-if (isset ($_GET['visiblecat'])) {
+if (isset($_GET['visiblecat'])) {
GradebookUtils::block_students();
if (isset ($_GET['set_visible'])) {
@@ -274,7 +275,7 @@ if (isset ($_GET['visiblecat'])) {
} else {
$visibility_command= 0;
}
- $cats= Category :: load($_GET['visiblecat']);
+ $cats = Category :: load($_GET['visiblecat']);
$cats[0]->set_visible($visibility_command);
$cats[0]->save();
$cats[0]->apply_visibility_to_children();
@@ -302,8 +303,9 @@ if (isset($_GET['deletecat'])) {
$confirmation_message = get_lang('CategoryDeleted');
$filter_confirm_msg = false;
}
+
//parameters for evaluations
-if (isset ($_GET['visibleeval'])) {
+if (isset($_GET['visibleeval'])) {
GradebookUtils::block_students();
if (isset ($_GET['set_visible'])) {
$visibility_command= 1;
@@ -322,6 +324,7 @@ if (isset ($_GET['visibleeval'])) {
$filter_confirm_msg = false;
}
}
+
//parameters for evaluations
if (isset($_GET['lockedeval'])) {
GradebookUtils::block_students();
@@ -339,9 +342,9 @@ if (isset($_GET['lockedeval'])) {
}
$filter_confirm_msg = false;
-
}
-if (isset ($_GET['deleteeval'])) {
+
+if (isset($_GET['deleteeval'])) {
GradebookUtils::block_students();
$eval= Evaluation :: load($_GET['deleteeval']);
if ($eval[0] != null) {
@@ -350,8 +353,9 @@ if (isset ($_GET['deleteeval'])) {
$confirmation_message = get_lang('GradebookEvaluationDeleted');
$filter_confirm_msg = false;
}
+
//parameters for links
-if (isset ($_GET['visiblelink'])) {
+if (isset($_GET['visiblelink'])) {
GradebookUtils::block_students();
if (isset ($_GET['set_visible'])) {
$visibility_command= 1;
@@ -441,7 +445,7 @@ switch ($action) {
}
//actions on the sortabletable
-if (isset ($_POST['action'])) {
+if (isset($_POST['action'])) {
GradebookUtils::block_students();
$number_of_selected_items= count($_POST['id']);
@@ -450,8 +454,7 @@ if (isset ($_POST['action'])) {
$filter_warning_msg = false;
} else {
switch ($_POST['action']) {
-
- case 'deleted' :
+ case 'deleted':
$number_of_deleted_categories= 0;
$number_of_deleted_evaluations= 0;
$number_of_deleted_links= 0;
@@ -486,10 +489,10 @@ if (isset ($_POST['action'])) {
$confirmation_message = get_lang('DeletedCategories') . ' : ' . $number_of_deleted_categories . ' ' . get_lang('DeletedEvaluations') . ' : ' . $number_of_deleted_evaluations . ' ' . get_lang('DeletedLinks') . ' : ' . $number_of_deleted_links . '
' . get_lang('TotalItems') . ' : ' . $number_of_selected_items . '';
$filter_confirm_msg = false;
break;
- case 'setvisible' :
+ case 'setvisible':
foreach ($_POST['id'] as $indexstr) {
if (substr($indexstr, 0, 4) == 'CATE') {
- $cats= Category :: load(substr($indexstr, 4));
+ $cats = Category :: load(substr($indexstr, 4));
$cats[0]->set_visible(1);
$cats[0]->save();
$cats[0]->apply_visibility_to_children();
@@ -508,10 +511,10 @@ if (isset ($_POST['action'])) {
$confirmation_message = get_lang('ItemsVisible');
$filter_confirm_msg = false;
break;
- case 'setinvisible' :
+ case 'setinvisible':
foreach ($_POST['id'] as $indexstr) {
if (substr($indexstr, 0, 4) == 'CATE') {
- $cats= Category :: load(substr($indexstr, 4));
+ $cats = Category :: load(substr($indexstr, 4));
$cats[0]->set_visible(0);
$cats[0]->save();
$cats[0]->apply_visibility_to_children();
@@ -609,15 +612,15 @@ $is_course_admin = api_is_allowed_to_edit(null, true);
//load data for category, evaluation and links
if (empty($_GET['selectcat'])) {
- $category= 0;
+ $category = 0;
} else {
- $category= $_GET['selectcat'];
+ $category = $_GET['selectcat'];
}
$simple_search_form='';
if (isset($_GET['studentoverview'])) {
//@todo this code also seems to be deprecated ...
- $cats= Category :: load($category);
+ $cats = Category :: load($category);
$stud_id= (api_is_allowed_to_edit() ? null : $stud_id);
$allcat= array ();
$alleval= $cats[0]->get_evaluations($stud_id, true);
@@ -656,6 +659,7 @@ if (isset($_GET['studentoverview'])) {
//if $category = 0 (which happens when GET['selectcat'] is undefined)
// then Category::load() will create a new 'root' category with empty
// course and session fields in memory (Category::create_root_category())
+
if ($_in_course === true) {
// When *inside* a course, we want to make sure there is one (and only
// one) category for this course or for this session.
@@ -671,7 +675,7 @@ if (isset($_GET['studentoverview'])) {
$cats = Category :: load(null, null, $course_code, null, null, $session_id, false);
if (empty($cats)) {
// There is no category for this course+session, so create one
- $cat= new Category();
+ $cat = new Category();
if (!empty($session_id)) {
$s_name = api_get_session_name($session_id);
$cat->set_name($course_code.' - '.get_lang('Session').' '.$s_name);
@@ -690,10 +694,11 @@ if (isset($_GET['studentoverview'])) {
if ($can_edit) {
$cat->add();
}
- unset ($cat);
+ unset($cat);
}
unset($cats);
}
+
$cats = Category::load($category, null, null, null, null, null, false);
//with this fix the teacher only can view 1 gradebook
@@ -706,19 +711,17 @@ if (isset($_GET['studentoverview'])) {
$allcat = $cats[0]->get_subcategories($stud_id, $course_code, $session_id);
$alleval = $cats[0]->get_evaluations($stud_id);
$alllink = $cats[0]->get_links($stud_id);
- //whether we found a category or not, we now have a category object with
- // empty or full subcats
}
// add params to the future links (in the table shown)
-$addparams = array ('selectcat' => $cats[0]->get_id());
+$addparams = array('selectcat' => $cats[0]->get_id());
-if (isset ($_GET['studentoverview'])) {
+if (isset($_GET['studentoverview'])) {
$addparams['studentoverview'] = '';
}
//$addparams['cidReq']='';
if (isset($_GET['cidReq']) && $_GET['cidReq']!='') {
- $addparams['cidReq']=Security::remove_XSS($_GET['cidReq']);
+ $addparams['cidReq'] = Security::remove_XSS($_GET['cidReq']);
} else {
$addparams['cidReq']='';
}
@@ -849,8 +852,7 @@ if (isset($first_time) && $first_time==1 && api_is_allowed_to_edit(null,true)) {
} else {
// This is the father
// Create gradebook/add gradebook links.
-
- DisplayGradebook::display_header_gradebook(
+ DisplayGradebook::header(
$cat,
0,
$cat->get_id(),
diff --git a/main/gradebook/lib/be/category.class.php b/main/gradebook/lib/be/category.class.php
index 89e17a6daf..0a1f990ec1 100755
--- a/main/gradebook/lib/be/category.class.php
+++ b/main/gradebook/lib/be/category.class.php
@@ -807,7 +807,12 @@ class Category implements GradebookItem
*/
public function is_certificate_available($user_id)
{
- $score = $this->calc_score($user_id, null, $this->course_code);
+ $score = $this->calc_score(
+ $user_id,
+ null,
+ $this->course_code,
+ $this->session_id
+ );
if (isset($score) && isset($score[0])) {
// Get a percentage score to compare to minimum certificate score
@@ -1487,13 +1492,15 @@ class Category implements GradebookItem
* @param int $stud_id student id (default: all students)
* @param boolean $recursive process subcategories (default: no recursion)
* @param string $course_code
+ * @param int $sessionId
*
* @return array
*/
public function get_evaluations(
$stud_id = null,
$recursive = false,
- $course_code = ''
+ $course_code = '',
+ $sessionId = 0
) {
$evals = array();
@@ -1501,18 +1508,30 @@ class Category implements GradebookItem
$course_code = api_get_course_id();
}
+ if (empty($sessionId)) {
+ $sessionId = api_get_session_id();
+ }
+
// 1 student
if (isset($stud_id) && !empty($stud_id)) {
// Special case: this is the root
if ($this->id == 0) {
$evals = Evaluation::get_evaluations_with_result_for_student(0, $stud_id);
} else {
- $evals = Evaluation::load(null,null, $course_code, $this->id, api_is_allowed_to_edit() ? null : 1);
+ $evals = Evaluation::load(
+ null,
+ null,
+ $course_code,
+ $this->id,
+ api_is_allowed_to_edit() ? null : 1
+ );
}
} else {
// All students
// course admin
- if ((api_is_allowed_to_edit() || api_is_drh() || api_is_session_admin()) && !api_is_platform_admin()) {
+ if ((api_is_allowed_to_edit() || api_is_drh() || api_is_session_admin()) &&
+ !api_is_platform_admin()
+ ) {
// root
if ($this->id == 0) {
$evals = Evaluation::load(null, api_get_user_id(), null, $this->id, null);
@@ -1529,11 +1548,11 @@ class Category implements GradebookItem
}
if ($recursive) {
- $subcats = $this->get_subcategories($stud_id, $course_code);
+ $subcats = $this->get_subcategories($stud_id, $course_code, $sessionId);
+
if (!empty($subcats)) {
foreach ($subcats as $subcat) {
$subevals = $subcat->get_evaluations($stud_id, true, $course_code);
- //$this->debugprint($subevals);
$evals = array_merge($evals, $subevals);
}
}
@@ -1555,7 +1574,7 @@ class Category implements GradebookItem
$stud_id = null,
$recursive = false,
$course_code = '',
- $sessionId = null
+ $sessionId = 0
) {
$links = array();
@@ -1737,6 +1756,7 @@ class Category implements GradebookItem
*/
public static function register_user_certificate($category_id, $user_id)
{
+ $sessionId = api_get_session_id();
// Generating the total score for a course
$cats_course = Category::load(
$category_id,
@@ -1744,19 +1764,21 @@ class Category implements GradebookItem
null,
null,
null,
- api_get_session_id(),
+ $sessionId,
false
);
+
/** @var Category $category */
$category = $cats_course[0];
if (!$category->getGenerateCetificates()) {
+
$skill = new Skill();
$skill->add_skill_to_user(
$user_id,
$category_id,
api_get_course_int_id(),
- api_get_session_id()
+ $sessionId
);
return false;
@@ -1792,7 +1814,11 @@ class Category implements GradebookItem
return false;
}
- $my_certificate = GradebookUtils::get_certificate_by_user_id($cats_course[0]->get_id(), $user_id);
+ $my_certificate = GradebookUtils::get_certificate_by_user_id(
+ $cats_course[0]->get_id(),
+ $user_id
+ );
+
if (empty($my_certificate)) {
GradebookUtils::register_user_info_about_certificate(
$category_id,
@@ -1800,8 +1826,12 @@ class Category implements GradebookItem
$my_score_in_gradebook,
api_get_utc_datetime()
);
- $my_certificate = GradebookUtils::get_certificate_by_user_id($cats_course[0]->get_id(), $user_id);
+ $my_certificate = GradebookUtils::get_certificate_by_user_id(
+ $cats_course[0]->get_id(),
+ $user_id
+ );
}
+
$html = array();
if (!empty($my_certificate)) {
$certificate_obj = new Certificate($my_certificate['id']);
@@ -1809,6 +1839,7 @@ class Category implements GradebookItem
if (!empty($fileWasGenerated)) {
$url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $my_certificate['id'];
+
$certificates = Display::url(
' '.get_lang('DownloadCertificate'),
$url,
@@ -1817,6 +1848,7 @@ class Category implements GradebookItem
'class' => 'btn'
)
);
+
$exportToPDF = Display::url(
Display::return_icon(
'pdf.png',
@@ -1826,6 +1858,7 @@ class Category implements GradebookItem
),
"$url&action=export"
);
+
$html = array(
'certificate_link' => $certificates,
'pdf_link' => $exportToPDF
diff --git a/main/gradebook/lib/be/evaluation.class.php b/main/gradebook/lib/be/evaluation.class.php
index 9b4298a7bb..bb3977dd84 100755
--- a/main/gradebook/lib/be/evaluation.class.php
+++ b/main/gradebook/lib/be/evaluation.class.php
@@ -218,34 +218,40 @@ class Evaluation implements GradebookItem
$tbl_grade_evaluations = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
$sql = 'SELECT * FROM '.$tbl_grade_evaluations;
$paramcount = 0;
+
if (isset ($id)) {
$sql.= ' WHERE id = '.intval($id);
$paramcount ++;
}
+
if (isset ($user_id)) {
if ($paramcount != 0) $sql .= ' AND';
else $sql .= ' WHERE';
$sql .= ' user_id = '.intval($user_id);
$paramcount ++;
}
+
if (isset ($course_code) && $course_code <> '-1') {
if ($paramcount != 0) $sql .= ' AND';
else $sql .= ' WHERE';
$sql .= " course_code = '".Database::escape_string($course_code)."'";
$paramcount ++;
}
+
if (isset ($category_id)) {
if ($paramcount != 0) $sql .= ' AND';
else $sql .= ' WHERE';
$sql .= ' category_id = '.intval($category_id);
$paramcount ++;
}
+
if (isset ($visible)) {
if ($paramcount != 0) $sql .= ' AND';
else $sql .= ' WHERE';
$sql .= ' visible = '.intval($visible);
$paramcount ++;
}
+
if (isset ($locked)) {
if ($paramcount != 0) $sql .= ' AND';
else $sql .= ' WHERE';
diff --git a/main/gradebook/lib/fe/displaygradebook.php b/main/gradebook/lib/fe/displaygradebook.php
index df43c18ee4..b2d3df5d9c 100755
--- a/main/gradebook/lib/fe/displaygradebook.php
+++ b/main/gradebook/lib/fe/displaygradebook.php
@@ -341,8 +341,10 @@ class DisplayGradebook
$my_course_id = api_get_course_id();
$my_file = substr($_SESSION['gradebook_dest'], 0, 5);
- $header .= ' | ' . Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '';
- $header .= ' | ' . Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM) . '';
+ $header .= ' | ' .
+ Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '';
+ $header .= ' | ' .
+ Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM) . '';
$visibility_icon = ($catobj->is_visible() == 0) ? 'invisible' : 'visible';
$visibility_command = ($catobj->is_visible() == 0) ? 'set_visible' : 'set_invisible';
@@ -380,7 +382,7 @@ class DisplayGradebook
* where we have only one calification per course or session)
* @return void Everything is printed on screen upon closing
*/
- static function display_header_gradebook(
+ static function header(
$catobj,
$showtree,
$selectcat,
@@ -391,8 +393,22 @@ class DisplayGradebook
$show_add_link = true,
$certificateLinkInfo = null
) {
+
+ $userId = api_get_user_id();
+ $courseCode = api_get_course_id();
+ $sessionId = api_get_session_id();
+
// Student.
- $status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
+ $status = CourseManager::get_user_in_course_status($userId, $courseCode);
+
+ if (!empty($sessionId)) {
+ $sessionStatus = SessionManager::get_user_status_in_course_session(
+ $userId,
+ $courseCode,
+ $sessionId
+ );
+ }
+
$objcat = new Category();
$course_id = CourseManager::get_course_by_category($selectcat);
$message_resource = $objcat->show_message_resource_delete($course_id);
@@ -403,7 +419,15 @@ class DisplayGradebook
$sum_categories_weight_array = array();
if (isset($catobj) && !empty($catobj)) {
- $categories = Category::load(null, null, null, $catobj->get_id());
+ $categories = Category::load(
+ null,
+ null,
+ null,
+ $catobj->get_id(),
+ null,
+ $sessionId
+ );
+
if (!empty($categories)) {
foreach ($categories as $category) {
$sum_categories_weight_array[$category->get_id()] = $category->get_weight();
@@ -413,23 +437,15 @@ class DisplayGradebook
}
}
- if (!$is_course_admin && $status <> 1 && $selectcat <> 0) {
- $user_id = api_get_user_id();
+ if (!$is_course_admin && ($status <> 1 || $sessionStatus == 0) && $selectcat <> 0) {
$catcourse = Category::load($catobj->get_id());
- $main_weight = $catcourse[0]->get_weight();
+ /** @var Category $category */
+ $category = $catcourse[0];
+ $main_weight = $category->get_weight();
$scoredisplay = ScoreDisplay :: instance();
- //$categories = Category::getCategories($catcourse[0]->get_id());
- // generating the total score for a course
- /*if (count($categories) > 0) {
- foreach ($categories as $category) {
- $allevals = $category->get_evaluations($user_id, true);
- $alllinks = $category->get_links($user_id, true);
- $catEvalsLinks = array_merge($allevals, $alllinks);
- }
- }*/
- $allevals = $catcourse[0]->get_evaluations($user_id, true);
- $alllinks = $catcourse[0]->get_links($user_id, true);
+ $allevals = $category->get_evaluations($userId, true);
+ $alllinks = $category->get_links($userId, true);
$allEvalsLinks = array_merge($allevals, $alllinks);
@@ -438,13 +454,10 @@ class DisplayGradebook
for ($count = 0; $count < count($allEvalsLinks); $count++) {
$item = $allEvalsLinks[$count];
- $score = $item->calc_score($user_id);
+ $score = $item->calc_score($userId);
if (!empty($score)) {
$divide = $score[1] == 0 ? 1 : $score[1];
- //$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
- //$item_value = $score[0] / $divide * $item->get_weight() / $sub_cat_percentage * $sub_cat_percentage / $main_weight * $main_weight;
$item_value = $score[0] / $divide * $item->get_weight();
- //var_dump($score[0], $divide, $item->get_weight(), $sub_cat_percentage, $main_weight, $item_value);
$item_value_total += $item_value;
}
}
@@ -600,8 +613,6 @@ class DisplayGradebook
if ($isDrhOfCourse) {
$header .= ' | ' .
Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '';
- /*$header .= ' | ' .
- Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM) . '';*/
}
$header .= '';
@@ -609,7 +620,7 @@ class DisplayGradebook
echo $header;
if (api_is_allowed_to_edit(null, true)) {
- $weight = ((intval($catobj->get_weight()) > 0) ? $catobj->get_weight() : 0);
+ $weight = intval($catobj->get_weight()) > 0 ? $catobj->get_weight() : 0;
$weight = get_lang('TotalWeight') . ' : ' . $weight;
$min_certification = (intval($catobj->get_certificate_min_score() > 0) ? $catobj->get_certificate_min_score() : 0);
diff --git a/main/gradebook/lib/fe/gradebooktable.class.php b/main/gradebook/lib/fe/gradebooktable.class.php
index 37e20ecf08..7935e9fb9c 100755
--- a/main/gradebook/lib/fe/gradebooktable.class.php
+++ b/main/gradebook/lib/fe/gradebooktable.class.php
@@ -221,7 +221,7 @@ class GradebookTable extends SortableTable
$row[] = $invisibility_span_open.$data[2].$invisibility_span_close;
// Weight.
- $average = $scoredisplay->display_score(
+ $weight = $scoredisplay->display_score(
array(
$data['3'],
$this->currentcat->get_weight()
@@ -231,11 +231,10 @@ class GradebookTable extends SortableTable
true
);
- // Weight
if (api_is_allowed_to_edit(null, true)) {
- $row[] = $invisibility_span_open .Display::tag('h4', $average).$invisibility_span_close;
+ $row[] = $invisibility_span_open .Display::tag('h4', $weight).$invisibility_span_close;
} else {
- $row[] = $invisibility_span_open .$average.$invisibility_span_close;
+ $row[] = $invisibility_span_open .$weight.$invisibility_span_close;
}
$category_weight = $item->get_weight();
@@ -270,7 +269,8 @@ class GradebookTable extends SortableTable
}
// Students get the results and certificates columns
- if (count($this->evals_links) > 0 && $status_user != 1) {
+ //if (count($this->evals_links) > 0 && $status_user != 1) {
+ if ($status_user != 1) {
$value_data = isset($data[4]) ? $data[4] : null;
$best = isset($data['best']) ? $data['best'] : null;
$average = isset($data['average']) ? $data['average'] : null;
diff --git a/main/inc/ajax/model.ajax.php b/main/inc/ajax/model.ajax.php
index 7f08e20fc5..2ba3ae12ec 100755
--- a/main/inc/ajax/model.ajax.php
+++ b/main/inc/ajax/model.ajax.php
@@ -146,6 +146,9 @@ switch ($action) {
if (!(api_is_platform_admin(false, true))) {
//exit;
}
+
+ $sessionId = isset($_GET['session_id']) ? intval($_GET['session_id']) : 0;
+
$courseCodeList = array();
$userIdList = array();
if (api_is_drh()) {
@@ -186,12 +189,27 @@ switch ($action) {
}
} elseif (api_is_student_boss()) {
$users = UserManager::getUsersFollowedByStudentBoss($userId);
-
$userIdList = array_keys($users);
}
- $groups = GroupPortalManager::get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_ADMIN);
+ $sessionIdList = [];
+ if ($sessionId == -1) {
+ $userIdList = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus(
+ 'admin',
+ null
+ );
+ $userIdList = api_array_column($userIdList, 'user_id');
+ $sessionList = SessionManager::get_sessions_list();
+ $sessionIdList = api_array_column($sessionList, 'id');
+
+ $courseCodeList = array();
+ foreach ($sessionList as $session) {
+ $courses = SessionManager::get_course_list_by_session_id($session['id']);
+ $courseCodeList = array_merge($courseCodeList, api_array_column($courses, 'code'));
+ }
+ }
+ $groups = GroupPortalManager::get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_ADMIN);
$groupsId = array_keys($groups);
if (is_array($groupsId)) {
@@ -217,13 +235,20 @@ switch ($action) {
}
if ($action == 'get_user_course_report') {
- $count = CourseManager::get_count_user_list_from_course_code(false, null, $courseCodeList, $userIdList);
+ $count = CourseManager::get_count_user_list_from_course_code(
+ false,
+ null,
+ $courseCodeList,
+ $userIdList,
+ $sessionIdList
+ );
} else {
$count = CourseManager::get_count_user_list_from_course_code(
true,
array('ruc'),
$courseCodeList,
- $userIdList
+ $userIdList,
+ $sessionIdList
);
}
break;
@@ -460,7 +485,14 @@ $columns = array();
switch ($action) {
case 'get_course_exercise_medias':
$columns = array('question');
- $result = Question::get_course_medias($course_id, $start, $limit, $sidx, $sord, $whereCondition);
+ $result = Question::get_course_medias(
+ $course_id,
+ $start,
+ $limit,
+ $sidx,
+ $sord,
+ $whereCondition
+ );
break;
case 'get_user_course_report_resumed':
$columns = array(
@@ -508,7 +540,9 @@ switch ($action) {
true,
array('ruc'),
$courseCodeList,
- $userIdList
+ $userIdList,
+ null,
+ $sessionIdList
);
$new_result = array();
@@ -542,6 +576,7 @@ switch ($action) {
if (!in_array($sidx, array('title'))) {
$sidx = 'title';
}
+
$result = CourseManager::get_user_list_from_course_code(
null,
null,
@@ -553,7 +588,9 @@ switch ($action) {
false,
null,
$courseCodeList,
- $userIdList
+ $userIdList,
+ null,
+ $sessionIdList
);
break;
diff --git a/main/inc/email_editor.php b/main/inc/email_editor.php
index 5b7690d29c..03209e371f 100755
--- a/main/inc/email_editor.php
+++ b/main/inc/email_editor.php
@@ -29,16 +29,16 @@ $action = isset($_GET['action']) ? $_GET['action'] : null;
$form = new FormValidator('email_editor', 'post');
$form->addElement('hidden', 'dest');
$form->addElement('text', 'email_address', get_lang('EmailDestination'));
-$form->addElement('text', 'email_title', get_lang('EmailTitle'), array('class' => 'span5'));
+$form->addElement('text', 'email_title', get_lang('EmailTitle'));
$form->freeze('email_address');
-$form->addElement('textarea', 'email_text', get_lang('EmailText'), array('class' => 'span5', 'rows' => '6'));
+$form->addElement('textarea', 'email_text', get_lang('EmailText'), array('rows' => '6'));
$form->addRule('email_address', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('email_title', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('email_text', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('email_address', get_lang('EmailWrong'), 'email');
-$form->addElement('button', 'submit', get_lang('SendMail'));
+$form->addButtonSend(get_lang('SendMail'));
switch ($action) {
case 'subscribe_me_to_session':
diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php
index 3096598c78..3a278c9c3b 100644
--- a/main/inc/lib/api.lib.php
+++ b/main/inc/lib/api.lib.php
@@ -8078,3 +8078,29 @@ function apiIsSystemInstalled()
$version = $settingsRow['selected_value'];
return array('installed' => 1, 'message' => $version);
}
+
+/**
+ * Fallback for PHP 5.5 array_colum function.
+ * Return the values from a single column in the $input array
+ * @param array $input Array from which to pull a column of values
+ * @param string $columnName The column of values to return
+ * @return array
+ */
+function api_array_column($input, $columnName)
+{
+ if (function_exists('array_column')) {
+ return array_column($input, $columnName);
+ }
+
+ $result = array();
+
+ foreach ($input as $value) {
+ if (!array_key_exists($columnName, $value)) {
+ continue;
+ }
+
+ $result[] = $value[$columnName];
+ }
+
+ return $result;
+}
diff --git a/main/inc/lib/certificate.lib.php b/main/inc/lib/certificate.lib.php
index 33354e2b54..8314e9f1fc 100755
--- a/main/inc/lib/certificate.lib.php
+++ b/main/inc/lib/certificate.lib.php
@@ -148,17 +148,22 @@ class Certificate extends Model
**/
public function generate($params = array())
{
- //The user directory should be set
- if (empty($this->certification_user_path) && $this->force_certificate_generation == false) {
+ // The user directory should be set
+ if (empty($this->certification_user_path) &&
+ $this->force_certificate_generation == false
+ ) {
return false;
}
+
$params['hide_print_button'] = isset($params['hide_print_button']) ? true : false;
$my_category = Category :: load($this->certificate_data['cat_id']);
+
if (isset($my_category[0]) &&
$my_category[0]->is_certificate_available($this->user_id)
) {
$user = api_get_user_info($this->user_id);
+
$scoredisplay = ScoreDisplay :: instance();
$scorecourse = $my_category[0]->calc_score($this->user_id);
$scorecourse_display = isset($scorecourse) ? $scoredisplay->display_score($scorecourse,SCORE_AVERAGE) : get_lang('NoResultsAvailable');
diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php
index 26464d03d6..51517d7f96 100755
--- a/main/inc/lib/course.lib.php
+++ b/main/inc/lib/course.lib.php
@@ -1131,7 +1131,7 @@ class CourseManager
*
* @param int the id of the user
* @param array info about the course (comes from course table, see database lib)
- *
+ * @deprecated linked_courses definition doesn't exists
* @return true if the user is registered in the real course or linked courses, false otherwise
*/
public static function is_user_subscribed_in_real_or_linked_course($user_id, $course_code, $session_id = '')
@@ -1209,6 +1209,7 @@ class CourseManager
* @param array $courseCodeList
* @param array $userIdList
* @param string $filterByActive
+ * @param array $sessionIdList
* @return array|int
*/
public static function get_user_list_from_course_code(
@@ -1223,16 +1224,21 @@ class CourseManager
$extra_field = array(),
$courseCodeList = array(),
$userIdList = array(),
- $filterByActive = null
+ $filterByActive = null,
+ $sessionIdList = array()
) {
- // variable initialisation
+ $course_table = Database::get_main_table(TABLE_MAIN_COURSE);
+ $sessionTable = Database::get_main_table(TABLE_MAIN_SESSION);
+
$session_id = intval($session_id);
$course_code = Database::escape_string($course_code);
$courseInfo = api_get_course_info($course_code);
- $courseId = $courseInfo['real_id'];
+ $courseId = 0;
+ if (!empty($courseInfo)) {
+ $courseId = $courseInfo['real_id'];
+ }
$where = array();
-
if (empty($order_by)) {
$order_by = 'user.lastname, user.firstname';
if (api_is_western_name_order()) {
@@ -1251,17 +1257,41 @@ class CourseManager
$filter_by_status_condition = null;
- if (!empty($session_id)) {
- $sql = 'SELECT DISTINCT user.user_id, session_course_user.status as status_session, user.* ';
+ if (!empty($session_id) || !empty($sessionIdList)) {
+ $sql = 'SELECT DISTINCT
+ user.user_id,
+ session_course_user.status as status_session,
+ id_session,
+ user.*,
+ course.*,
+ session.name as session_name
+ ';
if ($return_count) {
$sql = " SELECT COUNT(user.user_id) as count";
}
+
+ $sessionCondition = " session_course_user.id_session = $session_id";
+ if (!empty($sessionIdList)) {
+ $sessionIdListTostring = implode("','", array_map('intval', $sessionIdList));
+ $sessionCondition = " session_course_user.id_session IN ('$sessionIdListTostring') ";
+ }
+
+ $courseCondition = " session_course_user.course_code = '".$course_code."' AND ";
+ if (!empty($courseCodeList)) {
+ $courseCodeListForSession = array_map(array('Database', 'escape_string'), $courseCodeList);
+ $courseCodeListForSession = implode('","', $courseCodeListForSession);
+ $courseCondition = ' session_course_user.course_code IN ("' . $courseCodeListForSession . '") AND ';
+ }
+
$sql .= ' FROM ' . Database::get_main_table(TABLE_MAIN_USER) . ' as user ';
- $sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . ' as session_course_user
+ $sql .= " LEFT JOIN ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " as session_course_user
ON
user.user_id = session_course_user.id_user AND
- session_course_user.course_code="' . $course_code . '" AND
- session_course_user.id_session = ' . $session_id;
+ $courseCondition
+ $sessionCondition
+ INNER JOIN $course_table course ON session_course_user.course_code = course.code
+ INNER JOIN $sessionTable session ON session_course_user.id_session = session.id
+ ";
$where[] = ' session_course_user.course_code IS NOT NULL ';
// 2 = coach
@@ -1304,8 +1334,7 @@ class CourseManager
if (!empty($course_code)) {
$sql .= ' AND course_rel_user.course_code="' . $course_code . '"';
} else {
- $course_table = Database::get_main_table(TABLE_MAIN_COURSE);
- $sql .= " INNER JOIN $course_table course ON course_rel_user.course_code = course.code ";
+ $sql .= " INNER JOIN $course_table course ON course_rel_user.course_code = course.code ";
}
$where[] = ' course_rel_user.course_code IS NOT NULL ';
@@ -1320,11 +1349,19 @@ class CourseManager
$sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER) . ' au ON (au.user_id = user.user_id) ';
}
+ $extraFieldWasAdded = false;
if ($return_count && $resumed_report) {
foreach ($extra_field as $extraField) {
$extraFieldInfo = UserManager::get_extra_field_information_by_name($extraField);
- $sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_USER_FIELD_VALUES) . ' as ufv
- ON (user.user_id = ufv.user_id AND (field_id = ' . $extraFieldInfo['id'] . ' OR field_id IS NULL ) )';
+ if (!empty($extraFieldInfo)) {
+ $fieldValuesTable = Database::get_main_table(TABLE_MAIN_USER_FIELD_VALUES);
+ $sql .= ' LEFT JOIN '.$fieldValuesTable.' as ufv
+ ON (
+ user.user_id = ufv.user_id AND
+ (field_id = '.$extraFieldInfo['id'].' OR field_id IS NULL)
+ )';
+ $extraFieldWasAdded = true;
+ }
}
}
@@ -1335,14 +1372,16 @@ class CourseManager
$sql .= " AND (access_url_id = $current_access_url_id ) ";
}
- if ($return_count && $resumed_report) {
+ if ($return_count && $resumed_report && $extraFieldWasAdded) {
$sql .= ' AND field_id IS NOT NULL GROUP BY field_value ';
}
if (!empty($courseCodeList)) {
$courseCodeList = array_map(array('Database', 'escape_string'), $courseCodeList);
$courseCodeList = implode('","', $courseCodeList);
- $sql .= ' AND course.code IN ("' . $courseCodeList . '")';
+ if (empty($sessionIdList)) {
+ $sql .= ' AND course.code IN ("'.$courseCodeList.'")';
+ }
}
if (!empty($userIdList)) {
@@ -1392,34 +1431,51 @@ class CourseManager
$user_info['status_session'] = $user['status_session'];
}
+ $sessionId = isset($user['id_session']) ? $user['id_session'] : 0;
+ $course_code = isset($user['code']) ? $user['code'] : null;
+
if ($add_reports) {
- $course_code = $user['code'];
if ($resumed_report) {
- foreach ($extra_fields as $extra) {
- if (in_array($extra['1'], $extra_field)) {
- $user_data = UserManager::get_extra_user_data_by_field($user['user_id'], $extra['1']);
- break;
+ $extra = array();
+
+ if (!empty($extra_fields)) {
+ foreach ($extra_fields as $extra) {
+ if (in_array($extra['1'], $extra_field)) {
+ $user_data = UserManager::get_extra_user_data_by_field(
+ $user['user_id'],
+ $extra['1']
+ );
+ break;
+ }
}
}
- if (empty($user_data[$extra['1']])) {
- $row_key = '-1';
- $name = '-';
- } else {
- $row_key = $user_data[$extra['1']];
- $name = $user_data[$extra['1']];
+ $row_key = '-1';
+ $name = '-';
+
+ if (!empty($extra)) {
+ if (!empty($user_data[$extra['1']])) {
+ $row_key = $user_data[$extra['1']];
+ $name = $user_data[$extra['1']];
+ $users[$row_key]['extra_'.$extra['1']] = $name;
+ }
}
- $users[$row_key]['extra_' . $extra['1']] = $name;
- $users[$row_key]['training_hours'] += Tracking::get_time_spent_on_the_course($user['user_id'],
- $courseId, 0);
+ $users[$row_key]['training_hours'] += Tracking::get_time_spent_on_the_course(
+ $user['user_id'],
+ $courseId,
+ $sessionId
+ );
+
$users[$row_key]['count_users'] += $counter;
$registered_users_with_extra_field = 0;
if (!empty($name) && $name != '-') {
$name = Database::escape_string($name);
- $sql = "SELECT count(user_id) as count FROM $table_user_field_value WHERE field_value = '$name'";
+ $sql = "SELECT count(user_id) as count
+ FROM $table_user_field_value
+ WHERE field_value = '$name'";
$result_count = Database::query($sql);
if (Database::num_rows($result_count)) {
$row_count = Database::fetch_array($result_count);
@@ -1430,10 +1486,19 @@ class CourseManager
$users[$row_key]['count_users_registered'] = $registered_users_with_extra_field;
$users[$row_key]['average_hours_per_user'] = $users[$row_key]['training_hours'] / $users[$row_key]['count_users'];
- $category = Category:: load(null, null, $course_code);
+ $category = Category:: load(
+ null,
+ null,
+ $course_code,
+ null,
+ null,
+ $sessionId
+ );
+
if (!isset($users[$row_key]['count_certificates'])) {
$users[$row_key]['count_certificates'] = 0;
}
+
if (isset($category[0]) && $category[0]->is_certificate_available($user['user_id'])) {
$users[$row_key]['count_certificates']++;
}
@@ -1450,23 +1515,41 @@ class CourseManager
}
}
}
-
} else {
- $report_info['course'] = $user['title'];
+ $sessionName = !empty($sessionId) ? ' - '.$user['session_name'] : '';
+ $report_info['course'] = $user['title'].$sessionName;
$report_info['user'] = api_get_person_name($user['firstname'], $user['lastname']);
- $report_info['time'] = api_time_to_hms(Tracking::get_time_spent_on_the_course($user['user_id'],
- $courseId, 0));
+ $report_info['time'] = api_time_to_hms(
+ Tracking::get_time_spent_on_the_course(
+ $user['user_id'],
+ $courseId,
+ $sessionId
+ )
+ );
+
+ $category = Category:: load(
+ null,
+ null,
+ $course_code,
+ null,
+ null,
+ $sessionId
+ );
- $category = Category:: load(null, null, $course_code);
$report_info['certificate'] = Display::label(get_lang('No'));
if (isset($category[0]) && $category[0]->is_certificate_available($user['user_id'])) {
$report_info['certificate'] = Display::label(get_lang('Yes'), 'success');
}
- $progress = intval(Tracking::get_avg_student_progress($user['user_id'], $course_code, array(),
- 0));
- $report_info['progress_100'] = $progress == 100 ? Display::label(get_lang('Yes'),
- 'success') : Display::label(get_lang('No'));
+ $progress = intval(
+ Tracking::get_avg_student_progress(
+ $user['user_id'],
+ $course_code,
+ array(),
+ $sessionId
+ )
+ );
+ $report_info['progress_100'] = $progress == 100 ? Display::label(get_lang('Yes'), 'success') : Display::label(get_lang('No'));
$report_info['progress'] = $progress . "%";
foreach ($extra_fields as $extra) {
@@ -1480,6 +1563,7 @@ class CourseManager
}
}
}
+
return $users;
}
@@ -1488,13 +1572,15 @@ class CourseManager
* @param array $extra_field
* @param array $courseCodeList
* @param array $userIdList
+ * @param array $sessionIdList
* @return array|int
*/
static function get_count_user_list_from_course_code(
$resumed_report = false,
$extra_field = array(),
$courseCodeList = array(),
- $userIdList = array()
+ $userIdList = array(),
+ $sessionIdList = array()
) {
return self::get_user_list_from_course_code(
null,
@@ -1507,7 +1593,9 @@ class CourseManager
$resumed_report,
$extra_field,
$courseCodeList,
- $userIdList
+ $userIdList,
+ null,
+ $sessionIdList
);
}
@@ -2393,19 +2481,24 @@ class CourseManager
}
// get course list auto-register
- $sql = "SELECT DISTINCT(tcfv.course_code) FROM $tbl_course_field_value tcfv INNER JOIN $tbl_course_field tcf
+ $sql = "SELECT DISTINCT(tcfv.course_code)
+ FROM $tbl_course_field_value tcfv
+ INNER JOIN $tbl_course_field tcf
ON tcfv.field_id = tcf.id $join_access_url
- WHERE tcf.field_variable = 'special_course' AND tcfv.field_value = 1 $where_access_url";
- $special_course_result = Database::query($sql);
- $special_course_list = array();
-
- if (Database::num_rows($special_course_result) > 0) {
- $special_course_list = array();
- while ($result_row = Database::fetch_array($special_course_result)) {
- $special_course_list[] = $result_row['course_code'];
+ WHERE
+ tcf.field_variable = 'special_course' AND
+ tcfv.field_value = 1 $where_access_url";
+
+ $result = Database::query($sql);
+ $courseList = array();
+
+ if (Database::num_rows($result) > 0) {
+ while ($result_row = Database::fetch_array($result)) {
+ $courseList[] = $result_row['course_code'];
}
}
- return $special_course_list;
+
+ return $courseList;
}
/**
@@ -3427,10 +3520,17 @@ class CourseManager
$with_special_courses = ' course.code IN ("' . implode('","', $special_course_list) . '")';
}
$html = null;
-
+ $courseCount = 0;
if (!empty($with_special_courses)) {
- $sql = "SELECT course.id, course.code, course.subscribe subscr, course.unsubscribe unsubscr, course_rel_user.status status,
- course_rel_user.sort sort, course_rel_user.user_course_cat user_course_cat, course_rel_user.user_id
+ $sql = "SELECT
+ course.id,
+ course.code,
+ course.subscribe subscr,
+ course.unsubscribe unsubscr,
+ course_rel_user.status status,
+ course_rel_user.sort sort,
+ course_rel_user.user_course_cat user_course_cat,
+ course_rel_user.user_id
FROM $tbl_course course
LEFT JOIN $tbl_course_user course_rel_user
ON course.code = course_rel_user.course_code AND course_rel_user.user_id = '$user_id'
@@ -3438,6 +3538,7 @@ class CourseManager
$rs_special_course = Database::query($sql);
$number_of_courses = Database::num_rows($rs_special_course);
+
$key = 0;
if ($number_of_courses > 0) {
@@ -3446,9 +3547,9 @@ class CourseManager
if ($course_info['visibility'] == COURSE_VISIBILITY_HIDDEN) {
continue;
}
+ $courseCount++;
$params = array();
// Get notifications.
-
$course_info['id_session'] = null;
$course_info['status'] = $course['status'];
$show_notification = Display::show_notification($course_info);
@@ -3521,7 +3622,10 @@ class CourseManager
}
}
- return $html;
+ return [
+ 'html' => $html,
+ 'course_count' => $courseCount
+ ];
}
/**
@@ -3544,6 +3648,7 @@ class CourseManager
$sql = "SELECT id, title FROM $tucc WHERE user_id='" . $user_id . "' ORDER BY sort ASC";
$result = Database::query($sql);
$html = null;
+ $courseCount = 0;
while ($row = Database::fetch_array($result)) {
// We simply display the title of the category.
$params = array(
@@ -3552,16 +3657,24 @@ class CourseManager
'title' => $row['title'],
'class' => 'table_user_course_category'
);
+
+ $courseInCategory = self:: display_courses_in_category($row['id'], $load_dirs);
$html .= self::course_item_parent(
self::course_item_html($params, true),
- self:: display_courses_in_category($row['id'], $load_dirs)
+ $courseInCategory['html']
);
+ $courseCount += $courseInCategory['course_count'];
}
// Step 2: We display the course without a user category.
- $html .= self:: display_courses_in_category(0, $load_dirs);
-
- return $html;
+ $courseInCategory = self:: display_courses_in_category(0, $load_dirs);
+ $html .= $courseInCategory['html'];
+ $courseCount += $courseInCategory['course_count'];
+
+ return [
+ 'html' => $html,
+ 'course_count' => $courseCount
+ ];
}
/**
@@ -3622,7 +3735,7 @@ class CourseManager
$course_list = array();
$showCustomIcon = api_get_configuration_value('course_images_in_courses_list');
-
+ $courseCount = 0;
// Browse through all courses.
while ($course = Database::fetch_array($result)) {
$course_info = api_get_course_info($course['code']);
@@ -3641,6 +3754,8 @@ class CourseManager
$course_list[] = $course_info['real_id'];
}
+ $courseCount++;
+
// For each course, get if there is any notification icon to show
// (something that would have changed since the user's last visit).
$show_notification = Display::show_notification($course_info);
@@ -3740,7 +3855,10 @@ class CourseManager
$html .= self::course_item_html($params, $isSubcontent);
}
- return $html;
+ return [
+ 'html' => $html,
+ 'course_count' => $courseCount
+ ];
}
/**
diff --git a/main/inc/lib/course_category.lib.php b/main/inc/lib/course_category.lib.php
index 7c7f44ca42..5402d98a4b 100755
--- a/main/inc/lib/course_category.lib.php
+++ b/main/inc/lib/course_category.lib.php
@@ -958,56 +958,57 @@ function getCataloguePagination($pageCurrent, $pageLength, $pageTotal)
return $pageDiv;
}
-
- /**
- * Return URL to course catalog
- * @param int $pageCurrent
- * @param int $pageLength
- * @param string $categoryCode
- * @param int $hiddenLinks
- * @param string $action
- * @return string
- */
- function getCourseCategoryUrl(
- $pageCurrent,
- $pageLength,
- $categoryCode = null,
- $hiddenLinks = null,
- $action = null
- ) {
- $action = isset($action) ? Security::remove_XSS($action) : Security::remove_XSS($_REQUEST['action']);
- $searchTerm = isset($_REQUEST['search_term']) ? Security::remove_XSS($_REQUEST['search_term']) : null;
+/**
+ * Return URL to course catalog
+ * @param int $pageCurrent
+ * @param int $pageLength
+ * @param string $categoryCode
+ * @param int $hiddenLinks
+ * @param string $action
+ * @return string
+ */
+function getCourseCategoryUrl(
+ $pageCurrent,
+ $pageLength,
+ $categoryCode = null,
+ $hiddenLinks = null,
+ $action = null
+) {
+ $requestAction = isset($_REQUEST['action']) ? Security::remove_XSS($_REQUEST['action']) : null;
+ $action = isset($action) ? Security::remove_XSS($action) : $requestAction;
+ $searchTerm = isset($_REQUEST['search_term']) ? Security::remove_XSS($_REQUEST['search_term']) : null;
+
+ $categoryCodeRequest = isset($_REQUEST['category_code']) ? Security::remove_XSS($_REQUEST['category_code']) : null;
+ $categoryCode = isset($categoryCode) ? Security::remove_XSS($categoryCode) : $categoryCodeRequest;
+
+ $hiddenLinksRequest = isset($_REQUEST['hidden_links']) ? Security::remove_XSS($_REQUEST['hidden_links']) : null;
+ $hiddenLinks = isset($hiddenLinks) ? Security::remove_XSS($hiddenLinksRequest) : $categoryCodeRequest;
// Start URL with params
- $pageUrl = api_get_self() .
- '?action=' . $action .
- '&category_code=' . (
- isset($categoryCode) ? $categoryCode :
- Security::remove_XSS($_REQUEST['category_code'])
- ) .
- '&hidden_links=' . (
- isset($hiddenLinks) ? $hiddenLinks :
- Security::remove_XSS($_REQUEST['hidden_links'])
- ).
- '&pageCurrent=' . $pageCurrent .
- '&pageLength=' . $pageLength
- ;
- switch ($action) {
- case 'subscribe' :
- // for search
- $pageUrl .=
- '&search_term=' . $searchTerm .
- '&search_course=1' .
- '&sec_token=' . $_SESSION['sec_token'];
- break;
- case 'display_courses' :
- // No break
- default :
- break;
+ $pageUrl = api_get_self() .
+ '?action=' . $action .
+ '&category_code=' .$categoryCode.
+ '&hidden_links=' .$hiddenLinks.
+ '&pageCurrent=' . $pageCurrent .
+ '&pageLength=' . $pageLength
+ ;
- }
+ switch ($action) {
+ case 'subscribe' :
+ // for search
+ $pageUrl .=
+ '&search_term=' . $searchTerm .
+ '&search_course=1' .
+ '&sec_token=' . $_SESSION['sec_token'];
+ break;
+ case 'display_courses' :
+ // No break
+ default :
+ break;
+
+ }
- return $pageUrl;
+ return $pageUrl;
}
/**
@@ -1027,7 +1028,7 @@ function getPageNumberItem($pageNumber, $pageLength, $liAttributes = array(), $c
);
// If is current page ('active' class) clear URL
- if (isset($liAttributes) && is_array($liAttributes)) {
+ if (isset($liAttributes) && is_array($liAttributes) && isset($liAttributes['class'])) {
if (strpos('active', $liAttributes['class']) !== false) {
$url = '';
}
diff --git a/main/inc/lib/extra_field_value.lib.php b/main/inc/lib/extra_field_value.lib.php
index c29c7f1c6a..793c79f6dc 100755
--- a/main/inc/lib/extra_field_value.lib.php
+++ b/main/inc/lib/extra_field_value.lib.php
@@ -115,8 +115,10 @@ class ExtraFieldValue extends Model
// Parse params.
foreach ($params as $key => $value) {
if (substr($key, 0, 6) == 'extra_' || substr($key, 0, 7) == '_extra_') {
+
// An extra field.
$field_variable = substr($key, 6);
+
$extra_field_info = $extra_field->get_handler_field_info_by_field_variable($field_variable);
if ($extra_field_info) {
@@ -124,8 +126,7 @@ class ExtraFieldValue extends Model
$comment = isset($params[$commentVariable]) ? $params[$commentVariable] : null;
switch ($extra_field_info['field_type']) {
- case ExtraField::FIELD_TYPE_TAG :
-
+ case ExtraField::FIELD_TYPE_TAG:
$old = self::getAllValuesByItemAndField(
$params[$this->handler_id],
$extra_field_info['id']
@@ -242,12 +243,14 @@ class ExtraFieldValue extends Model
break;
default;
$new_params = array(
- $this->handler_id => $params[$this->handler_id],
- 'field_id' => $extra_field_info['id'],
- 'field_value' => $value
+ $this->handler_id => $params[$this->handler_id],
+ 'field_id' => $extra_field_info['id'],
+ 'field_value' => $value
);
- if ($this->handler_id !== 'session_id' && $this->handler_id !== 'course_code') {
+ if ($this->handler_id !== 'session_id' &&
+ $this->handler_id !== 'course_code'
+ ) {
$new_params['comment'] = $comment;
}
@@ -460,6 +463,7 @@ class ExtraFieldValue extends Model
}
} else {
$params['id'] = $field_values['id'];
+
return parent::update($params, $show_query);
}
}
diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php
index 3d92d9cfee..b834e5f8cf 100755
--- a/main/inc/lib/tracking.lib.php
+++ b/main/inc/lib/tracking.lib.php
@@ -1291,12 +1291,19 @@ class Tracking
$condition_user = " AND user_id = $user_id ";
}
- $sql = "SELECT SUM(UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date)) as nb_seconds
- FROM $tbl_track_course
- WHERE
- UNIX_TIMESTAMP(logout_course_date) > UNIX_TIMESTAMP(login_course_date) AND
- c_id = '$courseId' AND
- session_id = '$session_id' $condition_user";
+ $sql = "SELECT SUM(UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date)) as nb_seconds "
+ . "FROM $tbl_track_course "
+ . "WHERE UNIX_TIMESTAMP(logout_course_date) > UNIX_TIMESTAMP(login_course_date) ";
+
+ if ($courseId != 0) {
+ $sql .= "AND c_id = '$courseId' ";
+ }
+
+ if ($session_id != -1) {
+ $sql .= "AND session_id = '$session_id' ";
+ }
+
+ $sql .= $condition_user;
$rs = Database::query($sql);
$row = Database::fetch_array($rs);
diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php
index 82ab00eebc..26183fe95c 100755
--- a/main/inc/lib/usermanager.lib.php
+++ b/main/inc/lib/usermanager.lib.php
@@ -55,7 +55,7 @@ class UserManager
* @param string Phone number (optional)
* @param string Picture URI (optional)
* @param string Authentication source (optional, defaults to 'platform', dependind on constant)
- * @param string Account expiration date (optional, defaults to '0000-00-00 00:00:00')
+ * @param string Account expiration date (optional, defaults to null)
* @param int Whether the account is enabled or disabled by default
* @param int The department of HR in which the user is registered (optional, defaults to 0)
* @param array Extra fields
@@ -79,7 +79,7 @@ class UserManager
$phone = '',
$picture_uri = '',
$auth_source = PLATFORM_AUTH_SOURCE,
- $expiration_date = null,
+ $expirationDate = null,
$active = 1,
$hr_dept_id = 0,
$extra = null,
@@ -163,10 +163,19 @@ class UserManager
$currentDate = api_get_utc_datetime();
$now = new DateTime($currentDate);
- $manager = Database::getManager();
- if (!empty($expiration_date)) {
- $expiration_date = new \DateTime($expiration_date);
+ if (empty($expirationDate)) {
+ // Default expiration date
+ // if there is a default duration of a valid account then
+ // we have to change the expiration_date accordingly
+ $expirationDate = new DateTime($currentDate);
+ if (api_get_setting('account_valid_duration') != '') {
+ $days = intval(api_get_setting('account_valid_duration'));
+ $expirationDate->modify('+'.$days.' day');
+ }
+ } else {
+ $expirationDate = api_get_utc_datetime($expirationDate);
+ $expirationDate = new \DateTime($expirationDate);
}
$user = new User();
@@ -183,32 +192,13 @@ class UserManager
->setPhone($phone)
->setLanguage($language)
->setRegistrationDate($now)
- ->setExpirationDate($expiration_date)
+ ->setExpirationDate($expirationDate)
->setHrDeptId($hr_dept_id)
->setActive($active);
+ $manager = Database::getManager();
$manager->persist($user);
$manager->flush();
-
- /*$sql = "INSERT INTO $table_user
- SET lastname = '".Database::escape_string(trim($lastName))."',
- firstname = '".Database::escape_string(trim($firstName))."',
- username = '".Database::escape_string(trim($loginName))."',
- status = '".Database::escape_string($status)."',
- password = '".Database::escape_string($password)."',
- email = '".Database::escape_string($email)."',
- official_code = '".Database::escape_string($official_code)."',
- picture_uri = '".Database::escape_string($picture_uri)."',
- creator_id = '".Database::escape_string($creator_id)."',
- auth_source = '".Database::escape_string($auth_source)."',
- phone = '".Database::escape_string($phone)."',
- language = '".Database::escape_string($language)."',
- registration_date = '".$current_date."',
- expiration_date = '".Database::escape_string($expiration_date)."',
- hr_dept_id = '".Database::escape_string($hr_dept_id)."',
- active = '".Database::escape_string($active)."'";
-
- $result = Database::query($sql);*/
$userId = $user->getId();
if (!empty($userId)) {
@@ -251,7 +241,7 @@ class UserManager
$plugin = new AppPlugin();
$additionalParameters = array(
- 'smsType' => constant($plugin->getSMSPluginName().'::WELCOME_LOGIN_PASSWORD'),
+ 'smsType' => constant($plugin->getSMSPluginName().':: WELCOME_LOGIN_PASSWORD'),
'userId' => $return,
'mobilePhoneNumber' => $phoneNumber,
'password' => $original_password
@@ -677,6 +667,7 @@ class UserManager
}
if (!empty($expiration_date)) {
+ $expiration_date = api_get_utc_datetime($expiration_date);
$expiration_date = new \DateTime($expiration_date);
}
@@ -2743,7 +2734,6 @@ class UserManager
}
if (api_is_allowed_to_create_course()) {
-
foreach ($sessions as $enreg) {
$session_id = $enreg['id'];
$session_visibility = api_get_session_visibility($session_id);
@@ -2752,6 +2742,8 @@ class UserManager
continue;
}
+ // This query is horribly slow when more than a few thousand
+ // users and just a few sessions to which they are subscribed
$id_session = $enreg['id'];
$personal_course_list_sql = "SELECT DISTINCT
course.code code,
diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php
index 81a4828af7..189326b126 100755
--- a/main/inc/lib/userportal.lib.php
+++ b/main/inc/lib/userportal.lib.php
@@ -1040,17 +1040,23 @@ class IndexManager
$courses_html = '';
$special_courses = '';
+ $sessionCount = 0;
+ $courseCount = 0;
// If we're not in the history view...
if (!isset($_GET['history'])) {
// Display special courses.
- $special_courses = CourseManager::display_special_courses($user_id, $this->load_directories_preview);
+ $specialCourses = CourseManager::display_special_courses($user_id, $this->load_directories_preview);
+ $special_courses = $specialCourses['html'];
// Display courses.
- $courses_html .= CourseManager::display_courses($user_id, $this->load_directories_preview);
+ $courses = CourseManager::display_courses($user_id, $this->load_directories_preview);
+ $courses_html .= $courses['html'];
+ $courseCount = $specialCourses['course_count'] + $courses['course_count'];
}
$sessions_with_category = '';
$sessions_with_no_category = '';
+
if (is_array($session_categories)) {
foreach ($session_categories as $session_category) {
$session_category_id = $session_category['session_category']['id'];
@@ -1185,10 +1191,11 @@ class IndexManager
$parentInfo = CourseManager::course_item_html_no_icon($params);
}
-
$sessions_with_no_category .= CourseManager::course_item_parent(
$parentInfo,null
);
+
+ $sessionCount++;
}
}
} else {
@@ -1203,6 +1210,7 @@ class IndexManager
if (count($session['courses']) < 1) {
continue;
}
+
$date_session_start = $session['date_start'];
$date_session_end = $session['date_end'];
$days_access_before_beginning = $session['nb_days_access_before_beginning'];
@@ -1313,6 +1321,8 @@ class IndexManager
}
$html_sessions .= $parentInfo . $html_courses_session;
+
+ $sessionCount++;
}
}
}
@@ -1354,9 +1364,11 @@ class IndexManager
}
}
- return $sessions_with_category.
- $sessions_with_no_category.
- $courses_html.$special_courses;
+ return [
+ 'html' => $sessions_with_category.$sessions_with_no_category.$courses_html.$special_courses,
+ 'session_count' => $sessionCount,
+ 'course_count' => $courseCount
+ ];
}
/**
diff --git a/main/install/database.sql b/main/install/database.sql
index fdce332cba..a03c8cd9ed 100644
--- a/main/install/database.sql
+++ b/main/install/database.sql
@@ -2724,9 +2724,7 @@ CREATE TABLE IF NOT EXISTS message_attachment (
PRIMARY KEY (id)
);
-
-
-INSERT INTO course_field (field_type, field_variable, field_display_text, field_default_value, field_visible, field_changeable) values (10, 'special_course','Special course', '', 1 , 1);
+INSERT INTO course_field (field_type, field_variable, field_display_text, field_default_value, field_visible, field_changeable) values (1, 'special_course', 'Special course', '', 1 , 1);
--
-- Table structure for table block
@@ -4729,5 +4727,5 @@ CREATE TABLE c_attendance_calendar_rel_group (
-- Version
LOCK TABLES settings_current WRITE;
-UPDATE settings_current SET selected_value = '1.10.0.30' WHERE variable = 'chamilo_database_version';
+UPDATE settings_current SET selected_value = '1.10.0.31' WHERE variable = 'chamilo_database_version';
UNLOCK TABLES;
diff --git a/main/install/index.php b/main/install/index.php
index 53f6bfeba8..a64db23a12 100755
--- a/main/install/index.php
+++ b/main/install/index.php
@@ -453,7 +453,7 @@ if ($encryptPassForm == '1') {
|