@@ -14,6 +14,9 @@ |
||
14 | 14 | class Session implements \ArrayAccess |
15 | 15 | { |
16 | 16 | |
17 | + /** |
|
18 | + * @param string $variable |
|
19 | + */ |
|
17 | 20 | static function read($variable, $default = null) |
18 | 21 | { |
19 | 22 | return isset($_SESSION[$variable]) ? $_SESSION[$variable] : $default; |
@@ -31,6 +31,10 @@ |
||
31 | 31 | return $method == 'GET'; |
32 | 32 | } |
33 | 33 | |
34 | + /** |
|
35 | + * @param string $key |
|
36 | + * @param string $default |
|
37 | + */ |
|
34 | 38 | public static function post($key, $default = null) |
35 | 39 | { |
36 | 40 | return isset($_POST[$key]) ? $_POST[$key] : $default; |
@@ -15,7 +15,7 @@ |
||
15 | 15 | return isset($_REQUEST[$key]) ? $_REQUEST[$key] : $default; |
16 | 16 | } |
17 | 17 | |
18 | - public static function has($key){ |
|
18 | + public static function has($key) { |
|
19 | 19 | return isset($_REQUEST[$key]); |
20 | 20 | } |
21 | 21 |
@@ -16,7 +16,6 @@ |
||
16 | 16 | * @author Patrick Cool |
17 | 17 | * @author René Haentjens, added CSV file import (October 2004) |
18 | 18 | * @package chamilo.link |
19 | - |
|
20 | 19 | */ |
21 | 20 | |
22 | 21 | // Including libraries |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * @param int Whether the announcement should be visible to anonymous users (1) or not (0) |
307 | 307 | * @param string The language for which the announvement should be shown. Leave null for all langages |
308 | 308 | * @param int Whether to send an e-mail to all users (1) or not (0) |
309 | - * @return mixed insert_id on success, false on failure |
|
309 | + * @return false|string insert_id on success, false on failure |
|
310 | 310 | */ |
311 | 311 | public static function add_announcement( |
312 | 312 | $title, |
@@ -648,6 +648,8 @@ discard block |
||
648 | 648 | * @param int Whether to send to all teachers (1) or not (0) |
649 | 649 | * @param int Whether to send to all students (1) or not (0) |
650 | 650 | * @param string Language (optional, considered for all languages if left empty) |
651 | + * @param integer|null $teacher |
|
652 | + * @param integer|null $student |
|
651 | 653 | * @return bool True if the message was sent or there was no destination matching. False on database or e-mail sending error. |
652 | 654 | */ |
653 | 655 | public static function send_system_announcement_by_email($title, $content, $teacher, $student, $language = null, $sendEmailTest = false) |
@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS); |
23 | 23 | $userGroup = new UserGroup(); |
24 | 24 | |
25 | - $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0); |
|
25 | + $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(), 0); |
|
26 | 26 | $groups = array(); |
27 | 27 | foreach ($temp_user_groups as $user_group) { |
28 | 28 | $groups = array_merge($groups, array($user_group['id'])); |
29 | 29 | $groups = array_merge($groups, $userGroup->get_parent_groups($user_group['id'])); |
30 | 30 | } |
31 | 31 | |
32 | - $groups_string = '('.implode($groups,',').')'; |
|
32 | + $groups_string = '('.implode($groups, ',').')'; |
|
33 | 33 | $now = api_get_utc_datetime(); |
34 | 34 | $sql = "SELECT *, DATE_FORMAT(date_start,'%d-%m-%Y %h:%i:%s') AS display_date |
35 | 35 | FROM $db_table |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | * @param string $user_id |
105 | 105 | * @return string |
106 | 106 | */ |
107 | - public static function display_all_announcements($visible, $id = -1, $start = 0,$user_id='') |
|
107 | + public static function display_all_announcements($visible, $id = -1, $start = 0, $user_id = '') |
|
108 | 108 | { |
109 | 109 | $user_selected_language = api_get_interface_language(); |
110 | - $start = intval($start); |
|
110 | + $start = intval($start); |
|
111 | 111 | $userGroup = new UserGroup(); |
112 | 112 | $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS); |
113 | - $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0); |
|
113 | + $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(), 0); |
|
114 | 114 | $groups = array(); |
115 | 115 | foreach ($temp_user_groups as $user_group) { |
116 | 116 | $groups = array_merge($groups, array($user_group['id'])); |
@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | // Checks if tables exists to not break platform not updated |
121 | - $groups_string = '('.implode($groups,',').')'; |
|
121 | + $groups_string = '('.implode($groups, ',').')'; |
|
122 | 122 | |
123 | 123 | $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
124 | - $now = api_get_utc_datetime(); |
|
124 | + $now = api_get_utc_datetime(); |
|
125 | 125 | |
126 | 126 | $sql = "SELECT * FROM ".$db_table." |
127 | 127 | WHERE |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | $sql .= " AND access_url_id IN ('1', '$current_access_url_id')"; |
153 | 153 | } |
154 | 154 | |
155 | - if(!isset($_GET['start']) || $_GET['start'] == 0) { |
|
155 | + if (!isset($_GET['start']) || $_GET['start'] == 0) { |
|
156 | 156 | $sql .= " ORDER BY date_start DESC LIMIT ".$start.",20"; |
157 | 157 | } else { |
158 | - $sql .= " ORDER BY date_start DESC LIMIT ".($start+1).",20"; |
|
158 | + $sql .= " ORDER BY date_start DESC LIMIT ".($start + 1).",20"; |
|
159 | 159 | } |
160 | 160 | $announcements = Database::query($sql); |
161 | 161 | $content = ''; |
@@ -207,13 +207,13 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public static function display_arrow($user_id) |
209 | 209 | { |
210 | - $start = (int)$_GET['start']; |
|
211 | - $nb_announcement = SystemAnnouncementManager :: count_nb_announcement($start,$user_id); |
|
212 | - $next = ((int)$_GET['start']+19); |
|
213 | - $prev = ((int)$_GET['start']-19); |
|
210 | + $start = (int) $_GET['start']; |
|
211 | + $nb_announcement = SystemAnnouncementManager :: count_nb_announcement($start, $user_id); |
|
212 | + $next = ((int) $_GET['start'] + 19); |
|
213 | + $prev = ((int) $_GET['start'] - 19); |
|
214 | 214 | $content = ''; |
215 | - if(!isset($_GET['start']) || $_GET['start'] == 0) { |
|
216 | - if($nb_announcement > 20) { |
|
215 | + if (!isset($_GET['start']) || $_GET['start'] == 0) { |
|
216 | + if ($nb_announcement > 20) { |
|
217 | 217 | $content .= '<a href="news_list.php?start='.$next.'">'.get_lang('NextBis').' >> </a>'; |
218 | 218 | } |
219 | 219 | } else { |
@@ -322,15 +322,15 @@ discard block |
||
322 | 322 | $sendEmailTest = false |
323 | 323 | ) { |
324 | 324 | $original_content = $content; |
325 | - $a_dateS = explode(' ',$date_start); |
|
326 | - $a_arraySD = explode('-',$a_dateS[0]); |
|
327 | - $a_arraySH = explode(':',$a_dateS[1]); |
|
328 | - $date_start_to_compare = array_merge($a_arraySD,$a_arraySH); |
|
325 | + $a_dateS = explode(' ', $date_start); |
|
326 | + $a_arraySD = explode('-', $a_dateS[0]); |
|
327 | + $a_arraySH = explode(':', $a_dateS[1]); |
|
328 | + $date_start_to_compare = array_merge($a_arraySD, $a_arraySH); |
|
329 | 329 | |
330 | - $a_dateE = explode(' ',$date_end); |
|
331 | - $a_arrayED = explode('-',$a_dateE[0]); |
|
332 | - $a_arrayEH = explode(':',$a_dateE[1]); |
|
333 | - $date_end_to_compare = array_merge($a_arrayED,$a_arrayEH); |
|
330 | + $a_dateE = explode(' ', $date_end); |
|
331 | + $a_arrayED = explode('-', $a_dateE[0]); |
|
332 | + $a_arrayEH = explode(':', $a_dateE[1]); |
|
333 | + $date_end_to_compare = array_merge($a_arrayED, $a_arrayEH); |
|
334 | 334 | |
335 | 335 | $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
336 | 336 | |
@@ -504,15 +504,15 @@ discard block |
||
504 | 504 | $send_mail = 0, |
505 | 505 | $sendEmailTest = false |
506 | 506 | ) { |
507 | - $a_dateS = explode(' ',$date_start); |
|
508 | - $a_arraySD = explode('-',$a_dateS[0]); |
|
509 | - $a_arraySH = explode(':',$a_dateS[1]); |
|
510 | - $date_start_to_compare = array_merge($a_arraySD,$a_arraySH); |
|
507 | + $a_dateS = explode(' ', $date_start); |
|
508 | + $a_arraySD = explode('-', $a_dateS[0]); |
|
509 | + $a_arraySH = explode(':', $a_dateS[1]); |
|
510 | + $date_start_to_compare = array_merge($a_arraySD, $a_arraySH); |
|
511 | 511 | |
512 | - $a_dateE = explode(' ',$date_end); |
|
513 | - $a_arrayED = explode('-',$a_dateE[0]); |
|
514 | - $a_arrayEH = explode(':',$a_dateE[1]); |
|
515 | - $date_end_to_compare = array_merge($a_arrayED,$a_arrayEH); |
|
512 | + $a_dateE = explode(' ', $date_end); |
|
513 | + $a_arrayED = explode('-', $a_dateE[0]); |
|
514 | + $a_arrayEH = explode(':', $a_dateE[1]); |
|
515 | + $date_end_to_compare = array_merge($a_arrayED, $a_arrayEH); |
|
516 | 516 | |
517 | 517 | $langsql = is_null($lang) ? 'NULL' : "'".Database::escape_string($lang)."'"; |
518 | 518 | $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
@@ -536,8 +536,8 @@ discard block |
||
536 | 536 | return false; |
537 | 537 | } |
538 | 538 | |
539 | - $start = api_get_utc_datetime($date_start); |
|
540 | - $end = api_get_utc_datetime($date_end); |
|
539 | + $start = api_get_utc_datetime($date_start); |
|
540 | + $end = api_get_utc_datetime($date_end); |
|
541 | 541 | |
542 | 542 | $title = Database::escape_string($title); |
543 | 543 | $content = Database::escape_string($content); |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | $sendEmailTest |
561 | 561 | ); |
562 | 562 | } else { |
563 | - if ($send_mail==1) { |
|
563 | + if ($send_mail == 1) { |
|
564 | 564 | SystemAnnouncementManager::send_system_announcement_by_email( |
565 | 565 | $title, |
566 | 566 | $content, |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | global $charset; |
656 | 656 | |
657 | 657 | $title = api_html_entity_decode(stripslashes($title), ENT_QUOTES, $charset); |
658 | - $content = api_html_entity_decode(stripslashes(str_replace(array('\r\n', '\n', '\r'),'', $content)), ENT_QUOTES, $charset); |
|
658 | + $content = api_html_entity_decode(stripslashes(str_replace(array('\r\n', '\n', '\r'), '', $content)), ENT_QUOTES, $charset); |
|
659 | 659 | $now = api_get_utc_datetime(); |
660 | 660 | |
661 | 661 | if ($sendEmailTest) { |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '5' "; |
679 | 679 | } |
680 | 680 | |
681 | - if ($teacher<> 0 AND $student <> 0) { |
|
681 | + if ($teacher <> 0 AND $student <> 0) { |
|
682 | 682 | $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE 1 = 1 "; |
683 | 683 | } |
684 | 684 | |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | // Expiration date |
697 | 697 | $sql .= " AND (expiration_date = '' OR expiration_date IS NULL OR expiration_date > '$now') "; |
698 | 698 | |
699 | - if ((empty($teacher) or $teacher == '0') AND (empty($student) or $student == '0')) { |
|
699 | + if ((empty($teacher) or $teacher == '0') AND (empty($student) or $student == '0')) { |
|
700 | 700 | return true; |
701 | 701 | } |
702 | 702 | |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | |
708 | 708 | $message_sent = false; |
709 | 709 | |
710 | - while ($row = Database::fetch_array($result,'ASSOC')) { |
|
710 | + while ($row = Database::fetch_array($result, 'ASSOC')) { |
|
711 | 711 | MessageManager::send_message_simple($row['user_id'], $title, $content); |
712 | 712 | $message_sent = true; |
713 | 713 | } |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | $cut_size = 500; |
728 | 728 | $now = api_get_utc_datetime(); |
729 | 729 | |
730 | - $sql = "SELECT * FROM " . $table . " |
|
730 | + $sql = "SELECT * FROM ".$table." |
|
731 | 731 | WHERE |
732 | 732 | (lang = '$user_selected_language' OR lang = '') AND |
733 | 733 | ('$now' >= date_start AND '$now' <= date_end) "; |
@@ -10,17 +10,17 @@ discard block |
||
10 | 10 | CONST VISIBLE_STUDENT = 2; |
11 | 11 | CONST VISIBLE_TEACHER = 3; |
12 | 12 | |
13 | - /** |
|
14 | - * Displays all announcements |
|
15 | - * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER |
|
16 | - * @param int $id The identifier of the announcement to display |
|
17 | - */ |
|
18 | - public static function display_announcements($visible, $id = -1) |
|
13 | + /** |
|
14 | + * Displays all announcements |
|
15 | + * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER |
|
16 | + * @param int $id The identifier of the announcement to display |
|
17 | + */ |
|
18 | + public static function display_announcements($visible, $id = -1) |
|
19 | 19 | { |
20 | - $user_selected_language = api_get_interface_language(); |
|
21 | - $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
20 | + $user_selected_language = api_get_interface_language(); |
|
21 | + $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
22 | 22 | $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS); |
23 | - $userGroup = new UserGroup(); |
|
23 | + $userGroup = new UserGroup(); |
|
24 | 24 | |
25 | 25 | $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0); |
26 | 26 | $groups = array(); |
@@ -55,47 +55,47 @@ discard block |
||
55 | 55 | WHERE group_id in $groups_string |
56 | 56 | ) "; |
57 | 57 | } |
58 | - $current_access_url_id = 1; |
|
59 | - if (api_is_multiple_url_enabled()) { |
|
60 | - $current_access_url_id = api_get_current_access_url_id(); |
|
61 | - } |
|
62 | - $sql .= " AND access_url_id = '$current_access_url_id' "; |
|
63 | - $sql .= " ORDER BY date_start DESC LIMIT 0,7"; |
|
64 | - |
|
65 | - $announcements = Database::query($sql); |
|
66 | - if (Database::num_rows($announcements) > 0) { |
|
67 | - $query_string = ereg_replace('announcement=[1-9]+', '', $_SERVER['QUERY_STRING']); |
|
68 | - $query_string = ereg_replace('&$', '', $query_string); |
|
69 | - $url = api_get_self(); |
|
70 | - echo '<div class="system_announcements">'; |
|
71 | - echo '<h3>'.get_lang('SystemAnnouncements').'</h3>'; |
|
72 | - echo '<div style="margin:10px;text-align:right;"><a href="news_list.php">'.get_lang('More').'</a></div>'; |
|
73 | - |
|
74 | - while ($announcement = Database::fetch_object($announcements)) { |
|
75 | - if ($id != $announcement->id) { |
|
76 | - if (strlen($query_string) > 0) { |
|
77 | - $show_url = 'news_list.php#'.$announcement->id; |
|
78 | - } else { |
|
79 | - $show_url = 'news_list.php#'.$announcement->id; |
|
80 | - } |
|
81 | - $display_date = api_convert_and_format_date($announcement->display_date, DATE_FORMAT_LONG); |
|
82 | - echo '<a name="'.$announcement->id.'"></a> |
|
58 | + $current_access_url_id = 1; |
|
59 | + if (api_is_multiple_url_enabled()) { |
|
60 | + $current_access_url_id = api_get_current_access_url_id(); |
|
61 | + } |
|
62 | + $sql .= " AND access_url_id = '$current_access_url_id' "; |
|
63 | + $sql .= " ORDER BY date_start DESC LIMIT 0,7"; |
|
64 | + |
|
65 | + $announcements = Database::query($sql); |
|
66 | + if (Database::num_rows($announcements) > 0) { |
|
67 | + $query_string = ereg_replace('announcement=[1-9]+', '', $_SERVER['QUERY_STRING']); |
|
68 | + $query_string = ereg_replace('&$', '', $query_string); |
|
69 | + $url = api_get_self(); |
|
70 | + echo '<div class="system_announcements">'; |
|
71 | + echo '<h3>'.get_lang('SystemAnnouncements').'</h3>'; |
|
72 | + echo '<div style="margin:10px;text-align:right;"><a href="news_list.php">'.get_lang('More').'</a></div>'; |
|
73 | + |
|
74 | + while ($announcement = Database::fetch_object($announcements)) { |
|
75 | + if ($id != $announcement->id) { |
|
76 | + if (strlen($query_string) > 0) { |
|
77 | + $show_url = 'news_list.php#'.$announcement->id; |
|
78 | + } else { |
|
79 | + $show_url = 'news_list.php#'.$announcement->id; |
|
80 | + } |
|
81 | + $display_date = api_convert_and_format_date($announcement->display_date, DATE_FORMAT_LONG); |
|
82 | + echo '<a name="'.$announcement->id.'"></a> |
|
83 | 83 | <div class="system_announcement"> |
84 | 84 | <div class="system_announcement_title"><a name="ann'.$announcement->id.'" href="'.$show_url.'">'.$announcement->title.'</a></div><div class="system_announcement_date">'.$display_date.'</div> |
85 | 85 | </div>'; |
86 | - } else { |
|
87 | - echo '<div class="system_announcement"> |
|
86 | + } else { |
|
87 | + echo '<div class="system_announcement"> |
|
88 | 88 | <div class="system_announcement_title">' |
89 | - .$announcement->display_date.' |
|
89 | + .$announcement->display_date.' |
|
90 | 90 | <a name="ann'.$announcement->id.'" href="'.$url.'?'.$query_string.'#ann'.$announcement->id.'">'.$announcement->title.'</a> |
91 | 91 | </div>'; |
92 | - } |
|
93 | - echo '<br />'; |
|
94 | - } |
|
95 | - echo '</div>'; |
|
96 | - } |
|
97 | - return; |
|
98 | - } |
|
92 | + } |
|
93 | + echo '<br />'; |
|
94 | + } |
|
95 | + echo '</div>'; |
|
96 | + } |
|
97 | + return; |
|
98 | + } |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * @param $visible |
@@ -106,100 +106,100 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public static function display_all_announcements($visible, $id = -1, $start = 0,$user_id='') |
108 | 108 | { |
109 | - $user_selected_language = api_get_interface_language(); |
|
110 | - $start = intval($start); |
|
109 | + $user_selected_language = api_get_interface_language(); |
|
110 | + $start = intval($start); |
|
111 | 111 | $userGroup = new UserGroup(); |
112 | - $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS); |
|
113 | - $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0); |
|
112 | + $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS); |
|
113 | + $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0); |
|
114 | 114 | $groups = array(); |
115 | - foreach ($temp_user_groups as $user_group) { |
|
116 | - $groups = array_merge($groups, array($user_group['id'])); |
|
117 | - $groups = array_merge($groups, $userGroup->get_parent_groups($user_group['id'])); |
|
118 | - } |
|
115 | + foreach ($temp_user_groups as $user_group) { |
|
116 | + $groups = array_merge($groups, array($user_group['id'])); |
|
117 | + $groups = array_merge($groups, $userGroup->get_parent_groups($user_group['id'])); |
|
118 | + } |
|
119 | 119 | |
120 | - // Checks if tables exists to not break platform not updated |
|
121 | - $groups_string = '('.implode($groups,',').')'; |
|
120 | + // Checks if tables exists to not break platform not updated |
|
121 | + $groups_string = '('.implode($groups,',').')'; |
|
122 | 122 | |
123 | - $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
124 | - $now = api_get_utc_datetime(); |
|
123 | + $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
124 | + $now = api_get_utc_datetime(); |
|
125 | 125 | |
126 | - $sql = "SELECT * FROM ".$db_table." |
|
126 | + $sql = "SELECT * FROM ".$db_table." |
|
127 | 127 | WHERE |
128 | 128 | (lang = '$user_selected_language' OR lang IS NULL) AND |
129 | 129 | ( '$now' >= date_start AND '$now' <= date_end) "; |
130 | 130 | |
131 | - switch ($visible) { |
|
132 | - case self::VISIBLE_GUEST : |
|
133 | - $sql .= " AND visible_guest = 1 "; |
|
134 | - break; |
|
135 | - case self::VISIBLE_STUDENT : |
|
136 | - $sql .= " AND visible_student = 1 "; |
|
137 | - break; |
|
138 | - case self::VISIBLE_TEACHER : |
|
139 | - $sql .= " AND visible_teacher = 1 "; |
|
140 | - break; |
|
141 | - } |
|
142 | - |
|
143 | - if (count($groups) > 0) { |
|
131 | + switch ($visible) { |
|
132 | + case self::VISIBLE_GUEST : |
|
133 | + $sql .= " AND visible_guest = 1 "; |
|
134 | + break; |
|
135 | + case self::VISIBLE_STUDENT : |
|
136 | + $sql .= " AND visible_student = 1 "; |
|
137 | + break; |
|
138 | + case self::VISIBLE_TEACHER : |
|
139 | + $sql .= " AND visible_teacher = 1 "; |
|
140 | + break; |
|
141 | + } |
|
142 | + |
|
143 | + if (count($groups) > 0) { |
|
144 | 144 | $sql .= " OR id IN ( |
145 | 145 | SELECT announcement_id FROM $tbl_announcement_group |
146 | 146 | WHERE group_id in $groups_string |
147 | 147 | ) "; |
148 | - } |
|
148 | + } |
|
149 | 149 | |
150 | - if (api_is_multiple_url_enabled()) { |
|
151 | - $current_access_url_id = api_get_current_access_url_id(); |
|
150 | + if (api_is_multiple_url_enabled()) { |
|
151 | + $current_access_url_id = api_get_current_access_url_id(); |
|
152 | 152 | $sql .= " AND access_url_id IN ('1', '$current_access_url_id')"; |
153 | - } |
|
154 | - |
|
155 | - if(!isset($_GET['start']) || $_GET['start'] == 0) { |
|
156 | - $sql .= " ORDER BY date_start DESC LIMIT ".$start.",20"; |
|
157 | - } else { |
|
158 | - $sql .= " ORDER BY date_start DESC LIMIT ".($start+1).",20"; |
|
159 | - } |
|
160 | - $announcements = Database::query($sql); |
|
161 | - $content = ''; |
|
162 | - if (Database::num_rows($announcements) > 0) { |
|
163 | - $query_string = ereg_replace('announcement=[1-9]+', '', $_SERVER['QUERY_STRING']); |
|
164 | - $query_string = ereg_replace('&$', '', $query_string); |
|
165 | - $url = api_get_self(); |
|
166 | - $content .= '<div class="system_announcements">'; |
|
167 | - $content .= '<h3>'.get_lang('SystemAnnouncements').'</h3>'; |
|
168 | - $content .= '<table align="center">'; |
|
169 | - $content .= '<tr>'; |
|
170 | - $content .= '<td>'; |
|
171 | - $content .= SystemAnnouncementManager :: display_arrow($user_id); |
|
172 | - $content .= '</td>'; |
|
173 | - $content .= '</tr>'; |
|
174 | - $content .= '</table>'; |
|
175 | - $content .= '<table align="center" border="0" width="900px">'; |
|
176 | - while ($announcement = Database::fetch_object($announcements)) { |
|
177 | - $display_date = api_convert_and_format_date($announcement->display_date, DATE_FORMAT_LONG); |
|
178 | - $content .= '<tr><td>'; |
|
179 | - $content .= '<a name="'.$announcement->id.'"></a> |
|
153 | + } |
|
154 | + |
|
155 | + if(!isset($_GET['start']) || $_GET['start'] == 0) { |
|
156 | + $sql .= " ORDER BY date_start DESC LIMIT ".$start.",20"; |
|
157 | + } else { |
|
158 | + $sql .= " ORDER BY date_start DESC LIMIT ".($start+1).",20"; |
|
159 | + } |
|
160 | + $announcements = Database::query($sql); |
|
161 | + $content = ''; |
|
162 | + if (Database::num_rows($announcements) > 0) { |
|
163 | + $query_string = ereg_replace('announcement=[1-9]+', '', $_SERVER['QUERY_STRING']); |
|
164 | + $query_string = ereg_replace('&$', '', $query_string); |
|
165 | + $url = api_get_self(); |
|
166 | + $content .= '<div class="system_announcements">'; |
|
167 | + $content .= '<h3>'.get_lang('SystemAnnouncements').'</h3>'; |
|
168 | + $content .= '<table align="center">'; |
|
169 | + $content .= '<tr>'; |
|
170 | + $content .= '<td>'; |
|
171 | + $content .= SystemAnnouncementManager :: display_arrow($user_id); |
|
172 | + $content .= '</td>'; |
|
173 | + $content .= '</tr>'; |
|
174 | + $content .= '</table>'; |
|
175 | + $content .= '<table align="center" border="0" width="900px">'; |
|
176 | + while ($announcement = Database::fetch_object($announcements)) { |
|
177 | + $display_date = api_convert_and_format_date($announcement->display_date, DATE_FORMAT_LONG); |
|
178 | + $content .= '<tr><td>'; |
|
179 | + $content .= '<a name="'.$announcement->id.'"></a> |
|
180 | 180 | <div class="system_announcement"> |
181 | 181 | <h2>'.$announcement->title.'</h2><div class="system_announcement_date">'.$display_date.'</div> |
182 | 182 | <br /> |
183 | 183 | <div class="system_announcement_content">' |
184 | - .$announcement->content.' |
|
184 | + .$announcement->content.' |
|
185 | 185 | </div> |
186 | 186 | </div><br />'; |
187 | - $content .= '</tr></td>'; |
|
188 | - } |
|
189 | - $content .= '</table>'; |
|
190 | - |
|
191 | - $content .= '<table align="center">'; |
|
192 | - $content .= '<tr>'; |
|
193 | - $content .= '<td>'; |
|
194 | - $content .= SystemAnnouncementManager :: display_arrow($user_id); |
|
195 | - $content .= '</td>'; |
|
196 | - $content .= '</tr>'; |
|
197 | - $content .= '</table>'; |
|
198 | - $content .= '</div>'; |
|
199 | - } |
|
200 | - |
|
201 | - return $content; |
|
202 | - } |
|
187 | + $content .= '</tr></td>'; |
|
188 | + } |
|
189 | + $content .= '</table>'; |
|
190 | + |
|
191 | + $content .= '<table align="center">'; |
|
192 | + $content .= '<tr>'; |
|
193 | + $content .= '<td>'; |
|
194 | + $content .= SystemAnnouncementManager :: display_arrow($user_id); |
|
195 | + $content .= '</td>'; |
|
196 | + $content .= '</tr>'; |
|
197 | + $content .= '</table>'; |
|
198 | + $content .= '</div>'; |
|
199 | + } |
|
200 | + |
|
201 | + return $content; |
|
202 | + } |
|
203 | 203 | |
204 | 204 | /** |
205 | 205 | * @param int $user_id |
@@ -207,23 +207,23 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public static function display_arrow($user_id) |
209 | 209 | { |
210 | - $start = (int)$_GET['start']; |
|
211 | - $nb_announcement = SystemAnnouncementManager :: count_nb_announcement($start,$user_id); |
|
212 | - $next = ((int)$_GET['start']+19); |
|
213 | - $prev = ((int)$_GET['start']-19); |
|
214 | - $content = ''; |
|
215 | - if(!isset($_GET['start']) || $_GET['start'] == 0) { |
|
216 | - if($nb_announcement > 20) { |
|
217 | - $content .= '<a href="news_list.php?start='.$next.'">'.get_lang('NextBis').' >> </a>'; |
|
218 | - } |
|
219 | - } else { |
|
220 | - echo '<a href="news_list.php?start='.$prev.'"> << '.get_lang('Prev').'</a>'; |
|
221 | - if ($nb_announcement > 20) { |
|
222 | - $content .= '<a href="news_list.php?start='.$next.'">'.get_lang('NextBis').' >> </a>'; |
|
223 | - } |
|
224 | - } |
|
225 | - return $content; |
|
226 | - } |
|
210 | + $start = (int)$_GET['start']; |
|
211 | + $nb_announcement = SystemAnnouncementManager :: count_nb_announcement($start,$user_id); |
|
212 | + $next = ((int)$_GET['start']+19); |
|
213 | + $prev = ((int)$_GET['start']-19); |
|
214 | + $content = ''; |
|
215 | + if(!isset($_GET['start']) || $_GET['start'] == 0) { |
|
216 | + if($nb_announcement > 20) { |
|
217 | + $content .= '<a href="news_list.php?start='.$next.'">'.get_lang('NextBis').' >> </a>'; |
|
218 | + } |
|
219 | + } else { |
|
220 | + echo '<a href="news_list.php?start='.$prev.'"> << '.get_lang('Prev').'</a>'; |
|
221 | + if ($nb_announcement > 20) { |
|
222 | + $content .= '<a href="news_list.php?start='.$next.'">'.get_lang('NextBis').' >> </a>'; |
|
223 | + } |
|
224 | + } |
|
225 | + return $content; |
|
226 | + } |
|
227 | 227 | |
228 | 228 | /** |
229 | 229 | * @param int $start |
@@ -232,82 +232,82 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public static function count_nb_announcement($start = 0, $user_id = '') |
234 | 234 | { |
235 | - $start = intval($start); |
|
236 | - $visibility = api_is_allowed_to_create_course() ? self::VISIBLE_TEACHER : self::VISIBLE_STUDENT; |
|
237 | - $user_selected_language = api_get_interface_language(); |
|
238 | - $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
239 | - $sql = 'SELECT id FROM '.$db_table.' |
|
235 | + $start = intval($start); |
|
236 | + $visibility = api_is_allowed_to_create_course() ? self::VISIBLE_TEACHER : self::VISIBLE_STUDENT; |
|
237 | + $user_selected_language = api_get_interface_language(); |
|
238 | + $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
239 | + $sql = 'SELECT id FROM '.$db_table.' |
|
240 | 240 | WHERE (lang="'.$user_selected_language.'" OR lang IS NULL) '; |
241 | - if (isset($user_id)) { |
|
242 | - switch ($visibility) { |
|
243 | - case self::VISIBLE_GUEST : |
|
244 | - $sql .= " AND visible_guest = 1 "; |
|
245 | - break; |
|
246 | - case self::VISIBLE_STUDENT : |
|
247 | - $sql .= " AND visible_student = 1 "; |
|
248 | - break; |
|
249 | - case self::VISIBLE_TEACHER : |
|
250 | - $sql .= " AND visible_teacher = 1 "; |
|
251 | - break; |
|
252 | - } |
|
253 | - } |
|
254 | - |
|
255 | - $current_access_url_id = 1; |
|
256 | - if (api_is_multiple_url_enabled()) { |
|
257 | - $current_access_url_id = api_get_current_access_url_id(); |
|
258 | - } |
|
259 | - $sql .= " AND access_url_id = '$current_access_url_id' "; |
|
260 | - |
|
261 | - |
|
262 | - $sql .= 'LIMIT '.$start.', 21'; |
|
263 | - $announcements = Database::query($sql); |
|
264 | - $i = 0; |
|
265 | - while ($rows = Database::fetch_array($announcements)) { |
|
266 | - $i++; |
|
267 | - } |
|
268 | - return $i; |
|
269 | - } |
|
270 | - |
|
271 | - /** |
|
272 | - * Get all announcements |
|
273 | - * @return array An array with all available system announcements (as php |
|
274 | - * objects) |
|
275 | - */ |
|
276 | - public static function get_all_announcements() |
|
241 | + if (isset($user_id)) { |
|
242 | + switch ($visibility) { |
|
243 | + case self::VISIBLE_GUEST : |
|
244 | + $sql .= " AND visible_guest = 1 "; |
|
245 | + break; |
|
246 | + case self::VISIBLE_STUDENT : |
|
247 | + $sql .= " AND visible_student = 1 "; |
|
248 | + break; |
|
249 | + case self::VISIBLE_TEACHER : |
|
250 | + $sql .= " AND visible_teacher = 1 "; |
|
251 | + break; |
|
252 | + } |
|
253 | + } |
|
254 | + |
|
255 | + $current_access_url_id = 1; |
|
256 | + if (api_is_multiple_url_enabled()) { |
|
257 | + $current_access_url_id = api_get_current_access_url_id(); |
|
258 | + } |
|
259 | + $sql .= " AND access_url_id = '$current_access_url_id' "; |
|
260 | + |
|
261 | + |
|
262 | + $sql .= 'LIMIT '.$start.', 21'; |
|
263 | + $announcements = Database::query($sql); |
|
264 | + $i = 0; |
|
265 | + while ($rows = Database::fetch_array($announcements)) { |
|
266 | + $i++; |
|
267 | + } |
|
268 | + return $i; |
|
269 | + } |
|
270 | + |
|
271 | + /** |
|
272 | + * Get all announcements |
|
273 | + * @return array An array with all available system announcements (as php |
|
274 | + * objects) |
|
275 | + */ |
|
276 | + public static function get_all_announcements() |
|
277 | 277 | { |
278 | - $table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
279 | - $now = api_get_utc_datetime(); |
|
280 | - $sql = "SELECT *, IF ( '$now' >= date_start AND '$now' <= date_end, '1', '0') AS visible |
|
278 | + $table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
279 | + $now = api_get_utc_datetime(); |
|
280 | + $sql = "SELECT *, IF ( '$now' >= date_start AND '$now' <= date_end, '1', '0') AS visible |
|
281 | 281 | FROM $table"; |
282 | 282 | |
283 | - $current_access_url_id = 1; |
|
284 | - if (api_is_multiple_url_enabled()) { |
|
285 | - $current_access_url_id = api_get_current_access_url_id(); |
|
286 | - } |
|
287 | - $sql .= " WHERE access_url_id = '$current_access_url_id' "; |
|
288 | - $sql .= " ORDER BY date_start ASC"; |
|
289 | - |
|
290 | - $announcements = Database::query($sql); |
|
291 | - $all_announcements = array(); |
|
292 | - while ($announcement = Database::fetch_object($announcements)) { |
|
293 | - $all_announcements[] = $announcement; |
|
294 | - } |
|
295 | - return $all_announcements; |
|
296 | - } |
|
297 | - |
|
298 | - /** |
|
299 | - * Adds an announcement to the database |
|
300 | - * @param string Title of the announcement |
|
301 | - * @param string Content of the announcement |
|
302 | - * @param string Start date (YYYY-MM-DD HH:II: SS) |
|
303 | - * @param string End date (YYYY-MM-DD HH:II: SS) |
|
304 | - * @param int Whether the announcement should be visible to teachers (1) or not (0) |
|
305 | - * @param int Whether the announcement should be visible to students (1) or not (0) |
|
306 | - * @param int Whether the announcement should be visible to anonymous users (1) or not (0) |
|
307 | - * @param string The language for which the announvement should be shown. Leave null for all langages |
|
308 | - * @param int Whether to send an e-mail to all users (1) or not (0) |
|
309 | - * @return mixed insert_id on success, false on failure |
|
310 | - */ |
|
283 | + $current_access_url_id = 1; |
|
284 | + if (api_is_multiple_url_enabled()) { |
|
285 | + $current_access_url_id = api_get_current_access_url_id(); |
|
286 | + } |
|
287 | + $sql .= " WHERE access_url_id = '$current_access_url_id' "; |
|
288 | + $sql .= " ORDER BY date_start ASC"; |
|
289 | + |
|
290 | + $announcements = Database::query($sql); |
|
291 | + $all_announcements = array(); |
|
292 | + while ($announcement = Database::fetch_object($announcements)) { |
|
293 | + $all_announcements[] = $announcement; |
|
294 | + } |
|
295 | + return $all_announcements; |
|
296 | + } |
|
297 | + |
|
298 | + /** |
|
299 | + * Adds an announcement to the database |
|
300 | + * @param string Title of the announcement |
|
301 | + * @param string Content of the announcement |
|
302 | + * @param string Start date (YYYY-MM-DD HH:II: SS) |
|
303 | + * @param string End date (YYYY-MM-DD HH:II: SS) |
|
304 | + * @param int Whether the announcement should be visible to teachers (1) or not (0) |
|
305 | + * @param int Whether the announcement should be visible to students (1) or not (0) |
|
306 | + * @param int Whether the announcement should be visible to anonymous users (1) or not (0) |
|
307 | + * @param string The language for which the announvement should be shown. Leave null for all langages |
|
308 | + * @param int Whether to send an e-mail to all users (1) or not (0) |
|
309 | + * @return mixed insert_id on success, false on failure |
|
310 | + */ |
|
311 | 311 | public static function add_announcement( |
312 | 312 | $title, |
313 | 313 | $content, |
@@ -321,112 +321,112 @@ discard block |
||
321 | 321 | $add_to_calendar = false, |
322 | 322 | $sendEmailTest = false |
323 | 323 | ) { |
324 | - $original_content = $content; |
|
325 | - $a_dateS = explode(' ',$date_start); |
|
326 | - $a_arraySD = explode('-',$a_dateS[0]); |
|
327 | - $a_arraySH = explode(':',$a_dateS[1]); |
|
328 | - $date_start_to_compare = array_merge($a_arraySD,$a_arraySH); |
|
324 | + $original_content = $content; |
|
325 | + $a_dateS = explode(' ',$date_start); |
|
326 | + $a_arraySD = explode('-',$a_dateS[0]); |
|
327 | + $a_arraySH = explode(':',$a_dateS[1]); |
|
328 | + $date_start_to_compare = array_merge($a_arraySD,$a_arraySH); |
|
329 | 329 | |
330 | - $a_dateE = explode(' ',$date_end); |
|
331 | - $a_arrayED = explode('-',$a_dateE[0]); |
|
332 | - $a_arrayEH = explode(':',$a_dateE[1]); |
|
333 | - $date_end_to_compare = array_merge($a_arrayED,$a_arrayEH); |
|
330 | + $a_dateE = explode(' ',$date_end); |
|
331 | + $a_arrayED = explode('-',$a_dateE[0]); |
|
332 | + $a_arrayEH = explode(':',$a_dateE[1]); |
|
333 | + $date_end_to_compare = array_merge($a_arrayED,$a_arrayEH); |
|
334 | 334 | |
335 | - $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
335 | + $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
336 | 336 | |
337 | - if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) { |
|
338 | - Display :: display_normal_message(get_lang('InvalidStartDate')); |
|
339 | - return false; |
|
340 | - } |
|
337 | + if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) { |
|
338 | + Display :: display_normal_message(get_lang('InvalidStartDate')); |
|
339 | + return false; |
|
340 | + } |
|
341 | 341 | |
342 | - if (($date_end_to_compare[1] || |
|
342 | + if (($date_end_to_compare[1] || |
|
343 | 343 | $date_end_to_compare[2] || |
344 | 344 | $date_end_to_compare[0]) && |
345 | 345 | !checkdate($date_end_to_compare[1], $date_end_to_compare[2], $date_end_to_compare[0]) |
346 | 346 | ) { |
347 | - Display :: display_normal_message(get_lang('InvalidEndDate')); |
|
348 | - return false; |
|
349 | - } |
|
350 | - if (strlen(trim($title)) == 0) { |
|
351 | - Display::display_normal_message(get_lang('InvalidTitle')); |
|
352 | - return false; |
|
353 | - } |
|
354 | - |
|
355 | - $start = api_get_utc_datetime($date_start); |
|
347 | + Display :: display_normal_message(get_lang('InvalidEndDate')); |
|
348 | + return false; |
|
349 | + } |
|
350 | + if (strlen(trim($title)) == 0) { |
|
351 | + Display::display_normal_message(get_lang('InvalidTitle')); |
|
352 | + return false; |
|
353 | + } |
|
354 | + |
|
355 | + $start = api_get_utc_datetime($date_start); |
|
356 | 356 | $end = api_get_utc_datetime($date_end); |
357 | 357 | |
358 | - //Fixing urls that are sent by email |
|
359 | - $content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content); |
|
360 | - $content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content); |
|
358 | + //Fixing urls that are sent by email |
|
359 | + $content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content); |
|
360 | + $content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content); |
|
361 | 361 | |
362 | 362 | $lang = is_null($lang) ? '' : $lang; |
363 | 363 | |
364 | - $current_access_url_id = 1; |
|
365 | - if (api_is_multiple_url_enabled()) { |
|
366 | - $current_access_url_id = api_get_current_access_url_id(); |
|
367 | - } |
|
368 | - |
|
369 | - $params = [ |
|
370 | - 'title' => $title, |
|
371 | - 'content' => $content, |
|
372 | - 'date_start' => $start, |
|
373 | - 'date_end' => $end, |
|
374 | - 'visible_teacher' => $visible_teacher, |
|
375 | - 'visible_student' => $visible_student, |
|
376 | - 'visible_guest' => $visible_guest, |
|
377 | - 'lang' => $lang, |
|
378 | - 'access_url_id' => $current_access_url_id, |
|
379 | - ]; |
|
380 | - |
|
381 | - $resultId = Database::insert($db_table, $params); |
|
382 | - |
|
383 | - if ($resultId) { |
|
384 | - |
|
385 | - if ($sendEmailTest) { |
|
386 | - SystemAnnouncementManager::send_system_announcement_by_email( |
|
387 | - $title, |
|
388 | - $content, |
|
389 | - $visible_teacher, |
|
390 | - $visible_student, |
|
391 | - $lang, |
|
392 | - true |
|
393 | - ); |
|
394 | - } else { |
|
395 | - if ($send_mail == 1) { |
|
396 | - SystemAnnouncementManager::send_system_announcement_by_email( |
|
397 | - $title, |
|
398 | - $content, |
|
399 | - $visible_teacher, |
|
400 | - $visible_student, |
|
401 | - $lang |
|
402 | - ); |
|
403 | - } |
|
404 | - } |
|
405 | - |
|
406 | - if ($add_to_calendar) { |
|
407 | - $agenda = new Agenda(); |
|
408 | - $agenda->setType('admin'); |
|
409 | - $agenda->addEvent( |
|
410 | - $date_start, |
|
411 | - $date_end, |
|
412 | - false, |
|
413 | - $title, |
|
414 | - $original_content |
|
415 | - ); |
|
416 | - } |
|
417 | - |
|
418 | - return $resultId; |
|
419 | - |
|
420 | - } |
|
421 | - |
|
422 | - return false; |
|
423 | - } |
|
364 | + $current_access_url_id = 1; |
|
365 | + if (api_is_multiple_url_enabled()) { |
|
366 | + $current_access_url_id = api_get_current_access_url_id(); |
|
367 | + } |
|
368 | + |
|
369 | + $params = [ |
|
370 | + 'title' => $title, |
|
371 | + 'content' => $content, |
|
372 | + 'date_start' => $start, |
|
373 | + 'date_end' => $end, |
|
374 | + 'visible_teacher' => $visible_teacher, |
|
375 | + 'visible_student' => $visible_student, |
|
376 | + 'visible_guest' => $visible_guest, |
|
377 | + 'lang' => $lang, |
|
378 | + 'access_url_id' => $current_access_url_id, |
|
379 | + ]; |
|
380 | + |
|
381 | + $resultId = Database::insert($db_table, $params); |
|
382 | + |
|
383 | + if ($resultId) { |
|
384 | + |
|
385 | + if ($sendEmailTest) { |
|
386 | + SystemAnnouncementManager::send_system_announcement_by_email( |
|
387 | + $title, |
|
388 | + $content, |
|
389 | + $visible_teacher, |
|
390 | + $visible_student, |
|
391 | + $lang, |
|
392 | + true |
|
393 | + ); |
|
394 | + } else { |
|
395 | + if ($send_mail == 1) { |
|
396 | + SystemAnnouncementManager::send_system_announcement_by_email( |
|
397 | + $title, |
|
398 | + $content, |
|
399 | + $visible_teacher, |
|
400 | + $visible_student, |
|
401 | + $lang |
|
402 | + ); |
|
403 | + } |
|
404 | + } |
|
405 | + |
|
406 | + if ($add_to_calendar) { |
|
407 | + $agenda = new Agenda(); |
|
408 | + $agenda->setType('admin'); |
|
409 | + $agenda->addEvent( |
|
410 | + $date_start, |
|
411 | + $date_end, |
|
412 | + false, |
|
413 | + $title, |
|
414 | + $original_content |
|
415 | + ); |
|
416 | + } |
|
417 | + |
|
418 | + return $resultId; |
|
419 | + |
|
420 | + } |
|
421 | + |
|
422 | + return false; |
|
423 | + } |
|
424 | 424 | |
425 | 425 | /** |
426 | - * Makes the announcement id visible only for groups in groups_array |
|
427 | - * @param int announcement id |
|
428 | - * @param array array of group id |
|
429 | - **/ |
|
426 | + * Makes the announcement id visible only for groups in groups_array |
|
427 | + * @param int announcement id |
|
428 | + * @param array array of group id |
|
429 | + **/ |
|
430 | 430 | public static function announcement_for_groups($announcement_id, $group_array) |
431 | 431 | { |
432 | 432 | $tbl_announcement_group = Database:: get_main_table( |
@@ -460,10 +460,10 @@ discard block |
||
460 | 460 | } |
461 | 461 | |
462 | 462 | /** |
463 | - * Gets the groups of this announce |
|
464 | - * @param int announcement id |
|
465 | - * @return array array of group id |
|
466 | - **/ |
|
463 | + * Gets the groups of this announce |
|
464 | + * @param int announcement id |
|
465 | + * @return array array of group id |
|
466 | + **/ |
|
467 | 467 | public static function get_announcement_groups($announcement_id) |
468 | 468 | { |
469 | 469 | $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS); |
@@ -482,15 +482,15 @@ discard block |
||
482 | 482 | return $groups; |
483 | 483 | } |
484 | 484 | |
485 | - /** |
|
486 | - * Updates an announcement to the database |
|
487 | - * @param integer $id : id of the announcement |
|
488 | - * @param string $title : title of the announcement |
|
489 | - * @param string $content : content of the announcement |
|
490 | - * @param array $date_start: start date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute) |
|
491 | - * @param array $date_end : end date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute) |
|
492 | - * @return bool True on success, false on failure |
|
493 | - */ |
|
485 | + /** |
|
486 | + * Updates an announcement to the database |
|
487 | + * @param integer $id : id of the announcement |
|
488 | + * @param string $title : title of the announcement |
|
489 | + * @param string $content : content of the announcement |
|
490 | + * @param array $date_start: start date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute) |
|
491 | + * @param array $date_end : end date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute) |
|
492 | + * @return bool True on success, false on failure |
|
493 | + */ |
|
494 | 494 | public static function update_announcement( |
495 | 495 | $id, |
496 | 496 | $title, |
@@ -506,43 +506,43 @@ discard block |
||
506 | 506 | ) { |
507 | 507 | $em = Database::getManager(); |
508 | 508 | |
509 | - $a_dateS = explode(' ',$date_start); |
|
510 | - $a_arraySD = explode('-',$a_dateS[0]); |
|
511 | - $a_arraySH = explode(':',$a_dateS[1]); |
|
512 | - $date_start_to_compare = array_merge($a_arraySD,$a_arraySH); |
|
509 | + $a_dateS = explode(' ',$date_start); |
|
510 | + $a_arraySD = explode('-',$a_dateS[0]); |
|
511 | + $a_arraySH = explode(':',$a_dateS[1]); |
|
512 | + $date_start_to_compare = array_merge($a_arraySD,$a_arraySH); |
|
513 | 513 | |
514 | - $a_dateE = explode(' ',$date_end); |
|
515 | - $a_arrayED = explode('-',$a_dateE[0]); |
|
516 | - $a_arrayEH = explode(':',$a_dateE[1]); |
|
517 | - $date_end_to_compare = array_merge($a_arrayED,$a_arrayEH); |
|
514 | + $a_dateE = explode(' ',$date_end); |
|
515 | + $a_arrayED = explode('-',$a_dateE[0]); |
|
516 | + $a_arrayEH = explode(':',$a_dateE[1]); |
|
517 | + $date_end_to_compare = array_merge($a_arrayED,$a_arrayEH); |
|
518 | 518 | |
519 | 519 | $lang = is_null($lang) ? '' : $lang; |
520 | 520 | |
521 | - if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) { |
|
522 | - Display :: display_normal_message(get_lang('InvalidStartDate')); |
|
523 | - return false; |
|
524 | - } |
|
521 | + if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) { |
|
522 | + Display :: display_normal_message(get_lang('InvalidStartDate')); |
|
523 | + return false; |
|
524 | + } |
|
525 | 525 | |
526 | - if (($date_end_to_compare[1] || |
|
526 | + if (($date_end_to_compare[1] || |
|
527 | 527 | $date_end_to_compare[2] || |
528 | 528 | $date_end_to_compare[0]) && |
529 | 529 | !checkdate($date_end_to_compare[1], $date_end_to_compare[2], $date_end_to_compare[0]) |
530 | 530 | ) { |
531 | - Display :: display_normal_message(get_lang('InvalidEndDate')); |
|
532 | - return false; |
|
533 | - } |
|
531 | + Display :: display_normal_message(get_lang('InvalidEndDate')); |
|
532 | + return false; |
|
533 | + } |
|
534 | 534 | |
535 | - if (strlen(trim($title)) == 0) { |
|
536 | - Display::display_normal_message(get_lang('InvalidTitle')); |
|
537 | - return false; |
|
538 | - } |
|
535 | + if (strlen(trim($title)) == 0) { |
|
536 | + Display::display_normal_message(get_lang('InvalidTitle')); |
|
537 | + return false; |
|
538 | + } |
|
539 | 539 | |
540 | - $start = api_get_utc_datetime($date_start); |
|
540 | + $start = api_get_utc_datetime($date_start); |
|
541 | 541 | $end = api_get_utc_datetime($date_end); |
542 | 542 | |
543 | - //Fixing urls that are sent by email |
|
544 | - $content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content); |
|
545 | - $content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content); |
|
543 | + //Fixing urls that are sent by email |
|
544 | + $content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content); |
|
545 | + $content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content); |
|
546 | 546 | |
547 | 547 | $id = intval($id); |
548 | 548 | |
@@ -591,84 +591,84 @@ discard block |
||
591 | 591 | $em->merge($announcement); |
592 | 592 | $em->flush(); |
593 | 593 | |
594 | - return true; |
|
595 | - } |
|
594 | + return true; |
|
595 | + } |
|
596 | 596 | |
597 | - /** |
|
598 | - * Deletes an announcement |
|
599 | - * @param int $id The identifier of the announcement that should be |
|
600 | - * @return bool True on success, false on failure |
|
601 | - */ |
|
602 | - public static function delete_announcement($id) |
|
597 | + /** |
|
598 | + * Deletes an announcement |
|
599 | + * @param int $id The identifier of the announcement that should be |
|
600 | + * @return bool True on success, false on failure |
|
601 | + */ |
|
602 | + public static function delete_announcement($id) |
|
603 | 603 | { |
604 | - $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
605 | - $id = intval($id); |
|
606 | - $sql = "DELETE FROM ".$db_table." WHERE id =".$id; |
|
607 | - $res = Database::query($sql); |
|
608 | - if ($res === false) { |
|
609 | - |
|
610 | - return false; |
|
611 | - } |
|
612 | - return true; |
|
613 | - } |
|
614 | - |
|
615 | - /** |
|
616 | - * Gets an announcement |
|
617 | - * @param int $id The identifier of the announcement that should be |
|
618 | - * @return object Object of class StdClass or the required class, containing the query result row |
|
619 | - */ |
|
620 | - public static function get_announcement($id) |
|
604 | + $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
605 | + $id = intval($id); |
|
606 | + $sql = "DELETE FROM ".$db_table." WHERE id =".$id; |
|
607 | + $res = Database::query($sql); |
|
608 | + if ($res === false) { |
|
609 | + |
|
610 | + return false; |
|
611 | + } |
|
612 | + return true; |
|
613 | + } |
|
614 | + |
|
615 | + /** |
|
616 | + * Gets an announcement |
|
617 | + * @param int $id The identifier of the announcement that should be |
|
618 | + * @return object Object of class StdClass or the required class, containing the query result row |
|
619 | + */ |
|
620 | + public static function get_announcement($id) |
|
621 | 621 | { |
622 | - $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
623 | - $id = intval($id); |
|
624 | - $sql = "SELECT * FROM ".$db_table." WHERE id = ".$id; |
|
625 | - $announcement = Database::fetch_object(Database::query($sql)); |
|
626 | - |
|
627 | - return $announcement; |
|
628 | - } |
|
629 | - |
|
630 | - /** |
|
631 | - * Change the visibility of an announcement |
|
632 | - * @param int $announcement_id |
|
633 | - * @param int $user For who should the visibility be changed |
|
622 | + $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
623 | + $id = intval($id); |
|
624 | + $sql = "SELECT * FROM ".$db_table." WHERE id = ".$id; |
|
625 | + $announcement = Database::fetch_object(Database::query($sql)); |
|
626 | + |
|
627 | + return $announcement; |
|
628 | + } |
|
629 | + |
|
630 | + /** |
|
631 | + * Change the visibility of an announcement |
|
632 | + * @param int $announcement_id |
|
633 | + * @param int $user For who should the visibility be changed |
|
634 | 634 | * (possible values are VISIBLE_TEACHER, VISIBLE_STUDENT, VISIBLE_GUEST) |
635 | - * @return bool True on success, false on failure |
|
636 | - */ |
|
637 | - public static function set_visibility($announcement_id, $user, $visible) |
|
635 | + * @return bool True on success, false on failure |
|
636 | + */ |
|
637 | + public static function set_visibility($announcement_id, $user, $visible) |
|
638 | 638 | { |
639 | - $db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
640 | - $visible = intval($visible); |
|
641 | - $announcement_id = intval($announcement_id); |
|
639 | + $db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
640 | + $visible = intval($visible); |
|
641 | + $announcement_id = intval($announcement_id); |
|
642 | 642 | |
643 | 643 | if (!in_array($user, array(self::VISIBLE_GUEST, self::VISIBLE_STUDENT, self::VISIBLE_TEACHER))) { |
644 | 644 | return false; |
645 | 645 | } |
646 | 646 | |
647 | - $field = ($user == self::VISIBLE_TEACHER ? 'visible_teacher' : ($user == self::VISIBLE_STUDENT ? 'visible_student' : 'visible_guest')); |
|
647 | + $field = ($user == self::VISIBLE_TEACHER ? 'visible_teacher' : ($user == self::VISIBLE_STUDENT ? 'visible_student' : 'visible_guest')); |
|
648 | 648 | |
649 | - $sql = "UPDATE ".$db_table." SET ".$field." = '".$visible."' |
|
649 | + $sql = "UPDATE ".$db_table." SET ".$field." = '".$visible."' |
|
650 | 650 | WHERE id='".$announcement_id."'"; |
651 | - $res = Database::query($sql); |
|
652 | - |
|
653 | - if ($res === false) { |
|
654 | - return false; |
|
655 | - } |
|
656 | - |
|
657 | - return true; |
|
658 | - } |
|
659 | - |
|
660 | - /** |
|
661 | - * Send a system announcement by e-mail to all teachers/students depending on parameters |
|
662 | - * @param string Title |
|
663 | - * @param string Content |
|
664 | - * @param int Whether to send to all teachers (1) or not (0) |
|
665 | - * @param int Whether to send to all students (1) or not (0) |
|
666 | - * @param string Language (optional, considered for all languages if left empty) |
|
651 | + $res = Database::query($sql); |
|
652 | + |
|
653 | + if ($res === false) { |
|
654 | + return false; |
|
655 | + } |
|
656 | + |
|
657 | + return true; |
|
658 | + } |
|
659 | + |
|
660 | + /** |
|
661 | + * Send a system announcement by e-mail to all teachers/students depending on parameters |
|
662 | + * @param string Title |
|
663 | + * @param string Content |
|
664 | + * @param int Whether to send to all teachers (1) or not (0) |
|
665 | + * @param int Whether to send to all students (1) or not (0) |
|
666 | + * @param string Language (optional, considered for all languages if left empty) |
|
667 | 667 | * @return bool True if the message was sent or there was no destination matching. False on database or e-mail sending error. |
668 | - */ |
|
669 | - public static function send_system_announcement_by_email($title, $content, $teacher, $student, $language = null, $sendEmailTest = false) |
|
668 | + */ |
|
669 | + public static function send_system_announcement_by_email($title, $content, $teacher, $student, $language = null, $sendEmailTest = false) |
|
670 | 670 | { |
671 | - global $charset; |
|
671 | + global $charset; |
|
672 | 672 | |
673 | 673 | $title = api_html_entity_decode(stripslashes($title), ENT_QUOTES, $charset); |
674 | 674 | $content = api_html_entity_decode(stripslashes(str_replace(array('\r\n', '\n', '\r'),'', $content)), ENT_QUOTES, $charset); |
@@ -687,22 +687,22 @@ discard block |
||
687 | 687 | } |
688 | 688 | |
689 | 689 | if ($teacher <> 0 AND $student == 0) { |
690 | - $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '1' "; |
|
691 | - } |
|
690 | + $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '1' "; |
|
691 | + } |
|
692 | 692 | |
693 | - if ($teacher == 0 AND $student <> 0) { |
|
694 | - $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '5' "; |
|
695 | - } |
|
693 | + if ($teacher == 0 AND $student <> 0) { |
|
694 | + $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '5' "; |
|
695 | + } |
|
696 | 696 | |
697 | - if ($teacher<> 0 AND $student <> 0) { |
|
698 | - $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE 1 = 1 "; |
|
699 | - } |
|
697 | + if ($teacher<> 0 AND $student <> 0) { |
|
698 | + $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE 1 = 1 "; |
|
699 | + } |
|
700 | 700 | |
701 | - if (!empty($language)) { //special condition because language was already treated for SQL insert before |
|
702 | - $sql .= " AND language = '".Database::escape_string($language)."' "; |
|
703 | - } |
|
701 | + if (!empty($language)) { //special condition because language was already treated for SQL insert before |
|
702 | + $sql .= " AND language = '".Database::escape_string($language)."' "; |
|
703 | + } |
|
704 | 704 | |
705 | - if (api_is_multiple_url_enabled()) { |
|
705 | + if (api_is_multiple_url_enabled()) { |
|
706 | 706 | $sql .= " AND access_url_id = '".$current_access_url_id."' "; |
707 | 707 | } |
708 | 708 | |
@@ -712,25 +712,25 @@ discard block |
||
712 | 712 | // Expiration date |
713 | 713 | $sql .= " AND (expiration_date = '' OR expiration_date IS NULL OR expiration_date > '$now') "; |
714 | 714 | |
715 | - if ((empty($teacher) or $teacher == '0') AND (empty($student) or $student == '0')) { |
|
716 | - return true; |
|
717 | - } |
|
715 | + if ((empty($teacher) or $teacher == '0') AND (empty($student) or $student == '0')) { |
|
716 | + return true; |
|
717 | + } |
|
718 | 718 | |
719 | - $result = Database::query($sql); |
|
720 | - if ($result === false) { |
|
721 | - return false; |
|
722 | - } |
|
719 | + $result = Database::query($sql); |
|
720 | + if ($result === false) { |
|
721 | + return false; |
|
722 | + } |
|
723 | 723 | |
724 | 724 | $message_sent = false; |
725 | 725 | |
726 | - while ($row = Database::fetch_array($result,'ASSOC')) { |
|
726 | + while ($row = Database::fetch_array($result,'ASSOC')) { |
|
727 | 727 | MessageManager::send_message_simple($row['user_id'], $title, $content); |
728 | 728 | $message_sent = true; |
729 | - } |
|
730 | - return $message_sent; //true if at least one e-mail was sent |
|
731 | - } |
|
729 | + } |
|
730 | + return $message_sent; //true if at least one e-mail was sent |
|
731 | + } |
|
732 | 732 | |
733 | - /** |
|
733 | + /** |
|
734 | 734 | * Displays announcements as an slideshow |
735 | 735 | * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER |
736 | 736 | * @param int $id The identifier of the announcement to display |
@@ -80,7 +80,7 @@ |
||
80 | 80 | * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC) |
81 | 81 | * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column. |
82 | 82 | * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3] |
83 | - * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE) |
|
83 | + * @param integer $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE) |
|
84 | 84 | * @return array The sorted dataset |
85 | 85 | * @author [email protected] |
86 | 86 | */ |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * This is a library with some functions to sort tabular data |
|
5 | - * |
|
6 | - * @package chamilo.library |
|
7 | - */ |
|
4 | + * This is a library with some functions to sort tabular data |
|
5 | + * |
|
6 | + * @package chamilo.library |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | define('SORT_DATE', 3); |
10 | 10 | define('SORT_IMAGE', 4); |
@@ -15,16 +15,16 @@ discard block |
||
15 | 15 | class TableSort |
16 | 16 | { |
17 | 17 | /** |
18 | - * Sorts 2-dimensional table. |
|
19 | - * @param array $data The data to be sorted. |
|
20 | - * @param int $column The column on which the data should be sorted (default = 0) |
|
21 | - * @param int $direction The direction to sort (SORT_ASC (default) or SORT_DESC) |
|
22 | - * @param int $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, |
|
23 | - * SORT_STRING,SORT_DATE,SORT_IMAGE) |
|
24 | - * @return array The sorted dataset |
|
25 | - * @author [email protected] |
|
26 | - */ |
|
27 | - public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR) |
|
18 | + * Sorts 2-dimensional table. |
|
19 | + * @param array $data The data to be sorted. |
|
20 | + * @param int $column The column on which the data should be sorted (default = 0) |
|
21 | + * @param int $direction The direction to sort (SORT_ASC (default) or SORT_DESC) |
|
22 | + * @param int $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, |
|
23 | + * SORT_STRING,SORT_DATE,SORT_IMAGE) |
|
24 | + * @return array The sorted dataset |
|
25 | + * @author [email protected] |
|
26 | + */ |
|
27 | + public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR) |
|
28 | 28 | { |
29 | 29 | if (!is_array($data) || empty($data)) { |
30 | 30 | return array(); |
@@ -71,20 +71,20 @@ discard block |
||
71 | 71 | usort($data, create_function('$a, $b', $compare_function)); |
72 | 72 | |
73 | 73 | return $data; |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * Sorts 2-dimensional table. It is possile changing the columns that will be shown and the way that the columns are to be sorted. |
|
78 | - * @param array $data The data to be sorted. |
|
79 | - * @param int $column The column on which the data should be sorted (default = 0) |
|
80 | - * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC) |
|
81 | - * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column. |
|
82 | - * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3] |
|
83 | - * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE) |
|
84 | - * @return array The sorted dataset |
|
85 | - * @author [email protected] |
|
86 | - */ |
|
87 | - public static function sort_table_config( |
|
76 | + /** |
|
77 | + * Sorts 2-dimensional table. It is possile changing the columns that will be shown and the way that the columns are to be sorted. |
|
78 | + * @param array $data The data to be sorted. |
|
79 | + * @param int $column The column on which the data should be sorted (default = 0) |
|
80 | + * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC) |
|
81 | + * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column. |
|
82 | + * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3] |
|
83 | + * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE) |
|
84 | + * @return array The sorted dataset |
|
85 | + * @author [email protected] |
|
86 | + */ |
|
87 | + public static function sort_table_config( |
|
88 | 88 | $data, |
89 | 89 | $column = 0, |
90 | 90 | $direction = SORT_ASC, |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | if (!empty($data)) { |
133 | 133 | foreach ($data as $document) { |
134 | 134 | if ($document['type'] == 'folder') { |
135 | - $docs_to_sort[$document['id']] = api_strtolower($document['name']); |
|
135 | + $docs_to_sort[$document['id']] = api_strtolower($document['name']); |
|
136 | 136 | } else { |
137 | - $folder_to_sort[$document['id']] = api_strtolower($document['name']); |
|
137 | + $folder_to_sort[$document['id']] = api_strtolower($document['name']); |
|
138 | 138 | } |
139 | 139 | $new_data[$document['id']] = $document; |
140 | 140 | } |
@@ -196,91 +196,91 @@ discard block |
||
196 | 196 | usort($data, create_function('$a, $b', $compare_function)); |
197 | 197 | } |
198 | 198 | |
199 | - if (is_array($column_show) && !empty($column_show)) { |
|
199 | + if (is_array($column_show) && !empty($column_show)) { |
|
200 | 200 | |
201 | - // We show only the columns data that were set up on the $column_show array |
|
202 | - $new_order_data = array(); |
|
203 | - $count_data = count($data); |
|
204 | - $count_column_show = count($column_show); |
|
205 | - for ($j = 0; $j < $count_data; $j++) { |
|
206 | - $k = 0; |
|
207 | - for ($i = 0; $i < $count_column_show; $i++) { |
|
208 | - if ($column_show[$i]) { |
|
209 | - $new_order_data[$j][$k] = $data[$j][$i]; |
|
210 | - } |
|
211 | - $k++; |
|
212 | - } |
|
213 | - } |
|
214 | - // Replace the multi-arrays |
|
215 | - $data = $new_order_data; |
|
216 | - } |
|
201 | + // We show only the columns data that were set up on the $column_show array |
|
202 | + $new_order_data = array(); |
|
203 | + $count_data = count($data); |
|
204 | + $count_column_show = count($column_show); |
|
205 | + for ($j = 0; $j < $count_data; $j++) { |
|
206 | + $k = 0; |
|
207 | + for ($i = 0; $i < $count_column_show; $i++) { |
|
208 | + if ($column_show[$i]) { |
|
209 | + $new_order_data[$j][$k] = $data[$j][$i]; |
|
210 | + } |
|
211 | + $k++; |
|
212 | + } |
|
213 | + } |
|
214 | + // Replace the multi-arrays |
|
215 | + $data = $new_order_data; |
|
216 | + } |
|
217 | 217 | |
218 | - return $data; |
|
219 | - } |
|
218 | + return $data; |
|
219 | + } |
|
220 | 220 | |
221 | - /** |
|
222 | - * Checks whether a column of a 2D-array contains only numeric values |
|
223 | - * @param array $data The data-array |
|
224 | - * @param int $column The index of the column to check |
|
225 | - * @return bool TRUE if column contains only dates, FALSE otherwise |
|
226 | - * @todo Take locale into account (eg decimal point or comma ?) |
|
227 | - * @author [email protected] |
|
228 | - */ |
|
229 | - private static function is_numeric_column(& $data, $column) |
|
221 | + /** |
|
222 | + * Checks whether a column of a 2D-array contains only numeric values |
|
223 | + * @param array $data The data-array |
|
224 | + * @param int $column The index of the column to check |
|
225 | + * @return bool TRUE if column contains only dates, FALSE otherwise |
|
226 | + * @todo Take locale into account (eg decimal point or comma ?) |
|
227 | + * @author [email protected] |
|
228 | + */ |
|
229 | + private static function is_numeric_column(& $data, $column) |
|
230 | 230 | { |
231 | - $is_numeric = true; |
|
232 | - foreach ($data as $index => & $row) { |
|
233 | - $is_numeric &= is_numeric(strip_tags($row[$column])); |
|
234 | - if (!$is_numeric) { |
|
235 | - break; |
|
236 | - } |
|
237 | - } |
|
238 | - return $is_numeric; |
|
239 | - } |
|
231 | + $is_numeric = true; |
|
232 | + foreach ($data as $index => & $row) { |
|
233 | + $is_numeric &= is_numeric(strip_tags($row[$column])); |
|
234 | + if (!$is_numeric) { |
|
235 | + break; |
|
236 | + } |
|
237 | + } |
|
238 | + return $is_numeric; |
|
239 | + } |
|
240 | 240 | |
241 | - /** |
|
242 | - * Checks whether a column of a 2D-array contains only dates (GNU date syntax) |
|
243 | - * @param array $data The data-array |
|
244 | - * @param int $column The index of the column to check |
|
245 | - * @return bool TRUE if column contains only dates, FALSE otherwise |
|
246 | - * @author [email protected] |
|
247 | - */ |
|
248 | - private static function is_date_column(& $data, $column) |
|
241 | + /** |
|
242 | + * Checks whether a column of a 2D-array contains only dates (GNU date syntax) |
|
243 | + * @param array $data The data-array |
|
244 | + * @param int $column The index of the column to check |
|
245 | + * @return bool TRUE if column contains only dates, FALSE otherwise |
|
246 | + * @author [email protected] |
|
247 | + */ |
|
248 | + private static function is_date_column(& $data, $column) |
|
249 | 249 | { |
250 | - $is_date = true; |
|
251 | - foreach ($data as $index => & $row) { |
|
252 | - if (strlen(strip_tags($row[$column])) != 0) { |
|
253 | - $check_date = strtotime(strip_tags($row[$column])); |
|
254 | - // strtotime Returns a timestamp on success, FALSE otherwise. |
|
255 | - // Previous to PHP 5.1.0, this function would return -1 on failure. |
|
256 | - $is_date &= ($check_date != -1 && $check_date); |
|
257 | - } else { |
|
258 | - $is_date &= false; |
|
259 | - } |
|
260 | - if (!$is_date) { |
|
261 | - break; |
|
262 | - } |
|
263 | - } |
|
264 | - return $is_date; |
|
265 | - } |
|
250 | + $is_date = true; |
|
251 | + foreach ($data as $index => & $row) { |
|
252 | + if (strlen(strip_tags($row[$column])) != 0) { |
|
253 | + $check_date = strtotime(strip_tags($row[$column])); |
|
254 | + // strtotime Returns a timestamp on success, FALSE otherwise. |
|
255 | + // Previous to PHP 5.1.0, this function would return -1 on failure. |
|
256 | + $is_date &= ($check_date != -1 && $check_date); |
|
257 | + } else { |
|
258 | + $is_date &= false; |
|
259 | + } |
|
260 | + if (!$is_date) { |
|
261 | + break; |
|
262 | + } |
|
263 | + } |
|
264 | + return $is_date; |
|
265 | + } |
|
266 | 266 | |
267 | - /** |
|
268 | - * Checks whether a column of a 2D-array contains only images (<img src="path/file.ext" alt=".."/>) |
|
269 | - * @param array $data The data-array |
|
270 | - * @param int $column The index of the column to check |
|
271 | - * @return bool TRUE if column contains only images, FALSE otherwise |
|
272 | - * @author [email protected] |
|
273 | - */ |
|
274 | - private static function is_image_column(& $data, $column) |
|
267 | + /** |
|
268 | + * Checks whether a column of a 2D-array contains only images (<img src="path/file.ext" alt=".."/>) |
|
269 | + * @param array $data The data-array |
|
270 | + * @param int $column The index of the column to check |
|
271 | + * @return bool TRUE if column contains only images, FALSE otherwise |
|
272 | + * @author [email protected] |
|
273 | + */ |
|
274 | + private static function is_image_column(& $data, $column) |
|
275 | 275 | { |
276 | - $is_image = true; |
|
277 | - foreach ($data as $index => & $row) { |
|
278 | - $is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag |
|
279 | - $is_image &= strlen(trim(strip_tags($row[$column]))) == 0; // and no text outside attribute-values |
|
280 | - if (!$is_image) { |
|
281 | - break; |
|
282 | - } |
|
283 | - } |
|
284 | - return $is_image; |
|
285 | - } |
|
276 | + $is_image = true; |
|
277 | + foreach ($data as $index => & $row) { |
|
278 | + $is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag |
|
279 | + $is_image &= strlen(trim(strip_tags($row[$column]))) == 0; // and no text outside attribute-values |
|
280 | + if (!$is_image) { |
|
281 | + break; |
|
282 | + } |
|
283 | + } |
|
284 | + return $is_image; |
|
285 | + } |
|
286 | 286 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | $new_data_order = array(); |
159 | 159 | if (!empty($docs_to_sort)) { |
160 | - foreach($docs_to_sort as $id => $document) { |
|
160 | + foreach ($docs_to_sort as $id => $document) { |
|
161 | 161 | if (isset($new_data[$id])) { |
162 | 162 | $new_data_order[] = $new_data[$id]; |
163 | 163 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | if (!empty($folder_to_sort)) { |
168 | - foreach($folder_to_sort as $id => $document) { |
|
168 | + foreach ($folder_to_sort as $id => $document) { |
|
169 | 169 | if (isset($new_data[$id])) { |
170 | 170 | $new_data_order[] = $new_data[$id]; |
171 | 171 | } |
@@ -330,6 +330,7 @@ discard block |
||
330 | 330 | /** |
331 | 331 | * Sets the footer visibility |
332 | 332 | * @param bool true if we show the footer |
333 | + * @param boolean $status |
|
333 | 334 | */ |
334 | 335 | public function set_footer($status) |
335 | 336 | { |
@@ -370,6 +371,7 @@ discard block |
||
370 | 371 | /** |
371 | 372 | * Sets the header visibility |
372 | 373 | * @param bool true if we show the header |
374 | + * @param boolean $status |
|
373 | 375 | */ |
374 | 376 | public function set_header($status) |
375 | 377 | { |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $content = '<li class="help">'; |
265 | 265 | $content .= Display::url( |
266 | 266 | Display::return_icon('help.large.png', get_lang('Help')), |
267 | - api_get_path(WEB_CODE_PATH) . 'help/help.php?open=' . $help, |
|
267 | + api_get_path(WEB_CODE_PATH).'help/help.php?open='.$help, |
|
268 | 268 | [ |
269 | 269 | 'class' => 'ajax', |
270 | 270 | 'data-title' => get_lang('Help') |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | 'web_course' => api_get_path(WEB_COURSE_PATH), |
479 | 479 | 'web_main' => api_get_path(WEB_CODE_PATH), |
480 | 480 | 'web_css' => api_get_path(WEB_CSS_PATH), |
481 | - 'web_css_theme' => api_get_path(WEB_CSS_PATH) . 'themes/' . $this->theme . '/', |
|
481 | + 'web_css_theme' => api_get_path(WEB_CSS_PATH).'themes/'.$this->theme.'/', |
|
482 | 482 | 'web_ajax' => api_get_path(WEB_AJAX_PATH), |
483 | 483 | 'web_img' => api_get_path(WEB_IMG_PATH), |
484 | 484 | 'web_plugin' => api_get_path(WEB_PLUGIN_PATH), |
@@ -536,12 +536,12 @@ discard block |
||
536 | 536 | foreach ($bowerCSSFiles as $file) { |
537 | 537 | $css[] = api_get_path(WEB_PATH).'web/assets/'.$file; |
538 | 538 | } |
539 | - $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/bootstrap-select/css/bootstrap-select.min.css'; |
|
540 | - $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chosen/chosen.css'; |
|
541 | - $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/style.css'; |
|
539 | + $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/bootstrap-select/css/bootstrap-select.min.css'; |
|
540 | + $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chosen/chosen.css'; |
|
541 | + $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css'; |
|
542 | 542 | |
543 | 543 | if (api_is_global_chat_enabled()) { |
544 | - $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chat/css/chat.css'; |
|
544 | + $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chat/css/chat.css'; |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | //THEME CSS STYLE |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | |
609 | 609 | $style_print = ''; |
610 | 610 | if (is_readable(api_get_path(SYS_CSS_PATH).$this->theme.'/print.css')) { |
611 | - $style_print = api_get_css(api_get_cdn_path(api_get_path(WEB_CSS_PATH) . $this->theme . '/print.css'), |
|
611 | + $style_print = api_get_css(api_get_cdn_path(api_get_path(WEB_CSS_PATH).$this->theme.'/print.css'), |
|
612 | 612 | 'print'); |
613 | 613 | } |
614 | 614 | $this->assign('css_style_print', $style_print); |
@@ -631,10 +631,10 @@ discard block |
||
631 | 631 | |
632 | 632 | $isoCode = api_get_language_isocode(); |
633 | 633 | |
634 | - $selectLink = 'bootstrap-select/js/i18n/defaults-' . $isoCode . '_' . strtoupper($isoCode) . '.min.js'; |
|
634 | + $selectLink = 'bootstrap-select/js/i18n/defaults-'.$isoCode.'_'.strtoupper($isoCode).'.min.js'; |
|
635 | 635 | |
636 | 636 | if ($isoCode == 'en') { |
637 | - $selectLink = 'bootstrap-select/js/i18n/defaults-' . $isoCode . '_US.min.js'; |
|
637 | + $selectLink = 'bootstrap-select/js/i18n/defaults-'.$isoCode.'_US.min.js'; |
|
638 | 638 | } |
639 | 639 | // JS files |
640 | 640 | $js_files = array( |
@@ -684,8 +684,8 @@ discard block |
||
684 | 684 | } |
685 | 685 | |
686 | 686 | if ($isoCode != 'en') { |
687 | - $bowerJsFiles[] = 'jqueryui-timepicker-addon/dist/i18n/jquery-ui-timepicker-' . $isoCode . '.js'; |
|
688 | - $bowerJsFiles[] = 'jquery-ui/ui/minified/i18n/datepicker-' . $isoCode . '.min.js'; |
|
687 | + $bowerJsFiles[] = 'jqueryui-timepicker-addon/dist/i18n/jquery-ui-timepicker-'.$isoCode.'.js'; |
|
688 | + $bowerJsFiles[] = 'jquery-ui/ui/minified/i18n/datepicker-'.$isoCode.'.min.js'; |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | foreach ($bowerJsFiles as $file) { |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | } |
767 | 767 | |
768 | 768 | $this->assign('online_button', Display::return_icon('statusonline.png', null, null, ICON_SIZE_ATOM)); |
769 | - $this->assign('offline_button',Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM)); |
|
769 | + $this->assign('offline_button', Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM)); |
|
770 | 770 | |
771 | 771 | // Get language iso-code for this page - ignore errors |
772 | 772 | $this->assign('document_language', api_get_language_isocode()); |
@@ -825,15 +825,15 @@ discard block |
||
825 | 825 | $this->assign('section_name', 'section-'.$this_section); |
826 | 826 | |
827 | 827 | //Defaul root chamilo favicon |
828 | - $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_PATH) . 'favicon.ico" type="image/x-icon" />'; |
|
828 | + $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_PATH).'favicon.ico" type="image/x-icon" />'; |
|
829 | 829 | |
830 | 830 | //Added to verify if in the current Chamilo Theme exist a favicon |
831 | - $favicoThemeUrl = api_get_path(SYS_CSS_PATH) . 'themes/' . $this->theme . '/images/'; |
|
831 | + $favicoThemeUrl = api_get_path(SYS_CSS_PATH).'themes/'.$this->theme.'/images/'; |
|
832 | 832 | |
833 | 833 | //If exist pick the current chamilo theme favicon |
834 | - if (is_file($favicoThemeUrl . 'favicon.ico')) { |
|
835 | - $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_CSS_PATH) |
|
836 | - . 'themes/' . $this->theme . '/images/favicon.ico" type="image/x-icon" />'; |
|
834 | + if (is_file($favicoThemeUrl.'favicon.ico')) { |
|
835 | + $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_CSS_PATH) |
|
836 | + . 'themes/'.$this->theme.'/images/favicon.ico" type="image/x-icon" />'; |
|
837 | 837 | } |
838 | 838 | |
839 | 839 | if (api_is_multiple_url_enabled()) { |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) { |
864 | 864 | $bug_notification_link = '<li class="report"> |
865 | 865 | <a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank"> |
866 | - '. $iconBug . ' |
|
866 | + '. $iconBug.' |
|
867 | 867 | </a> |
868 | 868 | </li>'; |
869 | 869 | } |
@@ -975,26 +975,26 @@ discard block |
||
975 | 975 | $socialMeta = ''; |
976 | 976 | $metaTitle = api_get_setting('meta_title'); |
977 | 977 | if (!empty($metaTitle)) { |
978 | - $socialMeta .= '<meta name="twitter:card" content="summary" />' . "\n"; |
|
979 | - $socialMeta .= '<meta property="og:title" content="' . $metaTitle . '" />' . "\n"; |
|
980 | - $socialMeta .= '<meta property="og:url" content="' . api_get_path(WEB_PATH) . '" />' . "\n"; |
|
978 | + $socialMeta .= '<meta name="twitter:card" content="summary" />'."\n"; |
|
979 | + $socialMeta .= '<meta property="og:title" content="'.$metaTitle.'" />'."\n"; |
|
980 | + $socialMeta .= '<meta property="og:url" content="'.api_get_path(WEB_PATH).'" />'."\n"; |
|
981 | 981 | $metaDescription = api_get_setting('meta_description'); |
982 | 982 | if (!empty($metaDescription)) { |
983 | - $socialMeta .= '<meta property="og:description" content="' . $metaDescription . '" />' . "\n"; |
|
983 | + $socialMeta .= '<meta property="og:description" content="'.$metaDescription.'" />'."\n"; |
|
984 | 984 | } |
985 | 985 | $metaSite = api_get_setting('meta_twitter_site'); |
986 | 986 | if (!empty($metaSite)) { |
987 | - $socialMeta .= '<meta name="twitter:site" content="' . $metaSite . '" />' . "\n"; |
|
987 | + $socialMeta .= '<meta name="twitter:site" content="'.$metaSite.'" />'."\n"; |
|
988 | 988 | $metaCreator = api_get_setting('meta_twitter_creator'); |
989 | 989 | if (!empty($metaCreator)) { |
990 | - $socialMeta .= '<meta name="twitter:creator" content="' . $metaCreator . '" />' . "\n"; |
|
990 | + $socialMeta .= '<meta name="twitter:creator" content="'.$metaCreator.'" />'."\n"; |
|
991 | 991 | } |
992 | 992 | } |
993 | 993 | $metaImage = api_get_setting('meta_image_path'); |
994 | 994 | if (!empty($metaImage)) { |
995 | - if (is_file(api_get_path(SYS_PATH) . $metaImage)) { |
|
996 | - $path = api_get_path(WEB_PATH) . $metaImage; |
|
997 | - $socialMeta .= '<meta property="og:image" content="' . $path . '" />' . "\n"; |
|
995 | + if (is_file(api_get_path(SYS_PATH).$metaImage)) { |
|
996 | + $path = api_get_path(WEB_PATH).$metaImage; |
|
997 | + $socialMeta .= '<meta property="og:image" content="'.$path.'" />'."\n"; |
|
998 | 998 | } |
999 | 999 | } |
1000 | 1000 | } |
@@ -1027,7 +1027,7 @@ discard block |
||
1027 | 1027 | // Tutor name |
1028 | 1028 | if (api_get_setting('show_tutor_data') == 'true') { |
1029 | 1029 | // Course manager |
1030 | - $courseId = api_get_course_int_id(); |
|
1030 | + $courseId = api_get_course_int_id(); |
|
1031 | 1031 | $id_session = api_get_session_id(); |
1032 | 1032 | if (!empty($courseId)) { |
1033 | 1033 | $tutor_data = ''; |
@@ -1059,7 +1059,7 @@ discard block |
||
1059 | 1059 | $courseId = api_get_course_int_id(); |
1060 | 1060 | if (!empty($courseId)) { |
1061 | 1061 | $teacher_data = ''; |
1062 | - $mail= CourseManager::get_emails_of_tutors_to_course($courseId); |
|
1062 | + $mail = CourseManager::get_emails_of_tutors_to_course($courseId); |
|
1063 | 1063 | if (!empty($mail)) { |
1064 | 1064 | $teachers_parsed = array(); |
1065 | 1065 | foreach ($mail as $value) { |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | 'sessionVar' => basename(__FILE__, '.php'), |
1294 | 1294 | 'imageOptions' => array( |
1295 | 1295 | 'font_size' => 20, |
1296 | - 'font_path' => api_get_path(SYS_FONTS_PATH) . 'opensans/', |
|
1296 | + 'font_path' => api_get_path(SYS_FONTS_PATH).'opensans/', |
|
1297 | 1297 | 'font_file' => 'OpenSans-Regular.ttf', |
1298 | 1298 | //'output' => 'gif' |
1299 | 1299 | ) |
@@ -52,6 +52,7 @@ discard block |
||
52 | 52 | * Converts the text of a html-document to a given encoding, the meta-tag is changed accordingly. |
53 | 53 | * @param string $string The input full-html document. |
54 | 54 | * @param string The new encoding value to be set. |
55 | + * @param string $encoding |
|
55 | 56 | */ |
56 | 57 | function api_set_encoding_html(&$string, $encoding) { |
57 | 58 | $old_encoding = api_detect_encoding_html($string); |
@@ -74,7 +75,7 @@ discard block |
||
74 | 75 | * Returns the title of a html document. |
75 | 76 | * @param string $string The contents of the input document. |
76 | 77 | * @param string $input_encoding The encoding of the input document. If the value is not set, it is detected. |
77 | - * @param string $$output_encoding The encoding of the retrieved title. If the value is not set, the system encoding is assumend. |
|
78 | + * @param string $output_encoding The encoding of the retrieved title. If the value is not set, the system encoding is assumend. |
|
78 | 79 | * @return string The retrieved title, html-entities and extra-whitespace between the words are cleaned. |
79 | 80 | */ |
80 | 81 | function api_get_title_html(&$string, $output_encoding = null, $input_encoding = null) { |
@@ -433,7 +434,7 @@ discard block |
||
433 | 434 | * @since wordpress 2.8.1 |
434 | 435 | * @access private |
435 | 436 | * |
436 | - * @param string|array $search The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles. |
|
437 | + * @param string[] $search The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles. |
|
437 | 438 | * @param string $subject The string being searched and replaced on, otherwise known as the haystack. |
438 | 439 | * @return string The string with the replaced svalues. |
439 | 440 | */ |
@@ -628,6 +629,7 @@ discard block |
||
628 | 629 | * @param string The text to "cut" |
629 | 630 | * @param int Count of chars |
630 | 631 | * @param bool Whether to embed in a <span title="...">...</span> |
632 | + * @param integer $maxchar |
|
631 | 633 | * @return string |
632 | 634 | * */ |
633 | 635 | function cut($text, $maxchar, $embed = false) { |
@@ -645,7 +647,7 @@ discard block |
||
645 | 647 | * |
646 | 648 | * @param mixed Number to convert |
647 | 649 | * @param int Decimal points 0=never, 1=if needed, 2=always |
648 | - * @return mixed An integer or a float depends on the parameter |
|
650 | + * @return string|null An integer or a float depends on the parameter |
|
649 | 651 | */ |
650 | 652 | function float_format($number, $flag = 1) { |
651 | 653 | if (is_numeric($number)) { |
@@ -689,7 +691,7 @@ discard block |
||
689 | 691 | /** |
690 | 692 | * Gets the week from a day |
691 | 693 | * @param string Date in UTC (2010-01-01 12:12:12) |
692 | - * @return int Returns an integer with the week number of the year |
|
694 | + * @return string Returns an integer with the week number of the year |
|
693 | 695 | */ |
694 | 696 | function get_week_from_day($date) { |
695 | 697 | if (!empty($date)) { |
@@ -739,6 +741,9 @@ discard block |
||
739 | 741 | return $output.$end; |
740 | 742 | } |
741 | 743 | |
744 | +/** |
|
745 | + * @param string $glue |
|
746 | + */ |
|
742 | 747 | function implode_with_key($glue, $array) { |
743 | 748 | if (!empty($array)) { |
744 | 749 | $string = ''; |
@@ -817,7 +822,7 @@ discard block |
||
817 | 822 | /** |
818 | 823 | * @param string $string |
819 | 824 | * @param bool $capitalizeFirstCharacter |
820 | - * @return mixed |
|
825 | + * @return string |
|
821 | 826 | */ |
822 | 827 | function underScoreToCamelCase($string, $capitalizeFirstCharacter = true) |
823 | 828 | { |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * This is the text library for Chamilo. |
|
5 | - * It is loaded during the global initialization, |
|
6 | - * so the functions below are available everywhere. |
|
7 | - * |
|
8 | - * @package chamilo.library |
|
9 | - */ |
|
4 | + * This is the text library for Chamilo. |
|
5 | + * It is loaded during the global initialization, |
|
6 | + * so the functions below are available everywhere. |
|
7 | + * |
|
8 | + * @package chamilo.library |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | define('EXERCISE_NUMBER_OF_DECIMALS', 2); |
12 | 12 | |
@@ -693,8 +693,8 @@ discard block |
||
693 | 693 | */ |
694 | 694 | function get_week_from_day($date) { |
695 | 695 | if (!empty($date)) { |
696 | - $time = api_strtotime($date,'UTC'); |
|
697 | - return date('W', $time); |
|
696 | + $time = api_strtotime($date,'UTC'); |
|
697 | + return date('W', $time); |
|
698 | 698 | } else { |
699 | 699 | return date('W'); |
700 | 700 | } |
@@ -712,31 +712,31 @@ discard block |
||
712 | 712 | |
713 | 713 | function substrwords($text,$maxchar,$end='...') |
714 | 714 | { |
715 | - if(strlen($text)>$maxchar) |
|
716 | - { |
|
717 | - $words=explode(" ",$text); |
|
718 | - $output = ''; |
|
719 | - $i=0; |
|
720 | - while(1) |
|
721 | - { |
|
722 | - $length = (strlen($output)+strlen($words[$i])); |
|
723 | - if($length>$maxchar) |
|
724 | - { |
|
725 | - break; |
|
726 | - } |
|
727 | - else |
|
728 | - { |
|
729 | - $output = $output." ".$words[$i]; |
|
730 | - $i++; |
|
731 | - }; |
|
732 | - }; |
|
733 | - } |
|
734 | - else |
|
735 | - { |
|
736 | - $output = $text; |
|
737 | - return $output; |
|
738 | - } |
|
739 | - return $output.$end; |
|
715 | + if(strlen($text)>$maxchar) |
|
716 | + { |
|
717 | + $words=explode(" ",$text); |
|
718 | + $output = ''; |
|
719 | + $i=0; |
|
720 | + while(1) |
|
721 | + { |
|
722 | + $length = (strlen($output)+strlen($words[$i])); |
|
723 | + if($length>$maxchar) |
|
724 | + { |
|
725 | + break; |
|
726 | + } |
|
727 | + else |
|
728 | + { |
|
729 | + $output = $output." ".$words[$i]; |
|
730 | + $i++; |
|
731 | + }; |
|
732 | + }; |
|
733 | + } |
|
734 | + else |
|
735 | + { |
|
736 | + $output = $text; |
|
737 | + return $output; |
|
738 | + } |
|
739 | + return $output.$end; |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | function implode_with_key($glue, $array) { |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | if (@preg_match('/(.*<head.*)(<meta[^>]*content=[^>]*>)(.*<\/head>.*)/si', $string, $matches)) { |
59 | 59 | $meta = $matches[2]; |
60 | 60 | if (@preg_match("/(<meta[^>]*charset=)(.*)([\"';][^>]*>)/si", $meta, $matches1)) { |
61 | - $meta = $matches1[1] . $encoding . $matches1[3]; |
|
62 | - $string = $matches[1] . $meta . $matches[3]; |
|
61 | + $meta = $matches1[1].$encoding.$matches1[3]; |
|
62 | + $string = $matches[1].$meta.$matches[3]; |
|
63 | 63 | } else { |
64 | - $string = $matches[1] . '<meta http-equiv="Content-Type" content="text/html; charset='.$encoding.'"/>' . $matches[3]; |
|
64 | + $string = $matches[1].'<meta http-equiv="Content-Type" content="text/html; charset='.$encoding.'"/>'.$matches[3]; |
|
65 | 65 | } |
66 | 66 | } else { |
67 | 67 | $count = 1; |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | if (!preg_match(_PCRE_XML_ENCODING, $string)) { |
169 | 169 | if (strpos($matches[0], 'standalone') !== false) { |
170 | 170 | // The encoding option should precede the standalone option, othewise DOMDocument fails to load the document. |
171 | - $replace = str_replace('standalone', ' encoding="'.$to_encoding.'" standalone' , $matches[0]); |
|
171 | + $replace = str_replace('standalone', ' encoding="'.$to_encoding.'" standalone', $matches[0]); |
|
172 | 172 | } else { |
173 | - $replace = str_replace('?>', ' encoding="'.$to_encoding.'"?>' , $matches[0]); |
|
173 | + $replace = str_replace('?>', ' encoding="'.$to_encoding.'"?>', $matches[0]); |
|
174 | 174 | } |
175 | 175 | return api_convert_encoding(str_replace($matches[0], $replace, $string), $to_encoding, $from_encoding); |
176 | 176 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | function _make_url_clickable_cb($matches) { |
336 | 336 | $url = $matches[2]; |
337 | 337 | |
338 | - if ( ')' == $matches[3] && strpos( $url, '(' ) ) { |
|
338 | + if (')' == $matches[3] && strpos($url, '(')) { |
|
339 | 339 | // If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it, add the closing parenthesis to the URL. |
340 | 340 | // Then we can let the parenthesis balancer do its thing below. |
341 | 341 | $url .= $matches[3]; |
@@ -345,16 +345,16 @@ discard block |
||
345 | 345 | } |
346 | 346 | |
347 | 347 | // Include parentheses in the URL only if paired |
348 | - while ( substr_count( $url, '(' ) < substr_count( $url, ')' ) ) { |
|
349 | - $suffix = strrchr( $url, ')' ) . $suffix; |
|
350 | - $url = substr( $url, 0, strrpos( $url, ')' ) ); |
|
348 | + while (substr_count($url, '(') < substr_count($url, ')')) { |
|
349 | + $suffix = strrchr($url, ')').$suffix; |
|
350 | + $url = substr($url, 0, strrpos($url, ')')); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | $url = esc_url($url); |
354 | - if ( empty($url) ) |
|
354 | + if (empty($url)) |
|
355 | 355 | return $matches[0]; |
356 | 356 | |
357 | - return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix; |
|
357 | + return $matches[1]."<a href=\"$url\" rel=\"nofollow\">$url</a>".$suffix; |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | /** |
@@ -374,10 +374,10 @@ discard block |
||
374 | 374 | * @param string $_context Private. Use esc_url_raw() for database usage. |
375 | 375 | * @return string The cleaned $url after the 'clean_url' filter is applied. |
376 | 376 | */ |
377 | -function esc_url( $url, $protocols = null, $_context = 'display' ) { |
|
377 | +function esc_url($url, $protocols = null, $_context = 'display') { |
|
378 | 378 | //$original_url = $url; |
379 | 379 | |
380 | - if ( '' == $url ) |
|
380 | + if ('' == $url) |
|
381 | 381 | return $url; |
382 | 382 | $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url); |
383 | 383 | $strip = array('%0d', '%0a', '%0D', '%0A'); |
@@ -387,9 +387,9 @@ discard block |
||
387 | 387 | * presume it needs http:// appended (unless a relative |
388 | 388 | * link starting with /, # or ? or a php file). |
389 | 389 | */ |
390 | - if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) && |
|
391 | - ! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) |
|
392 | - $url = 'http://' . $url; |
|
390 | + if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && |
|
391 | + !preg_match('/^[a-z0-9-]+?\.php/i', $url)) |
|
392 | + $url = 'http://'.$url; |
|
393 | 393 | |
394 | 394 | return Security::remove_XSS($url); |
395 | 395 | |
@@ -437,12 +437,12 @@ discard block |
||
437 | 437 | * @param string $subject The string being searched and replaced on, otherwise known as the haystack. |
438 | 438 | * @return string The string with the replaced svalues. |
439 | 439 | */ |
440 | -function _deep_replace( $search, $subject ) { |
|
440 | +function _deep_replace($search, $subject) { |
|
441 | 441 | $subject = (string) $subject; |
442 | 442 | |
443 | 443 | $count = 1; |
444 | - while ( $count ) { |
|
445 | - $subject = str_replace( $search, '', $subject, $count ); |
|
444 | + while ($count) { |
|
445 | + $subject = str_replace($search, '', $subject, $count); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | return $subject; |
@@ -464,17 +464,17 @@ discard block |
||
464 | 464 | function _make_web_ftp_clickable_cb($matches) { |
465 | 465 | $ret = ''; |
466 | 466 | $dest = $matches[2]; |
467 | - $dest = 'http://' . $dest; |
|
467 | + $dest = 'http://'.$dest; |
|
468 | 468 | $dest = esc_url($dest); |
469 | - if ( empty($dest) ) |
|
469 | + if (empty($dest)) |
|
470 | 470 | return $matches[0]; |
471 | 471 | |
472 | 472 | // removed trailing [.,;:)] from URL |
473 | - if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) { |
|
473 | + if (in_array(substr($dest, -1), array('.', ',', ';', ':', ')')) === true) { |
|
474 | 474 | $ret = substr($dest, -1); |
475 | - $dest = substr($dest, 0, strlen($dest)-1); |
|
475 | + $dest = substr($dest, 0, strlen($dest) - 1); |
|
476 | 476 | } |
477 | - return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret"; |
|
477 | + return $matches[1]."<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret"; |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | /** |
@@ -490,8 +490,8 @@ discard block |
||
490 | 490 | * @return string HTML A element with email address. |
491 | 491 | */ |
492 | 492 | function _make_email_clickable_cb($matches) { |
493 | - $email = $matches[2] . '@' . $matches[3]; |
|
494 | - return $matches[1] . "<a href=\"mailto:$email\">$email</a>"; |
|
493 | + $email = $matches[2].'@'.$matches[3]; |
|
494 | + return $matches[1]."<a href=\"mailto:$email\">$email</a>"; |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | /** |
@@ -505,30 +505,30 @@ discard block |
||
505 | 505 | * @param string $text Content to convert URIs. |
506 | 506 | * @return string Content with converted URIs. |
507 | 507 | */ |
508 | -function make_clickable( $text ) { |
|
508 | +function make_clickable($text) { |
|
509 | 509 | $r = ''; |
510 | - $textarr = preg_split( '/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // split out HTML tags |
|
510 | + $textarr = preg_split('/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE); // split out HTML tags |
|
511 | 511 | $nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code> |
512 | - foreach ( $textarr as $piece ) { |
|
512 | + foreach ($textarr as $piece) { |
|
513 | 513 | |
514 | - if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) ) |
|
514 | + if (preg_match('|^<code[\s>]|i', $piece) || preg_match('|^<pre[\s>]|i', $piece)) |
|
515 | 515 | $nested_code_pre++; |
516 | - elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre ) |
|
516 | + elseif (('</code>' === strtolower($piece) || '</pre>' === strtolower($piece)) && $nested_code_pre) |
|
517 | 517 | $nested_code_pre--; |
518 | 518 | |
519 | - if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) { |
|
519 | + if ($nested_code_pre || empty($piece) || ($piece[0] === '<' && !preg_match('|^<\s*[\w]{1,20}+://|', $piece))) { |
|
520 | 520 | $r .= $piece; |
521 | 521 | continue; |
522 | 522 | } |
523 | 523 | |
524 | 524 | // Long strings might contain expensive edge cases ... |
525 | - if ( 10000 < strlen( $piece ) ) { |
|
525 | + if (10000 < strlen($piece)) { |
|
526 | 526 | // ... break it up |
527 | - foreach ( _split_str_by_whitespace( $piece, 2100 ) as $chunk ) { // 2100: Extra room for scheme and leading and trailing paretheses |
|
528 | - if ( 2101 < strlen( $chunk ) ) { |
|
527 | + foreach (_split_str_by_whitespace($piece, 2100) as $chunk) { // 2100: Extra room for scheme and leading and trailing paretheses |
|
528 | + if (2101 < strlen($chunk)) { |
|
529 | 529 | $r .= $chunk; // Too big, no whitespace: bail. |
530 | 530 | } else { |
531 | - $r .= make_clickable( $chunk ); |
|
531 | + $r .= make_clickable($chunk); |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | } else { |
@@ -549,18 +549,18 @@ discard block |
||
549 | 549 | ~xS'; // The regex is a non-anchored pattern and does not have a single fixed starting character. |
550 | 550 | // Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times. |
551 | 551 | |
552 | - $ret = preg_replace_callback( $url_clickable, '_make_url_clickable_cb', $ret ); |
|
552 | + $ret = preg_replace_callback($url_clickable, '_make_url_clickable_cb', $ret); |
|
553 | 553 | |
554 | - $ret = preg_replace_callback( '#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret ); |
|
555 | - $ret = preg_replace_callback( '#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret ); |
|
554 | + $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret); |
|
555 | + $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret); |
|
556 | 556 | |
557 | - $ret = substr( $ret, 1, -1 ); // Remove our whitespace padding. |
|
557 | + $ret = substr($ret, 1, -1); // Remove our whitespace padding. |
|
558 | 558 | $r .= $ret; |
559 | 559 | } |
560 | 560 | } |
561 | 561 | |
562 | 562 | // Cleanup of accidental links within links |
563 | - $r = preg_replace( '#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r ); |
|
563 | + $r = preg_replace('#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r); |
|
564 | 564 | return $r; |
565 | 565 | } |
566 | 566 | |
@@ -595,27 +595,27 @@ discard block |
||
595 | 595 | * @param int $goal The desired chunk length. |
596 | 596 | * @return array Numeric array of chunks. |
597 | 597 | */ |
598 | -function _split_str_by_whitespace( $string, $goal ) { |
|
598 | +function _split_str_by_whitespace($string, $goal) { |
|
599 | 599 | $chunks = array(); |
600 | 600 | |
601 | - $string_nullspace = strtr( $string, "\r\n\t\v\f ", "\000\000\000\000\000\000" ); |
|
601 | + $string_nullspace = strtr($string, "\r\n\t\v\f ", "\000\000\000\000\000\000"); |
|
602 | 602 | |
603 | - while ( $goal < strlen( $string_nullspace ) ) { |
|
604 | - $pos = strrpos( substr( $string_nullspace, 0, $goal + 1 ), "\000" ); |
|
603 | + while ($goal < strlen($string_nullspace)) { |
|
604 | + $pos = strrpos(substr($string_nullspace, 0, $goal + 1), "\000"); |
|
605 | 605 | |
606 | - if ( false === $pos ) { |
|
607 | - $pos = strpos( $string_nullspace, "\000", $goal + 1 ); |
|
608 | - if ( false === $pos ) { |
|
606 | + if (false === $pos) { |
|
607 | + $pos = strpos($string_nullspace, "\000", $goal + 1); |
|
608 | + if (false === $pos) { |
|
609 | 609 | break; |
610 | 610 | } |
611 | 611 | } |
612 | 612 | |
613 | - $chunks[] = substr( $string, 0, $pos + 1 ); |
|
614 | - $string = substr( $string, $pos + 1 ); |
|
615 | - $string_nullspace = substr( $string_nullspace, $pos + 1 ); |
|
613 | + $chunks[] = substr($string, 0, $pos + 1); |
|
614 | + $string = substr($string, $pos + 1); |
|
615 | + $string_nullspace = substr($string_nullspace, $pos + 1); |
|
616 | 616 | } |
617 | 617 | |
618 | - if ( $string ) { |
|
618 | + if ($string) { |
|
619 | 619 | $chunks[] = $string; |
620 | 620 | } |
621 | 621 | |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | */ |
694 | 694 | function get_week_from_day($date) { |
695 | 695 | if (!empty($date)) { |
696 | - $time = api_strtotime($date,'UTC'); |
|
696 | + $time = api_strtotime($date, 'UTC'); |
|
697 | 697 | return date('W', $time); |
698 | 698 | } else { |
699 | 699 | return date('W'); |
@@ -710,17 +710,17 @@ discard block |
||
710 | 710 | * @return a reduce string |
711 | 711 | */ |
712 | 712 | |
713 | -function substrwords($text,$maxchar,$end='...') |
|
713 | +function substrwords($text, $maxchar, $end = '...') |
|
714 | 714 | { |
715 | - if(strlen($text)>$maxchar) |
|
715 | + if (strlen($text) > $maxchar) |
|
716 | 716 | { |
717 | - $words=explode(" ",$text); |
|
717 | + $words = explode(" ", $text); |
|
718 | 718 | $output = ''; |
719 | - $i=0; |
|
720 | - while(1) |
|
719 | + $i = 0; |
|
720 | + while (1) |
|
721 | 721 | { |
722 | - $length = (strlen($output)+strlen($words[$i])); |
|
723 | - if($length>$maxchar) |
|
722 | + $length = (strlen($output) + strlen($words[$i])); |
|
723 | + if ($length > $maxchar) |
|
724 | 724 | { |
725 | 725 | break; |
726 | 726 | } |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | function implode_with_key($glue, $array) { |
743 | 743 | if (!empty($array)) { |
744 | 744 | $string = ''; |
745 | - foreach($array as $key => $value) { |
|
745 | + foreach ($array as $key => $value) { |
|
746 | 746 | if (empty($value)) { |
747 | 747 | $value = 'null'; |
748 | 748 | } |
@@ -764,13 +764,13 @@ discard block |
||
764 | 764 | { |
765 | 765 | $file_size = intval($file_size); |
766 | 766 | if ($file_size >= 1073741824) { |
767 | - $file_size = round($file_size / 1073741824 * 100) / 100 . 'G'; |
|
768 | - } elseif($file_size >= 1048576) { |
|
769 | - $file_size = round($file_size / 1048576 * 100) / 100 . 'M'; |
|
770 | - } elseif($file_size >= 1024) { |
|
771 | - $file_size = round($file_size / 1024 * 100) / 100 . 'k'; |
|
767 | + $file_size = round($file_size / 1073741824 * 100) / 100.'G'; |
|
768 | + } elseif ($file_size >= 1048576) { |
|
769 | + $file_size = round($file_size / 1048576 * 100) / 100.'M'; |
|
770 | + } elseif ($file_size >= 1024) { |
|
771 | + $file_size = round($file_size / 1024 * 100) / 100.'k'; |
|
772 | 772 | } else { |
773 | - $file_size = $file_size . 'B'; |
|
773 | + $file_size = $file_size.'B'; |
|
774 | 774 | } |
775 | 775 | return $file_size; |
776 | 776 | } |
@@ -779,18 +779,18 @@ discard block |
||
779 | 779 | { |
780 | 780 | $year = '0000'; |
781 | 781 | $month = $day = $hours = $minutes = $seconds = '00'; |
782 | - if (isset($array['Y']) && (isset($array['F']) || isset($array['M'])) && isset($array['d']) && isset($array['H']) && isset($array['i'])) { |
|
782 | + if (isset($array['Y']) && (isset($array['F']) || isset($array['M'])) && isset($array['d']) && isset($array['H']) && isset($array['i'])) { |
|
783 | 783 | $year = $array['Y']; |
784 | - $month = isset($array['F'])?$array['F']:$array['M']; |
|
785 | - if (intval($month) < 10 ) $month = '0'.$month; |
|
784 | + $month = isset($array['F']) ? $array['F'] : $array['M']; |
|
785 | + if (intval($month) < 10) $month = '0'.$month; |
|
786 | 786 | $day = $array['d']; |
787 | - if (intval($day) < 10 ) $day = '0'.$day; |
|
787 | + if (intval($day) < 10) $day = '0'.$day; |
|
788 | 788 | $hours = $array['H']; |
789 | - if (intval($hours) < 10 ) $hours = '0'.$hours; |
|
789 | + if (intval($hours) < 10) $hours = '0'.$hours; |
|
790 | 790 | $minutes = $array['i']; |
791 | - if (intval($minutes) < 10 ) $minutes = '0'.$minutes; |
|
791 | + if (intval($minutes) < 10) $minutes = '0'.$minutes; |
|
792 | 792 | } |
793 | - if (checkdate($month,$day,$year)) { |
|
793 | + if (checkdate($month, $day, $year)) { |
|
794 | 794 | $datetime = $year.'-'.$month.'-'.$day.' '.$hours.':'.$minutes.':'.$seconds; |
795 | 795 | } |
796 | 796 | return $datetime; |
@@ -351,8 +351,9 @@ discard block |
||
351 | 351 | } |
352 | 352 | |
353 | 353 | $url = esc_url($url); |
354 | - if ( empty($url) ) |
|
355 | - return $matches[0]; |
|
354 | + if ( empty($url) ) { |
|
355 | + return $matches[0]; |
|
356 | + } |
|
356 | 357 | |
357 | 358 | return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix; |
358 | 359 | } |
@@ -377,8 +378,9 @@ discard block |
||
377 | 378 | function esc_url( $url, $protocols = null, $_context = 'display' ) { |
378 | 379 | //$original_url = $url; |
379 | 380 | |
380 | - if ( '' == $url ) |
|
381 | - return $url; |
|
381 | + if ( '' == $url ) { |
|
382 | + return $url; |
|
383 | + } |
|
382 | 384 | $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url); |
383 | 385 | $strip = array('%0d', '%0a', '%0D', '%0A'); |
384 | 386 | $url = _deep_replace($strip, $url); |
@@ -388,8 +390,9 @@ discard block |
||
388 | 390 | * link starting with /, # or ? or a php file). |
389 | 391 | */ |
390 | 392 | if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) && |
391 | - ! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) |
|
392 | - $url = 'http://' . $url; |
|
393 | + ! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) { |
|
394 | + $url = 'http://' . $url; |
|
395 | + } |
|
393 | 396 | |
394 | 397 | return Security::remove_XSS($url); |
395 | 398 | |
@@ -466,8 +469,9 @@ discard block |
||
466 | 469 | $dest = $matches[2]; |
467 | 470 | $dest = 'http://' . $dest; |
468 | 471 | $dest = esc_url($dest); |
469 | - if ( empty($dest) ) |
|
470 | - return $matches[0]; |
|
472 | + if ( empty($dest) ) { |
|
473 | + return $matches[0]; |
|
474 | + } |
|
471 | 475 | |
472 | 476 | // removed trailing [.,;:)] from URL |
473 | 477 | if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) { |
@@ -511,10 +515,11 @@ discard block |
||
511 | 515 | $nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code> |
512 | 516 | foreach ( $textarr as $piece ) { |
513 | 517 | |
514 | - if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) ) |
|
515 | - $nested_code_pre++; |
|
516 | - elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre ) |
|
517 | - $nested_code_pre--; |
|
518 | + if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) ) { |
|
519 | + $nested_code_pre++; |
|
520 | + } elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre ) { |
|
521 | + $nested_code_pre--; |
|
522 | + } |
|
518 | 523 | |
519 | 524 | if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) { |
520 | 525 | $r .= $piece; |
@@ -723,15 +728,13 @@ discard block |
||
723 | 728 | if($length>$maxchar) |
724 | 729 | { |
725 | 730 | break; |
726 | - } |
|
727 | - else |
|
731 | + } else |
|
728 | 732 | { |
729 | 733 | $output = $output." ".$words[$i]; |
730 | 734 | $i++; |
731 | 735 | }; |
732 | 736 | }; |
733 | - } |
|
734 | - else |
|
737 | + } else |
|
735 | 738 | { |
736 | 739 | $output = $text; |
737 | 740 | return $output; |
@@ -782,13 +785,21 @@ discard block |
||
782 | 785 | if (isset($array['Y']) && (isset($array['F']) || isset($array['M'])) && isset($array['d']) && isset($array['H']) && isset($array['i'])) { |
783 | 786 | $year = $array['Y']; |
784 | 787 | $month = isset($array['F'])?$array['F']:$array['M']; |
785 | - if (intval($month) < 10 ) $month = '0'.$month; |
|
788 | + if (intval($month) < 10 ) { |
|
789 | + $month = '0'.$month; |
|
790 | + } |
|
786 | 791 | $day = $array['d']; |
787 | - if (intval($day) < 10 ) $day = '0'.$day; |
|
792 | + if (intval($day) < 10 ) { |
|
793 | + $day = '0'.$day; |
|
794 | + } |
|
788 | 795 | $hours = $array['H']; |
789 | - if (intval($hours) < 10 ) $hours = '0'.$hours; |
|
796 | + if (intval($hours) < 10 ) { |
|
797 | + $hours = '0'.$hours; |
|
798 | + } |
|
790 | 799 | $minutes = $array['i']; |
791 | - if (intval($minutes) < 10 ) $minutes = '0'.$minutes; |
|
800 | + if (intval($minutes) < 10 ) { |
|
801 | + $minutes = '0'.$minutes; |
|
802 | + } |
|
792 | 803 | } |
793 | 804 | if (checkdate($month,$day,$year)) { |
794 | 805 | $datetime = $year.'-'.$month.'-'.$day.' '.$hours.':'.$minutes.':'.$seconds; |
@@ -73,7 +73,7 @@ |
||
73 | 73 | * @todo the form should be auto generated |
74 | 74 | * @param string url |
75 | 75 | * @param string action add, edit |
76 | - * @return obj form validator obj |
|
76 | + * @return FormValidator form validator obj |
|
77 | 77 | */ |
78 | 78 | public function return_form($url, $action) |
79 | 79 | { |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | ); |
26 | 26 | public $is_course_model = true; |
27 | 27 | |
28 | - public function __construct() |
|
28 | + public function __construct() |
|
29 | 29 | { |
30 | 30 | $this->table = Database::get_course_table(TABLE_TIMELINE); |
31 | - } |
|
31 | + } |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Get the count of elements |
@@ -52,16 +52,16 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * Displays the title + grid |
54 | 54 | */ |
55 | - public function listing() |
|
55 | + public function listing() |
|
56 | 56 | { |
57 | - // action links |
|
58 | - $html = '<div class="actions">'; |
|
57 | + // action links |
|
58 | + $html = '<div class="actions">'; |
|
59 | 59 | //$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>'; |
60 | - $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>'; |
|
61 | - $html .= '</div>'; |
|
60 | + $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>'; |
|
61 | + $html .= '</div>'; |
|
62 | 62 | $html .= Display::grid_html('timelines'); |
63 | 63 | return $html; |
64 | - } |
|
64 | + } |
|
65 | 65 | |
66 | 66 | public function get_status_list() |
67 | 67 | { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $form->addElement('text', 'headline', get_lang('Name'), array('size' => '70')); |
91 | 91 | //$form->addHtmlEditor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'Careers','Width' => '100%', 'Height' => '250')); |
92 | - $status_list = $this->get_status_list(); |
|
92 | + $status_list = $this->get_status_list(); |
|
93 | 93 | $form->addElement('select', 'status', get_lang('Status'), $status_list); |
94 | 94 | if ($action == 'edit') { |
95 | 95 | //$form->addElement('text', 'created_at', get_lang('CreatedAt')); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | // Setting the rules |
175 | 175 | $form->addRule('headline', get_lang('ThisFieldIsRequired'), 'required'); |
176 | - return $form; |
|
176 | + return $form; |
|
177 | 177 | |
178 | 178 | } |
179 | 179 | |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | public function save_item($params) |
185 | 185 | { |
186 | 186 | $params['c_id'] = api_get_course_int_id(); |
187 | - $id = parent::save($params); |
|
188 | - if (!empty($id)) { |
|
189 | - //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
190 | - } |
|
191 | - return $id; |
|
187 | + $id = parent::save($params); |
|
188 | + if (!empty($id)) { |
|
189 | + //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
190 | + } |
|
191 | + return $id; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -199,16 +199,16 @@ discard block |
||
199 | 199 | $params['c_id'] = api_get_course_int_id(); |
200 | 200 | $params['parent_id'] = '0'; |
201 | 201 | $params['type'] = 'default'; |
202 | - $id = parent::save($params); |
|
203 | - if (!empty($id)) { |
|
204 | - //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
205 | - } |
|
206 | - return $id; |
|
202 | + $id = parent::save($params); |
|
203 | + if (!empty($id)) { |
|
204 | + //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
205 | + } |
|
206 | + return $id; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | public function delete($id) { |
210 | - parent::delete($id); |
|
211 | - //event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
210 | + parent::delete($id); |
|
211 | + //event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | public function get_url($id) { |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $item['asset'] = array( 'media' => $item['media'], |
248 | 248 | 'credit' => $item['media_credit'], |
249 | 249 | 'caption' => $item['media_caption'], |
250 | - ); |
|
250 | + ); |
|
251 | 251 | |
252 | 252 | //Cleaning items |
253 | 253 | unset($item['id']); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | public function __construct() |
29 | 29 | { |
30 | - $this->table = Database::get_course_table(TABLE_TIMELINE); |
|
30 | + $this->table = Database::get_course_table(TABLE_TIMELINE); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function get_all($where_conditions = array()) |
48 | 48 | { |
49 | - return Database::select('*',$this->table, array('where'=>$where_conditions,'order' =>'headline ASC')); |
|
49 | + return Database::select('*', $this->table, array('where'=>$where_conditions, 'order' =>'headline ASC')); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | // action links |
58 | 58 | $html = '<div class="actions">'; |
59 | 59 | //$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>'; |
60 | - $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>'; |
|
60 | + $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', '32').'</a>'; |
|
61 | 61 | $html .= '</div>'; |
62 | 62 | $html .= Display::grid_html('timelines'); |
63 | 63 | return $html; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | } |
245 | 245 | unset($item['end_date']); |
246 | 246 | // Assets |
247 | - $item['asset'] = array( 'media' => $item['media'], |
|
247 | + $item['asset'] = array('media' => $item['media'], |
|
248 | 248 | 'credit' => $item['media_credit'], |
249 | 249 | 'caption' => $item['media_caption'], |
250 | 250 | ); |
@@ -1287,6 +1287,8 @@ discard block |
||
1287 | 1287 | * @param string type of time filter: 'last_week' or 'custom' |
1288 | 1288 | * @param string start date date('Y-m-d H:i:s') |
1289 | 1289 | * @param string end date date('Y-m-d H:i:s') |
1290 | + * @param string $start_date |
|
1291 | + * @param string $end_date |
|
1290 | 1292 | * @return timestamp $nb_seconds |
1291 | 1293 | */ |
1292 | 1294 | public static function get_time_spent_on_the_platform( |
@@ -1390,7 +1392,7 @@ discard block |
||
1390 | 1392 | * Get first connection date for a student |
1391 | 1393 | * @param int $student_id |
1392 | 1394 | * |
1393 | - * @return string|bool Date format long without day or false if there are no connections |
|
1395 | + * @return string|false Date format long without day or false if there are no connections |
|
1394 | 1396 | */ |
1395 | 1397 | public static function get_first_connection_date($student_id) |
1396 | 1398 | { |
@@ -1420,7 +1422,7 @@ discard block |
||
1420 | 1422 | * @param int $student_id |
1421 | 1423 | * @param bool $warning_message Show a warning message (optional) |
1422 | 1424 | * @param bool $return_timestamp True for returning results in timestamp (optional) |
1423 | - * @return string|int|bool Date format long without day, false if there are no connections or |
|
1425 | + * @return string Date format long without day, false if there are no connections or |
|
1424 | 1426 | * timestamp if parameter $return_timestamp is true |
1425 | 1427 | */ |
1426 | 1428 | public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false) |
@@ -2667,6 +2669,9 @@ discard block |
||
2667 | 2669 | * @param array Limit average to listed lp ids |
2668 | 2670 | * @param int Session id (optional), if param $session_id is |
2669 | 2671 | * null(default) it'll return results including sessions, 0 = session is not filtered |
2672 | + * @param integer $student_id |
|
2673 | + * @param string $course_code |
|
2674 | + * @param integer $session_id |
|
2670 | 2675 | * @return int Total time |
2671 | 2676 | */ |
2672 | 2677 | public static function get_time_spent_in_lp($student_id, $course_code, $lp_ids = array(), $session_id = null) |
@@ -2733,6 +2738,8 @@ discard block |
||
2733 | 2738 | * @param int|array Student id(s) |
2734 | 2739 | * @param string Course code |
2735 | 2740 | * @param int Learning path id |
2741 | + * @param integer $student_id |
|
2742 | + * @param string $course_code |
|
2736 | 2743 | * @return int Total time |
2737 | 2744 | */ |
2738 | 2745 | public static function get_last_connection_time_in_lp($student_id, $course_code, $lp_id, $session_id = 0) |
@@ -5400,7 +5407,7 @@ discard block |
||
5400 | 5407 | |
5401 | 5408 | /** |
5402 | 5409 | * @param FormValidator $form |
5403 | - * @return mixed |
|
5410 | + * @return FormValidator |
|
5404 | 5411 | */ |
5405 | 5412 | public static function setUserSearchForm($form) |
5406 | 5413 | { |
@@ -5439,7 +5446,6 @@ discard block |
||
5439 | 5446 | * @param int $sessionId The session ID (session.id) |
5440 | 5447 | * @param int $courseId The course ID (course.id) |
5441 | 5448 | * @param int $exerciseId The quiz ID (c_quiz.id) |
5442 | - * @param int $answer The answer status (0 = incorrect, 1 = correct, 2 = both) |
|
5443 | 5449 | * @param array $options An array of options you can pass to the query (limit, where and order) |
5444 | 5450 | * @return array An array with the data of exercise(s) progress |
5445 | 5451 | */ |
@@ -6876,7 +6882,7 @@ discard block |
||
6876 | 6882 | * @param int $user_id |
6877 | 6883 | * @param int $course_id |
6878 | 6884 | * @param int $session_id |
6879 | - * @return array |
|
6885 | + * @return string[] |
|
6880 | 6886 | */ |
6881 | 6887 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
6882 | 6888 | { |
@@ -6922,9 +6928,9 @@ discard block |
||
6922 | 6928 | /** |
6923 | 6929 | * Displays the exercise results for a specific user in a specific course. |
6924 | 6930 | * @param string $view |
6925 | - * @param int $user_id User ID |
|
6931 | + * @param int $userId User ID |
|
6926 | 6932 | * @param string $courseCode Course code |
6927 | - * @return array |
|
6933 | + * @return string[] |
|
6928 | 6934 | * @todo remove globals |
6929 | 6935 | */ |
6930 | 6936 | public function display_exercise_tracking_info($view, $userId, $courseCode) |
@@ -2259,7 +2259,9 @@ discard block |
||
2259 | 2259 | $debug = false; |
2260 | 2260 | } |
2261 | 2261 | |
2262 | - if ($debug) echo '<h1>Tracking::get_avg_student_score</h1>'; |
|
2262 | + if ($debug) { |
|
2263 | + echo '<h1>Tracking::get_avg_student_score</h1>'; |
|
2264 | + } |
|
2263 | 2265 | $tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
2264 | 2266 | $tbl_stats_attempts = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
2265 | 2267 | |
@@ -2336,7 +2338,9 @@ discard block |
||
2336 | 2338 | $condition_user1 AND |
2337 | 2339 | session_id = $session_id |
2338 | 2340 | GROUP BY lp_id, user_id"; |
2339 | - if ($debug) echo $sql; |
|
2341 | + if ($debug) { |
|
2342 | + echo $sql; |
|
2343 | + } |
|
2340 | 2344 | |
2341 | 2345 | $rs_last_lp_view_id = Database::query($sql); |
2342 | 2346 | |
@@ -2352,7 +2356,9 @@ discard block |
||
2352 | 2356 | $lp_view_id = $row_lp_view['id']; |
2353 | 2357 | $lp_id = $row_lp_view['lp_id']; |
2354 | 2358 | $user_id = $row_lp_view['user_id']; |
2355 | - if ($debug) echo '<h2>LP id '.$lp_id.'</h2>'; |
|
2359 | + if ($debug) { |
|
2360 | + echo '<h2>LP id '.$lp_id.'</h2>'; |
|
2361 | + } |
|
2356 | 2362 | |
2357 | 2363 | if ($get_only_latest_attempt_results) { |
2358 | 2364 | //Getting lp_items done by the user |
@@ -2409,7 +2415,9 @@ discard block |
||
2409 | 2415 | lp_i.c_id = $course_id AND |
2410 | 2416 | (lp_i.item_type='sco' OR lp_i.item_type='".TOOL_QUIZ."') |
2411 | 2417 | WHERE lp_view_id = $lp_view_id "; |
2412 | - if ($debug) echo $sql.'<br />'; |
|
2418 | + if ($debug) { |
|
2419 | + echo $sql.'<br />'; |
|
2420 | + } |
|
2413 | 2421 | $res_max_score = Database::query($sql); |
2414 | 2422 | |
2415 | 2423 | while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) { |
@@ -2428,7 +2436,9 @@ discard block |
||
2428 | 2436 | $max_score_item_view = $row_max_score['max_score_item_view']; |
2429 | 2437 | $score = $row_max_score['score']; |
2430 | 2438 | |
2431 | - if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2439 | + if ($debug) { |
|
2440 | + echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2441 | + } |
|
2432 | 2442 | |
2433 | 2443 | if ($row_max_score['item_type'] == 'sco') { |
2434 | 2444 | /* Check if it is sco (easier to get max_score) |
@@ -2448,7 +2458,9 @@ discard block |
||
2448 | 2458 | if (!empty($max_score)) { |
2449 | 2459 | $lp_partial_total += $score/$max_score; |
2450 | 2460 | } |
2451 | - if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2461 | + if ($debug) { |
|
2462 | + echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2463 | + } |
|
2452 | 2464 | } else { |
2453 | 2465 | // Case of a TOOL_QUIZ element |
2454 | 2466 | $item_id = $row_max_score['iid']; |
@@ -2470,12 +2482,16 @@ discard block |
||
2470 | 2482 | ORDER BY exe_date DESC |
2471 | 2483 | LIMIT 1"; |
2472 | 2484 | |
2473 | - if ($debug) echo $sql .'<br />'; |
|
2485 | + if ($debug) { |
|
2486 | + echo $sql .'<br />'; |
|
2487 | + } |
|
2474 | 2488 | $result_last_attempt = Database::query($sql); |
2475 | 2489 | $num = Database :: num_rows($result_last_attempt); |
2476 | 2490 | if ($num > 0 ) { |
2477 | 2491 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
2478 | - if ($debug) echo $id_last_attempt.'<br />'; |
|
2492 | + if ($debug) { |
|
2493 | + echo $id_last_attempt.'<br />'; |
|
2494 | + } |
|
2479 | 2495 | |
2480 | 2496 | // Within the last attempt number tracking, get the sum of |
2481 | 2497 | // the max_scores of all questions that it was |
@@ -2494,7 +2510,9 @@ discard block |
||
2494 | 2510 | q.c_id = $course_id |
2495 | 2511 | ) |
2496 | 2512 | AS t"; |
2497 | - if ($debug) echo '$sql: '.$sql.' <br />'; |
|
2513 | + if ($debug) { |
|
2514 | + echo '$sql: '.$sql.' <br />'; |
|
2515 | + } |
|
2498 | 2516 | $res_max_score_bis = Database::query($sql); |
2499 | 2517 | $row_max_score_bis = Database::fetch_array($res_max_score_bis); |
2500 | 2518 | |
@@ -2504,7 +2522,9 @@ discard block |
||
2504 | 2522 | if (!empty($max_score) && floatval($max_score) > 0) { |
2505 | 2523 | $lp_partial_total += $score/$max_score; |
2506 | 2524 | } |
2507 | - if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2525 | + if ($debug) { |
|
2526 | + echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2527 | + } |
|
2508 | 2528 | } |
2509 | 2529 | } |
2510 | 2530 | |
@@ -2517,17 +2537,25 @@ discard block |
||
2517 | 2537 | $count_items++; |
2518 | 2538 | } |
2519 | 2539 | } |
2520 | - if ($debug) echo '$count_items: '.$count_items; |
|
2540 | + if ($debug) { |
|
2541 | + echo '$count_items: '.$count_items; |
|
2542 | + } |
|
2521 | 2543 | } |
2522 | 2544 | } //end for |
2523 | 2545 | |
2524 | 2546 | $score_of_scorm_calculate += $count_items ? (($lp_partial_total / $count_items) * 100) : 0; |
2525 | 2547 | |
2526 | - if ($debug) echo '<h3>$count_items '.$count_items.'</h3>'; |
|
2527 | - if ($debug) echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>'; |
|
2548 | + if ($debug) { |
|
2549 | + echo '<h3>$count_items '.$count_items.'</h3>'; |
|
2550 | + } |
|
2551 | + if ($debug) { |
|
2552 | + echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>'; |
|
2553 | + } |
|
2528 | 2554 | |
2529 | 2555 | $global_result += $score_of_scorm_calculate; |
2530 | - if ($debug) echo '<h3>$global_result '.$global_result.'</h3>'; |
|
2556 | + if ($debug) { |
|
2557 | + echo '<h3>$global_result '.$global_result.'</h3>'; |
|
2558 | + } |
|
2531 | 2559 | } // end while |
2532 | 2560 | } |
2533 | 2561 | |
@@ -2540,7 +2568,9 @@ discard block |
||
2540 | 2568 | c_id = $course_id AND |
2541 | 2569 | (item_type = 'quiz' OR item_type = 'sco') AND |
2542 | 2570 | lp_id = ".$lp_id; |
2543 | - if ($debug) echo $sql; |
|
2571 | + if ($debug) { |
|
2572 | + echo $sql; |
|
2573 | + } |
|
2544 | 2574 | $result_have_quiz = Database::query($sql); |
2545 | 2575 | |
2546 | 2576 | if (Database::num_rows($result_have_quiz) > 0 ) { |
@@ -2551,19 +2581,29 @@ discard block |
||
2551 | 2581 | } |
2552 | 2582 | } |
2553 | 2583 | |
2554 | - if ($debug) echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>'; |
|
2555 | - if ($debug) echo '<h3>Final return</h3>'; |
|
2584 | + if ($debug) { |
|
2585 | + echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>'; |
|
2586 | + } |
|
2587 | + if ($debug) { |
|
2588 | + echo '<h3>Final return</h3>'; |
|
2589 | + } |
|
2556 | 2590 | |
2557 | 2591 | if ($lp_with_quiz != 0) { |
2558 | 2592 | if (!$return_array) { |
2559 | 2593 | $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2); |
2560 | - if ($debug) var_dump($score_of_scorm_calculate); |
|
2594 | + if ($debug) { |
|
2595 | + var_dump($score_of_scorm_calculate); |
|
2596 | + } |
|
2561 | 2597 | if (empty($lp_ids)) { |
2562 | - if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
|
2598 | + if ($debug) { |
|
2599 | + echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
|
2600 | + } |
|
2563 | 2601 | } |
2564 | 2602 | return $score_of_scorm_calculate; |
2565 | 2603 | } else { |
2566 | - if ($debug) var_dump($global_result, $lp_with_quiz); |
|
2604 | + if ($debug) { |
|
2605 | + var_dump($global_result, $lp_with_quiz); |
|
2606 | + } |
|
2567 | 2607 | return array($global_result, $lp_with_quiz); |
2568 | 2608 | } |
2569 | 2609 | } else { |
@@ -3050,11 +3090,13 @@ discard block |
||
3050 | 3090 | |
3051 | 3091 | if (!empty ($id_session)) { |
3052 | 3092 | $sql .= ' WHERE session_course.session_id=' . $id_session; |
3053 | - if (api_is_multiple_url_enabled()) |
|
3054 | - $sql .= ' AND access_url_id = '.$access_url_id; |
|
3055 | - } else { |
|
3056 | - if (api_is_multiple_url_enabled()) |
|
3057 | - $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3093 | + if (api_is_multiple_url_enabled()) { |
|
3094 | + $sql .= ' AND access_url_id = '.$access_url_id; |
|
3095 | + } |
|
3096 | + } else { |
|
3097 | + if (api_is_multiple_url_enabled()) { |
|
3098 | + $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3099 | + } |
|
3058 | 3100 | } |
3059 | 3101 | |
3060 | 3102 | $result = Database::query($sql); |
@@ -3162,8 +3204,7 @@ discard block |
||
3162 | 3204 | if ($session['access_start_date'] == '0000-00-00 00:00:00' || empty($session['access_start_date']) |
3163 | 3205 | ) { |
3164 | 3206 | $session['status'] = get_lang('SessionActive'); |
3165 | - } |
|
3166 | - else { |
|
3207 | + } else { |
|
3167 | 3208 | $time_start = api_strtotime($session['access_start_date'], 'UTC'); |
3168 | 3209 | $time_end = api_strtotime($session['access_end_date'], 'UTC'); |
3169 | 3210 | if ($time_start < time() && time() < $time_end) { |
@@ -6599,8 +6640,9 @@ discard block |
||
6599 | 6640 | if (is_array($hpresults)) { |
6600 | 6641 | for($i = 0; $i < sizeof($hpresults); $i++) { |
6601 | 6642 | $title = GetQuizName($hpresults[$i][0],''); |
6602 | - if ($title == '') |
|
6603 | - $title = basename($hpresults[$i][0]); |
|
6643 | + if ($title == '') { |
|
6644 | + $title = basename($hpresults[$i][0]); |
|
6645 | + } |
|
6604 | 6646 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
6605 | 6647 | ?> |
6606 | 6648 | <tr> |
@@ -6972,8 +7014,9 @@ discard block |
||
6972 | 7014 | for($i = 0; $i < sizeof($hpresults); $i++) { |
6973 | 7015 | $title = GetQuizName($hpresults[$i][0],''); |
6974 | 7016 | |
6975 | - if ($title == '') |
|
6976 | - $title = basename($hpresults[$i][0]); |
|
7017 | + if ($title == '') { |
|
7018 | + $title = basename($hpresults[$i][0]); |
|
7019 | + } |
|
6977 | 7020 | |
6978 | 7021 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
6979 | 7022 |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $extendedAttempt = null, |
112 | 112 | $extendedAll = null, |
113 | 113 | $type = 'classic', |
114 | - $allowExtend = true |
|
114 | + $allowExtend = true |
|
115 | 115 | ) { |
116 | 116 | if (empty($courseInfo) || empty($lp_id)) { |
117 | 117 | return null; |
@@ -135,22 +135,22 @@ discard block |
||
135 | 135 | $extend_all = 0; |
136 | 136 | |
137 | 137 | if ($origin == 'tracking') { |
138 | - $url_suffix = '&session_id=' . $session_id . '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . $lp_id . '&origin=' . $origin; |
|
138 | + $url_suffix = '&session_id='.$session_id.'&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.$lp_id.'&origin='.$origin; |
|
139 | 139 | } else { |
140 | - $url_suffix = '&lp_id=' . $lp_id; |
|
140 | + $url_suffix = '&lp_id='.$lp_id; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | if (!empty($extendedAll)) { |
144 | 144 | $extend_all_link = Display::url( |
145 | 145 | Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), |
146 | - api_get_self() . '?action=stats' . $url_suffix |
|
146 | + api_get_self().'?action=stats'.$url_suffix |
|
147 | 147 | ); |
148 | 148 | |
149 | 149 | $extend_all = 1; |
150 | 150 | } else { |
151 | 151 | $extend_all_link = Display::url( |
152 | 152 | Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttempts')), |
153 | - api_get_self() . '?action=stats&extend_all=1' . $url_suffix |
|
153 | + api_get_self().'?action=stats&extend_all=1'.$url_suffix |
|
154 | 154 | ); |
155 | 155 | } |
156 | 156 | |
@@ -162,24 +162,24 @@ discard block |
||
162 | 162 | |
163 | 163 | $actionColumn = null; |
164 | 164 | if ($type == 'classic') { |
165 | - $actionColumn = ' <th>' . get_lang('Actions') . '</th>'; |
|
165 | + $actionColumn = ' <th>'.get_lang('Actions').'</th>'; |
|
166 | 166 | } |
167 | 167 | $output .= '<div class="table-responsive">'; |
168 | 168 | $output .= '<table class="table tracking"> |
169 | 169 | <thead> |
170 | 170 | <tr class="table-header"> |
171 | - <th width="16">' . ($allowExtend == true ? $extend_all_link : ' ') . '</th> |
|
171 | + <th width="16">' . ($allowExtend == true ? $extend_all_link : ' ').'</th> |
|
172 | 172 | <th colspan="4"> |
173 | - ' . get_lang('ScormLessonTitle') .' |
|
173 | + ' . get_lang('ScormLessonTitle').' |
|
174 | 174 | </th> |
175 | 175 | <th colspan="2"> |
176 | - ' . get_lang('ScormStatus') . ' |
|
176 | + ' . get_lang('ScormStatus').' |
|
177 | 177 | </th> |
178 | 178 | <th colspan="2"> |
179 | - ' . get_lang('ScormScore') . ' |
|
179 | + ' . get_lang('ScormScore').' |
|
180 | 180 | </th> |
181 | 181 | <th colspan="2"> |
182 | - ' . get_lang('ScormTime') . ' |
|
182 | + ' . get_lang('ScormTime').' |
|
183 | 183 | </th> |
184 | 184 | '.$actionColumn.' |
185 | 185 | </tr> |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | // Prepare statement to go through each attempt. |
243 | 243 | $viewCondition = null; |
244 | 244 | if (!empty($view)) { |
245 | - $viewCondition = " AND v.view_count = $view "; |
|
245 | + $viewCondition = " AND v.view_count = $view "; |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | $sql = "SELECT |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | FROM $TBL_QUIZ |
291 | 291 | WHERE |
292 | 292 | c_id = $course_id AND |
293 | - id ='" . $my_path . "'"; |
|
293 | + id ='".$my_path."'"; |
|
294 | 294 | $res_result_disabled = Database::query($sql); |
295 | 295 | $row_result_disabled = Database::fetch_row($res_result_disabled); |
296 | 296 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | if (!empty($inter_num)) { |
313 | 313 | $extend_link = Display::url( |
314 | 314 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
315 | - api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
315 | + api_get_self().'?action=stats&fold_id='.$my_item_id.$url_suffix |
|
316 | 316 | ); |
317 | 317 | } |
318 | 318 | $title = $row['mytitle']; |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | $action = null; |
332 | 332 | if ($type == 'classic') { |
333 | - $action = '<td></td>'; |
|
333 | + $action = '<td></td>'; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | if (in_array($row['item_type'], $chapterTypes)) { |
@@ -374,13 +374,13 @@ discard block |
||
374 | 374 | $extend_this_attempt = 1; |
375 | 375 | $extend_attempt_link = Display::url( |
376 | 376 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
377 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix |
|
377 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix |
|
378 | 378 | ); |
379 | 379 | } else { // Same case if fold_attempt_id is set, so not implemented explicitly. |
380 | 380 | // The extend button for this attempt has not been clicked. |
381 | 381 | $extend_attempt_link = Display::url( |
382 | 382 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
383 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
383 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
384 | 384 | ); |
385 | 385 | } |
386 | 386 | } |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | } |
414 | 414 | |
415 | 415 | // Remove "NaN" if any (@todo: locate the source of these NaN) |
416 | - $time = str_replace('NaN', '00' . $h . '00\'00"', $time); |
|
416 | + $time = str_replace('NaN', '00'.$h.'00\'00"', $time); |
|
417 | 417 | |
418 | 418 | if ($row['item_type'] != 'dokeos_chapter') { |
419 | 419 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
@@ -441,13 +441,13 @@ discard block |
||
441 | 441 | $action = '<td></td>'; |
442 | 442 | } |
443 | 443 | |
444 | - $output .= '<tr class="' . $oddclass . '"> |
|
444 | + $output .= '<tr class="'.$oddclass.'"> |
|
445 | 445 | <td></td> |
446 | - <td>' . $extend_attempt_link . '</td> |
|
447 | - <td colspan="3">' . get_lang('Attempt') . ' ' . $attemptCount . '</td> |
|
448 | - <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type) . '</td> |
|
449 | - <td colspan="2">' . $view_score . '</td> |
|
450 | - <td colspan="2">' . $time . '</td> |
|
446 | + <td>' . $extend_attempt_link.'</td> |
|
447 | + <td colspan="3">' . get_lang('Attempt').' '.$attemptCount.'</td> |
|
448 | + <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type).'</td> |
|
449 | + <td colspan="2">' . $view_score.'</td> |
|
450 | + <td colspan="2">' . $time.'</td> |
|
451 | 451 | '.$action.' |
452 | 452 | </tr>'; |
453 | 453 | $attemptCount++; |
@@ -460,10 +460,10 @@ discard block |
||
460 | 460 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
461 | 461 | $temp[] = '/'; |
462 | 462 | } else { |
463 | - $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
463 | + $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
464 | 464 | } |
465 | 465 | } else { |
466 | - $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
466 | + $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
467 | 467 | } |
468 | 468 | $temp[] = $time; |
469 | 469 | $csv_content[] = $temp; |
@@ -500,13 +500,13 @@ discard block |
||
500 | 500 | <td></td> |
501 | 501 | <td></td> |
502 | 502 | <td></td> |
503 | - <td>'.$interaction['order_id'] . '</td> |
|
504 | - <td>'.$interaction['id'] . '</td> |
|
503 | + <td>'.$interaction['order_id'].'</td> |
|
504 | + <td>'.$interaction['id'].'</td> |
|
505 | 505 | <td colspan="2">' . $interaction['type'].'</td> |
506 | - <td>'.$student_response . '</td> |
|
507 | - <td>'.$interaction['result'] . '</td> |
|
508 | - <td>'.$interaction['latency'] . '</td> |
|
509 | - <td>'.$interaction['time'] . '</td> |
|
506 | + <td>'.$student_response.'</td> |
|
507 | + <td>'.$interaction['result'].'</td> |
|
508 | + <td>'.$interaction['latency'].'</td> |
|
509 | + <td>'.$interaction['time'].'</td> |
|
510 | 510 | '.$action.' |
511 | 511 | </tr>'; |
512 | 512 | $counter++; |
@@ -523,12 +523,12 @@ discard block |
||
523 | 523 | <td></td> |
524 | 524 | <td></td> |
525 | 525 | <td></td> |
526 | - <td>' . $interaction['order_id'] . '</td> |
|
527 | - <td colspan="2">' . $interaction['objective_id'] . '</td> |
|
528 | - <td colspan="2">' . $interaction['status'] .'</td> |
|
529 | - <td>' . $interaction['score_raw'] . '</td> |
|
530 | - <td>' . $interaction['score_max'] . '</td> |
|
531 | - <td>' . $interaction['score_min'] . '</td> |
|
526 | + <td>' . $interaction['order_id'].'</td> |
|
527 | + <td colspan="2">' . $interaction['objective_id'].'</td> |
|
528 | + <td colspan="2">' . $interaction['status'].'</td> |
|
529 | + <td>' . $interaction['score_raw'].'</td> |
|
530 | + <td>' . $interaction['score_max'].'</td> |
|
531 | + <td>' . $interaction['score_min'].'</td> |
|
532 | 532 | '.$action.' |
533 | 533 | </tr>'; |
534 | 534 | $counter++; |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | $my_path = Database::escape_string($my_path); |
552 | 552 | $sql = "SELECT results_disabled |
553 | 553 | FROM $TBL_QUIZ |
554 | - WHERE c_id = $course_id AND id ='" . $my_path . "'"; |
|
554 | + WHERE c_id = $course_id AND id ='".$my_path."'"; |
|
555 | 555 | $res_result_disabled = Database::query($sql); |
556 | 556 | $row_result_disabled = Database::fetch_row($res_result_disabled); |
557 | 557 | |
@@ -575,14 +575,14 @@ discard block |
||
575 | 575 | $extend_this_attempt = 1; |
576 | 576 | $extend_attempt_link = Display::url( |
577 | 577 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
578 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix |
|
578 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix |
|
579 | 579 | ); |
580 | 580 | } else { |
581 | 581 | // Same case if fold_attempt_id is set, so not implemented explicitly. |
582 | 582 | // The extend button for this attempt has not been clicked. |
583 | 583 | $extend_attempt_link = Display::url( |
584 | 584 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
585 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
585 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
586 | 586 | ); |
587 | 587 | } |
588 | 588 | } |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | if ($inter_num > 1) { |
598 | 598 | $extend_link = Display::url( |
599 | 599 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
600 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
600 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
601 | 601 | ); |
602 | 602 | } |
603 | 603 | |
@@ -613,15 +613,15 @@ discard block |
||
613 | 613 | |
614 | 614 | // Selecting the exe_id from stats attempts tables in order to look the max score value. |
615 | 615 | |
616 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
616 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
617 | 617 | WHERE |
618 | - exe_exo_id="' . $row['path'] . '" AND |
|
619 | - exe_user_id="' . $user_id . '" AND |
|
620 | - orig_lp_id = "' . $lp_id . '" AND |
|
621 | - orig_lp_item_id = "' . $row['myid'] . '" AND |
|
622 | - c_id = ' . $course_id . ' AND |
|
618 | + exe_exo_id="' . $row['path'].'" AND |
|
619 | + exe_user_id="' . $user_id.'" AND |
|
620 | + orig_lp_id = "' . $lp_id.'" AND |
|
621 | + orig_lp_item_id = "' . $row['myid'].'" AND |
|
622 | + c_id = ' . $course_id.' AND |
|
623 | 623 | status <> "incomplete" AND |
624 | - session_id = ' . $session_id . ' |
|
624 | + session_id = ' . $session_id.' |
|
625 | 625 | ORDER BY exe_date DESC |
626 | 626 | LIMIT 1'; |
627 | 627 | |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | FROM $TBL_LP_ITEM_VIEW |
653 | 653 | WHERE |
654 | 654 | c_id = $course_id AND |
655 | - lp_item_id = '" . (int) $my_id . "' AND |
|
656 | - lp_view_id = '" . (int) $my_lp_view_id . "' |
|
655 | + lp_item_id = '".(int) $my_id."' AND |
|
656 | + lp_view_id = '" . (int) $my_lp_view_id."' |
|
657 | 657 | ORDER BY view_count DESC limit 1"; |
658 | 658 | $res_score = Database::query($sql); |
659 | 659 | $row_score = Database::fetch_array($res_score); |
@@ -662,8 +662,8 @@ discard block |
||
662 | 662 | FROM $TBL_LP_ITEM_VIEW |
663 | 663 | WHERE |
664 | 664 | c_id = $course_id AND |
665 | - lp_item_id = '" . (int) $my_id . "' AND |
|
666 | - lp_view_id = '" . (int) $my_lp_view_id . "'"; |
|
665 | + lp_item_id = '".(int) $my_id."' AND |
|
666 | + lp_view_id = '" . (int) $my_lp_view_id."'"; |
|
667 | 667 | $res_time = Database::query($sql); |
668 | 668 | $row_time = Database::fetch_array($res_time); |
669 | 669 | |
@@ -722,16 +722,16 @@ discard block |
||
722 | 722 | } else { |
723 | 723 | $correct_test_link = '-'; |
724 | 724 | if ($row['item_type'] == 'quiz') { |
725 | - $my_url_suffix = '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . intval($row['mylpid']) . '&origin=' . $origin; |
|
726 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
725 | + $my_url_suffix = '&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.intval($row['mylpid']).'&origin='.$origin; |
|
726 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
727 | 727 | WHERE |
728 | - exe_exo_id="' . $row['path'] . '" AND |
|
729 | - exe_user_id="' . $user_id . '" AND |
|
730 | - orig_lp_id = "' . $lp_id . '" AND |
|
731 | - orig_lp_item_id = "' . $row['myid'] . '" AND |
|
732 | - c_id = ' . $course_id . ' AND |
|
728 | + exe_exo_id="' . $row['path'].'" AND |
|
729 | + exe_user_id="' . $user_id.'" AND |
|
730 | + orig_lp_id = "' . $lp_id.'" AND |
|
731 | + orig_lp_item_id = "' . $row['myid'].'" AND |
|
732 | + c_id = ' . $course_id.' AND |
|
733 | 733 | status <> "incomplete" AND |
734 | - session_id = ' . $session_id . ' |
|
734 | + session_id = ' . $session_id.' |
|
735 | 735 | ORDER BY exe_date DESC '; |
736 | 736 | |
737 | 737 | $resultLastAttempt = Database::query($sql); |
@@ -743,12 +743,12 @@ discard block |
||
743 | 743 | ) { |
744 | 744 | $correct_test_link = Display::url( |
745 | 745 | Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), |
746 | - api_get_self() . '?action=stats' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id |
|
746 | + api_get_self().'?action=stats'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id |
|
747 | 747 | ); |
748 | 748 | } else { |
749 | 749 | $correct_test_link = Display::url( |
750 | 750 | Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttemptsByExercise')), |
751 | - api_get_self() . '?action=stats&extend_attempt=1' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id |
|
751 | + api_get_self().'?action=stats&extend_attempt=1'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id |
|
752 | 752 | ); |
753 | 753 | } |
754 | 754 | } |
@@ -758,14 +758,14 @@ discard block |
||
758 | 758 | |
759 | 759 | $action = null; |
760 | 760 | if ($type == 'classic') { |
761 | - $action = '<td>' . $correct_test_link . '</td>'; |
|
761 | + $action = '<td>'.$correct_test_link.'</td>'; |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | if ($lp_id == $my_lp_id && false) { |
765 | 765 | |
766 | - $output .= '<tr class =' . $oddclass . '> |
|
767 | - <td>' . $extend_link . '</td> |
|
768 | - <td colspan="4">' . $title . '</td> |
|
766 | + $output .= '<tr class ='.$oddclass.'> |
|
767 | + <td>' . $extend_link.'</td> |
|
768 | + <td colspan="4">' . $title.'</td> |
|
769 | 769 | <td colspan="2"> </td> |
770 | 770 | <td colspan="2"> </td> |
771 | 771 | <td colspan="2"> </td> |
@@ -790,13 +790,13 @@ discard block |
||
790 | 790 | $scoreItem .= ExerciseLib::show_score($score, $maxscore, false); |
791 | 791 | } |
792 | 792 | } else { |
793 | - $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore); |
|
793 | + $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.$maxscore); |
|
794 | 794 | } |
795 | 795 | |
796 | 796 | $output .= ' |
797 | 797 | <td>'.$extend_link.'</td> |
798 | - <td colspan="4">' . $title . '</td> |
|
799 | - <td colspan="2">' . learnpathitem::humanize_status($lesson_status) .'</td> |
|
798 | + <td colspan="4">' . $title.'</td> |
|
799 | + <td colspan="2">' . learnpathitem::humanize_status($lesson_status).'</td> |
|
800 | 800 | <td colspan="2">'.$scoreItem.'</td> |
801 | 801 | <td colspan="2">'.$time.'</td> |
802 | 802 | '.$action.' |
@@ -813,10 +813,10 @@ discard block |
||
813 | 813 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
814 | 814 | $temp[] = '/'; |
815 | 815 | } else { |
816 | - $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
816 | + $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
817 | 817 | } |
818 | 818 | } else { |
819 | - $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
819 | + $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
820 | 820 | } |
821 | 821 | $temp[] = $time; |
822 | 822 | $csv_content[] = $temp; |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | |
828 | 828 | $action = null; |
829 | 829 | if ($type == 'classic') { |
830 | - $action = '<td></td>'; |
|
830 | + $action = '<td></td>'; |
|
831 | 831 | } |
832 | 832 | |
833 | 833 | if ($extend_this_attempt || $extend_all) { |
@@ -864,11 +864,11 @@ discard block |
||
864 | 864 | <td></td> |
865 | 865 | <td></td> |
866 | 866 | <td></td> |
867 | - <td>' . $interaction['order_id'] . '</td> |
|
868 | - <td colspan="2">'.$interaction['objective_id'] . '</td> |
|
869 | - <td colspan="2">' . $interaction['status'] . '</td> |
|
867 | + <td>' . $interaction['order_id'].'</td> |
|
868 | + <td colspan="2">'.$interaction['objective_id'].'</td> |
|
869 | + <td colspan="2">' . $interaction['status'].'</td> |
|
870 | 870 | <td>' . $interaction['score_raw'].'</td> |
871 | - <td>' . $interaction['score_max'] .'</td> |
|
871 | + <td>' . $interaction['score_max'].'</td> |
|
872 | 872 | <td>' . $interaction['score_min'].'</td> |
873 | 873 | '.$action.' |
874 | 874 | </tr>'; |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | } |
878 | 878 | |
879 | 879 | // Attempts listing by exercise. |
880 | - if ($lp_id == $my_lp_id && $lp_item_id== $my_id && $extendedAttempt) { |
|
880 | + if ($lp_id == $my_lp_id && $lp_item_id == $my_id && $extendedAttempt) { |
|
881 | 881 | // Get attempts of a exercise. |
882 | 882 | if (!empty($lp_id) && |
883 | 883 | !empty($lp_item_id) && |
@@ -892,15 +892,15 @@ discard block |
||
892 | 892 | $row_path = Database::fetch_array($res_path); |
893 | 893 | |
894 | 894 | if (Database::num_rows($res_path) > 0) { |
895 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
895 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
896 | 896 | WHERE |
897 | - exe_exo_id="' . (int) $row_path['path'] . '" AND |
|
897 | + exe_exo_id="' . (int) $row_path['path'].'" AND |
|
898 | 898 | status <> "incomplete" AND |
899 | - exe_user_id="' . $user_id . '" AND |
|
900 | - orig_lp_id = "' . (int) $lp_id . '" AND |
|
901 | - orig_lp_item_id = "' . (int) $lp_item_id . '" AND |
|
902 | - c_id = ' . $course_id . ' AND |
|
903 | - session_id = ' . $session_id . ' |
|
899 | + exe_user_id="' . $user_id.'" AND |
|
900 | + orig_lp_id = "' . (int) $lp_id.'" AND |
|
901 | + orig_lp_item_id = "' . (int) $lp_item_id.'" AND |
|
902 | + c_id = ' . $course_id.' AND |
|
903 | + session_id = ' . $session_id.' |
|
904 | 904 | ORDER BY exe_date'; |
905 | 905 | $res_attempts = Database::query($sql); |
906 | 906 | $num_attempts = Database::num_rows($res_attempts); |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | if ($mktime_start_date && $mktime_exe_date) { |
919 | 919 | $mytime = ((int) $mktime_exe_date - (int) $mktime_start_date); |
920 | 920 | $time_attemp = learnpathItem :: getScormTimeFromParameter('js', $mytime); |
921 | - $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); |
|
921 | + $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp); |
|
922 | 922 | } else { |
923 | 923 | $time_attemp = ' - '; |
924 | 924 | } |
@@ -944,33 +944,33 @@ discard block |
||
944 | 944 | $my_lesson_status = learnpathitem::humanize_status('incomplete'); |
945 | 945 | } |
946 | 946 | |
947 | - $output .= '<tr class="' . $oddclass . '" > |
|
947 | + $output .= '<tr class="'.$oddclass.'" > |
|
948 | 948 | <td></td> |
949 | - <td>' . $extend_attempt_link . '</td> |
|
950 | - <td colspan="3">' . get_lang('Attempt').' '. $n.'</td> |
|
951 | - <td colspan="2">' . $my_lesson_status . '</td> |
|
952 | - <td colspan="2">'.$view_score . '</td> |
|
953 | - <td colspan="2">'.$time_attemp . '</td>'; |
|
949 | + <td>' . $extend_attempt_link.'</td> |
|
950 | + <td colspan="3">' . get_lang('Attempt').' '.$n.'</td> |
|
951 | + <td colspan="2">' . $my_lesson_status.'</td> |
|
952 | + <td colspan="2">'.$view_score.'</td> |
|
953 | + <td colspan="2">'.$time_attemp.'</td>'; |
|
954 | 954 | if ($action == 'classic') { |
955 | 955 | if ($origin != 'tracking') { |
956 | 956 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
957 | 957 | $output .= '<td> |
958 | - <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"> |
|
958 | + <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"> |
|
959 | 959 | </td>'; |
960 | 960 | } else { |
961 | 961 | $output .= '<td> |
962 | - <a href="../exercice/exercise_show.php?origin=' . $origin . '&id=' . $my_exe_id . '&cidReq=' . $courseCode . '" target="_parent"> |
|
963 | - <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"> |
|
962 | + <a href="../exercice/exercise_show.php?origin=' . $origin.'&id='.$my_exe_id.'&cidReq='.$courseCode.'" target="_parent"> |
|
963 | + <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"> |
|
964 | 964 | </a></td>'; |
965 | 965 | } |
966 | 966 | } else { |
967 | 967 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
968 | 968 | $output .= '<td> |
969 | - <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></td>'; |
|
969 | + <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></td>'; |
|
970 | 970 | } else { |
971 | 971 | $output .= '<td> |
972 | - <a href="../exercice/exercise_show.php?cidReq=' . $courseCode . '&origin=correct_exercise_in_lp&id=' . $my_exe_id . '" target="_parent"> |
|
973 | - <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></a></td>'; |
|
972 | + <a href="../exercice/exercise_show.php?cidReq=' . $courseCode.'&origin=correct_exercise_in_lp&id='.$my_exe_id.'" target="_parent"> |
|
973 | + <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></a></td>'; |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | } |
@@ -1029,13 +1029,13 @@ discard block |
||
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | $total_time = learnpathItem::getScormTimeFromParameter('js', $total_time); |
1032 | - $total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time); |
|
1032 | + $total_time = str_replace('NaN', '00'.$h.'00\'00"', $total_time); |
|
1033 | 1033 | |
1034 | 1034 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
1035 | 1035 | $final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); |
1036 | 1036 | } else { |
1037 | 1037 | if (is_numeric($total_score)) { |
1038 | - $final_score = $total_score . '%'; |
|
1038 | + $final_score = $total_score.'%'; |
|
1039 | 1039 | } else { |
1040 | 1040 | $final_score = $total_score; |
1041 | 1041 | } |
@@ -1051,19 +1051,19 @@ discard block |
||
1051 | 1051 | |
1052 | 1052 | $action = null; |
1053 | 1053 | if ($type == 'classic') { |
1054 | - $action = '<td></td>'; |
|
1054 | + $action = '<td></td>'; |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | $output .= '<tr class="'.$oddclass.'"> |
1058 | 1058 | <td></td> |
1059 | 1059 | <td colspan="4"> |
1060 | - <i>' . get_lang('AccomplishedStepsTotal') .'</i> |
|
1060 | + <i>' . get_lang('AccomplishedStepsTotal').'</i> |
|
1061 | 1061 | </td> |
1062 | 1062 | <td colspan="2">'.$progress.'%</td> |
1063 | 1063 | <td colspan="2"> |
1064 | 1064 | ' . $final_score.' |
1065 | 1065 | </td> |
1066 | - <td colspan="2">' . $total_time . '</div> |
|
1066 | + <td colspan="2">' . $total_time.'</div> |
|
1067 | 1067 | '.$action.' |
1068 | 1068 | </tr>'; |
1069 | 1069 | |
@@ -1359,7 +1359,7 @@ discard block |
||
1359 | 1359 | $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
1360 | 1360 | if (is_array($user_id)) { |
1361 | 1361 | $user_id = array_map('intval', $user_id); |
1362 | - $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1362 | + $condition_user = " AND user_id IN (".implode(',', $user_id).") "; |
|
1363 | 1363 | } else { |
1364 | 1364 | $user_id = intval($user_id); |
1365 | 1365 | $condition_user = " AND user_id = $user_id "; |
@@ -1396,13 +1396,13 @@ discard block |
||
1396 | 1396 | { |
1397 | 1397 | $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
1398 | 1398 | $sql = 'SELECT login_date |
1399 | - FROM ' . $tbl_track_login . ' |
|
1400 | - WHERE login_user_id = ' . intval($student_id) . ' |
|
1399 | + FROM ' . $tbl_track_login.' |
|
1400 | + WHERE login_user_id = ' . intval($student_id).' |
|
1401 | 1401 | ORDER BY login_date ASC |
1402 | 1402 | LIMIT 0,1'; |
1403 | 1403 | |
1404 | 1404 | $rs = Database::query($sql); |
1405 | - if (Database::num_rows($rs)>0) { |
|
1405 | + if (Database::num_rows($rs) > 0) { |
|
1406 | 1406 | if ($first_login_date = Database::result($rs, 0, 0)) { |
1407 | 1407 | return api_convert_and_format_date( |
1408 | 1408 | $first_login_date, |
@@ -1427,8 +1427,8 @@ discard block |
||
1427 | 1427 | { |
1428 | 1428 | $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
1429 | 1429 | $sql = 'SELECT login_date |
1430 | - FROM ' . $table . ' |
|
1431 | - WHERE login_user_id = ' . intval($student_id) . ' |
|
1430 | + FROM ' . $table.' |
|
1431 | + WHERE login_user_id = ' . intval($student_id).' |
|
1432 | 1432 | ORDER BY login_date |
1433 | 1433 | DESC LIMIT 0,1'; |
1434 | 1434 | |
@@ -1437,18 +1437,18 @@ discard block |
||
1437 | 1437 | if ($last_login_date = Database::result($rs, 0, 0)) { |
1438 | 1438 | $last_login_date = api_get_local_time($last_login_date); |
1439 | 1439 | if ($return_timestamp) { |
1440 | - return api_strtotime($last_login_date,'UTC'); |
|
1440 | + return api_strtotime($last_login_date, 'UTC'); |
|
1441 | 1441 | } else { |
1442 | 1442 | if (!$warning_message) { |
1443 | 1443 | return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
1444 | 1444 | } else { |
1445 | - $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1445 | + $timestamp = api_strtotime($last_login_date, 'UTC'); |
|
1446 | 1446 | $currentTimestamp = time(); |
1447 | 1447 | |
1448 | 1448 | //If the last connection is > than 7 days, the text is red |
1449 | 1449 | //345600 = 7 days in seconds |
1450 | 1450 | if ($currentTimestamp - $timestamp > 604800) { |
1451 | - return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1451 | + return '<span style="color: #F00;">'.api_format_date($last_login_date, DATE_FORMAT_SHORT).'</span>'; |
|
1452 | 1452 | } else { |
1453 | 1453 | return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
1454 | 1454 | } |
@@ -1483,7 +1483,7 @@ discard block |
||
1483 | 1483 | $sql = "$select |
1484 | 1484 | FROM $tbl_track_login |
1485 | 1485 | WHERE |
1486 | - login_user_id IN (' ". implode("','", $studentList) . "' ) AND |
|
1486 | + login_user_id IN (' ".implode("','", $studentList)."' ) AND |
|
1487 | 1487 | login_date < '$date' |
1488 | 1488 | "; |
1489 | 1489 | $rs = Database::query($sql); |
@@ -1582,7 +1582,7 @@ discard block |
||
1582 | 1582 | '.Display::return_icon('messagebox_warning.gif').' |
1583 | 1583 | </a>' |
1584 | 1584 | : null; |
1585 | - return $icon. Display::label($last_login_date, 'warning'); |
|
1585 | + return $icon.Display::label($last_login_date, 'warning'); |
|
1586 | 1586 | } else { |
1587 | 1587 | return $last_login_date; |
1588 | 1588 | } |
@@ -1632,7 +1632,7 @@ discard block |
||
1632 | 1632 | session_id = $session_id |
1633 | 1633 | $month_filter"; |
1634 | 1634 | $rs = Database::query($sql); |
1635 | - if (Database::num_rows($rs)>0) { |
|
1635 | + if (Database::num_rows($rs) > 0) { |
|
1636 | 1636 | $row = Database::fetch_object($rs); |
1637 | 1637 | $count = $row->count_connections; |
1638 | 1638 | } |
@@ -1653,14 +1653,14 @@ discard block |
||
1653 | 1653 | $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
1654 | 1654 | |
1655 | 1655 | $sql = 'SELECT DISTINCT c_id |
1656 | - FROM ' . $tbl_course_rel_user . ' |
|
1656 | + FROM ' . $tbl_course_rel_user.' |
|
1657 | 1657 | WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH; |
1658 | 1658 | $rs = Database::query($sql); |
1659 | 1659 | $nb_courses = Database::num_rows($rs); |
1660 | 1660 | |
1661 | 1661 | if ($include_sessions) { |
1662 | 1662 | $sql = 'SELECT DISTINCT c_id |
1663 | - FROM ' . $tbl_session_course_rel_user . ' |
|
1663 | + FROM ' . $tbl_session_course_rel_user.' |
|
1664 | 1664 | WHERE user_id = ' . $user_id; |
1665 | 1665 | $rs = Database::query($sql); |
1666 | 1666 | $nb_courses += Database::num_rows($rs); |
@@ -1707,7 +1707,7 @@ discard block |
||
1707 | 1707 | $condition_quiz = ""; |
1708 | 1708 | if (!empty($exercise_id)) { |
1709 | 1709 | $exercise_id = intval($exercise_id); |
1710 | - $condition_quiz =" AND id = $exercise_id "; |
|
1710 | + $condition_quiz = " AND id = $exercise_id "; |
|
1711 | 1711 | } |
1712 | 1712 | |
1713 | 1713 | // Compose a filter based on optional session id given |
@@ -1756,7 +1756,7 @@ discard block |
||
1756 | 1756 | } |
1757 | 1757 | } |
1758 | 1758 | if (!empty($exercise_list)) { |
1759 | - $exercise_id = implode("','",$exercise_list); |
|
1759 | + $exercise_id = implode("','", $exercise_list); |
|
1760 | 1760 | } |
1761 | 1761 | } |
1762 | 1762 | |
@@ -1781,10 +1781,10 @@ discard block |
||
1781 | 1781 | $quiz_avg_score = null; |
1782 | 1782 | |
1783 | 1783 | if (!empty($row['avg_score'])) { |
1784 | - $quiz_avg_score = round($row['avg_score'],2); |
|
1784 | + $quiz_avg_score = round($row['avg_score'], 2); |
|
1785 | 1785 | } |
1786 | 1786 | |
1787 | - if(!empty($row['num_attempts'])) { |
|
1787 | + if (!empty($row['num_attempts'])) { |
|
1788 | 1788 | $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
1789 | 1789 | } |
1790 | 1790 | if (is_array($student_id)) { |
@@ -1914,7 +1914,7 @@ discard block |
||
1914 | 1914 | $row = Database::fetch_row($rs); |
1915 | 1915 | $count = $row[0]; |
1916 | 1916 | } |
1917 | - $count = ($count != 0 ) ? 100*round(intval($count)/count($exercise_list), 2) .'%' : '0%'; |
|
1917 | + $count = ($count != 0) ? 100 * round(intval($count) / count($exercise_list), 2).'%' : '0%'; |
|
1918 | 1918 | return $count; |
1919 | 1919 | } |
1920 | 1920 | |
@@ -1939,7 +1939,7 @@ discard block |
||
1939 | 1939 | ); |
1940 | 1940 | |
1941 | 1941 | if (!empty($best_attempt) && !empty($best_attempt['exe_weighting'])) { |
1942 | - $result += $best_attempt['exe_result']/$best_attempt['exe_weighting']; |
|
1942 | + $result += $best_attempt['exe_result'] / $best_attempt['exe_weighting']; |
|
1943 | 1943 | } |
1944 | 1944 | } |
1945 | 1945 | $result = $result / count($exercise_list); |
@@ -1976,7 +1976,7 @@ discard block |
||
1976 | 1976 | $query = sprintf($sql, intval($courseId), $sessionId); |
1977 | 1977 | $rs = Database::query($query); |
1978 | 1978 | $teachers = array(); |
1979 | - while ($teacher = Database::fetch_array($rs,'ASSOC')) { |
|
1979 | + while ($teacher = Database::fetch_array($rs, 'ASSOC')) { |
|
1980 | 1980 | $teachers[] = $teacher; |
1981 | 1981 | } |
1982 | 1982 | $data = array(); |
@@ -2100,7 +2100,7 @@ discard block |
||
2100 | 2100 | $data[] = array( |
2101 | 2101 | 'course' => $course['title'], |
2102 | 2102 | 'session' => $teacher['name'], |
2103 | - 'tutor' => $tutor['username'] . ' - ' . $tutor['lastname'] . ' ' . $tutor['firstname'], |
|
2103 | + 'tutor' => $tutor['username'].' - '.$tutor['lastname'].' '.$tutor['firstname'], |
|
2104 | 2104 | 'documents' => $totalDocuments, |
2105 | 2105 | 'links' => $totalLinks, |
2106 | 2106 | 'forums' => $totalForums, |
@@ -2163,7 +2163,7 @@ discard block |
||
2163 | 2163 | for ($i = 0; $i < count($lPIds); $i++) { |
2164 | 2164 | $placeHolders[] = '?'; |
2165 | 2165 | } |
2166 | - $lPConditions['AND id IN(' . implode(', ', $placeHolders) . ') '] = $lPIds; |
|
2166 | + $lPConditions['AND id IN('.implode(', ', $placeHolders).') '] = $lPIds; |
|
2167 | 2167 | } |
2168 | 2168 | |
2169 | 2169 | if ($onlySeriousGame) { |
@@ -2183,12 +2183,12 @@ discard block |
||
2183 | 2183 | |
2184 | 2184 | $conditions = [ |
2185 | 2185 | " c_id = {$courseInfo['real_id']} ", |
2186 | - " lp_view.lp_id IN(" . implode(', ', $filteredLP) . ") " |
|
2186 | + " lp_view.lp_id IN(".implode(', ', $filteredLP).") " |
|
2187 | 2187 | ]; |
2188 | 2188 | |
2189 | 2189 | if (is_array($studentId)) { |
2190 | 2190 | $studentId = array_map('intval', $studentId); |
2191 | - $conditions[] = " lp_view.user_id IN (" . implode(',', $studentId) . ") "; |
|
2191 | + $conditions[] = " lp_view.user_id IN (".implode(',', $studentId).") "; |
|
2192 | 2192 | |
2193 | 2193 | $groupBy = 'GROUP BY lp_id'; |
2194 | 2194 | } else { |
@@ -2280,7 +2280,7 @@ discard block |
||
2280 | 2280 | // Compose a filter based on optional learning paths list given |
2281 | 2281 | $condition_lp = ""; |
2282 | 2282 | if (count($lp_ids) > 0) { |
2283 | - $condition_lp =" AND id IN(".implode(',',$lp_ids).") "; |
|
2283 | + $condition_lp = " AND id IN(".implode(',', $lp_ids).") "; |
|
2284 | 2284 | } |
2285 | 2285 | |
2286 | 2286 | // Compose a filter based on optional session id |
@@ -2320,9 +2320,9 @@ discard block |
||
2320 | 2320 | // prepare filter on users |
2321 | 2321 | if (is_array($student_id)) { |
2322 | 2322 | array_walk($student_id, 'intval'); |
2323 | - $condition_user1 =" AND user_id IN (".implode(',', $student_id).") "; |
|
2323 | + $condition_user1 = " AND user_id IN (".implode(',', $student_id).") "; |
|
2324 | 2324 | } else { |
2325 | - $condition_user1 =" AND user_id = $student_id "; |
|
2325 | + $condition_user1 = " AND user_id = $student_id "; |
|
2326 | 2326 | } |
2327 | 2327 | |
2328 | 2328 | if ($count_row_lp > 0 && !empty($student_id)) { |
@@ -2365,7 +2365,7 @@ discard block |
||
2365 | 2365 | ORDER BY lp_item_id"; |
2366 | 2366 | $res_lp_item = Database::query($sql); |
2367 | 2367 | |
2368 | - while ($row_lp_item = Database::fetch_array($res_lp_item,'ASSOC')) { |
|
2368 | + while ($row_lp_item = Database::fetch_array($res_lp_item, 'ASSOC')) { |
|
2369 | 2369 | $my_lp_item_id = $row_lp_item['lp_item_id']; |
2370 | 2370 | |
2371 | 2371 | // Getting the most recent attempt |
@@ -2388,8 +2388,8 @@ discard block |
||
2388 | 2388 | ORDER BY view_count DESC |
2389 | 2389 | LIMIT 1"; |
2390 | 2390 | $res_lp_item_result = Database::query($sql); |
2391 | - while ($row_max_score = Database::fetch_array($res_lp_item_result,'ASSOC')) { |
|
2392 | - $list[]= $row_max_score; |
|
2391 | + while ($row_max_score = Database::fetch_array($res_lp_item_result, 'ASSOC')) { |
|
2392 | + $list[] = $row_max_score; |
|
2393 | 2393 | } |
2394 | 2394 | } |
2395 | 2395 | } else { |
@@ -2413,8 +2413,8 @@ discard block |
||
2413 | 2413 | if ($debug) echo $sql.'<br />'; |
2414 | 2414 | $res_max_score = Database::query($sql); |
2415 | 2415 | |
2416 | - while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) { |
|
2417 | - $list[]= $row_max_score; |
|
2416 | + while ($row_max_score = Database::fetch_array($res_max_score, 'ASSOC')) { |
|
2417 | + $list[] = $row_max_score; |
|
2418 | 2418 | } |
2419 | 2419 | } |
2420 | 2420 | |
@@ -2429,7 +2429,7 @@ discard block |
||
2429 | 2429 | $max_score_item_view = $row_max_score['max_score_item_view']; |
2430 | 2430 | $score = $row_max_score['score']; |
2431 | 2431 | |
2432 | - if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2432 | + if ($debug) echo '<h3>Item Type: '.$row_max_score['item_type'].'</h3>'; |
|
2433 | 2433 | |
2434 | 2434 | if ($row_max_score['item_type'] == 'sco') { |
2435 | 2435 | /* Check if it is sco (easier to get max_score) |
@@ -2447,7 +2447,7 @@ discard block |
||
2447 | 2447 | } |
2448 | 2448 | // Avoid division by zero errors |
2449 | 2449 | if (!empty($max_score)) { |
2450 | - $lp_partial_total += $score/$max_score; |
|
2450 | + $lp_partial_total += $score / $max_score; |
|
2451 | 2451 | } |
2452 | 2452 | if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
2453 | 2453 | } else { |
@@ -2471,10 +2471,10 @@ discard block |
||
2471 | 2471 | ORDER BY exe_date DESC |
2472 | 2472 | LIMIT 1"; |
2473 | 2473 | |
2474 | - if ($debug) echo $sql .'<br />'; |
|
2474 | + if ($debug) echo $sql.'<br />'; |
|
2475 | 2475 | $result_last_attempt = Database::query($sql); |
2476 | 2476 | $num = Database :: num_rows($result_last_attempt); |
2477 | - if ($num > 0 ) { |
|
2477 | + if ($num > 0) { |
|
2478 | 2478 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
2479 | 2479 | if ($debug) echo $id_last_attempt.'<br />'; |
2480 | 2480 | |
@@ -2503,13 +2503,13 @@ discard block |
||
2503 | 2503 | $max_score = $row_max_score_bis['maxscore']; |
2504 | 2504 | } |
2505 | 2505 | if (!empty($max_score) && floatval($max_score) > 0) { |
2506 | - $lp_partial_total += $score/$max_score; |
|
2506 | + $lp_partial_total += $score / $max_score; |
|
2507 | 2507 | } |
2508 | 2508 | if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
2509 | 2509 | } |
2510 | 2510 | } |
2511 | 2511 | |
2512 | - if (in_array($row_max_score['item_type'], array('quiz','sco'))) { |
|
2512 | + if (in_array($row_max_score['item_type'], array('quiz', 'sco'))) { |
|
2513 | 2513 | // Normal way |
2514 | 2514 | if ($use_max_score[$lp_id]) { |
2515 | 2515 | $count_items++; |
@@ -2544,8 +2544,8 @@ discard block |
||
2544 | 2544 | if ($debug) echo $sql; |
2545 | 2545 | $result_have_quiz = Database::query($sql); |
2546 | 2546 | |
2547 | - if (Database::num_rows($result_have_quiz) > 0 ) { |
|
2548 | - $row = Database::fetch_array($result_have_quiz,'ASSOC'); |
|
2547 | + if (Database::num_rows($result_have_quiz) > 0) { |
|
2548 | + $row = Database::fetch_array($result_have_quiz, 'ASSOC'); |
|
2549 | 2549 | if (is_numeric($row['count']) && $row['count'] != 0) { |
2550 | 2550 | $lp_with_quiz++; |
2551 | 2551 | } |
@@ -2557,7 +2557,7 @@ discard block |
||
2557 | 2557 | |
2558 | 2558 | if ($lp_with_quiz != 0) { |
2559 | 2559 | if (!$return_array) { |
2560 | - $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2); |
|
2560 | + $score_of_scorm_calculate = round(($global_result / $lp_with_quiz), 2); |
|
2561 | 2561 | if ($debug) var_dump($score_of_scorm_calculate); |
2562 | 2562 | if (empty($lp_ids)) { |
2563 | 2563 | if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
@@ -2631,9 +2631,9 @@ discard block |
||
2631 | 2631 | |
2632 | 2632 | if (is_array($student_id)) { |
2633 | 2633 | array_walk($student_id, 'intval'); |
2634 | - $conditions[] =" lp_view.user_id IN (".implode(',', $student_id).") "; |
|
2634 | + $conditions[] = " lp_view.user_id IN (".implode(',', $student_id).") "; |
|
2635 | 2635 | } else { |
2636 | - $conditions[] =" lp_view.user_id = $student_id "; |
|
2636 | + $conditions[] = " lp_view.user_id = $student_id "; |
|
2637 | 2637 | } |
2638 | 2638 | |
2639 | 2639 | $conditionsToString = implode('AND ', $conditions); |
@@ -2657,7 +2657,7 @@ discard block |
||
2657 | 2657 | return 0; |
2658 | 2658 | } |
2659 | 2659 | |
2660 | - return ($row['sum_score'] / $row['sum_max_score'])*100; |
|
2660 | + return ($row['sum_score'] / $row['sum_max_score']) * 100; |
|
2661 | 2661 | |
2662 | 2662 | } |
2663 | 2663 | |
@@ -2687,7 +2687,7 @@ discard block |
||
2687 | 2687 | // Compose a filter based on optional learning paths list given |
2688 | 2688 | $condition_lp = ""; |
2689 | 2689 | if (count($lp_ids) > 0) { |
2690 | - $condition_lp =" AND id IN(".implode(',',$lp_ids).") "; |
|
2690 | + $condition_lp = " AND id IN(".implode(',', $lp_ids).") "; |
|
2691 | 2691 | } |
2692 | 2692 | |
2693 | 2693 | // Compose a filter based on optional session id |
@@ -2746,7 +2746,7 @@ discard block |
||
2746 | 2746 | |
2747 | 2747 | if (!empty($course)) { |
2748 | 2748 | |
2749 | - $course_id = $course['real_id']; |
|
2749 | + $course_id = $course['real_id']; |
|
2750 | 2750 | |
2751 | 2751 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
2752 | 2752 | $t_lpv = Database :: get_course_table(TABLE_LP_VIEW); |
@@ -2760,8 +2760,8 @@ discard block |
||
2760 | 2760 | // calculates last connection time |
2761 | 2761 | if ($count_row_lp > 0) { |
2762 | 2762 | $sql = 'SELECT MAX(start_time) |
2763 | - FROM ' . $t_lpiv . ' AS item_view |
|
2764 | - INNER JOIN ' . $t_lpv . ' AS view |
|
2763 | + FROM ' . $t_lpiv.' AS item_view |
|
2764 | + INNER JOIN ' . $t_lpv.' AS view |
|
2765 | 2765 | ON item_view.lp_view_id = view.id |
2766 | 2766 | WHERE |
2767 | 2767 | item_view.c_id = '.$course_id.' AND |
@@ -2797,15 +2797,15 @@ discard block |
||
2797 | 2797 | |
2798 | 2798 | // At first, courses where $coach_id is coach of the course // |
2799 | 2799 | $sql = 'SELECT session_id, c_id |
2800 | - FROM ' . $tbl_session_course_user . ' |
|
2800 | + FROM ' . $tbl_session_course_user.' |
|
2801 | 2801 | WHERE user_id=' . $coach_id.' AND status=2'; |
2802 | 2802 | |
2803 | 2803 | if (api_is_multiple_url_enabled()) { |
2804 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2804 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2805 | 2805 | $access_url_id = api_get_current_access_url_id(); |
2806 | 2806 | if ($access_url_id != -1) { |
2807 | 2807 | $sql = 'SELECT scu.session_id, scu.c_id |
2808 | - FROM ' . $tbl_session_course_user . ' scu |
|
2808 | + FROM ' . $tbl_session_course_user.' scu |
|
2809 | 2809 | INNER JOIN '.$tbl_session_rel_access_url.' sru |
2810 | 2810 | ON (scu.session_id=sru.session_id) |
2811 | 2811 | WHERE |
@@ -2839,28 +2839,28 @@ discard block |
||
2839 | 2839 | |
2840 | 2840 | // Then, courses where $coach_id is coach of the session // |
2841 | 2841 | $sql = 'SELECT session_course_user.user_id |
2842 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
2842 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
2843 | 2843 | INNER JOIN '.$tbl_session_user.' sru |
2844 | 2844 | ON session_course_user.user_id = sru.user_id AND session_course_user.session_id = sru.session_id |
2845 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
2845 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
2846 | 2846 | ON session_course.c_id = session_course_user.c_id |
2847 | 2847 | AND session_course_user.session_id = session_course.session_id |
2848 | - INNER JOIN ' . $tbl_session . ' as session |
|
2848 | + INNER JOIN ' . $tbl_session.' as session |
|
2849 | 2849 | ON session.id = session_course.session_id |
2850 | 2850 | AND session.id_coach = ' . $coach_id; |
2851 | 2851 | if (api_is_multiple_url_enabled()) { |
2852 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2852 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2853 | 2853 | $access_url_id = api_get_current_access_url_id(); |
2854 | - if ($access_url_id != -1){ |
|
2854 | + if ($access_url_id != -1) { |
|
2855 | 2855 | $sql = 'SELECT session_course_user.user_id |
2856 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
2856 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
2857 | 2857 | INNER JOIN '.$tbl_session_user.' sru |
2858 | 2858 | ON session_course_user.user_id = sru.user_id AND |
2859 | 2859 | session_course_user.session_id = sru.session_id |
2860 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
2860 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
2861 | 2861 | ON session_course.c_id = session_course_user.c_id AND |
2862 | 2862 | session_course_user.session_id = session_course.session_id |
2863 | - INNER JOIN ' . $tbl_session . ' as session |
|
2863 | + INNER JOIN ' . $tbl_session.' as session |
|
2864 | 2864 | ON session.id = session_course.session_id AND |
2865 | 2865 | session.id_coach = ' . $coach_id.' |
2866 | 2866 | INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url |
@@ -2890,8 +2890,8 @@ discard block |
||
2890 | 2890 | |
2891 | 2891 | $students = []; |
2892 | 2892 | // At first, courses where $coach_id is coach of the course // |
2893 | - $sql = 'SELECT c_id FROM ' . $tbl_session_course_user . ' |
|
2894 | - WHERE session_id="' . $id_session . '" AND user_id=' . $coach_id.' AND status=2'; |
|
2893 | + $sql = 'SELECT c_id FROM '.$tbl_session_course_user.' |
|
2894 | + WHERE session_id="' . $id_session.'" AND user_id='.$coach_id.' AND status=2'; |
|
2895 | 2895 | $result = Database::query($sql); |
2896 | 2896 | |
2897 | 2897 | while ($a_courses = Database::fetch_array($result)) { |
@@ -2901,7 +2901,7 @@ discard block |
||
2901 | 2901 | FROM $tbl_session_course_user AS srcru |
2902 | 2902 | WHERE |
2903 | 2903 | c_id = '$courseId' AND |
2904 | - session_id = '" . $id_session . "'"; |
|
2904 | + session_id = '".$id_session."'"; |
|
2905 | 2905 | $rs = Database::query($sql); |
2906 | 2906 | while ($row = Database::fetch_array($rs)) { |
2907 | 2907 | $students[$row['user_id']] = $row['user_id']; |
@@ -2909,15 +2909,15 @@ discard block |
||
2909 | 2909 | } |
2910 | 2910 | |
2911 | 2911 | // Then, courses where $coach_id is coach of the session |
2912 | - $sql = 'SELECT id_coach FROM ' . $tbl_session . ' |
|
2913 | - WHERE id="' . $id_session.'" AND id_coach="' . $coach_id . '"'; |
|
2912 | + $sql = 'SELECT id_coach FROM '.$tbl_session.' |
|
2913 | + WHERE id="' . $id_session.'" AND id_coach="'.$coach_id.'"'; |
|
2914 | 2914 | $result = Database::query($sql); |
2915 | 2915 | |
2916 | 2916 | //He is the session_coach so we select all the users in the session |
2917 | 2917 | if (Database::num_rows($result) > 0) { |
2918 | 2918 | $sql = 'SELECT DISTINCT srcru.user_id |
2919 | - FROM ' . $tbl_session_course_user . ' AS srcru |
|
2920 | - WHERE session_id="' . $id_session . '"'; |
|
2919 | + FROM ' . $tbl_session_course_user.' AS srcru |
|
2920 | + WHERE session_id="' . $id_session.'"'; |
|
2921 | 2921 | $result = Database::query($sql); |
2922 | 2922 | while ($row = Database::fetch_array($result)) { |
2923 | 2923 | $students[$row['user_id']] = $row['user_id']; |
@@ -2944,8 +2944,8 @@ discard block |
||
2944 | 2944 | |
2945 | 2945 | // At first, courses where $coach_id is coach of the course // |
2946 | 2946 | |
2947 | - $sql = 'SELECT 1 FROM ' . $tbl_session_course_user . ' |
|
2948 | - WHERE user_id=' . $coach_id .' AND status=2'; |
|
2947 | + $sql = 'SELECT 1 FROM '.$tbl_session_course_user.' |
|
2948 | + WHERE user_id=' . $coach_id.' AND status=2'; |
|
2949 | 2949 | $result = Database::query($sql); |
2950 | 2950 | if (Database::num_rows($result) > 0) { |
2951 | 2951 | return true; |
@@ -2953,12 +2953,12 @@ discard block |
||
2953 | 2953 | |
2954 | 2954 | // Then, courses where $coach_id is coach of the session |
2955 | 2955 | $sql = 'SELECT session_course_user.user_id |
2956 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
2957 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
2956 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
2957 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
2958 | 2958 | ON session_course.c_id = session_course_user.c_id |
2959 | - INNER JOIN ' . $tbl_session . ' as session |
|
2959 | + INNER JOIN ' . $tbl_session.' as session |
|
2960 | 2960 | ON session.id = session_course.session_id |
2961 | - AND session.id_coach = ' . $coach_id . ' |
|
2961 | + AND session.id_coach = ' . $coach_id.' |
|
2962 | 2962 | WHERE user_id = ' . $student_id; |
2963 | 2963 | $result = Database::query($sql); |
2964 | 2964 | if (Database::num_rows($result) > 0) { |
@@ -2990,16 +2990,16 @@ discard block |
||
2990 | 2990 | // At first, courses where $coach_id is coach of the course. |
2991 | 2991 | |
2992 | 2992 | $sql = 'SELECT DISTINCT c.code |
2993 | - FROM ' . $tbl_session_course_user . ' sc |
|
2993 | + FROM ' . $tbl_session_course_user.' sc |
|
2994 | 2994 | INNER JOIN '.$tbl_course.' c |
2995 | 2995 | ON (c.id = sc.c_id) |
2996 | 2996 | WHERE user_id = ' . $coach_id.' AND status = 2'; |
2997 | 2997 | |
2998 | 2998 | if (api_is_multiple_url_enabled()) { |
2999 | 2999 | $access_url_id = api_get_current_access_url_id(); |
3000 | - if ($access_url_id != -1){ |
|
3000 | + if ($access_url_id != -1) { |
|
3001 | 3001 | $sql = 'SELECT DISTINCT c.code |
3002 | - FROM ' . $tbl_session_course_user . ' scu |
|
3002 | + FROM ' . $tbl_session_course_user.' scu |
|
3003 | 3003 | INNER JOIN '.$tbl_course.' c |
3004 | 3004 | ON (c.code = scu.c_id) |
3005 | 3005 | INNER JOIN '.$tbl_course_rel_access_url.' cru |
@@ -3012,7 +3012,7 @@ discard block |
||
3012 | 3012 | } |
3013 | 3013 | |
3014 | 3014 | if (!empty($id_session)) { |
3015 | - $sql .= ' AND session_id=' . $id_session; |
|
3015 | + $sql .= ' AND session_id='.$id_session; |
|
3016 | 3016 | } |
3017 | 3017 | |
3018 | 3018 | $courseList = array(); |
@@ -3024,25 +3024,25 @@ discard block |
||
3024 | 3024 | // Then, courses where $coach_id is coach of the session |
3025 | 3025 | |
3026 | 3026 | $sql = 'SELECT DISTINCT course.code |
3027 | - FROM ' . $tbl_session_course . ' as session_course |
|
3028 | - INNER JOIN ' . $tbl_session . ' as session |
|
3027 | + FROM ' . $tbl_session_course.' as session_course |
|
3028 | + INNER JOIN ' . $tbl_session.' as session |
|
3029 | 3029 | ON session.id = session_course.session_id |
3030 | - AND session.id_coach = ' . $coach_id . ' |
|
3031 | - INNER JOIN ' . $tbl_course . ' as course |
|
3030 | + AND session.id_coach = ' . $coach_id.' |
|
3031 | + INNER JOIN ' . $tbl_course.' as course |
|
3032 | 3032 | ON course.id = session_course.c_id'; |
3033 | 3033 | |
3034 | 3034 | if (api_is_multiple_url_enabled()) { |
3035 | 3035 | $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
3036 | 3036 | $access_url_id = api_get_current_access_url_id(); |
3037 | - if ($access_url_id != -1){ |
|
3037 | + if ($access_url_id != -1) { |
|
3038 | 3038 | $sql = 'SELECT DISTINCT c.code |
3039 | - FROM ' . $tbl_session_course . ' as session_course |
|
3039 | + FROM ' . $tbl_session_course.' as session_course |
|
3040 | 3040 | INNER JOIN '.$tbl_course.' c |
3041 | 3041 | ON (c.id = session_course.c_id) |
3042 | - INNER JOIN ' . $tbl_session . ' as session |
|
3042 | + INNER JOIN ' . $tbl_session.' as session |
|
3043 | 3043 | ON session.id = session_course.session_id |
3044 | - AND session.id_coach = ' . $coach_id . ' |
|
3045 | - INNER JOIN ' . $tbl_course . ' as course |
|
3044 | + AND session.id_coach = ' . $coach_id.' |
|
3045 | + INNER JOIN ' . $tbl_course.' as course |
|
3046 | 3046 | ON course.id = session_course.c_id |
3047 | 3047 | INNER JOIN '.$tbl_course_rel_access_url.' course_rel_url |
3048 | 3048 | ON (course_rel_url.c_id = c.id)'; |
@@ -3050,12 +3050,12 @@ discard block |
||
3050 | 3050 | } |
3051 | 3051 | |
3052 | 3052 | if (!empty ($id_session)) { |
3053 | - $sql .= ' WHERE session_course.session_id=' . $id_session; |
|
3053 | + $sql .= ' WHERE session_course.session_id='.$id_session; |
|
3054 | 3054 | if (api_is_multiple_url_enabled()) |
3055 | - $sql .= ' AND access_url_id = '.$access_url_id; |
|
3056 | - } else { |
|
3055 | + $sql .= ' AND access_url_id = '.$access_url_id; |
|
3056 | + } else { |
|
3057 | 3057 | if (api_is_multiple_url_enabled()) |
3058 | - $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3058 | + $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3059 | 3059 | } |
3060 | 3060 | |
3061 | 3061 | $result = Database::query($sql); |
@@ -3111,7 +3111,7 @@ discard block |
||
3111 | 3111 | } |
3112 | 3112 | } |
3113 | 3113 | |
3114 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
3114 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
3115 | 3115 | $access_url_id = api_get_current_access_url_id(); |
3116 | 3116 | |
3117 | 3117 | $sql = " |
@@ -3231,7 +3231,7 @@ discard block |
||
3231 | 3231 | // table definition |
3232 | 3232 | $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
3233 | 3233 | $tbl_document = Database :: get_course_table(TABLE_DOCUMENT); |
3234 | - $course_id = $a_course['real_id']; |
|
3234 | + $course_id = $a_course['real_id']; |
|
3235 | 3235 | if (is_array($student_id)) { |
3236 | 3236 | $studentList = array_map('intval', $student_id); |
3237 | 3237 | $condition_user = " AND ip.insert_user_id IN ('".implode(',', $studentList)."') "; |
@@ -3282,7 +3282,7 @@ discard block |
||
3282 | 3282 | $a_course = CourseManager::get_course_information($course_code); |
3283 | 3283 | if (!empty($a_course)) { |
3284 | 3284 | $course_id = $a_course['real_id']; |
3285 | - $conditions[]= " ip.c_id = $course_id AND pub.c_id = $course_id "; |
|
3285 | + $conditions[] = " ip.c_id = $course_id AND pub.c_id = $course_id "; |
|
3286 | 3286 | } |
3287 | 3287 | |
3288 | 3288 | // table definition |
@@ -3291,14 +3291,14 @@ discard block |
||
3291 | 3291 | |
3292 | 3292 | if (is_array($student_id)) { |
3293 | 3293 | $studentList = array_map('intval', $student_id); |
3294 | - $conditions[]= " ip.insert_user_id IN ('".implode("','", $studentList)."') "; |
|
3294 | + $conditions[] = " ip.insert_user_id IN ('".implode("','", $studentList)."') "; |
|
3295 | 3295 | } else { |
3296 | 3296 | $student_id = intval($student_id); |
3297 | - $conditions[]= " ip.insert_user_id = '$student_id' "; |
|
3297 | + $conditions[] = " ip.insert_user_id = '$student_id' "; |
|
3298 | 3298 | } |
3299 | 3299 | if (isset($session_id)) { |
3300 | 3300 | $session_id = intval($session_id); |
3301 | - $conditions[]= " pub.session_id = $session_id "; |
|
3301 | + $conditions[] = " pub.session_id = $session_id "; |
|
3302 | 3302 | } |
3303 | 3303 | $conditionToString = implode('AND', $conditions); |
3304 | 3304 | |
@@ -3331,8 +3331,8 @@ discard block |
||
3331 | 3331 | $courseCondition = null; |
3332 | 3332 | $conditions = array(); |
3333 | 3333 | if (!empty($courseInfo)) { |
3334 | - $course_id = $courseInfo['real_id']; |
|
3335 | - $conditions[]= " post.c_id = $course_id AND forum.c_id = $course_id "; |
|
3334 | + $course_id = $courseInfo['real_id']; |
|
3335 | + $conditions[] = " post.c_id = $course_id AND forum.c_id = $course_id "; |
|
3336 | 3336 | } |
3337 | 3337 | |
3338 | 3338 | // Table definition. |
@@ -3341,15 +3341,15 @@ discard block |
||
3341 | 3341 | |
3342 | 3342 | if (is_array($student_id)) { |
3343 | 3343 | $studentList = array_map('intval', $student_id); |
3344 | - $conditions[]= " post.poster_id IN ('".implode("','", $studentList)."') "; |
|
3344 | + $conditions[] = " post.poster_id IN ('".implode("','", $studentList)."') "; |
|
3345 | 3345 | } else { |
3346 | 3346 | $student_id = intval($student_id); |
3347 | - $conditions[]= " post.poster_id = '$student_id' "; |
|
3347 | + $conditions[] = " post.poster_id = '$student_id' "; |
|
3348 | 3348 | } |
3349 | 3349 | |
3350 | 3350 | if (isset($session_id)) { |
3351 | 3351 | $session_id = intval($session_id); |
3352 | - $conditions[]= " forum.session_id = $session_id"; |
|
3352 | + $conditions[] = " forum.session_id = $session_id"; |
|
3353 | 3353 | } |
3354 | 3354 | |
3355 | 3355 | $conditionsToString = implode('AND ', $conditions); |
@@ -3384,7 +3384,7 @@ discard block |
||
3384 | 3384 | $condition_session = ''; |
3385 | 3385 | if (isset($session_id)) { |
3386 | 3386 | $session_id = intval($session_id); |
3387 | - $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id'); |
|
3387 | + $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id'); |
|
3388 | 3388 | } |
3389 | 3389 | |
3390 | 3390 | $course_id = $courseInfo['real_id']; |
@@ -3440,7 +3440,7 @@ discard block |
||
3440 | 3440 | $condition_session = ''; |
3441 | 3441 | if (isset($session_id)) { |
3442 | 3442 | $session_id = intval($session_id); |
3443 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3443 | + $condition_session = ' AND f.session_id = '.$session_id; |
|
3444 | 3444 | } |
3445 | 3445 | |
3446 | 3446 | $groupId = intval($groupId); |
@@ -3501,7 +3501,7 @@ discard block |
||
3501 | 3501 | $condition_session = ''; |
3502 | 3502 | if (isset($session_id)) { |
3503 | 3503 | $session_id = intval($session_id); |
3504 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3504 | + $condition_session = ' AND f.session_id = '.$session_id; |
|
3505 | 3505 | } |
3506 | 3506 | |
3507 | 3507 | $groupId = intval($groupId); |
@@ -3580,7 +3580,7 @@ discard block |
||
3580 | 3580 | { |
3581 | 3581 | $student_id = intval($student_id); |
3582 | 3582 | $courseId = intval($courseId); |
3583 | - $session_id = intval($session_id); |
|
3583 | + $session_id = intval($session_id); |
|
3584 | 3584 | $date_time = ''; |
3585 | 3585 | |
3586 | 3586 | // table definition |
@@ -3649,7 +3649,7 @@ discard block |
||
3649 | 3649 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
3650 | 3650 | |
3651 | 3651 | $sql = 'SELECT 1 |
3652 | - FROM ' . $table . ' |
|
3652 | + FROM ' . $table.' |
|
3653 | 3653 | WHERE down_user_id = '.$student_id.' |
3654 | 3654 | AND c_id = "'.$courseId.'" |
3655 | 3655 | AND down_session_id = '.$session_id.' '; |
@@ -3727,30 +3727,30 @@ discard block |
||
3727 | 3727 | '.$inner.' |
3728 | 3728 | WHERE c.id = '.$courseId.' |
3729 | 3729 | GROUP BY stats_login.user_id |
3730 | - HAVING DATE_SUB( "' . $now . '", INTERVAL '.$since.' DAY) > max_date '; |
|
3730 | + HAVING DATE_SUB( "' . $now.'", INTERVAL '.$since.' DAY) > max_date '; |
|
3731 | 3731 | |
3732 | 3732 | if ($since == 'never') { |
3733 | 3733 | if (empty($session_id)) { |
3734 | 3734 | $sql = 'SELECT course_user.user_id |
3735 | - FROM ' . $table_course_rel_user . ' course_user |
|
3736 | - LEFT JOIN ' . $tbl_track_login . ' stats_login |
|
3735 | + FROM ' . $table_course_rel_user.' course_user |
|
3736 | + LEFT JOIN ' . $tbl_track_login.' stats_login |
|
3737 | 3737 | ON course_user.user_id = stats_login.user_id AND |
3738 | - relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' |
|
3739 | - INNER JOIN ' . $tableCourse . ' c |
|
3738 | + relation_type<>' . COURSE_RELATION_TYPE_RRHH.' |
|
3739 | + INNER JOIN ' . $tableCourse.' c |
|
3740 | 3740 | ON (c.id = course_user.c_id) |
3741 | 3741 | WHERE |
3742 | - course_user.c_id = ' . $courseId . ' AND |
|
3742 | + course_user.c_id = ' . $courseId.' AND |
|
3743 | 3743 | stats_login.login_course_date IS NULL |
3744 | 3744 | GROUP BY course_user.user_id'; |
3745 | 3745 | } else { |
3746 | 3746 | $sql = 'SELECT session_course_user.user_id |
3747 | 3747 | FROM '.$tbl_session_course_user.' session_course_user |
3748 | - LEFT JOIN ' . $tbl_track_login . ' stats_login |
|
3748 | + LEFT JOIN ' . $tbl_track_login.' stats_login |
|
3749 | 3749 | ON session_course_user.user_id = stats_login.user_id |
3750 | - INNER JOIN ' . $tableCourse . ' c |
|
3750 | + INNER JOIN ' . $tableCourse.' c |
|
3751 | 3751 | ON (c.id = session_course_user.c_id) |
3752 | 3752 | WHERE |
3753 | - session_course_user.c_id = ' . $courseId . ' AND |
|
3753 | + session_course_user.c_id = ' . $courseId.' AND |
|
3754 | 3754 | stats_login.login_course_date IS NULL |
3755 | 3755 | GROUP BY session_course_user.user_id'; |
3756 | 3756 | |
@@ -3759,7 +3759,7 @@ discard block |
||
3759 | 3759 | |
3760 | 3760 | $rs = Database::query($sql); |
3761 | 3761 | $inactive_users = array(); |
3762 | - while($user = Database::fetch_array($rs)) { |
|
3762 | + while ($user = Database::fetch_array($rs)) { |
|
3763 | 3763 | $inactive_users[] = $user['user_id']; |
3764 | 3764 | } |
3765 | 3765 | |
@@ -3781,10 +3781,10 @@ discard block |
||
3781 | 3781 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
3782 | 3782 | |
3783 | 3783 | $sql = 'SELECT '.$student_id.' |
3784 | - FROM ' . $table . ' |
|
3784 | + FROM ' . $table.' |
|
3785 | 3785 | WHERE |
3786 | - access_user_id=' . $student_id . ' AND |
|
3787 | - c_id="' . $courseId . '" AND |
|
3786 | + access_user_id=' . $student_id.' AND |
|
3787 | + c_id="' . $courseId.'" AND |
|
3788 | 3788 | access_session_id = "'.$session_id.'" '; |
3789 | 3789 | |
3790 | 3790 | $rs = Database::query($sql); |
@@ -3802,13 +3802,13 @@ discard block |
||
3802 | 3802 | { |
3803 | 3803 | $hr_dept_id = intval($hr_dept_id); |
3804 | 3804 | $a_students = array(); |
3805 | - $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
3805 | + $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
3806 | 3806 | |
3807 | 3807 | $sql = 'SELECT DISTINCT user_id FROM '.$tbl_user.' as user |
3808 | 3808 | WHERE hr_dept_id='.$hr_dept_id; |
3809 | 3809 | $rs = Database::query($sql); |
3810 | 3810 | |
3811 | - while($user = Database :: fetch_array($rs)) { |
|
3811 | + while ($user = Database :: fetch_array($rs)) { |
|
3812 | 3812 | $a_students[$user['user_id']] = $user['user_id']; |
3813 | 3813 | } |
3814 | 3814 | |
@@ -3833,7 +3833,7 @@ discard block |
||
3833 | 3833 | $condition_session = ''; |
3834 | 3834 | if (isset($session_id)) { |
3835 | 3835 | $session_id = intval($session_id); |
3836 | - $condition_session = ' AND access_session_id = '. $session_id; |
|
3836 | + $condition_session = ' AND access_session_id = '.$session_id; |
|
3837 | 3837 | } |
3838 | 3838 | $sql = "SELECT |
3839 | 3839 | access_tool, |
@@ -3945,7 +3945,7 @@ discard block |
||
3945 | 3945 | if (!empty($date_from) && !empty($date_to)) { |
3946 | 3946 | $fieldStartDate = $fields['start_date']; |
3947 | 3947 | if (!isset($fields['end_date'])) { |
3948 | - $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to) ; |
|
3948 | + $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to); |
|
3949 | 3949 | } else { |
3950 | 3950 | $fieldEndDate = $fields['end_date']; |
3951 | 3951 | $where .= sprintf(" AND fieldStartDate >= '%s' |
@@ -3961,12 +3961,12 @@ discard block |
||
3961 | 3961 | $where |
3962 | 3962 | GROUP BY %s"; |
3963 | 3963 | $sql = sprintf($sql, |
3964 | - $fields['user'], //user field |
|
3965 | - $tableName, //FROM |
|
3966 | - $fields['course'], //course condition |
|
3967 | - $course['real_id'], //course condition |
|
3968 | - $fields['user'], //user condition |
|
3969 | - $userId, //user condition |
|
3964 | + $fields['user'], //user field |
|
3965 | + $tableName, //FROM |
|
3966 | + $fields['course'], //course condition |
|
3967 | + $course['real_id'], //course condition |
|
3968 | + $fields['user'], //user condition |
|
3969 | + $userId, //user condition |
|
3970 | 3970 | $fields['user'] //GROUP BY |
3971 | 3971 | ); |
3972 | 3972 | $rs = Database::query($sql); |
@@ -3974,7 +3974,7 @@ discard block |
||
3974 | 3974 | //iterate query |
3975 | 3975 | if (Database::num_rows($rs) > 0) { |
3976 | 3976 | while ($row = Database::fetch_array($rs)) { |
3977 | - $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total]: $row['total']; |
|
3977 | + $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total] : $row['total']; |
|
3978 | 3978 | } |
3979 | 3979 | } |
3980 | 3980 | } |
@@ -3997,11 +3997,11 @@ discard block |
||
3997 | 3997 | $courseId = api_get_course_int_id($course_code); |
3998 | 3998 | $data = array(); |
3999 | 3999 | |
4000 | - $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
4000 | + $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
4001 | 4001 | $condition_session = ''; |
4002 | 4002 | if (isset($session_id)) { |
4003 | 4003 | $session_id = intval($session_id); |
4004 | - $condition_session = ' AND down_session_id = '. $session_id; |
|
4004 | + $condition_session = ' AND down_session_id = '.$session_id; |
|
4005 | 4005 | } |
4006 | 4006 | $sql = "SELECT down_doc_path, COUNT(DISTINCT down_user_id), COUNT(down_doc_path) as count_down |
4007 | 4007 | FROM $TABLETRACK_DOWNLOADS |
@@ -4186,7 +4186,7 @@ discard block |
||
4186 | 4186 | |
4187 | 4187 | $final_course_data = array(); |
4188 | 4188 | |
4189 | - foreach($my_course_data as $course_id => $value) { |
|
4189 | + foreach ($my_course_data as $course_id => $value) { |
|
4190 | 4190 | $final_course_data[$course_id] = $course_list[$course_id]; |
4191 | 4191 | } |
4192 | 4192 | $course_in_session[$my_session_id]['course_list'] = $final_course_data; |
@@ -4207,7 +4207,7 @@ discard block |
||
4207 | 4207 | '.Display::tag('th', get_lang('Course'), array('width'=>'300px')).' |
4208 | 4208 | '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
4209 | 4209 | '.Display::tag('th', get_lang('Progress'), array('class'=>'head')).' |
4210 | - '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')),array('class'=>'head')).' |
|
4210 | + '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4211 | 4211 | '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
4212 | 4212 | '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
4213 | 4213 | </tr>'; |
@@ -4294,7 +4294,7 @@ discard block |
||
4294 | 4294 | $all_exercise_start_time = array(); |
4295 | 4295 | |
4296 | 4296 | foreach ($course_in_session as $my_session_id => $session_data) { |
4297 | - $course_list = $session_data['course_list']; |
|
4297 | + $course_list = $session_data['course_list']; |
|
4298 | 4298 | $user_count = count(SessionManager::get_users_by_session($my_session_id)); |
4299 | 4299 | $exercise_graph_name_list = array(); |
4300 | 4300 | //$user_results = array(); |
@@ -4339,20 +4339,20 @@ discard block |
||
4339 | 4339 | |
4340 | 4340 | $score = 0; |
4341 | 4341 | if (!empty($user_result_data['exe_weighting']) && intval($user_result_data['exe_weighting']) != 0) { |
4342 | - $score = intval($user_result_data['exe_result']/$user_result_data['exe_weighting'] * 100); |
|
4342 | + $score = intval($user_result_data['exe_result'] / $user_result_data['exe_weighting'] * 100); |
|
4343 | 4343 | } |
4344 | 4344 | $time = api_strtotime($exercise_data['start_time']) ? api_strtotime($exercise_data['start_time'], 'UTC') : 0; |
4345 | 4345 | $all_exercise_start_time[] = $time; |
4346 | 4346 | $my_results[] = $score; |
4347 | - if (count($exercise_list)<=10) { |
|
4347 | + if (count($exercise_list) <= 10) { |
|
4348 | 4348 | $title = cut($course_data['title'], 30)." \n ".cut($exercise_data['title'], 30); |
4349 | - $exercise_graph_name_list[]= $title; |
|
4349 | + $exercise_graph_name_list[] = $title; |
|
4350 | 4350 | $all_exercise_graph_name_list[] = $title; |
4351 | 4351 | } else { |
4352 | 4352 | // if there are more than 10 results, space becomes difficult to find, so only show the title of the exercise, not the tool |
4353 | 4353 | $title = cut($exercise_data['title'], 30); |
4354 | - $exercise_graph_name_list[]= $title; |
|
4355 | - $all_exercise_graph_name_list[]= $title; |
|
4354 | + $exercise_graph_name_list[] = $title; |
|
4355 | + $all_exercise_graph_name_list[] = $title; |
|
4356 | 4356 | } |
4357 | 4357 | } |
4358 | 4358 | } |
@@ -4385,7 +4385,7 @@ discard block |
||
4385 | 4385 | } |
4386 | 4386 | |
4387 | 4387 | $html .= Display::page_subheader( |
4388 | - Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('Sessions') |
|
4388 | + Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL).' '.get_lang('Sessions') |
|
4389 | 4389 | ); |
4390 | 4390 | |
4391 | 4391 | $html .= '<table class="data_table" width="100%">'; |
@@ -4435,7 +4435,7 @@ discard block |
||
4435 | 4435 | $courseInfo['real_id'], |
4436 | 4436 | $my_session_id |
4437 | 4437 | ); |
4438 | - if ($attempts > 1) { |
|
4438 | + if ($attempts > 1) { |
|
4439 | 4439 | $answered_exercises++; |
4440 | 4440 | } |
4441 | 4441 | } |
@@ -4448,7 +4448,7 @@ discard block |
||
4448 | 4448 | $all_average += $average; |
4449 | 4449 | } |
4450 | 4450 | |
4451 | - $all_average = $all_average / count($course_list); |
|
4451 | + $all_average = $all_average / count($course_list); |
|
4452 | 4452 | |
4453 | 4453 | if (isset($_GET['session_id']) && $my_session_id == $_GET['session_id']) { |
4454 | 4454 | $html .= '<tr style="background-color:#FBF09D">'; |
@@ -4473,31 +4473,31 @@ discard block |
||
4473 | 4473 | $html .= '</tr>'; |
4474 | 4474 | } |
4475 | 4475 | $html .= '</table><br />'; |
4476 | - $html .= Display::div($main_session_graph, array('id'=>'session_graph','class'=>'chart-session', 'style'=>'position:relative; text-align: center;') ); |
|
4476 | + $html .= Display::div($main_session_graph, array('id'=>'session_graph', 'class'=>'chart-session', 'style'=>'position:relative; text-align: center;')); |
|
4477 | 4477 | |
4478 | 4478 | // Checking selected session. |
4479 | 4479 | |
4480 | 4480 | if (isset($_GET['session_id'])) { |
4481 | 4481 | $session_id_from_get = intval($_GET['session_id']); |
4482 | - $session_data = $course_in_session[$session_id_from_get]; |
|
4483 | - $course_list = $session_data['course_list']; |
|
4482 | + $session_data = $course_in_session[$session_id_from_get]; |
|
4483 | + $course_list = $session_data['course_list']; |
|
4484 | 4484 | |
4485 | - $html .= Display::tag('h3',$session_data['name'].' - '.get_lang('CourseList')); |
|
4485 | + $html .= Display::tag('h3', $session_data['name'].' - '.get_lang('CourseList')); |
|
4486 | 4486 | |
4487 | 4487 | $html .= '<table class="data_table" width="100%">'; |
4488 | 4488 | //'.Display::tag('th', get_lang('DoneExercises'), array('class'=>'head')).' |
4489 | 4489 | $html .= ' |
4490 | 4490 | <tr> |
4491 | 4491 | <th width="300px">'.get_lang('Course').'</th> |
4492 | - '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).' |
|
4493 | - '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).' |
|
4494 | - '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).' |
|
4495 | - '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).' |
|
4496 | - '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
|
4497 | - '.Display::tag('th', get_lang('LPProgress') , array('class'=>'head')).' |
|
4498 | - '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4499 | - '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
|
4500 | - '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
|
4492 | + '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).' |
|
4493 | + '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).' |
|
4494 | + '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).' |
|
4495 | + '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).' |
|
4496 | + '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
|
4497 | + '.Display::tag('th', get_lang('LPProgress'), array('class'=>'head')).' |
|
4498 | + '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4499 | + '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
|
4500 | + '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
|
4501 | 4501 | </tr>'; |
4502 | 4502 | |
4503 | 4503 | foreach ($course_list as $course_data) { |
@@ -4513,14 +4513,14 @@ discard block |
||
4513 | 4513 | $count_exercises = count($exercises); |
4514 | 4514 | } |
4515 | 4515 | $answered_exercises = 0; |
4516 | - foreach($exercises as $exercise_item) { |
|
4516 | + foreach ($exercises as $exercise_item) { |
|
4517 | 4517 | $attempts = Event::count_exercise_attempts_by_user( |
4518 | 4518 | api_get_user_id(), |
4519 | 4519 | $exercise_item['id'], |
4520 | 4520 | $courseId, |
4521 | 4521 | $session_id_from_get |
4522 | 4522 | ); |
4523 | - if ($attempts > 1) { |
|
4523 | + if ($attempts > 1) { |
|
4524 | 4524 | $answered_exercises++; |
4525 | 4525 | } |
4526 | 4526 | } |
@@ -4529,7 +4529,7 @@ discard block |
||
4529 | 4529 | |
4530 | 4530 | // Average |
4531 | 4531 | $average = ExerciseLib::get_average_score_by_course($courseId, $session_id_from_get); |
4532 | - $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get); |
|
4532 | + $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get); |
|
4533 | 4533 | |
4534 | 4534 | $stats_array[$course_code] = array( |
4535 | 4535 | 'exercises' => $count_exercises, |
@@ -4599,11 +4599,11 @@ discard block |
||
4599 | 4599 | } |
4600 | 4600 | //Score |
4601 | 4601 | $html .= Display::tag('td', $percentage_score, array('align'=>'center')); |
4602 | - $html .= Display::tag('td', $last_connection, array('align'=>'center')); |
|
4602 | + $html .= Display::tag('td', $last_connection, array('align'=>'center')); |
|
4603 | 4603 | |
4604 | 4604 | if ($course_code == $courseCodeFromGet && $_GET['session_id'] == $session_id_from_get) { |
4605 | 4605 | $details = '<a href="#">'; |
4606 | - $details .=Display::return_icon('2rightarrow_na.png', get_lang('Details')); |
|
4606 | + $details .= Display::return_icon('2rightarrow_na.png', get_lang('Details')); |
|
4607 | 4607 | } else { |
4608 | 4608 | $details = '<a href="'.api_get_self().'?course='.$course_code.'&session_id='.$session_id_from_get.$extra_params.'">'; |
4609 | 4609 | $details .= Display::return_icon('2rightarrow.png', get_lang('Details')); |
@@ -4726,7 +4726,7 @@ discard block |
||
4726 | 4726 | ); |
4727 | 4727 | |
4728 | 4728 | $latest_attempt_url = ''; |
4729 | - $best_score = $position = $percentage_score_result = '-'; |
|
4729 | + $best_score = $position = $percentage_score_result = '-'; |
|
4730 | 4730 | $graph = $normal_graph = null; |
4731 | 4731 | |
4732 | 4732 | // Getting best results |
@@ -4762,7 +4762,7 @@ discard block |
||
4762 | 4762 | $percentage_score_result = Display::url(ExerciseLib::show_score($score, $weighting), $latest_attempt_url); |
4763 | 4763 | $my_score = 0; |
4764 | 4764 | if (!empty($weighting) && intval($weighting) != 0) { |
4765 | - $my_score = $score/$weighting; |
|
4765 | + $my_score = $score / $weighting; |
|
4766 | 4766 | } |
4767 | 4767 | //@todo this function slows the page |
4768 | 4768 | $position = ExerciseLib::get_exercise_result_ranking($my_score, $exe_id, $exercices['id'], $course_info['code'], $session_id, $user_list); |
@@ -4773,14 +4773,14 @@ discard block |
||
4773 | 4773 | } |
4774 | 4774 | $html .= Display::div( |
4775 | 4775 | $normal_graph, |
4776 | - array('id'=>'main_graph_'.$exercices['id'],'class'=>'dialog', 'style'=>'display:none') |
|
4776 | + array('id'=>'main_graph_'.$exercices['id'], 'class'=>'dialog', 'style'=>'display:none') |
|
4777 | 4777 | ); |
4778 | 4778 | |
4779 | 4779 | if (empty($graph)) { |
4780 | 4780 | $graph = '-'; |
4781 | 4781 | } else { |
4782 | 4782 | $graph = Display::url( |
4783 | - '<img src="' . $graph . '" >', |
|
4783 | + '<img src="'.$graph.'" >', |
|
4784 | 4784 | $normal_graph, |
4785 | 4785 | array( |
4786 | 4786 | 'id' => $exercices['id'], |
@@ -4813,7 +4813,7 @@ discard block |
||
4813 | 4813 | |
4814 | 4814 | |
4815 | 4815 | // LP table results |
4816 | - $html .='<table class="data_table">'; |
|
4816 | + $html .= '<table class="data_table">'; |
|
4817 | 4817 | $html .= Display::tag('th', get_lang('Learnpaths'), array('class'=>'head', 'style'=>'color:#000')); |
4818 | 4818 | $html .= Display::tag('th', get_lang('LatencyTimeSpent'), array('class'=>'head', 'style'=>'color:#000')); |
4819 | 4819 | $html .= Display::tag('th', get_lang('Progress'), array('class'=>'head', 'style'=>'color:#000')); |
@@ -4867,7 +4867,7 @@ discard block |
||
4867 | 4867 | if (!empty($last_connection_in_lp)) { |
4868 | 4868 | $last_connection = api_convert_and_format_date($last_connection_in_lp, DATE_TIME_FORMAT_LONG); |
4869 | 4869 | } |
4870 | - $html .= Display::tag('td', $last_connection, array('align'=>'center','width'=>'180px')); |
|
4870 | + $html .= Display::tag('td', $last_connection, array('align'=>'center', 'width'=>'180px')); |
|
4871 | 4871 | $html .= "</tr>"; |
4872 | 4872 | } |
4873 | 4873 | } else { |
@@ -4877,7 +4877,7 @@ discard block |
||
4877 | 4877 | </td> |
4878 | 4878 | </tr>'; |
4879 | 4879 | } |
4880 | - $html .='</table>'; |
|
4880 | + $html .= '</table>'; |
|
4881 | 4881 | } |
4882 | 4882 | |
4883 | 4883 | return $html; |
@@ -4904,7 +4904,7 @@ discard block |
||
4904 | 4904 | $myData->setSerieDescription('Serie1', get_lang('MyResults')); |
4905 | 4905 | $myData->setSerieDescription('Serie2', get_lang('AverageScore')); |
4906 | 4906 | $myData->setAxisUnit(0, '%'); |
4907 | - $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
4907 | + $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
4908 | 4908 | // Cache definition |
4909 | 4909 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
4910 | 4910 | $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1))); |
@@ -4912,9 +4912,9 @@ discard block |
||
4912 | 4912 | |
4913 | 4913 | if ($myCache->isInCache($chartHash)) { |
4914 | 4914 | //if we already created the img |
4915 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
4915 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
4916 | 4916 | $myCache->saveFromCache($chartHash, $imgPath); |
4917 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
4917 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
4918 | 4918 | } else { |
4919 | 4919 | /* Define width, height and angle */ |
4920 | 4920 | $mainWidth = 860; |
@@ -4943,7 +4943,7 @@ discard block |
||
4943 | 4943 | /* Set the default font */ |
4944 | 4944 | $myPicture->setFontProperties( |
4945 | 4945 | array( |
4946 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
4946 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
4947 | 4947 | 'FontSize' => 10) |
4948 | 4948 | ); |
4949 | 4949 | /* Write the chart title */ |
@@ -4960,7 +4960,7 @@ discard block |
||
4960 | 4960 | /* Set the default font */ |
4961 | 4961 | $myPicture->setFontProperties( |
4962 | 4962 | array( |
4963 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
4963 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
4964 | 4964 | 'FontSize' => 6 |
4965 | 4965 | ) |
4966 | 4966 | ); |
@@ -5002,7 +5002,7 @@ discard block |
||
5002 | 5002 | /* Draw the line chart */ |
5003 | 5003 | $myPicture->setFontProperties( |
5004 | 5004 | array( |
5005 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
5005 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
5006 | 5006 | 'FontSize' => 10 |
5007 | 5007 | ) |
5008 | 5008 | ); |
@@ -5035,12 +5035,12 @@ discard block |
||
5035 | 5035 | ); |
5036 | 5036 | |
5037 | 5037 | $myCache->writeToCache($chartHash, $myPicture); |
5038 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5038 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5039 | 5039 | $myCache->saveFromCache($chartHash, $imgPath); |
5040 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5040 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5041 | 5041 | } |
5042 | 5042 | |
5043 | - $html = '<img src="' . $imgPath . '">'; |
|
5043 | + $html = '<img src="'.$imgPath.'">'; |
|
5044 | 5044 | |
5045 | 5045 | return $html; |
5046 | 5046 | } |
@@ -5061,12 +5061,12 @@ discard block |
||
5061 | 5061 | |
5062 | 5062 | foreach ($attempts as $attempt) { |
5063 | 5063 | if (api_get_user_id() == $attempt['exe_user_id']) { |
5064 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5065 | - $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5064 | + if ($attempt['exe_weighting'] != 0) { |
|
5065 | + $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5066 | 5066 | } |
5067 | 5067 | } else { |
5068 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5069 | - $exercise_result[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5068 | + if ($attempt['exe_weighting'] != 0) { |
|
5069 | + $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5070 | 5070 | } |
5071 | 5071 | } |
5072 | 5072 | } |
@@ -5075,27 +5075,27 @@ discard block |
||
5075 | 5075 | rsort($my_exercise_result_array); |
5076 | 5076 | $my_exercise_result = 0; |
5077 | 5077 | if (isset($my_exercise_result_array[0])) { |
5078 | - $my_exercise_result = $my_exercise_result_array[0] *100; |
|
5078 | + $my_exercise_result = $my_exercise_result_array[0] * 100; |
|
5079 | 5079 | } |
5080 | 5080 | |
5081 | 5081 | $max = 100; |
5082 | - $pieces = 5 ; |
|
5082 | + $pieces = 5; |
|
5083 | 5083 | $part = round($max / $pieces); |
5084 | 5084 | $x_axis = array(); |
5085 | 5085 | $final_array = array(); |
5086 | 5086 | $my_final_array = array(); |
5087 | 5087 | |
5088 | - for ($i=1; $i <=$pieces; $i++) { |
|
5088 | + for ($i = 1; $i <= $pieces; $i++) { |
|
5089 | 5089 | $sum = 1; |
5090 | 5090 | if ($i == 1) { |
5091 | 5091 | $sum = 0; |
5092 | 5092 | } |
5093 | - $min = ($i-1)*$part + $sum; |
|
5094 | - $max = ($i)*$part; |
|
5095 | - $x_axis[]= $min." - ".$max; |
|
5093 | + $min = ($i - 1) * $part + $sum; |
|
5094 | + $max = ($i) * $part; |
|
5095 | + $x_axis[] = $min." - ".$max; |
|
5096 | 5096 | $count = 0; |
5097 | - foreach($exercise_result as $result) { |
|
5098 | - $percentage = $result*100; |
|
5097 | + foreach ($exercise_result as $result) { |
|
5098 | + $percentage = $result * 100; |
|
5099 | 5099 | //echo $percentage.' - '.$min.' - '.$max."<br />"; |
5100 | 5100 | if ($percentage >= $min && $percentage <= $max) { |
5101 | 5101 | //echo ' is > '; |
@@ -5103,7 +5103,7 @@ discard block |
||
5103 | 5103 | } |
5104 | 5104 | } |
5105 | 5105 | //echo '<br />'; |
5106 | - $final_array[]= $count; |
|
5106 | + $final_array[] = $count; |
|
5107 | 5107 | |
5108 | 5108 | if ($my_exercise_result >= $min && $my_exercise_result <= $max) { |
5109 | 5109 | $my_final_array[] = 1; |
@@ -5113,9 +5113,9 @@ discard block |
||
5113 | 5113 | } |
5114 | 5114 | |
5115 | 5115 | //Fix to remove the data of the user with my data |
5116 | - for($i = 0; $i<=count($my_final_array); $i++) { |
|
5116 | + for ($i = 0; $i <= count($my_final_array); $i++) { |
|
5117 | 5117 | if (!empty($my_final_array[$i])) { |
5118 | - $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5118 | + $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5119 | 5119 | $final_array[$i] = 0; |
5120 | 5120 | } |
5121 | 5121 | } |
@@ -5125,16 +5125,16 @@ discard block |
||
5125 | 5125 | $dataSet->addPoints($final_array, 'Serie1'); |
5126 | 5126 | $dataSet->addPoints($my_final_array, 'Serie2'); |
5127 | 5127 | $dataSet->normalize(100, "%"); |
5128 | - $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5128 | + $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5129 | 5129 | |
5130 | 5130 | // Cache definition |
5131 | 5131 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
5132 | 5132 | $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1))); |
5133 | 5133 | $chartHash = $myCache->getHash($dataSet); |
5134 | 5134 | if ($myCache->isInCache($chartHash)) { |
5135 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5135 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5136 | 5136 | $myCache->saveFromCache($chartHash, $imgPath); |
5137 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5137 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5138 | 5138 | } else { |
5139 | 5139 | /* Create the pChart object */ |
5140 | 5140 | $widthSize = 80; |
@@ -5150,7 +5150,7 @@ discard block |
||
5150 | 5150 | $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); |
5151 | 5151 | |
5152 | 5152 | /* Set the default font */ |
5153 | - $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize)); |
|
5153 | + $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize)); |
|
5154 | 5154 | |
5155 | 5155 | /* Do not write the chart title */ |
5156 | 5156 | |
@@ -5214,9 +5214,9 @@ discard block |
||
5214 | 5214 | |
5215 | 5215 | /* Save and write in cache */ |
5216 | 5216 | $myCache->writeToCache($chartHash, $myPicture); |
5217 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5217 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5218 | 5218 | $myCache->saveFromCache($chartHash, $imgPath); |
5219 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5219 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5220 | 5220 | } |
5221 | 5221 | |
5222 | 5222 | return $imgPath; |
@@ -5236,12 +5236,12 @@ discard block |
||
5236 | 5236 | } |
5237 | 5237 | foreach ($attempts as $attempt) { |
5238 | 5238 | if (api_get_user_id() == $attempt['exe_user_id']) { |
5239 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5240 | - $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5239 | + if ($attempt['exe_weighting'] != 0) { |
|
5240 | + $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5241 | 5241 | } |
5242 | 5242 | } else { |
5243 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5244 | - $exercise_result[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5243 | + if ($attempt['exe_weighting'] != 0) { |
|
5244 | + $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5245 | 5245 | } |
5246 | 5246 | } |
5247 | 5247 | } |
@@ -5250,32 +5250,32 @@ discard block |
||
5250 | 5250 | rsort($my_exercise_result_array); |
5251 | 5251 | $my_exercise_result = 0; |
5252 | 5252 | if (isset($my_exercise_result_array[0])) { |
5253 | - $my_exercise_result = $my_exercise_result_array[0] *100; |
|
5253 | + $my_exercise_result = $my_exercise_result_array[0] * 100; |
|
5254 | 5254 | } |
5255 | 5255 | |
5256 | 5256 | $max = 100; |
5257 | - $pieces = 5 ; |
|
5257 | + $pieces = 5; |
|
5258 | 5258 | $part = round($max / $pieces); |
5259 | 5259 | $x_axis = array(); |
5260 | 5260 | $final_array = array(); |
5261 | 5261 | $my_final_array = array(); |
5262 | 5262 | |
5263 | - for ($i=1; $i <=$pieces; $i++) { |
|
5263 | + for ($i = 1; $i <= $pieces; $i++) { |
|
5264 | 5264 | $sum = 1; |
5265 | 5265 | if ($i == 1) { |
5266 | 5266 | $sum = 0; |
5267 | 5267 | } |
5268 | - $min = ($i-1)*$part + $sum; |
|
5269 | - $max = ($i)*$part; |
|
5270 | - $x_axis[]= $min." - ".$max; |
|
5268 | + $min = ($i - 1) * $part + $sum; |
|
5269 | + $max = ($i) * $part; |
|
5270 | + $x_axis[] = $min." - ".$max; |
|
5271 | 5271 | $count = 0; |
5272 | - foreach($exercise_result as $result) { |
|
5273 | - $percentage = $result*100; |
|
5272 | + foreach ($exercise_result as $result) { |
|
5273 | + $percentage = $result * 100; |
|
5274 | 5274 | if ($percentage >= $min && $percentage <= $max) { |
5275 | 5275 | $count++; |
5276 | 5276 | } |
5277 | 5277 | } |
5278 | - $final_array[]= $count; |
|
5278 | + $final_array[] = $count; |
|
5279 | 5279 | |
5280 | 5280 | if ($my_exercise_result >= $min && $my_exercise_result <= $max) { |
5281 | 5281 | $my_final_array[] = 1; |
@@ -5286,9 +5286,9 @@ discard block |
||
5286 | 5286 | |
5287 | 5287 | //Fix to remove the data of the user with my data |
5288 | 5288 | |
5289 | - for($i = 0; $i<=count($my_final_array); $i++) { |
|
5289 | + for ($i = 0; $i <= count($my_final_array); $i++) { |
|
5290 | 5290 | if (!empty($my_final_array[$i])) { |
5291 | - $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5291 | + $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5292 | 5292 | $final_array[$i] = 0; |
5293 | 5293 | } |
5294 | 5294 | } |
@@ -5306,7 +5306,7 @@ discard block |
||
5306 | 5306 | $dataSet->setXAxisName(get_lang('Score')); |
5307 | 5307 | $dataSet->normalize(100, "%"); |
5308 | 5308 | |
5309 | - $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5309 | + $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5310 | 5310 | |
5311 | 5311 | // Cache definition |
5312 | 5312 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
@@ -5314,9 +5314,9 @@ discard block |
||
5314 | 5314 | $chartHash = $myCache->getHash($dataSet); |
5315 | 5315 | |
5316 | 5316 | if ($myCache->isInCache($chartHash)) { |
5317 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5317 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5318 | 5318 | $myCache->saveFromCache($chartHash, $imgPath); |
5319 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5319 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5320 | 5320 | } else { |
5321 | 5321 | /* Create the pChart object */ |
5322 | 5322 | $widthSize = 480; |
@@ -5332,7 +5332,7 @@ discard block |
||
5332 | 5332 | $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); |
5333 | 5333 | |
5334 | 5334 | /* Set the default font */ |
5335 | - $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10)); |
|
5335 | + $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => 10)); |
|
5336 | 5336 | |
5337 | 5337 | /* Write the chart title */ |
5338 | 5338 | $myPicture->drawText( |
@@ -5391,9 +5391,9 @@ discard block |
||
5391 | 5391 | |
5392 | 5392 | /* Write and save into cache */ |
5393 | 5393 | $myCache->writeToCache($chartHash, $myPicture); |
5394 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5394 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5395 | 5395 | $myCache->saveFromCache($chartHash, $imgPath); |
5396 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5396 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5397 | 5397 | } |
5398 | 5398 | |
5399 | 5399 | return $imgPath; |
@@ -5519,7 +5519,7 @@ discard block |
||
5519 | 5519 | $whereSessionParams .= $sessionIdx.','; |
5520 | 5520 | } |
5521 | 5521 | } |
5522 | - $whereSessionParams = substr($whereSessionParams,0,-1); |
|
5522 | + $whereSessionParams = substr($whereSessionParams, 0, -1); |
|
5523 | 5523 | } |
5524 | 5524 | |
5525 | 5525 | if (!empty($exerciseId)) { |
@@ -5580,7 +5580,7 @@ discard block |
||
5580 | 5580 | qq.position = rq.question_order AND |
5581 | 5581 | ta.question_id = rq.question_id |
5582 | 5582 | WHERE |
5583 | - te.c_id = $courseIdx ".(empty($whereSessionParams)?'':"AND te.session_id IN ($whereSessionParams)")." |
|
5583 | + te.c_id = $courseIdx ".(empty($whereSessionParams) ? '' : "AND te.session_id IN ($whereSessionParams)")." |
|
5584 | 5584 | AND q.c_id = $courseIdx |
5585 | 5585 | $where $order $limit"; |
5586 | 5586 | $sql_query = vsprintf($sql, $whereParams); |
@@ -5628,7 +5628,7 @@ discard block |
||
5628 | 5628 | // Now fill users data |
5629 | 5629 | $sqlUsers = "SELECT user_id, username, lastname, firstname |
5630 | 5630 | FROM $tuser |
5631 | - WHERE user_id IN (".implode(',',$userIds).")"; |
|
5631 | + WHERE user_id IN (".implode(',', $userIds).")"; |
|
5632 | 5632 | $resUsers = Database::query($sqlUsers); |
5633 | 5633 | while ($rowUser = Database::fetch_assoc($resUsers)) { |
5634 | 5634 | $users[$rowUser['user_id']] = $rowUser; |
@@ -5689,7 +5689,7 @@ discard block |
||
5689 | 5689 | WHERE |
5690 | 5690 | track_resource.c_id = $course_id AND |
5691 | 5691 | track_resource.insert_user_id = user.user_id AND |
5692 | - session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5692 | + session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5693 | 5693 | |
5694 | 5694 | if (isset($_GET['keyword'])) { |
5695 | 5695 | $keyword = Database::escape_string(trim($_GET['keyword'])); |
@@ -5747,7 +5747,7 @@ discard block |
||
5747 | 5747 | WHERE |
5748 | 5748 | track_resource.c_id = $course_id AND |
5749 | 5749 | track_resource.insert_user_id = user.user_id AND |
5750 | - session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5750 | + session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5751 | 5751 | |
5752 | 5752 | if (isset($_GET['keyword'])) { |
5753 | 5753 | $keyword = Database::escape_string(trim($_GET['keyword'])); |
@@ -6041,7 +6041,7 @@ discard block |
||
6041 | 6041 | public static function display_additional_profile_fields() |
6042 | 6042 | { |
6043 | 6043 | // getting all the extra profile fields that are defined by the platform administrator |
6044 | - $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6044 | + $extra_fields = UserManager :: get_extra_fields(0, 50, 5, 'ASC'); |
|
6045 | 6045 | |
6046 | 6046 | // creating the form |
6047 | 6047 | $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
@@ -6053,8 +6053,8 @@ discard block |
||
6053 | 6053 | $extra_fields_to_show = 0; |
6054 | 6054 | foreach ($extra_fields as $key=>$field) { |
6055 | 6055 | // show only extra fields that are visible + and can be filtered, added by J.Montoya |
6056 | - if ($field[6]==1 && $field[8] == 1) { |
|
6057 | - if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6056 | + if ($field[6] == 1 && $field[8] == 1) { |
|
6057 | + if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field']) { |
|
6058 | 6058 | $selected = 'selected="selected"'; |
6059 | 6059 | } else { |
6060 | 6060 | $selected = ''; |
@@ -6066,8 +6066,8 @@ discard block |
||
6066 | 6066 | $return .= '</select>'; |
6067 | 6067 | |
6068 | 6068 | // the form elements for the $_GET parameters (because the form is passed through GET |
6069 | - foreach ($_GET as $key=>$value){ |
|
6070 | - if ($key <> 'additional_profile_field') { |
|
6069 | + foreach ($_GET as $key=>$value) { |
|
6070 | + if ($key <> 'additional_profile_field') { |
|
6071 | 6071 | $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
6072 | 6072 | } |
6073 | 6073 | } |
@@ -6104,21 +6104,21 @@ discard block |
||
6104 | 6104 | $result_extra_field = UserManager::get_extra_field_information($field_id); |
6105 | 6105 | |
6106 | 6106 | if (!empty($users)) { |
6107 | - if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6108 | - foreach($users as $user_id) { |
|
6107 | + if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG) { |
|
6108 | + foreach ($users as $user_id) { |
|
6109 | 6109 | $user_result = UserManager::get_user_tags($user_id, $field_id); |
6110 | 6110 | $tag_list = array(); |
6111 | - foreach($user_result as $item) { |
|
6111 | + foreach ($user_result as $item) { |
|
6112 | 6112 | $tag_list[] = $item['tag']; |
6113 | 6113 | } |
6114 | - $return[$user_id][] = implode(', ',$tag_list); |
|
6114 | + $return[$user_id][] = implode(', ', $tag_list); |
|
6115 | 6115 | } |
6116 | 6116 | } else { |
6117 | 6117 | $new_user_array = array(); |
6118 | 6118 | foreach ($users as $user_id) { |
6119 | - $new_user_array[]= "'".$user_id."'"; |
|
6119 | + $new_user_array[] = "'".$user_id."'"; |
|
6120 | 6120 | } |
6121 | - $users = implode(',',$new_user_array); |
|
6121 | + $users = implode(',', $new_user_array); |
|
6122 | 6122 | $extraFieldType = EntityExtraField::USER_FIELD_TYPE; |
6123 | 6123 | // Selecting only the necessary information NOT ALL the user list |
6124 | 6124 | $sql = "SELECT user.user_id, v.value |
@@ -6133,7 +6133,7 @@ discard block |
||
6133 | 6133 | user.user_id IN ($users)"; |
6134 | 6134 | |
6135 | 6135 | $result = Database::query($sql); |
6136 | - while($row = Database::fetch_array($result)) { |
|
6136 | + while ($row = Database::fetch_array($result)) { |
|
6137 | 6137 | // get option value for field type double select by id |
6138 | 6138 | if (!empty($row['value'])) { |
6139 | 6139 | if ($result_extra_field['field_type'] == |
@@ -6172,7 +6172,7 @@ discard block |
||
6172 | 6172 | |
6173 | 6173 | public function sort_users_desc($a, $b) |
6174 | 6174 | { |
6175 | - return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6175 | + return strcmp(trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6176 | 6176 | } |
6177 | 6177 | |
6178 | 6178 | /** |
@@ -6207,7 +6207,7 @@ discard block |
||
6207 | 6207 | // get all users data from a course for sortable with limit |
6208 | 6208 | if (is_array($user_ids)) { |
6209 | 6209 | $user_ids = array_map('intval', $user_ids); |
6210 | - $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6210 | + $condition_user = " WHERE user.user_id IN (".implode(',', $user_ids).") "; |
|
6211 | 6211 | } else { |
6212 | 6212 | $user_ids = intval($user_ids); |
6213 | 6213 | $condition_user = " WHERE user.user_id = $user_ids "; |
@@ -6215,7 +6215,7 @@ discard block |
||
6215 | 6215 | |
6216 | 6216 | if (!empty($_GET['user_keyword'])) { |
6217 | 6217 | $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
6218 | - $condition_user .= " AND ( |
|
6218 | + $condition_user .= " AND ( |
|
6219 | 6219 | user.firstname LIKE '%".$keyword."%' OR |
6220 | 6220 | user.lastname LIKE '%".$keyword."%' OR |
6221 | 6221 | user.username LIKE '%".$keyword."%' OR |
@@ -6233,7 +6233,7 @@ discard block |
||
6233 | 6233 | $invitedUsersCondition = ''; |
6234 | 6234 | |
6235 | 6235 | if (!$includeInvitedUsers) { |
6236 | - $invitedUsersCondition = " AND user.status != " . INVITEE; |
|
6236 | + $invitedUsersCondition = " AND user.status != ".INVITEE; |
|
6237 | 6237 | } |
6238 | 6238 | |
6239 | 6239 | $sql = "SELECT user.user_id as user_id, |
@@ -6244,7 +6244,7 @@ discard block |
||
6244 | 6244 | FROM $tbl_user as user $url_table |
6245 | 6245 | $condition_user $url_condition $invitedUsersCondition"; |
6246 | 6246 | |
6247 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
6247 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
6248 | 6248 | $direction = 'ASC'; |
6249 | 6249 | } |
6250 | 6250 | |
@@ -6381,7 +6381,7 @@ discard block |
||
6381 | 6381 | } |
6382 | 6382 | |
6383 | 6383 | if (empty($session_id)) { |
6384 | - $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys; |
|
6384 | + $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0).' / '.$total_surveys; |
|
6385 | 6385 | } |
6386 | 6386 | |
6387 | 6387 | $user['link'] = '<center><a href="../mySpace/myStudents.php?student='.$user['user_id'].'&details=true&course='.$course_code.'&origin=tracking_course&id_session='.$session_id.'"><img src="'.api_get_path(WEB_IMG_PATH).'icons/22/2rightarrow.png" border="0" /></a></center>'; |
@@ -6391,35 +6391,35 @@ discard block |
||
6391 | 6391 | $is_western_name_order = api_is_western_name_order(); |
6392 | 6392 | $user_row = array(); |
6393 | 6393 | |
6394 | - $user_row[]= $user['official_code']; //0 |
|
6394 | + $user_row[] = $user['official_code']; //0 |
|
6395 | 6395 | |
6396 | 6396 | if ($is_western_name_order) { |
6397 | - $user_row[]= $user['firstname']; |
|
6398 | - $user_row[]= $user['lastname']; |
|
6397 | + $user_row[] = $user['firstname']; |
|
6398 | + $user_row[] = $user['lastname']; |
|
6399 | 6399 | } else { |
6400 | - $user_row[]= $user['lastname']; |
|
6401 | - $user_row[]= $user['firstname']; |
|
6400 | + $user_row[] = $user['lastname']; |
|
6401 | + $user_row[] = $user['firstname']; |
|
6402 | 6402 | } |
6403 | - $user_row[]= $user['username']; |
|
6404 | - $user_row[]= $user['time']; |
|
6405 | - $user_row[]= $user['average_progress']; |
|
6406 | - $user_row[]= $user['exercise_progress']; |
|
6407 | - $user_row[]= $user['exercise_average_best_attempt']; |
|
6408 | - $user_row[]= $user['student_score']; |
|
6409 | - $user_row[]= $user['count_assignments']; |
|
6410 | - $user_row[]= $user['count_messages']; |
|
6403 | + $user_row[] = $user['username']; |
|
6404 | + $user_row[] = $user['time']; |
|
6405 | + $user_row[] = $user['average_progress']; |
|
6406 | + $user_row[] = $user['exercise_progress']; |
|
6407 | + $user_row[] = $user['exercise_average_best_attempt']; |
|
6408 | + $user_row[] = $user['student_score']; |
|
6409 | + $user_row[] = $user['count_assignments']; |
|
6410 | + $user_row[] = $user['count_messages']; |
|
6411 | 6411 | |
6412 | 6412 | if (empty($session_id)) { |
6413 | - $user_row[]= $user['survey']; |
|
6413 | + $user_row[] = $user['survey']; |
|
6414 | 6414 | } |
6415 | 6415 | |
6416 | - $user_row[]= $user['first_connection']; |
|
6417 | - $user_row[]= $user['last_connection']; |
|
6416 | + $user_row[] = $user['first_connection']; |
|
6417 | + $user_row[] = $user['last_connection']; |
|
6418 | 6418 | if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
6419 | - $user_row[]= $user['additional']; |
|
6419 | + $user_row[] = $user['additional']; |
|
6420 | 6420 | } |
6421 | 6421 | |
6422 | - $user_row[]= $user['link']; |
|
6422 | + $user_row[] = $user['link']; |
|
6423 | 6423 | |
6424 | 6424 | $users[] = $user_row; |
6425 | 6425 | |
@@ -6464,8 +6464,8 @@ discard block |
||
6464 | 6464 | |
6465 | 6465 | $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
6466 | 6466 | $tempView = $view; |
6467 | - if(substr($view,0,1) == '1') { |
|
6468 | - $new_view = substr_replace($view,'0',0,1); |
|
6467 | + if (substr($view, 0, 1) == '1') { |
|
6468 | + $new_view = substr_replace($view, '0', 0, 1); |
|
6469 | 6469 | echo " |
6470 | 6470 | <tr> |
6471 | 6471 | <td valign='top'> |
@@ -6498,9 +6498,9 @@ discard block |
||
6498 | 6498 | </tr>"; |
6499 | 6499 | $total = 0; |
6500 | 6500 | if (is_array($results)) { |
6501 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6501 | + for ($j = 0; $j < count($results); $j++) { |
|
6502 | 6502 | echo "<tr>"; |
6503 | - echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
6503 | + echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0]) - 1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
6504 | 6504 | echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
6505 | 6505 | echo"</tr>"; |
6506 | 6506 | $total = $total + $results[$j][1]; |
@@ -6517,7 +6517,7 @@ discard block |
||
6517 | 6517 | echo "</table>"; |
6518 | 6518 | echo "</td></tr>"; |
6519 | 6519 | } else { |
6520 | - $new_view = substr_replace($view,'1',0,1); |
|
6520 | + $new_view = substr_replace($view, '1', 0, 1); |
|
6521 | 6521 | echo " |
6522 | 6522 | <tr> |
6523 | 6523 | <td valign='top'> |
@@ -6540,8 +6540,8 @@ discard block |
||
6540 | 6540 | { |
6541 | 6541 | global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
6542 | 6542 | $courseId = api_get_course_int_id($courseCode); |
6543 | - if(substr($view,1,1) == '1') { |
|
6544 | - $new_view = substr_replace($view,'0',1,1); |
|
6543 | + if (substr($view, 1, 1) == '1') { |
|
6544 | + $new_view = substr_replace($view, '0', 1, 1); |
|
6545 | 6545 | echo "<tr> |
6546 | 6546 | <td valign='top'> |
6547 | 6547 | <font color='#0000FF'>- </font><b>".get_lang('ExercicesResults')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>] |
@@ -6583,7 +6583,7 @@ discard block |
||
6583 | 6583 | </tr>"; |
6584 | 6584 | |
6585 | 6585 | if (is_array($results)) { |
6586 | - for($i = 0; $i < sizeof($results); $i++) { |
|
6586 | + for ($i = 0; $i < sizeof($results); $i++) { |
|
6587 | 6587 | $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
6588 | 6588 | echo "<tr>\n"; |
6589 | 6589 | echo "<td class='content'>".$results[$i][0]."</td>\n"; |
@@ -6598,8 +6598,8 @@ discard block |
||
6598 | 6598 | |
6599 | 6599 | // The Result of Tests |
6600 | 6600 | if (is_array($hpresults)) { |
6601 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6602 | - $title = GetQuizName($hpresults[$i][0],''); |
|
6601 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
6602 | + $title = GetQuizName($hpresults[$i][0], ''); |
|
6603 | 6603 | if ($title == '') |
6604 | 6604 | $title = basename($hpresults[$i][0]); |
6605 | 6605 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
@@ -6625,7 +6625,7 @@ discard block |
||
6625 | 6625 | echo "</table>"; |
6626 | 6626 | echo "</td>\n</tr>\n"; |
6627 | 6627 | } else { |
6628 | - $new_view = substr_replace($view,'1',1,1); |
|
6628 | + $new_view = substr_replace($view, '1', 1, 1); |
|
6629 | 6629 | echo " |
6630 | 6630 | <tr> |
6631 | 6631 | <td valign='top'> |
@@ -6644,8 +6644,8 @@ discard block |
||
6644 | 6644 | global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
6645 | 6645 | $_course = api_get_course_info_by_id($course_id); |
6646 | 6646 | |
6647 | - if (substr($view,2,1) == '1') { |
|
6648 | - $new_view = substr_replace($view,'0',2,1); |
|
6647 | + if (substr($view, 2, 1) == '1') { |
|
6648 | + $new_view = substr_replace($view, '0', 2, 1); |
|
6649 | 6649 | echo "<tr> |
6650 | 6650 | <td valign='top'> |
6651 | 6651 | <font color='#0000FF'>- </font><b>".get_lang('WorkUploads')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>] |
@@ -6659,7 +6659,7 @@ discard block |
||
6659 | 6659 | AND u.c_id = '".intval($course_id)."' |
6660 | 6660 | ORDER BY u.upload_date DESC"; |
6661 | 6661 | echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
6662 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6662 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6663 | 6663 | echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
6664 | 6664 | echo "<tr> |
6665 | 6665 | <td class='secLine' width='40%'> |
@@ -6673,7 +6673,7 @@ discard block |
||
6673 | 6673 | </td> |
6674 | 6674 | </tr>"; |
6675 | 6675 | if (is_array($results)) { |
6676 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6676 | + for ($j = 0; $j < count($results); $j++) { |
|
6677 | 6677 | $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
6678 | 6678 | $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
6679 | 6679 | echo "<tr>"; |
@@ -6692,7 +6692,7 @@ discard block |
||
6692 | 6692 | echo "</table>"; |
6693 | 6693 | echo "</td></tr>"; |
6694 | 6694 | } else { |
6695 | - $new_view = substr_replace($view,'1',2,1); |
|
6695 | + $new_view = substr_replace($view, '1', 2, 1); |
|
6696 | 6696 | echo " |
6697 | 6697 | <tr> |
6698 | 6698 | <td valign='top'> |
@@ -6711,8 +6711,8 @@ discard block |
||
6711 | 6711 | { |
6712 | 6712 | global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
6713 | 6713 | $courseId = api_get_course_int_id($courseCode); |
6714 | - if (substr($view,3,1) == '1') { |
|
6715 | - $new_view = substr_replace($view,'0',3,1); |
|
6714 | + if (substr($view, 3, 1) == '1') { |
|
6715 | + $new_view = substr_replace($view, '0', 3, 1); |
|
6716 | 6716 | echo " |
6717 | 6717 | <tr> |
6718 | 6718 | <td valign='top'> |
@@ -6736,7 +6736,7 @@ discard block |
||
6736 | 6736 | </td> |
6737 | 6737 | </tr>"; |
6738 | 6738 | if (is_array($results)) { |
6739 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6739 | + for ($j = 0; $j < count($results); $j++) { |
|
6740 | 6740 | echo "<tr>"; |
6741 | 6741 | echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
6742 | 6742 | echo"</tr>"; |
@@ -6749,7 +6749,7 @@ discard block |
||
6749 | 6749 | echo "</table>"; |
6750 | 6750 | echo "</td></tr>"; |
6751 | 6751 | } else { |
6752 | - $new_view = substr_replace($view,'1',3,1); |
|
6752 | + $new_view = substr_replace($view, '1', 3, 1); |
|
6753 | 6753 | echo " |
6754 | 6754 | <tr> |
6755 | 6755 | <td valign='top'> |
@@ -6776,8 +6776,8 @@ discard block |
||
6776 | 6776 | $session_id = intval($session_id); |
6777 | 6777 | |
6778 | 6778 | $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
6779 | - if(substr($view,4,1) == '1') { |
|
6780 | - $new_view = substr_replace($view,'0',4,1); |
|
6779 | + if (substr($view, 4, 1) == '1') { |
|
6780 | + $new_view = substr_replace($view, '0', 4, 1); |
|
6781 | 6781 | echo " |
6782 | 6782 | <tr> |
6783 | 6783 | <td valign='top'> |
@@ -6803,7 +6803,7 @@ discard block |
||
6803 | 6803 | </td> |
6804 | 6804 | </tr>"; |
6805 | 6805 | if (is_array($results)) { |
6806 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6806 | + for ($j = 0; $j < count($results); $j++) { |
|
6807 | 6807 | echo "<tr>"; |
6808 | 6808 | echo "<td class='content'>".$results[$j]."</td>"; |
6809 | 6809 | echo"</tr>"; |
@@ -6816,7 +6816,7 @@ discard block |
||
6816 | 6816 | echo "</table>"; |
6817 | 6817 | echo "</td></tr>"; |
6818 | 6818 | } else { |
6819 | - $new_view = substr_replace($view,'1',4,1); |
|
6819 | + $new_view = substr_replace($view, '1', 4, 1); |
|
6820 | 6820 | echo " |
6821 | 6821 | <tr> |
6822 | 6822 | <td valign='top'> |
@@ -6850,11 +6850,11 @@ discard block |
||
6850 | 6850 | ORDER BY login_date DESC LIMIT 1"; |
6851 | 6851 | $ip = ''; |
6852 | 6852 | $res_ip = Database::query($sql_ip); |
6853 | - if ($res_ip !== false && Database::num_rows($res_ip)>0) { |
|
6853 | + if ($res_ip !== false && Database::num_rows($res_ip) > 0) { |
|
6854 | 6854 | $row_ip = Database::fetch_row($res_ip); |
6855 | 6855 | if ($return_as_link) { |
6856 | 6856 | $ip = Display::url( |
6857 | - (empty($body_replace)?$row_ip[1]:$body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1], |
|
6857 | + (empty($body_replace) ? $row_ip[1] : $body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1], |
|
6858 | 6858 | array('title'=>get_lang('TraceIP'), 'target'=>'_blank') |
6859 | 6859 | ); |
6860 | 6860 | } else { |
@@ -6890,9 +6890,9 @@ discard block |
||
6890 | 6890 | $course_id = intval($course_id); |
6891 | 6891 | |
6892 | 6892 | $tempView = $view; |
6893 | - if (substr($view,0,1) == '1') { |
|
6894 | - $new_view = substr_replace($view,'0',0,1); |
|
6895 | - $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
6893 | + if (substr($view, 0, 1) == '1') { |
|
6894 | + $new_view = substr_replace($view, '0', 0, 1); |
|
6895 | + $title[1] = get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
6896 | 6896 | $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
6897 | 6897 | FROM $track_access_table |
6898 | 6898 | WHERE access_user_id = $user_id |
@@ -6902,20 +6902,20 @@ discard block |
||
6902 | 6902 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
6903 | 6903 | //$results = getManyResults2Col($sql); |
6904 | 6904 | $results = getManyResults3Col($sql); |
6905 | - $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
6906 | - $line=''; |
|
6905 | + $title_line = get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
6906 | + $line = ''; |
|
6907 | 6907 | $total = 0; |
6908 | 6908 | if (is_array($results)) { |
6909 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6909 | + for ($j = 0; $j < count($results); $j++) { |
|
6910 | 6910 | $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
6911 | 6911 | $total = $total + $results[$j][1]; |
6912 | 6912 | } |
6913 | 6913 | $line .= get_lang('Total').";".$total."\n"; |
6914 | 6914 | } else { |
6915 | - $line= get_lang('NoResult')."</center></td>"; |
|
6915 | + $line = get_lang('NoResult')."</center></td>"; |
|
6916 | 6916 | } |
6917 | 6917 | } else { |
6918 | - $new_view = substr_replace($view,'1',0,1); |
|
6918 | + $new_view = substr_replace($view, '1', 0, 1); |
|
6919 | 6919 | } |
6920 | 6920 | return array($title_line, $line); |
6921 | 6921 | } |
@@ -6933,8 +6933,8 @@ discard block |
||
6933 | 6933 | global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
6934 | 6934 | $courseId = api_get_course_int_id($courseCode); |
6935 | 6935 | $userId = intval($userId); |
6936 | - if (substr($view,1,1) == '1') { |
|
6937 | - $new_view = substr_replace($view,'0',1,1); |
|
6936 | + if (substr($view, 1, 1) == '1') { |
|
6937 | + $new_view = substr_replace($view, '0', 1, 1); |
|
6938 | 6938 | $title[1] = get_lang('ExercicesDetails'); |
6939 | 6939 | $line = ''; |
6940 | 6940 | $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
@@ -6958,7 +6958,7 @@ discard block |
||
6958 | 6958 | $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
6959 | 6959 | |
6960 | 6960 | if (is_array($results)) { |
6961 | - for($i = 0; $i < sizeof($results); $i++) |
|
6961 | + for ($i = 0; $i < sizeof($results); $i++) |
|
6962 | 6962 | { |
6963 | 6963 | $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
6964 | 6964 | $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
@@ -6970,8 +6970,8 @@ discard block |
||
6970 | 6970 | |
6971 | 6971 | // The Result of Tests |
6972 | 6972 | if (is_array($hpresults)) { |
6973 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6974 | - $title = GetQuizName($hpresults[$i][0],''); |
|
6973 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
6974 | + $title = GetQuizName($hpresults[$i][0], ''); |
|
6975 | 6975 | |
6976 | 6976 | if ($title == '') |
6977 | 6977 | $title = basename($hpresults[$i][0]); |
@@ -6985,10 +6985,10 @@ discard block |
||
6985 | 6985 | } |
6986 | 6986 | |
6987 | 6987 | if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
6988 | - $line=get_lang('NoResult'); |
|
6988 | + $line = get_lang('NoResult'); |
|
6989 | 6989 | } |
6990 | 6990 | } else { |
6991 | - $new_view = substr_replace($view,'1',1,1); |
|
6991 | + $new_view = substr_replace($view, '1', 1, 1); |
|
6992 | 6992 | } |
6993 | 6993 | return array($title_line, $line); |
6994 | 6994 | } |
@@ -7004,7 +7004,7 @@ discard block |
||
7004 | 7004 | $user_id = intval($user_id); |
7005 | 7005 | $course_id = intval($course_id); |
7006 | 7006 | |
7007 | - if (substr($view,2,1) == '1') { |
|
7007 | + if (substr($view, 2, 1) == '1') { |
|
7008 | 7008 | $sql = "SELECT u.upload_date, w.title, w.author, w.url |
7009 | 7009 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
7010 | 7010 | WHERE |
@@ -7012,21 +7012,21 @@ discard block |
||
7012 | 7012 | u.upload_user_id = '$user_id' AND |
7013 | 7013 | u.c_id = '$course_id' |
7014 | 7014 | ORDER BY u.upload_date DESC"; |
7015 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7015 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
7016 | 7016 | |
7017 | - $title[1]=get_lang('WorksDetails'); |
|
7018 | - $line=''; |
|
7019 | - $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7017 | + $title[1] = get_lang('WorksDetails'); |
|
7018 | + $line = ''; |
|
7019 | + $title_line = get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7020 | 7020 | |
7021 | 7021 | if (is_array($results)) { |
7022 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7022 | + for ($j = 0; $j < count($results); $j++) { |
|
7023 | 7023 | $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
7024 | 7024 | $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
7025 | 7025 | $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
7026 | 7026 | } |
7027 | 7027 | |
7028 | 7028 | } else { |
7029 | - $line= get_lang('NoResult'); |
|
7029 | + $line = get_lang('NoResult'); |
|
7030 | 7030 | } |
7031 | 7031 | } |
7032 | 7032 | return array($title_line, $line); |
@@ -7042,9 +7042,9 @@ discard block |
||
7042 | 7042 | $courseId = api_get_course_int_id($courseCode); |
7043 | 7043 | $userId = intval($userId); |
7044 | 7044 | $line = null; |
7045 | - if (substr($view,3,1) == '1') { |
|
7046 | - $new_view = substr_replace($view,'0',3,1); |
|
7047 | - $title[1]=get_lang('LinksDetails'); |
|
7045 | + if (substr($view, 3, 1) == '1') { |
|
7046 | + $new_view = substr_replace($view, '0', 3, 1); |
|
7047 | + $title[1] = get_lang('LinksDetails'); |
|
7048 | 7048 | $sql = "SELECT cl.title, cl.url |
7049 | 7049 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
7050 | 7050 | WHERE sl.links_link_id = cl.id |
@@ -7052,16 +7052,16 @@ discard block |
||
7052 | 7052 | AND sl.links_user_id = $userId |
7053 | 7053 | GROUP BY cl.title, cl.url"; |
7054 | 7054 | $results = StatsUtils::getManyResults2Col($sql); |
7055 | - $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7055 | + $title_line = get_lang('LinksTitleLinkColumn')."\n"; |
|
7056 | 7056 | if (is_array($results)) { |
7057 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7057 | + for ($j = 0; $j < count($results); $j++) { |
|
7058 | 7058 | $line .= $results[$j][0]."\n"; |
7059 | 7059 | } |
7060 | 7060 | } else { |
7061 | - $line=get_lang('NoResult'); |
|
7061 | + $line = get_lang('NoResult'); |
|
7062 | 7062 | } |
7063 | 7063 | } else { |
7064 | - $new_view = substr_replace($view,'1',3,1); |
|
7064 | + $new_view = substr_replace($view, '1', 3, 1); |
|
7065 | 7065 | } |
7066 | 7066 | return array($title_line, $line); |
7067 | 7067 | } |
@@ -7083,9 +7083,9 @@ discard block |
||
7083 | 7083 | |
7084 | 7084 | $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
7085 | 7085 | |
7086 | - if (substr($view,4,1) == '1') { |
|
7087 | - $new_view = substr_replace($view,'0',4,1); |
|
7088 | - $title[1]= get_lang('DocumentsDetails'); |
|
7086 | + if (substr($view, 4, 1) == '1') { |
|
7087 | + $new_view = substr_replace($view, '0', 4, 1); |
|
7088 | + $title[1] = get_lang('DocumentsDetails'); |
|
7089 | 7089 | |
7090 | 7090 | $sql = "SELECT down_doc_path |
7091 | 7091 | FROM $downloads_table |
@@ -7098,14 +7098,14 @@ discard block |
||
7098 | 7098 | $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
7099 | 7099 | $line = null; |
7100 | 7100 | if (is_array($results)) { |
7101 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7101 | + for ($j = 0; $j < count($results); $j++) { |
|
7102 | 7102 | $line .= $results[$j]."\n"; |
7103 | 7103 | } |
7104 | 7104 | } else { |
7105 | 7105 | $line = get_lang('NoResult'); |
7106 | 7106 | } |
7107 | 7107 | } else { |
7108 | - $new_view = substr_replace($view,'1',4,1); |
|
7108 | + $new_view = substr_replace($view, '1', 4, 1); |
|
7109 | 7109 | } |
7110 | 7110 | return array($title_line, $line); |
7111 | 7111 | } |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | $extend_link = ''; |
312 | 312 | if (!empty($inter_num)) { |
313 | 313 | $extend_link = Display::url( |
314 | - Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
|
315 | - api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
314 | + Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
|
315 | + api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
316 | 316 | ); |
317 | 317 | } |
318 | 318 | $title = $row['mytitle']; |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | case 'last_30_days': |
1320 | 1320 | $new_date = date('Y-m-d H:i:s', strtotime('-30 day')); |
1321 | 1321 | $condition_time = ' AND (login_date >= "'.$new_date.'" AND logout_date <= "'.$today.'") '; |
1322 | - break; |
|
1322 | + break; |
|
1323 | 1323 | case 'custom': |
1324 | 1324 | if (!empty($start_date) && !empty($end_date)) { |
1325 | 1325 | $start_date = Database::escape_string($start_date); |
@@ -1329,10 +1329,10 @@ discard block |
||
1329 | 1329 | break; |
1330 | 1330 | } |
1331 | 1331 | |
1332 | - $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff |
|
1332 | + $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff |
|
1333 | 1333 | FROM '.$tbl_track_login.' |
1334 | 1334 | WHERE '.$userCondition.$condition_time; |
1335 | - $rs = Database::query($sql); |
|
1335 | + $rs = Database::query($sql); |
|
1336 | 1336 | $row = Database::fetch_array($rs, 'ASSOC'); |
1337 | 1337 | $diff = $row['diff']; |
1338 | 1338 | |
@@ -1354,18 +1354,18 @@ discard block |
||
1354 | 1354 | public static function get_time_spent_on_the_course($user_id, $courseId, $session_id = 0) |
1355 | 1355 | { |
1356 | 1356 | $courseId = intval($courseId); |
1357 | - $session_id = intval($session_id); |
|
1358 | - |
|
1359 | - $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1360 | - if (is_array($user_id)) { |
|
1361 | - $user_id = array_map('intval', $user_id); |
|
1362 | - $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1363 | - } else { |
|
1364 | - $user_id = intval($user_id); |
|
1365 | - $condition_user = " AND user_id = $user_id "; |
|
1366 | - } |
|
1367 | - |
|
1368 | - $sql = "SELECT |
|
1357 | + $session_id = intval($session_id); |
|
1358 | + |
|
1359 | + $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1360 | + if (is_array($user_id)) { |
|
1361 | + $user_id = array_map('intval', $user_id); |
|
1362 | + $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1363 | + } else { |
|
1364 | + $user_id = intval($user_id); |
|
1365 | + $condition_user = " AND user_id = $user_id "; |
|
1366 | + } |
|
1367 | + |
|
1368 | + $sql = "SELECT |
|
1369 | 1369 | SUM(UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date)) as nb_seconds |
1370 | 1370 | FROM $tbl_track_course |
1371 | 1371 | WHERE UNIX_TIMESTAMP(logout_course_date) > UNIX_TIMESTAMP(login_course_date) "; |
@@ -1381,9 +1381,9 @@ discard block |
||
1381 | 1381 | $sql .= $condition_user; |
1382 | 1382 | |
1383 | 1383 | $rs = Database::query($sql); |
1384 | - $row = Database::fetch_array($rs); |
|
1384 | + $row = Database::fetch_array($rs); |
|
1385 | 1385 | |
1386 | - return $row['nb_seconds']; |
|
1386 | + return $row['nb_seconds']; |
|
1387 | 1387 | } |
1388 | 1388 | |
1389 | 1389 | /** |
@@ -1394,25 +1394,25 @@ discard block |
||
1394 | 1394 | */ |
1395 | 1395 | public static function get_first_connection_date($student_id) |
1396 | 1396 | { |
1397 | - $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1398 | - $sql = 'SELECT login_date |
|
1397 | + $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1398 | + $sql = 'SELECT login_date |
|
1399 | 1399 | FROM ' . $tbl_track_login . ' |
1400 | 1400 | WHERE login_user_id = ' . intval($student_id) . ' |
1401 | 1401 | ORDER BY login_date ASC |
1402 | 1402 | LIMIT 0,1'; |
1403 | 1403 | |
1404 | - $rs = Database::query($sql); |
|
1405 | - if (Database::num_rows($rs)>0) { |
|
1406 | - if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1404 | + $rs = Database::query($sql); |
|
1405 | + if (Database::num_rows($rs)>0) { |
|
1406 | + if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1407 | 1407 | return api_convert_and_format_date( |
1408 | 1408 | $first_login_date, |
1409 | 1409 | DATE_FORMAT_SHORT, |
1410 | 1410 | date_default_timezone_get() |
1411 | 1411 | ); |
1412 | - } |
|
1413 | - } |
|
1412 | + } |
|
1413 | + } |
|
1414 | 1414 | |
1415 | - return false; |
|
1415 | + return false; |
|
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | /** |
@@ -1425,38 +1425,38 @@ discard block |
||
1425 | 1425 | */ |
1426 | 1426 | public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false) |
1427 | 1427 | { |
1428 | - $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1429 | - $sql = 'SELECT login_date |
|
1428 | + $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1429 | + $sql = 'SELECT login_date |
|
1430 | 1430 | FROM ' . $table . ' |
1431 | 1431 | WHERE login_user_id = ' . intval($student_id) . ' |
1432 | 1432 | ORDER BY login_date |
1433 | 1433 | DESC LIMIT 0,1'; |
1434 | 1434 | |
1435 | - $rs = Database::query($sql); |
|
1436 | - if (Database::num_rows($rs) > 0) { |
|
1437 | - if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1438 | - $last_login_date = api_get_local_time($last_login_date); |
|
1439 | - if ($return_timestamp) { |
|
1440 | - return api_strtotime($last_login_date,'UTC'); |
|
1441 | - } else { |
|
1442 | - if (!$warning_message) { |
|
1443 | - return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1444 | - } else { |
|
1445 | - $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1446 | - $currentTimestamp = time(); |
|
1447 | - |
|
1448 | - //If the last connection is > than 7 days, the text is red |
|
1449 | - //345600 = 7 days in seconds |
|
1450 | - if ($currentTimestamp - $timestamp > 604800) { |
|
1451 | - return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1452 | - } else { |
|
1453 | - return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1454 | - } |
|
1455 | - } |
|
1456 | - } |
|
1457 | - } |
|
1458 | - } |
|
1459 | - return false; |
|
1435 | + $rs = Database::query($sql); |
|
1436 | + if (Database::num_rows($rs) > 0) { |
|
1437 | + if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1438 | + $last_login_date = api_get_local_time($last_login_date); |
|
1439 | + if ($return_timestamp) { |
|
1440 | + return api_strtotime($last_login_date,'UTC'); |
|
1441 | + } else { |
|
1442 | + if (!$warning_message) { |
|
1443 | + return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1444 | + } else { |
|
1445 | + $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1446 | + $currentTimestamp = time(); |
|
1447 | + |
|
1448 | + //If the last connection is > than 7 days, the text is red |
|
1449 | + //345600 = 7 days in seconds |
|
1450 | + if ($currentTimestamp - $timestamp > 604800) { |
|
1451 | + return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1452 | + } else { |
|
1453 | + return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1454 | + } |
|
1455 | + } |
|
1456 | + } |
|
1457 | + } |
|
1458 | + } |
|
1459 | + return false; |
|
1460 | 1460 | } |
1461 | 1461 | |
1462 | 1462 | /** |
@@ -1510,30 +1510,30 @@ discard block |
||
1510 | 1510 | $session_id = 0, |
1511 | 1511 | $convert_date = true |
1512 | 1512 | ) { |
1513 | - $student_id = intval($student_id); |
|
1513 | + $student_id = intval($student_id); |
|
1514 | 1514 | $courseId = intval($courseId); |
1515 | - $session_id = intval($session_id); |
|
1515 | + $session_id = intval($session_id); |
|
1516 | 1516 | |
1517 | - $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1518 | - $sql = 'SELECT login_course_date |
|
1517 | + $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1518 | + $sql = 'SELECT login_course_date |
|
1519 | 1519 | FROM '.$tbl_track_login.' |
1520 | 1520 | WHERE |
1521 | 1521 | user_id = '.$student_id.' AND |
1522 | 1522 | c_id = '.$courseId.' AND |
1523 | 1523 | session_id = '.$session_id.' |
1524 | 1524 | ORDER BY login_course_date ASC LIMIT 0,1'; |
1525 | - $rs = Database::query($sql); |
|
1526 | - if (Database::num_rows($rs) > 0) { |
|
1527 | - if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1528 | - if ($convert_date) { |
|
1529 | - return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT); |
|
1530 | - } else { |
|
1531 | - return $first_login_date; |
|
1532 | - } |
|
1533 | - } |
|
1534 | - } |
|
1535 | - |
|
1536 | - return false; |
|
1525 | + $rs = Database::query($sql); |
|
1526 | + if (Database::num_rows($rs) > 0) { |
|
1527 | + if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1528 | + if ($convert_date) { |
|
1529 | + return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT); |
|
1530 | + } else { |
|
1531 | + return $first_login_date; |
|
1532 | + } |
|
1533 | + } |
|
1534 | + } |
|
1535 | + |
|
1536 | + return false; |
|
1537 | 1537 | } |
1538 | 1538 | |
1539 | 1539 | /** |
@@ -1549,13 +1549,13 @@ discard block |
||
1549 | 1549 | $session_id = 0, |
1550 | 1550 | $convert_date = true |
1551 | 1551 | ) { |
1552 | - // protect data |
|
1553 | - $student_id = intval($student_id); |
|
1552 | + // protect data |
|
1553 | + $student_id = intval($student_id); |
|
1554 | 1554 | $courseId = $courseInfo['real_id']; |
1555 | - $session_id = intval($session_id); |
|
1555 | + $session_id = intval($session_id); |
|
1556 | 1556 | |
1557 | - $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
1558 | - $sql = 'SELECT access_date |
|
1557 | + $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
1558 | + $sql = 'SELECT access_date |
|
1559 | 1559 | FROM '.$tbl_track_e_access.' |
1560 | 1560 | WHERE access_user_id = '.$student_id.' AND |
1561 | 1561 | c_id = "'.$courseId.'" AND |
@@ -1563,39 +1563,39 @@ discard block |
||
1563 | 1563 | ORDER BY access_date DESC |
1564 | 1564 | LIMIT 0,1'; |
1565 | 1565 | |
1566 | - $rs = Database::query($sql); |
|
1567 | - if (Database::num_rows($rs) > 0) { |
|
1568 | - if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1566 | + $rs = Database::query($sql); |
|
1567 | + if (Database::num_rows($rs) > 0) { |
|
1568 | + if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1569 | 1569 | if (empty($last_login_date) || $last_login_date == '0000-00-00 00:00:00') { |
1570 | 1570 | return false; |
1571 | 1571 | } |
1572 | 1572 | //see #5736 |
1573 | 1573 | $last_login_date_timestamp = api_strtotime($last_login_date); |
1574 | - $now = time(); |
|
1575 | - //If the last connection is > than 7 days, the text is red |
|
1576 | - //345600 = 7 days in seconds |
|
1577 | - if ($now - $last_login_date_timestamp > 604800) { |
|
1578 | - if ($convert_date) { |
|
1574 | + $now = time(); |
|
1575 | + //If the last connection is > than 7 days, the text is red |
|
1576 | + //345600 = 7 days in seconds |
|
1577 | + if ($now - $last_login_date_timestamp > 604800) { |
|
1578 | + if ($convert_date) { |
|
1579 | 1579 | $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
1580 | 1580 | $icon = api_is_allowed_to_edit() ? |
1581 | 1581 | '<a href="'.api_get_path(REL_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'&cidReq='.$courseInfo['code'].'" title="'.get_lang('RemindInactiveUser').'"> |
1582 | 1582 | '.Display::return_icon('messagebox_warning.gif').' |
1583 | 1583 | </a>' |
1584 | 1584 | : null; |
1585 | - return $icon. Display::label($last_login_date, 'warning'); |
|
1586 | - } else { |
|
1587 | - return $last_login_date; |
|
1588 | - } |
|
1589 | - } else { |
|
1590 | - if ($convert_date) { |
|
1591 | - return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1592 | - } else { |
|
1593 | - return $last_login_date; |
|
1594 | - } |
|
1595 | - } |
|
1596 | - } |
|
1597 | - } |
|
1598 | - return false; |
|
1585 | + return $icon. Display::label($last_login_date, 'warning'); |
|
1586 | + } else { |
|
1587 | + return $last_login_date; |
|
1588 | + } |
|
1589 | + } else { |
|
1590 | + if ($convert_date) { |
|
1591 | + return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1592 | + } else { |
|
1593 | + return $last_login_date; |
|
1594 | + } |
|
1595 | + } |
|
1596 | + } |
|
1597 | + } |
|
1598 | + return false; |
|
1599 | 1599 | } |
1600 | 1600 | |
1601 | 1601 | /** |
@@ -1608,36 +1608,36 @@ discard block |
||
1608 | 1608 | */ |
1609 | 1609 | public static function get_course_connections_count($courseId, $session_id = 0, $start = 0, $stop = null) |
1610 | 1610 | { |
1611 | - if ($start < 0) { |
|
1612 | - $start = 0; |
|
1613 | - } |
|
1614 | - if (!isset($stop) or ($stop < 0)) { |
|
1615 | - $stop = api_get_utc_datetime(); |
|
1616 | - } |
|
1611 | + if ($start < 0) { |
|
1612 | + $start = 0; |
|
1613 | + } |
|
1614 | + if (!isset($stop) or ($stop < 0)) { |
|
1615 | + $stop = api_get_utc_datetime(); |
|
1616 | + } |
|
1617 | 1617 | |
1618 | 1618 | $start = Database::escape_string($start); |
1619 | 1619 | $stop = Database::escape_string($stop); |
1620 | 1620 | |
1621 | - $month_filter = " AND login_course_date > '$start' AND login_course_date < '$stop' "; |
|
1621 | + $month_filter = " AND login_course_date > '$start' AND login_course_date < '$stop' "; |
|
1622 | 1622 | |
1623 | 1623 | $courseId = intval($courseId); |
1624 | - $session_id = intval($session_id); |
|
1625 | - $count = 0; |
|
1624 | + $session_id = intval($session_id); |
|
1625 | + $count = 0; |
|
1626 | 1626 | |
1627 | - $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1628 | - $sql = "SELECT count(*) as count_connections |
|
1627 | + $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1628 | + $sql = "SELECT count(*) as count_connections |
|
1629 | 1629 | FROM $tbl_track_e_course_access |
1630 | 1630 | WHERE |
1631 | 1631 | c_id = $courseId AND |
1632 | 1632 | session_id = $session_id |
1633 | 1633 | $month_filter"; |
1634 | - $rs = Database::query($sql); |
|
1635 | - if (Database::num_rows($rs)>0) { |
|
1636 | - $row = Database::fetch_object($rs); |
|
1637 | - $count = $row->count_connections; |
|
1638 | - } |
|
1634 | + $rs = Database::query($sql); |
|
1635 | + if (Database::num_rows($rs)>0) { |
|
1636 | + $row = Database::fetch_object($rs); |
|
1637 | + $count = $row->count_connections; |
|
1638 | + } |
|
1639 | 1639 | |
1640 | - return $count; |
|
1640 | + return $count; |
|
1641 | 1641 | } |
1642 | 1642 | |
1643 | 1643 | /** |
@@ -1648,25 +1648,25 @@ discard block |
||
1648 | 1648 | */ |
1649 | 1649 | public static function count_course_per_student($user_id, $include_sessions = true) |
1650 | 1650 | { |
1651 | - $user_id = intval($user_id); |
|
1652 | - $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
1653 | - $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
1651 | + $user_id = intval($user_id); |
|
1652 | + $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
1653 | + $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
1654 | 1654 | |
1655 | - $sql = 'SELECT DISTINCT c_id |
|
1655 | + $sql = 'SELECT DISTINCT c_id |
|
1656 | 1656 | FROM ' . $tbl_course_rel_user . ' |
1657 | 1657 | WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH; |
1658 | - $rs = Database::query($sql); |
|
1659 | - $nb_courses = Database::num_rows($rs); |
|
1658 | + $rs = Database::query($sql); |
|
1659 | + $nb_courses = Database::num_rows($rs); |
|
1660 | 1660 | |
1661 | - if ($include_sessions) { |
|
1662 | - $sql = 'SELECT DISTINCT c_id |
|
1661 | + if ($include_sessions) { |
|
1662 | + $sql = 'SELECT DISTINCT c_id |
|
1663 | 1663 | FROM ' . $tbl_session_course_rel_user . ' |
1664 | 1664 | WHERE user_id = ' . $user_id; |
1665 | - $rs = Database::query($sql); |
|
1666 | - $nb_courses += Database::num_rows($rs); |
|
1667 | - } |
|
1665 | + $rs = Database::query($sql); |
|
1666 | + $nb_courses += Database::num_rows($rs); |
|
1667 | + } |
|
1668 | 1668 | |
1669 | - return $nb_courses; |
|
1669 | + return $nb_courses; |
|
1670 | 1670 | } |
1671 | 1671 | |
1672 | 1672 | /** |
@@ -1697,25 +1697,25 @@ discard block |
||
1697 | 1697 | $into_lp = 0 |
1698 | 1698 | ) { |
1699 | 1699 | $course_code = Database::escape_string($course_code); |
1700 | - $course_info = api_get_course_info($course_code); |
|
1701 | - if (!empty($course_info)) { |
|
1702 | - // table definition |
|
1703 | - $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
1704 | - $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1705 | - |
|
1706 | - // Compose a filter based on optional exercise given |
|
1707 | - $condition_quiz = ""; |
|
1708 | - if (!empty($exercise_id)) { |
|
1709 | - $exercise_id = intval($exercise_id); |
|
1710 | - $condition_quiz =" AND id = $exercise_id "; |
|
1711 | - } |
|
1712 | - |
|
1713 | - // Compose a filter based on optional session id given |
|
1714 | - $condition_session = ""; |
|
1715 | - if (isset($session_id)) { |
|
1716 | - $session_id = intval($session_id); |
|
1717 | - $condition_session = " AND session_id = $session_id "; |
|
1718 | - } |
|
1700 | + $course_info = api_get_course_info($course_code); |
|
1701 | + if (!empty($course_info)) { |
|
1702 | + // table definition |
|
1703 | + $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
1704 | + $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1705 | + |
|
1706 | + // Compose a filter based on optional exercise given |
|
1707 | + $condition_quiz = ""; |
|
1708 | + if (!empty($exercise_id)) { |
|
1709 | + $exercise_id = intval($exercise_id); |
|
1710 | + $condition_quiz =" AND id = $exercise_id "; |
|
1711 | + } |
|
1712 | + |
|
1713 | + // Compose a filter based on optional session id given |
|
1714 | + $condition_session = ""; |
|
1715 | + if (isset($session_id)) { |
|
1716 | + $session_id = intval($session_id); |
|
1717 | + $condition_session = " AND session_id = $session_id "; |
|
1718 | + } |
|
1719 | 1719 | if ($active_filter == 1) { |
1720 | 1720 | $condition_active = 'AND active <> -1'; |
1721 | 1721 | } elseif ($active_filter == 0) { |
@@ -1731,25 +1731,25 @@ discard block |
||
1731 | 1731 | $select_lp_id = ', orig_lp_id as lp_id '; |
1732 | 1732 | } |
1733 | 1733 | |
1734 | - $sql = "SELECT count(id) FROM $tbl_course_quiz |
|
1734 | + $sql = "SELECT count(id) FROM $tbl_course_quiz |
|
1735 | 1735 | WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz "; |
1736 | - $count_quiz = Database::fetch_row(Database::query($sql)); |
|
1736 | + $count_quiz = Database::fetch_row(Database::query($sql)); |
|
1737 | 1737 | |
1738 | - if (!empty($count_quiz[0]) && !empty($student_id)) { |
|
1739 | - if (is_array($student_id)) { |
|
1738 | + if (!empty($count_quiz[0]) && !empty($student_id)) { |
|
1739 | + if (is_array($student_id)) { |
|
1740 | 1740 | $student_id = array_map('intval', $student_id); |
1741 | - $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") "; |
|
1742 | - } else { |
|
1741 | + $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") "; |
|
1742 | + } else { |
|
1743 | 1743 | $student_id = intval($student_id); |
1744 | - $condition_user = " AND exe_user_id = '$student_id' "; |
|
1745 | - } |
|
1744 | + $condition_user = " AND exe_user_id = '$student_id' "; |
|
1745 | + } |
|
1746 | 1746 | |
1747 | - if (empty($exercise_id)) { |
|
1748 | - $sql = "SELECT id FROM $tbl_course_quiz |
|
1747 | + if (empty($exercise_id)) { |
|
1748 | + $sql = "SELECT id FROM $tbl_course_quiz |
|
1749 | 1749 | WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz"; |
1750 | 1750 | $result = Database::query($sql); |
1751 | 1751 | $exercise_list = array(); |
1752 | - $exercise_id = null; |
|
1752 | + $exercise_id = null; |
|
1753 | 1753 | if (Database::num_rows($result)) { |
1754 | 1754 | while ($row = Database::fetch_array($result)) { |
1755 | 1755 | $exercise_list[] = $row['id']; |
@@ -1758,11 +1758,11 @@ discard block |
||
1758 | 1758 | if (!empty($exercise_list)) { |
1759 | 1759 | $exercise_id = implode("','",$exercise_list); |
1760 | 1760 | } |
1761 | - } |
|
1761 | + } |
|
1762 | 1762 | |
1763 | - $count_quiz = Database::fetch_row(Database::query($sql)); |
|
1763 | + $count_quiz = Database::fetch_row(Database::query($sql)); |
|
1764 | 1764 | |
1765 | - $sql = "SELECT |
|
1765 | + $sql = "SELECT |
|
1766 | 1766 | SUM(exe_result/exe_weighting*100) as avg_score, |
1767 | 1767 | COUNT(*) as num_attempts |
1768 | 1768 | $select_lp_id |
@@ -1776,20 +1776,20 @@ discard block |
||
1776 | 1776 | $condition_into_lp |
1777 | 1777 | ORDER BY exe_date DESC"; |
1778 | 1778 | |
1779 | - $res = Database::query($sql); |
|
1780 | - $row = Database::fetch_array($res); |
|
1781 | - $quiz_avg_score = null; |
|
1779 | + $res = Database::query($sql); |
|
1780 | + $row = Database::fetch_array($res); |
|
1781 | + $quiz_avg_score = null; |
|
1782 | 1782 | |
1783 | - if (!empty($row['avg_score'])) { |
|
1784 | - $quiz_avg_score = round($row['avg_score'],2); |
|
1785 | - } |
|
1783 | + if (!empty($row['avg_score'])) { |
|
1784 | + $quiz_avg_score = round($row['avg_score'],2); |
|
1785 | + } |
|
1786 | 1786 | |
1787 | - if(!empty($row['num_attempts'])) { |
|
1788 | - $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
|
1789 | - } |
|
1790 | - if (is_array($student_id)) { |
|
1791 | - $quiz_avg_score = round($quiz_avg_score / count($student_id), 2); |
|
1792 | - } |
|
1787 | + if(!empty($row['num_attempts'])) { |
|
1788 | + $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
|
1789 | + } |
|
1790 | + if (is_array($student_id)) { |
|
1791 | + $quiz_avg_score = round($quiz_avg_score / count($student_id), 2); |
|
1792 | + } |
|
1793 | 1793 | if ($into_lp == 0) { |
1794 | 1794 | return $quiz_avg_score; |
1795 | 1795 | } else { |
@@ -1812,9 +1812,9 @@ discard block |
||
1812 | 1812 | return array($quiz_avg_score, null); |
1813 | 1813 | } |
1814 | 1814 | } |
1815 | - } |
|
1816 | - } |
|
1817 | - return null; |
|
1815 | + } |
|
1816 | + } |
|
1817 | + return null; |
|
1818 | 1818 | } |
1819 | 1819 | |
1820 | 1820 | /** |
@@ -1847,15 +1847,15 @@ discard block |
||
1847 | 1847 | $find_all_lp = 0 |
1848 | 1848 | ) { |
1849 | 1849 | $courseId = intval($courseId); |
1850 | - $student_id = intval($student_id); |
|
1851 | - $exercise_id = intval($exercise_id); |
|
1852 | - $session_id = intval($session_id); |
|
1850 | + $student_id = intval($student_id); |
|
1851 | + $exercise_id = intval($exercise_id); |
|
1852 | + $session_id = intval($session_id); |
|
1853 | 1853 | |
1854 | - $lp_id = intval($lp_id); |
|
1854 | + $lp_id = intval($lp_id); |
|
1855 | 1855 | $lp_item_id = intval($lp_item_id); |
1856 | - $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1856 | + $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1857 | 1857 | |
1858 | - $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex |
|
1858 | + $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex |
|
1859 | 1859 | WHERE ex.c_id = $courseId |
1860 | 1860 | AND ex.exe_exo_id = $exercise_id |
1861 | 1861 | AND status = '' |
@@ -1870,11 +1870,11 @@ discard block |
||
1870 | 1870 | AND orig_lp_item_id = $lp_item_id"; |
1871 | 1871 | } |
1872 | 1872 | |
1873 | - $rs = Database::query($sql); |
|
1874 | - $row = Database::fetch_row($rs); |
|
1875 | - $count_attempts = $row[0]; |
|
1873 | + $rs = Database::query($sql); |
|
1874 | + $row = Database::fetch_row($rs); |
|
1875 | + $count_attempts = $row[0]; |
|
1876 | 1876 | |
1877 | - return $count_attempts; |
|
1877 | + return $count_attempts; |
|
1878 | 1878 | } |
1879 | 1879 | |
1880 | 1880 | /** |
@@ -1884,7 +1884,7 @@ discard block |
||
1884 | 1884 | * @param int $user_id |
1885 | 1885 | * @param int $courseId |
1886 | 1886 | * @param int $session_id |
1887 | - */ |
|
1887 | + */ |
|
1888 | 1888 | public static function get_exercise_student_progress($exercise_list, $user_id, $courseId, $session_id) |
1889 | 1889 | { |
1890 | 1890 | $courseId = intval($courseId); |
@@ -3500,8 +3500,8 @@ discard block |
||
3500 | 3500 | |
3501 | 3501 | $condition_session = ''; |
3502 | 3502 | if (isset($session_id)) { |
3503 | - $session_id = intval($session_id); |
|
3504 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3503 | + $session_id = intval($session_id); |
|
3504 | + $condition_session = ' AND f.session_id = '. $session_id; |
|
3505 | 3505 | } |
3506 | 3506 | |
3507 | 3507 | $groupId = intval($groupId); |
@@ -5400,9 +5400,9 @@ discard block |
||
5400 | 5400 | } |
5401 | 5401 | |
5402 | 5402 | /** |
5403 | - * @param FormValidator $form |
|
5404 | - * @return mixed |
|
5405 | - */ |
|
5403 | + * @param FormValidator $form |
|
5404 | + * @return mixed |
|
5405 | + */ |
|
5406 | 5406 | public static function setUserSearchForm($form) |
5407 | 5407 | { |
5408 | 5408 | global $_configuration; |
@@ -5681,26 +5681,26 @@ discard block |
||
5681 | 5681 | $session_id = api_get_session_id(); |
5682 | 5682 | $course_id = api_get_course_int_id(); |
5683 | 5683 | |
5684 | - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5685 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5684 | + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5685 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5686 | 5686 | |
5687 | - $sql = "SELECT count(tool) AS total_number_of_items |
|
5687 | + $sql = "SELECT count(tool) AS total_number_of_items |
|
5688 | 5688 | FROM $table_item_property track_resource, $table_user user |
5689 | 5689 | WHERE |
5690 | 5690 | track_resource.c_id = $course_id AND |
5691 | 5691 | track_resource.insert_user_id = user.user_id AND |
5692 | 5692 | session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
5693 | 5693 | |
5694 | - if (isset($_GET['keyword'])) { |
|
5695 | - $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5696 | - $sql .= " AND ( |
|
5694 | + if (isset($_GET['keyword'])) { |
|
5695 | + $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5696 | + $sql .= " AND ( |
|
5697 | 5697 | user.username LIKE '%".$keyword."%' OR |
5698 | 5698 | lastedit_type LIKE '%".$keyword."%' OR |
5699 | 5699 | tool LIKE '%".$keyword."%' |
5700 | 5700 | )"; |
5701 | - } |
|
5701 | + } |
|
5702 | 5702 | |
5703 | - $sql .= " AND tool IN ( |
|
5703 | + $sql .= " AND tool IN ( |
|
5704 | 5704 | 'document', |
5705 | 5705 | 'learnpath', |
5706 | 5706 | 'quiz', |
@@ -5712,10 +5712,10 @@ discard block |
||
5712 | 5712 | 'thematic_advance', |
5713 | 5713 | 'thematic_plan' |
5714 | 5714 | )"; |
5715 | - $res = Database::query($sql); |
|
5716 | - $obj = Database::fetch_object($res); |
|
5715 | + $res = Database::query($sql); |
|
5716 | + $obj = Database::fetch_object($res); |
|
5717 | 5717 | |
5718 | - return $obj->total_number_of_items; |
|
5718 | + return $obj->total_number_of_items; |
|
5719 | 5719 | } |
5720 | 5720 | |
5721 | 5721 | /** |
@@ -5730,12 +5730,12 @@ discard block |
||
5730 | 5730 | $session_id = api_get_session_id(); |
5731 | 5731 | $course_id = api_get_course_int_id(); |
5732 | 5732 | |
5733 | - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5734 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5735 | - $table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
5736 | - $session_id = intval($session_id); |
|
5733 | + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5734 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5735 | + $table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
5736 | + $session_id = intval($session_id); |
|
5737 | 5737 | |
5738 | - $sql = "SELECT |
|
5738 | + $sql = "SELECT |
|
5739 | 5739 | tool as col0, |
5740 | 5740 | lastedit_type as col1, |
5741 | 5741 | ref as ref, |
@@ -5749,16 +5749,16 @@ discard block |
||
5749 | 5749 | track_resource.insert_user_id = user.user_id AND |
5750 | 5750 | session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
5751 | 5751 | |
5752 | - if (isset($_GET['keyword'])) { |
|
5753 | - $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5754 | - $sql .= " AND ( |
|
5752 | + if (isset($_GET['keyword'])) { |
|
5753 | + $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5754 | + $sql .= " AND ( |
|
5755 | 5755 | user.username LIKE '%".$keyword."%' OR |
5756 | 5756 | lastedit_type LIKE '%".$keyword."%' OR |
5757 | 5757 | tool LIKE '%".$keyword."%' |
5758 | 5758 | ) "; |
5759 | - } |
|
5759 | + } |
|
5760 | 5760 | |
5761 | - $sql .= " AND tool IN ( |
|
5761 | + $sql .= " AND tool IN ( |
|
5762 | 5762 | 'document', |
5763 | 5763 | 'learnpath', |
5764 | 5764 | 'quiz', |
@@ -5771,41 +5771,41 @@ discard block |
||
5771 | 5771 | 'thematic_plan' |
5772 | 5772 | )"; |
5773 | 5773 | |
5774 | - if ($column == 0) { |
|
5775 | - $column = '0'; |
|
5776 | - } |
|
5777 | - if ($column != '' && $direction != '') { |
|
5778 | - if ($column != 2 && $column != 4) { |
|
5779 | - $sql .= " ORDER BY col$column $direction"; |
|
5780 | - } |
|
5781 | - } else { |
|
5782 | - $sql .= " ORDER BY col5 DESC "; |
|
5783 | - } |
|
5774 | + if ($column == 0) { |
|
5775 | + $column = '0'; |
|
5776 | + } |
|
5777 | + if ($column != '' && $direction != '') { |
|
5778 | + if ($column != 2 && $column != 4) { |
|
5779 | + $sql .= " ORDER BY col$column $direction"; |
|
5780 | + } |
|
5781 | + } else { |
|
5782 | + $sql .= " ORDER BY col5 DESC "; |
|
5783 | + } |
|
5784 | 5784 | |
5785 | 5785 | $from = intval($from); |
5786 | 5786 | $number_of_items = intval($number_of_items); |
5787 | 5787 | |
5788 | - $sql .= " LIMIT $from, $number_of_items "; |
|
5789 | - |
|
5790 | - $res = Database::query($sql); |
|
5791 | - $resources = array(); |
|
5792 | - $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan'); |
|
5793 | - while ($row = Database::fetch_array($res)) { |
|
5794 | - $ref = $row['ref']; |
|
5795 | - $table_name = TrackingCourseLog::get_tool_name_table($row['col0']); |
|
5796 | - $table_tool = Database :: get_course_table($table_name['table_name']); |
|
5797 | - |
|
5798 | - $id = $table_name['id_tool']; |
|
5799 | - $recorset = false; |
|
5788 | + $sql .= " LIMIT $from, $number_of_items "; |
|
5800 | 5789 | |
5801 | - if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) { |
|
5802 | - $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
5803 | - $sql = "SELECT thematic_id FROM $table_tool |
|
5790 | + $res = Database::query($sql); |
|
5791 | + $resources = array(); |
|
5792 | + $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan'); |
|
5793 | + while ($row = Database::fetch_array($res)) { |
|
5794 | + $ref = $row['ref']; |
|
5795 | + $table_name = TrackingCourseLog::get_tool_name_table($row['col0']); |
|
5796 | + $table_tool = Database :: get_course_table($table_name['table_name']); |
|
5797 | + |
|
5798 | + $id = $table_name['id_tool']; |
|
5799 | + $recorset = false; |
|
5800 | + |
|
5801 | + if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) { |
|
5802 | + $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
5803 | + $sql = "SELECT thematic_id FROM $table_tool |
|
5804 | 5804 | WHERE c_id = $course_id AND id = $ref"; |
5805 | - $rs_thematic = Database::query($sql); |
|
5806 | - if (Database::num_rows($rs_thematic)) { |
|
5807 | - $row_thematic = Database::fetch_array($rs_thematic); |
|
5808 | - $thematic_id = $row_thematic['thematic_id']; |
|
5805 | + $rs_thematic = Database::query($sql); |
|
5806 | + if (Database::num_rows($rs_thematic)) { |
|
5807 | + $row_thematic = Database::fetch_array($rs_thematic); |
|
5808 | + $thematic_id = $row_thematic['thematic_id']; |
|
5809 | 5809 | |
5810 | 5810 | $sql = "SELECT session.id, session.name, user.username |
5811 | 5811 | FROM $tbl_thematic t, $table_session session, $table_user user |
@@ -5814,9 +5814,9 @@ discard block |
||
5814 | 5814 | t.session_id = session.id AND |
5815 | 5815 | session.id_coach = user.user_id AND |
5816 | 5816 | t.id = $thematic_id"; |
5817 | - $recorset = Database::query($sql); |
|
5818 | - } |
|
5819 | - } else { |
|
5817 | + $recorset = Database::query($sql); |
|
5818 | + } |
|
5819 | + } else { |
|
5820 | 5820 | $sql = "SELECT session.id, session.name, user.username |
5821 | 5821 | FROM $table_tool tool, $table_session session, $table_user user |
5822 | 5822 | WHERE |
@@ -5824,127 +5824,127 @@ discard block |
||
5824 | 5824 | tool.session_id = session.id AND |
5825 | 5825 | session.id_coach = user.user_id AND |
5826 | 5826 | tool.$id = $ref"; |
5827 | - $recorset = Database::query($sql); |
|
5828 | - } |
|
5829 | - |
|
5830 | - if (!empty($recorset)) { |
|
5831 | - $obj = Database::fetch_object($recorset); |
|
5832 | - |
|
5833 | - $name_session = ''; |
|
5834 | - $coach_name = ''; |
|
5835 | - if (!empty($obj)) { |
|
5836 | - $name_session = $obj->name; |
|
5837 | - $coach_name = $obj->username; |
|
5838 | - } |
|
5839 | - |
|
5840 | - $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool']; |
|
5841 | - $row[0] = ''; |
|
5842 | - if ($row['col6'] != 2) { |
|
5843 | - if (in_array($row['col0'], $thematic_tools)) { |
|
5844 | - |
|
5845 | - $exp_thematic_tool = explode('_', $row['col0']); |
|
5846 | - $thematic_tool_title = ''; |
|
5847 | - if (is_array($exp_thematic_tool)) { |
|
5848 | - foreach ($exp_thematic_tool as $exp) { |
|
5849 | - $thematic_tool_title .= api_ucfirst($exp); |
|
5850 | - } |
|
5851 | - } else { |
|
5852 | - $thematic_tool_title = api_ucfirst($row['col0']); |
|
5853 | - } |
|
5854 | - |
|
5855 | - $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>'; |
|
5856 | - } else { |
|
5857 | - $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>'; |
|
5858 | - } |
|
5859 | - } else { |
|
5860 | - $row[0] = api_ucfirst($row['col0']); |
|
5861 | - } |
|
5862 | - $row[1] = get_lang($row[1]); |
|
5863 | - $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get()); |
|
5864 | - $row[5] = ''; |
|
5865 | - //@todo Improve this code please |
|
5866 | - switch ($table_name['table_name']) { |
|
5867 | - case 'document' : |
|
5868 | - $sql = "SELECT tool.title as title FROM $table_tool tool |
|
5827 | + $recorset = Database::query($sql); |
|
5828 | + } |
|
5829 | + |
|
5830 | + if (!empty($recorset)) { |
|
5831 | + $obj = Database::fetch_object($recorset); |
|
5832 | + |
|
5833 | + $name_session = ''; |
|
5834 | + $coach_name = ''; |
|
5835 | + if (!empty($obj)) { |
|
5836 | + $name_session = $obj->name; |
|
5837 | + $coach_name = $obj->username; |
|
5838 | + } |
|
5839 | + |
|
5840 | + $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool']; |
|
5841 | + $row[0] = ''; |
|
5842 | + if ($row['col6'] != 2) { |
|
5843 | + if (in_array($row['col0'], $thematic_tools)) { |
|
5844 | + |
|
5845 | + $exp_thematic_tool = explode('_', $row['col0']); |
|
5846 | + $thematic_tool_title = ''; |
|
5847 | + if (is_array($exp_thematic_tool)) { |
|
5848 | + foreach ($exp_thematic_tool as $exp) { |
|
5849 | + $thematic_tool_title .= api_ucfirst($exp); |
|
5850 | + } |
|
5851 | + } else { |
|
5852 | + $thematic_tool_title = api_ucfirst($row['col0']); |
|
5853 | + } |
|
5854 | + |
|
5855 | + $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>'; |
|
5856 | + } else { |
|
5857 | + $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>'; |
|
5858 | + } |
|
5859 | + } else { |
|
5860 | + $row[0] = api_ucfirst($row['col0']); |
|
5861 | + } |
|
5862 | + $row[1] = get_lang($row[1]); |
|
5863 | + $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get()); |
|
5864 | + $row[5] = ''; |
|
5865 | + //@todo Improve this code please |
|
5866 | + switch ($table_name['table_name']) { |
|
5867 | + case 'document' : |
|
5868 | + $sql = "SELECT tool.title as title FROM $table_tool tool |
|
5869 | 5869 | WHERE c_id = $course_id AND id = $ref"; |
5870 | - $rs_document = Database::query($sql); |
|
5871 | - $obj_document = Database::fetch_object($rs_document); |
|
5872 | - $row[5] = $obj_document->title; |
|
5870 | + $rs_document = Database::query($sql); |
|
5871 | + $obj_document = Database::fetch_object($rs_document); |
|
5872 | + $row[5] = $obj_document->title; |
|
5873 | 5873 | |
5874 | - break; |
|
5875 | - case 'announcement': |
|
5874 | + break; |
|
5875 | + case 'announcement': |
|
5876 | 5876 | $sql = "SELECT title FROM $table_tool |
5877 | 5877 | WHERE c_id = $course_id AND id = $ref"; |
5878 | - $rs_document = Database::query($sql); |
|
5879 | - $obj_document = Database::fetch_object($rs_document); |
|
5878 | + $rs_document = Database::query($sql); |
|
5879 | + $obj_document = Database::fetch_object($rs_document); |
|
5880 | 5880 | if ($obj_document) { |
5881 | 5881 | $row[5] = $obj_document->title; |
5882 | 5882 | } |
5883 | - break; |
|
5884 | - case 'glossary': |
|
5883 | + break; |
|
5884 | + case 'glossary': |
|
5885 | 5885 | $sql = "SELECT name FROM $table_tool |
5886 | 5886 | WHERE c_id = $course_id AND glossary_id = $ref"; |
5887 | - $rs_document = Database::query($sql); |
|
5888 | - $obj_document = Database::fetch_object($rs_document); |
|
5887 | + $rs_document = Database::query($sql); |
|
5888 | + $obj_document = Database::fetch_object($rs_document); |
|
5889 | 5889 | if ($obj_document) { |
5890 | 5890 | $row[5] = $obj_document->name; |
5891 | 5891 | } |
5892 | - break; |
|
5893 | - case 'lp': |
|
5892 | + break; |
|
5893 | + case 'lp': |
|
5894 | 5894 | $sql = "SELECT name |
5895 | 5895 | FROM $table_tool WHERE c_id = $course_id AND id = $ref"; |
5896 | - $rs_document = Database::query($sql); |
|
5897 | - $obj_document = Database::fetch_object($rs_document); |
|
5898 | - $row[5] = $obj_document->name; |
|
5899 | - break; |
|
5900 | - case 'quiz': |
|
5896 | + $rs_document = Database::query($sql); |
|
5897 | + $obj_document = Database::fetch_object($rs_document); |
|
5898 | + $row[5] = $obj_document->name; |
|
5899 | + break; |
|
5900 | + case 'quiz': |
|
5901 | 5901 | $sql = "SELECT title FROM $table_tool |
5902 | 5902 | WHERE c_id = $course_id AND id = $ref"; |
5903 | - $rs_document = Database::query($sql); |
|
5904 | - $obj_document = Database::fetch_object($rs_document); |
|
5903 | + $rs_document = Database::query($sql); |
|
5904 | + $obj_document = Database::fetch_object($rs_document); |
|
5905 | 5905 | if ($obj_document) { |
5906 | 5906 | $row[5] = $obj_document->title; |
5907 | 5907 | } |
5908 | - break; |
|
5909 | - case 'course_description': |
|
5908 | + break; |
|
5909 | + case 'course_description': |
|
5910 | 5910 | $sql = "SELECT title FROM $table_tool |
5911 | 5911 | WHERE c_id = $course_id AND id = $ref"; |
5912 | - $rs_document = Database::query($sql); |
|
5913 | - $obj_document = Database::fetch_object($rs_document); |
|
5912 | + $rs_document = Database::query($sql); |
|
5913 | + $obj_document = Database::fetch_object($rs_document); |
|
5914 | 5914 | if ($obj_document) { |
5915 | 5915 | $row[5] = $obj_document->title; |
5916 | 5916 | } |
5917 | - break; |
|
5918 | - case 'thematic': |
|
5919 | - $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
5920 | - if (Database::num_rows($rs) > 0) { |
|
5921 | - $obj = Database::fetch_object($rs); |
|
5922 | - $row[5] = $obj->title; |
|
5923 | - } |
|
5924 | - break; |
|
5925 | - case 'thematic_advance': |
|
5926 | - $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
5927 | - if (Database::num_rows($rs) > 0) { |
|
5928 | - $obj = Database::fetch_object($rs); |
|
5929 | - $row[5] = $obj->content; |
|
5930 | - } |
|
5931 | - break; |
|
5932 | - case 'thematic_plan': |
|
5933 | - $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
5934 | - if (Database::num_rows($rs) > 0) { |
|
5935 | - $obj = Database::fetch_object($rs); |
|
5936 | - $row[5] = $obj->title; |
|
5937 | - } |
|
5938 | - break; |
|
5939 | - default: |
|
5940 | - break; |
|
5941 | - } |
|
5942 | - |
|
5943 | - $row2 = $name_session; |
|
5944 | - if (!empty($coach_name)) { |
|
5945 | - $row2 .= '<br />'.get_lang('Coach').': '.$coach_name; |
|
5946 | - } |
|
5947 | - $row[2] = $row2; |
|
5917 | + break; |
|
5918 | + case 'thematic': |
|
5919 | + $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
5920 | + if (Database::num_rows($rs) > 0) { |
|
5921 | + $obj = Database::fetch_object($rs); |
|
5922 | + $row[5] = $obj->title; |
|
5923 | + } |
|
5924 | + break; |
|
5925 | + case 'thematic_advance': |
|
5926 | + $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
5927 | + if (Database::num_rows($rs) > 0) { |
|
5928 | + $obj = Database::fetch_object($rs); |
|
5929 | + $row[5] = $obj->content; |
|
5930 | + } |
|
5931 | + break; |
|
5932 | + case 'thematic_plan': |
|
5933 | + $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
5934 | + if (Database::num_rows($rs) > 0) { |
|
5935 | + $obj = Database::fetch_object($rs); |
|
5936 | + $row[5] = $obj->title; |
|
5937 | + } |
|
5938 | + break; |
|
5939 | + default: |
|
5940 | + break; |
|
5941 | + } |
|
5942 | + |
|
5943 | + $row2 = $name_session; |
|
5944 | + if (!empty($coach_name)) { |
|
5945 | + $row2 .= '<br />'.get_lang('Coach').': '.$coach_name; |
|
5946 | + } |
|
5947 | + $row[2] = $row2; |
|
5948 | 5948 | if (!empty($row['col3'])) { |
5949 | 5949 | $userInfo = api_get_user_info($row['user_id']); |
5950 | 5950 | |
@@ -5961,11 +5961,11 @@ discard block |
||
5961 | 5961 | $row[4] = $ip; |
5962 | 5962 | } |
5963 | 5963 | |
5964 | - $resources[] = $row; |
|
5965 | - } |
|
5966 | - } |
|
5964 | + $resources[] = $row; |
|
5965 | + } |
|
5966 | + } |
|
5967 | 5967 | |
5968 | - return $resources; |
|
5968 | + return $resources; |
|
5969 | 5969 | } |
5970 | 5970 | |
5971 | 5971 | /** |
@@ -5975,63 +5975,63 @@ discard block |
||
5975 | 5975 | */ |
5976 | 5976 | public static function get_tool_name_table($tool) |
5977 | 5977 | { |
5978 | - switch ($tool) { |
|
5979 | - case 'document': |
|
5980 | - $table_name = TABLE_DOCUMENT; |
|
5981 | - $link_tool = 'document/document.php'; |
|
5982 | - $id_tool = 'id'; |
|
5983 | - break; |
|
5984 | - case 'learnpath': |
|
5985 | - $table_name = TABLE_LP_MAIN; |
|
5986 | - $link_tool = 'newscorm/lp_controller.php'; |
|
5987 | - $id_tool = 'id'; |
|
5988 | - break; |
|
5989 | - case 'quiz': |
|
5990 | - $table_name = TABLE_QUIZ_TEST; |
|
5991 | - $link_tool = 'exercice/exercice.php'; |
|
5992 | - $id_tool = 'id'; |
|
5993 | - break; |
|
5994 | - case 'glossary': |
|
5995 | - $table_name = TABLE_GLOSSARY; |
|
5996 | - $link_tool = 'glossary/index.php'; |
|
5997 | - $id_tool = 'glossary_id'; |
|
5998 | - break; |
|
5999 | - case 'link': |
|
6000 | - $table_name = TABLE_LINK; |
|
6001 | - $link_tool = 'link/link.php'; |
|
6002 | - $id_tool = 'id'; |
|
6003 | - break; |
|
6004 | - case 'course_description': |
|
6005 | - $table_name = TABLE_COURSE_DESCRIPTION; |
|
6006 | - $link_tool = 'course_description/'; |
|
6007 | - $id_tool = 'id'; |
|
6008 | - break; |
|
6009 | - case 'announcement': |
|
6010 | - $table_name = TABLE_ANNOUNCEMENT; |
|
6011 | - $link_tool = 'announcements/announcements.php'; |
|
6012 | - $id_tool = 'id'; |
|
6013 | - break; |
|
6014 | - case 'thematic': |
|
6015 | - $table_name = TABLE_THEMATIC; |
|
6016 | - $link_tool = 'course_progress/index.php'; |
|
6017 | - $id_tool = 'id'; |
|
6018 | - break; |
|
6019 | - case 'thematic_advance': |
|
6020 | - $table_name = TABLE_THEMATIC_ADVANCE; |
|
6021 | - $link_tool = 'course_progress/index.php'; |
|
6022 | - $id_tool = 'id'; |
|
6023 | - break; |
|
6024 | - case 'thematic_plan': |
|
6025 | - $table_name = TABLE_THEMATIC_PLAN; |
|
6026 | - $link_tool = 'course_progress/index.php'; |
|
6027 | - $id_tool = 'id'; |
|
6028 | - break; |
|
6029 | - default: |
|
6030 | - $table_name = $tool; |
|
6031 | - break; |
|
6032 | - } |
|
6033 | - |
|
6034 | - return array( |
|
5978 | + switch ($tool) { |
|
5979 | + case 'document': |
|
5980 | + $table_name = TABLE_DOCUMENT; |
|
5981 | + $link_tool = 'document/document.php'; |
|
5982 | + $id_tool = 'id'; |
|
5983 | + break; |
|
5984 | + case 'learnpath': |
|
5985 | + $table_name = TABLE_LP_MAIN; |
|
5986 | + $link_tool = 'newscorm/lp_controller.php'; |
|
5987 | + $id_tool = 'id'; |
|
5988 | + break; |
|
5989 | + case 'quiz': |
|
5990 | + $table_name = TABLE_QUIZ_TEST; |
|
5991 | + $link_tool = 'exercice/exercice.php'; |
|
5992 | + $id_tool = 'id'; |
|
5993 | + break; |
|
5994 | + case 'glossary': |
|
5995 | + $table_name = TABLE_GLOSSARY; |
|
5996 | + $link_tool = 'glossary/index.php'; |
|
5997 | + $id_tool = 'glossary_id'; |
|
5998 | + break; |
|
5999 | + case 'link': |
|
6000 | + $table_name = TABLE_LINK; |
|
6001 | + $link_tool = 'link/link.php'; |
|
6002 | + $id_tool = 'id'; |
|
6003 | + break; |
|
6004 | + case 'course_description': |
|
6005 | + $table_name = TABLE_COURSE_DESCRIPTION; |
|
6006 | + $link_tool = 'course_description/'; |
|
6007 | + $id_tool = 'id'; |
|
6008 | + break; |
|
6009 | + case 'announcement': |
|
6010 | + $table_name = TABLE_ANNOUNCEMENT; |
|
6011 | + $link_tool = 'announcements/announcements.php'; |
|
6012 | + $id_tool = 'id'; |
|
6013 | + break; |
|
6014 | + case 'thematic': |
|
6015 | + $table_name = TABLE_THEMATIC; |
|
6016 | + $link_tool = 'course_progress/index.php'; |
|
6017 | + $id_tool = 'id'; |
|
6018 | + break; |
|
6019 | + case 'thematic_advance': |
|
6020 | + $table_name = TABLE_THEMATIC_ADVANCE; |
|
6021 | + $link_tool = 'course_progress/index.php'; |
|
6022 | + $id_tool = 'id'; |
|
6023 | + break; |
|
6024 | + case 'thematic_plan': |
|
6025 | + $table_name = TABLE_THEMATIC_PLAN; |
|
6026 | + $link_tool = 'course_progress/index.php'; |
|
6027 | + $id_tool = 'id'; |
|
6028 | + break; |
|
6029 | + default: |
|
6030 | + $table_name = $tool; |
|
6031 | + break; |
|
6032 | + } |
|
6033 | + |
|
6034 | + return array( |
|
6035 | 6035 | 'table_name' => $table_name, |
6036 | 6036 | 'link_tool' => $link_tool, |
6037 | 6037 | 'id_tool' => $id_tool |
@@ -6040,45 +6040,45 @@ discard block |
||
6040 | 6040 | |
6041 | 6041 | public static function display_additional_profile_fields() |
6042 | 6042 | { |
6043 | - // getting all the extra profile fields that are defined by the platform administrator |
|
6044 | - $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6045 | - |
|
6046 | - // creating the form |
|
6047 | - $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
|
6048 | - |
|
6049 | - // the select field with the additional user profile fields (= this is where we select the field of which we want to see |
|
6050 | - // the information the users have entered or selected. |
|
6051 | - $return .= '<select name="additional_profile_field">'; |
|
6052 | - $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>'; |
|
6053 | - $extra_fields_to_show = 0; |
|
6054 | - foreach ($extra_fields as $key=>$field) { |
|
6055 | - // show only extra fields that are visible + and can be filtered, added by J.Montoya |
|
6056 | - if ($field[6]==1 && $field[8] == 1) { |
|
6057 | - if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6058 | - $selected = 'selected="selected"'; |
|
6059 | - } else { |
|
6060 | - $selected = ''; |
|
6061 | - } |
|
6062 | - $extra_fields_to_show++; |
|
6063 | - $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>'; |
|
6064 | - } |
|
6065 | - } |
|
6066 | - $return .= '</select>'; |
|
6067 | - |
|
6068 | - // the form elements for the $_GET parameters (because the form is passed through GET |
|
6069 | - foreach ($_GET as $key=>$value){ |
|
6070 | - if ($key <> 'additional_profile_field') { |
|
6071 | - $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
|
6072 | - } |
|
6073 | - } |
|
6074 | - // the submit button |
|
6075 | - $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>'; |
|
6076 | - $return .= '</form>'; |
|
6077 | - if ($extra_fields_to_show > 0) { |
|
6078 | - return $return; |
|
6079 | - } else { |
|
6080 | - return ''; |
|
6081 | - } |
|
6043 | + // getting all the extra profile fields that are defined by the platform administrator |
|
6044 | + $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6045 | + |
|
6046 | + // creating the form |
|
6047 | + $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
|
6048 | + |
|
6049 | + // the select field with the additional user profile fields (= this is where we select the field of which we want to see |
|
6050 | + // the information the users have entered or selected. |
|
6051 | + $return .= '<select name="additional_profile_field">'; |
|
6052 | + $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>'; |
|
6053 | + $extra_fields_to_show = 0; |
|
6054 | + foreach ($extra_fields as $key=>$field) { |
|
6055 | + // show only extra fields that are visible + and can be filtered, added by J.Montoya |
|
6056 | + if ($field[6]==1 && $field[8] == 1) { |
|
6057 | + if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6058 | + $selected = 'selected="selected"'; |
|
6059 | + } else { |
|
6060 | + $selected = ''; |
|
6061 | + } |
|
6062 | + $extra_fields_to_show++; |
|
6063 | + $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>'; |
|
6064 | + } |
|
6065 | + } |
|
6066 | + $return .= '</select>'; |
|
6067 | + |
|
6068 | + // the form elements for the $_GET parameters (because the form is passed through GET |
|
6069 | + foreach ($_GET as $key=>$value){ |
|
6070 | + if ($key <> 'additional_profile_field') { |
|
6071 | + $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
|
6072 | + } |
|
6073 | + } |
|
6074 | + // the submit button |
|
6075 | + $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>'; |
|
6076 | + $return .= '</form>'; |
|
6077 | + if ($extra_fields_to_show > 0) { |
|
6078 | + return $return; |
|
6079 | + } else { |
|
6080 | + return ''; |
|
6081 | + } |
|
6082 | 6082 | } |
6083 | 6083 | |
6084 | 6084 | /** |
@@ -6097,31 +6097,31 @@ discard block |
||
6097 | 6097 | */ |
6098 | 6098 | public static function get_addtional_profile_information_of_field_by_user($field_id, $users) |
6099 | 6099 | { |
6100 | - // Database table definition |
|
6101 | - $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6102 | - $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
6100 | + // Database table definition |
|
6101 | + $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6102 | + $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
6103 | 6103 | $extraField = Database::get_main_table(TABLE_EXTRA_FIELD); |
6104 | - $result_extra_field = UserManager::get_extra_field_information($field_id); |
|
6105 | - |
|
6106 | - if (!empty($users)) { |
|
6107 | - if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6108 | - foreach($users as $user_id) { |
|
6109 | - $user_result = UserManager::get_user_tags($user_id, $field_id); |
|
6110 | - $tag_list = array(); |
|
6111 | - foreach($user_result as $item) { |
|
6112 | - $tag_list[] = $item['tag']; |
|
6113 | - } |
|
6114 | - $return[$user_id][] = implode(', ',$tag_list); |
|
6115 | - } |
|
6116 | - } else { |
|
6117 | - $new_user_array = array(); |
|
6118 | - foreach ($users as $user_id) { |
|
6119 | - $new_user_array[]= "'".$user_id."'"; |
|
6120 | - } |
|
6121 | - $users = implode(',',$new_user_array); |
|
6104 | + $result_extra_field = UserManager::get_extra_field_information($field_id); |
|
6105 | + |
|
6106 | + if (!empty($users)) { |
|
6107 | + if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6108 | + foreach($users as $user_id) { |
|
6109 | + $user_result = UserManager::get_user_tags($user_id, $field_id); |
|
6110 | + $tag_list = array(); |
|
6111 | + foreach($user_result as $item) { |
|
6112 | + $tag_list[] = $item['tag']; |
|
6113 | + } |
|
6114 | + $return[$user_id][] = implode(', ',$tag_list); |
|
6115 | + } |
|
6116 | + } else { |
|
6117 | + $new_user_array = array(); |
|
6118 | + foreach ($users as $user_id) { |
|
6119 | + $new_user_array[]= "'".$user_id."'"; |
|
6120 | + } |
|
6121 | + $users = implode(',',$new_user_array); |
|
6122 | 6122 | $extraFieldType = EntityExtraField::USER_FIELD_TYPE; |
6123 | - // Selecting only the necessary information NOT ALL the user list |
|
6124 | - $sql = "SELECT user.user_id, v.value |
|
6123 | + // Selecting only the necessary information NOT ALL the user list |
|
6124 | + $sql = "SELECT user.user_id, v.value |
|
6125 | 6125 | FROM $table_user user |
6126 | 6126 | INNER JOIN $table_user_field_values v |
6127 | 6127 | ON (user.user_id = v.item_id) |
@@ -6132,27 +6132,27 @@ discard block |
||
6132 | 6132 | v.field_id=".intval($field_id)." AND |
6133 | 6133 | user.user_id IN ($users)"; |
6134 | 6134 | |
6135 | - $result = Database::query($sql); |
|
6136 | - while($row = Database::fetch_array($result)) { |
|
6137 | - // get option value for field type double select by id |
|
6138 | - if (!empty($row['value'])) { |
|
6139 | - if ($result_extra_field['field_type'] == |
|
6135 | + $result = Database::query($sql); |
|
6136 | + while($row = Database::fetch_array($result)) { |
|
6137 | + // get option value for field type double select by id |
|
6138 | + if (!empty($row['value'])) { |
|
6139 | + if ($result_extra_field['field_type'] == |
|
6140 | 6140 | ExtraField::FIELD_TYPE_DOUBLE_SELECT |
6141 | 6141 | ) { |
6142 | - $id_double_select = explode(';', $row['value']); |
|
6143 | - if (is_array($id_double_select)) { |
|
6144 | - $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value']; |
|
6145 | - $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value']; |
|
6146 | - $row['value'] = ($value1.';'.$value2); |
|
6147 | - } |
|
6148 | - } |
|
6149 | - } |
|
6150 | - // get other value from extra field |
|
6151 | - $return[$row['user_id']][] = $row['value']; |
|
6152 | - } |
|
6153 | - } |
|
6154 | - } |
|
6155 | - return $return; |
|
6142 | + $id_double_select = explode(';', $row['value']); |
|
6143 | + if (is_array($id_double_select)) { |
|
6144 | + $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value']; |
|
6145 | + $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value']; |
|
6146 | + $row['value'] = ($value1.';'.$value2); |
|
6147 | + } |
|
6148 | + } |
|
6149 | + } |
|
6150 | + // get other value from extra field |
|
6151 | + $return[$row['user_id']][] = $row['value']; |
|
6152 | + } |
|
6153 | + } |
|
6154 | + } |
|
6155 | + return $return; |
|
6156 | 6156 | } |
6157 | 6157 | |
6158 | 6158 | /** |
@@ -6161,18 +6161,18 @@ discard block |
||
6161 | 6161 | */ |
6162 | 6162 | public function count_student_in_course() |
6163 | 6163 | { |
6164 | - global $nbStudents; |
|
6165 | - return $nbStudents; |
|
6164 | + global $nbStudents; |
|
6165 | + return $nbStudents; |
|
6166 | 6166 | } |
6167 | 6167 | |
6168 | 6168 | public function sort_users($a, $b) |
6169 | 6169 | { |
6170 | - return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
6170 | + return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
6171 | 6171 | } |
6172 | 6172 | |
6173 | 6173 | public function sort_users_desc($a, $b) |
6174 | 6174 | { |
6175 | - return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6175 | + return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6176 | 6176 | } |
6177 | 6177 | |
6178 | 6178 | /** |
@@ -6181,8 +6181,8 @@ discard block |
||
6181 | 6181 | */ |
6182 | 6182 | public static function get_number_of_users() |
6183 | 6183 | { |
6184 | - global $user_ids; |
|
6185 | - return count($user_ids); |
|
6184 | + global $user_ids; |
|
6185 | + return count($user_ids); |
|
6186 | 6186 | } |
6187 | 6187 | |
6188 | 6188 | /** |
@@ -6198,37 +6198,37 @@ discard block |
||
6198 | 6198 | { |
6199 | 6199 | global $user_ids, $course_code, $additional_user_profile_info, $export_csv, $is_western_name_order, $csv_content, $session_id; |
6200 | 6200 | |
6201 | - $course_code = Database::escape_string($course_code); |
|
6202 | - $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6203 | - $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
6201 | + $course_code = Database::escape_string($course_code); |
|
6202 | + $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6203 | + $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
6204 | 6204 | |
6205 | - $access_url_id = api_get_current_access_url_id(); |
|
6205 | + $access_url_id = api_get_current_access_url_id(); |
|
6206 | 6206 | |
6207 | - // get all users data from a course for sortable with limit |
|
6208 | - if (is_array($user_ids)) { |
|
6209 | - $user_ids = array_map('intval', $user_ids); |
|
6210 | - $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6211 | - } else { |
|
6212 | - $user_ids = intval($user_ids); |
|
6213 | - $condition_user = " WHERE user.user_id = $user_ids "; |
|
6214 | - } |
|
6207 | + // get all users data from a course for sortable with limit |
|
6208 | + if (is_array($user_ids)) { |
|
6209 | + $user_ids = array_map('intval', $user_ids); |
|
6210 | + $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6211 | + } else { |
|
6212 | + $user_ids = intval($user_ids); |
|
6213 | + $condition_user = " WHERE user.user_id = $user_ids "; |
|
6214 | + } |
|
6215 | 6215 | |
6216 | - if (!empty($_GET['user_keyword'])) { |
|
6217 | - $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
|
6218 | - $condition_user .= " AND ( |
|
6216 | + if (!empty($_GET['user_keyword'])) { |
|
6217 | + $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
|
6218 | + $condition_user .= " AND ( |
|
6219 | 6219 | user.firstname LIKE '%".$keyword."%' OR |
6220 | 6220 | user.lastname LIKE '%".$keyword."%' OR |
6221 | 6221 | user.username LIKE '%".$keyword."%' OR |
6222 | 6222 | user.email LIKE '%".$keyword."%' |
6223 | 6223 | ) "; |
6224 | - } |
|
6224 | + } |
|
6225 | 6225 | |
6226 | 6226 | $url_table = null; |
6227 | 6227 | $url_condition = null; |
6228 | - if (api_is_multiple_url_enabled()) { |
|
6229 | - $url_table = ", ".$tbl_url_rel_user." as url_users"; |
|
6230 | - $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'"; |
|
6231 | - } |
|
6228 | + if (api_is_multiple_url_enabled()) { |
|
6229 | + $url_table = ", ".$tbl_url_rel_user." as url_users"; |
|
6230 | + $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'"; |
|
6231 | + } |
|
6232 | 6232 | |
6233 | 6233 | $invitedUsersCondition = ''; |
6234 | 6234 | |
@@ -6236,7 +6236,7 @@ discard block |
||
6236 | 6236 | $invitedUsersCondition = " AND user.status != " . INVITEE; |
6237 | 6237 | } |
6238 | 6238 | |
6239 | - $sql = "SELECT user.user_id as user_id, |
|
6239 | + $sql = "SELECT user.user_id as user_id, |
|
6240 | 6240 | user.official_code as col0, |
6241 | 6241 | user.lastname as col1, |
6242 | 6242 | user.firstname as col2, |
@@ -6244,17 +6244,17 @@ discard block |
||
6244 | 6244 | FROM $tbl_user as user $url_table |
6245 | 6245 | $condition_user $url_condition $invitedUsersCondition"; |
6246 | 6246 | |
6247 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
6248 | - $direction = 'ASC'; |
|
6249 | - } |
|
6247 | + if (!in_array($direction, array('ASC','DESC'))) { |
|
6248 | + $direction = 'ASC'; |
|
6249 | + } |
|
6250 | 6250 | |
6251 | - $column = intval($column); |
|
6251 | + $column = intval($column); |
|
6252 | 6252 | |
6253 | - $from = intval($from); |
|
6254 | - $number_of_items = intval($number_of_items); |
|
6253 | + $from = intval($from); |
|
6254 | + $number_of_items = intval($number_of_items); |
|
6255 | 6255 | |
6256 | - $sql .= " ORDER BY col$column $direction "; |
|
6257 | - $sql .= " LIMIT $from,$number_of_items"; |
|
6256 | + $sql .= " ORDER BY col$column $direction "; |
|
6257 | + $sql .= " LIMIT $from,$number_of_items"; |
|
6258 | 6258 | |
6259 | 6259 | $res = Database::query($sql); |
6260 | 6260 | $users = array(); |
@@ -6288,7 +6288,7 @@ discard block |
||
6288 | 6288 | } |
6289 | 6289 | } |
6290 | 6290 | |
6291 | - while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
6291 | + while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
6292 | 6292 | $courseInfo = api_get_course_info($course_code); |
6293 | 6293 | $courseId = $courseInfo['real_id']; |
6294 | 6294 | |
@@ -6319,10 +6319,10 @@ discard block |
||
6319 | 6319 | $session_id |
6320 | 6320 | ); |
6321 | 6321 | |
6322 | - if (empty($avg_student_progress)) { |
|
6322 | + if (empty($avg_student_progress)) { |
|
6323 | 6323 | $avg_student_progress = 0; |
6324 | - } |
|
6325 | - $user['average_progress'] = $avg_student_progress.'%'; |
|
6324 | + } |
|
6325 | + $user['average_progress'] = $avg_student_progress.'%'; |
|
6326 | 6326 | |
6327 | 6327 | $total_user_exercise = Tracking::get_exercise_student_progress( |
6328 | 6328 | $total_exercises, |
@@ -6342,11 +6342,11 @@ discard block |
||
6342 | 6342 | |
6343 | 6343 | $user['exercise_average_best_attempt'] = $total_user_exercise; |
6344 | 6344 | |
6345 | - if (is_numeric($avg_student_score)) { |
|
6346 | - $user['student_score'] = $avg_student_score.'%'; |
|
6347 | - } else { |
|
6348 | - $user['student_score'] = $avg_student_score; |
|
6349 | - } |
|
6345 | + if (is_numeric($avg_student_score)) { |
|
6346 | + $user['student_score'] = $avg_student_score.'%'; |
|
6347 | + } else { |
|
6348 | + $user['student_score'] = $avg_student_score; |
|
6349 | + } |
|
6350 | 6350 | |
6351 | 6351 | $user['count_assignments'] = Tracking::count_student_assignments( |
6352 | 6352 | $user['user_id'], |
@@ -6369,29 +6369,29 @@ discard block |
||
6369 | 6369 | $session_id |
6370 | 6370 | ); |
6371 | 6371 | |
6372 | - // we need to display an additional profile field |
|
6373 | - $user['additional'] = ''; |
|
6372 | + // we need to display an additional profile field |
|
6373 | + $user['additional'] = ''; |
|
6374 | 6374 | |
6375 | - if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
|
6376 | - if (isset($additional_user_profile_info[$user['user_id']]) && |
|
6375 | + if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
|
6376 | + if (isset($additional_user_profile_info[$user['user_id']]) && |
|
6377 | 6377 | is_array($additional_user_profile_info[$user['user_id']]) |
6378 | 6378 | ) { |
6379 | - $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]); |
|
6380 | - } |
|
6381 | - } |
|
6379 | + $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]); |
|
6380 | + } |
|
6381 | + } |
|
6382 | 6382 | |
6383 | 6383 | if (empty($session_id)) { |
6384 | 6384 | $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys; |
6385 | 6385 | } |
6386 | 6386 | |
6387 | - $user['link'] = '<center> |
|
6387 | + $user['link'] = '<center> |
|
6388 | 6388 | <a href="../mySpace/myStudents.php?student='.$user['user_id'].'&details=true&course='.$course_code.'&origin=tracking_course&id_session='.$session_id.'"> |
6389 | 6389 | '.Display::return_icon('2rightarrow.png').' |
6390 | 6390 | </a> |
6391 | 6391 | </center>'; |
6392 | 6392 | |
6393 | - // store columns in array $users |
|
6394 | - $is_western_name_order = api_is_western_name_order(); |
|
6393 | + // store columns in array $users |
|
6394 | + $is_western_name_order = api_is_western_name_order(); |
|
6395 | 6395 | $user_row = array(); |
6396 | 6396 | $user_row[]= $user['official_code']; //0 |
6397 | 6397 | if ($is_western_name_order) { |
@@ -6424,21 +6424,21 @@ discard block |
||
6424 | 6424 | |
6425 | 6425 | $users[] = $user_row; |
6426 | 6426 | |
6427 | - if ($export_csv) { |
|
6428 | - if (empty($session_id)) { |
|
6427 | + if ($export_csv) { |
|
6428 | + if (empty($session_id)) { |
|
6429 | 6429 | $user_row = array_map('strip_tags', $user_row); |
6430 | - unset($user_row[14]); |
|
6431 | - unset($user_row[15]); |
|
6430 | + unset($user_row[14]); |
|
6431 | + unset($user_row[15]); |
|
6432 | 6432 | } else { |
6433 | 6433 | $user_row = array_map('strip_tags', $user_row); |
6434 | 6434 | unset($user_row[13]); |
6435 | 6435 | unset($user_row[14]); |
6436 | 6436 | } |
6437 | 6437 | |
6438 | - $csv_content[] = $user_row; |
|
6439 | - } |
|
6440 | - } |
|
6441 | - return $users; |
|
6438 | + $csv_content[] = $user_row; |
|
6439 | + } |
|
6440 | + } |
|
6441 | + return $users; |
|
6442 | 6442 | } |
6443 | 6443 | } |
6444 | 6444 | |
@@ -6456,18 +6456,18 @@ discard block |
||
6456 | 6456 | */ |
6457 | 6457 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
6458 | 6458 | { |
6459 | - $MonthsLong = $GLOBALS['MonthsLong']; |
|
6460 | - |
|
6461 | - // protected data |
|
6462 | - $user_id = intval($user_id); |
|
6463 | - $session_id = intval($session_id); |
|
6464 | - $course_id = Database::escape_string($course_id); |
|
6465 | - |
|
6466 | - $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6467 | - $tempView = $view; |
|
6468 | - if(substr($view,0,1) == '1') { |
|
6469 | - $new_view = substr_replace($view,'0',0,1); |
|
6470 | - echo " |
|
6459 | + $MonthsLong = $GLOBALS['MonthsLong']; |
|
6460 | + |
|
6461 | + // protected data |
|
6462 | + $user_id = intval($user_id); |
|
6463 | + $session_id = intval($session_id); |
|
6464 | + $course_id = Database::escape_string($course_id); |
|
6465 | + |
|
6466 | + $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6467 | + $tempView = $view; |
|
6468 | + if(substr($view,0,1) == '1') { |
|
6469 | + $new_view = substr_replace($view,'0',0,1); |
|
6470 | + echo " |
|
6471 | 6471 | <tr> |
6472 | 6472 | <td valign='top'> |
6473 | 6473 | <font color='#0000FF'>- </font>" . |
@@ -6475,9 +6475,9 @@ discard block |
||
6475 | 6475 | </td> |
6476 | 6476 | </tr> |
6477 | 6477 | "; |
6478 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>"; |
|
6478 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>"; |
|
6479 | 6479 | |
6480 | - $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6480 | + $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6481 | 6481 | FROM $track_access_table |
6482 | 6482 | WHERE access_user_id = $user_id |
6483 | 6483 | AND c_id = $course_id |
@@ -6485,11 +6485,11 @@ discard block |
||
6485 | 6485 | GROUP BY YEAR(access_date),MONTH(access_date) |
6486 | 6486 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
6487 | 6487 | |
6488 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6489 | - $results = getManyResults3Col($sql); |
|
6488 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6489 | + $results = getManyResults3Col($sql); |
|
6490 | 6490 | |
6491 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6492 | - echo "<tr> |
|
6491 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6492 | + echo "<tr> |
|
6493 | 6493 | <td class='secLine'> |
6494 | 6494 | ".get_lang('LoginsTitleMonthColumn')." |
6495 | 6495 | </td> |
@@ -6497,36 +6497,36 @@ discard block |
||
6497 | 6497 | ".get_lang('LoginsTitleCountColumn')." |
6498 | 6498 | </td> |
6499 | 6499 | </tr>"; |
6500 | - $total = 0; |
|
6501 | - if (is_array($results)) { |
|
6502 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6503 | - echo "<tr>"; |
|
6504 | - echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
6505 | - echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
|
6506 | - echo"</tr>"; |
|
6507 | - $total = $total + $results[$j][1]; |
|
6508 | - } |
|
6509 | - echo "<tr>"; |
|
6510 | - echo "<td>".get_lang('Total')."</td>"; |
|
6511 | - echo "<td align='right' class='content'>".$total."</td>"; |
|
6512 | - echo"</tr>"; |
|
6513 | - } else { |
|
6514 | - echo "<tr>"; |
|
6515 | - echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
|
6516 | - echo"</tr>"; |
|
6517 | - } |
|
6518 | - echo "</table>"; |
|
6519 | - echo "</td></tr>"; |
|
6520 | - } else { |
|
6521 | - $new_view = substr_replace($view,'1',0,1); |
|
6522 | - echo " |
|
6500 | + $total = 0; |
|
6501 | + if (is_array($results)) { |
|
6502 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6503 | + echo "<tr>"; |
|
6504 | + echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
6505 | + echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
|
6506 | + echo"</tr>"; |
|
6507 | + $total = $total + $results[$j][1]; |
|
6508 | + } |
|
6509 | + echo "<tr>"; |
|
6510 | + echo "<td>".get_lang('Total')."</td>"; |
|
6511 | + echo "<td align='right' class='content'>".$total."</td>"; |
|
6512 | + echo"</tr>"; |
|
6513 | + } else { |
|
6514 | + echo "<tr>"; |
|
6515 | + echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
|
6516 | + echo"</tr>"; |
|
6517 | + } |
|
6518 | + echo "</table>"; |
|
6519 | + echo "</td></tr>"; |
|
6520 | + } else { |
|
6521 | + $new_view = substr_replace($view,'1',0,1); |
|
6522 | + echo " |
|
6523 | 6523 | <tr> |
6524 | 6524 | <td valign='top'> |
6525 | 6525 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".$user_id."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LoginsAndAccessTools')."</a> |
6526 | 6526 | </td> |
6527 | 6527 | </tr> |
6528 | 6528 | "; |
6529 | - } |
|
6529 | + } |
|
6530 | 6530 | } |
6531 | 6531 | |
6532 | 6532 | /** |
@@ -6539,38 +6539,38 @@ discard block |
||
6539 | 6539 | */ |
6540 | 6540 | public function display_exercise_tracking_info($view, $user_id, $courseCode) |
6541 | 6541 | { |
6542 | - global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
6542 | + global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
6543 | 6543 | $courseId = api_get_course_int_id($courseCode); |
6544 | - if(substr($view,1,1) == '1') { |
|
6545 | - $new_view = substr_replace($view,'0',1,1); |
|
6546 | - echo "<tr> |
|
6544 | + if(substr($view,1,1) == '1') { |
|
6545 | + $new_view = substr_replace($view,'0',1,1); |
|
6546 | + echo "<tr> |
|
6547 | 6547 | <td valign='top'> |
6548 | 6548 | <font color='#0000FF'>- </font><b>".get_lang('ExercicesResults')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>] |
6549 | 6549 | </td> |
6550 | 6550 | </tr>"; |
6551 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />"; |
|
6551 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />"; |
|
6552 | 6552 | |
6553 | - $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6553 | + $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6554 | 6554 | FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te |
6555 | 6555 | WHERE te.c_id = $courseId |
6556 | 6556 | AND te.exe_user_id = ".intval($user_id)." |
6557 | 6557 | AND te.exe_exo_id = ce.id |
6558 | 6558 | ORDER BY ce.title ASC, te.exe_date ASC"; |
6559 | 6559 | |
6560 | - $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6560 | + $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6561 | 6561 | FROM $TBL_TRACK_HOTPOTATOES AS te |
6562 | 6562 | WHERE te.exe_user_id = '".intval($user_id)."' AND te.c_id = $courseId |
6563 | 6563 | ORDER BY te.c_id ASC, te.exe_date ASC"; |
6564 | 6564 | |
6565 | - $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
6565 | + $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
6566 | 6566 | |
6567 | - $NoTestRes = 0; |
|
6568 | - $NoHPTestRes = 0; |
|
6567 | + $NoTestRes = 0; |
|
6568 | + $NoHPTestRes = 0; |
|
6569 | 6569 | |
6570 | - echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n"; |
|
6571 | - $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6572 | - echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n"; |
|
6573 | - echo " |
|
6570 | + echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n"; |
|
6571 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6572 | + echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n"; |
|
6573 | + echo " |
|
6574 | 6574 | <tr bgcolor='#E6E6E6'> |
6575 | 6575 | <td> |
6576 | 6576 | ".get_lang('ExercicesTitleExerciceColumn')." |
@@ -6583,28 +6583,28 @@ discard block |
||
6583 | 6583 | </td> |
6584 | 6584 | </tr>"; |
6585 | 6585 | |
6586 | - if (is_array($results)) { |
|
6587 | - for($i = 0; $i < sizeof($results); $i++) { |
|
6588 | - $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
6589 | - echo "<tr>\n"; |
|
6590 | - echo "<td class='content'>".$results[$i][0]."</td>\n"; |
|
6591 | - echo "<td class='content'>".$display_date."</td>\n"; |
|
6592 | - echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n"; |
|
6593 | - echo "</tr>\n"; |
|
6594 | - } |
|
6595 | - } else { |
|
6596 | - // istvan begin |
|
6597 | - $NoTestRes = 1; |
|
6598 | - } |
|
6599 | - |
|
6600 | - // The Result of Tests |
|
6601 | - if (is_array($hpresults)) { |
|
6602 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6603 | - $title = GetQuizName($hpresults[$i][0],''); |
|
6604 | - if ($title == '') |
|
6605 | - $title = basename($hpresults[$i][0]); |
|
6606 | - $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
6607 | - ?> |
|
6586 | + if (is_array($results)) { |
|
6587 | + for($i = 0; $i < sizeof($results); $i++) { |
|
6588 | + $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
6589 | + echo "<tr>\n"; |
|
6590 | + echo "<td class='content'>".$results[$i][0]."</td>\n"; |
|
6591 | + echo "<td class='content'>".$display_date."</td>\n"; |
|
6592 | + echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n"; |
|
6593 | + echo "</tr>\n"; |
|
6594 | + } |
|
6595 | + } else { |
|
6596 | + // istvan begin |
|
6597 | + $NoTestRes = 1; |
|
6598 | + } |
|
6599 | + |
|
6600 | + // The Result of Tests |
|
6601 | + if (is_array($hpresults)) { |
|
6602 | + for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6603 | + $title = GetQuizName($hpresults[$i][0],''); |
|
6604 | + if ($title == '') |
|
6605 | + $title = basename($hpresults[$i][0]); |
|
6606 | + $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
6607 | + ?> |
|
6608 | 6608 | <tr> |
6609 | 6609 | <td class="content"><?php echo $title; ?></td> |
6610 | 6610 | <td class="content" align="center"><?php echo $display_date; ?></td> |
@@ -6614,26 +6614,26 @@ discard block |
||
6614 | 6614 | |
6615 | 6615 | <?php |
6616 | 6616 | } |
6617 | - } else { |
|
6618 | - $NoHPTestRes = 1; |
|
6619 | - } |
|
6620 | - |
|
6621 | - if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
6622 | - echo "<tr>\n"; |
|
6623 | - echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n"; |
|
6624 | - echo "</tr>\n"; |
|
6625 | - } |
|
6626 | - echo "</table>"; |
|
6627 | - echo "</td>\n</tr>\n"; |
|
6628 | - } else { |
|
6629 | - $new_view = substr_replace($view,'1',1,1); |
|
6630 | - echo " |
|
6617 | + } else { |
|
6618 | + $NoHPTestRes = 1; |
|
6619 | + } |
|
6620 | + |
|
6621 | + if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
6622 | + echo "<tr>\n"; |
|
6623 | + echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n"; |
|
6624 | + echo "</tr>\n"; |
|
6625 | + } |
|
6626 | + echo "</table>"; |
|
6627 | + echo "</td>\n</tr>\n"; |
|
6628 | + } else { |
|
6629 | + $new_view = substr_replace($view,'1',1,1); |
|
6630 | + echo " |
|
6631 | 6631 | <tr> |
6632 | 6632 | <td valign='top'> |
6633 | 6633 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=$user_id&view=".$new_view."' class='specialLink'>".get_lang('ExercicesResults')."</a> |
6634 | 6634 | </td> |
6635 | 6635 | </tr>"; |
6636 | - } |
|
6636 | + } |
|
6637 | 6637 | } |
6638 | 6638 | |
6639 | 6639 | /** |
@@ -6642,27 +6642,27 @@ discard block |
||
6642 | 6642 | */ |
6643 | 6643 | public function display_student_publications_tracking_info($view, $user_id, $course_id) |
6644 | 6644 | { |
6645 | - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
6645 | + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
6646 | 6646 | $_course = api_get_course_info_by_id($course_id); |
6647 | 6647 | |
6648 | - if (substr($view,2,1) == '1') { |
|
6649 | - $new_view = substr_replace($view,'0',2,1); |
|
6650 | - echo "<tr> |
|
6648 | + if (substr($view,2,1) == '1') { |
|
6649 | + $new_view = substr_replace($view,'0',2,1); |
|
6650 | + echo "<tr> |
|
6651 | 6651 | <td valign='top'> |
6652 | 6652 | <font color='#0000FF'>- </font><b>".get_lang('WorkUploads')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>] |
6653 | 6653 | </td> |
6654 | 6654 | </tr>"; |
6655 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>"; |
|
6656 | - $sql = "SELECT u.upload_date, w.title, w.author,w.url |
|
6655 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>"; |
|
6656 | + $sql = "SELECT u.upload_date, w.title, w.author,w.url |
|
6657 | 6657 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
6658 | 6658 | WHERE u.upload_work_id = w.id |
6659 | 6659 | AND u.upload_user_id = '".intval($user_id)."' |
6660 | 6660 | AND u.c_id = '".intval($course_id)."' |
6661 | 6661 | ORDER BY u.upload_date DESC"; |
6662 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6663 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6664 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6665 | - echo "<tr> |
|
6662 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6663 | + $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6664 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6665 | + echo "<tr> |
|
6666 | 6666 | <td class='secLine' width='40%'> |
6667 | 6667 | ".get_lang('WorkTitle')." |
6668 | 6668 | </td> |
@@ -6673,35 +6673,35 @@ discard block |
||
6673 | 6673 | ".get_lang('Date')." |
6674 | 6674 | </td> |
6675 | 6675 | </tr>"; |
6676 | - if (is_array($results)) { |
|
6677 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6678 | - $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
6679 | - $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
6680 | - echo "<tr>"; |
|
6681 | - echo "<td class='content'>" |
|
6682 | - ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>" |
|
6683 | - ."</td>"; |
|
6684 | - echo "<td class='content'>".$results[$j][2]."</td>"; |
|
6685 | - echo "<td class='content'>".$beautifulDate."</td>"; |
|
6686 | - echo"</tr>"; |
|
6687 | - } |
|
6688 | - } else { |
|
6689 | - echo "<tr>"; |
|
6690 | - echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>"; |
|
6691 | - echo"</tr>"; |
|
6692 | - } |
|
6693 | - echo "</table>"; |
|
6694 | - echo "</td></tr>"; |
|
6695 | - } else { |
|
6696 | - $new_view = substr_replace($view,'1',2,1); |
|
6697 | - echo " |
|
6676 | + if (is_array($results)) { |
|
6677 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6678 | + $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
6679 | + $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
6680 | + echo "<tr>"; |
|
6681 | + echo "<td class='content'>" |
|
6682 | + ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>" |
|
6683 | + ."</td>"; |
|
6684 | + echo "<td class='content'>".$results[$j][2]."</td>"; |
|
6685 | + echo "<td class='content'>".$beautifulDate."</td>"; |
|
6686 | + echo"</tr>"; |
|
6687 | + } |
|
6688 | + } else { |
|
6689 | + echo "<tr>"; |
|
6690 | + echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>"; |
|
6691 | + echo"</tr>"; |
|
6692 | + } |
|
6693 | + echo "</table>"; |
|
6694 | + echo "</td></tr>"; |
|
6695 | + } else { |
|
6696 | + $new_view = substr_replace($view,'1',2,1); |
|
6697 | + echo " |
|
6698 | 6698 | <tr> |
6699 | 6699 | <td valign='top'> |
6700 | 6700 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('WorkUploads')."</a> |
6701 | 6701 | </td> |
6702 | 6702 | </tr> |
6703 | 6703 | "; |
6704 | - } |
|
6704 | + } |
|
6705 | 6705 | } |
6706 | 6706 | |
6707 | 6707 | /** |
@@ -6710,55 +6710,55 @@ discard block |
||
6710 | 6710 | */ |
6711 | 6711 | public function display_links_tracking_info($view, $user_id, $courseCode) |
6712 | 6712 | { |
6713 | - global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
6713 | + global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
6714 | 6714 | $courseId = api_get_course_int_id($courseCode); |
6715 | - if (substr($view,3,1) == '1') { |
|
6716 | - $new_view = substr_replace($view,'0',3,1); |
|
6717 | - echo " |
|
6715 | + if (substr($view,3,1) == '1') { |
|
6716 | + $new_view = substr_replace($view,'0',3,1); |
|
6717 | + echo " |
|
6718 | 6718 | <tr> |
6719 | 6719 | <td valign='top'> |
6720 | 6720 | <font color='#0000FF'>- </font><b>".get_lang('LinksAccess')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00010'>".get_lang('ExportAsCSV')."</a>] |
6721 | 6721 | </td> |
6722 | 6722 | </tr> |
6723 | 6723 | "; |
6724 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>"; |
|
6725 | - $sql = "SELECT cl.title, cl.url |
|
6724 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>"; |
|
6725 | + $sql = "SELECT cl.title, cl.url |
|
6726 | 6726 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
6727 | 6727 | WHERE sl.links_link_id = cl.id |
6728 | 6728 | AND sl.c_id = $courseId |
6729 | 6729 | AND sl.links_user_id = ".intval($user_id)." |
6730 | 6730 | GROUP BY cl.title, cl.url"; |
6731 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6732 | - $results = StatsUtils::getManyResults2Col($sql); |
|
6733 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6734 | - echo "<tr> |
|
6731 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6732 | + $results = StatsUtils::getManyResults2Col($sql); |
|
6733 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6734 | + echo "<tr> |
|
6735 | 6735 | <td class='secLine'> |
6736 | 6736 | ".get_lang('LinksTitleLinkColumn')." |
6737 | 6737 | </td> |
6738 | 6738 | </tr>"; |
6739 | - if (is_array($results)) { |
|
6740 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6741 | - echo "<tr>"; |
|
6742 | - echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
|
6743 | - echo"</tr>"; |
|
6744 | - } |
|
6745 | - } else { |
|
6746 | - echo "<tr>"; |
|
6747 | - echo "<td ><center>".get_lang('NoResult')."</center></td>"; |
|
6748 | - echo"</tr>"; |
|
6749 | - } |
|
6750 | - echo "</table>"; |
|
6751 | - echo "</td></tr>"; |
|
6752 | - } else { |
|
6753 | - $new_view = substr_replace($view,'1',3,1); |
|
6754 | - echo " |
|
6739 | + if (is_array($results)) { |
|
6740 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6741 | + echo "<tr>"; |
|
6742 | + echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
|
6743 | + echo"</tr>"; |
|
6744 | + } |
|
6745 | + } else { |
|
6746 | + echo "<tr>"; |
|
6747 | + echo "<td ><center>".get_lang('NoResult')."</center></td>"; |
|
6748 | + echo"</tr>"; |
|
6749 | + } |
|
6750 | + echo "</table>"; |
|
6751 | + echo "</td></tr>"; |
|
6752 | + } else { |
|
6753 | + $new_view = substr_replace($view,'1',3,1); |
|
6754 | + echo " |
|
6755 | 6755 | <tr> |
6756 | 6756 | <td valign='top'> |
6757 | 6757 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LinksAccess')."</a> |
6758 | 6758 | </td> |
6759 | 6759 | </tr> |
6760 | 6760 | "; |
6761 | - } |
|
6761 | + } |
|
6762 | 6762 | } |
6763 | 6763 | |
6764 | 6764 | /** |
@@ -6771,61 +6771,61 @@ discard block |
||
6771 | 6771 | */ |
6772 | 6772 | public static function display_document_tracking_info($view, $user_id, $course_code, $session_id = 0) |
6773 | 6773 | { |
6774 | - // protect data |
|
6774 | + // protect data |
|
6775 | 6775 | $user_id = intval($user_id); |
6776 | 6776 | $courseId = api_get_course_int_id($course_code); |
6777 | - $session_id = intval($session_id); |
|
6777 | + $session_id = intval($session_id); |
|
6778 | 6778 | |
6779 | - $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
6780 | - if(substr($view,4,1) == '1') { |
|
6781 | - $new_view = substr_replace($view,'0',4,1); |
|
6782 | - echo " |
|
6779 | + $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
6780 | + if(substr($view,4,1) == '1') { |
|
6781 | + $new_view = substr_replace($view,'0',4,1); |
|
6782 | + echo " |
|
6783 | 6783 | <tr> |
6784 | 6784 | <td valign='top'> |
6785 | 6785 | <font color='#0000FF'>- </font><b>".get_lang('DocumentsAccess')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00001'>".get_lang('ExportAsCSV')."</a>] |
6786 | 6786 | </td> |
6787 | 6787 | </tr> |
6788 | 6788 | "; |
6789 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>"; |
|
6789 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>"; |
|
6790 | 6790 | |
6791 | - $sql = "SELECT down_doc_path |
|
6791 | + $sql = "SELECT down_doc_path |
|
6792 | 6792 | FROM $downloads_table |
6793 | 6793 | WHERE c_id = $courseId |
6794 | 6794 | AND down_user_id = $user_id |
6795 | 6795 | AND down_session_id = $session_id |
6796 | 6796 | GROUP BY down_doc_path"; |
6797 | 6797 | |
6798 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6799 | - $results = StatsUtils::getManyResults1Col($sql); |
|
6800 | - echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>"; |
|
6801 | - echo "<tr> |
|
6798 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6799 | + $results = StatsUtils::getManyResults1Col($sql); |
|
6800 | + echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>"; |
|
6801 | + echo "<tr> |
|
6802 | 6802 | <td class='secLine'> |
6803 | 6803 | ".get_lang('DocumentsTitleDocumentColumn')." |
6804 | 6804 | </td> |
6805 | 6805 | </tr>"; |
6806 | - if (is_array($results)) { |
|
6807 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6808 | - echo "<tr>"; |
|
6809 | - echo "<td class='content'>".$results[$j]."</td>"; |
|
6810 | - echo"</tr>"; |
|
6811 | - } |
|
6812 | - } else { |
|
6813 | - echo "<tr>"; |
|
6814 | - echo "<td><center>".get_lang('NoResult')."</center></td>"; |
|
6815 | - echo"</tr>"; |
|
6816 | - } |
|
6817 | - echo "</table>"; |
|
6818 | - echo "</td></tr>"; |
|
6819 | - } else { |
|
6820 | - $new_view = substr_replace($view,'1',4,1); |
|
6821 | - echo " |
|
6806 | + if (is_array($results)) { |
|
6807 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6808 | + echo "<tr>"; |
|
6809 | + echo "<td class='content'>".$results[$j]."</td>"; |
|
6810 | + echo"</tr>"; |
|
6811 | + } |
|
6812 | + } else { |
|
6813 | + echo "<tr>"; |
|
6814 | + echo "<td><center>".get_lang('NoResult')."</center></td>"; |
|
6815 | + echo"</tr>"; |
|
6816 | + } |
|
6817 | + echo "</table>"; |
|
6818 | + echo "</td></tr>"; |
|
6819 | + } else { |
|
6820 | + $new_view = substr_replace($view,'1',4,1); |
|
6821 | + echo " |
|
6822 | 6822 | <tr> |
6823 | 6823 | <td valign='top'> |
6824 | 6824 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('DocumentsAccess')."</a> |
6825 | 6825 | </td> |
6826 | 6826 | </tr> |
6827 | 6827 | "; |
6828 | - } |
|
6828 | + } |
|
6829 | 6829 | } |
6830 | 6830 | |
6831 | 6831 | /** |
@@ -6882,43 +6882,43 @@ discard block |
||
6882 | 6882 | */ |
6883 | 6883 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
6884 | 6884 | { |
6885 | - $MonthsLong = $GLOBALS['MonthsLong']; |
|
6886 | - $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6887 | - |
|
6888 | - // protected data |
|
6889 | - $user_id = intval($user_id); |
|
6890 | - $session_id = intval($session_id); |
|
6891 | - $course_id = intval($course_id); |
|
6892 | - |
|
6893 | - $tempView = $view; |
|
6894 | - if (substr($view,0,1) == '1') { |
|
6895 | - $new_view = substr_replace($view,'0',0,1); |
|
6896 | - $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
6897 | - $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6885 | + $MonthsLong = $GLOBALS['MonthsLong']; |
|
6886 | + $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6887 | + |
|
6888 | + // protected data |
|
6889 | + $user_id = intval($user_id); |
|
6890 | + $session_id = intval($session_id); |
|
6891 | + $course_id = intval($course_id); |
|
6892 | + |
|
6893 | + $tempView = $view; |
|
6894 | + if (substr($view,0,1) == '1') { |
|
6895 | + $new_view = substr_replace($view,'0',0,1); |
|
6896 | + $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
6897 | + $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6898 | 6898 | FROM $track_access_table |
6899 | 6899 | WHERE access_user_id = $user_id |
6900 | 6900 | AND c_id = $course_id |
6901 | 6901 | AND access_session_id = $session_id |
6902 | 6902 | GROUP BY YEAR(access_date),MONTH(access_date) |
6903 | 6903 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
6904 | - //$results = getManyResults2Col($sql); |
|
6905 | - $results = getManyResults3Col($sql); |
|
6906 | - $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
6907 | - $line=''; |
|
6908 | - $total = 0; |
|
6909 | - if (is_array($results)) { |
|
6910 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6911 | - $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
|
6912 | - $total = $total + $results[$j][1]; |
|
6913 | - } |
|
6914 | - $line .= get_lang('Total').";".$total."\n"; |
|
6915 | - } else { |
|
6916 | - $line= get_lang('NoResult')."</center></td>"; |
|
6917 | - } |
|
6918 | - } else { |
|
6919 | - $new_view = substr_replace($view,'1',0,1); |
|
6920 | - } |
|
6921 | - return array($title_line, $line); |
|
6904 | + //$results = getManyResults2Col($sql); |
|
6905 | + $results = getManyResults3Col($sql); |
|
6906 | + $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
6907 | + $line=''; |
|
6908 | + $total = 0; |
|
6909 | + if (is_array($results)) { |
|
6910 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6911 | + $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
|
6912 | + $total = $total + $results[$j][1]; |
|
6913 | + } |
|
6914 | + $line .= get_lang('Total').";".$total."\n"; |
|
6915 | + } else { |
|
6916 | + $line= get_lang('NoResult')."</center></td>"; |
|
6917 | + } |
|
6918 | + } else { |
|
6919 | + $new_view = substr_replace($view,'1',0,1); |
|
6920 | + } |
|
6921 | + return array($title_line, $line); |
|
6922 | 6922 | } |
6923 | 6923 | |
6924 | 6924 | /** |
@@ -6931,67 +6931,67 @@ discard block |
||
6931 | 6931 | */ |
6932 | 6932 | public function display_exercise_tracking_info($view, $userId, $courseCode) |
6933 | 6933 | { |
6934 | - global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
6934 | + global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
6935 | 6935 | $courseId = api_get_course_int_id($courseCode); |
6936 | 6936 | $userId = intval($userId); |
6937 | - if (substr($view,1,1) == '1') { |
|
6938 | - $new_view = substr_replace($view,'0',1,1); |
|
6939 | - $title[1] = get_lang('ExercicesDetails'); |
|
6940 | - $line = ''; |
|
6941 | - $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6937 | + if (substr($view,1,1) == '1') { |
|
6938 | + $new_view = substr_replace($view,'0',1,1); |
|
6939 | + $title[1] = get_lang('ExercicesDetails'); |
|
6940 | + $line = ''; |
|
6941 | + $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6942 | 6942 | FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te |
6943 | 6943 | WHERE te.c_id = $courseId |
6944 | 6944 | AND te.exe_user_id = $userId |
6945 | 6945 | AND te.exe_exo_id = ce.id |
6946 | 6946 | ORDER BY ce.title ASC, te.exe_date ASC"; |
6947 | 6947 | |
6948 | - $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6948 | + $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6949 | 6949 | FROM $TABLETRACK_HOTPOTATOES AS te |
6950 | 6950 | WHERE te.exe_user_id = '$userId' AND te.c_id = $courseId |
6951 | 6951 | ORDER BY te.c_id ASC, te.exe_date ASC"; |
6952 | 6952 | |
6953 | - $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
6953 | + $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
6954 | 6954 | |
6955 | - $NoTestRes = 0; |
|
6956 | - $NoHPTestRes = 0; |
|
6955 | + $NoTestRes = 0; |
|
6956 | + $NoHPTestRes = 0; |
|
6957 | 6957 | |
6958 | - $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6959 | - $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
|
6958 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6959 | + $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
|
6960 | 6960 | |
6961 | - if (is_array($results)) { |
|
6962 | - for($i = 0; $i < sizeof($results); $i++) |
|
6963 | - { |
|
6964 | - $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
6965 | - $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
|
6966 | - } |
|
6967 | - } else { |
|
6961 | + if (is_array($results)) { |
|
6962 | + for($i = 0; $i < sizeof($results); $i++) |
|
6963 | + { |
|
6964 | + $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
6965 | + $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
|
6966 | + } |
|
6967 | + } else { |
|
6968 | 6968 | // istvan begin |
6969 | - $NoTestRes = 1; |
|
6970 | - } |
|
6971 | - |
|
6972 | - // The Result of Tests |
|
6973 | - if (is_array($hpresults)) { |
|
6974 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6975 | - $title = GetQuizName($hpresults[$i][0],''); |
|
6976 | - |
|
6977 | - if ($title == '') |
|
6978 | - $title = basename($hpresults[$i][0]); |
|
6979 | - |
|
6980 | - $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
6981 | - |
|
6982 | - $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; |
|
6983 | - } |
|
6984 | - } else { |
|
6985 | - $NoHPTestRes = 1; |
|
6986 | - } |
|
6987 | - |
|
6988 | - if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
6989 | - $line=get_lang('NoResult'); |
|
6990 | - } |
|
6991 | - } else { |
|
6992 | - $new_view = substr_replace($view,'1',1,1); |
|
6993 | - } |
|
6994 | - return array($title_line, $line); |
|
6969 | + $NoTestRes = 1; |
|
6970 | + } |
|
6971 | + |
|
6972 | + // The Result of Tests |
|
6973 | + if (is_array($hpresults)) { |
|
6974 | + for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6975 | + $title = GetQuizName($hpresults[$i][0],''); |
|
6976 | + |
|
6977 | + if ($title == '') |
|
6978 | + $title = basename($hpresults[$i][0]); |
|
6979 | + |
|
6980 | + $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
6981 | + |
|
6982 | + $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; |
|
6983 | + } |
|
6984 | + } else { |
|
6985 | + $NoHPTestRes = 1; |
|
6986 | + } |
|
6987 | + |
|
6988 | + if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
6989 | + $line=get_lang('NoResult'); |
|
6990 | + } |
|
6991 | + } else { |
|
6992 | + $new_view = substr_replace($view,'1',1,1); |
|
6993 | + } |
|
6994 | + return array($title_line, $line); |
|
6995 | 6995 | } |
6996 | 6996 | |
6997 | 6997 | /** |
@@ -7000,37 +7000,37 @@ discard block |
||
7000 | 7000 | */ |
7001 | 7001 | public function display_student_publications_tracking_info($view, $user_id, $course_id) |
7002 | 7002 | { |
7003 | - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
7003 | + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
7004 | 7004 | $_course = api_get_course_info(); |
7005 | 7005 | $user_id = intval($user_id); |
7006 | 7006 | $course_id = intval($course_id); |
7007 | 7007 | |
7008 | - if (substr($view,2,1) == '1') { |
|
7009 | - $sql = "SELECT u.upload_date, w.title, w.author, w.url |
|
7008 | + if (substr($view,2,1) == '1') { |
|
7009 | + $sql = "SELECT u.upload_date, w.title, w.author, w.url |
|
7010 | 7010 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
7011 | 7011 | WHERE |
7012 | 7012 | u.upload_work_id = w.id AND |
7013 | 7013 | u.upload_user_id = '$user_id' AND |
7014 | 7014 | u.c_id = '$course_id' |
7015 | 7015 | ORDER BY u.upload_date DESC"; |
7016 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7017 | - |
|
7018 | - $title[1]=get_lang('WorksDetails'); |
|
7019 | - $line=''; |
|
7020 | - $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7021 | - |
|
7022 | - if (is_array($results)) { |
|
7023 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7024 | - $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
7025 | - $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
7026 | - $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
|
7027 | - } |
|
7028 | - |
|
7029 | - } else { |
|
7030 | - $line= get_lang('NoResult'); |
|
7031 | - } |
|
7032 | - } |
|
7033 | - return array($title_line, $line); |
|
7016 | + $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7017 | + |
|
7018 | + $title[1]=get_lang('WorksDetails'); |
|
7019 | + $line=''; |
|
7020 | + $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7021 | + |
|
7022 | + if (is_array($results)) { |
|
7023 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
7024 | + $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
7025 | + $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
7026 | + $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
|
7027 | + } |
|
7028 | + |
|
7029 | + } else { |
|
7030 | + $line= get_lang('NoResult'); |
|
7031 | + } |
|
7032 | + } |
|
7033 | + return array($title_line, $line); |
|
7034 | 7034 | } |
7035 | 7035 | |
7036 | 7036 | /** |
@@ -7039,32 +7039,32 @@ discard block |
||
7039 | 7039 | */ |
7040 | 7040 | public function display_links_tracking_info($view, $userId, $courseCode) |
7041 | 7041 | { |
7042 | - global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
7042 | + global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
7043 | 7043 | $courseId = api_get_course_int_id($courseCode); |
7044 | 7044 | $userId = intval($userId); |
7045 | 7045 | $line = null; |
7046 | - if (substr($view,3,1) == '1') { |
|
7047 | - $new_view = substr_replace($view,'0',3,1); |
|
7048 | - $title[1]=get_lang('LinksDetails'); |
|
7049 | - $sql = "SELECT cl.title, cl.url |
|
7046 | + if (substr($view,3,1) == '1') { |
|
7047 | + $new_view = substr_replace($view,'0',3,1); |
|
7048 | + $title[1]=get_lang('LinksDetails'); |
|
7049 | + $sql = "SELECT cl.title, cl.url |
|
7050 | 7050 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
7051 | 7051 | WHERE sl.links_link_id = cl.id |
7052 | 7052 | AND sl.c_id = $courseId |
7053 | 7053 | AND sl.links_user_id = $userId |
7054 | 7054 | GROUP BY cl.title, cl.url"; |
7055 | - $results = StatsUtils::getManyResults2Col($sql); |
|
7056 | - $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7057 | - if (is_array($results)) { |
|
7058 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7059 | - $line .= $results[$j][0]."\n"; |
|
7060 | - } |
|
7061 | - } else { |
|
7062 | - $line=get_lang('NoResult'); |
|
7063 | - } |
|
7064 | - } else { |
|
7065 | - $new_view = substr_replace($view,'1',3,1); |
|
7066 | - } |
|
7067 | - return array($title_line, $line); |
|
7055 | + $results = StatsUtils::getManyResults2Col($sql); |
|
7056 | + $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7057 | + if (is_array($results)) { |
|
7058 | + for ($j = 0 ; $j < count($results) ; $j++) { |
|
7059 | + $line .= $results[$j][0]."\n"; |
|
7060 | + } |
|
7061 | + } else { |
|
7062 | + $line=get_lang('NoResult'); |
|
7063 | + } |
|
7064 | + } else { |
|
7065 | + $new_view = substr_replace($view,'1',3,1); |
|
7066 | + } |
|
7067 | + return array($title_line, $line); |
|
7068 | 7068 | } |
7069 | 7069 | |
7070 | 7070 | /** |
@@ -7077,38 +7077,38 @@ discard block |
||
7077 | 7077 | */ |
7078 | 7078 | public function display_document_tracking_info($view, $user_id, $courseCode, $session_id = 0) |
7079 | 7079 | { |
7080 | - // protect data |
|
7081 | - $user_id = intval($user_id); |
|
7080 | + // protect data |
|
7081 | + $user_id = intval($user_id); |
|
7082 | 7082 | $courseId = api_get_course_int_id($courseCode); |
7083 | - $session_id = intval($session_id); |
|
7083 | + $session_id = intval($session_id); |
|
7084 | 7084 | |
7085 | - $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
7085 | + $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
7086 | 7086 | |
7087 | - if (substr($view,4,1) == '1') { |
|
7088 | - $new_view = substr_replace($view,'0',4,1); |
|
7089 | - $title[1]= get_lang('DocumentsDetails'); |
|
7087 | + if (substr($view,4,1) == '1') { |
|
7088 | + $new_view = substr_replace($view,'0',4,1); |
|
7089 | + $title[1]= get_lang('DocumentsDetails'); |
|
7090 | 7090 | |
7091 | - $sql = "SELECT down_doc_path |
|
7091 | + $sql = "SELECT down_doc_path |
|
7092 | 7092 | FROM $downloads_table |
7093 | 7093 | WHERE c_id = $courseId |
7094 | 7094 | AND down_user_id = $user_id |
7095 | 7095 | AND down_session_id = $session_id |
7096 | 7096 | GROUP BY down_doc_path"; |
7097 | 7097 | |
7098 | - $results = StatsUtils::getManyResults1Col($sql); |
|
7099 | - $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
|
7098 | + $results = StatsUtils::getManyResults1Col($sql); |
|
7099 | + $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
|
7100 | 7100 | $line = null; |
7101 | - if (is_array($results)) { |
|
7102 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7103 | - $line .= $results[$j]."\n"; |
|
7104 | - } |
|
7105 | - } else { |
|
7106 | - $line = get_lang('NoResult'); |
|
7107 | - } |
|
7108 | - } else { |
|
7109 | - $new_view = substr_replace($view,'1',4,1); |
|
7110 | - } |
|
7111 | - return array($title_line, $line); |
|
7101 | + if (is_array($results)) { |
|
7102 | + for ($j = 0 ; $j < count($results) ; $j++) { |
|
7103 | + $line .= $results[$j]."\n"; |
|
7104 | + } |
|
7105 | + } else { |
|
7106 | + $line = get_lang('NoResult'); |
|
7107 | + } |
|
7108 | + } else { |
|
7109 | + $new_view = substr_replace($view,'1',4,1); |
|
7110 | + } |
|
7111 | + return array($title_line, $line); |
|
7112 | 7112 | } |
7113 | 7113 | |
7114 | 7114 | /** |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @param string $url The URL of the site |
19 | 19 | * @param string $description The description of the site |
20 | 20 | * @param int $active is active or not |
21 | - * @return boolean if success |
|
21 | + * @return Doctrine\DBAL\Driver\Statement|null if success |
|
22 | 22 | */ |
23 | 23 | public static function add($url, $description, $active) |
24 | 24 | { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param string $url |
44 | 44 | * @param string $description The description of the site |
45 | 45 | * @param int $active is active or not |
46 | - * @return boolean if success |
|
46 | + * @return Doctrine\DBAL\Driver\Statement|null if success |
|
47 | 47 | */ |
48 | 48 | public static function update($url_id, $url, $description, $active) |
49 | 49 | { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @author Julio Montoya |
68 | 68 | * @param int $id url id |
69 | 69 | * |
70 | - * @return boolean true if success |
|
70 | + * @return Doctrine\DBAL\Driver\Statement|null true if success |
|
71 | 71 | * */ |
72 | 72 | public static function delete($id) |
73 | 73 | { |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | * @author Julio Montoya |
367 | 367 | * @param int user id |
368 | 368 | * @param int url id |
369 | - * @return boolean true if success |
|
369 | + * @return integer true if success |
|
370 | 370 | * */ |
371 | 371 | public static function relation_url_user_exist($user_id, $url_id) |
372 | 372 | { |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | * @author Julio Montoya |
385 | 385 | * @param int $courseId |
386 | 386 | * @param int $urlId |
387 | - * @return boolean true if success |
|
387 | + * @return integer true if success |
|
388 | 388 | * */ |
389 | 389 | public static function relation_url_course_exist($courseId, $urlId) |
390 | 390 | { |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * @author Julio Montoya |
406 | 406 | * @param int $userGroupId |
407 | 407 | * @param int $urlId |
408 | - * @return boolean true if success |
|
408 | + * @return integer true if success |
|
409 | 409 | * */ |
410 | 410 | public static function relationUrlUsergroupExist($userGroupId, $urlId) |
411 | 411 | { |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @author Julio Montoya |
425 | 425 | * @param int user id |
426 | 426 | * @param int url id |
427 | - * @return boolean true if success |
|
427 | + * @return integer true if success |
|
428 | 428 | * */ |
429 | 429 | public static function relation_url_session_exist($session_id, $url_id) |
430 | 430 | { |
@@ -545,6 +545,8 @@ discard block |
||
545 | 545 | * @author Julio Montoya |
546 | 546 | * @param array of course ids |
547 | 547 | * @param array of url_ids |
548 | + * @param integer[] $courseCategoryList |
|
549 | + * @param integer[] $urlList |
|
548 | 550 | * @return array |
549 | 551 | **/ |
550 | 552 | public static function addCourseCategoryListToUrl($courseCategoryList, $urlList) |
@@ -575,7 +577,7 @@ discard block |
||
575 | 577 | * @author Julio Montoya |
576 | 578 | * @param int $categoryCourseId |
577 | 579 | * @param int $urlId |
578 | - * @return boolean true if success |
|
580 | + * @return integer true if success |
|
579 | 581 | * */ |
580 | 582 | public static function relationUrlCourseCategoryExist($categoryCourseId, $urlId) |
581 | 583 | { |
@@ -592,7 +594,7 @@ discard block |
||
592 | 594 | /** |
593 | 595 | * @param int $userGroupId |
594 | 596 | * @param int $urlId |
595 | - * @return int |
|
597 | + * @return string |
|
596 | 598 | */ |
597 | 599 | public static function addUserGroupToUrl($userGroupId, $urlId) |
598 | 600 | { |
@@ -692,7 +694,7 @@ discard block |
||
692 | 694 | * @param int $courseId |
693 | 695 | * @param int $url_id |
694 | 696 | * |
695 | - * @return resource |
|
697 | + * @return boolean |
|
696 | 698 | */ |
697 | 699 | public static function add_course_to_url($courseId, $url_id = 1) |
698 | 700 | { |
@@ -763,7 +765,7 @@ discard block |
||
763 | 765 | * @param int $courseId |
764 | 766 | * @param int $urlId |
765 | 767 | * |
766 | - * @return boolean true if success |
|
768 | + * @return Doctrine\DBAL\Driver\Statement|null true if success |
|
767 | 769 | * */ |
768 | 770 | public static function delete_url_rel_course($courseId, $urlId) |
769 | 771 | { |
@@ -781,7 +783,7 @@ discard block |
||
781 | 783 | * @param int $userGroupId |
782 | 784 | * @param int $urlId |
783 | 785 | * |
784 | - * @return boolean true if success |
|
786 | + * @return Doctrine\DBAL\Driver\Statement|null true if success |
|
785 | 787 | * */ |
786 | 788 | public static function delete_url_rel_usergroup($userGroupId, $urlId) |
787 | 789 | { |
@@ -800,7 +802,7 @@ discard block |
||
800 | 802 | * @param int $userGroupId |
801 | 803 | * @param int $urlId |
802 | 804 | * |
803 | - * @return boolean true if success |
|
805 | + * @return Doctrine\DBAL\Driver\Statement|null true if success |
|
804 | 806 | * */ |
805 | 807 | public static function deleteUrlRelCourseCategory($userGroupId, $urlId) |
806 | 808 | { |
@@ -819,7 +821,7 @@ discard block |
||
819 | 821 | * @param char course code |
820 | 822 | * @param int url id |
821 | 823 | * |
822 | - * @return boolean true if success |
|
824 | + * @return Doctrine\DBAL\Driver\Statement|null true if success |
|
823 | 825 | * */ |
824 | 826 | public static function delete_url_rel_session($session_id, $url_id) |
825 | 827 | { |
@@ -11,15 +11,15 @@ discard block |
||
11 | 11 | class UrlManager |
12 | 12 | { |
13 | 13 | /** |
14 | - * Creates a new url access |
|
15 | - * |
|
16 | - * @author Julio Montoya <[email protected]>, |
|
17 | - * |
|
18 | - * @param string $url The URL of the site |
|
19 | - * @param string $description The description of the site |
|
20 | - * @param int $active is active or not |
|
21 | - * @return boolean if success |
|
22 | - */ |
|
14 | + * Creates a new url access |
|
15 | + * |
|
16 | + * @author Julio Montoya <[email protected]>, |
|
17 | + * |
|
18 | + * @param string $url The URL of the site |
|
19 | + * @param string $description The description of the site |
|
20 | + * @param int $active is active or not |
|
21 | + * @return boolean if success |
|
22 | + */ |
|
23 | 23 | public static function add($url, $description, $active) |
24 | 24 | { |
25 | 25 | $tms = time(); |
@@ -36,15 +36,15 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
39 | - * Updates an URL access |
|
40 | - * @author Julio Montoya <[email protected]>, |
|
41 | - * |
|
42 | - * @param int $url_id The url id |
|
43 | - * @param string $url |
|
44 | - * @param string $description The description of the site |
|
45 | - * @param int $active is active or not |
|
46 | - * @return boolean if success |
|
47 | - */ |
|
39 | + * Updates an URL access |
|
40 | + * @author Julio Montoya <[email protected]>, |
|
41 | + * |
|
42 | + * @param int $url_id The url id |
|
43 | + * @param string $url |
|
44 | + * @param string $description The description of the site |
|
45 | + * @param int $active is active or not |
|
46 | + * @return boolean if success |
|
47 | + */ |
|
48 | 48 | public static function update($url_id, $url, $description, $active) |
49 | 49 | { |
50 | 50 | $url_id = intval($url_id); |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
66 | - * Deletes an url |
|
67 | - * @author Julio Montoya |
|
68 | - * @param int $id url id |
|
66 | + * Deletes an url |
|
67 | + * @author Julio Montoya |
|
68 | + * @param int $id url id |
|
69 | 69 | * |
70 | - * @return boolean true if success |
|
71 | - * */ |
|
70 | + * @return boolean true if success |
|
71 | + * */ |
|
72 | 72 | public static function delete($id) |
73 | 73 | { |
74 | 74 | $id = intval($id); |
@@ -200,12 +200,12 @@ discard block |
||
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
203 | - * Gets the inner join of access_url and the course table |
|
204 | - * |
|
205 | - * @author Julio Montoya |
|
206 | - * @param int access url id |
|
207 | - * @return array Database::store_result of the result |
|
208 | - **/ |
|
203 | + * Gets the inner join of access_url and the course table |
|
204 | + * |
|
205 | + * @author Julio Montoya |
|
206 | + * @param int access url id |
|
207 | + * @return array Database::store_result of the result |
|
208 | + **/ |
|
209 | 209 | public static function get_url_rel_course_data($access_url_id = null) |
210 | 210 | { |
211 | 211 | $where = ''; |
@@ -362,12 +362,12 @@ discard block |
||
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
365 | - * Checks the relationship between an URL and a User (return the num_rows) |
|
366 | - * @author Julio Montoya |
|
367 | - * @param int user id |
|
368 | - * @param int url id |
|
369 | - * @return boolean true if success |
|
370 | - * */ |
|
365 | + * Checks the relationship between an URL and a User (return the num_rows) |
|
366 | + * @author Julio Montoya |
|
367 | + * @param int user id |
|
368 | + * @param int url id |
|
369 | + * @return boolean true if success |
|
370 | + * */ |
|
371 | 371 | public static function relation_url_user_exist($user_id, $url_id) |
372 | 372 | { |
373 | 373 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
@@ -377,15 +377,15 @@ discard block |
||
377 | 377 | $num = Database::num_rows($result); |
378 | 378 | |
379 | 379 | return $num; |
380 | - } |
|
380 | + } |
|
381 | 381 | |
382 | 382 | /** |
383 | - * Checks the relationship between an URL and a Course (return the num_rows) |
|
384 | - * @author Julio Montoya |
|
385 | - * @param int $courseId |
|
386 | - * @param int $urlId |
|
387 | - * @return boolean true if success |
|
388 | - * */ |
|
383 | + * Checks the relationship between an URL and a Course (return the num_rows) |
|
384 | + * @author Julio Montoya |
|
385 | + * @param int $courseId |
|
386 | + * @param int $urlId |
|
387 | + * @return boolean true if success |
|
388 | + * */ |
|
389 | 389 | public static function relation_url_course_exist($courseId, $urlId) |
390 | 390 | { |
391 | 391 | $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
@@ -420,12 +420,12 @@ discard block |
||
420 | 420 | } |
421 | 421 | |
422 | 422 | /** |
423 | - * Checks the relationship between an URL and a Session (return the num_rows) |
|
424 | - * @author Julio Montoya |
|
425 | - * @param int user id |
|
426 | - * @param int url id |
|
427 | - * @return boolean true if success |
|
428 | - * */ |
|
423 | + * Checks the relationship between an URL and a Session (return the num_rows) |
|
424 | + * @author Julio Montoya |
|
425 | + * @param int user id |
|
426 | + * @param int url id |
|
427 | + * @return boolean true if success |
|
428 | + * */ |
|
429 | 429 | public static function relation_url_session_exist($session_id, $url_id) |
430 | 430 | { |
431 | 431 | $table_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
@@ -737,13 +737,13 @@ discard block |
||
737 | 737 | } |
738 | 738 | |
739 | 739 | /** |
740 | - * Deletes an url and user relationship |
|
741 | - * @author Julio Montoya |
|
742 | - * @param int user id |
|
743 | - * @param int url id |
|
740 | + * Deletes an url and user relationship |
|
741 | + * @author Julio Montoya |
|
742 | + * @param int user id |
|
743 | + * @param int url id |
|
744 | 744 | * |
745 | - * @return boolean true if success |
|
746 | - * */ |
|
745 | + * @return boolean true if success |
|
746 | + * */ |
|
747 | 747 | public static function delete_url_rel_user($user_id, $url_id) |
748 | 748 | { |
749 | 749 | $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
@@ -758,13 +758,13 @@ discard block |
||
758 | 758 | } |
759 | 759 | |
760 | 760 | /** |
761 | - * Deletes an url and course relationship |
|
762 | - * @author Julio Montoya |
|
763 | - * @param int $courseId |
|
764 | - * @param int $urlId |
|
761 | + * Deletes an url and course relationship |
|
762 | + * @author Julio Montoya |
|
763 | + * @param int $courseId |
|
764 | + * @param int $urlId |
|
765 | 765 | * |
766 | - * @return boolean true if success |
|
767 | - * */ |
|
766 | + * @return boolean true if success |
|
767 | + * */ |
|
768 | 768 | public static function delete_url_rel_course($courseId, $urlId) |
769 | 769 | { |
770 | 770 | $table_url_rel_course= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
@@ -814,13 +814,13 @@ discard block |
||
814 | 814 | } |
815 | 815 | |
816 | 816 | /** |
817 | - * Deletes an url and session relationship |
|
818 | - * @author Julio Montoya |
|
819 | - * @param char course code |
|
820 | - * @param int url id |
|
817 | + * Deletes an url and session relationship |
|
818 | + * @author Julio Montoya |
|
819 | + * @param char course code |
|
820 | + * @param int url id |
|
821 | 821 | * |
822 | - * @return boolean true if success |
|
823 | - * */ |
|
822 | + * @return boolean true if success |
|
823 | + * */ |
|
824 | 824 | public static function delete_url_rel_session($session_id, $url_id) |
825 | 825 | { |
826 | 826 | $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public static function add($url, $description, $active) |
24 | 24 | { |
25 | 25 | $tms = time(); |
26 | - $table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
26 | + $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
27 | 27 | $sql = "INSERT INTO $table |
28 | 28 | SET url = '".Database::escape_string($url)."', |
29 | 29 | description = '".Database::escape_string($description)."', |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | $id = intval($id); |
75 | 75 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
76 | - $sql= "DELETE FROM $table WHERE id = ".$id; |
|
76 | + $sql = "DELETE FROM $table WHERE id = ".$id; |
|
77 | 77 | $result = Database::query($sql); |
78 | 78 | |
79 | 79 | return $result; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public static function url_exist($url) |
88 | 88 | { |
89 | - $table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
89 | + $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
90 | 90 | $sql = "SELECT id FROM $table |
91 | 91 | WHERE url = '".Database::escape_string($url)."' "; |
92 | 92 | $res = Database::query($sql); |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | * */ |
121 | 121 | public static function url_count() |
122 | 122 | { |
123 | - $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
123 | + $table_access_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
124 | 124 | $sql = "SELECT count(id) as count_result FROM $table_access_url"; |
125 | 125 | $res = Database::query($sql); |
126 | - $url = Database::fetch_array($res,'ASSOC'); |
|
126 | + $url = Database::fetch_array($res, 'ASSOC'); |
|
127 | 127 | $result = $url['count_result']; |
128 | 128 | |
129 | 129 | return $result; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | FROM $table |
142 | 142 | ORDER BY id"; |
143 | 143 | $res = Database::query($sql); |
144 | - $urls = array (); |
|
144 | + $urls = array(); |
|
145 | 145 | while ($url = Database::fetch_array($res)) { |
146 | 146 | $urls[] = $url; |
147 | 147 | } |
@@ -258,12 +258,12 @@ discard block |
||
258 | 258 | **/ |
259 | 259 | public static function get_url_rel_session_data($access_url_id = null) |
260 | 260 | { |
261 | - $where =''; |
|
261 | + $where = ''; |
|
262 | 262 | $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
263 | 263 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
264 | 264 | |
265 | 265 | if (!empty($access_url_id)) |
266 | - $where ="WHERE $table_url_rel_session.access_url_id = ".intval($access_url_id); |
|
266 | + $where = "WHERE $table_url_rel_session.access_url_id = ".intval($access_url_id); |
|
267 | 267 | |
268 | 268 | $sql = "SELECT id, name, access_url_id |
269 | 269 | FROM $tbl_session u |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $table_user_group = Database::get_main_table(TABLE_USERGROUP); |
294 | 294 | |
295 | 295 | if (!empty($access_url_id)) { |
296 | - $where ="WHERE $table_url_rel_usergroup.access_url_id = ".intval($access_url_id); |
|
296 | + $where = "WHERE $table_url_rel_usergroup.access_url_id = ".intval($access_url_id); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | $sql = "SELECT id, name, access_url_id |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | public static function relation_url_user_exist($user_id, $url_id) |
372 | 372 | { |
373 | 373 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
374 | - $sql= "SELECT user_id FROM $table |
|
374 | + $sql = "SELECT user_id FROM $table |
|
375 | 375 | WHERE access_url_id = ".intval($url_id)." AND user_id = ".intval($user_id)." "; |
376 | 376 | $result = Database::query($sql); |
377 | 377 | $num = Database::num_rows($result); |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | public static function relation_url_course_exist($courseId, $urlId) |
390 | 390 | { |
391 | 391 | $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
392 | - $sql= "SELECT c_id FROM $table_url_rel_course |
|
392 | + $sql = "SELECT c_id FROM $table_url_rel_course |
|
393 | 393 | WHERE |
394 | 394 | access_url_id = ".intval($urlId)." AND |
395 | 395 | c_id = '".intval($courseId)."'"; |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | public static function relationUrlUsergroupExist($userGroupId, $urlId) |
411 | 411 | { |
412 | 412 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP); |
413 | - $sql= "SELECT usergroup_id FROM $table |
|
413 | + $sql = "SELECT usergroup_id FROM $table |
|
414 | 414 | WHERE access_url_id = ".intval($urlId)." AND |
415 | 415 | usergroup_id = ".intval($userGroupId); |
416 | 416 | $result = Database::query($sql); |
@@ -428,9 +428,9 @@ discard block |
||
428 | 428 | * */ |
429 | 429 | public static function relation_url_session_exist($session_id, $url_id) |
430 | 430 | { |
431 | - $table_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
431 | + $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
432 | 432 | $session_id = intval($session_id); |
433 | - $url_id = intval($url_id); |
|
433 | + $url_id = intval($url_id); |
|
434 | 434 | $sql = "SELECT session_id FROM $table_url_rel_session |
435 | 435 | WHERE |
436 | 436 | access_url_id = ".intval($url_id)." AND |
@@ -453,11 +453,11 @@ discard block |
||
453 | 453 | $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
454 | 454 | $result_array = array(); |
455 | 455 | |
456 | - if (is_array($user_list) && is_array($url_list)){ |
|
456 | + if (is_array($user_list) && is_array($url_list)) { |
|
457 | 457 | foreach ($url_list as $url_id) { |
458 | 458 | foreach ($user_list as $user_id) { |
459 | - $count = UrlManager::relation_url_user_exist($user_id,$url_id); |
|
460 | - if ($count==0) { |
|
459 | + $count = UrlManager::relation_url_user_exist($user_id, $url_id); |
|
460 | + if ($count == 0) { |
|
461 | 461 | $sql = "INSERT INTO $table_url_rel_user |
462 | 462 | SET user_id = ".intval($user_id).", access_url_id = ".intval($url_id); |
463 | 463 | $result = Database::query($sql); |
@@ -482,19 +482,19 @@ discard block |
||
482 | 482 | * @param array of url_ids |
483 | 483 | * @return array |
484 | 484 | **/ |
485 | - public static function add_courses_to_urls($course_list,$url_list) |
|
485 | + public static function add_courses_to_urls($course_list, $url_list) |
|
486 | 486 | { |
487 | 487 | $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
488 | 488 | $result_array = array(); |
489 | 489 | |
490 | - if (is_array($course_list) && is_array($url_list)){ |
|
490 | + if (is_array($course_list) && is_array($url_list)) { |
|
491 | 491 | foreach ($url_list as $url_id) { |
492 | 492 | foreach ($course_list as $course_code) { |
493 | 493 | $courseInfo = api_get_course_info($course_code); |
494 | 494 | $courseId = $courseInfo['real_id']; |
495 | 495 | |
496 | 496 | $count = self::relation_url_course_exist($courseId, $url_id); |
497 | - if ($count==0) { |
|
497 | + if ($count == 0) { |
|
498 | 498 | $sql = "INSERT INTO $table_url_rel_course |
499 | 499 | SET c_id = '".$courseId."', access_url_id = ".intval($url_id); |
500 | 500 | $result = Database::query($sql); |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | public static function relationUrlCourseCategoryExist($categoryCourseId, $urlId) |
581 | 581 | { |
582 | 582 | $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY); |
583 | - $sql= "SELECT course_category_id FROM $table |
|
583 | + $sql = "SELECT course_category_id FROM $table |
|
584 | 584 | WHERE access_url_id = ".intval($urlId)." AND |
585 | 585 | course_category_id = ".intval($categoryCourseId); |
586 | 586 | $result = Database::query($sql); |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
750 | 750 | $result = true; |
751 | 751 | if (!empty($user_id) && !empty($url_id)) { |
752 | - $sql= "DELETE FROM $table_url_rel_user |
|
752 | + $sql = "DELETE FROM $table_url_rel_user |
|
753 | 753 | WHERE user_id = ".intval($user_id)." AND access_url_id = ".intval($url_id); |
754 | 754 | $result = Database::query($sql); |
755 | 755 | } |
@@ -767,8 +767,8 @@ discard block |
||
767 | 767 | * */ |
768 | 768 | public static function delete_url_rel_course($courseId, $urlId) |
769 | 769 | { |
770 | - $table_url_rel_course= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
771 | - $sql= "DELETE FROM $table_url_rel_course |
|
770 | + $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
771 | + $sql = "DELETE FROM $table_url_rel_course |
|
772 | 772 | WHERE c_id = '".intval($courseId)."' AND access_url_id=".intval($urlId)." "; |
773 | 773 | $result = Database::query($sql); |
774 | 774 | |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | public static function delete_url_rel_usergroup($userGroupId, $urlId) |
787 | 787 | { |
788 | 788 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP); |
789 | - $sql= "DELETE FROM $table |
|
789 | + $sql = "DELETE FROM $table |
|
790 | 790 | WHERE usergroup_id = '".intval($userGroupId)."' AND |
791 | 791 | access_url_id=".intval($urlId)." "; |
792 | 792 | $result = Database::query($sql); |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | public static function deleteUrlRelCourseCategory($userGroupId, $urlId) |
806 | 806 | { |
807 | 807 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY); |
808 | - $sql= "DELETE FROM $table |
|
808 | + $sql = "DELETE FROM $table |
|
809 | 809 | WHERE course_category_id = '".intval($userGroupId)."' AND |
810 | 810 | access_url_id=".intval($urlId)." "; |
811 | 811 | $result = Database::query($sql); |
@@ -824,9 +824,9 @@ discard block |
||
824 | 824 | public static function delete_url_rel_session($session_id, $url_id) |
825 | 825 | { |
826 | 826 | $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
827 | - $sql= "DELETE FROM $table_url_rel_session |
|
827 | + $sql = "DELETE FROM $table_url_rel_session |
|
828 | 828 | WHERE session_id = ".intval($session_id)." AND access_url_id=".intval($url_id)." "; |
829 | - $result = Database::query($sql,'ASSOC'); |
|
829 | + $result = Database::query($sql, 'ASSOC'); |
|
830 | 830 | |
831 | 831 | return $result; |
832 | 832 | } |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | * */ |
840 | 840 | public static function update_urls_rel_user($user_list, $access_url_id) |
841 | 841 | { |
842 | - $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
842 | + $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
843 | 843 | $sql = "SELECT user_id FROM $table_url_rel_user WHERE access_url_id = ".intval($access_url_id); |
844 | 844 | $result = Database::query($sql); |
845 | 845 | $existing_users = array(); |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | $result = Database::query($sql); |
894 | 894 | |
895 | 895 | $existing_courses = array(); |
896 | - while ($row = Database::fetch_array($result)){ |
|
896 | + while ($row = Database::fetch_array($result)) { |
|
897 | 897 | $existing_courses[] = $row['c_id']; |
898 | 898 | } |
899 | 899 | |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | $result = Database::query($sql); |
927 | 927 | $existingItems = array(); |
928 | 928 | |
929 | - while ($row = Database::fetch_array($result)){ |
|
929 | + while ($row = Database::fetch_array($result)) { |
|
930 | 930 | $existingItems[] = $row['usergroup_id']; |
931 | 931 | } |
932 | 932 | |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | $result = Database::query($sql); |
960 | 960 | $existingItems = array(); |
961 | 961 | |
962 | - while ($row = Database::fetch_array($result)){ |
|
962 | + while ($row = Database::fetch_array($result)) { |
|
963 | 963 | $existingItems[] = $row['course_category_id']; |
964 | 964 | } |
965 | 965 | |
@@ -1000,15 +1000,15 @@ discard block |
||
1000 | 1000 | * @param array user list |
1001 | 1001 | * @param int access_url_id |
1002 | 1002 | * */ |
1003 | - public static function update_urls_rel_session($session_list,$access_url_id) |
|
1003 | + public static function update_urls_rel_session($session_list, $access_url_id) |
|
1004 | 1004 | { |
1005 | - $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
1005 | + $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
1006 | 1006 | |
1007 | 1007 | $sql = "SELECT session_id FROM $table_url_rel_session WHERE access_url_id=".intval($access_url_id); |
1008 | 1008 | $result = Database::query($sql); |
1009 | 1009 | $existing_sessions = array(); |
1010 | 1010 | |
1011 | - while ($row = Database::fetch_array($result)){ |
|
1011 | + while ($row = Database::fetch_array($result)) { |
|
1012 | 1012 | $existing_sessions[] = $row['session_id']; |
1013 | 1013 | } |
1014 | 1014 | |
@@ -1037,13 +1037,13 @@ discard block |
||
1037 | 1037 | */ |
1038 | 1038 | public static function get_access_url_from_user($user_id) |
1039 | 1039 | { |
1040 | - $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
1041 | - $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
1040 | + $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
1041 | + $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
1042 | 1042 | $sql = "SELECT url, access_url_id FROM $table_url_rel_user url_rel_user INNER JOIN $table_url u |
1043 | 1043 | ON (url_rel_user.access_url_id = u.id) |
1044 | 1044 | WHERE user_id = ".intval($user_id); |
1045 | 1045 | $result = Database::query($sql); |
1046 | - $url_list = Database::store_result($result,'ASSOC'); |
|
1046 | + $url_list = Database::store_result($result, 'ASSOC'); |
|
1047 | 1047 | return $url_list; |
1048 | 1048 | } |
1049 | 1049 | |
@@ -1053,14 +1053,14 @@ discard block |
||
1053 | 1053 | */ |
1054 | 1054 | public static function get_access_url_from_course($courseId) |
1055 | 1055 | { |
1056 | - $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
1057 | - $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
1056 | + $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
1057 | + $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
1058 | 1058 | $sql = "SELECT url, access_url_id FROM $table c INNER JOIN $table_url u |
1059 | 1059 | ON (c.access_url_id = u.id) |
1060 | 1060 | WHERE c_id = ".intval($courseId); |
1061 | 1061 | |
1062 | 1062 | $result = Database::query($sql); |
1063 | - $url_list = Database::store_result($result,'ASSOC'); |
|
1063 | + $url_list = Database::store_result($result, 'ASSOC'); |
|
1064 | 1064 | return $url_list; |
1065 | 1065 | } |
1066 | 1066 | |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | public static function get_access_url_from_session($session_id) |
1072 | 1072 | { |
1073 | 1073 | $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
1074 | - $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
1074 | + $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
1075 | 1075 | $sql = "SELECT url, access_url_id FROM $table_url_rel_session url_rel_session INNER JOIN $table_url u |
1076 | 1076 | ON (url_rel_session.access_url_id = u.id) |
1077 | 1077 | WHERE session_id = ".intval($session_id); |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | */ |
1088 | 1088 | public static function get_url_id($url) |
1089 | 1089 | { |
1090 | - $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
1090 | + $table_access_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
1091 | 1091 | $sql = "SELECT id FROM $table_access_url WHERE url = '".Database::escape_string($url)."'"; |
1092 | 1092 | $result = Database::query($sql); |
1093 | 1093 | $access_url_id = Database::result($result, 0, 0); |
@@ -262,8 +262,9 @@ |
||
262 | 262 | $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
263 | 263 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
264 | 264 | |
265 | - if (!empty($access_url_id)) |
|
266 | - $where ="WHERE $table_url_rel_session.access_url_id = ".intval($access_url_id); |
|
265 | + if (!empty($access_url_id)) { |
|
266 | + $where ="WHERE $table_url_rel_session.access_url_id = ".intval($access_url_id); |
|
267 | + } |
|
267 | 268 | |
268 | 269 | $sql = "SELECT id, name, access_url_id |
269 | 270 | FROM $tbl_session u |