@@ -20,32 +20,32 @@ discard block |
||
20 | 20 | $i=1; |
21 | 21 | echo '<div class="actions" style="margin-bottom:30px">'; |
22 | 22 | echo '<a href="index.php?'.api_get_cidreq().'">'. |
23 | - Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM). |
|
24 | - '</a>'; |
|
23 | + Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM). |
|
24 | + '</a>'; |
|
25 | 25 | ksort($categories); |
26 | 26 | foreach ($categories as $id => $title) { |
27 | - if ($i == ADD_BLOCK) { |
|
28 | - echo '<a href="index.php?'.api_get_cidreq().'&action=add">'. |
|
29 | - Display::return_icon($default_description_icon[$id], $title, '',ICON_SIZE_MEDIUM).'</a>'; |
|
30 | - break; |
|
31 | - } else { |
|
32 | - echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'. |
|
33 | - Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>'; |
|
34 | - $i++; |
|
35 | - } |
|
27 | + if ($i == ADD_BLOCK) { |
|
28 | + echo '<a href="index.php?'.api_get_cidreq().'&action=add">'. |
|
29 | + Display::return_icon($default_description_icon[$id], $title, '',ICON_SIZE_MEDIUM).'</a>'; |
|
30 | + break; |
|
31 | + } else { |
|
32 | + echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'. |
|
33 | + Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>'; |
|
34 | + $i++; |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | echo '</div>'; |
38 | 38 | |
39 | 39 | // error messages |
40 | 40 | if (isset($error) && intval($error) == 1) { |
41 | - Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false); |
|
41 | + Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // default header title form |
45 | 45 | $header = ''; |
46 | 46 | $description_type = intval($description_type); |
47 | 47 | if ($description_type >= ADD_BLOCK) { |
48 | - $header = $default_description_titles[ADD_BLOCK]; |
|
48 | + $header = $default_description_titles[ADD_BLOCK]; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | // display form |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | |
74 | 74 | // display default questions |
75 | 75 | if (isset ($question[$description_type])) { |
76 | - $message = '<strong>'.get_lang('QuestionPlan').'</strong><br />'; |
|
77 | - $message .= $question[$description_type]; |
|
78 | - Display::display_normal_message($message, false); |
|
76 | + $message = '<strong>'.get_lang('QuestionPlan').'</strong><br />'; |
|
77 | + $message .= $question[$description_type]; |
|
78 | + Display::display_normal_message($message, false); |
|
79 | 79 | } |
80 | 80 | $form->display(); |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * Export tabular data to XML-file |
|
119 | - * @param array Simple array of data to put in XML |
|
120 | - * @param string Name of file to be given to the user |
|
121 | - * @param string Name of common tag to place each line in |
|
122 | - * @param string Name of the root element. A root element should always be given. |
|
123 | - * @param string Encoding in which the data is provided |
|
124 | - */ |
|
118 | + * Export tabular data to XML-file |
|
119 | + * @param array Simple array of data to put in XML |
|
120 | + * @param string Name of file to be given to the user |
|
121 | + * @param string Name of common tag to place each line in |
|
122 | + * @param string Name of the root element. A root element should always be given. |
|
123 | + * @param string Encoding in which the data is provided |
|
124 | + */ |
|
125 | 125 | public static function arrayToXml( |
126 | 126 | $data, |
127 | 127 | $filename = 'export', |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | foreach ($data as $row) { |
201 | 201 | $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>'; |
202 | 202 | if (is_array($row['value'])) { |
203 | - $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n"; |
|
203 | + $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n"; |
|
204 | 204 | $string .= str_repeat("\t",$level).'</'.$row['name'].'>'; |
205 | 205 | } else { |
206 | 206 | $string .= $row['value']; |
@@ -25,29 +25,29 @@ |
||
25 | 25 | function search_courses($needle,$type) |
26 | 26 | { |
27 | 27 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
28 | - $xajax_response = new xajaxResponse(); |
|
29 | - $return = ''; |
|
30 | - if(!empty($needle) && !empty($type)) { |
|
31 | - // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
32 | - $charset = api_get_system_encoding(); |
|
33 | - $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
34 | - $needle = Database::escape_string($needle); |
|
28 | + $xajax_response = new xajaxResponse(); |
|
29 | + $return = ''; |
|
30 | + if(!empty($needle) && !empty($type)) { |
|
31 | + // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
32 | + $charset = api_get_system_encoding(); |
|
33 | + $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
34 | + $needle = Database::escape_string($needle); |
|
35 | 35 | |
36 | - $sql = 'SELECT * FROM '.$tbl_session.' WHERE name LIKE "'.$needle.'%" ORDER BY id'; |
|
36 | + $sql = 'SELECT * FROM '.$tbl_session.' WHERE name LIKE "'.$needle.'%" ORDER BY id'; |
|
37 | 37 | |
38 | - $rs = Database::query($sql); |
|
39 | - $course_list = array(); |
|
38 | + $rs = Database::query($sql); |
|
39 | + $course_list = array(); |
|
40 | 40 | |
41 | - $return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">'; |
|
42 | - while($course = Database :: fetch_array($rs)) { |
|
43 | - $course_list[] = $course['id']; |
|
44 | - $return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>'; |
|
45 | - } |
|
46 | - $return .= '</select>'; |
|
47 | - $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
48 | - } |
|
49 | - $_SESSION['course_list'] = $course_list; |
|
41 | + $return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">'; |
|
42 | + while($course = Database :: fetch_array($rs)) { |
|
43 | + $course_list[] = $course['id']; |
|
44 | + $return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>'; |
|
45 | + } |
|
46 | + $return .= '</select>'; |
|
47 | + $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
48 | + } |
|
49 | + $_SESSION['course_list'] = $course_list; |
|
50 | 50 | |
51 | - return $xajax_response; |
|
52 | - } |
|
51 | + return $xajax_response; |
|
52 | + } |
|
53 | 53 | } |
@@ -137,7 +137,7 @@ |
||
137 | 137 | array('\r', '\n', '\x3c', '\x3e', '\x26'), |
138 | 138 | addslashes($var) |
139 | 139 | ).'"'; |
140 | - case 'array': |
|
140 | + case 'array': |
|
141 | 141 | // Arrays in JSON can't be associative. If the array is empty or if it |
142 | 142 | // has sequential whole number keys starting with 0, it's not associative |
143 | 143 | // so we can go ahead and convert it as an array. |
@@ -47,20 +47,20 @@ discard block |
||
47 | 47 | $navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&courseCode='.$_course['official_code'] : '' ); |
48 | 48 | $navigation['myprofile']['title'] = get_lang('ModifyProfile'); |
49 | 49 | $navigation['myprofile']['key'] = 'profile'; |
50 | - // Link to my agenda |
|
50 | + // Link to my agenda |
|
51 | 51 | $navigation['myagenda']['url'] = api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?type=personal'; |
52 | 52 | $navigation['myagenda']['title'] = get_lang('MyAgenda'); |
53 | 53 | $navigation['myagenda']['key'] = 'agenda'; |
54 | 54 | |
55 | - // Gradebook |
|
56 | - if (api_get_setting('gradebook_enable') == 'true') { |
|
55 | + // Gradebook |
|
56 | + if (api_get_setting('gradebook_enable') == 'true') { |
|
57 | 57 | $navigation['mygradebook']['url'] = api_get_path(WEB_CODE_PATH).'gradebook/gradebook.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&courseCode='.$_course['official_code'] : '' ); |
58 | 58 | $navigation['mygradebook']['title'] = get_lang('MyGradebook'); |
59 | 59 | $navigation['mygradebook']['key'] = 'gradebook'; |
60 | - } |
|
60 | + } |
|
61 | 61 | |
62 | - // Reporting |
|
63 | - if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) { |
|
62 | + // Reporting |
|
63 | + if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) { |
|
64 | 64 | // Link to my space |
65 | 65 | $navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH).'mySpace/'.(api_is_drh()?'session.php':''); |
66 | 66 | $navigation['session_my_space']['title'] = get_lang('MySpace'); |
@@ -84,21 +84,21 @@ discard block |
||
84 | 84 | $navigation['session_my_progress']['key'] = 'my-progress'; |
85 | 85 | } |
86 | 86 | |
87 | - // Social |
|
88 | - if (api_get_setting('allow_social_tool')=='true') { |
|
87 | + // Social |
|
88 | + if (api_get_setting('allow_social_tool')=='true') { |
|
89 | 89 | $navigation['social']['url'] = api_get_path(WEB_CODE_PATH).'social/home.php'; |
90 | 90 | $navigation['social']['title'] = get_lang('SocialNetwork'); |
91 | 91 | $navigation['social']['key'] = 'social-network'; |
92 | - } |
|
92 | + } |
|
93 | 93 | |
94 | - // Dashboard |
|
95 | - if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) { |
|
94 | + // Dashboard |
|
95 | + if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) { |
|
96 | 96 | $navigation['dashboard']['url'] = api_get_path(WEB_CODE_PATH).'dashboard/index.php'; |
97 | 97 | $navigation['dashboard']['title'] = get_lang('Dashboard'); |
98 | 98 | $navigation['dashboard']['key'] = 'dashboard'; |
99 | - } |
|
99 | + } |
|
100 | 100 | |
101 | - // Reports |
|
101 | + // Reports |
|
102 | 102 | /* |
103 | 103 | if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) { |
104 | 104 | $navigation['reports']['url'] = api_get_path(WEB_CODE_PATH).'reports/index.php'; |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | } |
122 | 122 | // End Custom Tabs |
123 | 123 | |
124 | - // Platform administration |
|
125 | - if (api_is_platform_admin(true)) { |
|
124 | + // Platform administration |
|
125 | + if (api_is_platform_admin(true)) { |
|
126 | 126 | $navigation['platform_admin']['url'] = api_get_path(WEB_CODE_PATH).'admin/'; |
127 | 127 | $navigation['platform_admin']['title'] = get_lang('PlatformAdmin'); |
128 | 128 | $navigation['platform_admin']['key'] = 'admin'; |
129 | - } |
|
129 | + } |
|
130 | 130 | |
131 | - return $navigation; |
|
131 | + return $navigation; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | if ($number && |
255 | 255 | (api_get_setting('showonline', 'world') == 'true' && !$user_id) || |
256 | 256 | (api_get_setting('showonline', 'users') == 'true' && $user_id) |
257 | - ) |
|
257 | + ) |
|
258 | 258 | { |
259 | 259 | $html .= '<li><a href="'.api_get_path(WEB_PATH).'whoisonline.php" target="_self" title="'.get_lang('UsersOnline').'" >'. |
260 | 260 | Display::return_icon('user.png', get_lang('UsersOnline'), array(), ICON_SIZE_TINY).' '.$number.'</a></li>'; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | (is_array($_course) && |
266 | 266 | api_get_setting('showonline', 'course') == 'true' && isset($_course['sysCode']) |
267 | 267 | ) |
268 | - ) |
|
268 | + ) |
|
269 | 269 | { |
270 | 270 | $html .= '<li><a href="'.api_get_path(WEB_PATH).'whoisonline.php?cidReq='.$_course['sysCode'].'" target="_self">'. |
271 | 271 | Display::return_icon('course.png', get_lang('UsersOnline').' '.get_lang('InThisCourse'), array(), ICON_SIZE_TINY).' '.$number_online_in_course.' </a></li>'; |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
379 | - // Reports |
|
379 | + // Reports |
|
380 | 380 | if (!empty($possible_tabs['reports'])) { |
381 | 381 | if (api_get_setting('show_tabs', 'reports') == 'true') { |
382 | 382 | if ((api_is_platform_admin() || api_is_drh() || api_is_session_admin()) && Rights::hasRight('show_tabs:reports')) { |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | $navigation_item_my_courses['title'] = get_lang('MyCourses'); |
624 | 624 | $navigation_item_my_courses['url'] = api_get_path(WEB_PATH).'user_portal.php'; |
625 | 625 | $navigation[] = $navigation_item_my_courses; |
626 | - */ |
|
626 | + */ |
|
627 | 627 | $navigation[] = $navigation_item; |
628 | 628 | } |
629 | 629 |
@@ -1320,10 +1320,10 @@ discard block |
||
1320 | 1320 | } |
1321 | 1321 | |
1322 | 1322 | $sql .= ' FROM ' . Database::get_main_table(TABLE_MAIN_USER) . ' as user ' |
1323 | - . ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_COURSE_USER) . ' as course_rel_user |
|
1323 | + . ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_COURSE_USER) . ' as course_rel_user |
|
1324 | 1324 | ON user.user_id = course_rel_user.user_id AND |
1325 | 1325 | course_rel_user.relation_type <> ' . COURSE_RELATION_TYPE_RRHH . ' ' |
1326 | - . " INNER JOIN $course_table course ON course_rel_user.c_id = course.id "; |
|
1326 | + . " INNER JOIN $course_table course ON course_rel_user.c_id = course.id "; |
|
1327 | 1327 | |
1328 | 1328 | if (!empty($course_code)) { |
1329 | 1329 | $sql .= ' AND course_rel_user.c_id="' . $courseId . '"'; |
@@ -1665,7 +1665,7 @@ discard block |
||
1665 | 1665 | |
1666 | 1666 | // We get the coach for the given course in a given session. |
1667 | 1667 | $sql = 'SELECT user_id FROM ' . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . |
1668 | - ' WHERE session_id ="' . $session_id . '" AND c_id="' . $courseId . '" AND status = 2'; |
|
1668 | + ' WHERE session_id ="' . $session_id . '" AND c_id="' . $courseId . '" AND status = 2'; |
|
1669 | 1669 | $rs = Database::query($sql); |
1670 | 1670 | while ($user = Database::fetch_array($rs)) { |
1671 | 1671 | $user_info = api_get_user_info($user['user_id']); |
@@ -3374,13 +3374,13 @@ discard block |
||
3374 | 3374 | $params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code']; |
3375 | 3375 | if ($load_dirs) { |
3376 | 3376 | $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
3377 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3377 | + . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3378 | 3378 | $params['document'] .= Display::div('', ['id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container']); |
3379 | 3379 | } |
3380 | 3380 | }else{ |
3381 | 3381 | if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED && $load_dirs) { |
3382 | 3382 | $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
3383 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3383 | + . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3384 | 3384 | $params['document'] .= Display::div('', ['id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container']); |
3385 | 3385 | } |
3386 | 3386 | } |
@@ -3563,7 +3563,7 @@ discard block |
||
3563 | 3563 | $params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code']; |
3564 | 3564 | if($load_dirs){ |
3565 | 3565 | $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
3566 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3566 | + . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3567 | 3567 | $params['document'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container')); |
3568 | 3568 | } |
3569 | 3569 | } |
@@ -3701,7 +3701,7 @@ discard block |
||
3701 | 3701 | $params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code']; |
3702 | 3702 | if($load_dirs){ |
3703 | 3703 | $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
3704 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3704 | + . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3705 | 3705 | $params['document'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container')); |
3706 | 3706 | } |
3707 | 3707 | } |
@@ -4010,7 +4010,7 @@ discard block |
||
4010 | 4010 | } |
4011 | 4011 | |
4012 | 4012 | $session_title .= isset($course['special_course']) ? ' ' . |
4013 | - Display::return_icon('klipper.png', get_lang('CourseAutoRegister')) : ''; |
|
4013 | + Display::return_icon('klipper.png', get_lang('CourseAutoRegister')) : ''; |
|
4014 | 4014 | |
4015 | 4015 | $params['title'] = $session_title; |
4016 | 4016 | $params['extra'] = ''; |
@@ -304,9 +304,9 @@ discard block |
||
304 | 304 | */ |
305 | 305 | public static function remove_XSS($var, $user_status = null, $filter_terms = false) |
306 | 306 | { |
307 | - if ($filter_terms) { |
|
308 | - $var = self::filter_terms($var); |
|
309 | - } |
|
307 | + if ($filter_terms) { |
|
308 | + $var = self::filter_terms($var); |
|
309 | + } |
|
310 | 310 | |
311 | 311 | if (empty($user_status)) { |
312 | 312 | if (api_is_anonymous()) { |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | */ |
402 | 402 | public static function filter_terms($text) |
403 | 403 | { |
404 | - static $bad_terms = array(); |
|
404 | + static $bad_terms = array(); |
|
405 | 405 | |
406 | 406 | if (empty($bad_terms)) { |
407 | 407 | $list = api_get_setting('filter_terms'); |
@@ -422,14 +422,14 @@ discard block |
||
422 | 422 | } |
423 | 423 | } |
424 | 424 | |
425 | - $replace = '***'; |
|
426 | - if (!empty($bad_terms)) { |
|
427 | - // Fast way |
|
428 | - $new_text = str_ireplace($bad_terms, $replace, $text, $count); |
|
429 | - $text = $new_text; |
|
430 | - } |
|
425 | + $replace = '***'; |
|
426 | + if (!empty($bad_terms)) { |
|
427 | + // Fast way |
|
428 | + $new_text = str_ireplace($bad_terms, $replace, $text, $count); |
|
429 | + $text = $new_text; |
|
430 | + } |
|
431 | 431 | |
432 | - return $text; |
|
432 | + return $text; |
|
433 | 433 | } |
434 | 434 | |
435 | 435 |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | */ |
166 | 166 | function LoginDelete($user_id) |
167 | 167 | { |
168 | - $online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
168 | + $online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
169 | 169 | $user_id = intval($user_id); |
170 | - $query = "DELETE FROM " . $online_table . " WHERE login_user_id = $user_id"; |
|
171 | - Database::query($query); |
|
170 | + $query = "DELETE FROM " . $online_table . " WHERE login_user_id = $user_id"; |
|
171 | + Database::query($query); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -177,17 +177,17 @@ discard block |
||
177 | 177 | */ |
178 | 178 | function user_is_online($user_id) |
179 | 179 | { |
180 | - $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
181 | - $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
180 | + $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
181 | + $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
182 | 182 | |
183 | - $access_url_id = api_get_current_access_url_id(); |
|
184 | - $time_limit = api_get_setting('time_limit_whosonline'); |
|
183 | + $access_url_id = api_get_current_access_url_id(); |
|
184 | + $time_limit = api_get_setting('time_limit_whosonline'); |
|
185 | 185 | |
186 | 186 | $online_time = time() - $time_limit*60; |
187 | 187 | $limit_date = api_get_utc_datetime($online_time); |
188 | 188 | $user_id = intval($user_id); |
189 | 189 | |
190 | - $query = " SELECT login_user_id,login_date |
|
190 | + $query = " SELECT login_user_id,login_date |
|
191 | 191 | FROM $track_online_table track |
192 | 192 | INNER JOIN $table_user u ON (u.id=track.login_user_id) |
193 | 193 | WHERE |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | u.id = $user_id |
197 | 197 | LIMIT 1 "; |
198 | 198 | |
199 | - $result = Database::query($query); |
|
200 | - if (Database::num_rows($result)) { |
|
199 | + $result = Database::query($query); |
|
200 | + if (Database::num_rows($result)) { |
|
201 | 201 | |
202 | - return true; |
|
203 | - } |
|
202 | + return true; |
|
203 | + } |
|
204 | 204 | |
205 | - return false; |
|
205 | + return false; |
|
206 | 206 | |
207 | 207 | } |
208 | 208 | /** |
@@ -238,13 +238,13 @@ discard block |
||
238 | 238 | |
239 | 239 | $online_time = time() - $time_limit * 60; |
240 | 240 | $current_date = api_get_utc_datetime($online_time); |
241 | - $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
242 | - $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
|
243 | - $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
241 | + $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
242 | + $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
|
243 | + $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
244 | 244 | |
245 | - if ($friends) { |
|
246 | - // who friends from social network is online |
|
247 | - $query = "SELECT DISTINCT login_user_id, login_date |
|
245 | + if ($friends) { |
|
246 | + // who friends from social network is online |
|
247 | + $query = "SELECT DISTINCT login_user_id, login_date |
|
248 | 248 | FROM $track_online_table INNER JOIN $friend_user_table |
249 | 249 | ON (friend_user_id = login_user_id) |
250 | 250 | WHERE |
@@ -254,21 +254,21 @@ discard block |
||
254 | 254 | user_id = '".api_get_user_id()."' |
255 | 255 | ORDER BY $column $direction |
256 | 256 | LIMIT $from, $number_of_items"; |
257 | - } else { |
|
258 | - $query = "SELECT DISTINCT login_user_id, login_date |
|
257 | + } else { |
|
258 | + $query = "SELECT DISTINCT login_user_id, login_date |
|
259 | 259 | FROM ".$track_online_table ." e |
260 | 260 | INNER JOIN ".$table_user ." u ON (u.id = e.login_user_id) |
261 | 261 | WHERE u.status != ".ANONYMOUS." AND login_date >= '".$current_date."' |
262 | 262 | ORDER BY $column $direction |
263 | 263 | LIMIT $from, $number_of_items"; |
264 | - } |
|
265 | - |
|
266 | - if (api_get_multiple_access_url()) { |
|
267 | - $access_url_id = api_get_current_access_url_id(); |
|
268 | - if ($access_url_id != -1) { |
|
269 | - if ($friends) { |
|
270 | - // friends from social network is online |
|
271 | - $query = "SELECT distinct login_user_id, login_date |
|
264 | + } |
|
265 | + |
|
266 | + if (api_get_multiple_access_url()) { |
|
267 | + $access_url_id = api_get_current_access_url_id(); |
|
268 | + if ($access_url_id != -1) { |
|
269 | + if ($friends) { |
|
270 | + // friends from social network is online |
|
271 | + $query = "SELECT distinct login_user_id, login_date |
|
272 | 272 | FROM $track_online_table track INNER JOIN $friend_user_table |
273 | 273 | ON (friend_user_id = login_user_id) |
274 | 274 | WHERE track.access_url_id = $access_url_id AND |
@@ -277,9 +277,9 @@ discard block |
||
277 | 277 | relation_type='".USER_RELATION_TYPE_FRIEND."' |
278 | 278 | ORDER BY $column $direction |
279 | 279 | LIMIT $from, $number_of_items"; |
280 | - } else { |
|
281 | - // all users online |
|
282 | - $query = "SELECT login_user_id, login_date |
|
280 | + } else { |
|
281 | + // all users online |
|
282 | + $query = "SELECT login_user_id, login_date |
|
283 | 283 | FROM ".$track_online_table ." track |
284 | 284 | INNER JOIN ".$table_user ." u |
285 | 285 | ON (u.id=track.login_user_id) |
@@ -287,26 +287,26 @@ discard block |
||
287 | 287 | login_date >= '".$current_date."' |
288 | 288 | ORDER BY $column $direction |
289 | 289 | LIMIT $from, $number_of_items"; |
290 | - } |
|
291 | - } |
|
292 | - } |
|
290 | + } |
|
291 | + } |
|
292 | + } |
|
293 | 293 | |
294 | - //This query will show all registered users. Only for dev purposes. |
|
295 | - /*$query = "SELECT DISTINCT u.id as login_user_id, login_date FROM ".$track_online_table ." e , $table_user u |
|
294 | + //This query will show all registered users. Only for dev purposes. |
|
295 | + /*$query = "SELECT DISTINCT u.id as login_user_id, login_date FROM ".$track_online_table ." e , $table_user u |
|
296 | 296 | GROUP by u.id |
297 | 297 | ORDER BY $column $direction |
298 | 298 | LIMIT $from, $number_of_items";*/ |
299 | 299 | |
300 | - $result = Database::query($query); |
|
301 | - if ($result) { |
|
302 | - $users_online = array(); |
|
303 | - while (list($login_user_id, $login_date) = Database::fetch_row($result)) { |
|
300 | + $result = Database::query($query); |
|
301 | + if ($result) { |
|
302 | + $users_online = array(); |
|
303 | + while (list($login_user_id, $login_date) = Database::fetch_row($result)) { |
|
304 | 304 | $users_online[] = $login_user_id; |
305 | - } |
|
306 | - return $users_online; |
|
307 | - } else { |
|
308 | - return false; |
|
309 | - } |
|
305 | + } |
|
306 | + return $users_online; |
|
307 | + } else { |
|
308 | + return false; |
|
309 | + } |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | function who_is_online_count($time_limit = null, $friends = false) |
@@ -316,15 +316,15 @@ discard block |
||
316 | 316 | } else { |
317 | 317 | $time_limit = intval($time_limit); |
318 | 318 | } |
319 | - $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
320 | - $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
|
321 | - $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
322 | - $online_time = time() - $time_limit * 60; |
|
323 | - $current_date = api_get_utc_datetime($online_time); |
|
324 | - |
|
325 | - if ($friends) { |
|
326 | - // who friends from social network is online |
|
327 | - $query = "SELECT DISTINCT count(login_user_id) as count |
|
319 | + $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
320 | + $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
|
321 | + $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
322 | + $online_time = time() - $time_limit * 60; |
|
323 | + $current_date = api_get_utc_datetime($online_time); |
|
324 | + |
|
325 | + if ($friends) { |
|
326 | + // who friends from social network is online |
|
327 | + $query = "SELECT DISTINCT count(login_user_id) as count |
|
328 | 328 | FROM $track_online_table INNER JOIN $friend_user_table |
329 | 329 | ON (friend_user_id = login_user_id) |
330 | 330 | WHERE |
@@ -332,20 +332,20 @@ discard block |
||
332 | 332 | friend_user_id <> '".api_get_user_id()."' AND |
333 | 333 | relation_type='".USER_RELATION_TYPE_FRIEND."' AND |
334 | 334 | user_id = '".api_get_user_id()."' "; |
335 | - } else { |
|
336 | - // All users online |
|
337 | - $query = "SELECT count(login_id) as count |
|
335 | + } else { |
|
336 | + // All users online |
|
337 | + $query = "SELECT count(login_id) as count |
|
338 | 338 | FROM $track_online_table track INNER JOIN $table_user u |
339 | 339 | ON (u.id=track.login_user_id) |
340 | 340 | WHERE u.status != ".ANONYMOUS." AND login_date >= '$current_date' "; |
341 | - } |
|
342 | - |
|
343 | - if (api_get_multiple_access_url()) { |
|
344 | - $access_url_id = api_get_current_access_url_id(); |
|
345 | - if ($access_url_id != -1) { |
|
346 | - if ($friends) { |
|
347 | - // friends from social network is online |
|
348 | - $query = "SELECT DISTINCT count(login_user_id) as count |
|
341 | + } |
|
342 | + |
|
343 | + if (api_get_multiple_access_url()) { |
|
344 | + $access_url_id = api_get_current_access_url_id(); |
|
345 | + if ($access_url_id != -1) { |
|
346 | + if ($friends) { |
|
347 | + // friends from social network is online |
|
348 | + $query = "SELECT DISTINCT count(login_user_id) as count |
|
349 | 349 | FROM $track_online_table track |
350 | 350 | INNER JOIN $friend_user_table ON (friend_user_id = login_user_id) |
351 | 351 | WHERE |
@@ -353,29 +353,29 @@ discard block |
||
353 | 353 | login_date >= '".$current_date."' AND |
354 | 354 | friend_user_id <> '".api_get_user_id()."' AND |
355 | 355 | relation_type='".USER_RELATION_TYPE_FRIEND."' "; |
356 | - } else { |
|
357 | - // all users online |
|
358 | - $query = "SELECT count(login_id) as count FROM $track_online_table track |
|
356 | + } else { |
|
357 | + // all users online |
|
358 | + $query = "SELECT count(login_id) as count FROM $track_online_table track |
|
359 | 359 | INNER JOIN $table_user u ON (u.id=track.login_user_id) |
360 | 360 | WHERE |
361 | 361 | u.status != ".ANONYMOUS." AND |
362 | 362 | track.access_url_id = $access_url_id AND |
363 | 363 | login_date >= '$current_date' "; |
364 | - } |
|
365 | - } |
|
366 | - } |
|
364 | + } |
|
365 | + } |
|
366 | + } |
|
367 | 367 | |
368 | 368 | // Dev purposes show all users online |
369 | 369 | /*$table_user = Database::get_main_table(TABLE_MAIN_USER); |
370 | 370 | $query = "SELECT count(*) as count FROM ".$table_user;*/ |
371 | 371 | |
372 | - $result = Database::query($query); |
|
373 | - if (Database::num_rows($result) > 0) { |
|
374 | - $row = Database::fetch_array($result); |
|
375 | - return $row['count']; |
|
376 | - } else { |
|
377 | - return false; |
|
378 | - } |
|
372 | + $result = Database::query($query); |
|
373 | + if (Database::num_rows($result) > 0) { |
|
374 | + $row = Database::fetch_array($result); |
|
375 | + return $row['count']; |
|
376 | + } else { |
|
377 | + return false; |
|
378 | + } |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | */ |
389 | 389 | function who_is_online_in_this_course($from, $number_of_items, $uid, $time_limit, $course_code) |
390 | 390 | { |
391 | - if (empty($course_code)) return false; |
|
391 | + if (empty($course_code)) return false; |
|
392 | 392 | |
393 | 393 | if (empty($time_limit)) { |
394 | 394 | $time_limit = api_get_setting('time_limit_whosonline'); |
@@ -401,55 +401,55 @@ discard block |
||
401 | 401 | $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
402 | 402 | $course_code = Database::escape_string($course_code); |
403 | 403 | $courseInfo = api_get_course_info($course_code); |
404 | - $courseId = $courseInfo['real_id']; |
|
404 | + $courseId = $courseInfo['real_id']; |
|
405 | 405 | |
406 | 406 | $from = intval($from); |
407 | 407 | $number_of_items = intval($number_of_items); |
408 | 408 | |
409 | - $query = "SELECT login_user_id, login_date FROM $track_online_table |
|
409 | + $query = "SELECT login_user_id, login_date FROM $track_online_table |
|
410 | 410 | WHERE login_user_id <> 2 AND c_id = $courseId AND login_date >= '$current_date' |
411 | 411 | LIMIT $from, $number_of_items "; |
412 | 412 | |
413 | - $result = Database::query($query); |
|
414 | - if ($result) { |
|
415 | - $users_online = array(); |
|
413 | + $result = Database::query($query); |
|
414 | + if ($result) { |
|
415 | + $users_online = array(); |
|
416 | 416 | |
417 | - while(list($login_user_id, $login_date) = Database::fetch_row($result)) { |
|
417 | + while(list($login_user_id, $login_date) = Database::fetch_row($result)) { |
|
418 | 418 | $users_online[] = $login_user_id; |
419 | - } |
|
420 | - return $users_online; |
|
421 | - } else { |
|
422 | - return false; |
|
423 | - } |
|
419 | + } |
|
420 | + return $users_online; |
|
421 | + } else { |
|
422 | + return false; |
|
423 | + } |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | function who_is_online_in_this_course_count($uid, $time_limit, $coursecode=null) |
427 | 427 | { |
428 | - if (empty($coursecode)) { |
|
429 | - return false; |
|
430 | - } |
|
431 | - $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
432 | - $coursecode = Database::escape_string($coursecode); |
|
433 | - $time_limit = Database::escape_string($time_limit); |
|
428 | + if (empty($coursecode)) { |
|
429 | + return false; |
|
430 | + } |
|
431 | + $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
432 | + $coursecode = Database::escape_string($coursecode); |
|
433 | + $time_limit = Database::escape_string($time_limit); |
|
434 | 434 | |
435 | 435 | $online_time = time() - $time_limit * 60; |
436 | 436 | $current_date = api_get_utc_datetime($online_time); |
437 | - $courseId = api_get_course_int_id($coursecode); |
|
437 | + $courseId = api_get_course_int_id($coursecode); |
|
438 | 438 | |
439 | - if (empty($courseId)) { |
|
440 | - return false; |
|
441 | - } |
|
439 | + if (empty($courseId)) { |
|
440 | + return false; |
|
441 | + } |
|
442 | 442 | |
443 | - $query = "SELECT count(login_user_id) as count |
|
443 | + $query = "SELECT count(login_user_id) as count |
|
444 | 444 | FROM $track_online_table |
445 | 445 | WHERE login_user_id <> 2 AND c_id = $courseId AND login_date >= '$current_date' "; |
446 | - $result = Database::query($query); |
|
447 | - if (Database::num_rows($result) > 0) { |
|
448 | - $row = Database::fetch_array($result); |
|
449 | - return $row['count']; |
|
450 | - } else { |
|
451 | - return false; |
|
452 | - } |
|
446 | + $result = Database::query($query); |
|
447 | + if (Database::num_rows($result) > 0) { |
|
448 | + $row = Database::fetch_array($result); |
|
449 | + return $row['count']; |
|
450 | + } else { |
|
451 | + return false; |
|
452 | + } |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | /** |
@@ -459,15 +459,15 @@ discard block |
||
459 | 459 | * @deprecated user api_get_user_info($user_id) |
460 | 460 | */ |
461 | 461 | function GetFullUserName($uid) { |
462 | - $uid = (int) $uid; |
|
463 | - $uid = intval($uid); |
|
464 | - $user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
465 | - $query = "SELECT firstname, lastname FROM ".$user_table." WHERE id=$uid"; |
|
466 | - $result = @Database::query($query); |
|
467 | - if (count($result)>0) { |
|
468 | - while(list($firstname,$lastname)= Database::fetch_array($result)) { |
|
469 | - $str = str_replace(' ', ' ', api_get_person_name($firstname, $lastname)); |
|
470 | - return $str; |
|
471 | - } |
|
472 | - } |
|
462 | + $uid = (int) $uid; |
|
463 | + $uid = intval($uid); |
|
464 | + $user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
465 | + $query = "SELECT firstname, lastname FROM ".$user_table." WHERE id=$uid"; |
|
466 | + $result = @Database::query($query); |
|
467 | + if (count($result)>0) { |
|
468 | + while(list($firstname,$lastname)= Database::fetch_array($result)) { |
|
469 | + $str = str_replace(' ', ' ', api_get_person_name($firstname, $lastname)); |
|
470 | + return $str; |
|
471 | + } |
|
472 | + } |
|
473 | 473 | } |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | if (isset($_configuration['language_measure_frequency']) && |
96 | 96 | $_configuration['language_measure_frequency'] == 1 |
97 | 97 | ) { |
98 | - require_once api_get_path(SYS_CODE_PATH).'/cron/lang/langstats.class.php'; |
|
99 | - global $langstats; |
|
100 | - $langstats->add_use($variable,''); |
|
98 | + require_once api_get_path(SYS_CODE_PATH).'/cron/lang/langstats.class.php'; |
|
99 | + global $langstats; |
|
100 | + $langstats->add_use($variable,''); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | if (!isset($used_lang_vars)) { |
104 | - $used_lang_vars = array(); |
|
104 | + $used_lang_vars = array(); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | // Caching results from some API functions, for speed. |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | static $text_direction = array(); |
292 | 292 | |
293 | 293 | if (empty($language)) { |
294 | - $language = api_get_interface_language(); |
|
294 | + $language = api_get_interface_language(); |
|
295 | 295 | } |
296 | 296 | if (!isset($text_direction[$language])) { |
297 | 297 | $text_direction[$language] = in_array(api_purify_language_id($language), |
@@ -528,24 +528,24 @@ discard block |
||
528 | 528 | case DATE_FORMAT_ONLY_DAYNAME: |
529 | 529 | $date_format = get_lang('dateFormatOnlyDayName', '', $language); |
530 | 530 | if (INTL_INSTALLED) { |
531 | - $datetype = IntlDateFormatter::SHORT; |
|
532 | - $timetype = IntlDateFormatter::NONE; |
|
533 | - } |
|
531 | + $datetype = IntlDateFormatter::SHORT; |
|
532 | + $timetype = IntlDateFormatter::NONE; |
|
533 | + } |
|
534 | 534 | break; |
535 | 535 | case DATE_FORMAT_NUMBER_NO_YEAR: |
536 | 536 | $date_format = get_lang('dateFormatShortNumberNoYear', '', $language); |
537 | - if (INTL_INSTALLED) { |
|
538 | - $datetype = IntlDateFormatter::SHORT; |
|
539 | - $timetype = IntlDateFormatter::NONE; |
|
540 | - } |
|
537 | + if (INTL_INSTALLED) { |
|
538 | + $datetype = IntlDateFormatter::SHORT; |
|
539 | + $timetype = IntlDateFormatter::NONE; |
|
540 | + } |
|
541 | + break; |
|
542 | + case DATE_FORMAT_NUMBER: |
|
543 | + $date_format = get_lang('dateFormatShortNumber', '', $language); |
|
544 | + if (INTL_INSTALLED) { |
|
545 | + $datetype = IntlDateFormatter::SHORT; |
|
546 | + $timetype = IntlDateFormatter::NONE; |
|
547 | + } |
|
541 | 548 | break; |
542 | - case DATE_FORMAT_NUMBER: |
|
543 | - $date_format = get_lang('dateFormatShortNumber', '', $language); |
|
544 | - if (INTL_INSTALLED) { |
|
545 | - $datetype = IntlDateFormatter::SHORT; |
|
546 | - $timetype = IntlDateFormatter::NONE; |
|
547 | - } |
|
548 | - break; |
|
549 | 549 | case TIME_NO_SEC_FORMAT: |
550 | 550 | $date_format = get_lang('timeNoSecFormat', '', $language); |
551 | 551 | if (INTL_INSTALLED) { |
@@ -581,14 +581,14 @@ discard block |
||
581 | 581 | $timetype = IntlDateFormatter::SHORT; |
582 | 582 | } |
583 | 583 | break; |
584 | - case DATE_TIME_FORMAT_SHORT: |
|
584 | + case DATE_TIME_FORMAT_SHORT: |
|
585 | 585 | $date_format = get_lang('dateTimeFormatShort', '', $language); |
586 | 586 | if (INTL_INSTALLED) { |
587 | 587 | $datetype = IntlDateFormatter::FULL; |
588 | 588 | $timetype = IntlDateFormatter::SHORT; |
589 | 589 | } |
590 | 590 | break; |
591 | - case DATE_TIME_FORMAT_SHORT_TIME_FIRST: |
|
591 | + case DATE_TIME_FORMAT_SHORT_TIME_FIRST: |
|
592 | 592 | $date_format = get_lang('dateTimeFormatShortTimeFirst', '', $language); |
593 | 593 | if (INTL_INSTALLED) { |
594 | 594 | $datetype = IntlDateFormatter::FULL; |
@@ -1700,7 +1700,6 @@ discard block |
||
1700 | 1700 | |
1701 | 1701 | /** |
1702 | 1702 | * Return true a date is valid |
1703 | - |
|
1704 | 1703 | * @param string $date example: 2014-06-30 13:05:05 |
1705 | 1704 | * @param string $format example: "Y-m-d H:i:s" |
1706 | 1705 | * |
@@ -1969,15 +1968,15 @@ discard block |
||
1969 | 1968 | function apiGetHumanDateTime($date, $showTime = true, $humanForm = false) { |
1970 | 1969 | if ($showTime) { |
1971 | 1970 | if ($humanForm) { |
1972 | - return $date->format('j M Y H:i:s'); |
|
1971 | + return $date->format('j M Y H:i:s'); |
|
1973 | 1972 | } else { |
1974 | - return $date->format('Y-m-d H:i:s'); |
|
1973 | + return $date->format('Y-m-d H:i:s'); |
|
1975 | 1974 | } |
1976 | 1975 | } else { |
1977 | 1976 | if ($humanForm) { |
1978 | - return $date->format('j M Y'); |
|
1977 | + return $date->format('j M Y'); |
|
1979 | 1978 | } else { |
1980 | - return $date->format('Y-m-d'); |
|
1979 | + return $date->format('Y-m-d'); |
|
1981 | 1980 | } |
1982 | 1981 | } |
1983 | 1982 | } |