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 - - - - - - + <?php echo custompages_get_lang('Registration');?> + + + + + + + + + + + -
- -
-
- -
-
'; - }?> - display(); - ?> -
- -
- -
- - + +
+
+
+
+
+ + '.$content['error'].'
'; + }?> +
+ + +
+ +
+
+
+ +
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 - - - - - - + <?php echo custompages_get_lang('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') {
-
+
@@ -479,7 +479,7 @@ if ($encryptPassForm == '1') { echo ''; ?>
-
+
  1. >
  2. @@ -498,7 +498,7 @@ if ($encryptPassForm == '1') {
-
+
-
+
+                
+            
diff --git a/main/install/migrate-db-1.9.0-1.10.0-pre.sql b/main/install/migrate-db-1.9.0-1.10.0-pre.sql index fecb5a25a3..10befbc9c8 100644 --- a/main/install/migrate-db-1.9.0-1.10.0-pre.sql +++ b/main/install/migrate-db-1.9.0-1.10.0-pre.sql @@ -124,5 +124,7 @@ CREATE TABLE IF NOT EXISTS c_student_publication_rel_user (id INT PRIMARY KEY N CREATE TABLE IF NOT EXISTS c_student_publication_comment (id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, work_id INT NOT NULL, c_id INT NOT NULL, comment text, file VARCHAR(255), user_id int NOT NULL, sent_at datetime NOT NULL); CREATE TABLE IF NOT EXISTS c_attendance_calendar_rel_group (id int NOT NULL auto_increment PRIMARY KEY, c_id INT NOT NULL, group_id INT NOT NULL, calendar_id INT NOT NULL); +UPDATE course_field SET field_type = 1 WHERE field_variable = 'special_course'; + -- Do not move this query -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'; diff --git a/main/lang/arabic/trad4all.inc.php b/main/lang/arabic/trad4all.inc.php index c77639c209..8c2a4c310d 100755 --- a/main/lang/arabic/trad4all.inc.php +++ b/main/lang/arabic/trad4all.inc.php @@ -1961,7 +1961,7 @@ $localLangName = "اللغة"; $email = "البريد الإلكتروني"; $CourseCodeAlreadyExists = "عفوا ! رمز المقرر مستخدم مسبقا, فضلا اختر واحدا أخر."; $Statistics = "احصائيات"; -$Grouplist = "قائمة المجموعات"; +$GroupList = "قائمة المجموعات"; $Previous = "السابق"; $DestDirectoryDoesntExist = "المجلد المقصود غير موجود"; $Courses = "مقررات"; diff --git a/main/lang/asturian/trad4all.inc.php b/main/lang/asturian/trad4all.inc.php index 93f5b3e4ef..df800407d9 100755 --- a/main/lang/asturian/trad4all.inc.php +++ b/main/lang/asturian/trad4all.inc.php @@ -2558,7 +2558,7 @@ $localLangName = "llingua"; $email = "e-maill"; $CourseCodeAlreadyExists = "Perdón, pero esti códigu yá esiste. Escueya otru, por favor."; $Statistics = "Estadístiques"; -$Grouplist = "llistáu de grupos"; +$GroupList = "llistáu de grupos"; $Previous = "Anterior"; $DestDirectoryDoesntExist = "El direutoriu de destín nun esiste"; $Courses = "cursos"; diff --git a/main/lang/basque/trad4all.inc.php b/main/lang/basque/trad4all.inc.php index e12cedc851..ee7059d22b 100755 --- a/main/lang/basque/trad4all.inc.php +++ b/main/lang/basque/trad4all.inc.php @@ -2649,7 +2649,7 @@ $localLangName = "hizkuntza"; $email = "e-mail"; $CourseCodeAlreadyExists = "Sentitzen dugu, baina kode hau badago lehendik. Mesedez, hautatu beste bat."; $Statistics = "Estatistikak"; -$Grouplist = "Talde zerrenda"; +$GroupList = "Talde zerrenda"; $Previous = "Aurrekoa"; $DestDirectoryDoesntExist = "Ez da helburuko karpetarik"; $Courses = "Ikastaroak"; diff --git a/main/lang/brazilian/trad4all.inc.php b/main/lang/brazilian/trad4all.inc.php index 1faa7eaf8a..b4495519c1 100755 --- a/main/lang/brazilian/trad4all.inc.php +++ b/main/lang/brazilian/trad4all.inc.php @@ -3038,7 +3038,7 @@ $localLangName = "Idioma"; $email = "e-mail"; $CourseCodeAlreadyExists = "Perdão, mas o código do curso já existe. Por favor escolha outro."; $Statistics = "Estatísticas"; -$Grouplist = "lista de grupos"; +$GroupList = "lista de grupos"; $Previous = "prever"; $DestDirectoryDoesntExist = "Diretório de destino inexistente"; $Courses = "cursos"; diff --git a/main/lang/bulgarian/trad4all.inc.php b/main/lang/bulgarian/trad4all.inc.php index bdfa55c119..d95d48aa2b 100755 --- a/main/lang/bulgarian/trad4all.inc.php +++ b/main/lang/bulgarian/trad4all.inc.php @@ -2543,7 +2543,7 @@ $localLangName = "български"; $email = "E-mail"; $CourseCodeAlreadyExists = "Този код на курс вече е зает. Моля, въведете друг код."; $Statistics = "Статистика"; -$Grouplist = "Списък на групите"; +$GroupList = "Списък на групите"; $Previous = "Предишен"; $DestDirectoryDoesntExist = "Папката-приемник не съществува."; $Courses = "Курсове"; diff --git a/main/lang/catalan/trad4all.inc.php b/main/lang/catalan/trad4all.inc.php index 10480b8e79..ff8cf8dd34 100755 --- a/main/lang/catalan/trad4all.inc.php +++ b/main/lang/catalan/trad4all.inc.php @@ -2823,7 +2823,7 @@ $localLangName = "idioma"; $email = "e-mail"; $CourseCodeAlreadyExists = "Trist, però aquell codi de curs ja existeix. Si us plau esculli'n un altre."; $Statistics = "Estadístiques"; -$Grouplist = "Llista de grups"; +$GroupList = "Llista de grups"; $Previous = "previ"; $DestDirectoryDoesntExist = "El directori de destinació no existeix"; $Courses = "Cursos"; diff --git a/main/lang/croatian/trad4all.inc.php b/main/lang/croatian/trad4all.inc.php index c392e707b1..039aa0c46d 100755 --- a/main/lang/croatian/trad4all.inc.php +++ b/main/lang/croatian/trad4all.inc.php @@ -1741,7 +1741,7 @@ $localLangName = "jezik"; $email = "elektronička pošta"; $CourseCodeAlreadyExists = "Žao nam je, ali ta je šifra kolegija već u uporabi. Molimo odaberite drugu."; $Statistics = "Statistika"; -$Grouplist = "popis skupina"; +$GroupList = "popis skupina"; $Previous = "prethodni"; $DestDirectoryDoesntExist = "Odabrana mapa ne postoji"; $Courses = "kolegiji"; diff --git a/main/lang/czech/trad4all.inc.php b/main/lang/czech/trad4all.inc.php index 594ec3149b..a2214e9588 100755 --- a/main/lang/czech/trad4all.inc.php +++ b/main/lang/czech/trad4all.inc.php @@ -1609,7 +1609,7 @@ $localLangName = "jazyk"; $email = "e-mail"; $CourseCodeAlreadyExists = "Lituji, ale takový kód kurzu již existuje. Prosím zvolte jiný."; $Statistics = "Statistika"; -$Grouplist = "seznam skupin"; +$GroupList = "seznam skupin"; $Previous = "předchozí"; $DestDirectoryDoesntExist = "Cílový adresář neexistuje"; $ShowAll = "Ukaž vše"; diff --git a/main/lang/danish/trad4all.inc.php b/main/lang/danish/trad4all.inc.php index e2835e789d..04f2ffd3c7 100755 --- a/main/lang/danish/trad4all.inc.php +++ b/main/lang/danish/trad4all.inc.php @@ -1769,7 +1769,7 @@ $localLangName = "sprog"; $email = "Email"; $CourseCodeAlreadyExists = "Beklager, men den valgte kursuskode eksisterer allerede. Vælg venligst en anden."; $Statistics = "Statistikker"; -$Grouplist = "gruppeliste"; +$GroupList = "gruppeliste"; $Previous = "forrige"; $DestDirectoryDoesntExist = "Mappen eksisterer ikke"; $Courses = "kurser"; diff --git a/main/lang/dutch/trad4all.inc.php b/main/lang/dutch/trad4all.inc.php index cea546828a..e068b67705 100755 --- a/main/lang/dutch/trad4all.inc.php +++ b/main/lang/dutch/trad4all.inc.php @@ -2588,7 +2588,7 @@ $localLangName = "Nederlands"; $email = "E-mail"; $CourseCodeAlreadyExists = "Deze cursuscode is al in gebruik. Gelieve een andere te kiezen."; $Statistics = "Statistieken"; -$Grouplist = "Groepenlijst"; +$GroupList = "Groepenlijst"; $Previous = "Vorige"; $DestDirectoryDoesntExist = "De bestemmingsmap bestaat niet"; $Courses = "cursussen"; diff --git a/main/lang/english/trad4all.inc.php b/main/lang/english/trad4all.inc.php index 59aa13c9ce..9ba73e1b32 100755 --- a/main/lang/english/trad4all.inc.php +++ b/main/lang/english/trad4all.inc.php @@ -3082,7 +3082,7 @@ $localLangName = "language"; $email = "e-mail"; $CourseCodeAlreadyExists = "Sorry, but that training code already exists. Please choose another one."; $Statistics = "Statistics"; -$Grouplist = "Groups list"; +$GroupList = "Groups list"; $Previous = "Previous"; $DestDirectoryDoesntExist = "The target folder does not exist"; $Courses = "Courses"; diff --git a/main/lang/esperanto/trad4all.inc.php b/main/lang/esperanto/trad4all.inc.php index 7d444f7175..e37f8e14a1 100755 --- a/main/lang/esperanto/trad4all.inc.php +++ b/main/lang/esperanto/trad4all.inc.php @@ -1534,7 +1534,7 @@ $localLangName = "Esperanto"; $email = "Retpoŝto XX"; $CourseCodeAlreadyExists = "Tiu kurskodo jam ekzistas. Bonvolu elekti alian."; $Statistics = "Statistikoj"; -$Grouplist = "Gruplisto"; +$GroupList = "Gruplisto"; $Previous = "Antaŭa"; $Courses = "kursoj"; $In = "en"; diff --git a/main/lang/finnish/trad4all.inc.php b/main/lang/finnish/trad4all.inc.php index 567c996fb5..54973abeda 100755 --- a/main/lang/finnish/trad4all.inc.php +++ b/main/lang/finnish/trad4all.inc.php @@ -1324,7 +1324,7 @@ $localLangName = "kieli"; $email = "sähköposti"; $CourseCodeAlreadyExists = "Kurssikoodi on jo käytössä. Ole hyvä ja valitse toinen."; $Statistics = "Tilastot"; -$Grouplist = "ryhmälista"; +$GroupList = "ryhmälista"; $Previous = "edellinen"; $DestDirectoryDoesntExist = "Kohde hakemistoa ei ole olemassa"; $Courses = "kurssit"; diff --git a/main/lang/french/trad4all.inc.php b/main/lang/french/trad4all.inc.php index 7ec9addc6a..53d43f9f20 100755 --- a/main/lang/french/trad4all.inc.php +++ b/main/lang/french/trad4all.inc.php @@ -3073,7 +3073,7 @@ $localLangName = "français"; $email = "email"; $CourseCodeAlreadyExists = "Désolé, mais ce code de cours existe déjà. Veuillez en choisir un autre."; $Statistics = "Statistiques"; -$Grouplist = "Liste des groupes"; +$GroupList = "Liste des groupes"; $Previous = "précédent"; $DestDirectoryDoesntExist = "Le répertoire de destination n'existe pas"; $Courses = "cours"; diff --git a/main/lang/galician/trad4all.inc.php b/main/lang/galician/trad4all.inc.php index ba236b7670..689dafaea2 100755 --- a/main/lang/galician/trad4all.inc.php +++ b/main/lang/galician/trad4all.inc.php @@ -2705,7 +2705,7 @@ $localLangName = "galego"; $email = "correo electrónico"; $CourseCodeAlreadyExists = "Parece que o código do curso xa existe. Por favor, escolle outro código."; $Statistics = "Estatísticas"; -$Grouplist = "lista de grupos"; +$GroupList = "lista de grupos"; $Previous = "anterior"; $DestDirectoryDoesntExist = "O directorio de destino non existe"; $Courses = "cursos"; diff --git a/main/lang/german/trad4all.inc.php b/main/lang/german/trad4all.inc.php index 4ec37b5db8..77908abb30 100755 --- a/main/lang/german/trad4all.inc.php +++ b/main/lang/german/trad4all.inc.php @@ -2598,7 +2598,7 @@ $localLangName = "Sprache"; $email = "E-Mail"; $CourseCodeAlreadyExists = "Dieses Kürzel existiert bereits. Benutzen Sie bitte ein anderes Kürzel"; $Statistics = "Auswertung"; -$Grouplist = "Gruppen-Liste"; +$GroupList = "Gruppen-Liste"; $Previous = "vorherige"; $DestDirectoryDoesntExist = "Das Zielverzeichnis ist nicht vorhanden"; $Courses = "Kurse"; diff --git a/main/lang/greek/trad4all.inc.php b/main/lang/greek/trad4all.inc.php index 86839dd6e6..5d4f8aa070 100755 --- a/main/lang/greek/trad4all.inc.php +++ b/main/lang/greek/trad4all.inc.php @@ -2573,7 +2573,7 @@ $localLangName = "γλώσσα"; $email = "e-mail"; $CourseCodeAlreadyExists = "Ο κωδικός αυτού του μαθήματος υπάρχει ήδη. Παρακαλούμε επιλέξτε κάποιον άλλο"; $Statistics = "Στατιστικά"; -$Grouplist = "Λίστα ομάδων"; +$GroupList = "Λίστα ομάδων"; $Previous = "Προηγούμενος"; $DestDirectoryDoesntExist = "Ο φάκελος δεν υπάρχει"; $Courses = "Μαθήματα"; diff --git a/main/lang/hungarian/trad4all.inc.php b/main/lang/hungarian/trad4all.inc.php index 58cfeb8fd8..181632fe3b 100755 --- a/main/lang/hungarian/trad4all.inc.php +++ b/main/lang/hungarian/trad4all.inc.php @@ -2000,7 +2000,7 @@ $localLangName = "magyar"; $email = "e-mail"; $CourseCodeAlreadyExists = "Sajnos ez a kurzus kód már létezik. Kérjük válassz egy másikat!"; $Statistics = "Statisztikák"; -$Grouplist = "csoport lista"; +$GroupList = "csoport lista"; $Previous = "előző"; $DestDirectoryDoesntExist = "A célkönyvtár nem létezik"; $Courses = "kurzusok"; diff --git a/main/lang/indonesian/trad4all.inc.php b/main/lang/indonesian/trad4all.inc.php index 932ae007fb..9a06293c59 100755 --- a/main/lang/indonesian/trad4all.inc.php +++ b/main/lang/indonesian/trad4all.inc.php @@ -1363,7 +1363,7 @@ $localLangName = "bahasa"; $email = "email"; $CourseCodeAlreadyExists = "Maaf, kode mata kuliah tsb sudah terpakai. Silahkan pilih yang lain."; $Statistics = "Statistik"; -$Grouplist = "daftar group"; +$GroupList = "daftar group"; $Previous = "sebelumnya"; $Courses = "mata kuliah"; $In = "dalam"; diff --git a/main/lang/italian/trad4all.inc.php b/main/lang/italian/trad4all.inc.php index 1c8cd85833..33a9c7a61b 100755 --- a/main/lang/italian/trad4all.inc.php +++ b/main/lang/italian/trad4all.inc.php @@ -2561,7 +2561,7 @@ $localLangName = "Italiano"; $email = "e-mail"; $CourseCodeAlreadyExists = "Spiacente, ma questo codice è già in uso, scegline uno diverso."; $Statistics = "Statistiche"; -$Grouplist = "Elenco dei gruppi"; +$GroupList = "Elenco dei gruppi"; $Previous = "precedente"; $DestDirectoryDoesntExist = "La cartella di destinazione non esiste"; $Courses = "Corsi"; diff --git a/main/lang/korean/trad4all.inc.php b/main/lang/korean/trad4all.inc.php index 663e83f898..47a444ffe2 100755 --- a/main/lang/korean/trad4all.inc.php +++ b/main/lang/korean/trad4all.inc.php @@ -1085,7 +1085,7 @@ $localLangName = "언어"; $email = "e-mail"; $CourseCodeAlreadyExists = "존재하는 과목 코드입니다. 다른 코드를 선택하시기 바랍니다."; $Statistics = "통계정보"; -$Grouplist = "그룹 목록"; +$GroupList = "그룹 목록"; $Previous = "이전"; $Courses = "과정"; $In = "들어가기"; diff --git a/main/lang/latvian/trad4all.inc.php b/main/lang/latvian/trad4all.inc.php index ff22959bbd..a86369cf65 100755 --- a/main/lang/latvian/trad4all.inc.php +++ b/main/lang/latvian/trad4all.inc.php @@ -2447,7 +2447,7 @@ $localLangName = "valoda"; $email = "e-pasts"; $CourseCodeAlreadyExists = "Hmm, bet šis kursa kods jau eksistē. Lūdzu izvēlies citu codu."; $Statistics = "Statistika"; -$Grouplist = "grupas saraksts"; +$GroupList = "grupas saraksts"; $Previous = "iepriekšējo"; $DestDirectoryDoesntExist = "Saņēmēj direktorija neeksistē"; $Courses = "kursi"; diff --git a/main/lang/lithuanian/trad4all.inc.php b/main/lang/lithuanian/trad4all.inc.php index 3719097076..b5c020c0d3 100755 --- a/main/lang/lithuanian/trad4all.inc.php +++ b/main/lang/lithuanian/trad4all.inc.php @@ -1658,7 +1658,7 @@ $localLangName = "kalba"; $email = "e-mail"; $CourseCodeAlreadyExists = "Sorry, but that course code already exists. Please choose another one."; $Statistics = "Statistika"; -$Grouplist = "grupių sąrašas"; +$GroupList = "grupių sąrašas"; $Previous = "ankstesnis"; $DestDirectoryDoesntExist = "Katalogas neegzistuoja"; $Courses = "kursai"; diff --git a/main/lang/macedonian/trad4all.inc.php b/main/lang/macedonian/trad4all.inc.php index 28ae757175..b2ed7cd65e 100755 --- a/main/lang/macedonian/trad4all.inc.php +++ b/main/lang/macedonian/trad4all.inc.php @@ -1618,7 +1618,7 @@ $localLangName = "јазик"; $email = "e-mail"; $CourseCodeAlreadyExists = "Жалам, но шифрата на курсот веќе постои. Ве молам изберете друга шифра."; $Statistics = "Статистика"; -$Grouplist = "список на групи"; +$GroupList = "список на групи"; $Previous = "претходно"; $DestDirectoryDoesntExist = "Посочениот директориум не постои"; $Courses = "курсеви"; diff --git a/main/lang/norwegian/trad4all.inc.php b/main/lang/norwegian/trad4all.inc.php index d93f3e15a3..fc43ad7c92 100755 --- a/main/lang/norwegian/trad4all.inc.php +++ b/main/lang/norwegian/trad4all.inc.php @@ -633,7 +633,7 @@ $localLangName = "språk"; $email = "e-post"; $CourseCodeAlreadyExists = "Denne kurskoden finnes allerede. Benytt en annen"; $Statistics = "Statistikk"; -$Grouplist = "liste grupper"; +$GroupList = "liste grupper"; $Previous = "forrige"; $Courses = "kurs"; $In = "i"; diff --git a/main/lang/persian/trad4all.inc.php b/main/lang/persian/trad4all.inc.php index 380bce4093..eab22acddb 100755 --- a/main/lang/persian/trad4all.inc.php +++ b/main/lang/persian/trad4all.inc.php @@ -1951,7 +1951,7 @@ $localLangName = "فرانسوی"; $email = "پست الکترونیک"; $CourseCodeAlreadyExists = "کددرس مورد نظر شما قبلاً توسط فرد دیگری استفاده شده است. لطفاً کد دیگری انتخاب کنید"; $Statistics = "آمار"; -$Grouplist = "لیست گروه ها"; +$GroupList = "لیست گروه ها"; $Previous = "قبلی"; $DestDirectoryDoesntExist = "پوشه مقصد وجود ندارد"; $Courses = "دروس"; diff --git a/main/lang/polish/trad4all.inc.php b/main/lang/polish/trad4all.inc.php index 35f5de193e..b1ab9b348e 100755 --- a/main/lang/polish/trad4all.inc.php +++ b/main/lang/polish/trad4all.inc.php @@ -2642,7 +2642,7 @@ $localLangName = "język"; $email = "e-mail"; $CourseCodeAlreadyExists = "Kod kursu już istnieje. Wybierz inny."; $Statistics = "Statystyki"; -$Grouplist = "Lista grup"; +$GroupList = "Lista grup"; $Previous = "Poprzedni"; $DestDirectoryDoesntExist = "Docelowy folder nie istnieje"; $Courses = "Kursy"; diff --git a/main/lang/portuguese/trad4all.inc.php b/main/lang/portuguese/trad4all.inc.php index 1662586d51..e23ddca54f 100755 --- a/main/lang/portuguese/trad4all.inc.php +++ b/main/lang/portuguese/trad4all.inc.php @@ -2773,7 +2773,7 @@ $localLangName = "idioma"; $email = "e-mail"; $CourseCodeAlreadyExists = "Lamentamos, mas esse código de curso já existe. Por favor, escolha outro."; $Statistics = "Estatísticas"; -$Grouplist = "Lista dos grupos"; +$GroupList = "Lista dos grupos"; $Previous = "anterior"; $DestDirectoryDoesntExist = "A pasta/directório de destino não existe"; $Courses = "Cursos"; diff --git a/main/lang/quechua_cusco/trad4all.inc.php b/main/lang/quechua_cusco/trad4all.inc.php index 85e5de0711..58b5c7b0bb 100755 --- a/main/lang/quechua_cusco/trad4all.inc.php +++ b/main/lang/quechua_cusco/trad4all.inc.php @@ -2357,7 +2357,7 @@ $localLangName = "simi"; $email = "e-chaski"; $CourseCodeAlreadyExists = "kay chinpuqa kashanña. Hoqta ajllaspa malliy."; $Statistics = "Yupanakuna"; -$Grouplist = "huñusqakunaq sinrin"; +$GroupList = "huñusqakunaq sinrin"; $Previous = "Ñaupaq"; $DestDirectoryDoesntExist = "Wayaqepi allchanapaqqa mana kanchu"; $Courses = "yachachinakuna"; diff --git a/main/lang/romanian/trad4all.inc.php b/main/lang/romanian/trad4all.inc.php index 4c261e781e..fa3e516cfc 100755 --- a/main/lang/romanian/trad4all.inc.php +++ b/main/lang/romanian/trad4all.inc.php @@ -2256,7 +2256,7 @@ $localLangName = "limba"; $email = "email"; $CourseCodeAlreadyExists = "Acest cod de curs exista deja, alege altul."; $Statistics = "Statistici"; -$Grouplist = "lista grup"; +$GroupList = "lista grup"; $Previous = "anterior"; $DestDirectoryDoesntExist = "Dosarul de destinatie nu exista"; $Courses = "cursuri"; diff --git a/main/lang/russian/trad4all.inc.php b/main/lang/russian/trad4all.inc.php index 72363915ae..8a55a9dbc9 100755 --- a/main/lang/russian/trad4all.inc.php +++ b/main/lang/russian/trad4all.inc.php @@ -1879,7 +1879,7 @@ $localLangName = "язык"; $email = "эл. почта"; $CourseCodeAlreadyExists = "Извините, но такой код курса уже существует. Пожалуйста, выберите другой."; $Statistics = "Статистика"; -$Grouplist = "Список группы"; +$GroupList = "Список группы"; $Previous = "предыдущий"; $DestDirectoryDoesntExist = "Целевая папка не существует"; $Courses = "курсы"; diff --git a/main/lang/serbian/trad4all.inc.php b/main/lang/serbian/trad4all.inc.php index 0a7502aef1..58dcadc477 100755 --- a/main/lang/serbian/trad4all.inc.php +++ b/main/lang/serbian/trad4all.inc.php @@ -1580,7 +1580,7 @@ $localLangName = "jezik"; $email = "e-mail"; $CourseCodeAlreadyExists = "Takva šifra kursa već postoji. Molim Vas, izaberite drugu."; $Statistics = "Statistike"; -$Grouplist = "Lista grupa"; +$GroupList = "Lista grupa"; $Previous = "prethodna"; $Courses = "kursevi"; $In = "u"; diff --git a/main/lang/simpl_chinese/trad4all.inc.php b/main/lang/simpl_chinese/trad4all.inc.php index a71c6b2cbd..b32940479b 100755 --- a/main/lang/simpl_chinese/trad4all.inc.php +++ b/main/lang/simpl_chinese/trad4all.inc.php @@ -1813,7 +1813,7 @@ $localLangName = "语言"; $email = "电子邮件"; $CourseCodeAlreadyExists = "对不起,课程代码已经存在,请选择另外一个"; $Statistics = "统计"; -$Grouplist = "群组列表"; +$GroupList = "群组列表"; $Previous = "上一步"; $DestDirectoryDoesntExist = "目标文件夹不存在"; $Courses = "课程"; diff --git a/main/lang/slovak/trad4all.inc.php b/main/lang/slovak/trad4all.inc.php index 7f2832e74c..f8216c1891 100755 --- a/main/lang/slovak/trad4all.inc.php +++ b/main/lang/slovak/trad4all.inc.php @@ -3107,7 +3107,7 @@ $localLangName = "jazyk"; $email = "e-mail"; $CourseCodeAlreadyExists = "Prepáčte, ale tento kód kurzu je už použitý. Zvolte prosím iný."; $Statistics = "Štatistika"; -$Grouplist = "Zoznam skupín"; +$GroupList = "Zoznam skupín"; $Previous = "Predošlý"; $DestDirectoryDoesntExist = "Cieľová zložka neexistuje"; $Courses = "Kurzy"; diff --git a/main/lang/slovenian/trad4all.inc.php b/main/lang/slovenian/trad4all.inc.php index 7c8cbfe32b..6580ad599f 100755 --- a/main/lang/slovenian/trad4all.inc.php +++ b/main/lang/slovenian/trad4all.inc.php @@ -2985,7 +2985,7 @@ $localLangName = "jezik"; $email = "e-pošta"; $CourseCodeAlreadyExists = "Oprostite, koda tečaja že obstaja. Izberite drugo kodo."; $Statistics = "Statistika"; -$Grouplist = "Seznam skupin"; +$GroupList = "Seznam skupin"; $Previous = "prejšnji"; $DestDirectoryDoesntExist = "Ciljna mapa ne obstaja"; $Courses = "Tečaji"; diff --git a/main/lang/spanish/trad4all.inc.php b/main/lang/spanish/trad4all.inc.php index 2ae462e415..aefa94dacd 100755 --- a/main/lang/spanish/trad4all.inc.php +++ b/main/lang/spanish/trad4all.inc.php @@ -3082,7 +3082,7 @@ $localLangName = "idioma"; $email = "e-mail"; $CourseCodeAlreadyExists = "Lo siento, pero este código ya existe. Pruebe a escoger otro."; $Statistics = "Estadísticas"; -$Grouplist = "Lista de grupos"; +$GroupList = "Lista de grupos"; $Previous = "Anterior"; $DestDirectoryDoesntExist = "La carpeta de destino no existe"; $Courses = "Cursos"; diff --git a/main/lang/spanish_latin/trad4all.inc.php b/main/lang/spanish_latin/trad4all.inc.php index 51ee039080..cbb9622824 100755 --- a/main/lang/spanish_latin/trad4all.inc.php +++ b/main/lang/spanish_latin/trad4all.inc.php @@ -1479,7 +1479,7 @@ $localLangName = "español"; $email = "Correo electrónico"; $CourseCodeAlreadyExists = "El código del curso ya existe, Por favor seleccione otro."; $Statistics = "Estadística"; -$Grouplist = "lista de grupos"; +$GroupList = "lista de grupos"; $Previous = "anterior"; $Courses = "Cursos"; $In = "en"; diff --git a/main/lang/swedish/trad4all.inc.php b/main/lang/swedish/trad4all.inc.php index ed3a8704cb..010d12d4e3 100755 --- a/main/lang/swedish/trad4all.inc.php +++ b/main/lang/swedish/trad4all.inc.php @@ -1891,7 +1891,7 @@ $localLangName = "språk"; $email = "e-post"; $CourseCodeAlreadyExists = "Tyvärr, denna kurs existerar redan. Var vänlig välj en annan."; $Statistics = "Statistik"; -$Grouplist = "grupplista"; +$GroupList = "grupplista"; $Previous = "föregående"; $DestDirectoryDoesntExist = "Den önskade katalogen finns inte"; $Courses = "Kurser"; diff --git a/main/lang/thai/trad4all.inc.php b/main/lang/thai/trad4all.inc.php index 1e3f2b8c24..94b1d895b6 100755 --- a/main/lang/thai/trad4all.inc.php +++ b/main/lang/thai/trad4all.inc.php @@ -1218,7 +1218,7 @@ $localLangName = "ภาษา"; $email = "อีเมล"; $CourseCodeAlreadyExists = "ขออภัย! รหัสวิชานี้มีอยู่แล้ว โปรดเลือกรหัสอื่นหรือกำหนดให้แตกต่างออกไป"; $Statistics = "สถิติ"; -$Grouplist = "รายชื่อกลุ่ม"; +$GroupList = "รายชื่อกลุ่ม"; $Previous = "ที่ผ่านมา"; $Courses = "รายวิชา"; $In = "ใน"; diff --git a/main/lang/trad_chinese/trad4all.inc.php b/main/lang/trad_chinese/trad4all.inc.php index e122d10e0b..732f2ab641 100755 --- a/main/lang/trad_chinese/trad4all.inc.php +++ b/main/lang/trad_chinese/trad4all.inc.php @@ -1748,7 +1748,7 @@ $localLangName = "語言"; $email = "電郵"; $CourseCodeAlreadyExists = "對不起,這課程編號已經存在,請選另外一個。"; $Statistics = "統計"; -$Grouplist = "群組清單"; +$GroupList = "群組清單"; $Previous = "上一步"; $DestDirectoryDoesntExist = "目標檔案夾不存在"; $Courses = "課程"; diff --git a/main/lang/turkish/trad4all.inc.php b/main/lang/turkish/trad4all.inc.php index 9625c4ed13..dd068d756f 100755 --- a/main/lang/turkish/trad4all.inc.php +++ b/main/lang/turkish/trad4all.inc.php @@ -1803,7 +1803,7 @@ $localLangName = "lisan"; $email = "e-posta"; $CourseCodeAlreadyExists = "Üzgünüm, Bu ders kodu zaten var. Lütfen başka bir kod belirleyiniz."; $Statistics = "İstatistik"; -$Grouplist = "grup listesi"; +$GroupList = "grup listesi"; $Previous = "önceki"; $Courses = "dersler"; $In = "in"; diff --git a/main/lang/ukrainian/trad4all.inc.php b/main/lang/ukrainian/trad4all.inc.php index c0275080a4..eb607681c2 100755 --- a/main/lang/ukrainian/trad4all.inc.php +++ b/main/lang/ukrainian/trad4all.inc.php @@ -1384,7 +1384,7 @@ $Platform = "Платформа"; $localLangName = "мова"; $CourseCodeAlreadyExists = "Вибачте, але цей код курсу вже існує. Будь ласка, виберіть інший"; $Statistics = "Статистика"; -$Grouplist = "список групи"; +$GroupList = "список групи"; $Previous = "попередній"; $DestDirectoryDoesntExist = "Каталог призначення не існує"; $Courses = "курси"; diff --git a/main/link/index.php b/main/link/index.php deleted file mode 100755 index e5663f3004..0000000000 --- a/main/link/index.php +++ /dev/null @@ -1,15 +0,0 @@ -run(); -return; diff --git a/main/mySpace/company_reports.php b/main/mySpace/company_reports.php index 39d65007ce..3dfe117ff2 100755 --- a/main/mySpace/company_reports.php +++ b/main/mySpace/company_reports.php @@ -22,9 +22,10 @@ $tool_name = get_lang('Report'); $this_section = SECTION_TRACKING; $htmlHeadXtra[] = api_get_jqgrid_js(); +$sessionId = isset($_GET['session_id']) ? intval($_GET['session_id']) : -1; //jqgrid will use this URL to do the selects -$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_user_course_report'; +$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_user_course_report&session_id='.$sessionId; $extra_fields = UserManager::get_extra_fields(0, 100, null, null, true, true); @@ -111,17 +112,13 @@ $content = '
'; if (!empty($actions)) { $content .= $actions; } - -$content .= '
'; $content .= Display::url( get_lang("CompanyReportResumed"), api_get_path(WEB_CODE_PATH) . "mySpace/company_reports_resumed.php", array( - 'class' => 'btn btn-info' + 'class' => 'btn btn-success' ) ); - -$content .= '
'; $content .= '
'; $content .= '

' . get_lang('CompanyReport') . '

'; $content .= Display::grid_html('user_course_report'); diff --git a/main/mySpace/company_reports_resumed.php b/main/mySpace/company_reports_resumed.php index cc20ffde5c..48d7ca3037 100755 --- a/main/mySpace/company_reports_resumed.php +++ b/main/mySpace/company_reports_resumed.php @@ -4,9 +4,7 @@ * Special report for corporate users * @package chamilo.reporting */ -/** - * Code - */ + $cidReset = true; require_once '../inc/global.inc.php'; @@ -22,9 +20,10 @@ $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('MySpace')); $tool_name = get_lang('Report'); $this_section = SECTION_TRACKING; $htmlHeadXtra[] = api_get_jqgrid_js(); +$sessionId = isset($_GET['session_id']) ? intval($_GET['session_id']) : -1; // jqgrid will use this URL to do the selects -$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_user_course_report_resumed'; +$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_user_course_report_resumed&session_id='.$sessionId; $extra_fields = UserManager::get_extra_fields(0, 100, null, null, true, true); @@ -109,15 +108,13 @@ if (!empty($actions)) { } if (!api_is_student_boss()) { - $content .= '
'; $content .= Display::url( get_lang("CompanyReport"), api_get_path(WEB_CODE_PATH) . "mySpace/company_reports.php", array( - 'class' => 'btn btn-info' + 'class' => 'btn btn-success' ) ); - $content .= '
'; } $content .= ''; diff --git a/main/newscorm/learnpathItem.class.php b/main/newscorm/learnpathItem.class.php index d108b435af..b9294b2ae7 100755 --- a/main/newscorm/learnpathItem.class.php +++ b/main/newscorm/learnpathItem.class.php @@ -2605,7 +2605,7 @@ class learnpathItem return $returnstatus; } else { $status = $items[$refs_list[$prereqs_string]]->get_status(false); - $returnstatus = $status == $this->possible_status[2] OR $status == $this->possible_status[3]; + $returnstatus = $status == $this->possible_status[2] || $status == $this->possible_status[3]; if (!$returnstatus) { if (self::debug > 1) { diff --git a/main/session/index.php b/main/session/index.php index 1d711e1f21..62ce60568c 100755 --- a/main/session/index.php +++ b/main/session/index.php @@ -5,16 +5,12 @@ * @package chamilo.session * @author Julio Montoya Beeznest */ -/** - * Code - */ use \ChamiloSession as Session; $cidReset = true; require_once '../inc/global.inc.php'; - $session_id = isset($_GET['session_id']) ? intval($_GET['session_id']): null; $sessionField = new ExtraFieldValue('session'); @@ -43,23 +39,37 @@ if (isset($_SESSION['objExercise'])) { Session::erase('objExercise'); } +$userId = api_get_user_id(); $session_info = SessionManager::fetch($session_id); $session_list = SessionManager::get_sessions_by_coach(api_get_user_id()); $course_list = SessionManager::get_course_list_by_session_id($session_id); // Getting all sessions where I'm subscribed -$new_session_list = array(); +/*$new_session_list = array(); if (!api_is_anonymous()) { $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id()); } $user_course_list = array(); foreach ($new_session_list as $session_item) { $user_course_list[] = $session_item['code']; +}*/ + + +$user_course_list = array(); +foreach ($course_list as $course) { + $status = SessionManager::get_user_status_in_course_session($userId, $course['code'], $session_id); + if ($status || api_is_platform_admin()) { + $user_course_list[] = $course['code']; + } +} + +if (empty($user_course_list)) { + api_not_allowed(true); } $my_session_list = array(); $final_array = array(); - +/* if (!empty($new_session_list)) { foreach ($new_session_list as $item) { $my_session_id = isset($item['id_session']) ? $item['id_session'] : null; @@ -110,7 +120,8 @@ if (!empty($new_session_list)) { } $my_session_list[] = $my_session_id; } -} +}*/ + $new_course_list = array(); if (!empty($course_list)) { @@ -202,11 +213,11 @@ if (!empty($course_list)) { } // If the requested session does not exist in my list we stop the script -if (!api_is_platform_admin()) { +/*if (!api_is_platform_admin()) { if (!api_is_anonymous() && !in_array($session_id, $my_session_list)) { api_not_allowed(true); } -} +}*/ //If session is not active we stop de script if (!api_is_allowed_to_session_edit()) { diff --git a/main/social/groups.php b/main/social/groups.php index 2fb3f94251..0b3c7363cb 100755 --- a/main/social/groups.php +++ b/main/social/groups.php @@ -10,7 +10,7 @@ $cidReset = true; require_once '../inc/global.inc.php'; api_block_anonymous_users(); -if (api_get_setting('allow_social_tool') != 'true') { +if (api_get_setting('allow_social_tool') != 'true' && !api_is_platform_admin()) { api_not_allowed(); } diff --git a/main/survey/survey.lib.php b/main/survey/survey.lib.php index 19e005e901..53f3cfd102 100755 --- a/main/survey/survey.lib.php +++ b/main/survey/survey.lib.php @@ -3405,7 +3405,7 @@ class SurveyUtil foreach ($groupList as $groupId) { $userGroupList = GroupManager::getStudents($groupId); - $userGroupIdList = array_column($userGroupList, 'user_id'); + $userGroupIdList = api_array_column($userGroupList, 'user_id'); $users_array = array_merge($users_array, $userGroupIdList); $params = array( diff --git a/main/template/default/admin/teacher_time_report.tpl b/main/template/default/admin/teacher_time_report.tpl index 7608c21f0e..d19c7c8820 100644 --- a/main/template/default/admin/teacher_time_report.tpl +++ b/main/template/default/admin/teacher_time_report.tpl @@ -96,7 +96,7 @@
- +
diff --git a/main/upload/form.scorm.php b/main/upload/form.scorm.php index 0dddec1aeb..646ebe814d 100755 --- a/main/upload/form.scorm.php +++ b/main/upload/form.scorm.php @@ -47,11 +47,16 @@ echo ''; -$form = new FormValidator('', 'POST', 'upload.php', '', 'id="upload_form" enctype="multipart/form-data" style="background-image: url(\'../img/scorm.jpg\'); background-repeat: no-repeat; background-position: 620px;"'); +$form = new FormValidator( + '', + 'POST', + 'upload.php', + '', + 'id="upload_form" enctype="multipart/form-data" style="background-image: url(\'../img/scorm.jpg\'); background-repeat: no-repeat; background-position: 620px;"' +); $form->addElement('header', '', $nameTools); $form->addElement('hidden', 'curdirpath', $path); $form->addElement('hidden', 'tool', $my_tool); - $form->addElement('file', 'user_file', get_lang('FileToUpload')); $form->add_real_progress_bar('uploadScorm', 'user_file'); $form->addRule('user_file', get_lang('ThisFieldIsRequired'), 'required'); @@ -71,11 +76,10 @@ if (api_is_platform_admin()) { $form->addElement('checkbox', 'use_max_score', null, get_lang('UseMaxScore100')); } -$form->addElement('style_submit_button', 'submit', get_lang('Send'), 'class="upload"'); -$form->addElement('html', '


'); +$form->addButtonUpload(get_lang('Upload')); if (is_dir(api_get_path(PLUGIN_PATH)."/pens")) { - require_once(api_get_path(PLUGIN_PATH)."/pens/chamilo_pens.php"); + require_once api_get_path(PLUGIN_PATH)."/pens/chamilo_pens.php"; $list = ChamiloPens::findAll(); if (count($list) > 0) { $select_pens = $form->addElement('select', 'pens_package', get_lang('Or').' '.get_lang('select a PENS package')); diff --git a/tests/datafiller/data_users.php b/tests/datafiller/data_users.php index 87d291f68b..cf9b60dddd 100755 --- a/tests/datafiller/data_users.php +++ b/tests/datafiller/data_users.php @@ -177,10 +177,10 @@ $users[] = array( ); $users[] = array('username' => 'mbrandybuck', 'pass' => 'mbrandybuck', 'firstname' => 'Meriadoc', 'lastname' => 'Brandybuck', 'status' => 5, 'auth_source' => 'platform', 'email' => 'mbrandybuck@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'amaurichard', 'pass' => 'amaurichard', 'firstname' => 'Anabelle', 'lastname' => 'Maurichard', 'status' => 5, 'auth_source' => 'platform', 'email' => 'amaurichard@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'ptook', 'pass' => 'ptook', 'firstname' => 'Peregrin', 'lastname' => 'Took', 'status' => 5, 'auth_source' => 'platform', 'email' => 'ptook@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'abaggins', 'pass' => 'abaggins', 'firstname' => 'Angelica', 'lastname' => 'Baggins', 'status' => 5, 'auth_source' => 'platform', 'email' => 'abaggins@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'bproudfoot', 'pass' => 'bproudfoot', 'firstname' => 'Bodo', 'lastname' => 'Proudfoot', 'status' => 5, 'auth_source' => 'platform', 'email' => 'bproudfoot@example.com', 'creator_id' => 1, 'active' => 1); +$users[] = array('username' => 'amaurichard', 'pass' => 'amaurichard', 'firstname' => 'Anabelle', 'lastname' => 'Maurichard', 'status' => 3, 'auth_source' => 'platform', 'email' => 'amaurichard@example.com', 'creator_id' => 1, 'active' => 1); +$users[] = array('username' => 'ptook', 'pass' => 'ptook', 'firstname' => 'Peregrin', 'lastname' => 'Took', 'status' => 4, 'auth_source' => 'platform', 'email' => 'ptook@example.com', 'creator_id' => 1, 'active' => 1); +$users[] = array('username' => 'abaggins', 'pass' => 'abaggins', 'firstname' => 'Angelica', 'lastname' => 'Baggins', 'status' => 17, 'auth_source' => 'platform', 'email' => 'abaggins@example.com', 'creator_id' => 1, 'active' => 1); +$users[] = array('username' => 'bproudfoot', 'pass' => 'bproudfoot', 'firstname' => 'Bodo', 'lastname' => 'Proudfoot', 'status' => 20, 'auth_source' => 'platform', 'email' => 'bproudfoot@example.com', 'creator_id' => 1, 'active' => 1); $users[] = array('username' => 'csackville', 'pass' => 'csackville', 'firstname' => 'Camelia', 'lastname' => 'Sackville', 'status' => 5, 'auth_source' => 'platform', 'email' => 'csackville@example.com', 'creator_id' => 1, 'active' => 1); $users[] = array('username' => 'dboffin', 'pass' => 'dboffin', 'firstname' => 'Donnamira', 'lastname' => 'Boffin', 'status' => 5, 'auth_source' => 'platform', 'email' => 'dboffin@example.com', 'creator_id' => 1, 'active' => 1); $users[] = array('username' => 'efairbairn', 'pass' => 'efairbairn', 'firstname' => 'Elfstan', 'lastname' => 'Fairbairn', 'status' => 5, 'auth_source' => 'platform', 'email' => 'efairbairn@example.com', 'creator_id' => 1, 'active' => 1); @@ -196,7 +196,7 @@ $users[] = array('username' => 'obolger', 'pass'=> 'obolger', 'firstname' => 'Od $users[] = array('username' => 'pbolger', 'pass'=> 'pbolger', 'firstname' => 'Prisca', 'lastname' => 'Bolger', 'status' => 5, 'auth_source' => 'platform', 'email' => 'pbolger@example.com', 'creator_id' => 1, 'active' => 1); $users[] = array('username' => 'rgardner', 'pass'=> 'rgardner', 'firstname' => 'Ruby', 'lastname' => 'Gardner', 'status' => 5, 'auth_source' => 'platform', 'email' => 'rgardner@example.com', 'creator_id' => 1, 'active' => 1); $users[] = array('username' => 'stook', 'pass'=> 'stook', 'firstname' => 'Sigismond', 'lastname' => 'Took', 'status' => 5, 'auth_source' => 'platform', 'email' => 'stook@example.com', 'creator_id' => 1, 'active' => 1); -$users[] = array('username' => 'sgollum', 'pass'=> 'sgollum', 'firstname' => 'Sméagol', 'lastname' => 'Gollum', 'status' => 5, 'auth_source' => 'platform', 'email' => 'sgollum@example.com', 'creator_id' => 1, 'active' => 1); +$users[] = array('username' => 'sgollum', 'pass'=> 'sgollum', 'firstname' => 'Smeagol', 'lastname' => 'Gollum', 'status' => 5, 'auth_source' => 'platform', 'email' => 'sgollum@example.com', 'creator_id' => 1, 'active' => 1); $users[] = array('username' => 'tsandyman', 'pass'=> 'tsandyman', 'firstname' => 'Ted', 'lastname' => 'Sandyman', 'status' => 5, 'auth_source' => 'platform', 'email' => 'tsandyman@example.com', 'creator_id' => 1, 'active' => 1); $users[] = array('username' => 'wgamwich', 'pass'=> 'wgamwich', 'firstname' => 'Wiseman', 'lastname' => 'Gamwich', 'status' => 5, 'auth_source' => 'platform', 'email' => 'wgamwich@example.com', 'creator_id' => 1, 'active' => 1); diff --git a/tests/features/accessCompanyReports.feature b/tests/features/accessCompanyReports.feature new file mode 100644 index 0000000000..df676fbfbb --- /dev/null +++ b/tests/features/accessCompanyReports.feature @@ -0,0 +1,20 @@ +@administration +Feature: Access to company reports as admin + In order to analyse reports of time spent on the platform + As an administrator + I need to be able to access the company reports + + Scenario: See the company reports link on the admin page + Given I am a platform administrator + And I am on "/main/admin/index.php" + Then I should see "Reports" + + Scenario: Access the company report + Given I am a platform administrator + And I am on "/main/mySpace/company_reports.php" + Then I should not see "not authorized" + + Scenario: Access the resumed version of the company report + Given I am a platform administrator + And I am on "/main/admin/company_reports_resumed.php" + Then I should not see "not authorized" diff --git a/tests/features/bootstrap/FeatureContext.php b/tests/features/bootstrap/FeatureContext.php index 29ca38ca44..00e66ede4a 100644 --- a/tests/features/bootstrap/FeatureContext.php +++ b/tests/features/bootstrap/FeatureContext.php @@ -3,6 +3,7 @@ use Behat\Behat\Context\ClosuredContextInterface, Behat\Behat\Context\TranslatedContextInterface, Behat\Behat\Context\BehatContext, + Behat\Behat\Context\Step\Given, Behat\Behat\Exception\PendingException; use Behat\Gherkin\Node\PyStringNode, @@ -38,11 +39,99 @@ class FeatureContext extends MinkContext public function iAmAPlatformAdministrator() { return array( - new \Behat\Behat\Context\Step\Given('I am on homepage'), - new \Behat\Behat\Context\Step\Given('I fill in "login" with "admin"'), - new \Behat\Behat\Context\Step\Given('I fill in "password" with "admin"'), - new \Behat\Behat\Context\Step\Given('I press "submitAuth"') + new Given('I am on "/index.php?logout=logout"'), + new Given('I am on homepage'), + new Given('I fill in "login" with "admin"'), + new Given('I fill in "password" with "admin"'), + new Given('I press "submitAuth"') + ); + } + /** + * @Given /^Test users exist$/ + */ + public function testUsersExist() + { + return array( + new Given('I am a platform administrator'), + new Given('I am on "/main/admin/filler.php?fill=users"') + ); + } + /** + * @Given /^I am a session administrator$/ + */ + public function iAmASessionAdministrator() + { + return array( + new Given('I am on "/index.php?logout=logout"'), + new Given('I am on homepage'), + new Given('I fill in "login" with "amaurichard"'), + new Given('I fill in "password" with "amaurichard"'), + new Given('I press "submitAuth"') + ); + } + /** + * @Given /^I am a teacher$/ + */ + public function iAmATeacher() + { + return array( + new Given('I am on "/index.php?logout=logout"'), + new Given('I am on homepage'), + new Given('I fill in "login" with "mmosquera"'), + new Given('I fill in "password" with "mmosquera"'), + new Given('I press "submitAuth"') + ); + } + /** + * @Given /^I am a student$/ + */ + public function iAmAStudent() + { + return array( + new Given('I am on "/index.php?logout=logout"'), + new Given('I am on homepage'), + new Given('I fill in "login" with "mbrandybuck"'), + new Given('I fill in "password" with "mbrandybuck"'), + new Given('I press "submitAuth"') + ); + } + /** + * @Given /^I am an HR manager$/ + */ + public function iAmAnHR() + { + return array( + new Given('I am on "/index.php?logout=logout"'), + new Given('I am on homepage'), + new Given('I fill in "login" with "ptook"'), + new Given('I fill in "password" with "ptook"'), + new Given('I press "submitAuth"') + ); + } + /** + * @Given /^I am a student boss$/ + */ + public function iAmAStudentBoss() + { + return array( + new Given('I am on "/index.php?logout=logout"'), + new Given('I am on homepage'), + new Given('I fill in "login" with "abaggins"'), + new Given('I fill in "password" with "abaggins"'), + new Given('I press "submitAuth"') + ); + } + /** + * @Given /^I am an invitee$/ + */ + public function iAmAnInvitee() + { + return array( + new Given('I am on "/index.php?logout=logout"'), + new Given('I am on homepage'), + new Given('I fill in "login" with "bproudfoot"'), + new Given('I fill in "password" with "bproudfoot"'), + new Given('I press "submitAuth"') ); } - } diff --git a/tests/features/createCourse.feature b/tests/features/createCourse.feature new file mode 100644 index 0000000000..54e4b9b018 --- /dev/null +++ b/tests/features/createCourse.feature @@ -0,0 +1,37 @@ +@administration +Feature: Courses management as admin + In order to add courses + As an administrator + I need to be able to create new courses from the admin page + + Scenario: See the courses list + Given I am a platform administrator + And I am on "/main/admin/course_list.php" + Then I should see "Course list" + And I should not see "not authorized" + + Scenario: See the course creation link on the admin page + Given I am a platform administrator + And I am on "/main/admin/index.php" + Then I should see "Create a course" + + Scenario: Access the course creation page + Given I am a platform administrator + And I am on "/main/admin/course_add.php" + Then I should not see "not authorized" + + Scenario: Access the course creation page + Given I am a platform administrator + And I am on "/main/admin/course_add.php" + When I fill in "title" with "TESTCOURSE1" + And I press "submit" + Then I should see "Course list" + + Scenario: Search and delete a course + Given I am a platform administrator + And I am on "/main/admin/course_list.php" + And I fill in "course-search-keyword" with "TESTCOURSE1" + And I press "submit" + When I follow "Delete" + Then I should see "Course list" + And I should not see "not be deleted" diff --git a/tests/features/login.feature b/tests/features/login.feature index d51debadb1..1e4d198d23 100644 --- a/tests/features/login.feature +++ b/tests/features/login.feature @@ -1,14 +1,30 @@ -# features/createUser.feature +# features/login.feature @common Feature: User login In order to log in - As a registered user + As any registered user I need to be able to enter my details in the form and get in Scenario: Login as admin user successfully - Given I am on "/index.php" - When I fill in "login" with "admin" - And I fill in "password" with "admin" - And I press "submitAuth" - Then I should see "John Doe" - And I should see "Administration" \ No newline at end of file + Given I am a platform administrator + Then |I should not see an "
" element + + Scenario: Login as student user successfully + Given I am a student + Then |I should not see an "
" element + + Scenario: Login as teacher successfully + Given I am a teacher + Then |I should not see an "
" element + + Scenario: Login as HRD successfully + Given I am an HR manager + Then |I should not see an "
" element + + Scenario: Login as student bott successfully + Given I am a student boss + Then |I should not see an "
" element + + Scenario: Login as invitee successfully + Given I am an invitee + Then |I should not see an "
" element diff --git a/user_portal.php b/user_portal.php index a259270796..39e0d40aa2 100755 --- a/user_portal.php +++ b/user_portal.php @@ -30,52 +30,48 @@ require_once api_get_path(LIBRARY_PATH).'userportal.lib.php'; api_block_anonymous_users(); // Only users who are logged in can proceed. -$user_id = api_get_user_id(); +$userId = api_get_user_id(); /* Constants and CONFIGURATION parameters */ $load_dirs = api_get_setting('show_documents_preview'); +$controller = new IndexManager(get_lang('MyCourses')); + +// Main courses and session list +$courseAndSessions = $controller->return_courses_and_sessions($userId); + // Check if a user is enrolled only in one course for going directly to the course after the login. if (api_get_setting('go_to_course_after_login') == 'true') { - // Get the courses list - $personal_course_list = UserManager::get_personal_session_course_list($user_id); - - $my_session_list = array(); - $count_of_courses_no_sessions = 0; - $count_of_courses_with_sessions = 0; - - foreach ($personal_course_list as $course) { - if (!empty($course['id_session'])) { - $my_session_list[$course['id_session']] = true; - $count_of_courses_with_sessions++; - } else { - $count_of_courses_no_sessions++; - } - } - $count_of_sessions = count($my_session_list); + $count_of_sessions = $courseAndSessions['session_count']; + $count_of_courses_no_sessions = $courseAndSessions['course_count']; if ($count_of_sessions == 1 && $count_of_courses_no_sessions == 0) { - $key = array_keys($personal_course_list); - $course_info = $personal_course_list[$key[0]]; - $course_directory = $course_info['course_info']['path']; - $id_session = isset($course_info['id_session']) ? $course_info['id_session'] : 0; - $url = api_get_path(WEB_CODE_PATH).'session/?session_id='.$id_session; - - header('location:'.$url); - exit; + $sessions = SessionManager::get_sessions_by_user($userId); + if (isset($sessions[0])) { + $sessionInfo = $sessions[0]; + if (isset($sessionInfo['session_id'])) { + $url = api_get_path(WEB_CODE_PATH).'session/?session_id='.$sessionInfo['session_id']; + + header('Location:'.$url); + exit; + } + } } if (!isset($_SESSION['coursesAlreadyVisited']) && $count_of_sessions == 0 && $count_of_courses_no_sessions == 1 ) { - $key = array_keys($personal_course_list); - $course_info = $personal_course_list[$key[0]]; - $course_directory = $course_info['course_info']['path']; - $id_session = isset($course_info['id_session']) ? $course_info['id_session'] : 0; - $url = api_get_path(WEB_COURSE_PATH).$course_directory.'/?id_session='.$id_session; - header('location:'.$url); - exit; + $courses = CourseManager::get_courses_list_by_user_id($userId); + + if (!empty($courses) && isset($courses[0]) && isset($courses[0]['code'])) { + $courseInfo = api_get_course_info($courses[0]['code']); + if (!empty($courseInfo)) { + $courseUrl = $courseInfo['course_public_url']; + header('Location:'.$courseUrl); + exit; + } + } } } @@ -123,38 +119,14 @@ if ($load_dirs) { '; } -/* Sniffing system */ - -//store posts to sessions -/* -if (isset($_SESSION['sniff_navigator']) && $_SESSION['sniff_navigator']!="checked") { - $_SESSION['sniff_navigator']=Security::remove_XSS($_POST['sniff_navigator']); - $_SESSION['sniff_screen_size_w']=Security::remove_XSS($_POST['sniff_navigator_screen_size_w']); - $_SESSION['sniff__screen_size_h']=Security::remove_XSS($_POST['sniff_navigator_screen_size_h']); - $_SESSION['sniff_type_mimetypes']=Security::remove_XSS($_POST['sniff_navigator_type_mimetypes']); - $_SESSION['sniff_suffixes_mimetypes']=Security::remove_XSS($_POST['sniff_navigator_suffixes_mimetypes']); - $_SESSION['sniff_list_plugins']=Security::remove_XSS($_POST['sniff_navigator_list_plugins']); - $_SESSION['sniff_check_some_activex']=Security::remove_XSS($_POST['sniff_navigator_check_some_activex']); - $_SESSION['sniff_check_some_plugins']=Security::remove_XSS($_POST['sniff_navigator_check_some_plugins']); - $_SESSION['sniff_java']=Security::remove_XSS($_POST['sniff_navigator_java']); - $_SESSION['sniff_java_sun_ver']=Security::remove_XSS($_POST['sniff_navigator_java_sun_ver']); -} -*/ -/* MAIN CODE */ - -$controller = new IndexManager(get_lang('MyCourses')); - -// Main courses and session list -$courses_and_sessions = $controller->return_courses_and_sessions($user_id); - //Show the chamilo mascot -if (empty($courses_and_sessions) && !isset($_GET['history'])) { +if (empty($courseAndSessions['html']) && !isset($_GET['history'])) { $controller->tpl->assign('welcome_to_course_block', $controller->return_welcome_to_course_block()); } -$controller->tpl->assign('content', $courses_and_sessions); +$controller->tpl->assign('content', $courseAndSessions['html']); if (api_get_setting('allow_browser_sniffer') == 'true') { if ($_SESSION['sniff_navigator']!="checked") {