diff --git a/custompages/registration-dist.php b/custompages/registration-dist.php index c0206a1149..ae86a1988b 100644 --- a/custompages/registration-dist.php +++ b/custompages/registration-dist.php @@ -7,14 +7,9 @@ * 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 */ diff --git a/main/admin/course_list.php b/main/admin/course_list.php index 62fd51191f..f2a21e7eb0 100755 --- a/main/admin/course_list.php +++ b/main/admin/course_list.php @@ -231,14 +231,22 @@ function get_course_data_by_session($from, $number_of_items, $column, $direction function modify_filter($code) { $icourse = api_get_course_info($code); + return - ''.Display::return_icon('synthese_view.gif', get_lang('Info')).' '. - //''.Display::return_icon('course_home.gif', get_lang('CourseHomepage')).' '. // This is not the preferable way to go to the homepage. - ''.Display::return_icon('course_home.gif', get_lang('CourseHomepage')).' '. - ''.Display::return_icon('statistics.gif', get_lang('Tracking')).' '. - ''.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).' '. - ''.Display::return_icon('backup.gif', get_lang('CreateBackup')).' '. - ''.Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).''; + ''. + Display::return_icon('synthese_view.gif', get_lang('Info')).' '. + //''. + //Display::return_icon('course_home.gif', get_lang('CourseHomepage')).' '. // This is not the preferable way to go to the homepage. + ''. + Display::return_icon('course_home.gif', get_lang('CourseHomepage')).' '. + ''. + Display::return_icon('statistics.gif', get_lang('Tracking')).' '. + ''. + Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).' '. + ''. + Display::return_icon('backup.gif', get_lang('CreateBackup')).' '. + ''. + Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).''; } /** diff --git a/main/admin/settings.php b/main/admin/settings.php index 4d10af8f4a..33a7dc870f 100755 --- a/main/admin/settings.php +++ b/main/admin/settings.php @@ -484,7 +484,7 @@ if (!empty($_GET['category'])) { api_get_utc_datetime(), $user_id ); - Display :: display_confirmation_message(get_lang('DashboardPluginsHaveBeenUpdatedSucesslly')); + Display :: display_confirmation_message(get_lang('DashboardPluginsUpdatedSuccessfully')); } } echo ' -'; +'; Display :: display_header($tool_name, "User"); $usergroup = new UserGroup(); diff --git a/main/user/resume_session.php b/main/user/resume_session.php index 80e1f1235c..3550cfd201 100755 --- a/main/user/resume_session.php +++ b/main/user/resume_session.php @@ -1,5 +1,6 @@ - '.get_lang('NoCoursesForThisSession').' + '.get_lang('NoCoursesForThisSession').' '; } else { // select the courses @@ -276,7 +277,8 @@ if($allowTutors == 'true') { } $orig_param = '&origin=resume_session'; - //hide_course_breadcrumb the parameter has been added to hide the name of the course, that appeared in the default $interbreadcrumb + //hide_course_breadcrumb the parameter has been added to hide the + // name of the course, that appeared in the default $interbreadcrumb echo ' '.Display::url($course['title'].' ('.$course['visual_code'].')', api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$id_session),' @@ -292,7 +294,6 @@ if($allowTutors == 'true') { - @@ -330,7 +331,8 @@ if($allowTutors == 'true') { $result = Database::query($sql); $users = Database::store_result($result); - $orig_param = '&origin=resume_session&id_session='.$id_session; // change breadcrumb in destination page + // change breadcrumb in destination page + $orig_param = '&origin=resume_session&id_session='.$id_session; foreach ($users as $user) { $user_link = ''; if (!empty($user['user_id'])) { @@ -347,6 +349,7 @@ if($allowTutors == 'true') { $link_to_add_user_in_url = ''.$add.''; } } + echo '
'.$user_link.' diff --git a/main/user/session_list.php b/main/user/session_list.php index 1f049b9635..f93de53d33 100755 --- a/main/user/session_list.php +++ b/main/user/session_list.php @@ -1,5 +1,6 @@ 'name', 'index'=>'name', 'width'=>'160', 'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"), @@ -56,9 +66,10 @@ if($allowTutors == 'true') { array('name'=>'coach_name', 'index'=>'coach_name', 'width'=>'80', 'align'=>'left', 'search' => 'false'), array('name'=>'status', 'index'=>'session_active','width'=>'40', 'align'=>'left', 'search' => 'true', 'stype'=>'select', //for the bottom bar - 'searchoptions' => array( - 'defaultValue' => '1', - 'value' => '1:'.get_lang('Active').';0:'.get_lang('Inactive')), + 'searchoptions' => array( + 'defaultValue' => '1', + 'value' => '1:'.get_lang('Active').';0:'.get_lang('Inactive') + ), //for the top bar 'editoptions' => array('value' => ':'.get_lang('All').';1:'.get_lang('Active').';0:'.get_lang('Inactive'))), array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'), diff --git a/main/user/subscribe_class.php b/main/user/subscribe_class.php index 66bfc0b0a4..6a69aa620d 100755 --- a/main/user/subscribe_class.php +++ b/main/user/subscribe_class.php @@ -74,7 +74,8 @@ function get_number_of_classes() /** * Get the classes to display on the current page. */ -function get_class_data($from, $number_of_items, $column, $direction) { +function get_class_data($from, $number_of_items, $column, $direction) +{ $class_table = Database :: get_main_table(TABLE_MAIN_CLASS); $course_class_table = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS); $class_user_table = Database :: get_main_table(TABLE_MAIN_CLASS_USER); diff --git a/main/user/subscribe_user.php b/main/user/subscribe_user.php index 3aba74fb81..ee036bee04 100755 --- a/main/user/subscribe_user.php +++ b/main/user/subscribe_user.php @@ -50,50 +50,49 @@ if ($keyword) { $tool_name = get_lang('SearchResults'); } - $current_session_id = api_get_session_id(); $list_register_user=''; $list_not_register_user=''; if (isset($_REQUEST['register'])) { - if ($type == COURSEMANAGER) { - if (!empty($current_session_id)) { - $result_simple_sub = SessionManager::set_coach_to_course_session( - $_REQUEST['user_id'], - $current_session_id, - $courseInfo['code'] - ); - } else { - $result_simple_sub = CourseManager:: subscribe_user( - $_REQUEST['user_id'], - $courseInfo['code'], - COURSEMANAGER - ); - } - } else { + if ($type == COURSEMANAGER) { + if (!empty($current_session_id)) { + $result_simple_sub = SessionManager::set_coach_to_course_session( + $_REQUEST['user_id'], + $current_session_id, + $courseInfo['code'] + ); + } else { + $result_simple_sub = CourseManager:: subscribe_user( + $_REQUEST['user_id'], + $courseInfo['code'], + COURSEMANAGER + ); + } + } else { $result_simple_sub = CourseManager:: subscribe_user( $_REQUEST['user_id'], $courseInfo['code'] ); - } + } $user_id_temp = $_SESSION['session_user_id']; - if (is_array($user_id_temp)) { - $counter = count($user_id_temp); - for ($j=0; $j<$counter;$j++) { - if ($user_id_temp[$j]==$_GET['user_id']) { - if ($result_simple_sub) { + if (is_array($user_id_temp)) { + $counter = count($user_id_temp); + for ($j=0; $j<$counter;$j++) { + if ($user_id_temp[$j]==$_GET['user_id']) { + if ($result_simple_sub) { Display::addFlash(Display::return_message($_SESSION['session_user_name'][$j].' '.get_lang('AddedToCourse'))); - } else { + } else { Display::addFlash(Display::return_message($_SESSION['session_user_name'][$j].' '.get_lang('NotAddedToCourse'), 'error')); - } - } - } - unset($_SESSION['session_user_id']); - unset($_SESSION['session_user_name']); - } + } + } + } + unset($_SESSION['session_user_id']); + unset($_SESSION['session_user_name']); + } header('Location:'.api_get_path(WEB_CODE_PATH).'user/user.php?'.api_get_cidreq().'&type='.$type); exit; @@ -132,12 +131,12 @@ if (isset($_POST['action'])) { $user_id_temp = $_SESSION['session_user_id']; $user_name_temp = $_SESSION['session_user_name']; - unset($_SESSION['session_user_id']); - unset($_SESSION['session_user_name']); - $counter = 0; - $is_suscribe_counter = count($is_suscribe_user_id); + unset($_SESSION['session_user_id']); + unset($_SESSION['session_user_name']); + $counter = 0; + $is_suscribe_counter = count($is_suscribe_user_id); - $list_register_user=''; + $list_register_user=''; for ($i = 0; $i < $is_suscribe_counter; $i++) { for ($j = 0; $j < count($user_id_temp); $j++) { @@ -153,20 +152,20 @@ if (isset($_POST['action'])) { } } - if (!empty($list_register_user)) { + if (!empty($list_register_user)) { if ($is_suscribe_counter == 1) { - $register_user_message = $temp_unique_user.' '.get_lang('AddedToCourse'); - Display::addFlash(Display::return_message($register_user_message)); - } else { - $register_user_message = get_lang('UsersRegistered').'

'.$list_register_user; + $register_user_message = $temp_unique_user.' '.get_lang('AddedToCourse'); + Display::addFlash(Display::return_message($register_user_message)); + } else { + $register_user_message = get_lang('UsersRegistered').'

'.$list_register_user; Display::addFlash(Display::return_message($register_user_message, 'normal', false)); - } - } + } + } - if (!empty($list_not_register_user)) { - $not_register_user_message = get_lang('UsersNotRegistered').'


'.$list_not_register_user; + if (!empty($list_not_register_user)) { + $not_register_user_message = get_lang('UsersNotRegistered').'


'.$list_not_register_user; Display::addFlash(Display::return_message($not_register_user_message, 'error', false)); - } + } header('Location:'.api_get_path(WEB_CODE_PATH).'user/user.php?'.api_get_cidreq().'&type='.$type); exit; @@ -210,7 +209,7 @@ if (api_get_setting('show_email_addresses') == 'true') { $table->set_header($col ++, get_lang('Email')); $table->set_column_filter($col -1, 'email_filter'); } -$table->set_header($col ++, get_lang('Active'),false); +$table->set_header($col++, get_lang('Active'), false); $table->set_column_filter($col -1, 'active_filter'); $table->set_header($col ++, get_lang('Actions'), false); $table->set_column_filter($col -1, 'reg_filter'); @@ -308,7 +307,9 @@ function get_number_of_users() $sql = "SELECT COUNT(u.user_id) FROM $user_table u LEFT JOIN $tbl_session_rel_course_user cu - ON u.user_id = cu.user_id and cu.c_id = '".api_get_course_int_id()."' AND session_id ='".api_get_session_id()."' + ON + u.user_id = cu.user_id and cu.c_id = '".api_get_course_int_id()."' AND + session_id ='".api_get_session_id()."' INNER JOIN $tbl_url_rel_user as url_rel_user ON (url_rel_user.user_id = u.user_id) WHERE @@ -341,7 +342,6 @@ function get_number_of_users() } } } - } else { // students if (api_get_session_id() != 0) { @@ -423,7 +423,13 @@ function get_number_of_users() // when there is a keyword then we are searching and we have to change the SQL statement if (isset($_GET['keyword']) AND !empty($_GET['keyword'])) { $keyword = Database::escape_string(trim($_REQUEST['keyword'])); - $sql .= " AND (firstname LIKE '%".$keyword."%' OR lastname LIKE '%".$keyword."%' OR email LIKE '%".$keyword."%' OR username LIKE '%".$keyword."%' OR official_code LIKE '%".$keyword."%')"; + $sql .= " AND ( + firstname LIKE '%".$keyword."%' OR + lastname LIKE '%".$keyword."%' OR + email LIKE '%".$keyword."%' OR + username LIKE '%".$keyword."%' OR + official_code LIKE '%".$keyword."%' + )"; // we also want to search for users who have something in their profile fields that matches the keyword if (api_get_setting('ProfilingFilterAddingUsers') == 'true') { diff --git a/main/user/user.php b/main/user/user.php index 556fed3f7c..bfcefc6398 100755 --- a/main/user/user.php +++ b/main/user/user.php @@ -202,14 +202,14 @@ if (api_is_allowed_to_edit(null, true)) { if (api_get_session_id()) { $table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $sql = "SELECT DISTINCT - user.user_id, ".($is_western_name_order ? "user.firstname, user.lastname" : "user.lastname, user.firstname").", - user.username, - $select_email_condition - phone, - user.official_code, - active - $legal - FROM $table_session_course_user as session_course_user, $table_users as user "; + user.user_id, ".($is_western_name_order ? "user.firstname, user.lastname" : "user.lastname, user.firstname").", + user.username, + $select_email_condition + phone, + user.official_code, + active + $legal + FROM $table_session_course_user as session_course_user, $table_users as user "; if (api_is_multiple_url_enabled()) { $sql .= ' , '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au '; } @@ -280,7 +280,6 @@ if (api_is_allowed_to_edit(null, true)) { } if ($sessionId == 0) { - // users directly subscribed to the course $table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); $sql = "SELECT DISTINCT @@ -446,7 +445,6 @@ if (!$is_allowed_in_course) { // Statistics Event::event_access_tool(TOOL_USER); - /** * Get the users to display on the current page. */ @@ -609,13 +607,13 @@ function get_user_data($from, $number_of_items, $column, $direction) foreach ($a_course_users as $user_id => $o_course_user) { if (( - isset($_GET['keyword']) && - searchUserKeyword( - $o_course_user['firstname'], - $o_course_user['lastname'], - $o_course_user['username'], - $o_course_user['official_code'], - $_GET['keyword']) + isset($_GET['keyword']) && + searchUserKeyword( + $o_course_user['firstname'], + $o_course_user['lastname'], + $o_course_user['username'], + $o_course_user['official_code'], + $_GET['keyword']) ) || !isset($_GET['keyword']) || empty($_GET['keyword']) ) { @@ -942,7 +940,7 @@ if (api_is_allowed_to_edit(null, true)) { $url = api_get_path(WEB_CODE_PATH).'user/subscribe_user.php?'.api_get_cidreq().'&type='.COURSEMANAGER; break; } - + echo '
'; echo '
'; echo Display::url( @@ -964,7 +962,7 @@ if (api_is_allowed_to_edit(null, true)) { $actions .= ''. Display::return_icon('pdf.png', get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).' '; echo $actions; - + echo '
'; echo '
'; echo '
'; @@ -973,17 +971,17 @@ if (api_is_allowed_to_edit(null, true)) { $form->addText('keyword', '', false); $form->addButtonSearch(get_lang('SearchButton')); $form->display(); - echo '
'; echo '
'; echo '
'; - + echo ''; + $allowTutors = api_get_setting('allow_tutors_to_assign_students_to_session'); if (api_is_allowed_to_edit() && $allowTutors == 'true') { $actions .= ' '. get_lang('Sessions').''; } - + echo ''; } diff --git a/main/user/user_import.php b/main/user/user_import.php index 1f19b25b9e..da2898847e 100755 --- a/main/user/user_import.php +++ b/main/user/user_import.php @@ -40,11 +40,9 @@ $type = ''; if ($form->validate()) { if (isset($_FILES['import_file']['size']) && $_FILES['import_file']['size'] !== 0) { - $unsubscribe_users = isset($_POST['unsubscribe_users']) ? true : false; //@todo : csvToArray deprecated $users = Import::csvToArray($_FILES['import_file']['tmp_name']); - $invalid_users = array(); $clean_users = array(); @@ -134,7 +132,6 @@ if (!empty($message)) { } else { $empty_line_msg = ($empty_line == 0) ? get_lang('ErrorsWhenImportingFile'): get_lang('ErrorsWhenImportingFile').': '.get_lang('EmptyHeaderLine'); Display::display_error_message($empty_line_msg); - } } diff --git a/main/wiki/wiki.inc.php b/main/wiki/wiki.inc.php index 6b2d36ec32..07d3595168 100755 --- a/main/wiki/wiki.inc.php +++ b/main/wiki/wiki.inc.php @@ -419,7 +419,7 @@ class Wiki Database::update( $tbl_wiki_conf, $params, - ['page_id => ? AND c_id = ?' => [$pageId, $course_id]] + ['page_id = ? AND c_id = ?' => [$pageId, $course_id]] ); } diff --git a/plugin/dashboard/block_evaluation_graph/block_evaluation_graph.class.php b/plugin/dashboard/block_evaluation_graph/block_evaluation_graph.class.php index bbb6467b88..f1b2fa0e11 100755 --- a/plugin/dashboard/block_evaluation_graph/block_evaluation_graph.class.php +++ b/plugin/dashboard/block_evaluation_graph/block_evaluation_graph.class.php @@ -83,28 +83,28 @@ class BlockEvaluationGraph extends Block
'; - if (empty($evaluations_base_courses_graph) && empty($evaluations_courses_in_sessions_graph)) { - $html .= '

'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'

'; - } else { - // display evaluations base courses graph - if (!empty($evaluations_base_courses_graph)) { - foreach ($evaluations_base_courses_graph as $course_code => $img_html) { - $html .= '
'.$course_code.'
'; - $html .= $img_html; - } - } - // display evaluations base courses graph - if (!empty($evaluations_courses_in_sessions_graph)) { - foreach ($evaluations_courses_in_sessions_graph as $session_id => $courses) { - $session_name = api_get_session_name($session_id); - $html .= '
'.$session_name.':'.get_lang('Evaluations').'
'; - foreach ($courses as $course_code => $img_html) { - $html .= '
'.$course_code.'
'; - $html .= $img_html; - } - } - } - } + if (empty($evaluations_base_courses_graph) && empty($evaluations_courses_in_sessions_graph)) { + $html .= '

'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'

'; + } else { + // display evaluations base courses graph + if (!empty($evaluations_base_courses_graph)) { + foreach ($evaluations_base_courses_graph as $course_code => $img_html) { + $html .= '
'.$course_code.'
'; + $html .= $img_html; + } + } + // display evaluations base courses graph + if (!empty($evaluations_courses_in_sessions_graph)) { + foreach ($evaluations_courses_in_sessions_graph as $session_id => $courses) { + $session_name = api_get_session_name($session_id); + $html .= '
'.$session_name.':'.get_lang('Evaluations').'
'; + foreach ($courses as $course_code => $img_html) { + $html .= '
'.$course_code.'
'; + $html .= $img_html; + } + } + } + } $html .= '
'; diff --git a/plugin/dashboard/block_teacher_graph/block_teacher_graph.class.php b/plugin/dashboard/block_teacher_graph/block_teacher_graph.class.php index 46c819f549..38ec5fd4f2 100755 --- a/plugin/dashboard/block_teacher_graph/block_teacher_graph.class.php +++ b/plugin/dashboard/block_teacher_graph/block_teacher_graph.class.php @@ -195,7 +195,7 @@ class BlockTeacherGraph extends Block } $graph = ''; } else { - $graph = '

'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'

'; + $graph = '

'.api_convert_encoding(get_lang('GraphicNotAvailable'), 'UTF-8').'

'; } return $graph; diff --git a/tests/main/inc/lib/tracking.lib.test.php b/tests/main/inc/lib/tracking.lib.test.php index 4219068cb3..589eb50075 100755 --- a/tests/main/inc/lib/tracking.lib.test.php +++ b/tests/main/inc/lib/tracking.lib.test.php @@ -210,12 +210,12 @@ class TestTracking extends UnitTestCase { //var_dump($res); } - function testget_inactives_students_in_course() { + function testGetInactiveStudentsInCourse() { global $_course; $course_code = $_course; $since='2010-10-02'; $session_id=''; - $res=Tracking::get_inactives_students_in_course($course_code, $since, $session_id); + $res=Tracking::getInactiveStudentsInCourse($course_code, $since, $session_id); if(!is_null($res))$this->assertTrue(is_array($res)); //var_dump($res); } diff --git a/whoisonline.php b/whoisonline.php index 8a7f85bc68..ffa3ebf364 100755 --- a/whoisonline.php +++ b/whoisonline.php @@ -16,19 +16,13 @@ if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) { } $_SESSION['who_is_online_counter'] = 2; - -//$htmlHeadXtra[] = api_get_js('jquery.endless-scroll.js'); -//social tab $this_section = SECTION_SOCIAL; // table definitions $track_user_table = Database::get_main_table(TABLE_MAIN_USER); -$htmlHeadXtra[] = ''; $social_right_content = null; $whoisonline_list = null; +$social_search = ''; /* if (isset($_GET['chatid'])) { //send out call request @@ -68,7 +62,7 @@ if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) || if (api_get_setting('allow_social_tool') == 'true') { if (!api_is_anonymous()) { $query = isset($_GET['q']) ? $_GET['q']: null; - $social_search .= UserManager::get_search_form($query); + $social_search = UserManager::get_search_form($query); } } //$social_right_content .= SocialManager::display_user_list($user_list);