@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
81 | 81 | $sql = "SELECT * FROM $table_class_user cu, $table_user u WHERE cu.class_id = '".$class_id."' AND cu.user_id = u.user_id"; |
82 | 82 | $res = Database::query($sql); |
83 | - $users = array (); |
|
83 | + $users = array(); |
|
84 | 84 | while ($user = Database::fetch_array($res, 'ASSOC')) { |
85 | 85 | $users[] = $user; |
86 | 86 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $table_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS); |
118 | 118 | $courses = ClassManager :: get_courses($class_id); |
119 | 119 | if (count($courses) != 0) { |
120 | - $course_codes = array (); |
|
120 | + $course_codes = array(); |
|
121 | 121 | foreach ($courses as $index => $course) { |
122 | 122 | $course_codes[] = $course['course_code']; |
123 | 123 | $sql = "SELECT DISTINCT user_id FROM $table_class_user t1, $table_course_class t2 WHERE t1.class_id=t2.class_id AND course_code = '".$course['course_code']."' AND user_id = $user_id AND t2.class_id<>'$class_id'"; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $table_course = Database :: get_main_table(TABLE_MAIN_COURSE); |
143 | 143 | $sql = "SELECT * FROM $table_class_course cc, $table_course c WHERE cc.class_id = '".$class_id."' AND cc.course_code = c.code"; |
144 | 144 | $res = Database::query($sql); |
145 | - $courses = array (); |
|
145 | + $courses = array(); |
|
146 | 146 | while ($course = Database::fetch_array($res, 'ASSOC')) { |
147 | 147 | $courses[] = $course; |
148 | 148 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $table_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS); |
218 | 218 | $sql = "SELECT cl.* FROM $table_class cl, $table_course_class cc WHERE cc.course_code = '".Database::escape_string($course_code)."' AND cc.class_id = cl.id"; |
219 | 219 | $res = Database::query($sql); |
220 | - $classes = array (); |
|
220 | + $classes = array(); |
|
221 | 221 | while ($class = Database::fetch_array($res, 'ASSOC')) { |
222 | 222 | $classes[] = $class; |
223 | 223 | } |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * @return string |
98 | 98 | */ |
99 | 99 | function kses($string, $allowed_html, $allowed_protocols = |
100 | - array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', |
|
101 | - 'gopher', 'mailto')) |
|
100 | + array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', |
|
101 | + 'gopher', 'mailto')) |
|
102 | 102 | { |
103 | 103 | $string = kses_no_null($string); |
104 | 104 | $string = kses_js_entities($string); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | // No attributes are allowed for closing elements |
219 | 219 | |
220 | 220 | return kses_attr("$slash$elem", $attrlist, $allowed_html, |
221 | - $allowed_protocols); |
|
221 | + $allowed_protocols); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | foreach ($attrarr as $arreach) |
262 | 262 | { |
263 | 263 | if (!@isset($allowed_html[strtolower($element)] |
264 | - [strtolower($arreach['name'])])) |
|
264 | + [strtolower($arreach['name'])])) |
|
265 | 265 | continue; // the attribute is not allowed |
266 | 266 | |
267 | 267 | $current = $allowed_html[strtolower($element)] |
268 | - [strtolower($arreach['name'])]; |
|
268 | + [strtolower($arreach['name'])]; |
|
269 | 269 | if ($current == '') |
270 | 270 | continue; // the attribute is not allowed |
271 | 271 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $ok = true; |
280 | 280 | foreach ($current as $currkey => $currval) |
281 | 281 | if (!kses_check_attr_val($arreach['value'], $arreach['vless'], |
282 | - $currkey, $currval)) |
|
282 | + $currkey, $currval)) |
|
283 | 283 | { $ok = false; break; } |
284 | 284 | |
285 | 285 | if ( strtolower($arreach['name']) == 'style' ) { |
@@ -35,47 +35,47 @@ discard block |
||
35 | 35 | */ |
36 | 36 | |
37 | 37 | $kses_allowedentitynames = array( |
38 | - 'nbsp', 'iexcl', 'cent', 'pound', 'curren', 'yen', |
|
39 | - 'brvbar', 'sect', 'uml', 'copy', 'ordf', 'laquo', |
|
40 | - 'not', 'shy', 'reg', 'macr', 'deg', 'plusmn', |
|
41 | - 'acute', 'micro', 'para', 'middot', 'cedil', 'ordm', |
|
42 | - 'raquo', 'iquest', 'Agrave', 'Aacute', 'Acirc', 'Atilde', |
|
43 | - 'Auml', 'Aring', 'AElig', 'Ccedil', 'Egrave', 'Eacute', |
|
44 | - 'Ecirc', 'Euml', 'Igrave', 'Iacute', 'Icirc', 'Iuml', |
|
45 | - 'ETH', 'Ntilde', 'Ograve', 'Oacute', 'Ocirc', 'Otilde', |
|
46 | - 'Ouml', 'times', 'Oslash', 'Ugrave', 'Uacute', 'Ucirc', |
|
47 | - 'Uuml', 'Yacute', 'THORN', 'szlig', 'agrave', 'aacute', |
|
48 | - 'acirc', 'atilde', 'auml', 'aring', 'aelig', 'ccedil', |
|
49 | - 'egrave', 'eacute', 'ecirc', 'euml', 'igrave', 'iacute', |
|
50 | - 'icirc', 'iuml', 'eth', 'ntilde', 'ograve', 'oacute', |
|
51 | - 'ocirc', 'otilde', 'ouml', 'divide', 'oslash', 'ugrave', |
|
52 | - 'uacute', 'ucirc', 'uuml', 'yacute', 'thorn', 'yuml', |
|
53 | - 'quot', 'amp', 'lt', 'gt', 'apos', 'OElig', |
|
54 | - 'oelig', 'Scaron', 'scaron', 'Yuml', 'circ', 'tilde', |
|
55 | - 'ensp', 'emsp', 'thinsp', 'zwnj', 'zwj', 'lrm', |
|
56 | - 'rlm', 'ndash', 'mdash', 'lsquo', 'rsquo', 'sbquo', |
|
57 | - 'ldquo', 'rdquo', 'bdquo', 'dagger', 'Dagger', 'permil', |
|
58 | - 'lsaquo', 'rsaquo', 'euro', 'fnof', 'Alpha', 'Beta', |
|
59 | - 'Gamma', 'Delta', 'Epsilon', 'Zeta', 'Eta', 'Theta', |
|
60 | - 'Iota', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Xi', |
|
61 | - 'Omicron', 'Pi', 'Rho', 'Sigma', 'Tau', 'Upsilon', |
|
62 | - 'Phi', 'Chi', 'Psi', 'Omega', 'alpha', 'beta', |
|
63 | - 'gamma', 'delta', 'epsilon', 'zeta', 'eta', 'theta', |
|
64 | - 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', |
|
65 | - 'omicron', 'pi', 'rho', 'sigmaf', 'sigma', 'tau', |
|
66 | - 'upsilon', 'phi', 'chi', 'psi', 'omega', 'thetasym', |
|
67 | - 'upsih', 'piv', 'bull', 'hellip', 'prime', 'Prime', |
|
68 | - 'oline', 'frasl', 'weierp', 'image', 'real', 'trade', |
|
69 | - 'alefsym', 'larr', 'uarr', 'rarr', 'darr', 'harr', |
|
70 | - 'crarr', 'lArr', 'uArr', 'rArr', 'dArr', 'hArr', |
|
71 | - 'forall', 'part', 'exist', 'empty', 'nabla', 'isin', |
|
72 | - 'notin', 'ni', 'prod', 'sum', 'minus', 'lowast', |
|
73 | - 'radic', 'prop', 'infin', 'ang', 'and', 'or', |
|
74 | - 'cap', 'cup', 'int', 'sim', 'cong', 'asymp', |
|
75 | - 'ne', 'equiv', 'le', 'ge', 'sub', 'sup', |
|
76 | - 'nsub', 'sube', 'supe', 'oplus', 'otimes', 'perp', |
|
77 | - 'sdot', 'lceil', 'rceil', 'lfloor', 'rfloor', 'lang', |
|
78 | - 'rang', 'loz', 'spades', 'clubs', 'hearts', 'diams', |
|
38 | + 'nbsp', 'iexcl', 'cent', 'pound', 'curren', 'yen', |
|
39 | + 'brvbar', 'sect', 'uml', 'copy', 'ordf', 'laquo', |
|
40 | + 'not', 'shy', 'reg', 'macr', 'deg', 'plusmn', |
|
41 | + 'acute', 'micro', 'para', 'middot', 'cedil', 'ordm', |
|
42 | + 'raquo', 'iquest', 'Agrave', 'Aacute', 'Acirc', 'Atilde', |
|
43 | + 'Auml', 'Aring', 'AElig', 'Ccedil', 'Egrave', 'Eacute', |
|
44 | + 'Ecirc', 'Euml', 'Igrave', 'Iacute', 'Icirc', 'Iuml', |
|
45 | + 'ETH', 'Ntilde', 'Ograve', 'Oacute', 'Ocirc', 'Otilde', |
|
46 | + 'Ouml', 'times', 'Oslash', 'Ugrave', 'Uacute', 'Ucirc', |
|
47 | + 'Uuml', 'Yacute', 'THORN', 'szlig', 'agrave', 'aacute', |
|
48 | + 'acirc', 'atilde', 'auml', 'aring', 'aelig', 'ccedil', |
|
49 | + 'egrave', 'eacute', 'ecirc', 'euml', 'igrave', 'iacute', |
|
50 | + 'icirc', 'iuml', 'eth', 'ntilde', 'ograve', 'oacute', |
|
51 | + 'ocirc', 'otilde', 'ouml', 'divide', 'oslash', 'ugrave', |
|
52 | + 'uacute', 'ucirc', 'uuml', 'yacute', 'thorn', 'yuml', |
|
53 | + 'quot', 'amp', 'lt', 'gt', 'apos', 'OElig', |
|
54 | + 'oelig', 'Scaron', 'scaron', 'Yuml', 'circ', 'tilde', |
|
55 | + 'ensp', 'emsp', 'thinsp', 'zwnj', 'zwj', 'lrm', |
|
56 | + 'rlm', 'ndash', 'mdash', 'lsquo', 'rsquo', 'sbquo', |
|
57 | + 'ldquo', 'rdquo', 'bdquo', 'dagger', 'Dagger', 'permil', |
|
58 | + 'lsaquo', 'rsaquo', 'euro', 'fnof', 'Alpha', 'Beta', |
|
59 | + 'Gamma', 'Delta', 'Epsilon', 'Zeta', 'Eta', 'Theta', |
|
60 | + 'Iota', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Xi', |
|
61 | + 'Omicron', 'Pi', 'Rho', 'Sigma', 'Tau', 'Upsilon', |
|
62 | + 'Phi', 'Chi', 'Psi', 'Omega', 'alpha', 'beta', |
|
63 | + 'gamma', 'delta', 'epsilon', 'zeta', 'eta', 'theta', |
|
64 | + 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', |
|
65 | + 'omicron', 'pi', 'rho', 'sigmaf', 'sigma', 'tau', |
|
66 | + 'upsilon', 'phi', 'chi', 'psi', 'omega', 'thetasym', |
|
67 | + 'upsih', 'piv', 'bull', 'hellip', 'prime', 'Prime', |
|
68 | + 'oline', 'frasl', 'weierp', 'image', 'real', 'trade', |
|
69 | + 'alefsym', 'larr', 'uarr', 'rarr', 'darr', 'harr', |
|
70 | + 'crarr', 'lArr', 'uArr', 'rArr', 'dArr', 'hArr', |
|
71 | + 'forall', 'part', 'exist', 'empty', 'nabla', 'isin', |
|
72 | + 'notin', 'ni', 'prod', 'sum', 'minus', 'lowast', |
|
73 | + 'radic', 'prop', 'infin', 'ang', 'and', 'or', |
|
74 | + 'cap', 'cup', 'int', 'sim', 'cong', 'asymp', |
|
75 | + 'ne', 'equiv', 'le', 'ge', 'sub', 'sup', |
|
76 | + 'nsub', 'sube', 'supe', 'oplus', 'otimes', 'perp', |
|
77 | + 'sdot', 'lceil', 'rceil', 'lfloor', 'rfloor', 'lang', |
|
78 | + 'rang', 'loz', 'spades', 'clubs', 'hearts', 'diams', |
|
79 | 79 | ); |
80 | 80 | |
81 | 81 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | global $pass_allowed_html, $pass_allowed_protocols; |
146 | 146 | $pass_allowed_html = $allowed_html; |
147 | 147 | $pass_allowed_protocols = $allowed_protocols; |
148 | - return preg_replace_callback( '%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%', '_kses_split_callback', $string ); |
|
148 | + return preg_replace_callback('%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%', '_kses_split_callback', $string); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | * |
154 | 154 | * @access private |
155 | 155 | */ |
156 | -function _kses_split_callback( $match ) |
|
156 | +function _kses_split_callback($match) |
|
157 | 157 | { |
158 | 158 | global $pass_allowed_html, $pass_allowed_protocols; |
159 | - return kses_split2( $match[1], $pass_allowed_html, $pass_allowed_protocols ); |
|
159 | + return kses_split2($match[1], $pass_allowed_html, $pass_allowed_protocols); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -189,9 +189,9 @@ discard block |
||
189 | 189 | |
190 | 190 | if (preg_match('%^<!--(.*?)(-->)?$%', $string, $matches)) { |
191 | 191 | $string = str_replace(array('<!--', '-->'), '', $matches[1]); |
192 | - while ( $string != $newstring = kses($string, $allowed_html, $allowed_protocols) ) |
|
192 | + while ($string != $newstring = kses($string, $allowed_html, $allowed_protocols)) |
|
193 | 193 | $string = $newstring; |
194 | - if ( $string == '' ) |
|
194 | + if ($string == '') |
|
195 | 195 | return ''; |
196 | 196 | // prevent multiple dashes in comments |
197 | 197 | $string = preg_replace('/--+/', '-', $string); |
@@ -282,12 +282,12 @@ discard block |
||
282 | 282 | $currkey, $currval)) |
283 | 283 | { $ok = false; break; } |
284 | 284 | |
285 | - if ( strtolower($arreach['name']) == 'style' ) { |
|
285 | + if (strtolower($arreach['name']) == 'style') { |
|
286 | 286 | $orig_value = $arreach['value']; |
287 | 287 | |
288 | 288 | $value = kses_safecss_filter_attr($orig_value); |
289 | 289 | |
290 | - if ( empty($value) ) |
|
290 | + if (empty($value)) |
|
291 | 291 | continue; |
292 | 292 | |
293 | 293 | $arreach['value'] = $value; |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | if (preg_match('/^\s+/', $attr)) // valueless |
362 | 362 | { |
363 | 363 | $working = 1; $mode = 0; |
364 | - if(FALSE === array_key_exists($attrname, $attrarr)) { |
|
365 | - $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); |
|
364 | + if (FALSE === array_key_exists($attrname, $attrarr)) { |
|
365 | + $attrarr[$attrname] = array('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); |
|
366 | 366 | } |
367 | 367 | $attr = preg_replace('/^\s+/', '', $attr); |
368 | 368 | } |
@@ -379,12 +379,12 @@ discard block |
||
379 | 379 | $thisval = $match[1]; |
380 | 380 | } else { |
381 | 381 | $thisval = $match[1]; |
382 | - if ( in_array(strtolower($attrname), $uris) ) |
|
382 | + if (in_array(strtolower($attrname), $uris)) |
|
383 | 383 | $thisval = kses_bad_protocol($thisval, $allowed_protocols); |
384 | 384 | } |
385 | 385 | |
386 | - if(FALSE === array_key_exists($attrname, $attrarr)) { |
|
387 | - $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); |
|
386 | + if (FALSE === array_key_exists($attrname, $attrarr)) { |
|
387 | + $attrarr[$attrname] = array('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); |
|
388 | 388 | } |
389 | 389 | $working = 1; $mode = 0; |
390 | 390 | $attr = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr); |
@@ -395,11 +395,11 @@ discard block |
||
395 | 395 | // 'value' |
396 | 396 | { |
397 | 397 | $thisval = $match[1]; |
398 | - if ( in_array(strtolower($attrname), $uris) ) |
|
398 | + if (in_array(strtolower($attrname), $uris)) |
|
399 | 399 | $thisval = kses_bad_protocol($thisval, $allowed_protocols); |
400 | 400 | |
401 | - if(FALSE === array_key_exists($attrname, $attrarr)) { |
|
402 | - $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n'); |
|
401 | + if (FALSE === array_key_exists($attrname, $attrarr)) { |
|
402 | + $attrarr[$attrname] = array('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n'); |
|
403 | 403 | } |
404 | 404 | $working = 1; $mode = 0; |
405 | 405 | $attr = preg_replace("/^'[^']*'(\s+|$)/", '', $attr); |
@@ -410,11 +410,11 @@ discard block |
||
410 | 410 | // value |
411 | 411 | { |
412 | 412 | $thisval = $match[1]; |
413 | - if ( in_array(strtolower($attrname), $uris) ) |
|
413 | + if (in_array(strtolower($attrname), $uris)) |
|
414 | 414 | $thisval = kses_bad_protocol($thisval, $allowed_protocols); |
415 | 415 | |
416 | - if(FALSE === array_key_exists($attrname, $attrarr)) { |
|
417 | - $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); |
|
416 | + if (FALSE === array_key_exists($attrname, $attrarr)) { |
|
417 | + $attrarr[$attrname] = array('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); |
|
418 | 418 | } |
419 | 419 | // We add quotes to conform to W3C's HTML spec. |
420 | 420 | $working = 1; $mode = 0; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | if ($mode == 1 && FALSE === array_key_exists($attrname, $attrarr)) |
435 | 435 | // special case, for when the attribute list ends with a valueless |
436 | 436 | // attribute like "selected" |
437 | - $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); |
|
437 | + $attrarr[$attrname] = array('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); |
|
438 | 438 | |
439 | 439 | return $attrarr; |
440 | 440 | } |
@@ -579,12 +579,12 @@ discard block |
||
579 | 579 | { |
580 | 580 | $outarray = array(); |
581 | 581 | |
582 | - foreach ( (array) $inarray as $inkey => $inval) |
|
582 | + foreach ((array) $inarray as $inkey => $inval) |
|
583 | 583 | { |
584 | 584 | $outkey = strtolower($inkey); |
585 | 585 | $outarray[$outkey] = array(); |
586 | 586 | |
587 | - foreach ( (array) $inval as $inkey2 => $inval2) |
|
587 | + foreach ((array) $inval as $inkey2 => $inval2) |
|
588 | 588 | { |
589 | 589 | $outkey2 = strtolower($inkey2); |
590 | 590 | $outarray[$outkey][$outkey2] = $inval2; |
@@ -632,9 +632,9 @@ discard block |
||
632 | 632 | function kses_bad_protocol_once($string, $allowed_protocols) |
633 | 633 | { |
634 | 634 | $string2 = preg_split('/:|�*58;|�*3a;/i', $string, 2); |
635 | - if(isset($string2[1]) && !preg_match('%/\?%',$string2[0])) |
|
635 | + if (isset($string2[1]) && !preg_match('%/\?%', $string2[0])) |
|
636 | 636 | { |
637 | - $string = kses_bad_protocol_once2($string2[0],$allowed_protocols).trim($string2[1]); |
|
637 | + $string = kses_bad_protocol_once2($string2[0], $allowed_protocols).trim($string2[1]); |
|
638 | 638 | } |
639 | 639 | return $string; |
640 | 640 | } |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | $string2 = strtolower($string2); |
661 | 661 | |
662 | 662 | $allowed = false; |
663 | - foreach ( (array) $allowed_protocols as $one_protocol) |
|
663 | + foreach ((array) $allowed_protocols as $one_protocol) |
|
664 | 664 | if (strtolower($one_protocol) == $string2) |
665 | 665 | { |
666 | 666 | $allowed = true; |
@@ -711,11 +711,11 @@ discard block |
||
711 | 711 | function kses_named_entities($matches) { |
712 | 712 | global $kses_allowedentitynames; |
713 | 713 | |
714 | - if ( empty($matches[1]) ) |
|
714 | + if (empty($matches[1])) |
|
715 | 715 | return ''; |
716 | 716 | |
717 | 717 | $i = $matches[1]; |
718 | - return ( ( ! in_array($i, $kses_allowedentitynames) ) ? "&$i;" : "&$i;" ); |
|
718 | + return ((!in_array($i, $kses_allowedentitynames)) ? "&$i;" : "&$i;"); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | /** |
@@ -730,12 +730,12 @@ discard block |
||
730 | 730 | * @return string Correctly encoded entity |
731 | 731 | */ |
732 | 732 | function kses_normalize_entities2($matches) { |
733 | - if ( empty($matches[1]) ) |
|
733 | + if (empty($matches[1])) |
|
734 | 734 | return ''; |
735 | 735 | |
736 | 736 | $i = $matches[1]; |
737 | 737 | if (kses_valid_unicode($i)) { |
738 | - $i = str_pad(ltrim($i,'0'), 3, '0', STR_PAD_LEFT); |
|
738 | + $i = str_pad(ltrim($i, '0'), 3, '0', STR_PAD_LEFT); |
|
739 | 739 | $i = "&#$i;"; |
740 | 740 | } else { |
741 | 741 | $i = "&#$i;"; |
@@ -756,11 +756,11 @@ discard block |
||
756 | 756 | * @return string Correctly encoded entity |
757 | 757 | */ |
758 | 758 | function kses_normalize_entities3($matches) { |
759 | - if ( empty($matches[1]) ) |
|
759 | + if (empty($matches[1])) |
|
760 | 760 | return ''; |
761 | 761 | |
762 | 762 | $hexchars = $matches[1]; |
763 | - return ( ( ! kses_valid_unicode(hexdec($hexchars)) ) ? "&#x$hexchars;" : '&#x'.ltrim($hexchars,'0').';' ); |
|
763 | + return ((!kses_valid_unicode(hexdec($hexchars))) ? "&#x$hexchars;" : '&#x'.ltrim($hexchars, '0').';'); |
|
764 | 764 | } |
765 | 765 | |
766 | 766 | /** |
@@ -770,10 +770,10 @@ discard block |
||
770 | 770 | * @return bool true if the value was a valid Unicode number |
771 | 771 | */ |
772 | 772 | function kses_valid_unicode($i) { |
773 | - return ( $i == 0x9 || $i == 0xa || $i == 0xd || |
|
773 | + return ($i == 0x9 || $i == 0xa || $i == 0xd || |
|
774 | 774 | ($i >= 0x20 && $i <= 0xd7ff) || |
775 | 775 | ($i >= 0xe000 && $i <= 0xfffd) || |
776 | - ($i >= 0x10000 && $i <= 0x10ffff) ); |
|
776 | + ($i >= 0x10000 && $i <= 0x10ffff)); |
|
777 | 777 | } |
778 | 778 | |
779 | 779 | /** |
@@ -800,8 +800,8 @@ discard block |
||
800 | 800 | * @param array $match preg match |
801 | 801 | * @return string |
802 | 802 | */ |
803 | -function _kses_decode_entities_chr( $match ) { |
|
804 | - return chr( $match[1] ); |
|
803 | +function _kses_decode_entities_chr($match) { |
|
804 | + return chr($match[1]); |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | /** |
@@ -810,24 +810,24 @@ discard block |
||
810 | 810 | * @param array $match preg match |
811 | 811 | * @return string |
812 | 812 | */ |
813 | -function _kses_decode_entities_chr_hexdec( $match ) { |
|
814 | - return chr( hexdec( $match[1] ) ); |
|
813 | +function _kses_decode_entities_chr_hexdec($match) { |
|
814 | + return chr(hexdec($match[1])); |
|
815 | 815 | } |
816 | 816 | |
817 | 817 | /** |
818 | 818 | * Inline CSS filter |
819 | 819 | * |
820 | 820 | */ |
821 | -function kses_safecss_filter_attr( $css ) { |
|
821 | +function kses_safecss_filter_attr($css) { |
|
822 | 822 | |
823 | 823 | $css = kses_no_null($css); |
824 | - $css = str_replace(array("\n","\r","\t"), '', $css); |
|
824 | + $css = str_replace(array("\n", "\r", "\t"), '', $css); |
|
825 | 825 | |
826 | - if ( preg_match( '%[\\(&=}]|/\*%', $css ) ) // remove any inline css containing \ ( & } = or comments |
|
826 | + if (preg_match('%[\\(&=}]|/\*%', $css)) // remove any inline css containing \ ( & } = or comments |
|
827 | 827 | return ''; |
828 | 828 | |
829 | - $css_array = explode( ';', trim( $css ) ); |
|
830 | - $allowed_attr = array( 'text-align', 'margin', 'color', 'float', |
|
829 | + $css_array = explode(';', trim($css)); |
|
830 | + $allowed_attr = array('text-align', 'margin', 'color', 'float', |
|
831 | 831 | 'border', 'background', 'background-color', 'border-bottom', 'border-bottom-color', |
832 | 832 | 'border-bottom-style', 'border-bottom-width', 'border-collapse', 'border-color', 'border-left', |
833 | 833 | 'border-left-color', 'border-left-style', 'border-left-width', 'border-right', 'border-right-color', |
@@ -837,26 +837,26 @@ discard block |
||
837 | 837 | 'font-variant', 'font-weight', 'height', 'letter-spacing', 'line-height', 'margin-bottom', |
838 | 838 | 'margin-left', 'margin-right', 'margin-top', 'overflow', 'padding', 'padding-bottom', |
839 | 839 | 'padding-left', 'padding-right', 'padding-top', 'text-decoration', 'text-indent', 'vertical-align', |
840 | - 'width' ); |
|
840 | + 'width'); |
|
841 | 841 | |
842 | - if ( empty($allowed_attr) ) |
|
842 | + if (empty($allowed_attr)) |
|
843 | 843 | return $css; |
844 | 844 | |
845 | 845 | $css = ''; |
846 | - foreach ( $css_array as $css_item ) { |
|
847 | - if ( $css_item == '' ) |
|
846 | + foreach ($css_array as $css_item) { |
|
847 | + if ($css_item == '') |
|
848 | 848 | continue; |
849 | - $css_item = trim( $css_item ); |
|
849 | + $css_item = trim($css_item); |
|
850 | 850 | $found = false; |
851 | - if ( strpos( $css_item, ':' ) === false ) { |
|
851 | + if (strpos($css_item, ':') === false) { |
|
852 | 852 | $found = true; |
853 | 853 | } else { |
854 | - $parts = split( ':', $css_item ); |
|
855 | - if ( in_array( strtolower( trim( $parts[0] ) ), $allowed_attr ) ) |
|
854 | + $parts = split(':', $css_item); |
|
855 | + if (in_array(strtolower(trim($parts[0])), $allowed_attr)) |
|
856 | 856 | $found = true; |
857 | 857 | } |
858 | - if ( $found ) { |
|
859 | - if( $css != '' ) |
|
858 | + if ($found) { |
|
859 | + if ($css != '') |
|
860 | 860 | $css .= ';'; |
861 | 861 | $css .= $css_item; |
862 | 862 | } |
@@ -183,16 +183,19 @@ discard block |
||
183 | 183 | { |
184 | 184 | $string = kses_stripslashes($string); |
185 | 185 | |
186 | - if (substr($string, 0, 1) != '<') |
|
187 | - return '>'; |
|
186 | + if (substr($string, 0, 1) != '<') { |
|
187 | + return '>'; |
|
188 | + } |
|
188 | 189 | // It matched a ">" character |
189 | 190 | |
190 | 191 | if (preg_match('%^<!--(.*?)(-->)?$%', $string, $matches)) { |
191 | 192 | $string = str_replace(array('<!--', '-->'), '', $matches[1]); |
192 | - while ( $string != $newstring = kses($string, $allowed_html, $allowed_protocols) ) |
|
193 | - $string = $newstring; |
|
194 | - if ( $string == '' ) |
|
195 | - return ''; |
|
193 | + while ( $string != $newstring = kses($string, $allowed_html, $allowed_protocols) ) { |
|
194 | + $string = $newstring; |
|
195 | + } |
|
196 | + if ( $string == '' ) { |
|
197 | + return ''; |
|
198 | + } |
|
196 | 199 | // prevent multiple dashes in comments |
197 | 200 | $string = preg_replace('/--+/', '-', $string); |
198 | 201 | // prevent three dashes closing a comment |
@@ -201,20 +204,23 @@ discard block |
||
201 | 204 | } |
202 | 205 | // Allow HTML comments |
203 | 206 | |
204 | - if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches)) |
|
205 | - return ''; |
|
207 | + if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches)) { |
|
208 | + return ''; |
|
209 | + } |
|
206 | 210 | // It's seriously malformed |
207 | 211 | |
208 | 212 | $slash = trim($matches[1]); |
209 | 213 | $elem = $matches[2]; |
210 | 214 | $attrlist = $matches[3]; |
211 | 215 | |
212 | - if (!@isset($allowed_html[strtolower($elem)])) |
|
213 | - return ''; |
|
216 | + if (!@isset($allowed_html[strtolower($elem)])) { |
|
217 | + return ''; |
|
218 | + } |
|
214 | 219 | // They are using a not allowed HTML element |
215 | 220 | |
216 | - if ($slash != '') |
|
217 | - return "<$slash$elem>"; |
|
221 | + if ($slash != '') { |
|
222 | + return "<$slash$elem>"; |
|
223 | + } |
|
218 | 224 | // No attributes are allowed for closing elements |
219 | 225 | |
220 | 226 | return kses_attr("$slash$elem", $attrlist, $allowed_html, |
@@ -241,13 +247,15 @@ discard block |
||
241 | 247 | // Is there a closing XHTML slash at the end of the attributes? |
242 | 248 | |
243 | 249 | $xhtml_slash = ''; |
244 | - if (preg_match('%\s*/\s*$%', $attr)) |
|
245 | - $xhtml_slash = ' /'; |
|
250 | + if (preg_match('%\s*/\s*$%', $attr)) { |
|
251 | + $xhtml_slash = ' /'; |
|
252 | + } |
|
246 | 253 | |
247 | 254 | // Are any attributes allowed at all for this element? |
248 | 255 | |
249 | - if (@count($allowed_html[strtolower($element)]) == 0) |
|
250 | - return "<$element$xhtml_slash>"; |
|
256 | + if (@count($allowed_html[strtolower($element)]) == 0) { |
|
257 | + return "<$element$xhtml_slash>"; |
|
258 | + } |
|
251 | 259 | |
252 | 260 | // Split it |
253 | 261 | |
@@ -261,42 +269,52 @@ discard block |
||
261 | 269 | foreach ($attrarr as $arreach) |
262 | 270 | { |
263 | 271 | if (!@isset($allowed_html[strtolower($element)] |
264 | - [strtolower($arreach['name'])])) |
|
265 | - continue; // the attribute is not allowed |
|
272 | + [strtolower($arreach['name'])])) { |
|
273 | + continue; |
|
274 | + } |
|
275 | + // the attribute is not allowed |
|
266 | 276 | |
267 | 277 | $current = $allowed_html[strtolower($element)] |
268 | 278 | [strtolower($arreach['name'])]; |
269 | - if ($current == '') |
|
270 | - continue; // the attribute is not allowed |
|
279 | + if ($current == '') { |
|
280 | + continue; |
|
281 | + } |
|
282 | + // the attribute is not allowed |
|
271 | 283 | |
272 | - if (!is_array($current)) |
|
273 | - $attr2 .= ' '.$arreach['whole']; |
|
284 | + if (!is_array($current)) { |
|
285 | + $attr2 .= ' '.$arreach['whole']; |
|
286 | + } |
|
274 | 287 | // there are no checks |
275 | 288 | |
276 | 289 | else |
277 | 290 | { |
278 | 291 | // there are some checks |
279 | 292 | $ok = true; |
280 | - foreach ($current as $currkey => $currval) |
|
281 | - if (!kses_check_attr_val($arreach['value'], $arreach['vless'], |
|
293 | + foreach ($current as $currkey => $currval) { |
|
294 | + if (!kses_check_attr_val($arreach['value'], $arreach['vless'], |
|
282 | 295 | $currkey, $currval)) |
283 | - { $ok = false; break; } |
|
296 | + { $ok = false; |
|
297 | + } |
|
298 | + break; } |
|
284 | 299 | |
285 | 300 | if ( strtolower($arreach['name']) == 'style' ) { |
286 | 301 | $orig_value = $arreach['value']; |
287 | 302 | |
288 | 303 | $value = kses_safecss_filter_attr($orig_value); |
289 | 304 | |
290 | - if ( empty($value) ) |
|
291 | - continue; |
|
305 | + if ( empty($value) ) { |
|
306 | + continue; |
|
307 | + } |
|
292 | 308 | |
293 | 309 | $arreach['value'] = $value; |
294 | 310 | |
295 | 311 | $arreach['whole'] = str_replace($orig_value, $value, $arreach['whole']); |
296 | 312 | } |
297 | 313 | |
298 | - if ($ok) |
|
299 | - $attr2 .= ' '.$arreach['whole']; // it passed them |
|
314 | + if ($ok) { |
|
315 | + $attr2 .= ' '.$arreach['whole']; |
|
316 | + } |
|
317 | + // it passed them |
|
300 | 318 | } // if !is_array($current) |
301 | 319 | } // foreach |
302 | 320 | |
@@ -351,16 +369,22 @@ discard block |
||
351 | 369 | |
352 | 370 | case 1: // equals sign or valueless ("selected") |
353 | 371 | |
354 | - if (preg_match('/^\s*=\s*/', $attr)) // equals sign |
|
372 | + if (preg_match('/^\s*=\s*/', $attr)) { |
|
373 | + // equals sign |
|
355 | 374 | { |
356 | - $working = 1; $mode = 2; |
|
375 | + $working = 1; |
|
376 | + } |
|
377 | + $mode = 2; |
|
357 | 378 | $attr = preg_replace('/^\s*=\s*/', '', $attr); |
358 | 379 | break; |
359 | 380 | } |
360 | 381 | |
361 | - if (preg_match('/^\s+/', $attr)) // valueless |
|
382 | + if (preg_match('/^\s+/', $attr)) { |
|
383 | + // valueless |
|
362 | 384 | { |
363 | - $working = 1; $mode = 0; |
|
385 | + $working = 1; |
|
386 | + } |
|
387 | + $mode = 0; |
|
364 | 388 | if(FALSE === array_key_exists($attrname, $attrarr)) { |
365 | 389 | $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); |
366 | 390 | } |
@@ -371,16 +395,18 @@ discard block |
||
371 | 395 | |
372 | 396 | case 2: // attribute value, a URL after href= for instance |
373 | 397 | |
374 | - if (preg_match('%^"([^"]*)"(\s+|/?$)%', $attr, $match)) |
|
375 | - // "value" |
|
398 | + if (preg_match('%^"([^"]*)"(\s+|/?$)%', $attr, $match)) { |
|
399 | + // "value" |
|
376 | 400 | { |
377 | 401 | // MDL-2684 - kses stripping CSS styles that it thinks look like protocols |
378 | 402 | if ($attrname == 'style') { |
379 | 403 | $thisval = $match[1]; |
404 | + } |
|
380 | 405 | } else { |
381 | 406 | $thisval = $match[1]; |
382 | - if ( in_array(strtolower($attrname), $uris) ) |
|
383 | - $thisval = kses_bad_protocol($thisval, $allowed_protocols); |
|
407 | + if ( in_array(strtolower($attrname), $uris) ) { |
|
408 | + $thisval = kses_bad_protocol($thisval, $allowed_protocols); |
|
409 | + } |
|
384 | 410 | } |
385 | 411 | |
386 | 412 | if(FALSE === array_key_exists($attrname, $attrarr)) { |
@@ -391,12 +417,14 @@ discard block |
||
391 | 417 | break; |
392 | 418 | } |
393 | 419 | |
394 | - if (preg_match("%^'([^']*)'(\s+|/?$)%", $attr, $match)) |
|
395 | - // 'value' |
|
420 | + if (preg_match("%^'([^']*)'(\s+|/?$)%", $attr, $match)) { |
|
421 | + // 'value' |
|
396 | 422 | { |
397 | 423 | $thisval = $match[1]; |
398 | - if ( in_array(strtolower($attrname), $uris) ) |
|
399 | - $thisval = kses_bad_protocol($thisval, $allowed_protocols); |
|
424 | + } |
|
425 | + if ( in_array(strtolower($attrname), $uris) ) { |
|
426 | + $thisval = kses_bad_protocol($thisval, $allowed_protocols); |
|
427 | + } |
|
400 | 428 | |
401 | 429 | if(FALSE === array_key_exists($attrname, $attrarr)) { |
402 | 430 | $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n'); |
@@ -406,12 +434,14 @@ discard block |
||
406 | 434 | break; |
407 | 435 | } |
408 | 436 | |
409 | - if (preg_match("%^([^\s\"']+)(\s+|/?$)%", $attr, $match)) |
|
410 | - // value |
|
437 | + if (preg_match("%^([^\s\"']+)(\s+|/?$)%", $attr, $match)) { |
|
438 | + // value |
|
411 | 439 | { |
412 | 440 | $thisval = $match[1]; |
413 | - if ( in_array(strtolower($attrname), $uris) ) |
|
414 | - $thisval = kses_bad_protocol($thisval, $allowed_protocols); |
|
441 | + } |
|
442 | + if ( in_array(strtolower($attrname), $uris) ) { |
|
443 | + $thisval = kses_bad_protocol($thisval, $allowed_protocols); |
|
444 | + } |
|
415 | 445 | |
416 | 446 | if(FALSE === array_key_exists($attrname, $attrarr)) { |
417 | 447 | $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); |
@@ -424,17 +454,20 @@ discard block |
||
424 | 454 | break; |
425 | 455 | } // switch |
426 | 456 | |
427 | - if ($working == 0) // not well formed, remove and try again |
|
457 | + if ($working == 0) { |
|
458 | + // not well formed, remove and try again |
|
428 | 459 | { |
429 | 460 | $attr = kses_html_error($attr); |
461 | + } |
|
430 | 462 | $mode = 0; |
431 | 463 | } |
432 | 464 | } // while |
433 | 465 | |
434 | - if ($mode == 1 && FALSE === array_key_exists($attrname, $attrarr)) |
|
435 | - // special case, for when the attribute list ends with a valueless |
|
466 | + if ($mode == 1 && FALSE === array_key_exists($attrname, $attrarr)) { |
|
467 | + // special case, for when the attribute list ends with a valueless |
|
436 | 468 | // attribute like "selected" |
437 | 469 | $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); |
470 | + } |
|
438 | 471 | |
439 | 472 | return $attrarr; |
440 | 473 | } |
@@ -462,16 +495,18 @@ discard block |
||
462 | 495 | // greater than the given value. This can be used to avoid Buffer Overflows |
463 | 496 | // in WWW clients and various Internet servers. |
464 | 497 | |
465 | - if (strlen($value) > $checkvalue) |
|
466 | - $ok = false; |
|
498 | + if (strlen($value) > $checkvalue) { |
|
499 | + $ok = false; |
|
500 | + } |
|
467 | 501 | break; |
468 | 502 | |
469 | 503 | case 'minlen': |
470 | 504 | // The minlen check makes sure that the attribute value has a length not |
471 | 505 | // smaller than the given value. |
472 | 506 | |
473 | - if (strlen($value) < $checkvalue) |
|
474 | - $ok = false; |
|
507 | + if (strlen($value) < $checkvalue) { |
|
508 | + $ok = false; |
|
509 | + } |
|
475 | 510 | break; |
476 | 511 | |
477 | 512 | case 'maxval': |
@@ -481,20 +516,24 @@ discard block |
||
481 | 516 | // value is not greater than the given value. |
482 | 517 | // This check can be used to avoid Denial of Service attacks. |
483 | 518 | |
484 | - if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value)) |
|
485 | - $ok = false; |
|
486 | - if ($value > $checkvalue) |
|
487 | - $ok = false; |
|
519 | + if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value)) { |
|
520 | + $ok = false; |
|
521 | + } |
|
522 | + if ($value > $checkvalue) { |
|
523 | + $ok = false; |
|
524 | + } |
|
488 | 525 | break; |
489 | 526 | |
490 | 527 | case 'minval': |
491 | 528 | // The minval check checks that the attribute value is a positive integer, |
492 | 529 | // and that it is not smaller than the given value. |
493 | 530 | |
494 | - if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value)) |
|
495 | - $ok = false; |
|
496 | - if ($value < $checkvalue) |
|
497 | - $ok = false; |
|
531 | + if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value)) { |
|
532 | + $ok = false; |
|
533 | + } |
|
534 | + if ($value < $checkvalue) { |
|
535 | + $ok = false; |
|
536 | + } |
|
498 | 537 | break; |
499 | 538 | |
500 | 539 | case 'valueless': |
@@ -503,8 +542,9 @@ discard block |
||
503 | 542 | // is a "y" or a "Y", the attribute must not have a value. |
504 | 543 | // If the given value is an "n" or an "N", the attribute must have one. |
505 | 544 | |
506 | - if (strtolower($checkvalue) != $vless) |
|
507 | - $ok = false; |
|
545 | + if (strtolower($checkvalue) != $vless) { |
|
546 | + $ok = false; |
|
547 | + } |
|
508 | 548 | break; |
509 | 549 | } // switch |
510 | 550 | |
@@ -660,18 +700,20 @@ discard block |
||
660 | 700 | $string2 = strtolower($string2); |
661 | 701 | |
662 | 702 | $allowed = false; |
663 | - foreach ( (array) $allowed_protocols as $one_protocol) |
|
664 | - if (strtolower($one_protocol) == $string2) |
|
703 | + foreach ( (array) $allowed_protocols as $one_protocol) { |
|
704 | + if (strtolower($one_protocol) == $string2) |
|
665 | 705 | { |
666 | 706 | $allowed = true; |
707 | + } |
|
667 | 708 | break; |
668 | 709 | } |
669 | 710 | |
670 | - if ($allowed) |
|
671 | - return "$string2:"; |
|
672 | - else |
|
673 | - return ''; |
|
674 | -} |
|
711 | + if ($allowed) { |
|
712 | + return "$string2:"; |
|
713 | + } else { |
|
714 | + return ''; |
|
715 | + } |
|
716 | + } |
|
675 | 717 | |
676 | 718 | /** |
677 | 719 | * Converts and fixes HTML entities. |
@@ -711,8 +753,9 @@ discard block |
||
711 | 753 | function kses_named_entities($matches) { |
712 | 754 | global $kses_allowedentitynames; |
713 | 755 | |
714 | - if ( empty($matches[1]) ) |
|
715 | - return ''; |
|
756 | + if ( empty($matches[1]) ) { |
|
757 | + return ''; |
|
758 | + } |
|
716 | 759 | |
717 | 760 | $i = $matches[1]; |
718 | 761 | return ( ( ! in_array($i, $kses_allowedentitynames) ) ? "&$i;" : "&$i;" ); |
@@ -730,8 +773,9 @@ discard block |
||
730 | 773 | * @return string Correctly encoded entity |
731 | 774 | */ |
732 | 775 | function kses_normalize_entities2($matches) { |
733 | - if ( empty($matches[1]) ) |
|
734 | - return ''; |
|
776 | + if ( empty($matches[1]) ) { |
|
777 | + return ''; |
|
778 | + } |
|
735 | 779 | |
736 | 780 | $i = $matches[1]; |
737 | 781 | if (kses_valid_unicode($i)) { |
@@ -756,8 +800,9 @@ discard block |
||
756 | 800 | * @return string Correctly encoded entity |
757 | 801 | */ |
758 | 802 | function kses_normalize_entities3($matches) { |
759 | - if ( empty($matches[1]) ) |
|
760 | - return ''; |
|
803 | + if ( empty($matches[1]) ) { |
|
804 | + return ''; |
|
805 | + } |
|
761 | 806 | |
762 | 807 | $hexchars = $matches[1]; |
763 | 808 | return ( ( ! kses_valid_unicode(hexdec($hexchars)) ) ? "&#x$hexchars;" : '&#x'.ltrim($hexchars,'0').';' ); |
@@ -823,8 +868,10 @@ discard block |
||
823 | 868 | $css = kses_no_null($css); |
824 | 869 | $css = str_replace(array("\n","\r","\t"), '', $css); |
825 | 870 | |
826 | - if ( preg_match( '%[\\(&=}]|/\*%', $css ) ) // remove any inline css containing \ ( & } = or comments |
|
871 | + if ( preg_match( '%[\\(&=}]|/\*%', $css ) ) { |
|
872 | + // remove any inline css containing \ ( & } = or comments |
|
827 | 873 | return ''; |
874 | + } |
|
828 | 875 | |
829 | 876 | $css_array = explode( ';', trim( $css ) ); |
830 | 877 | $allowed_attr = array( 'text-align', 'margin', 'color', 'float', |
@@ -839,25 +886,29 @@ discard block |
||
839 | 886 | 'padding-left', 'padding-right', 'padding-top', 'text-decoration', 'text-indent', 'vertical-align', |
840 | 887 | 'width' ); |
841 | 888 | |
842 | - if ( empty($allowed_attr) ) |
|
843 | - return $css; |
|
889 | + if ( empty($allowed_attr) ) { |
|
890 | + return $css; |
|
891 | + } |
|
844 | 892 | |
845 | 893 | $css = ''; |
846 | 894 | foreach ( $css_array as $css_item ) { |
847 | - if ( $css_item == '' ) |
|
848 | - continue; |
|
895 | + if ( $css_item == '' ) { |
|
896 | + continue; |
|
897 | + } |
|
849 | 898 | $css_item = trim( $css_item ); |
850 | 899 | $found = false; |
851 | 900 | if ( strpos( $css_item, ':' ) === false ) { |
852 | 901 | $found = true; |
853 | 902 | } else { |
854 | 903 | $parts = split( ':', $css_item ); |
855 | - if ( in_array( strtolower( trim( $parts[0] ) ), $allowed_attr ) ) |
|
856 | - $found = true; |
|
904 | + if ( in_array( strtolower( trim( $parts[0] ) ), $allowed_attr ) ) { |
|
905 | + $found = true; |
|
906 | + } |
|
857 | 907 | } |
858 | 908 | if ( $found ) { |
859 | - if( $css != '' ) |
|
860 | - $css .= ';'; |
|
909 | + if( $css != '' ) { |
|
910 | + $css .= ';'; |
|
911 | + } |
|
861 | 912 | $css .= $css_item; |
862 | 913 | } |
863 | 914 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $last_modified = 0; |
212 | 212 | $return = 0; |
213 | 213 | if (is_dir($dir)) { |
214 | - while(($entry = $dir->read()) !== false) |
|
214 | + while (($entry = $dir->read()) !== false) |
|
215 | 215 | { |
216 | 216 | if ($entry != '.' && $entry != '..') |
217 | 217 | continue; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | 'props.session_id' |
285 | 285 | ); |
286 | 286 | |
287 | - $visibility_rule = ' props.visibility ' . ($can_see_invisible ? '<> 2' : '= 1'); |
|
287 | + $visibility_rule = ' props.visibility '.($can_see_invisible ? '<> 2' : '= 1'); |
|
288 | 288 | |
289 | 289 | $sql = "SELECT SUM(table1.size) FROM ( |
290 | 290 | SELECT size |
@@ -213,16 +213,19 @@ |
||
213 | 213 | if (is_dir($dir)) { |
214 | 214 | while(($entry = $dir->read()) !== false) |
215 | 215 | { |
216 | - if ($entry != '.' && $entry != '..') |
|
217 | - continue; |
|
216 | + if ($entry != '.' && $entry != '..') { |
|
217 | + continue; |
|
218 | + } |
|
218 | 219 | |
219 | - if (!is_dir($dir_name.'/'.$entry)) |
|
220 | - $current_modified = filemtime($dir_name.'/'.$entry); |
|
221 | - elseif ($do_recursive) |
|
222 | - $current_modified = recent_modified_file_time($dir_name.'/'.$entry, true); |
|
220 | + if (!is_dir($dir_name.'/'.$entry)) { |
|
221 | + $current_modified = filemtime($dir_name.'/'.$entry); |
|
222 | + } elseif ($do_recursive) { |
|
223 | + $current_modified = recent_modified_file_time($dir_name.'/'.$entry, true); |
|
224 | + } |
|
223 | 225 | |
224 | - if ($current_modified > $last_modified) |
|
225 | - $last_modified = $current_modified; |
|
226 | + if ($current_modified > $last_modified) { |
|
227 | + $last_modified = $current_modified; |
|
228 | + } |
|
226 | 229 | } |
227 | 230 | |
228 | 231 | $dir->close(); |
@@ -3122,8 +3122,9 @@ |
||
3122 | 3122 | global $DaysShort, $course_path; |
3123 | 3123 | //Handle leap year |
3124 | 3124 | $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
3125 | - if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) |
|
3126 | - $numberofdays[2] = 29; |
|
3125 | + if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) { |
|
3126 | + $numberofdays[2] = 29; |
|
3127 | + } |
|
3127 | 3128 | //Get the first day of the month |
3128 | 3129 | $dayone = getdate(mktime(0, 0, 0, $month, 1, $year)); |
3129 | 3130 | //Start the week on monday |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | * @param string $color |
566 | 566 | * @param bool $addAnnouncement |
567 | 567 | * |
568 | - * @return bool |
|
568 | + * @return null|false |
|
569 | 569 | */ |
570 | 570 | public function editEvent( |
571 | 571 | $id, |
@@ -1308,6 +1308,7 @@ discard block |
||
1308 | 1308 | * |
1309 | 1309 | * @param int $eventId |
1310 | 1310 | * @param int $courseId |
1311 | + * @param integer $sessionId |
|
1311 | 1312 | * @paraù int $sessionId |
1312 | 1313 | * |
1313 | 1314 | * @return array |
@@ -2469,6 +2470,7 @@ discard block |
||
2469 | 2470 | * Adds x weeks to a UNIX timestamp |
2470 | 2471 | * @param int The timestamp |
2471 | 2472 | * @param int The number of weeks to add |
2473 | + * @param integer $timestamp |
|
2472 | 2474 | * @return int The new timestamp |
2473 | 2475 | */ |
2474 | 2476 | function addWeek($timestamp, $num = 1) |
@@ -2480,6 +2482,7 @@ discard block |
||
2480 | 2482 | * Adds x months to a UNIX timestamp |
2481 | 2483 | * @param int The timestamp |
2482 | 2484 | * @param int The number of years to add |
2485 | + * @param integer $timestamp |
|
2483 | 2486 | * @return int The new timestamp |
2484 | 2487 | */ |
2485 | 2488 | function addMonth($timestamp, $num = 1) |
@@ -2498,6 +2501,7 @@ discard block |
||
2498 | 2501 | * Adds x years to a UNIX timestamp |
2499 | 2502 | * @param int The timestamp |
2500 | 2503 | * @param int The number of years to add |
2504 | + * @param integer $timestamp |
|
2501 | 2505 | * @return int The new timestamp |
2502 | 2506 | */ |
2503 | 2507 | function addYear($timestamp, $num = 1) |
@@ -2697,7 +2701,7 @@ discard block |
||
2697 | 2701 | /** |
2698 | 2702 | * @param array $courseInfo |
2699 | 2703 | * @param $file |
2700 | - * @return array|bool|string |
|
2704 | + * @return false|string |
|
2701 | 2705 | */ |
2702 | 2706 | public function importEventFile($courseInfo, $file) |
2703 | 2707 | { |
@@ -2810,7 +2814,7 @@ discard block |
||
2810 | 2814 | |
2811 | 2815 | /** |
2812 | 2816 | * Parse filter turns USER:12 to ['users' => [12])] or G:1 ['groups' => [1]] |
2813 | - * @param $filter |
|
2817 | + * @param integer $filter |
|
2814 | 2818 | * @return array |
2815 | 2819 | */ |
2816 | 2820 | public function parseAgendaFilter($filter) |
@@ -3324,6 +3328,7 @@ discard block |
||
3324 | 3328 | * @param int user ID of the user |
3325 | 3329 | * @param string Optional start date in datetime format (if no start date is given, uses today) |
3326 | 3330 | * @param string Optional end date in datetime format (if no date is given, uses one year from now) |
3331 | + * @param integer $user_id |
|
3327 | 3332 | * @return array Array of events ordered by start date, in |
3328 | 3333 | * [0]('datestart','dateend','title'),[1]('datestart','dateend','title','link','coursetitle') format, |
3329 | 3334 | * where datestart and dateend are in yyyyMMddhhmmss format. |
@@ -1499,12 +1499,12 @@ discard block |
||
1499 | 1499 | } |
1500 | 1500 | |
1501 | 1501 | if (empty($session_id)) { |
1502 | - $sessionCondition = " |
|
1502 | + $sessionCondition = " |
|
1503 | 1503 | ( |
1504 | 1504 | agenda.session_id = 0 AND (ip.session_id IS NULL OR ip.session_id = 0) |
1505 | 1505 | ) "; |
1506 | 1506 | } else { |
1507 | - $sessionCondition = " |
|
1507 | + $sessionCondition = " |
|
1508 | 1508 | ( |
1509 | 1509 | agenda.session_id = $session_id AND |
1510 | 1510 | ip.session_id = $session_id |
@@ -1543,13 +1543,13 @@ discard block |
||
1543 | 1543 | } |
1544 | 1544 | |
1545 | 1545 | if (empty($session_id)) { |
1546 | - $sessionCondition = " |
|
1546 | + $sessionCondition = " |
|
1547 | 1547 | ( |
1548 | 1548 | agenda.session_id = 0 AND |
1549 | 1549 | (ip.session_id IS NULL OR ip.session_id = 0) |
1550 | 1550 | ) "; |
1551 | 1551 | } else { |
1552 | - $sessionCondition = " |
|
1552 | + $sessionCondition = " |
|
1553 | 1553 | ( |
1554 | 1554 | agenda.session_id = $session_id AND |
1555 | 1555 | ip.session_id = $session_id |
@@ -1601,7 +1601,7 @@ discard block |
||
1601 | 1601 | while ($row = Database::fetch_array($result, 'ASSOC')) { |
1602 | 1602 | $event = array(); |
1603 | 1603 | $event['id'] = 'course_'.$row['id']; |
1604 | - $event['unique_id'] = $row['iid']; |
|
1604 | + $event['unique_id'] = $row['iid']; |
|
1605 | 1605 | // To avoid doubles |
1606 | 1606 | if (in_array($event['unique_id'], $eventsAdded)) { |
1607 | 1607 | continue; |
@@ -2151,7 +2151,7 @@ discard block |
||
2151 | 2151 | ); |
2152 | 2152 | |
2153 | 2153 | $form->addLabel('', |
2154 | - '<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">'.get_lang('AddOneMoreFile').'</a></span> ('.sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize'))).')'); |
|
2154 | + '<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">'.get_lang('AddOneMoreFile').'</a></span> ('.sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize'))).')'); |
|
2155 | 2155 | |
2156 | 2156 | |
2157 | 2157 | //if ($showAttachmentForm) { |
@@ -2729,8 +2729,8 @@ discard block |
||
2729 | 2729 | |
2730 | 2730 | $startDateTime = api_get_local_time($start->format('Y-m-d H:i:s'), $currentTimeZone, $start->format('e')); |
2731 | 2731 | $endDateTime = api_get_local_time($end->format('Y-m-d H:i'), $currentTimeZone, $end->format('e')); |
2732 | - $title = api_convert_encoding((string)$event->summary, $charset, 'UTF-8'); |
|
2733 | - $description = api_convert_encoding((string)$event->description, $charset, 'UTF-8'); |
|
2732 | + $title = api_convert_encoding((string) $event->summary, $charset, 'UTF-8'); |
|
2733 | + $description = api_convert_encoding((string) $event->description, $charset, 'UTF-8'); |
|
2734 | 2734 | |
2735 | 2735 | $id = $this->addEvent( |
2736 | 2736 | $startDateTime, |
@@ -2872,7 +2872,7 @@ discard block |
||
2872 | 2872 | ORDER BY start_date "; |
2873 | 2873 | } else { |
2874 | 2874 | // if the user is not an administrator of that course |
2875 | - if (is_array($group_memberships) && count($group_memberships)>0) { |
|
2875 | + if (is_array($group_memberships) && count($group_memberships) > 0) { |
|
2876 | 2876 | $sqlquery = "SELECT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref |
2877 | 2877 | FROM ".$TABLEAGENDA." agenda, |
2878 | 2878 | ".$TABLE_ITEMPROPERTY." ip |
@@ -2902,14 +2902,14 @@ discard block |
||
2902 | 2902 | $agendaday = -1; |
2903 | 2903 | if ($item['start_date'] != '0000-00-00 00:00:00') { |
2904 | 2904 | $item['start_date'] = api_get_local_time($item['start_date']); |
2905 | - $item['start_date_tms'] = api_strtotime($item['start_date']); |
|
2905 | + $item['start_date_tms'] = api_strtotime($item['start_date']); |
|
2906 | 2906 | $agendaday = date("j", $item['start_date_tms']); |
2907 | 2907 | } |
2908 | 2908 | if ($item['end_date'] != '0000-00-00 00:00:00') { |
2909 | 2909 | $item['end_date'] = api_get_local_time($item['end_date']); |
2910 | 2910 | } |
2911 | 2911 | |
2912 | - $url = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday"; |
|
2912 | + $url = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday"; |
|
2913 | 2913 | |
2914 | 2914 | $item['url'] = $url; |
2915 | 2915 | $item['course_name'] = $array_course_info['title']; |
@@ -2921,9 +2921,9 @@ discard block |
||
2921 | 2921 | } |
2922 | 2922 | |
2923 | 2923 | // sorting by hour for every day |
2924 | - $agendaitems = array (); |
|
2924 | + $agendaitems = array(); |
|
2925 | 2925 | while (list ($agendaday, $tmpitems) = each($items)) { |
2926 | - if(!isset($agendaitems[$agendaday])) { |
|
2926 | + if (!isset($agendaitems[$agendaday])) { |
|
2927 | 2927 | $agendaitems[$agendaday] = ''; |
2928 | 2928 | } |
2929 | 2929 | sort($tmpitems); |
@@ -3097,9 +3097,9 @@ discard block |
||
3097 | 3097 | $end_year = $start_end_day_of_week['end']['year']; |
3098 | 3098 | // in sql statements you have to use year-month-day for date calculations |
3099 | 3099 | $start_filter = $start_year."-".$start_month."-".$start_day." 00:00:00"; |
3100 | - $start_filter = api_get_utc_datetime($start_filter); |
|
3100 | + $start_filter = api_get_utc_datetime($start_filter); |
|
3101 | 3101 | $end_filter = $end_year."-".$end_month."-".$end_day." 23:59:59"; |
3102 | - $end_filter = api_get_utc_datetime($end_filter); |
|
3102 | + $end_filter = api_get_utc_datetime($end_filter); |
|
3103 | 3103 | $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'"; |
3104 | 3104 | } |
3105 | 3105 | // 3. creating the SQL statement for getting the personal agenda items in DAY view |
@@ -3107,18 +3107,18 @@ discard block |
||
3107 | 3107 | // we are in day view |
3108 | 3108 | // we could use mysql date() function but this is only available from 4.1 and higher |
3109 | 3109 | $start_filter = $year."-".$month."-".$day." 00:00:00"; |
3110 | - $start_filter = api_get_utc_datetime($start_filter); |
|
3110 | + $start_filter = api_get_utc_datetime($start_filter); |
|
3111 | 3111 | $end_filter = $year."-".$month."-".$day." 23:59:59"; |
3112 | - $end_filter = api_get_utc_datetime($end_filter); |
|
3112 | + $end_filter = api_get_utc_datetime($end_filter); |
|
3113 | 3113 | $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'"; |
3114 | 3114 | } |
3115 | 3115 | |
3116 | 3116 | $result = Database::query($sql); |
3117 | 3117 | while ($item = Database::fetch_array($result, 'ASSOC')) { |
3118 | 3118 | |
3119 | - $time_minute = api_convert_and_format_date($item['date'], TIME_NO_SEC_FORMAT); |
|
3120 | - $item['date'] = api_get_local_time($item['date']); |
|
3121 | - $item['start_date_tms'] = api_strtotime($item['date']); |
|
3119 | + $time_minute = api_convert_and_format_date($item['date'], TIME_NO_SEC_FORMAT); |
|
3120 | + $item['date'] = api_get_local_time($item['date']); |
|
3121 | + $item['start_date_tms'] = api_strtotime($item['date']); |
|
3122 | 3122 | $item['content'] = $item['text']; |
3123 | 3123 | |
3124 | 3124 | // we break the date field in the database into a date and a time part |
@@ -3138,7 +3138,7 @@ discard block |
||
3138 | 3138 | $second = $agendatime[2]; |
3139 | 3139 | |
3140 | 3140 | if ($type == 'month_view') { |
3141 | - $item['calendar_type'] = 'personal'; |
|
3141 | + $item['calendar_type'] = 'personal'; |
|
3142 | 3142 | $item['start_date'] = $item['date']; |
3143 | 3143 | $agendaitems[$day][] = $item; |
3144 | 3144 | continue; |
@@ -3163,7 +3163,7 @@ discard block |
||
3163 | 3163 | // this is the array construction for the DAY view |
3164 | 3164 | $halfhour = 2 * $agendatime['0']; |
3165 | 3165 | if ($agendatime['1'] >= '30') { |
3166 | - $halfhour = $halfhour +1; |
|
3166 | + $halfhour = $halfhour + 1; |
|
3167 | 3167 | } |
3168 | 3168 | |
3169 | 3169 | //Display events by list |
@@ -3187,22 +3187,22 @@ discard block |
||
3187 | 3187 | { |
3188 | 3188 | global $DaysShort, $course_path; |
3189 | 3189 | //Handle leap year |
3190 | - $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
3190 | + $numberofdays = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
3191 | 3191 | if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) |
3192 | 3192 | $numberofdays[2] = 29; |
3193 | 3193 | //Get the first day of the month |
3194 | 3194 | $dayone = getdate(mktime(0, 0, 0, $month, 1, $year)); |
3195 | 3195 | //Start the week on monday |
3196 | 3196 | $startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6; |
3197 | - $g_cc = (isset($_GET['courseCode'])?$_GET['courseCode']:''); |
|
3197 | + $g_cc = (isset($_GET['courseCode']) ? $_GET['courseCode'] : ''); |
|
3198 | 3198 | |
3199 | - $next_month = ($month == 1 ? 12 : $month -1); |
|
3200 | - $prev_month = ($month == 12 ? 1 : $month +1); |
|
3199 | + $next_month = ($month == 1 ? 12 : $month - 1); |
|
3200 | + $prev_month = ($month == 12 ? 1 : $month + 1); |
|
3201 | 3201 | |
3202 | - $next_year = ($month == 1 ? $year -1 : $year); |
|
3203 | - $prev_year = ($month == 12 ? $year +1 : $year); |
|
3202 | + $next_year = ($month == 1 ? $year - 1 : $year); |
|
3203 | + $prev_year = ($month == 12 ? $year + 1 : $year); |
|
3204 | 3204 | |
3205 | - if ($show_content) { |
|
3205 | + if ($show_content) { |
|
3206 | 3206 | $back_url = Display::url(get_lang('Previous'), api_get_self()."?coursePath=".urlencode($course_path)."&courseCode=".Security::remove_XSS($g_cc)."&action=view&view=month&month=".$next_month."&year=".$next_year); |
3207 | 3207 | $next_url = Display::url(get_lang('Next'), api_get_self()."?coursePath=".urlencode($course_path)."&courseCode=".Security::remove_XSS($g_cc)."&action=view&view=month&month=".$prev_month."&year=".$prev_year); |
3208 | 3208 | } else { |
@@ -3219,7 +3219,7 @@ discard block |
||
3219 | 3219 | $html .= '</div>'; |
3220 | 3220 | $html .= '<table id="agenda_list2" class="table table-bordered">'; |
3221 | 3221 | $html .= '<tr>'; |
3222 | - for ($ii = 1; $ii < 8; $ii ++) { |
|
3222 | + for ($ii = 1; $ii < 8; $ii++) { |
|
3223 | 3223 | $html .= '<td class="weekdays">'.$DaysShort[$ii % 7].'</td>'; |
3224 | 3224 | } |
3225 | 3225 | $html .= '</tr>'; |
@@ -3228,7 +3228,7 @@ discard block |
||
3228 | 3228 | $today = getdate(); |
3229 | 3229 | while ($curday <= $numberofdays[$month]) { |
3230 | 3230 | $html .= "<tr>"; |
3231 | - for ($ii = 0; $ii < 7; $ii ++) { |
|
3231 | + for ($ii = 0; $ii < 7; $ii++) { |
|
3232 | 3232 | if (($curday == -1) && ($ii == $startdayofweek)) { |
3233 | 3233 | $curday = 1; |
3234 | 3234 | } |
@@ -3242,21 +3242,21 @@ discard block |
||
3242 | 3242 | $html .= "<td ".$class.">".$dayheader; |
3243 | 3243 | |
3244 | 3244 | if (!empty($agendaitems[$curday])) { |
3245 | - $items = $agendaitems[$curday]; |
|
3246 | - $items = msort($items, 'start_date_tms'); |
|
3245 | + $items = $agendaitems[$curday]; |
|
3246 | + $items = msort($items, 'start_date_tms'); |
|
3247 | 3247 | |
3248 | - foreach($items as $value) { |
|
3248 | + foreach ($items as $value) { |
|
3249 | 3249 | $value['title'] = Security::remove_XSS($value['title']); |
3250 | 3250 | $start_time = api_format_date($value['start_date'], TIME_NO_SEC_FORMAT); |
3251 | 3251 | $end_time = ''; |
3252 | 3252 | |
3253 | 3253 | if (!empty($value['end_date']) && $value['end_date'] != '0000-00-00 00:00:00') { |
3254 | - $end_time = '- <i>'.api_format_date($value['end_date'], DATE_TIME_FORMAT_LONG).'</i>'; |
|
3254 | + $end_time = '- <i>'.api_format_date($value['end_date'], DATE_TIME_FORMAT_LONG).'</i>'; |
|
3255 | 3255 | } |
3256 | 3256 | $complete_time = '<i>'.api_format_date($value['start_date'], DATE_TIME_FORMAT_LONG).'</i> '.$end_time; |
3257 | 3257 | $time = '<i>'.$start_time.'</i>'; |
3258 | 3258 | |
3259 | - switch($value['calendar_type']) { |
|
3259 | + switch ($value['calendar_type']) { |
|
3260 | 3260 | case 'personal': |
3261 | 3261 | $bg_color = '#D0E7F4'; |
3262 | 3262 | $icon = Display::return_icon('user.png', get_lang('MyAgenda'), array(), ICON_SIZE_SMALL); |
@@ -3308,7 +3308,7 @@ discard block |
||
3308 | 3308 | } |
3309 | 3309 | } |
3310 | 3310 | $html .= "</td>"; |
3311 | - $curday ++; |
|
3311 | + $curday++; |
|
3312 | 3312 | } else { |
3313 | 3313 | $html .= "<td></td>"; |
3314 | 3314 | } |
@@ -3329,18 +3329,18 @@ discard block |
||
3329 | 3329 | * where datestart and dateend are in yyyyMMddhhmmss format. |
3330 | 3330 | * @TODO Implement really personal events (from user DB) and global events (from main DB) |
3331 | 3331 | */ |
3332 | - public static function get_personal_agenda_items_between_dates($user_id, $date_start='', $date_end='') |
|
3332 | + public static function get_personal_agenda_items_between_dates($user_id, $date_start = '', $date_end = '') |
|
3333 | 3333 | { |
3334 | - $items = array (); |
|
3334 | + $items = array(); |
|
3335 | 3335 | if ($user_id != strval(intval($user_id))) { return $items; } |
3336 | - if (empty($date_start)) { $date_start = date('Y-m-d H:i:s');} |
|
3337 | - if (empty($date_end)) { $date_end = date('Y-m-d H:i:s',mktime(0, 0, 0, date("m"), date("d"), date("Y")+1));} |
|
3336 | + if (empty($date_start)) { $date_start = date('Y-m-d H:i:s'); } |
|
3337 | + if (empty($date_end)) { $date_end = date('Y-m-d H:i:s', mktime(0, 0, 0, date("m"), date("d"), date("Y") + 1)); } |
|
3338 | 3338 | $expr = '/\d{4}-\d{2}-\d{2}\ \d{2}:\d{2}:\d{2}/'; |
3339 | - if(!preg_match($expr,$date_start)) { return $items; } |
|
3340 | - if(!preg_match($expr,$date_end)) { return $items; } |
|
3339 | + if (!preg_match($expr, $date_start)) { return $items; } |
|
3340 | + if (!preg_match($expr, $date_end)) { return $items; } |
|
3341 | 3341 | |
3342 | 3342 | // get agenda-items for every course |
3343 | - $courses = api_get_user_courses($user_id,false); |
|
3343 | + $courses = api_get_user_courses($user_id, false); |
|
3344 | 3344 | foreach ($courses as $id => $course) { |
3345 | 3345 | $c = api_get_course_info_by_id($course['real_id']); |
3346 | 3346 | //databases of the courses |
@@ -3364,9 +3364,9 @@ discard block |
||
3364 | 3364 | " ORDER BY start_date "; |
3365 | 3365 | } else { |
3366 | 3366 | // if the user is not an administrator of that course, then... |
3367 | - if (is_array($group_memberships) && count($group_memberships)>0) |
|
3367 | + if (is_array($group_memberships) && count($group_memberships) > 0) |
|
3368 | 3368 | { |
3369 | - $sqlquery = "SELECT " . |
|
3369 | + $sqlquery = "SELECT ". |
|
3370 | 3370 | "DISTINCT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref ". |
3371 | 3371 | " FROM ".$t_a." agenda, ". |
3372 | 3372 | $t_ip." ip ". |
@@ -3394,13 +3394,13 @@ discard block |
||
3394 | 3394 | |
3395 | 3395 | $result = Database::query($sqlquery); |
3396 | 3396 | while ($item = Database::fetch_array($result)) { |
3397 | - $agendaday = date("j",strtotime($item['start_date'])); |
|
3398 | - $month = date("n",strtotime($item['start_date'])); |
|
3399 | - $year = date("Y",strtotime($item['start_date'])); |
|
3397 | + $agendaday = date("j", strtotime($item['start_date'])); |
|
3398 | + $month = date("n", strtotime($item['start_date'])); |
|
3399 | + $year = date("Y", strtotime($item['start_date'])); |
|
3400 | 3400 | $URL = api_get_path(WEB_PATH)."main/calendar/agenda.php?cidReq=".urlencode($course["code"])."&day=$agendaday&month=$month&year=$year#$agendaday"; |
3401 | - list($year,$month,$day,$hour,$min,$sec) = split('[-: ]',$item['start_date']); |
|
3401 | + list($year, $month, $day, $hour, $min, $sec) = split('[-: ]', $item['start_date']); |
|
3402 | 3402 | $start_date = $year.$month.$day.$hour.$min; |
3403 | - list($year,$month,$day,$hour,$min,$sec) = split('[-: ]',$item['end_date']); |
|
3403 | + list($year, $month, $day, $hour, $min, $sec) = split('[-: ]', $item['end_date']); |
|
3404 | 3404 | $end_date = $year.$month.$day.$hour.$min; |
3405 | 3405 | |
3406 | 3406 | $items[] = array( |
@@ -3429,7 +3429,7 @@ discard block |
||
3429 | 3429 | $user = api_get_user_id(); |
3430 | 3430 | $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE id=".$id." AND user = ".$user; |
3431 | 3431 | $result = Database::query($sql); |
3432 | - if(Database::num_rows($result)==1) { |
|
3432 | + if (Database::num_rows($result) == 1) { |
|
3433 | 3433 | $item = Database::fetch_array($result); |
3434 | 3434 | } else { |
3435 | 3435 | $item = null; |
@@ -3451,9 +3451,9 @@ discard block |
||
3451 | 3451 | // step 2: we which day this is (0=sunday, 1=monday, ...) |
3452 | 3452 | $number_day_in_week = date('w', $random_day_in_week); |
3453 | 3453 | // step 3: we calculate the timestamp of the monday of the week we are in |
3454 | - $start_timestamp = $random_day_in_week - (($number_day_in_week -1) * 24 * 60 * 60); |
|
3454 | + $start_timestamp = $random_day_in_week - (($number_day_in_week - 1) * 24 * 60 * 60); |
|
3455 | 3455 | // step 4: we calculate the timestamp of the sunday of the week we are in |
3456 | - $end_timestamp = $random_day_in_week + ((7 - $number_day_in_week +1) * 24 * 60 * 60) - 3600; |
|
3456 | + $end_timestamp = $random_day_in_week + ((7 - $number_day_in_week + 1) * 24 * 60 * 60) - 3600; |
|
3457 | 3457 | // step 5: calculating the start_day, end_day, start_month, end_month, start_year, end_year |
3458 | 3458 | $start_day = date('j', $start_timestamp); |
3459 | 3459 | $start_month = date('n', $start_timestamp); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $count = intval($count); |
80 | 80 | $from = intval($from); |
81 | 81 | |
82 | - $sql .= " ORDER BY $column $direction"; |
|
82 | + $sql .= " ORDER BY $column $direction"; |
|
83 | 83 | $sql .= " LIMIT $count, $from "; |
84 | 84 | |
85 | 85 | $result = Database::query($sql); |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | static function deactivate_zombies($ceiling) |
94 | 94 | { |
95 | 95 | $zombies = self::list_zombies($ceiling); |
96 | - $ids = array(); |
|
97 | - foreach($zombies as $zombie) { |
|
96 | + $ids = array(); |
|
97 | + foreach ($zombies as $zombie) { |
|
98 | 98 | $ids[] = $zombie['user_id']; |
99 | 99 | } |
100 | 100 | UserManager::deactivate_users($ids); |
@@ -248,17 +248,17 @@ discard block |
||
248 | 248 | } |
249 | 249 | } |
250 | 250 | |
251 | - if (trim($home_top_temp) == '' && api_is_platform_admin()) { |
|
252 | - $home_top_temp = '<div class="welcome-mascot">' . get_lang('PortalHomepageDefaultIntroduction') . '</div>'; |
|
253 | - } else { |
|
254 | - $home_top_temp = '<div class="welcome-home-top-temp">' . $home_top_temp . '</div>'; |
|
255 | - } |
|
256 | - $open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp); |
|
257 | - $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
|
258 | - } |
|
259 | - |
|
260 | - return $html; |
|
261 | - } |
|
251 | + if (trim($home_top_temp) == '' && api_is_platform_admin()) { |
|
252 | + $home_top_temp = '<div class="welcome-mascot">' . get_lang('PortalHomepageDefaultIntroduction') . '</div>'; |
|
253 | + } else { |
|
254 | + $home_top_temp = '<div class="welcome-home-top-temp">' . $home_top_temp . '</div>'; |
|
255 | + } |
|
256 | + $open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp); |
|
257 | + $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
|
258 | + } |
|
259 | + |
|
260 | + return $html; |
|
261 | + } |
|
262 | 262 | |
263 | 263 | function return_notice() |
264 | 264 | { |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | $thereIsSubCat = true; |
510 | 510 | } elseif (api_get_setting('show_empty_course_categories') == 'true') { |
511 | 511 | /* End changed code to eliminate the (0 courses) after empty categories. */ |
512 | - $htmlListCat .= '<li>'; |
|
512 | + $htmlListCat .= '<li>'; |
|
513 | 513 | $htmlListCat .= $catLine['name']; |
514 | 514 | $htmlListCat .= "</li>"; |
515 | 515 | $thereIsSubCat = true; |
@@ -639,11 +639,11 @@ discard block |
||
639 | 639 | } |
640 | 640 | |
641 | 641 | /** |
642 | - * retrieves all the courses that the user has already subscribed to |
|
643 | - * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
|
644 | - * @param int $user_id: the id of the user |
|
645 | - * @return array an array containing all the information of the courses of the given user |
|
646 | - */ |
|
642 | + * retrieves all the courses that the user has already subscribed to |
|
643 | + * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
|
644 | + * @param int $user_id: the id of the user |
|
645 | + * @return array an array containing all the information of the courses of the given user |
|
646 | + */ |
|
647 | 647 | public function get_courses_of_user($user_id) |
648 | 648 | { |
649 | 649 | $table_course = Database::get_main_table(TABLE_MAIN_COURSE); |
@@ -338,7 +338,7 @@ |
||
338 | 338 | |
339 | 339 | if (empty($certificatesItem) && empty($searchItem)) { |
340 | 340 | return null; |
341 | - }else{ |
|
341 | + } else{ |
|
342 | 342 | $content.= $certificatesItem; |
343 | 343 | $content.= $searchItem; |
344 | 344 | } |
@@ -657,6 +657,7 @@ discard block |
||
657 | 657 | * retrieves all the courses that the user has already subscribed to |
658 | 658 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
659 | 659 | * @param int $user_id: the id of the user |
660 | + * @param integer $user_id |
|
660 | 661 | * @return array an array containing all the information of the courses of the given user |
661 | 662 | */ |
662 | 663 | public function get_courses_of_user($user_id) |
@@ -707,13 +708,13 @@ discard block |
||
707 | 708 | |
708 | 709 | /** |
709 | 710 | * @todo use the template system |
710 | - * @param $title |
|
711 | - * @param $content |
|
711 | + * @param string|null $title |
|
712 | + * @param string $content |
|
712 | 713 | * @param string $id |
713 | 714 | * @param array $params |
714 | 715 | * @param string $idAccordion |
715 | 716 | * @param string $idCollapse |
716 | - * @return null|string |
|
717 | + * @return string |
|
717 | 718 | */ |
718 | 719 | public function show_right_block( |
719 | 720 | $title, |
@@ -937,7 +938,7 @@ discard block |
||
937 | 938 | } |
938 | 939 | |
939 | 940 | /** |
940 | - * @return null|string |
|
941 | + * @return string |
|
941 | 942 | */ |
942 | 943 | public function return_course_block() |
943 | 944 | { |
@@ -1590,8 +1591,8 @@ discard block |
||
1590 | 1591 | |
1591 | 1592 | /** |
1592 | 1593 | * Return HTML code for personal user course category |
1593 | - * @param $id |
|
1594 | - * @param $title |
|
1594 | + * @param integer $id |
|
1595 | + * @param string $title |
|
1595 | 1596 | * @return string |
1596 | 1597 | */ |
1597 | 1598 | private static function getHtmlForUserCategory($id, $title) |
@@ -1612,7 +1613,7 @@ discard block |
||
1612 | 1613 | /** |
1613 | 1614 | * return HTML code for course display in session view |
1614 | 1615 | * @param array $courseInfo |
1615 | - * @param $userCategoryId |
|
1616 | + * @param integer $userCategoryId |
|
1616 | 1617 | * @param bool $displayButton |
1617 | 1618 | * @param $loadDirs |
1618 | 1619 | * @return string |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | { |
45 | 45 | $exercise_list = array(); |
46 | 46 | if (!empty($personal_course_list)) { |
47 | - foreach($personal_course_list as $course_item) { |
|
47 | + foreach ($personal_course_list as $course_item) { |
|
48 | 48 | $course_code = $course_item['c']; |
49 | 49 | $session_id = $course_item['id_session']; |
50 | 50 | |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | $session_id |
54 | 54 | ); |
55 | 55 | |
56 | - foreach($exercises as $exercise_item) { |
|
57 | - $exercise_item['course_code'] = $course_code; |
|
58 | - $exercise_item['session_id'] = $session_id; |
|
59 | - $exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC'); |
|
56 | + foreach ($exercises as $exercise_item) { |
|
57 | + $exercise_item['course_code'] = $course_code; |
|
58 | + $exercise_item['session_id'] = $session_id; |
|
59 | + $exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC'); |
|
60 | 60 | |
61 | 61 | $exercise_list[] = $exercise_item; |
62 | 62 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
174 | - if ($show_menu && ($show_create_link || $show_course_link )) { |
|
174 | + if ($show_menu && ($show_create_link || $show_course_link)) { |
|
175 | 175 | $show_menu = true; |
176 | 176 | } else { |
177 | 177 | $show_menu = false; |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | if ($show_menu) { |
184 | 184 | $html .= '<ul class="nav nav-pills nav-stacked">'; |
185 | 185 | if ($show_create_link) { |
186 | - $html .= '<li class="add-course"><a href="' . api_get_path(WEB_CODE_PATH) . 'create_course/add_course.php">'.Display::return_icon('new-course.png', get_lang('CourseCreate')).(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>'; |
|
186 | + $html .= '<li class="add-course"><a href="'.api_get_path(WEB_CODE_PATH).'create_course/add_course.php">'.Display::return_icon('new-course.png', get_lang('CourseCreate')).(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>'; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | if ($show_course_link) { |
190 | 190 | if (!api_is_drh() && !api_is_session_admin()) { |
191 | - $html .= '<li class="list-course"><a href="'. api_get_path(WEB_CODE_PATH) . 'auth/courses.php">'. Display::return_icon('catalog-course.png', get_lang('CourseCatalog')) .get_lang('CourseCatalog').'</a></li>'; |
|
191 | + $html .= '<li class="list-course"><a href="'.api_get_path(WEB_CODE_PATH).'auth/courses.php">'.Display::return_icon('catalog-course.png', get_lang('CourseCatalog')).get_lang('CourseCatalog').'</a></li>'; |
|
192 | 192 | } else { |
193 | - $html .= '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'dashboard/index.php">'.get_lang('Dashboard').'</a></li>'; |
|
193 | + $html .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'dashboard/index.php">'.get_lang('Dashboard').'</a></li>'; |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | $html .= '</ul>'; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $html = ''; |
215 | 215 | |
216 | 216 | if (!empty($_GET['include']) && preg_match('/^[a-zA-Z0-9_-]*\.html$/', $_GET['include'])) { |
217 | - $open = @(string)file_get_contents(api_get_path(SYS_PATH).$this->home.$_GET['include']); |
|
217 | + $open = @(string) file_get_contents(api_get_path(SYS_PATH).$this->home.$_GET['include']); |
|
218 | 218 | $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
219 | 219 | } else { |
220 | 220 | // Hiding home top when user not connected. |
@@ -244,15 +244,15 @@ discard block |
||
244 | 244 | $home_top_temp = file_get_contents($this->home.'home_top.html'); |
245 | 245 | } else { |
246 | 246 | if (file_exists($this->default_home.'home_top.html')) { |
247 | - $home_top_temp = file_get_contents($this->default_home . 'home_top.html'); |
|
247 | + $home_top_temp = file_get_contents($this->default_home.'home_top.html'); |
|
248 | 248 | } |
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
252 | 252 | if (trim($home_top_temp) == '' && api_is_platform_admin()) { |
253 | - $home_top_temp = '<div class="welcome-mascot">' . get_lang('PortalHomepageDefaultIntroduction') . '</div>'; |
|
253 | + $home_top_temp = '<div class="welcome-mascot">'.get_lang('PortalHomepageDefaultIntroduction').'</div>'; |
|
254 | 254 | } else { |
255 | - $home_top_temp = '<div class="welcome-home-top-temp">' . $home_top_temp . '</div>'; |
|
255 | + $home_top_temp = '<div class="welcome-home-top-temp">'.$home_top_temp.'</div>'; |
|
256 | 256 | } |
257 | 257 | $open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp); |
258 | 258 | $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
@@ -268,9 +268,9 @@ discard block |
||
268 | 268 | |
269 | 269 | $html = ''; |
270 | 270 | // Notice |
271 | - $home_notice = @(string)file_get_contents($sys_path.$this->home.'home_notice_'.$user_selected_language.'.html'); |
|
271 | + $home_notice = @(string) file_get_contents($sys_path.$this->home.'home_notice_'.$user_selected_language.'.html'); |
|
272 | 272 | if (empty($home_notice)) { |
273 | - $home_notice = @(string)file_get_contents($sys_path.$this->home.'home_notice.html'); |
|
273 | + $home_notice = @(string) file_get_contents($sys_path.$this->home.'home_notice.html'); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | if (!empty($home_notice)) { |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | } |
303 | 303 | |
304 | 304 | $html = null; |
305 | - $home_menu = @(string)file_get_contents($sys_path.$this->home.'home_menu_'.$user_selected_language.'.html'); |
|
305 | + $home_menu = @(string) file_get_contents($sys_path.$this->home.'home_menu_'.$user_selected_language.'.html'); |
|
306 | 306 | if (!empty($home_menu)) { |
307 | 307 | $home_menu_content = '<ul class="nav nav-pills nav-stacked">'; |
308 | 308 | $home_menu_content .= api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu))); |
@@ -332,9 +332,9 @@ discard block |
||
332 | 332 | if (!api_is_anonymous()) { |
333 | 333 | $certificatesItem = Display::tag( |
334 | 334 | 'li', |
335 | - Display::url(Display::return_icon('graduation.png',get_lang('MyCertificates'),null,ICON_SIZE_SMALL). |
|
335 | + Display::url(Display::return_icon('graduation.png', get_lang('MyCertificates'), null, ICON_SIZE_SMALL). |
|
336 | 336 | get_lang('MyCertificates'), |
337 | - api_get_path(WEB_CODE_PATH) . "gradebook/my_certificates.php" |
|
337 | + api_get_path(WEB_CODE_PATH)."gradebook/my_certificates.php" |
|
338 | 338 | ) |
339 | 339 | ); |
340 | 340 | } |
@@ -344,29 +344,29 @@ discard block |
||
344 | 344 | if (api_get_setting('allow_public_certificates') == 'true') { |
345 | 345 | $searchItem = Display::tag( |
346 | 346 | 'li', |
347 | - Display::url(Display::return_icon('search_graduation.png',get_lang('Search'),null,ICON_SIZE_SMALL). |
|
347 | + Display::url(Display::return_icon('search_graduation.png', get_lang('Search'), null, ICON_SIZE_SMALL). |
|
348 | 348 | get_lang('Search'), |
349 | - api_get_path(WEB_CODE_PATH) . "gradebook/search.php" |
|
349 | + api_get_path(WEB_CODE_PATH)."gradebook/search.php" |
|
350 | 350 | ) |
351 | 351 | ); |
352 | 352 | } |
353 | 353 | |
354 | 354 | if (empty($certificatesItem) && empty($searchItem)) { |
355 | 355 | return null; |
356 | - }else{ |
|
357 | - $content.= $certificatesItem; |
|
358 | - $content.= $searchItem; |
|
356 | + } else { |
|
357 | + $content .= $certificatesItem; |
|
358 | + $content .= $searchItem; |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | if (api_get_setting('allow_skills_tool') == 'true') { |
362 | 362 | |
363 | - $content .= Display::tag('li', Display::url(Display::return_icon('skill-badges.png',get_lang('MySkills'),null,ICON_SIZE_SMALL).get_lang('MySkills'), api_get_path(WEB_CODE_PATH).'social/my_skills_report.php')); |
|
363 | + $content .= Display::tag('li', Display::url(Display::return_icon('skill-badges.png', get_lang('MySkills'), null, ICON_SIZE_SMALL).get_lang('MySkills'), api_get_path(WEB_CODE_PATH).'social/my_skills_report.php')); |
|
364 | 364 | $allowSkillsManagement = api_get_setting('allow_hr_skills_management') == 'true'; |
365 | 365 | if (($allowSkillsManagement && api_is_drh()) || api_is_platform_admin()) { |
366 | 366 | $content .= Display::tag('li', |
367 | 367 | Display::url(Display::return_icon('edit-skill.png', get_lang('MySkills'), null, |
368 | - ICON_SIZE_SMALL) . get_lang('ManageSkills'), |
|
369 | - api_get_path(WEB_CODE_PATH) . 'admin/skills_wheel.php')); |
|
368 | + ICON_SIZE_SMALL).get_lang('ManageSkills'), |
|
369 | + api_get_path(WEB_CODE_PATH).'admin/skills_wheel.php')); |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | $content .= '</ul>'; |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | FROM $main_category_table t1 |
466 | 466 | LEFT JOIN $main_category_table t2 ON t1.code=t2.parent_id |
467 | 467 | LEFT JOIN $main_course_table t3 ON (t3.category_code = t1.code $platform_visible_courses) |
468 | - WHERE t1.parent_id ". (empty ($category) ? "IS NULL" : "='$category'")." |
|
468 | + WHERE t1.parent_id ".(empty ($category) ? "IS NULL" : "='$category'")." |
|
469 | 469 | GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count ORDER BY t1.tree_pos, t1.name"; |
470 | 470 | |
471 | 471 | // Showing only the category of courses of the current access_url_id |
@@ -542,10 +542,10 @@ discard block |
||
542 | 542 | } |
543 | 543 | $result .= $htmlTitre; |
544 | 544 | if ($thereIsSubCat) { |
545 | - $result .= $htmlListCat; |
|
545 | + $result .= $htmlListCat; |
|
546 | 546 | } |
547 | 547 | while ($categoryName = Database::fetch_array($resCats)) { |
548 | - $result .= '<h3>' . $categoryName['name'] . "</h3>\n"; |
|
548 | + $result .= '<h3>'.$categoryName['name']."</h3>\n"; |
|
549 | 549 | } |
550 | 550 | $numrows = Database::num_rows($sql_result_courses); |
551 | 551 | $courses_list_string = ''; |
@@ -643,12 +643,12 @@ discard block |
||
643 | 643 | if ($courses_shown > 0) { |
644 | 644 | // Only display the list of courses and categories if there was more than |
645 | 645 | // 0 courses visible to the world (we're in the anonymous list here). |
646 | - $result .= $courses_list_string; |
|
646 | + $result .= $courses_list_string; |
|
647 | 647 | } |
648 | 648 | if ($category != '') { |
649 | - $result .= '<p><a href="'.api_get_self().'"> ' . |
|
649 | + $result .= '<p><a href="'.api_get_self().'"> '. |
|
650 | 650 | Display :: return_icon('back.png', get_lang('BackToHomePage')). |
651 | - get_lang('BackToHomePage') . '</a></p>'; |
|
651 | + get_lang('BackToHomePage').'</a></p>'; |
|
652 | 652 | } |
653 | 653 | return $result; |
654 | 654 | } |
@@ -725,14 +725,14 @@ discard block |
||
725 | 725 | ) { |
726 | 726 | if (!empty($idAccordion)) { |
727 | 727 | $html = null; |
728 | - $html .= '<div class="panel-group" id="'.$idAccordion.'" role="tablist" aria-multiselectable="true">' . PHP_EOL; |
|
729 | - $html .= '<div class="panel panel-default" id="'.$id.'">' . PHP_EOL; |
|
730 | - $html .= '<div class="panel-heading" role="tab"><h4 class="panel-title">' . PHP_EOL; |
|
731 | - $html .= '<a role="button" data-toggle="collapse" data-parent="#'.$idAccordion.'" href="#'.$idCollapse.'" aria-expanded="true" aria-controls="'.$idCollapse.'">'.$title.'</a>' . PHP_EOL; |
|
732 | - $html .= '</h4></div>' . PHP_EOL; |
|
733 | - $html .= '<div id="'.$idCollapse.'" class="panel-collapse collapse in" role="tabpanel">' . PHP_EOL; |
|
734 | - $html .= '<div class="panel-body">'.$content.'</div>' . PHP_EOL; |
|
735 | - $html .= '</div></div></div>' . PHP_EOL; |
|
728 | + $html .= '<div class="panel-group" id="'.$idAccordion.'" role="tablist" aria-multiselectable="true">'.PHP_EOL; |
|
729 | + $html .= '<div class="panel panel-default" id="'.$id.'">'.PHP_EOL; |
|
730 | + $html .= '<div class="panel-heading" role="tab"><h4 class="panel-title">'.PHP_EOL; |
|
731 | + $html .= '<a role="button" data-toggle="collapse" data-parent="#'.$idAccordion.'" href="#'.$idCollapse.'" aria-expanded="true" aria-controls="'.$idCollapse.'">'.$title.'</a>'.PHP_EOL; |
|
732 | + $html .= '</h4></div>'.PHP_EOL; |
|
733 | + $html .= '<div id="'.$idCollapse.'" class="panel-collapse collapse in" role="tabpanel">'.PHP_EOL; |
|
734 | + $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL; |
|
735 | + $html .= '</div></div></div>'.PHP_EOL; |
|
736 | 736 | |
737 | 737 | } else { |
738 | 738 | if (!empty($id)) { |
@@ -741,9 +741,9 @@ discard block |
||
741 | 741 | $params['class'] = 'panel panel-default'; |
742 | 742 | $html = null; |
743 | 743 | if (!empty($title)) { |
744 | - $html .= '<div class="panel-heading">'.$title.'</div>' . PHP_EOL; |
|
744 | + $html .= '<div class="panel-heading">'.$title.'</div>'.PHP_EOL; |
|
745 | 745 | } |
746 | - $html.= '<div class="panel-body">'.$content.'</div>' . PHP_EOL; |
|
746 | + $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL; |
|
747 | 747 | $html = Display::div($html, $params); |
748 | 748 | } |
749 | 749 | return $html; |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | $usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id()); |
790 | 790 | $classes = ''; |
791 | 791 | if (!empty($usergroup_list)) { |
792 | - foreach($usergroup_list as $group_id) { |
|
792 | + foreach ($usergroup_list as $group_id) { |
|
793 | 793 | $data = $usergroup->get($group_id); |
794 | 794 | $data['name'] = Display::url($data['name'], api_get_path(WEB_CODE_PATH).'user/classes.php?id='.$data['id']); |
795 | 795 | $classes .= Display::tag('li', $data['name']); |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | if (api_is_platform_admin()) { |
799 | 799 | $classes .= Display::tag( |
800 | 800 | 'li', |
801 | - Display::url(get_lang('AddClasses') ,api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add') |
|
801 | + Display::url(get_lang('AddClasses'), api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add') |
|
802 | 802 | ); |
803 | 803 | } |
804 | 804 | if (!empty($classes)) { |
@@ -820,11 +820,11 @@ discard block |
||
820 | 820 | $content = null; |
821 | 821 | |
822 | 822 | if (api_get_setting('allow_social_tool') == 'true') { |
823 | - $content .= '<a style="text-align:center" href="' . api_get_path(WEB_PATH) . 'main/social/home.php"> |
|
824 | - <img class="img-circle" src="' . $userPicture . '" ></a>'; |
|
823 | + $content .= '<a style="text-align:center" href="'.api_get_path(WEB_PATH).'main/social/home.php"> |
|
824 | + <img class="img-circle" src="' . $userPicture.'" ></a>'; |
|
825 | 825 | } else { |
826 | - $content .= '<a style="text-align:center" href="' . api_get_path(WEB_PATH) . 'main/auth/profile.php"> |
|
827 | - <img class="img-circle" title="' . get_lang('EditProfile') . '" src="' . $userPicture. '" ></a>'; |
|
826 | + $content .= '<a style="text-align:center" href="'.api_get_path(WEB_PATH).'main/auth/profile.php"> |
|
827 | + <img class="img-circle" title="' . get_lang('EditProfile').'" src="'.$userPicture.'" ></a>'; |
|
828 | 828 | } |
829 | 829 | |
830 | 830 | $html = self::show_right_block( |
@@ -876,12 +876,12 @@ discard block |
||
876 | 876 | if (api_get_setting('allow_social_tool') == 'true') { |
877 | 877 | $link = '?f=social'; |
878 | 878 | } |
879 | - $profile_content .= '<li class="inbox-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php'.$link.'">'.Display::return_icon('inbox.png',get_lang('Inbox'),null,ICON_SIZE_SMALL).get_lang('Inbox').$cant_msg.' </a></li>'; |
|
880 | - $profile_content .= '<li class="new-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php'.$link.'">'.Display::return_icon('new-message.png',get_lang('Compose'),null,ICON_SIZE_SMALL).get_lang('Compose').' </a></li>'; |
|
879 | + $profile_content .= '<li class="inbox-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php'.$link.'">'.Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_SMALL).get_lang('Inbox').$cant_msg.' </a></li>'; |
|
880 | + $profile_content .= '<li class="new-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php'.$link.'">'.Display::return_icon('new-message.png', get_lang('Compose'), null, ICON_SIZE_SMALL).get_lang('Compose').' </a></li>'; |
|
881 | 881 | |
882 | 882 | if (api_get_setting('allow_social_tool') == 'true') { |
883 | 883 | $total_invitations = Display::badge($total_invitations); |
884 | - $profile_content .= '<li class="invitations-social"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitations.png',get_lang('PendingInvitations'),null,ICON_SIZE_SMALL).get_lang('PendingInvitations').$total_invitations.'</a></li>'; |
|
884 | + $profile_content .= '<li class="invitations-social"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitations.png', get_lang('PendingInvitations'), null, ICON_SIZE_SMALL).get_lang('PendingInvitations').$total_invitations.'</a></li>'; |
|
885 | 885 | } |
886 | 886 | |
887 | 887 | if (isset($_configuration['allow_my_files_link_in_homepage']) && $_configuration['allow_my_files_link_in_homepage']) { |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | |
898 | 898 | $editProfileUrl = Display::getProfileEditionLink($user_id); |
899 | 899 | |
900 | - $profile_content .= '<li class="profile-social"><a href="' . $editProfileUrl . '">'.Display::return_icon('edit-profile.png',get_lang('EditProfile'),null,ICON_SIZE_SMALL).get_lang('EditProfile').'</a></li>'; |
|
900 | + $profile_content .= '<li class="profile-social"><a href="'.$editProfileUrl.'">'.Display::return_icon('edit-profile.png', get_lang('EditProfile'), null, ICON_SIZE_SMALL).get_lang('EditProfile').'</a></li>'; |
|
901 | 901 | $profile_content .= '</ul>'; |
902 | 902 | $html = self::show_right_block( |
903 | 903 | get_lang('Profile'), |
@@ -972,17 +972,17 @@ discard block |
||
972 | 972 | if ($show_create_link) { |
973 | 973 | $my_account_content .= '<li class="add-course"><a href="main/create_course/add_course.php">'; |
974 | 974 | if (api_get_setting('course_validation') == 'true' && !api_is_platform_admin()) { |
975 | - $my_account_content .= Display::return_icon('new-course.png',get_lang('CreateCourseRequest'),null,ICON_SIZE_SMALL); |
|
975 | + $my_account_content .= Display::return_icon('new-course.png', get_lang('CreateCourseRequest'), null, ICON_SIZE_SMALL); |
|
976 | 976 | $my_account_content .= get_lang('CreateCourseRequest'); |
977 | 977 | } else { |
978 | - $my_account_content .= Display::return_icon('new-course.png',get_lang('CourseCreate'),null,ICON_SIZE_SMALL); |
|
978 | + $my_account_content .= Display::return_icon('new-course.png', get_lang('CourseCreate'), null, ICON_SIZE_SMALL); |
|
979 | 979 | $my_account_content .= get_lang('CourseCreate'); |
980 | 980 | } |
981 | 981 | $my_account_content .= '</a></li>'; |
982 | 982 | |
983 | 983 | if (SessionManager::allowToManageSessions()) { |
984 | 984 | $my_account_content .= '<li class="add-course"><a href="main/session/session_add.php">'; |
985 | - $my_account_content .= Display::return_icon('session.png',get_lang('AddSession'),null,ICON_SIZE_SMALL); |
|
985 | + $my_account_content .= Display::return_icon('session.png', get_lang('AddSession'), null, ICON_SIZE_SMALL); |
|
986 | 986 | $my_account_content .= get_lang('AddSession'); |
987 | 987 | $my_account_content .= '</a></li>'; |
988 | 988 | } |
@@ -990,21 +990,21 @@ discard block |
||
990 | 990 | |
991 | 991 | //Sort courses |
992 | 992 | $url = api_get_path(WEB_CODE_PATH).'auth/courses.php?action=sortmycourses'; |
993 | - $img_order= Display::return_icon('order-course.png',get_lang('SortMyCourses'),null,ICON_SIZE_SMALL); |
|
993 | + $img_order = Display::return_icon('order-course.png', get_lang('SortMyCourses'), null, ICON_SIZE_SMALL); |
|
994 | 994 | $my_account_content .= '<li class="order-course">'.Display::url($img_order.get_lang('SortMyCourses'), $url, array('class' => 'sort course')).'</li>'; |
995 | 995 | |
996 | 996 | // Session history |
997 | 997 | if (isset($_GET['history']) && intval($_GET['history']) == 1) { |
998 | - $my_account_content .= '<li class="history-course"><a href="user_portal.php">'.Display::return_icon('history-course.png',get_lang('DisplayTrainingList'),null,ICON_SIZE_SMALL).get_lang('DisplayTrainingList').'</a></li>'; |
|
998 | + $my_account_content .= '<li class="history-course"><a href="user_portal.php">'.Display::return_icon('history-course.png', get_lang('DisplayTrainingList'), null, ICON_SIZE_SMALL).get_lang('DisplayTrainingList').'</a></li>'; |
|
999 | 999 | } else { |
1000 | - $my_account_content .= '<li class="history-course"><a href="user_portal.php?history=1" >'.Display::return_icon('history-course.png',get_lang('HistoryTrainingSessions'),null,ICON_SIZE_SMALL).get_lang('HistoryTrainingSessions').'</a></li>'; |
|
1000 | + $my_account_content .= '<li class="history-course"><a href="user_portal.php?history=1" >'.Display::return_icon('history-course.png', get_lang('HistoryTrainingSessions'), null, ICON_SIZE_SMALL).get_lang('HistoryTrainingSessions').'</a></li>'; |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | // Course catalog |
1004 | 1004 | |
1005 | 1005 | if ($show_course_link) { |
1006 | 1006 | if (!api_is_drh()) { |
1007 | - $my_account_content .= '<li class="list-course"><a href="main/auth/courses.php" >'.Display::return_icon('catalog-course.png',get_lang('CourseCatalog'),null,ICON_SIZE_SMALL).get_lang('CourseCatalog').'</a></li>'; |
|
1007 | + $my_account_content .= '<li class="list-course"><a href="main/auth/courses.php" >'.Display::return_icon('catalog-course.png', get_lang('CourseCatalog'), null, ICON_SIZE_SMALL).get_lang('CourseCatalog').'</a></li>'; |
|
1008 | 1008 | } else { |
1009 | 1009 | $my_account_content .= '<li><a href="main/dashboard/index.php">'.get_lang('Dashboard').'</a></li>'; |
1010 | 1010 | } |
@@ -1183,10 +1183,10 @@ discard block |
||
1183 | 1183 | |
1184 | 1184 | $extra_info = !empty($session_box['coach']) ? $session_box['coach'] : null; |
1185 | 1185 | $extra_info .= !empty($session_box['coach']) |
1186 | - ? ' - ' . $session_box['dates'] |
|
1186 | + ? ' - '.$session_box['dates'] |
|
1187 | 1187 | : $session_box['dates']; |
1188 | 1188 | $extra_info .= isset($session_box['duration']) |
1189 | - ? ' ' . $session_box['duration'] |
|
1189 | + ? ' '.$session_box['duration'] |
|
1190 | 1190 | : null; |
1191 | 1191 | |
1192 | 1192 | $params['extra_fields'] = $session_box['extra_fields']; |
@@ -1308,8 +1308,8 @@ discard block |
||
1308 | 1308 | $sessionParams['course_list_session_style'] = $coursesListSessionStyle; |
1309 | 1309 | $sessionParams['title'] = $session_box['title']; |
1310 | 1310 | $sessionParams['subtitle'] = (!empty($session_box['coach']) |
1311 | - ? $session_box['coach'] . ' | ' |
|
1312 | - : '') . $session_box['dates']; |
|
1311 | + ? $session_box['coach'].' | ' |
|
1312 | + : '').$session_box['dates']; |
|
1313 | 1313 | $sessionParams['show_actions'] = api_is_platform_admin(); |
1314 | 1314 | $sessionParams['courses'] = $html_courses_session; |
1315 | 1315 | $sessionParams['show_simple_session_info'] = false; |
@@ -1359,14 +1359,14 @@ discard block |
||
1359 | 1359 | !empty($session_category_start_date) && |
1360 | 1360 | $session_category_start_date != '0000-00-00' |
1361 | 1361 | ) { |
1362 | - $categoryParams['subtitle'] = get_lang('From') . ' ' . $session_category_start_date; |
|
1362 | + $categoryParams['subtitle'] = get_lang('From').' '.$session_category_start_date; |
|
1363 | 1363 | } |
1364 | 1364 | |
1365 | 1365 | if ( |
1366 | 1366 | !empty($session_category_end_date) && |
1367 | 1367 | $session_category_end_date != '0000-00-00' |
1368 | 1368 | ) { |
1369 | - $categoryParams['subtitle'] = get_lang('Until') . ' ' . $session_category_end_date; |
|
1369 | + $categoryParams['subtitle'] = get_lang('Until').' '.$session_category_end_date; |
|
1370 | 1370 | } |
1371 | 1371 | } |
1372 | 1372 | |
@@ -1440,7 +1440,7 @@ discard block |
||
1440 | 1440 | if ($load_history) { |
1441 | 1441 | $html .= Display::page_subheader(get_lang('HistoryTrainingSession')); |
1442 | 1442 | if (empty($session_categories)) { |
1443 | - $html .= get_lang('YouDoNotHaveAnySessionInItsHistory'); |
|
1443 | + $html .= get_lang('YouDoNotHaveAnySessionInItsHistory'); |
|
1444 | 1444 | } |
1445 | 1445 | } |
1446 | 1446 | |
@@ -1513,7 +1513,7 @@ discard block |
||
1513 | 1513 | } else { |
1514 | 1514 | $htmlCategory .= '<div class="session-view-row" >'; |
1515 | 1515 | } |
1516 | - $coursesInfo = $listCourse['course']; |
|
1516 | + $coursesInfo = $listCourse['course']; |
|
1517 | 1517 | |
1518 | 1518 | $htmlCategory .= self::getHtmlForCourse( |
1519 | 1519 | $coursesInfo, |
@@ -1530,7 +1530,7 @@ discard block |
||
1530 | 1530 | $listCategorySession['catSessionName'] |
1531 | 1531 | ); |
1532 | 1532 | // list of session |
1533 | - $htmlSession = ''; // start |
|
1533 | + $htmlSession = ''; // start |
|
1534 | 1534 | foreach ($listCategorySession['sessionList'] as $k => $listSession) { |
1535 | 1535 | // add session |
1536 | 1536 | $htmlSession .= '<div class="session-view-row">'; |
@@ -1547,8 +1547,8 @@ discard block |
||
1547 | 1547 | $htmlSessionCategory .= $htmlSession; |
1548 | 1548 | } |
1549 | 1549 | $htmlSessionCategory .= '</div>'; // end session cat block |
1550 | - $htmlCategory .= $htmlSessionCategory .'</div>' ; |
|
1551 | - $htmlCategory .= ''; // end course block |
|
1550 | + $htmlCategory .= $htmlSessionCategory.'</div>'; |
|
1551 | + $htmlCategory .= ''; // end course block |
|
1552 | 1552 | } |
1553 | 1553 | $userCategoryHtml .= $htmlCategory; |
1554 | 1554 | } |
@@ -1573,11 +1573,11 @@ discard block |
||
1573 | 1573 | } |
1574 | 1574 | } |
1575 | 1575 | $htmlCategory .= ''; |
1576 | - $userCategoryHtml .= $htmlCategory; // end user cat block |
|
1576 | + $userCategoryHtml .= $htmlCategory; // end user cat block |
|
1577 | 1577 | if ($userCategoryId != 0) { |
1578 | 1578 | $userCategoryHtml .= '</div>'; |
1579 | 1579 | } |
1580 | - $html .= $userCategoryHtml; // |
|
1580 | + $html .= $userCategoryHtml; // |
|
1581 | 1581 | } |
1582 | 1582 | $html .= '</div>'; |
1583 | 1583 | |
@@ -1718,11 +1718,11 @@ discard block |
||
1718 | 1718 | $html = ''; |
1719 | 1719 | |
1720 | 1720 | if ($categorySessionId == 0) { |
1721 | - $class1 = 'session-view-lvl-2'; // session |
|
1722 | - $class2 = 'session-view-lvl-4'; // got to course in session link |
|
1721 | + $class1 = 'session-view-lvl-2'; // session |
|
1722 | + $class2 = 'session-view-lvl-4'; // got to course in session link |
|
1723 | 1723 | } else { |
1724 | - $class1 = 'session-view-lvl-3'; // session |
|
1725 | - $class2 = 'session-view-lvl-5'; // got to course in session link |
|
1724 | + $class1 = 'session-view-lvl-3'; // session |
|
1725 | + $class2 = 'session-view-lvl-5'; // got to course in session link |
|
1726 | 1726 | } |
1727 | 1727 | |
1728 | 1728 | $icon = Display::return_icon( |
@@ -1750,7 +1750,7 @@ discard block |
||
1750 | 1750 | if ($listA['userCatTitle'] == $listB['userCatTitle']) { |
1751 | 1751 | if ($listA['title'] == $listB['title']) { |
1752 | 1752 | return 0; |
1753 | - } else if($listA['title'] > $listB['title']) { |
|
1753 | + } else if ($listA['title'] > $listB['title']) { |
|
1754 | 1754 | return 1; |
1755 | 1755 | } else { |
1756 | 1756 | return -1; |
@@ -1771,7 +1771,7 @@ discard block |
||
1771 | 1771 | { |
1772 | 1772 | if ($listA['title'] == $listB['title']) { |
1773 | 1773 | return 0; |
1774 | - } else if($listA['title'] > $listB['title']) { |
|
1774 | + } else if ($listA['title'] > $listB['title']) { |
|
1775 | 1775 | return 1; |
1776 | 1776 | } else { |
1777 | 1777 | return -1; |
@@ -73,8 +73,9 @@ |
||
73 | 73 | //$form->addElement('submit','submit',get_lang('Filter')); |
74 | 74 | $form->addButtonFilter(get_lang('Filter')); |
75 | 75 | |
76 | -if (!empty($_REQUEST['course_code'])) |
|
76 | +if (!empty($_REQUEST['course_code'])) { |
|
77 | 77 | $selected_course = $_REQUEST['course_code']; |
78 | +} |
|
78 | 79 | if (!empty($selected_course)) { |
79 | 80 | $selected_course = api_get_course_info($selected_course); |
80 | 81 | $course_list = array($selected_course); |
@@ -16,34 +16,34 @@ discard block |
||
16 | 16 | $is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || $is_courseCoach || $is_sessionAdmin; |
17 | 17 | |
18 | 18 | if (!$is_allowedToTrack) { |
19 | - Display :: display_header(null); |
|
20 | - api_not_allowed(); |
|
21 | - Display :: display_footer(); |
|
19 | + Display :: display_header(null); |
|
20 | + api_not_allowed(); |
|
21 | + Display :: display_footer(); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | $export_to_csv = false; |
25 | 25 | if (isset($_GET['export'])) { |
26 | - $export_to_csv = true; |
|
26 | + $export_to_csv = true; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | if (api_is_platform_admin() ) { |
30 | - $global = true; |
|
30 | + $global = true; |
|
31 | 31 | } else { |
32 | - $global = false; |
|
32 | + $global = false; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | if ($global) { |
36 | - $temp_course_list = CourseManager :: get_courses_list(); |
|
37 | - foreach($temp_course_list as $temp_course_item) { |
|
38 | - $course_item = CourseManager ::get_course_information($temp_course_item['code']); |
|
36 | + $temp_course_list = CourseManager :: get_courses_list(); |
|
37 | + foreach($temp_course_list as $temp_course_item) { |
|
38 | + $course_item = CourseManager ::get_course_information($temp_course_item['code']); |
|
39 | 39 | $course_list[] = array( |
40 | 40 | 'code' => $course_item['code'], |
41 | 41 | 'title' => $course_item['title'], |
42 | 42 | ); |
43 | - } |
|
43 | + } |
|
44 | 44 | } else { |
45 | 45 | $current_course['code'] = $_course['id']; |
46 | - $course_list = array($current_course); |
|
46 | + $course_list = array($current_course); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $new_course_select = array(); |
@@ -54,20 +54,20 @@ discard block |
||
54 | 54 | $form = new FormValidator('search_simple', 'POST', '', '', null, false); |
55 | 55 | $form->addElement('select','course_code',get_lang('Course'), $new_course_select); |
56 | 56 | if ($global) { |
57 | - $form->addElement('hidden','view','admin'); |
|
57 | + $form->addElement('hidden','view','admin'); |
|
58 | 58 | } else { |
59 | - //Get exam lists |
|
59 | + //Get exam lists |
|
60 | 60 | $course_id = api_get_course_int_id(); |
61 | - $t_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
62 | - $sqlExercices = "SELECT quiz.title,id FROM ".$t_quiz." AS quiz |
|
61 | + $t_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
62 | + $sqlExercices = "SELECT quiz.title,id FROM ".$t_quiz." AS quiz |
|
63 | 63 | WHERE c_id = $course_id AND active='1' |
64 | 64 | ORDER BY quiz.title ASC"; |
65 | - $resultExercices = Database::query($sqlExercices); |
|
66 | - $exercise_list[0] = get_lang('All'); |
|
67 | - while($a_exercices = Database::fetch_array($resultExercices)) { |
|
68 | - $exercise_list[$a_exercices['id']] = $a_exercices['title']; |
|
69 | - } |
|
70 | - $form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list); |
|
65 | + $resultExercices = Database::query($sqlExercices); |
|
66 | + $exercise_list[0] = get_lang('All'); |
|
67 | + while($a_exercices = Database::fetch_array($resultExercices)) { |
|
68 | + $exercise_list[$a_exercices['id']] = $a_exercices['title']; |
|
69 | + } |
|
70 | + $form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | //$form->addElement('submit','submit',get_lang('Filter')); |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | if (!$export_to_csv) { |
84 | - Display :: display_header(get_lang('Reporting')); |
|
85 | - echo '<div class="actions" style ="font-size:10pt;">'; |
|
86 | - if ($global) { |
|
84 | + Display :: display_header(get_lang('Reporting')); |
|
85 | + echo '<div class="actions" style ="font-size:10pt;">'; |
|
86 | + if ($global) { |
|
87 | 87 | |
88 | 88 | echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'"> |
89 | 89 | '.Display::return_icon('csv.gif').' |
@@ -93,81 +93,81 @@ discard block |
||
93 | 93 | '.get_lang('Print').'</a> |
94 | 94 | </div>'; |
95 | 95 | |
96 | - $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher">'.get_lang('TeacherInterface').'</a>'; |
|
96 | + $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher">'.get_lang('TeacherInterface').'</a>'; |
|
97 | 97 | if (api_is_platform_admin()) { |
98 | - $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=admin">'.get_lang('AdminInterface').'</a>'; |
|
98 | + $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=admin">'.get_lang('AdminInterface').'</a>'; |
|
99 | 99 | } else { |
100 | 100 | $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=coach">'.get_lang('AdminInterface').'</a>'; |
101 | 101 | } |
102 | - $menu_items[] = get_lang('ExamTracking'); |
|
103 | - $nb_menu_items = count($menu_items); |
|
104 | - if($nb_menu_items>1) { |
|
105 | - foreach($menu_items as $key=> $item) { |
|
106 | - echo $item; |
|
107 | - if($key!=$nb_menu_items-1) { |
|
108 | - echo ' | '; |
|
109 | - } |
|
110 | - } |
|
111 | - echo '<br />'; |
|
112 | - } |
|
113 | - } else { |
|
114 | - echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=true">'.get_lang('StudentsTracking').'</a> | |
|
102 | + $menu_items[] = get_lang('ExamTracking'); |
|
103 | + $nb_menu_items = count($menu_items); |
|
104 | + if($nb_menu_items>1) { |
|
105 | + foreach($menu_items as $key=> $item) { |
|
106 | + echo $item; |
|
107 | + if($key!=$nb_menu_items-1) { |
|
108 | + echo ' | '; |
|
109 | + } |
|
110 | + } |
|
111 | + echo '<br />'; |
|
112 | + } |
|
113 | + } else { |
|
114 | + echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=true">'.get_lang('StudentsTracking').'</a> | |
|
115 | 115 | <a href="courseLog.php?'.api_get_cidreq().'&studentlist=false">'.get_lang('CourseTracking').'</a> | '; |
116 | 116 | echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=resources">'.get_lang('ResourcesTracking').'</a>'; |
117 | - echo ' | '.get_lang('ExamTracking').''; |
|
117 | + echo ' | '.get_lang('ExamTracking').''; |
|
118 | 118 | echo '<a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'"> |
119 | 119 | '.Display::return_icon('excel.gif').' |
120 | 120 | '.get_lang('ExportAsXLS').'</a><br /><br />'; |
121 | 121 | |
122 | - } |
|
122 | + } |
|
123 | 123 | echo '</div>'; |
124 | - echo '<br /><br />'; |
|
125 | - $form->display(); |
|
124 | + echo '<br /><br />'; |
|
125 | + $form->display(); |
|
126 | 126 | } |
127 | 127 | $main_result = array(); |
128 | 128 | $session_id = 0; |
129 | 129 | $user_list = array(); |
130 | 130 | // Getting course list |
131 | 131 | foreach ($course_list as $current_course ) { |
132 | - $course_info = api_get_course_info($current_course['code']); |
|
133 | - $_course = $course_info; |
|
134 | - |
|
135 | - // Getting LP list |
|
136 | - $list = new LearnpathList('', $current_course['code'], $session_id); |
|
137 | - $lp_list = $list->get_flat_list(); |
|
138 | - |
|
139 | - // Looping LPs |
|
140 | - $lps = array(); |
|
141 | - foreach ($lp_list as $lp_id =>$lp) { |
|
142 | - $exercise_list = Event::get_all_exercises_from_lp($lp_id, $course_info['real_id']); |
|
143 | - $attempt_result = array(); |
|
144 | - // Looping Chamilo Exercises in LP |
|
145 | - foreach ($exercise_list as $exercise) { |
|
146 | - $exercise_stats = Event::get_all_exercise_event_from_lp( |
|
147 | - $exercise['path'], |
|
148 | - $course_info['real_id'], |
|
149 | - $session_id |
|
150 | - ); |
|
151 | - // Looping Exercise Attempts |
|
152 | - foreach ($exercise_stats as $stats) { |
|
153 | - $attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = $stats; |
|
154 | - $user_list[$stats['exe_user_id']] = $stats['exe_user_id']; |
|
155 | - } |
|
156 | - $exercise_list_name[$exercise['id']] = $exercise['title']; |
|
157 | - } |
|
158 | - $lps[$lp_id] = array('lp_name' =>$lp['lp_name'], 'exercises' =>$attempt_result); |
|
159 | - $lp_list_name[$lp_id] = $lp['lp_name']; |
|
160 | - } |
|
161 | - $main_result[$current_course['code']] = $lps; |
|
132 | + $course_info = api_get_course_info($current_course['code']); |
|
133 | + $_course = $course_info; |
|
134 | + |
|
135 | + // Getting LP list |
|
136 | + $list = new LearnpathList('', $current_course['code'], $session_id); |
|
137 | + $lp_list = $list->get_flat_list(); |
|
138 | + |
|
139 | + // Looping LPs |
|
140 | + $lps = array(); |
|
141 | + foreach ($lp_list as $lp_id =>$lp) { |
|
142 | + $exercise_list = Event::get_all_exercises_from_lp($lp_id, $course_info['real_id']); |
|
143 | + $attempt_result = array(); |
|
144 | + // Looping Chamilo Exercises in LP |
|
145 | + foreach ($exercise_list as $exercise) { |
|
146 | + $exercise_stats = Event::get_all_exercise_event_from_lp( |
|
147 | + $exercise['path'], |
|
148 | + $course_info['real_id'], |
|
149 | + $session_id |
|
150 | + ); |
|
151 | + // Looping Exercise Attempts |
|
152 | + foreach ($exercise_stats as $stats) { |
|
153 | + $attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = $stats; |
|
154 | + $user_list[$stats['exe_user_id']] = $stats['exe_user_id']; |
|
155 | + } |
|
156 | + $exercise_list_name[$exercise['id']] = $exercise['title']; |
|
157 | + } |
|
158 | + $lps[$lp_id] = array('lp_name' =>$lp['lp_name'], 'exercises' =>$attempt_result); |
|
159 | + $lp_list_name[$lp_id] = $lp['lp_name']; |
|
160 | + } |
|
161 | + $main_result[$current_course['code']] = $lps; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | if (!empty($user_list)) { |
165 | 165 | foreach($user_list as $user_id) { |
166 | 166 | $user_data = api_get_user_info($user_id); |
167 | - $user_list_name[$user_id] = api_get_person_name( |
|
168 | - $user_data['firstname'], |
|
169 | - $user_data['lastname'] |
|
170 | - ); |
|
167 | + $user_list_name[$user_id] = api_get_person_name( |
|
168 | + $user_data['firstname'], |
|
169 | + $user_data['lastname'] |
|
170 | + ); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | $export_array = array(); |
@@ -207,15 +207,15 @@ discard block |
||
207 | 207 | $html_result .= Display::tag('td', $result); |
208 | 208 | |
209 | 209 | $html_result .= '</tr>'; |
210 | - $export_array[] = array( |
|
211 | - $course_code, |
|
212 | - $lp_list_name[$lp_id], |
|
213 | - $exercise_list_name[$exercise_id], |
|
214 | - $user_list_name[$user_id], |
|
215 | - $attempt, |
|
216 | - api_get_local_time($attempt_data['exe_date']), |
|
217 | - $result, |
|
218 | - ); |
|
210 | + $export_array[] = array( |
|
211 | + $course_code, |
|
212 | + $lp_list_name[$lp_id], |
|
213 | + $exercise_list_name[$exercise_id], |
|
214 | + $user_list_name[$user_id], |
|
215 | + $attempt, |
|
216 | + api_get_local_time($attempt_data['exe_date']), |
|
217 | + $result, |
|
218 | + ); |
|
219 | 219 | $attempt++; |
220 | 220 | } |
221 | 221 | } |
@@ -226,30 +226,30 @@ discard block |
||
226 | 226 | } |
227 | 227 | |
228 | 228 | if (!$export_to_csv) { |
229 | - echo $html_result; |
|
229 | + echo $html_result; |
|
230 | 230 | } |
231 | 231 | $filename = 'learning_path_results-'.date('Y-m-d-h:i:s').'.xls'; |
232 | 232 | if ($export_to_csv) { |
233 | 233 | export_complete_report_csv($filename, $export_array); |
234 | - exit; |
|
234 | + exit; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | function export_complete_report_csv($filename, $array) |
238 | 238 | { |
239 | - $header[] = array( |
|
240 | - get_lang('Course'), |
|
241 | - get_lang('LearningPath'), |
|
242 | - get_lang('Exercise'), |
|
243 | - get_lang('User'), |
|
244 | - get_lang('Attempt'), |
|
245 | - get_lang('Date'), |
|
246 | - get_lang('Results'), |
|
247 | - ); |
|
248 | - if (!empty($array)) { |
|
249 | - $array = array_merge($header, $array); |
|
250 | - Export :: arrayToCsv($array, $filename); |
|
251 | - } |
|
252 | - exit; |
|
239 | + $header[] = array( |
|
240 | + get_lang('Course'), |
|
241 | + get_lang('LearningPath'), |
|
242 | + get_lang('Exercise'), |
|
243 | + get_lang('User'), |
|
244 | + get_lang('Attempt'), |
|
245 | + get_lang('Date'), |
|
246 | + get_lang('Results'), |
|
247 | + ); |
|
248 | + if (!empty($array)) { |
|
249 | + $array = array_merge($header, $array); |
|
250 | + Export :: arrayToCsv($array, $filename); |
|
251 | + } |
|
252 | + exit; |
|
253 | 253 | |
254 | 254 | } |
255 | 255 | Display :: display_footer(); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $export_to_csv = true; |
27 | 27 | } |
28 | 28 | |
29 | -if (api_is_platform_admin() ) { |
|
29 | +if (api_is_platform_admin()) { |
|
30 | 30 | $global = true; |
31 | 31 | } else { |
32 | 32 | $global = false; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | if ($global) { |
36 | 36 | $temp_course_list = CourseManager :: get_courses_list(); |
37 | - foreach($temp_course_list as $temp_course_item) { |
|
37 | + foreach ($temp_course_list as $temp_course_item) { |
|
38 | 38 | $course_item = CourseManager ::get_course_information($temp_course_item['code']); |
39 | 39 | $course_list[] = array( |
40 | 40 | 'code' => $course_item['code'], |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | $new_course_select = array(); |
50 | -foreach($course_list as $data) { |
|
50 | +foreach ($course_list as $data) { |
|
51 | 51 | $new_course_select[$data['code']] = $data['title']; |
52 | 52 | } |
53 | 53 | |
54 | 54 | $form = new FormValidator('search_simple', 'POST', '', '', null, false); |
55 | -$form->addElement('select','course_code',get_lang('Course'), $new_course_select); |
|
55 | +$form->addElement('select', 'course_code', get_lang('Course'), $new_course_select); |
|
56 | 56 | if ($global) { |
57 | - $form->addElement('hidden','view','admin'); |
|
57 | + $form->addElement('hidden', 'view', 'admin'); |
|
58 | 58 | } else { |
59 | 59 | //Get exam lists |
60 | 60 | $course_id = api_get_course_int_id(); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | ORDER BY quiz.title ASC"; |
65 | 65 | $resultExercices = Database::query($sqlExercices); |
66 | 66 | $exercise_list[0] = get_lang('All'); |
67 | - while($a_exercices = Database::fetch_array($resultExercices)) { |
|
67 | + while ($a_exercices = Database::fetch_array($resultExercices)) { |
|
68 | 68 | $exercise_list[$a_exercices['id']] = $a_exercices['title']; |
69 | 69 | } |
70 | 70 | $form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'"> |
89 | 89 | '.Display::return_icon('csv.gif').' |
90 | - '.get_lang('ExportAsCSV').'</a>' . |
|
90 | + '.get_lang('ExportAsCSV').'</a>'. |
|
91 | 91 | '<a href="javascript: void(0);" onclick="javascript: window.print()"> |
92 | 92 | '.Display::return_icon('printmgr.gif').' |
93 | 93 | '.get_lang('Print').'</a> |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | } |
102 | 102 | $menu_items[] = get_lang('ExamTracking'); |
103 | 103 | $nb_menu_items = count($menu_items); |
104 | - if($nb_menu_items>1) { |
|
105 | - foreach($menu_items as $key=> $item) { |
|
104 | + if ($nb_menu_items > 1) { |
|
105 | + foreach ($menu_items as $key=> $item) { |
|
106 | 106 | echo $item; |
107 | - if($key!=$nb_menu_items-1) { |
|
107 | + if ($key != $nb_menu_items - 1) { |
|
108 | 108 | echo ' | '; |
109 | 109 | } |
110 | 110 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $session_id = 0; |
129 | 129 | $user_list = array(); |
130 | 130 | // Getting course list |
131 | -foreach ($course_list as $current_course ) { |
|
131 | +foreach ($course_list as $current_course) { |
|
132 | 132 | $course_info = api_get_course_info($current_course['code']); |
133 | 133 | $_course = $course_info; |
134 | 134 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | if (!empty($user_list)) { |
165 | - foreach($user_list as $user_id) { |
|
165 | + foreach ($user_list as $user_id) { |
|
166 | 166 | $user_data = api_get_user_info($user_id); |
167 | 167 | $user_list_name[$user_id] = api_get_person_name( |
168 | 168 | $user_data['firstname'], |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | ); |
171 | 171 | } |
172 | 172 | } |
173 | -$export_array = array(); |
|
173 | +$export_array = array(); |
|
174 | 174 | if (!empty($main_result)) { |
175 | 175 | |
176 | 176 | $html_result .= '<table class="data_table">'; |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | |
194 | 194 | foreach ($exercises as $exercise_id => $exercise_data) { |
195 | 195 | $users = $exercise_data['users']; |
196 | - foreach($users as $user_id => $attempts) { |
|
196 | + foreach ($users as $user_id => $attempts) { |
|
197 | 197 | $attempt = 1; |
198 | - foreach($attempts as $exe_id => $attempt_data) { |
|
198 | + foreach ($attempts as $exe_id => $attempt_data) { |
|
199 | 199 | $html_result .= '<tr colspan="">'; |
200 | 200 | $html_result .= Display::tag('td', $course_code); |
201 | 201 | $html_result .= Display::tag('td', $lp_list_name[$lp_id]); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | } |
224 | 224 | } |
225 | - $html_result .='</table>'; |
|
225 | + $html_result .= '</table>'; |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | if (!$export_to_csv) { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | $nameTools = get_lang('ToolName'); |
25 | 25 | |
26 | -$interbreadcrumb[]= array ("url"=>"courseLog.php", "name"=> "Statistics"); |
|
26 | +$interbreadcrumb[] = array("url"=>"courseLog.php", "name"=> "Statistics"); |
|
27 | 27 | |
28 | 28 | $htmlHeadXtra[] = "<style type='text/css'> |
29 | 29 | /*<![CDATA[*/ |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | td {border-bottom: thin dashed gray;} |
41 | 41 | /*]]>*/ |
42 | 42 | </style>"; |
43 | -Display::display_header($nameTools,"Tracking"); |
|
43 | +Display::display_header($nameTools, "Tracking"); |
|
44 | 44 | ?> |
45 | 45 | |
46 | 46 | <h3> |
@@ -59,16 +59,16 @@ discard block |
||
59 | 59 | // Defining the months of the year to allow translation of the months |
60 | 60 | $MonthsShort = api_get_months_short(); |
61 | 61 | |
62 | -$tool=$_REQUEST['tool']; |
|
63 | -$period=$_REQUEST['period']; |
|
64 | -$reqdate=$_REQUEST['reqdate']; |
|
62 | +$tool = $_REQUEST['tool']; |
|
63 | +$period = $_REQUEST['period']; |
|
64 | +$reqdate = $_REQUEST['reqdate']; |
|
65 | 65 | ?> |
66 | 66 | <table width="100%" cellpadding="2" cellspacing="0" border="0"> |
67 | 67 | <?php |
68 | 68 | $TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
69 | 69 | $courseId = api_get_course_int_id(); |
70 | 70 | //stats for the current course |
71 | - if(isset($_cid)) { |
|
71 | + if (isset($_cid)) { |
|
72 | 72 | // to see stats of one course user must be courseAdmin of this course |
73 | 73 | $is_allowedToTrack = $is_courseAdmin; |
74 | 74 | $courseCodeEqualcidIfNeeded = "AND c_id = '$courseId'"; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $is_allowedToTrack = $is_platformAdmin; |
79 | 79 | $courseCodeEqualcidIfNeeded = ""; |
80 | 80 | } |
81 | - if( $is_allowedToTrack) { |
|
81 | + if ($is_allowedToTrack) { |
|
82 | 82 | // list of all tools |
83 | 83 | if (!isset($tool)) { |
84 | 84 | $sql = "SELECT access_tool, count( access_tool ) |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | echo "<tr> |
91 | 91 | <td> |
92 | 92 | "; |
93 | - if(isset($_cid)) echo "<b>$_cid : </b>"; |
|
93 | + if (isset($_cid)) echo "<b>$_cid : </b>"; |
|
94 | 94 | echo " <b>".get_lang('ToolList')."</b> |
95 | 95 | </td> |
96 | 96 | </tr> |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | </tr>"; |
109 | 109 | if (is_array($results)) |
110 | 110 | { |
111 | - for($j = 0 ; $j < count($results) ; $j++) |
|
111 | + for ($j = 0; $j < count($results); $j++) |
|
112 | 112 | { |
113 | 113 | echo "<tr>"; |
114 | 114 | echo "<td><a href='toolaccess_details.php?tool=".urlencode($results[$j][0])."'>".get_lang($results[$j][0])."</a></td>"; |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | $encodedTool = urlencode($tool); |
132 | 132 | $tool = urldecode($tool); |
133 | 133 | |
134 | - if( !isset($reqdate) ) |
|
134 | + if (!isset($reqdate)) |
|
135 | 135 | $reqdate = time(); |
136 | 136 | echo "<tr> |
137 | 137 | <td> |
138 | 138 | "; |
139 | - if(isset($_cid)) echo "<b>$_cid : </b>"; |
|
139 | + if (isset($_cid)) echo "<b>$_cid : </b>"; |
|
140 | 140 | echo " <b>".get_lang($tool)."</b> |
141 | 141 | </td> |
142 | 142 | </tr> |
@@ -145,22 +145,22 @@ discard block |
||
145 | 145 | /* ------ display ------ */ |
146 | 146 | // displayed period |
147 | 147 | echo "<tr><td>"; |
148 | - switch($period) |
|
148 | + switch ($period) |
|
149 | 149 | { |
150 | 150 | case "month" : |
151 | - echo $MonthsLong[date("n", $reqdate)-1].date(" Y", $reqdate); |
|
151 | + echo $MonthsLong[date("n", $reqdate) - 1].date(" Y", $reqdate); |
|
152 | 152 | break; |
153 | 153 | case "week" : |
154 | - $weeklowreqdate = ($reqdate-(86400*date("w" , $reqdate))); |
|
155 | - $weekhighreqdate = ($reqdate+(86400*(6-date("w" , $reqdate)) )); |
|
156 | - echo "<b>".$langFrom."</b> ".date("d " , $weeklowreqdate).$MonthsLong[date("n", $weeklowreqdate)-1].date(" Y" , $weeklowreqdate); |
|
157 | - echo " <b>".$langTo."</b> ".date("d " , $weekhighreqdate ).$MonthsLong[date("n", $weekhighreqdate)-1].date(" Y" , $weekhighreqdate); |
|
154 | + $weeklowreqdate = ($reqdate - (86400 * date("w", $reqdate))); |
|
155 | + $weekhighreqdate = ($reqdate + (86400 * (6 - date("w", $reqdate)))); |
|
156 | + echo "<b>".$langFrom."</b> ".date("d ", $weeklowreqdate).$MonthsLong[date("n", $weeklowreqdate) - 1].date(" Y", $weeklowreqdate); |
|
157 | + echo " <b>".$langTo."</b> ".date("d ", $weekhighreqdate).$MonthsLong[date("n", $weekhighreqdate) - 1].date(" Y", $weekhighreqdate); |
|
158 | 158 | break; |
159 | 159 | // default == day |
160 | 160 | default : |
161 | 161 | $period = "day"; |
162 | 162 | case "day" : |
163 | - echo $DaysLong[date("w" , $reqdate)].date(" d " , $reqdate).$MonthsLong[date("n", $reqdate)-1].date(" Y" , $reqdate); |
|
163 | + echo $DaysLong[date("w", $reqdate)].date(" d ", $reqdate).$MonthsLong[date("n", $reqdate) - 1].date(" Y", $reqdate); |
|
164 | 164 | break; |
165 | 165 | } |
166 | 166 | echo "</tr></td>"; |
@@ -174,13 +174,13 @@ discard block |
||
174 | 174 | || |
175 | 175 | |
176 | 176 | "; |
177 | - switch($period) |
|
177 | + switch ($period) |
|
178 | 178 | { |
179 | 179 | case "month" : |
180 | 180 | // previous and next date must be evaluated |
181 | 181 | // 30 days should be a good approximation |
182 | - $previousReqDate = mktime(1,1,1,date("m",$reqdate)-1,1,date("Y",$reqdate)); |
|
183 | - $nextReqDate = mktime(1,1,1,date("m",$reqdate)+1,1,date("Y",$reqdate)); |
|
182 | + $previousReqDate = mktime(1, 1, 1, date("m", $reqdate) - 1, 1, date("Y", $reqdate)); |
|
183 | + $nextReqDate = mktime(1, 1, 1, date("m", $reqdate) + 1, 1, date("Y", $reqdate)); |
|
184 | 184 | echo " |
185 | 185 | [<a href='".api_get_self()."?tool=$encodedTool&period=month&reqdate=$previousReqDate' class='specialLink'>$langPreviousMonth</a>] |
186 | 186 | [<a href='".api_get_self()."?tool=$encodedTool&period=month&reqdate=$nextReqDate' class='specialLink'>$langNextMonth</a>] |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | break; |
189 | 189 | case "week" : |
190 | 190 | // previous and next date must be evaluated |
191 | - $previousReqDate = $reqdate - 7*86400; |
|
192 | - $nextReqDate = $reqdate + 7*86400; |
|
191 | + $previousReqDate = $reqdate - 7 * 86400; |
|
192 | + $nextReqDate = $reqdate + 7 * 86400; |
|
193 | 193 | echo " |
194 | 194 | [<a href='".api_get_self()."?tool=$encodedTool&period=week&reqdate=$previousReqDate' class='specialLink'>$langPreviousWeek</a>] |
195 | 195 | [<a href='".api_get_self()."?tool=$encodedTool&period=week&reqdate=$nextReqDate' class='specialLink'>$langNextWeek</a>] |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | </tr> |
214 | 214 | "; |
215 | 215 | // display information about this period |
216 | - switch($period) |
|
216 | + switch ($period) |
|
217 | 217 | { |
218 | 218 | // all days |
219 | 219 | case "month" : |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | ORDER BY access_date ASC"; |
227 | 227 | |
228 | 228 | $days_array = StatsUtils::daysTab($sql); |
229 | - StatsUtils::makeHitsTable($days_array,$langDay); |
|
229 | + StatsUtils::makeHitsTable($days_array, $langDay); |
|
230 | 230 | break; |
231 | 231 | // all days |
232 | 232 | case "week" : |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | ORDER BY access_date ASC"; |
240 | 240 | |
241 | 241 | $days_array = StatsUtils::daysTab($sql); |
242 | - StatsUtils::makeHitsTable($days_array,$langDay); |
|
242 | + StatsUtils::makeHitsTable($days_array, $langDay); |
|
243 | 243 | break; |
244 | 244 | // all hours |
245 | 245 | case "day" : |
@@ -251,8 +251,8 @@ discard block |
||
251 | 251 | AND YEAR(access_date) = YEAR(FROM_UNIXTIME('$reqdate')) |
252 | 252 | ORDER BY access_date ASC"; |
253 | 253 | |
254 | - $hours_array = StatsUtils::hoursTab($sql,$reqdate); |
|
255 | - StatsUtils::makeHitsTable($hours_array,$langHour); |
|
254 | + $hours_array = StatsUtils::hoursTab($sql, $reqdate); |
|
255 | + StatsUtils::makeHitsTable($hours_array, $langHour); |
|
256 | 256 | break; |
257 | 257 | } |
258 | 258 | } |
@@ -90,7 +90,9 @@ discard block |
||
90 | 90 | echo "<tr> |
91 | 91 | <td> |
92 | 92 | "; |
93 | - if(isset($_cid)) echo "<b>$_cid : </b>"; |
|
93 | + if(isset($_cid)) { |
|
94 | + echo "<b>$_cid : </b>"; |
|
95 | + } |
|
94 | 96 | echo " <b>".get_lang('ToolList')."</b> |
95 | 97 | </td> |
96 | 98 | </tr> |
@@ -116,27 +118,28 @@ discard block |
||
116 | 118 | echo"</tr>"; |
117 | 119 | } |
118 | 120 | |
119 | - } |
|
120 | - else |
|
121 | + } else |
|
121 | 122 | { |
122 | 123 | echo "<tr>"; |
123 | 124 | echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
124 | 125 | echo"</tr>"; |
125 | 126 | } |
126 | 127 | echo "</table></td></tr>"; |
127 | - } |
|
128 | - else |
|
128 | + } else |
|
129 | 129 | { |
130 | 130 | // this can prevent bug if there is special chars in $tool |
131 | 131 | $encodedTool = urlencode($tool); |
132 | 132 | $tool = urldecode($tool); |
133 | 133 | |
134 | - if( !isset($reqdate) ) |
|
135 | - $reqdate = time(); |
|
134 | + if( !isset($reqdate) ) { |
|
135 | + $reqdate = time(); |
|
136 | + } |
|
136 | 137 | echo "<tr> |
137 | 138 | <td> |
138 | 139 | "; |
139 | - if(isset($_cid)) echo "<b>$_cid : </b>"; |
|
140 | + if(isset($_cid)) { |
|
141 | + echo "<b>$_cid : </b>"; |
|
142 | + } |
|
140 | 143 | echo " <b>".get_lang($tool)."</b> |
141 | 144 | </td> |
142 | 145 | </tr> |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | // check if uid is tutor of this group |
76 | 76 | $courseId = api_get_course_int_id(); |
77 | 77 | |
78 | - if (( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) { |
|
78 | + if (($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) { |
|
79 | 79 | if ($is_allowedToTrackEverybodyInCourse) { |
80 | 80 | $sql = "SELECT u.firstname,u.lastname, u.email |
81 | 81 | FROM $TABLECOURSUSER cu , $TABLEUSER u |
82 | 82 | WHERE |
83 | 83 | cu.user_id = u.user_id AND |
84 | - cu.relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND |
|
84 | + cu.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND |
|
85 | 85 | cu.c_id = '$courseId' AND |
86 | 86 | u.user_id = '$uInfo'"; |
87 | 87 | } else { |
@@ -97,21 +97,21 @@ discard block |
||
97 | 97 | $res[2] == "" ? $res2 = get_lang('NoEmail') : $res2 = Display::encrypted_mailto_link($res[2]); |
98 | 98 | |
99 | 99 | echo "<tr><td>"; |
100 | - echo $informationsAbout . " : <br>"; |
|
100 | + echo $informationsAbout." : <br>"; |
|
101 | 101 | echo "<ul>\n" |
102 | - . "<li>" . get_lang('FirstName') . " : " . $res[0] . "</li>\n" |
|
103 | - . "<li>" . get_lang('LastName') . " : " . $res[1] . "</li>\n" |
|
104 | - . "<li>" . get_lang('Email') . " : " . $res2 . "</li>\n" |
|
102 | + . "<li>".get_lang('FirstName')." : ".$res[0]."</li>\n" |
|
103 | + . "<li>".get_lang('LastName')." : ".$res[1]."</li>\n" |
|
104 | + . "<li>".get_lang('Email')." : ".$res2."</li>\n" |
|
105 | 105 | . "</ul>"; |
106 | 106 | echo "</td></tr>"; |
107 | 107 | /* * ***** MENU ******* */ |
108 | 108 | echo "<tr> |
109 | 109 | <td> |
110 | - [<a href='userLog.php?uInfo=$uInfo&view=$view'>" . get_lang('Back') . "</a>] |
|
110 | + [<a href='userLog.php?uInfo=$uInfo&view=$view'>".get_lang('Back')."</a>] |
|
111 | 111 | "; |
112 | 112 | echo " || |
113 | - [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=week&reqdate=$reqdate' class='specialLink'>" . get_lang('PeriodWeek') . "</a>] |
|
114 | - [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=month&reqdate=$reqdate' class='specialLink'>" . get_lang('PeriodMonth') . "</a>] |
|
113 | + [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=week&reqdate=$reqdate' class='specialLink'>".get_lang('PeriodWeek')."</a>] |
|
114 | + [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=month&reqdate=$reqdate' class='specialLink'>".get_lang('PeriodMonth')."</a>] |
|
115 | 115 | || |
116 | 116 | "; |
117 | 117 | switch ($period) { |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | $previousReqDate = $reqdate - 7 * 86400; |
121 | 121 | $nextReqDate = $reqdate + 7 * 86400; |
122 | 122 | echo " |
123 | - [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=week&reqdate=$previousReqDate' class='specialLink'>" . get_lang('PreviousWeek') . "</a>] |
|
124 | - [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=week&reqdate=$nextReqDate' class='specialLink'>" . get_lang('NextWeek') . "</a>] |
|
123 | + [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=week&reqdate=$previousReqDate' class='specialLink'>".get_lang('PreviousWeek')."</a>] |
|
124 | + [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=week&reqdate=$nextReqDate' class='specialLink'>".get_lang('NextWeek')."</a>] |
|
125 | 125 | "; |
126 | 126 | break; |
127 | 127 | default : |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | $previousReqDate = mktime(1, 1, 1, date("m", $reqdate) - 1, 1, date("Y", $reqdate)); |
133 | 133 | $nextReqDate = mktime(1, 1, 1, date("m", $reqdate) + 1, 1, date("Y", $reqdate)); |
134 | 134 | echo " |
135 | - [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=month&reqdate=$previousReqDate' class='specialLink'>" . get_lang('PreviousMonth') . "</a>] |
|
136 | - [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=month&reqdate=$nextReqDate' class='specialLink'>" . get_lang('NextMonth') . "</a>] |
|
135 | + [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=month&reqdate=$previousReqDate' class='specialLink'>".get_lang('PreviousMonth')."</a>] |
|
136 | + [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=month&reqdate=$nextReqDate' class='specialLink'>".get_lang('NextMonth')."</a>] |
|
137 | 137 | "; |
138 | 138 | break; |
139 | 139 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | AND YEAR(access_date) = YEAR(FROM_UNIXTIME('$reqdate')) |
154 | 154 | GROUP BY DAYOFMONTH(access_date) |
155 | 155 | ORDER BY access_date ASC"; |
156 | - $displayedDate = $MonthsLong[date("n", $reqdate) - 1] . date(" Y", $reqdate); |
|
156 | + $displayedDate = $MonthsLong[date("n", $reqdate) - 1].date(" Y", $reqdate); |
|
157 | 157 | break; |
158 | 158 | case "week" : |
159 | 159 | $sql = "SELECT access_date |
@@ -165,24 +165,24 @@ discard block |
||
165 | 165 | GROUP BY DAYOFMONTH(access_date) |
166 | 166 | ORDER BY access_date ASC"; |
167 | 167 | $weeklowreqdate = ($reqdate - (86400 * date("w", $reqdate))); |
168 | - $weekhighreqdate = ($reqdate + (86400 * (6 - date("w", $reqdate)) )); |
|
169 | - $displayedDate = get_lang('From') . " " . date("d ", $weeklowreqdate) . $MonthsLong[date("n", $weeklowreqdate) - 1] . date(" Y", $weeklowreqdate) |
|
170 | - . " " . get_lang('To') . " " . date("d ", $weekhighreqdate) . $MonthsLong[date("n", $weekhighreqdate) - 1] . date(" Y", $weekhighreqdate); |
|
168 | + $weekhighreqdate = ($reqdate + (86400 * (6 - date("w", $reqdate)))); |
|
169 | + $displayedDate = get_lang('From')." ".date("d ", $weeklowreqdate).$MonthsLong[date("n", $weeklowreqdate) - 1].date(" Y", $weeklowreqdate) |
|
170 | + . " ".get_lang('To')." ".date("d ", $weekhighreqdate).$MonthsLong[date("n", $weekhighreqdate) - 1].date(" Y", $weekhighreqdate); |
|
171 | 171 | break; |
172 | 172 | } |
173 | 173 | echo "<tr><td>"; |
174 | 174 | $results = StatsUtils::getManyResults1Col($sql); |
175 | 175 | /* * * display of the displayed period ** */ |
176 | 176 | echo "<table width='100%' cellpadding='2' cellspacing='1' border='0' align=center>"; |
177 | - echo "<td bgcolor='#E6E6E6'>" . $displayedDate . "</td>"; |
|
177 | + echo "<td bgcolor='#E6E6E6'>".$displayedDate."</td>"; |
|
178 | 178 | if (is_array($results)) { |
179 | 179 | for ($j = 0; $j < sizeof($results); $j++) { |
180 | 180 | $beautifulDateTime = api_convert_and_format_date($results[$j], null, date_default_timezone_get()); |
181 | 181 | echo "<tr>"; |
182 | - echo "<td style='padding-left : 40px;' valign='top'>" . $beautifulDateTime . "</td>"; |
|
182 | + echo "<td style='padding-left : 40px;' valign='top'>".$beautifulDateTime."</td>"; |
|
183 | 183 | echo"</tr>"; |
184 | 184 | // $limit is used to select only results between $results[$j] (current login) and next one |
185 | - if ($j == ( sizeof($results) - 1 )) |
|
185 | + if ($j == (sizeof($results) - 1)) |
|
186 | 186 | $limit = date("Y-m-d H:i:s", $nextReqDate); |
187 | 187 | else |
188 | 188 | $limit = $results[$j + 1]; |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | FROM $TABLETRACK_ACCESS |
193 | 193 | WHERE access_user_id = $uInfo |
194 | 194 | AND access_tool IS NOT NULL |
195 | - AND access_date > '" . $results[$j] . "' |
|
196 | - AND access_date < '" . $limit . "' |
|
195 | + AND access_date > '".$results[$j]."' |
|
196 | + AND access_date < '" . $limit."' |
|
197 | 197 | AND c_id = $courseId |
198 | 198 | GROUP BY access_tool |
199 | 199 | ORDER BY access_tool ASC"; |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | echo "<table width='50%' cellpadding='0' cellspacing='0' border='0'>\n"; |
205 | 205 | for ($k = 0; $k < count($results2); $k++) { |
206 | 206 | echo "<tr>\n"; |
207 | - echo "<td width='70%' style='padding-left : 60px;'>" . get_lang($results2[$k][0]) . "</td>\n"; |
|
208 | - echo "<td width='30%' align='right' style='padding-right : 40px'>" . $results2[$k][1] . " " . get_lang('Visits') . "</td>\n"; |
|
207 | + echo "<td width='70%' style='padding-left : 60px;'>".get_lang($results2[$k][0])."</td>\n"; |
|
208 | + echo "<td width='30%' align='right' style='padding-right : 40px'>".$results2[$k][1]." ".get_lang('Visits')."</td>\n"; |
|
209 | 209 | echo "</tr>"; |
210 | 210 | } |
211 | 211 | echo "</table>\n"; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | } |
216 | 216 | } else { |
217 | 217 | echo "<tr>"; |
218 | - echo "<td colspan='2' bgcolor='#eeeeee'>" . get_lang('NoResult') . "</td>"; |
|
218 | + echo "<td colspan='2' bgcolor='#eeeeee'>".get_lang('NoResult')."</td>"; |
|
219 | 219 | echo "</tr>"; |
220 | 220 | } |
221 | 221 | echo "</table>"; |
@@ -182,10 +182,11 @@ |
||
182 | 182 | echo "<td style='padding-left : 40px;' valign='top'>" . $beautifulDateTime . "</td>"; |
183 | 183 | echo"</tr>"; |
184 | 184 | // $limit is used to select only results between $results[$j] (current login) and next one |
185 | - if ($j == ( sizeof($results) - 1 )) |
|
186 | - $limit = date("Y-m-d H:i:s", $nextReqDate); |
|
187 | - else |
|
188 | - $limit = $results[$j + 1]; |
|
185 | + if ($j == ( sizeof($results) - 1 )) { |
|
186 | + $limit = date("Y-m-d H:i:s", $nextReqDate); |
|
187 | + } else { |
|
188 | + $limit = $results[$j + 1]; |
|
189 | + } |
|
189 | 190 | // select all access to tool between displayed date and next displayed date or now() if |
190 | 191 | // displayed date is the last login date |
191 | 192 | $sql = "SELECT access_tool, count(access_tool) |
@@ -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 |