@@ -666,7 +666,7 @@ |
||
666 | 666 | $res = Database::query($sql); |
667 | 667 | $count1 = Database::fetch_object($res); |
668 | 668 | $sql = "SELECT COUNT(*) AS n FROM $user_table as u $table ". |
669 | - "WHERE LENGTH(picture_uri) > 0 $url_condition2"; |
|
669 | + "WHERE LENGTH(picture_uri) > 0 $url_condition2"; |
|
670 | 670 | $res = Database::query($sql); |
671 | 671 | $count2 = Database::fetch_object($res); |
672 | 672 | // #users without picture |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | $course_user_table = Database:: get_main_table(TABLE_MAIN_COURSE_USER); |
105 | 105 | $course_table = Database:: get_main_table(TABLE_MAIN_COURSE); |
106 | 106 | $user_table = Database:: get_main_table(TABLE_MAIN_USER); |
107 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
107 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
108 | 108 | $current_url_id = api_get_current_access_url_id(); |
109 | - $active_filter = $onlyActive?' AND active=1':''; |
|
110 | - $status_filter = isset($status)?' AND status = '.intval($status):''; |
|
109 | + $active_filter = $onlyActive ? ' AND active=1' : ''; |
|
110 | + $status_filter = isset($status) ? ' AND status = '.intval($status) : ''; |
|
111 | 111 | |
112 | 112 | if (api_is_multiple_url_enabled()) { |
113 | 113 | $sql = "SELECT COUNT(DISTINCT(u.user_id)) AS number |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | FROM $user_table |
132 | 132 | WHERE 1=1 $status_filter $active_filter"; |
133 | 133 | if (isset ($categoryCode)) { |
134 | - $status_filter = isset($status)?' AND status = '.intval($status):''; |
|
134 | + $status_filter = isset($status) ? ' AND status = '.intval($status) : ''; |
|
135 | 135 | $sql = "SELECT COUNT(DISTINCT(cu.user_id)) AS number |
136 | 136 | FROM $course_user_table cu, $course_table c |
137 | 137 | WHERE |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | public static function countSessions() |
157 | 157 | { |
158 | 158 | $session_table = Database :: get_main_table(TABLE_MAIN_SESSION); |
159 | - $access_url_rel_session_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
159 | + $access_url_rel_session_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
160 | 160 | if (api_is_multiple_url_enabled()) { |
161 | 161 | $current_url_id = api_get_current_access_url_id(); |
162 | 162 | $sql = "SELECT COUNT(id) AS number |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | public static function getNumberOfActivities() |
180 | 180 | { |
181 | 181 | // Database table definitions |
182 | - $track_e_default = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT); |
|
182 | + $track_e_default = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT); |
|
183 | 183 | $table_user = Database::get_main_table(TABLE_MAIN_USER); |
184 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
184 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
185 | 185 | $current_url_id = api_get_current_access_url_id(); |
186 | 186 | if (api_is_multiple_url_enabled()) { |
187 | 187 | $sql = "SELECT count(default_id) AS total_number_of_items |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $from = intval($from); |
226 | 226 | $numberOfItems = intval($numberOfItems); |
227 | 227 | |
228 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
228 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
229 | 229 | $direction = 'DESC'; |
230 | 230 | } |
231 | 231 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $sql .= " LIMIT $from,$numberOfItems "; |
277 | 277 | |
278 | 278 | $res = Database::query($sql); |
279 | - $activities = array (); |
|
279 | + $activities = array(); |
|
280 | 280 | while ($row = Database::fetch_row($res)) { |
281 | 281 | |
282 | 282 | if (strpos($row[1], '_object') === false && strpos($row[1], '_array') === false) { |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $sql = "SELECT code, name FROM $categoryTable |
344 | 344 | ORDER BY tree_pos"; |
345 | 345 | $res = Database::query($sql); |
346 | - $categories = array (); |
|
346 | + $categories = array(); |
|
347 | 347 | while ($category = Database::fetch_object($res)) { |
348 | 348 | $categories[$category->code] = $category->name; |
349 | 349 | } |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | $data_max = ($data_max < $value ? $value : $data_max); |
365 | 365 | } |
366 | 366 | reset($data); |
367 | - $result = array (); |
|
367 | + $result = array(); |
|
368 | 368 | $delta = $max / $data_max; |
369 | 369 | foreach ($data as $index => $value) { |
370 | 370 | $result[$index] = (int) round($value * $delta); |
@@ -398,9 +398,9 @@ discard block |
||
398 | 398 | } else { |
399 | 399 | $number_label = Statistics::makeSizeString($number); |
400 | 400 | } |
401 | - $percentage = ($total>0?number_format(100*$number/$total, 1, ',', '.'):'0'); |
|
401 | + $percentage = ($total > 0 ? number_format(100 * $number / $total, 1, ',', '.') : '0'); |
|
402 | 402 | |
403 | - echo '<tr class="row_'.($i%2 == 0 ? 'odd' : 'even').'"> |
|
403 | + echo '<tr class="row_'.($i % 2 == 0 ? 'odd' : 'even').'"> |
|
404 | 404 | <td width="150">'.$subtitle.'</td> |
405 | 405 | <td width="550">'.Display::bar_progress($percentage, false).'</td> |
406 | 406 | <td align="right">'.$number_label.'</td>'; |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | echo '<td align="right"> '.$percentage.'%</td>'; |
409 | 409 | } |
410 | 410 | echo '</tr>'; |
411 | - $i ++; |
|
411 | + $i++; |
|
412 | 412 | } |
413 | 413 | if ($showTotal) { |
414 | 414 | if (!$isFileSize) { |
@@ -428,17 +428,17 @@ discard block |
||
428 | 428 | public static function printLoginStats($type) |
429 | 429 | { |
430 | 430 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
431 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
431 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
432 | 432 | $current_url_id = api_get_current_access_url_id(); |
433 | 433 | |
434 | 434 | $table_url = null; |
435 | 435 | $where_url = null; |
436 | 436 | $now = api_get_utc_datetime(); |
437 | - $where_url_last = ' WHERE login_date > DATE_SUB("' . $now . '",INTERVAL 1 %s)'; |
|
437 | + $where_url_last = ' WHERE login_date > DATE_SUB("'.$now.'",INTERVAL 1 %s)'; |
|
438 | 438 | if (api_is_multiple_url_enabled()) { |
439 | 439 | $table_url = ", $access_url_rel_user_table"; |
440 | 440 | $where_url = " WHERE login_user_id=user_id AND access_url_id='".$current_url_id."'"; |
441 | - $where_url_last = ' AND login_date > DATE_SUB("' . $now . '",INTERVAL 1 %s)'; |
|
441 | + $where_url_last = ' AND login_date > DATE_SUB("'.$now.'",INTERVAL 1 %s)'; |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | $period = get_lang('PeriodMonth'); |
@@ -453,13 +453,13 @@ discard block |
||
453 | 453 | case 'hour': |
454 | 454 | $period = get_lang('PeriodHour'); |
455 | 455 | $sql = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY stat_date "; |
456 | - $sql_last_x = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'DAY')." GROUP BY stat_date ORDER BY stat_date "; |
|
456 | + $sql_last_x = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last, 'DAY')." GROUP BY stat_date ORDER BY stat_date "; |
|
457 | 457 | break; |
458 | 458 | case 'day': |
459 | 459 | $periodCollection = api_get_week_days_long(); |
460 | 460 | $period = get_lang('PeriodDay'); |
461 | 461 | $sql = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) "; |
462 | - $sql_last_x = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'WEEK')." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) "; |
|
462 | + $sql_last_x = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last, 'WEEK')." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) "; |
|
463 | 463 | break; |
464 | 464 | } |
465 | 465 | if ($sql_last_x) { |
@@ -501,14 +501,14 @@ discard block |
||
501 | 501 | { |
502 | 502 | $totalLogin = array(); |
503 | 503 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
504 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
504 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
505 | 505 | $current_url_id = api_get_current_access_url_id(); |
506 | 506 | if (api_is_multiple_url_enabled()) { |
507 | 507 | $table_url = ", $access_url_rel_user_table"; |
508 | 508 | $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'"; |
509 | 509 | } else { |
510 | 510 | $table_url = ''; |
511 | - $where_url=''; |
|
511 | + $where_url = ''; |
|
512 | 512 | } |
513 | 513 | $now = api_get_utc_datetime(); |
514 | 514 | $field = 'login_user_id'; |
@@ -540,14 +540,14 @@ discard block |
||
540 | 540 | { |
541 | 541 | $totalLogin = []; |
542 | 542 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
543 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
543 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
544 | 544 | $current_url_id = api_get_current_access_url_id(); |
545 | 545 | if (api_is_multiple_url_enabled()) { |
546 | 546 | $table_url = ", $access_url_rel_user_table"; |
547 | 547 | $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'"; |
548 | 548 | } else { |
549 | 549 | $table_url = ''; |
550 | - $where_url=''; |
|
550 | + $where_url = ''; |
|
551 | 551 | } |
552 | 552 | $now = api_get_utc_datetime(); |
553 | 553 | $field = 'login_user_id'; |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | $sql = "SELECT count($field) AS number, date(login_date) as login_date FROM $table $table_url WHERE DATE_ADD(login_date, INTERVAL 15 DAY) >= '$now' $where_url GROUP BY date(login_date)"; |
558 | 558 | |
559 | 559 | $res = Database::query($sql); |
560 | - while($row = Database::fetch_array($res,'ASSOC')){ |
|
560 | + while ($row = Database::fetch_array($res, 'ASSOC')) { |
|
561 | 561 | $totalLogin[$row['login_date']] = $row['number']; |
562 | 562 | } |
563 | 563 | |
@@ -652,13 +652,13 @@ discard block |
||
652 | 652 | public static function printUserPicturesStats() |
653 | 653 | { |
654 | 654 | $user_table = Database :: get_main_table(TABLE_MAIN_USER); |
655 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
655 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
656 | 656 | $current_url_id = api_get_current_access_url_id(); |
657 | 657 | $url_condition = null; |
658 | 658 | $url_condition2 = null; |
659 | 659 | $table = null; |
660 | 660 | if (api_is_multiple_url_enabled()) { |
661 | - $url_condition = ", $access_url_rel_user_table as url WHERE url.user_id=u.user_id AND access_url_id='".$current_url_id."'"; |
|
661 | + $url_condition = ", $access_url_rel_user_table as url WHERE url.user_id=u.user_id AND access_url_id='".$current_url_id."'"; |
|
662 | 662 | $url_condition2 = " AND url.user_id=u.user_id AND access_url_id='".$current_url_id."'"; |
663 | 663 | $table = ", $access_url_rel_user_table as url "; |
664 | 664 | } |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | 'width=200px', |
691 | 691 | false |
692 | 692 | ); |
693 | - $renderer =& $form->defaultRenderer(); |
|
693 | + $renderer = & $form->defaultRenderer(); |
|
694 | 694 | $renderer->setCustomElementTemplate('<span>{element}</span> '); |
695 | 695 | $form->addElement('hidden', 'report', 'activities'); |
696 | 696 | $form->addElement('hidden', 'activities_direction', 'DESC'); |
@@ -740,10 +740,10 @@ discard block |
||
740 | 740 | $columns[1] = 'access_date'; |
741 | 741 | $sql_order[SORT_ASC] = 'ASC'; |
742 | 742 | $sql_order[SORT_DESC] = 'DESC'; |
743 | - $per_page = isset($_GET['per_page'])?intval($_GET['per_page']) : 10; |
|
744 | - $page_nr = isset($_GET['page_nr'])?intval($_GET['page_nr']) : 1; |
|
745 | - $column = isset($_GET['column'])?intval($_GET['column']) : 0; |
|
746 | - $date_diff = isset($_GET['date_diff'])?intval($_GET['date_diff']) : 60; |
|
743 | + $per_page = isset($_GET['per_page']) ? intval($_GET['per_page']) : 10; |
|
744 | + $page_nr = isset($_GET['page_nr']) ? intval($_GET['page_nr']) : 1; |
|
745 | + $column = isset($_GET['column']) ? intval($_GET['column']) : 0; |
|
746 | + $date_diff = isset($_GET['date_diff']) ? intval($_GET['date_diff']) : 60; |
|
747 | 747 | |
748 | 748 | $direction = isset($_GET['direction']) ? $_GET['direction'] : SORT_ASC; |
749 | 749 | |
@@ -772,25 +772,25 @@ discard block |
||
772 | 772 | access_url_id='".$current_url_id."' |
773 | 773 | GROUP BY c_id |
774 | 774 | HAVING c_id <> '' |
775 | - AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ". $date_diff; |
|
775 | + AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ".$date_diff; |
|
776 | 776 | } else { |
777 | 777 | $sql = "SELECT * FROM $table |
778 | 778 | GROUP BY c_id |
779 | 779 | HAVING c_id <> '' |
780 | - AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ". $date_diff; |
|
780 | + AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ".$date_diff; |
|
781 | 781 | } |
782 | 782 | $sql .= ' ORDER BY '.$columns[$column].' '.$sql_order[$direction]; |
783 | - $from = ($page_nr -1) * $per_page; |
|
783 | + $from = ($page_nr - 1) * $per_page; |
|
784 | 784 | $sql .= ' LIMIT '.$from.','.$per_page; |
785 | 785 | |
786 | 786 | echo '<p>'.get_lang('LastAccess').' >= '.$date_diff.' '.get_lang('Days').'</p>'; |
787 | 787 | $res = Database::query($sql); |
788 | 788 | if (Database::num_rows($res) > 0) { |
789 | - $courses = array (); |
|
789 | + $courses = array(); |
|
790 | 790 | while ($obj = Database::fetch_object($res)) { |
791 | 791 | $courseInfo = api_get_course_info_by_id($obj->c_id); |
792 | - $course = array (); |
|
793 | - $course[]= '<a href="'.api_get_path(WEB_COURSE_PATH).$courseInfo['code'].'">'.$courseInfo['code'].' <a>'; |
|
792 | + $course = array(); |
|
793 | + $course[] = '<a href="'.api_get_path(WEB_COURSE_PATH).$courseInfo['code'].'">'.$courseInfo['code'].' <a>'; |
|
794 | 794 | // Allow sort by date hiding the numerical date |
795 | 795 | $course[] = '<span style="display:none;">'.$obj->access_date.'</span>'.api_convert_and_format_date($obj->access_date); |
796 | 796 | $courses[] = $course; |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | { |
864 | 864 | $user_friend_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
865 | 865 | $user_table = Database::get_main_table(TABLE_MAIN_USER); |
866 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
866 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
867 | 867 | $current_url_id = api_get_current_access_url_id(); |
868 | 868 | |
869 | 869 | if (api_is_multiple_url_enabled()) { |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | { |
896 | 896 | $totalLogin = array(); |
897 | 897 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
898 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
898 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
899 | 899 | $current_url_id = api_get_current_access_url_id(); |
900 | 900 | $total = self::countUsers(); |
901 | 901 | if (api_is_multiple_url_enabled()) { |
@@ -903,14 +903,14 @@ discard block |
||
903 | 903 | $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'"; |
904 | 904 | } else { |
905 | 905 | $table_url = ''; |
906 | - $where_url=''; |
|
906 | + $where_url = ''; |
|
907 | 907 | } |
908 | 908 | $now = api_get_utc_datetime(); |
909 | - $sql[get_lang('ThisDay')] = |
|
909 | + $sql[get_lang('ThisDay')] = |
|
910 | 910 | "SELECT count(distinct(login_user_id)) AS number ". |
911 | 911 | " FROM $table $table_url ". |
912 | 912 | " WHERE DATE_ADD(login_date, INTERVAL 1 DAY) >= '$now' $where_url"; |
913 | - $sql[get_lang('Last7days')] = |
|
913 | + $sql[get_lang('Last7days')] = |
|
914 | 914 | "SELECT count(distinct(login_user_id)) AS number ". |
915 | 915 | " FROM $table $table_url ". |
916 | 916 | " WHERE DATE_ADD(login_date, INTERVAL 7 DAY) >= '$now' $where_url"; |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | "SELECT count(distinct(login_user_id)) AS number ". |
923 | 923 | " FROM $table $table_url ". |
924 | 924 | " WHERE DATE_ADD(login_date, INTERVAL 6 MONTH) >= '$now' $where_url"; |
925 | - $sql[get_lang('NeverConnected')] = |
|
925 | + $sql[get_lang('NeverConnected')] = |
|
926 | 926 | "SELECT count(distinct(login_user_id)) AS number ". |
927 | 927 | " FROM $table $table_url WHERE 1=1 $where_url"; |
928 | 928 | foreach ($sql as $index => $query) { |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | |
19 | 19 | class OpenGraph implements Iterator |
20 | 20 | { |
21 | - /** |
|
22 | - * There are base schema's based on type, this is just |
|
23 | - * a map so that the schema can be obtained |
|
24 | - * |
|
25 | - */ |
|
21 | + /** |
|
22 | + * There are base schema's based on type, this is just |
|
23 | + * a map so that the schema can be obtained |
|
24 | + * |
|
25 | + */ |
|
26 | 26 | public static $TYPES = array( |
27 | 27 | 'activity' => array('activity', 'sport'), |
28 | 28 | 'business' => array('bar', 'company', 'cafe', 'hotel', 'restaurant'), |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | 'website' => array('blog', 'website'), |
35 | 35 | ); |
36 | 36 | |
37 | - /** |
|
38 | - * Holds all the Open Graph values we've parsed from a page |
|
39 | - * |
|
40 | - */ |
|
37 | + /** |
|
38 | + * Holds all the Open Graph values we've parsed from a page |
|
39 | + * |
|
40 | + */ |
|
41 | 41 | private $_values = array(); |
42 | 42 | |
43 | - /** |
|
44 | - * Fetches a URI and parses it for Open Graph data, returns |
|
45 | - * false on error. |
|
46 | - * |
|
47 | - * @param $URI URI to page to parse for Open Graph data |
|
48 | - * @return OpenGraph |
|
49 | - */ |
|
43 | + /** |
|
44 | + * Fetches a URI and parses it for Open Graph data, returns |
|
45 | + * false on error. |
|
46 | + * |
|
47 | + * @param $URI URI to page to parse for Open Graph data |
|
48 | + * @return OpenGraph |
|
49 | + */ |
|
50 | 50 | static public function fetch($URI) { |
51 | 51 | $curl = curl_init($URI); |
52 | 52 | |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | - /** |
|
73 | - * Parses HTML and extracts Open Graph data, this assumes |
|
74 | - * the document is at least well formed. |
|
75 | - * |
|
76 | - * @param $HTML HTML to parse |
|
77 | - * @return OpenGraph |
|
78 | - */ |
|
72 | + /** |
|
73 | + * Parses HTML and extracts Open Graph data, this assumes |
|
74 | + * the document is at least well formed. |
|
75 | + * |
|
76 | + * @param $HTML HTML to parse |
|
77 | + * @return OpenGraph |
|
78 | + */ |
|
79 | 79 | static private function _parse($HTML) { |
80 | 80 | $old_libxml_error = libxml_use_internal_errors(true); |
81 | 81 | |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | return $page; |
141 | 141 | } |
142 | 142 | |
143 | - /** |
|
144 | - * Helper method to access attributes directly |
|
145 | - * Example: |
|
146 | - * $graph->title |
|
147 | - * |
|
148 | - * @param $key Key to fetch from the lookup |
|
149 | - */ |
|
143 | + /** |
|
144 | + * Helper method to access attributes directly |
|
145 | + * Example: |
|
146 | + * $graph->title |
|
147 | + * |
|
148 | + * @param $key Key to fetch from the lookup |
|
149 | + */ |
|
150 | 150 | public function __get($key) { |
151 | 151 | if (array_key_exists($key, $this->_values)) { |
152 | 152 | return $this->_values[$key]; |
@@ -161,29 +161,29 @@ discard block |
||
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | - /** |
|
165 | - * Return all the keys found on the page |
|
166 | - * |
|
167 | - * @return array |
|
168 | - */ |
|
164 | + /** |
|
165 | + * Return all the keys found on the page |
|
166 | + * |
|
167 | + * @return array |
|
168 | + */ |
|
169 | 169 | public function keys() { |
170 | 170 | return array_keys($this->_values); |
171 | 171 | } |
172 | 172 | |
173 | - /** |
|
174 | - * Helper method to check an attribute exists |
|
175 | - * |
|
176 | - * @param $key |
|
177 | - */ |
|
173 | + /** |
|
174 | + * Helper method to check an attribute exists |
|
175 | + * |
|
176 | + * @param $key |
|
177 | + */ |
|
178 | 178 | public function __isset($key) { |
179 | 179 | return array_key_exists($key, $this->_values); |
180 | 180 | } |
181 | 181 | |
182 | - /** |
|
183 | - * Will return true if the page has location data embedded |
|
184 | - * |
|
185 | - * @return boolean Check if the page has location data |
|
186 | - */ |
|
182 | + /** |
|
183 | + * Will return true if the page has location data embedded |
|
184 | + * |
|
185 | + * @return boolean Check if the page has location data |
|
186 | + */ |
|
187 | 187 | public function hasLocation() { |
188 | 188 | if (array_key_exists('latitude', $this->_values) && array_key_exists('longitude', $this->_values)) { |
189 | 189 | return true; |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | return $valid_address; |
198 | 198 | } |
199 | 199 | |
200 | - /** |
|
201 | - * Iterator code |
|
202 | - */ |
|
200 | + /** |
|
201 | + * Iterator code |
|
202 | + */ |
|
203 | 203 | private $_position = 0; |
204 | 204 | public function rewind() { reset($this->_values); $this->_position = 0; } |
205 | 205 | public function current() { return current($this->_values); } |
@@ -18,9 +18,11 @@ |
||
18 | 18 | |
19 | 19 | foreach ($event_config[$event_name]["actions"] as $func) { |
20 | 20 | $execute = true; |
21 | - if (!function_exists($func)) // if the function doesn't exist, we log |
|
21 | + if (!function_exists($func)) { |
|
22 | + // if the function doesn't exist, we log |
|
22 | 23 | { |
23 | 24 | error_log("EventsDispatcher warning : ".$func." does not exist."); |
25 | + } |
|
24 | 26 | $execute = false; |
25 | 27 | } |
26 | 28 |
@@ -38,7 +38,7 @@ |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | - * @return bool |
|
41 | + * @return false|null |
|
42 | 42 | */ |
43 | 43 | public function create_user_folder() |
44 | 44 | { |
@@ -34,8 +34,8 @@ |
||
34 | 34 | $idUserLocal = api_get_user_id(); |
35 | 35 | $userLocal = api_get_user_info($idUserLocal, true); |
36 | 36 | $htmlHeadXtra[] = '<script type="text/javascript" src="' |
37 | - . api_get_path(WEB_PATH) . 'web/assets/SimpleWebRTC/latest.js' |
|
38 | - . '"></script>' . "\n"; |
|
37 | + . api_get_path(WEB_PATH).'web/assets/SimpleWebRTC/latest.js' |
|
38 | + . '"></script>'."\n"; |
|
39 | 39 | |
40 | 40 | $template = new Template(); |
41 | 41 | $template->assign('room_name', $chatVideo->getRoomName()); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $from = intval($from); |
75 | 75 | $number_of_items = intval($number_of_items); |
76 | 76 | |
77 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
77 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
78 | 78 | $direction = 'ASC'; |
79 | 79 | } |
80 | 80 | |
@@ -97,24 +97,24 @@ discard block |
||
97 | 97 | $thematic[1] = '<a href="index.php?'.api_get_cidreq().'&action=thematic_details&thematic_id='.$thematic[0].'">'. |
98 | 98 | Security::remove_XSS($thematic[1], STUDENT).$session_star.'</a>'; |
99 | 99 | if (api_is_allowed_to_edit(null, true)) { |
100 | - $actions = ''; |
|
100 | + $actions = ''; |
|
101 | 101 | |
102 | 102 | if (api_get_session_id()) { |
103 | 103 | if (api_get_session_id() == $thematic[3]) { |
104 | 104 | $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic[0].'">'. |
105 | - Display::return_icon('lesson_plan.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).'</a> '; |
|
105 | + Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).'</a> '; |
|
106 | 106 | $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic[0].'">'. |
107 | - Display::return_icon('lesson_plan_calendar.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).'</a> '; |
|
107 | + Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).'</a> '; |
|
108 | 108 | |
109 | 109 | $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$thematic[0].'">'. |
110 | - Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'; |
|
110 | + Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'; |
|
111 | 111 | $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$thematic[0].'">'. |
112 | - Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
|
112 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
113 | 113 | } else { |
114 | - $actions .= Display::return_icon('lesson_plan_na.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).' '; |
|
115 | - $actions .= Display::return_icon('lesson_plan_calendar_na.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).' '; |
|
116 | - $actions .= Display::return_icon('edit_na.png',get_lang('Edit'),'',ICON_SIZE_SMALL); |
|
117 | - $actions .= Display::return_icon('delete_na.png',get_lang('Delete'),'',ICON_SIZE_SMALL).' '; |
|
114 | + $actions .= Display::return_icon('lesson_plan_na.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).' '; |
|
115 | + $actions .= Display::return_icon('lesson_plan_calendar_na.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).' '; |
|
116 | + $actions .= Display::return_icon('edit_na.png', get_lang('Edit'), '', ICON_SIZE_SMALL); |
|
117 | + $actions .= Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL).' '; |
|
118 | 118 | $actions .= Display::url( |
119 | 119 | Display::return_icon('cd.gif', get_lang('Copy')), |
120 | 120 | 'index.php?'.api_get_cidreq().'&action=thematic_copy&thematic_id='.$thematic[0] |
@@ -122,26 +122,26 @@ discard block |
||
122 | 122 | } |
123 | 123 | } else { |
124 | 124 | $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic[0].'">'. |
125 | - Display::return_icon('lesson_plan.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).'</a> '; |
|
125 | + Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).'</a> '; |
|
126 | 126 | $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic[0].'">'. |
127 | - Display::return_icon('lesson_plan_calendar.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).'</a> '; |
|
127 | + Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).'</a> '; |
|
128 | 128 | |
129 | 129 | if ($thematic[2] > 1) { |
130 | 130 | $actions .= '<a href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$thematic[0].'">'. |
131 | - Display::return_icon('up.png', get_lang('Up'),'',ICON_SIZE_SMALL).'</a>'; |
|
131 | + Display::return_icon('up.png', get_lang('Up'), '', ICON_SIZE_SMALL).'</a>'; |
|
132 | 132 | } else { |
133 | - $actions .= Display::return_icon('up_na.png',' ','',ICON_SIZE_SMALL); |
|
133 | + $actions .= Display::return_icon('up_na.png', ' ', '', ICON_SIZE_SMALL); |
|
134 | 134 | } |
135 | 135 | if ($thematic[2] < self::get_max_thematic_item()) { |
136 | 136 | $actions .= '<a href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$thematic[0].'">'. |
137 | - Display::return_icon('down.png',get_lang('Down'),'',ICON_SIZE_SMALL).'</a>'; |
|
137 | + Display::return_icon('down.png', get_lang('Down'), '', ICON_SIZE_SMALL).'</a>'; |
|
138 | 138 | } else { |
139 | - $actions .= Display::return_icon('down_na.png',' ','',ICON_SIZE_SMALL); |
|
139 | + $actions .= Display::return_icon('down_na.png', ' ', '', ICON_SIZE_SMALL); |
|
140 | 140 | } |
141 | 141 | $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$thematic[0].'">'. |
142 | - Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'; |
|
142 | + Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'; |
|
143 | 143 | $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$thematic[0].'">'. |
144 | - Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
|
144 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
145 | 145 | } |
146 | 146 | $thematics[] = array($thematic[0], $thematic[1], $actions); |
147 | 147 | } |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | $res = Database::query($sql); |
279 | 279 | if (Database::num_rows($res) > 0) { |
280 | 280 | if (!empty($thematic_id)) { |
281 | - $data = Database::fetch_array($res,'ASSOC'); |
|
281 | + $data = Database::fetch_array($res, 'ASSOC'); |
|
282 | 282 | } else { |
283 | - while ($row = Database::fetch_array($res,'ASSOC')) { |
|
283 | + while ($row = Database::fetch_array($res, 'ASSOC')) { |
|
284 | 284 | $data[$row['id']] = $row; |
285 | 285 | } |
286 | 286 | } |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | |
376 | 376 | if (is_array($thematic_id)) { |
377 | 377 | foreach ($thematic_id as $id) { |
378 | - $id = intval($id); |
|
378 | + $id = intval($id); |
|
379 | 379 | $sql = "UPDATE $tbl_thematic SET active = 0 |
380 | 380 | WHERE c_id = $course_id AND id = $id"; |
381 | 381 | $result = Database::query($sql); |
@@ -391,8 +391,8 @@ discard block |
||
391 | 391 | ); |
392 | 392 | } |
393 | 393 | } |
394 | - } else { |
|
395 | - $thematic_id = intval($thematic_id); |
|
394 | + } else { |
|
395 | + $thematic_id = intval($thematic_id); |
|
396 | 396 | $sql = "UPDATE $tbl_thematic SET active = 0 |
397 | 397 | WHERE c_id = $course_id AND id = $thematic_id"; |
398 | 398 | $result = Database::query($sql); |
@@ -428,8 +428,8 @@ discard block |
||
428 | 428 | $new_thematic_id = $thematic_copy->thematic_save(); |
429 | 429 | if (!empty($new_thematic_id)) { |
430 | 430 | $thematic_advanced = self::get_thematic_advance_by_thematic_id($thematic_id); |
431 | - if(!empty($thematic_advanced)) { |
|
432 | - foreach($thematic_advanced as $item) { |
|
431 | + if (!empty($thematic_advanced)) { |
|
432 | + foreach ($thematic_advanced as $item) { |
|
433 | 433 | $thematic = new Thematic(); |
434 | 434 | $thematic->set_thematic_advance_attributes( |
435 | 435 | 0, |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | $column = intval($column); |
493 | 493 | $from = intval($from); |
494 | 494 | $number_of_items = intval($number_of_items); |
495 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
495 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
496 | 496 | $direction = 'ASC'; |
497 | 497 | } |
498 | 498 | $data = array(); |
@@ -525,8 +525,8 @@ discard block |
||
525 | 525 | $thematic_advance[1] = api_get_local_time($thematic_advance[1]); |
526 | 526 | $thematic_advance[1] = api_format_date($thematic_advance[1], DATE_TIME_FORMAT_LONG); |
527 | 527 | $actions = ''; |
528 | - $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',22).'</a>'; |
|
529 | - $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('delete.png',get_lang('Delete'),'',22).'</a></center>'; |
|
528 | + $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('edit.png', get_lang('Edit'), '', 22).'</a>'; |
|
529 | + $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('delete.png', get_lang('Delete'), '', 22).'</a></center>'; |
|
530 | 530 | $data[] = array($i, $thematic_advance[1], $thematic_advance[2], $thematic_advance[3], $actions); |
531 | 531 | $i++; |
532 | 532 | } |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | |
591 | 591 | $session_star = ''; |
592 | 592 | if (api_is_allowed_to_edit(null, true)) { |
593 | - if ($thematic_advance['session_id'] !=0) { |
|
593 | + if ($thematic_advance['session_id'] != 0) { |
|
594 | 594 | $session_star = api_get_session_image(api_get_session_id(), $uinfo['status']); |
595 | 595 | } |
596 | 596 | } |
@@ -616,13 +616,13 @@ discard block |
||
616 | 616 | |
617 | 617 | foreach ($data as $thematic_id => $thematic_plan_data) { |
618 | 618 | $new_thematic_plan_data = array(); |
619 | - foreach($thematic_plan_data as $thematic_item) { |
|
619 | + foreach ($thematic_plan_data as $thematic_item) { |
|
620 | 620 | $thematic_simple_list[] = $thematic_item['description_type']; |
621 | 621 | $new_thematic_plan_data[$thematic_item['description_type']] = $thematic_item; |
622 | 622 | } |
623 | 623 | |
624 | 624 | if (!empty($thematic_simple_list)) { |
625 | - foreach($thematic_simple_list as $item) { |
|
625 | + foreach ($thematic_simple_list as $item) { |
|
626 | 626 | $default_thematic_plan_title[$item] = $new_thematic_plan_data[$item]['title']; |
627 | 627 | } |
628 | 628 | } |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | } |
639 | 639 | if (!empty($data[$thematic_id][$id]['title']) && !empty($data[$thematic_id][$id]['description'])) { |
640 | 640 | if (api_is_allowed_to_edit(null, true)) { |
641 | - if ($data[$thematic_id][$id]['session_id'] !=0) { |
|
641 | + if ($data[$thematic_id][$id]['session_id'] != 0) { |
|
642 | 642 | $session_star = api_get_session_image(api_get_session_id(), $uinfo['status']); |
643 | 643 | } |
644 | 644 | } |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | if ($no_data) { |
652 | 652 | $return .= '<div><em>'.get_lang('StillDoNotHaveAThematicPlan').'</em></div>'; |
653 | 653 | } |
654 | - $return .= '</div>'; |
|
654 | + $return .= '</div>'; |
|
655 | 655 | $final_return[$thematic_id] = $return; |
656 | 656 | } |
657 | 657 | return $final_return; |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | api_get_session_id() |
692 | 692 | ); |
693 | 693 | foreach ($list as $value) { |
694 | - $elements[$value['ref']]= $value; |
|
694 | + $elements[$value['ref']] = $value; |
|
695 | 695 | } |
696 | 696 | } |
697 | 697 | |
@@ -865,18 +865,18 @@ discard block |
||
865 | 865 | api_get_session_id() |
866 | 866 | ); |
867 | 867 | |
868 | - $thematic_plan_complete_list = array(); |
|
868 | + $thematic_plan_complete_list = array(); |
|
869 | 869 | $thematic_plan_id_list = array(); |
870 | 870 | |
871 | 871 | if (!empty($items_from_course)) { |
872 | - foreach($items_from_course as $item) { |
|
872 | + foreach ($items_from_course as $item) { |
|
873 | 873 | $thematic_plan_id_list[] = $item['ref']; |
874 | 874 | $thematic_plan_complete_list[$item['ref']] = $item; |
875 | 875 | } |
876 | 876 | } |
877 | 877 | |
878 | 878 | if (!empty($items_from_session)) { |
879 | - foreach($items_from_session as $item) { |
|
879 | + foreach ($items_from_session as $item) { |
|
880 | 880 | $thematic_plan_id_list[] = $item['ref']; |
881 | 881 | $thematic_plan_complete_list[$item['ref']] = $item; |
882 | 882 | } |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | if (!isset($thematic_id) && !isset($description_type)) { |
899 | 899 | // group all data group by thematic id |
900 | 900 | $tmp = array(); |
901 | - while ($row = Database::fetch_array($rs,'ASSOC')) { |
|
901 | + while ($row = Database::fetch_array($rs, 'ASSOC')) { |
|
902 | 902 | $tmp[] = $row['thematic_id']; |
903 | 903 | if (in_array($row['thematic_id'], $tmp)) { |
904 | 904 | $row['session_id'] = $thematic_plan_complete_list[$row['id']]; |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | } |
907 | 907 | } |
908 | 908 | } else { |
909 | - while ($row = Database::fetch_array($rs,'ASSOC')) { |
|
909 | + while ($row = Database::fetch_array($rs, 'ASSOC')) { |
|
910 | 910 | $row['session_id'] = $thematic_plan_complete_list[$row['id']]; |
911 | 911 | $data[] = $row; |
912 | 912 | } |
@@ -941,8 +941,8 @@ discard block |
||
941 | 941 | ); |
942 | 942 | |
943 | 943 | $elements_to_show = array(); |
944 | - foreach($list as $value) { |
|
945 | - $elements_to_show[]= $value['ref']; |
|
944 | + foreach ($list as $value) { |
|
945 | + $elements_to_show[] = $value['ref']; |
|
946 | 946 | } |
947 | 947 | $condition = ''; |
948 | 948 | if (!empty($elements_to_show)) { |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | c_id = $course_id AND |
955 | 955 | thematic_id = $thematic_id AND |
956 | 956 | description_type = '$description_type'"; |
957 | - $rs = Database::query($sql); |
|
957 | + $rs = Database::query($sql); |
|
958 | 958 | |
959 | 959 | $affected_rows = 0; |
960 | 960 | if (Database::num_rows($rs) > 0) { |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | $diff = array_diff($all, $a_thematic_advance_ids); |
1191 | 1191 | if (!empty($diff)) { |
1192 | 1192 | $upd = "UPDATE $tbl_thematic_advance SET done_advance = 0 |
1193 | - WHERE c_id = $course_id AND id IN(".implode(',',$diff).") "; |
|
1193 | + WHERE c_id = $course_id AND id IN(".implode(',', $diff).") "; |
|
1194 | 1194 | Database::query($upd); |
1195 | 1195 | } |
1196 | 1196 | |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | $course_code = api_get_course_id(); |
1305 | 1305 | } |
1306 | 1306 | if (api_get_session_id()) { |
1307 | - $thematic_data = $this->get_thematic_list(null, $course_code ); |
|
1307 | + $thematic_data = $this->get_thematic_list(null, $course_code); |
|
1308 | 1308 | } else { |
1309 | 1309 | $thematic_data = $this->get_thematic_list(null, $course_code, 0); |
1310 | 1310 | } |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | } |
1357 | 1357 | // calculate average by thematic |
1358 | 1358 | $count_total_advances = count($advances); |
1359 | - $average = round(($count_done_advances*100)/$count_total_advances); |
|
1359 | + $average = round(($count_done_advances * 100) / $count_total_advances); |
|
1360 | 1360 | } |
1361 | 1361 | |
1362 | 1362 | return $average; |
@@ -1447,12 +1447,12 @@ discard block |
||
1447 | 1447 | public function get_default_thematic_plan_title() |
1448 | 1448 | { |
1449 | 1449 | $default_thematic_plan_titles = array(); |
1450 | - $default_thematic_plan_titles[1]= get_lang('Objectives'); |
|
1451 | - $default_thematic_plan_titles[2]= get_lang('SkillToAcquire'); |
|
1452 | - $default_thematic_plan_titles[3]= get_lang('Methodology'); |
|
1453 | - $default_thematic_plan_titles[4]= get_lang('Infrastructure'); |
|
1454 | - $default_thematic_plan_titles[5]= get_lang('Assessment'); |
|
1455 | - $default_thematic_plan_titles[6]= get_lang('Others'); |
|
1450 | + $default_thematic_plan_titles[1] = get_lang('Objectives'); |
|
1451 | + $default_thematic_plan_titles[2] = get_lang('SkillToAcquire'); |
|
1452 | + $default_thematic_plan_titles[3] = get_lang('Methodology'); |
|
1453 | + $default_thematic_plan_titles[4] = get_lang('Infrastructure'); |
|
1454 | + $default_thematic_plan_titles[5] = get_lang('Assessment'); |
|
1455 | + $default_thematic_plan_titles[6] = get_lang('Others'); |
|
1456 | 1456 | |
1457 | 1457 | return $default_thematic_plan_titles; |
1458 | 1458 | } |
@@ -1464,12 +1464,12 @@ discard block |
||
1464 | 1464 | public function get_default_thematic_plan_icon() |
1465 | 1465 | { |
1466 | 1466 | $default_thematic_plan_icon = array(); |
1467 | - $default_thematic_plan_icon[1]= 'icons/32/objective.png'; |
|
1468 | - $default_thematic_plan_icon[2]= 'icons/32/skills.png'; |
|
1469 | - $default_thematic_plan_icon[3]= 'icons/32/strategy.png'; |
|
1470 | - $default_thematic_plan_icon[4]= 'icons/32/laptop.png'; |
|
1471 | - $default_thematic_plan_icon[5]= 'icons/32/assessment.png'; |
|
1472 | - $default_thematic_plan_icon[6]= 'icons/32/wizard.png'; |
|
1467 | + $default_thematic_plan_icon[1] = 'icons/32/objective.png'; |
|
1468 | + $default_thematic_plan_icon[2] = 'icons/32/skills.png'; |
|
1469 | + $default_thematic_plan_icon[3] = 'icons/32/strategy.png'; |
|
1470 | + $default_thematic_plan_icon[4] = 'icons/32/laptop.png'; |
|
1471 | + $default_thematic_plan_icon[5] = 'icons/32/assessment.png'; |
|
1472 | + $default_thematic_plan_icon[6] = 'icons/32/wizard.png'; |
|
1473 | 1473 | |
1474 | 1474 | return $default_thematic_plan_icon; |
1475 | 1475 | } |
@@ -1481,11 +1481,11 @@ discard block |
||
1481 | 1481 | public function get_default_question() |
1482 | 1482 | { |
1483 | 1483 | $question = array(); |
1484 | - $question[1]= get_lang('ObjectivesQuestions'); |
|
1485 | - $question[2]= get_lang('SkillToAcquireQuestions'); |
|
1486 | - $question[3]= get_lang('MethodologyQuestions'); |
|
1487 | - $question[4]= get_lang('InfrastructureQuestions'); |
|
1488 | - $question[5]= get_lang('AssessmentQuestions'); |
|
1484 | + $question[1] = get_lang('ObjectivesQuestions'); |
|
1485 | + $question[2] = get_lang('SkillToAcquireQuestions'); |
|
1486 | + $question[3] = get_lang('MethodologyQuestions'); |
|
1487 | + $question[4] = get_lang('InfrastructureQuestions'); |
|
1488 | + $question[5] = get_lang('AssessmentQuestions'); |
|
1489 | 1489 | |
1490 | 1490 | return $question; |
1491 | 1491 | } |
@@ -242,6 +242,8 @@ discard block |
||
242 | 242 | /** |
243 | 243 | * get thematic list |
244 | 244 | * @param int Thematic id (optional), get list by id |
245 | + * @param integer $thematic_id |
|
246 | + * @param integer $session_id |
|
245 | 247 | * @return array Thematic data |
246 | 248 | */ |
247 | 249 | public static function get_thematic_list( |
@@ -798,6 +800,7 @@ discard block |
||
798 | 800 | /** |
799 | 801 | * delete thematic advance |
800 | 802 | * @param int Thematic advance id |
803 | + * @param integer $thematic_advance_id |
|
801 | 804 | * @return int Affected rows |
802 | 805 | */ |
803 | 806 | public function thematic_advance_destroy($thematic_advance_id) |
@@ -1114,6 +1117,7 @@ discard block |
||
1114 | 1117 | /** |
1115 | 1118 | * update done thematic advances from thematic details interface |
1116 | 1119 | * @param int Thematic id |
1120 | + * @param integer $thematic_advance_id |
|
1117 | 1121 | * @return int Affected rows |
1118 | 1122 | */ |
1119 | 1123 | public function update_done_thematic_advances($thematic_advance_id) |
@@ -1296,6 +1300,7 @@ discard block |
||
1296 | 1300 | * Get total average of thematic advances |
1297 | 1301 | * @param string Course code (optional) |
1298 | 1302 | * @param int Session id (optional) |
1303 | + * @param integer $session_id |
|
1299 | 1304 | * @return float Average of thematic advances |
1300 | 1305 | */ |
1301 | 1306 | public function get_total_average_of_thematic_advances($course_code = null, $session_id = null) |
@@ -1433,7 +1438,7 @@ discard block |
||
1433 | 1438 | |
1434 | 1439 | /** |
1435 | 1440 | * get thematic id |
1436 | - * @return void |
|
1441 | + * @return integer |
|
1437 | 1442 | */ |
1438 | 1443 | public function get_thematic_id() |
1439 | 1444 | { |
@@ -1442,7 +1447,7 @@ discard block |
||
1442 | 1447 | |
1443 | 1448 | /** |
1444 | 1449 | * Get thematic plan titles by default |
1445 | - * @return array |
|
1450 | + * @return string[] |
|
1446 | 1451 | */ |
1447 | 1452 | public function get_default_thematic_plan_title() |
1448 | 1453 | { |
@@ -1459,7 +1464,7 @@ discard block |
||
1459 | 1464 | |
1460 | 1465 | /** |
1461 | 1466 | * Get thematic plan icons by default |
1462 | - * @return array |
|
1467 | + * @return string[] |
|
1463 | 1468 | */ |
1464 | 1469 | public function get_default_thematic_plan_icon() |
1465 | 1470 | { |
@@ -1476,7 +1481,7 @@ discard block |
||
1476 | 1481 | |
1477 | 1482 | /** |
1478 | 1483 | * Get questions by default for help |
1479 | - * @return array |
|
1484 | + * @return string[] |
|
1480 | 1485 | */ |
1481 | 1486 | public function get_default_question() |
1482 | 1487 | { |
@@ -1710,8 +1710,7 @@ |
||
1710 | 1710 | } |
1711 | 1711 | } |
1712 | 1712 | return false; |
1713 | - } |
|
1714 | - elseif (is_array($encoding2)) { |
|
1713 | + } elseif (is_array($encoding2)) { |
|
1715 | 1714 | foreach ($encoding2 as $encoding) { |
1716 | 1715 | if (api_equal_encodings($encoding1, $encoding, $strict)) { |
1717 | 1716 | return true; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | ) { |
106 | 106 | require_once api_get_path(SYS_CODE_PATH).'/cron/lang/langstats.class.php'; |
107 | 107 | global $langstats; |
108 | - $langstats->add_use($variable,''); |
|
108 | + $langstats->add_use($variable, ''); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | if (!isset($used_lang_vars)) { |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | if ($use_users_timezone == 'true') { |
372 | 372 | $userId = api_get_user_id(); |
373 | 373 | // Get the timezone based on user preference, if it exists |
374 | - $timezone_user = UserManager::get_extra_user_data_by_field($userId,'timezone'); |
|
374 | + $timezone_user = UserManager::get_extra_user_data_by_field($userId, 'timezone'); |
|
375 | 375 | if (isset($timezone_user['timezone']) && $timezone_user['timezone'] != null) { |
376 | 376 | $to_timezone = $timezone_user['timezone']; |
377 | 377 | } |
@@ -636,10 +636,10 @@ discard block |
||
636 | 636 | // We replace %a %A %b %B masks of date format with translated strings |
637 | 637 | $translated = &_api_get_day_month_names($language); |
638 | 638 | $date_format = str_replace(array('%A', '%a', '%B', '%b'), |
639 | - array($translated['days_long'][(int)strftime('%w', $time )], |
|
640 | - $translated['days_short'][(int)strftime('%w', $time)], |
|
641 | - $translated['months_long'][(int)strftime('%m', $time) - 1], |
|
642 | - $translated['months_short'][(int)strftime('%m', $time) - 1]), |
|
639 | + array($translated['days_long'][(int) strftime('%w', $time)], |
|
640 | + $translated['days_short'][(int) strftime('%w', $time)], |
|
641 | + $translated['months_long'][(int) strftime('%m', $time) - 1], |
|
642 | + $translated['months_short'][(int) strftime('%m', $time) - 1]), |
|
643 | 643 | $date_format); |
644 | 644 | $formatted_date = api_to_system_encoding(strftime($date_format, $time), 'UTF-8'); |
645 | 645 | } |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | |
661 | 661 | function date_to_str_ago($date, $timeZone = 'UTC') |
662 | 662 | { |
663 | - if ($date == '0000-00-00 00:00:00') { |
|
663 | + if ($date == '0000-00-00 00:00:00') { |
|
664 | 664 | return ''; |
665 | 665 | } |
666 | 666 | |
@@ -1577,7 +1577,7 @@ discard block |
||
1577 | 1577 | * @return string Returns the encoding identificator modified in suitable for comparison way. |
1578 | 1578 | */ |
1579 | 1579 | function api_refine_encoding_id($encoding) { |
1580 | - if (is_array($encoding)){ |
|
1580 | + if (is_array($encoding)) { |
|
1581 | 1581 | return array_map('api_refine_encoding_id', $encoding); |
1582 | 1582 | } |
1583 | 1583 | return strtoupper(str_replace('_', '-', $encoding)); |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | if (isset($_configuration['language_measure_frequency']) && |
96 | 96 | $_configuration['language_measure_frequency'] == 1 |
97 | 97 | ) { |
98 | - require_once api_get_path(SYS_CODE_PATH).'/cron/lang/langstats.class.php'; |
|
99 | - global $langstats; |
|
100 | - $langstats->add_use($variable,''); |
|
98 | + require_once api_get_path(SYS_CODE_PATH).'/cron/lang/langstats.class.php'; |
|
99 | + global $langstats; |
|
100 | + $langstats->add_use($variable,''); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | if (!isset($used_lang_vars)) { |
104 | - $used_lang_vars = array(); |
|
104 | + $used_lang_vars = array(); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | // Caching results from some API functions, for speed. |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | static $text_direction = array(); |
292 | 292 | |
293 | 293 | if (empty($language)) { |
294 | - $language = api_get_interface_language(); |
|
294 | + $language = api_get_interface_language(); |
|
295 | 295 | } |
296 | 296 | if (!isset($text_direction[$language])) { |
297 | 297 | $text_direction[$language] = in_array(api_purify_language_id($language), |
@@ -528,24 +528,24 @@ discard block |
||
528 | 528 | case DATE_FORMAT_ONLY_DAYNAME: |
529 | 529 | $date_format = get_lang('dateFormatOnlyDayName', '', $language); |
530 | 530 | if (INTL_INSTALLED) { |
531 | - $datetype = IntlDateFormatter::SHORT; |
|
532 | - $timetype = IntlDateFormatter::NONE; |
|
533 | - } |
|
531 | + $datetype = IntlDateFormatter::SHORT; |
|
532 | + $timetype = IntlDateFormatter::NONE; |
|
533 | + } |
|
534 | 534 | break; |
535 | 535 | case DATE_FORMAT_NUMBER_NO_YEAR: |
536 | 536 | $date_format = get_lang('dateFormatShortNumberNoYear', '', $language); |
537 | - if (INTL_INSTALLED) { |
|
538 | - $datetype = IntlDateFormatter::SHORT; |
|
539 | - $timetype = IntlDateFormatter::NONE; |
|
540 | - } |
|
537 | + if (INTL_INSTALLED) { |
|
538 | + $datetype = IntlDateFormatter::SHORT; |
|
539 | + $timetype = IntlDateFormatter::NONE; |
|
540 | + } |
|
541 | + break; |
|
542 | + case DATE_FORMAT_NUMBER: |
|
543 | + $date_format = get_lang('dateFormatShortNumber', '', $language); |
|
544 | + if (INTL_INSTALLED) { |
|
545 | + $datetype = IntlDateFormatter::SHORT; |
|
546 | + $timetype = IntlDateFormatter::NONE; |
|
547 | + } |
|
541 | 548 | break; |
542 | - case DATE_FORMAT_NUMBER: |
|
543 | - $date_format = get_lang('dateFormatShortNumber', '', $language); |
|
544 | - if (INTL_INSTALLED) { |
|
545 | - $datetype = IntlDateFormatter::SHORT; |
|
546 | - $timetype = IntlDateFormatter::NONE; |
|
547 | - } |
|
548 | - break; |
|
549 | 549 | case TIME_NO_SEC_FORMAT: |
550 | 550 | $date_format = get_lang('timeNoSecFormat', '', $language); |
551 | 551 | if (INTL_INSTALLED) { |
@@ -581,14 +581,14 @@ discard block |
||
581 | 581 | $timetype = IntlDateFormatter::SHORT; |
582 | 582 | } |
583 | 583 | break; |
584 | - case DATE_TIME_FORMAT_SHORT: |
|
584 | + case DATE_TIME_FORMAT_SHORT: |
|
585 | 585 | $date_format = get_lang('dateTimeFormatShort', '', $language); |
586 | 586 | if (INTL_INSTALLED) { |
587 | 587 | $datetype = IntlDateFormatter::FULL; |
588 | 588 | $timetype = IntlDateFormatter::SHORT; |
589 | 589 | } |
590 | 590 | break; |
591 | - case DATE_TIME_FORMAT_SHORT_TIME_FIRST: |
|
591 | + case DATE_TIME_FORMAT_SHORT_TIME_FIRST: |
|
592 | 592 | $date_format = get_lang('dateTimeFormatShortTimeFirst', '', $language); |
593 | 593 | if (INTL_INSTALLED) { |
594 | 594 | $datetype = IntlDateFormatter::FULL; |
@@ -1696,7 +1696,6 @@ discard block |
||
1696 | 1696 | |
1697 | 1697 | /** |
1698 | 1698 | * Return true a date is valid |
1699 | - |
|
1700 | 1699 | * @param string $date example: 2014-06-30 13:05:05 |
1701 | 1700 | * @param string $format example: "Y-m-d H:i:s" |
1702 | 1701 | * |
@@ -1965,15 +1964,15 @@ discard block |
||
1965 | 1964 | function apiGetHumanDateTime($date, $showTime = true, $humanForm = false) { |
1966 | 1965 | if ($showTime) { |
1967 | 1966 | if ($dateHuman) { |
1968 | - return $date->format('j M Y H:i:s'); |
|
1967 | + return $date->format('j M Y H:i:s'); |
|
1969 | 1968 | } else { |
1970 | - return $date->format('Y-m-d H:i:s'); |
|
1969 | + return $date->format('Y-m-d H:i:s'); |
|
1971 | 1970 | } |
1972 | 1971 | } else { |
1973 | 1972 | if ($dateHuman) { |
1974 | - return $date->format('j M Y'); |
|
1973 | + return $date->format('j M Y'); |
|
1975 | 1974 | } else { |
1976 | - return $date->format('Y-m-d'); |
|
1975 | + return $date->format('Y-m-d'); |
|
1977 | 1976 | } |
1978 | 1977 | } |
1979 | 1978 | } |
@@ -422,6 +422,7 @@ discard block |
||
422 | 422 | * If null, the timezone will be determined based on user preference, |
423 | 423 | * or timezone chosen by the admin for the platform. |
424 | 424 | * @param string The timezone to be converted from. If null, UTC will be assumed. |
425 | + * @param string $to_timezone |
|
425 | 426 | * @return string The converted time formatted as Y-m-d H:i:s |
426 | 427 | * |
427 | 428 | * @author Guillaume Viguier <[email protected]> |
@@ -666,6 +667,7 @@ discard block |
||
666 | 667 | * @param mixed The time to be converted |
667 | 668 | * @param mixed Format to be used (TIME_NO_SEC_FORMAT, DATE_FORMAT_SHORT, DATE_FORMAT_LONG, DATE_TIME_FORMAT_LONG) |
668 | 669 | * @param string Timezone to be converted from. If null, UTC will be assumed. |
670 | + * @param string $from_timezone |
|
669 | 671 | * @return string Converted and localized date |
670 | 672 | * |
671 | 673 | * @author Guillaume Viguier <[email protected]> |
@@ -735,7 +737,7 @@ discard block |
||
735 | 737 | * @param int|string $format (optional) The person name format. It may be a pattern-string (for example '%t %l, %f' or '%T %F %L', ...) or some of the constants PERSON_NAME_COMMON_CONVENTION (default), PERSON_NAME_WESTERN_ORDER, PERSON_NAME_EASTERN_ORDER, PERSON_NAME_LIBRARY_ORDER. |
736 | 738 | * @param string $language (optional) The language id. If it is omitted, the current interface language is assumed. This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only. |
737 | 739 | * @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default. |
738 | - * @return bool The result is sort of full name of the person. |
|
740 | + * @return string The result is sort of full name of the person. |
|
739 | 741 | * Sample results: |
740 | 742 | * Peter Ustinoff or Dr. Peter Ustinoff - the Western order |
741 | 743 | * Ustinoff Peter or Dr. Ustinoff Peter - the Eastern order |
@@ -1054,8 +1056,8 @@ discard block |
||
1054 | 1056 | |
1055 | 1057 | /** |
1056 | 1058 | * This function returns a string or an array with all occurrences of search in subject (ignoring case) replaced with the given replace value. |
1057 | - * @param mixed $search String or array of strings to be found. |
|
1058 | - * @param mixed $replace String or array of strings used for replacement. |
|
1059 | + * @param string $search String or array of strings to be found. |
|
1060 | + * @param string $replace String or array of strings used for replacement. |
|
1059 | 1061 | * @param mixed $subject String or array of strings being searched. |
1060 | 1062 | * @param int $count (optional) The number of matched and replaced needles will be returned in count, which is passed by reference. |
1061 | 1063 | * @param string $encoding (optional) The used internally by this function character encoding. |
@@ -1118,10 +1120,10 @@ discard block |
||
1118 | 1120 | /** |
1119 | 1121 | * Finds first occurrence of a string within another, case insensitive. |
1120 | 1122 | * @param string $haystack The string from which to get the first occurrence. |
1121 | - * @param mixed $needle The string to be found. |
|
1123 | + * @param string $needle The string to be found. |
|
1122 | 1124 | * @param bool $before_needle (optional) Determines which portion of $haystack this function returns. The default value is FALSE. |
1123 | 1125 | * @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default. |
1124 | - * @return mixed Returns the portion of $haystack, or FALSE if $needle is not found. |
|
1126 | + * @return false|string Returns the portion of $haystack, or FALSE if $needle is not found. |
|
1125 | 1127 | * Notes: |
1126 | 1128 | * If $needle is not a string, it is converted to an integer and applied as the ordinal value (codepoint if the encoding is UTF-8) of a character. |
1127 | 1129 | * If $before_needle is set to TRUE, the function returns all of $haystack from the beginning to the first occurrence of $needle. |
@@ -1177,7 +1179,7 @@ discard block |
||
1177 | 1179 | * @param mixed $needle The string which first character is to be found. |
1178 | 1180 | * @param bool $before_needle (optional) Determines which portion of $haystack this function returns. The default value is FALSE. |
1179 | 1181 | * @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default. |
1180 | - * @return mixed Returns the portion of $haystack, or FALSE if the first character from $needle is not found. |
|
1182 | + * @return false|string Returns the portion of $haystack, or FALSE if the first character from $needle is not found. |
|
1181 | 1183 | * Notes: |
1182 | 1184 | * If $needle is not a string, it is converted to an integer and applied as the ordinal value (codepoint if the encoding is UTF-8) of a character. |
1183 | 1185 | * If $before_needle is set to TRUE, the function returns all of $haystack from the beginning to the first occurrence. |
@@ -1244,7 +1246,7 @@ discard block |
||
1244 | 1246 | * @param mixed $needle The string to be found. |
1245 | 1247 | * @param bool $before_needle (optional) Determines which portion of $haystack this function returns. The default value is FALSE. |
1246 | 1248 | * @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default. |
1247 | - * @return mixed Returns the portion of $haystack, or FALSE if $needle is not found. |
|
1249 | + * @return false|string Returns the portion of $haystack, or FALSE if $needle is not found. |
|
1248 | 1250 | * Notes: |
1249 | 1251 | * If $needle is not a string, it is converted to an integer and applied as the ordinal value (codepoint if the encoding is UTF-8) of a character. |
1250 | 1252 | * If $before_needle is set to TRUE, the function returns all of $haystack from the beginning to the first occurrence of $needle. |
@@ -1387,7 +1389,7 @@ discard block |
||
1387 | 1389 | * Note that this changes the return value in an array where every element is an array consisting of the matched string at index 0 and its string offset into subject at index 1. |
1388 | 1390 | * @param int $offset (optional) Normally, the search starts from the beginning of the subject string. The optional parameter offset can be used to specify the alternate place from which to start the search. |
1389 | 1391 | * @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default. |
1390 | - * @return int|boolean Returns the number of times pattern matches or FALSE if an error occurred. |
|
1392 | + * @return integer Returns the number of times pattern matches or FALSE if an error occurred. |
|
1391 | 1393 | * @link http://php.net/preg_match |
1392 | 1394 | */ |
1393 | 1395 | function api_preg_match($pattern, $subject, &$matches = null, $flags = 0, $offset = 0, $encoding = null) { |
@@ -1410,7 +1412,7 @@ discard block |
||
1410 | 1412 | * If no order flag is given, PREG_PATTERN_ORDER is assumed. |
1411 | 1413 | * @param int $offset (optional) Normally, the search starts from the beginning of the subject string. The optional parameter offset can be used to specify the alternate place from which to start the search. |
1412 | 1414 | * @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default. |
1413 | - * @return int|boolean Returns the number of full pattern matches (which might be zero), or FALSE if an error occurred. |
|
1415 | + * @return integer Returns the number of full pattern matches (which might be zero), or FALSE if an error occurred. |
|
1414 | 1416 | * @link http://php.net/preg_match_all |
1415 | 1417 | */ |
1416 | 1418 | function api_preg_match_all($pattern, $subject, &$matches, $flags = PREG_PATTERN_ORDER, $offset = 0, $encoding = null) { |
@@ -1425,8 +1427,8 @@ discard block |
||
1425 | 1427 | |
1426 | 1428 | /** |
1427 | 1429 | * Performs a regular expression search and replace, UTF-8 aware when it is applicable. |
1428 | - * @param string|array $pattern The pattern to search for. It can be either a string or an array with strings. |
|
1429 | - * @param string|array $replacement The string or an array with strings to replace. |
|
1430 | + * @param string $pattern The pattern to search for. It can be either a string or an array with strings. |
|
1431 | + * @param string $replacement The string or an array with strings to replace. |
|
1430 | 1432 | * @param string|array $subject The string or an array with strings to search and replace. |
1431 | 1433 | * @param int $limit The maximum possible replacements for each pattern in each subject string. Defaults to -1 (no limit). |
1432 | 1434 | * @param int &$count If specified, this variable will be filled with the number of replacements done. |
@@ -1574,7 +1576,7 @@ discard block |
||
1574 | 1576 | |
1575 | 1577 | /** |
1576 | 1578 | * This function checks whether two $encoding are equal (same, equvalent). |
1577 | - * @param string|array $encoding1 The first encoding |
|
1579 | + * @param string $encoding1 The first encoding |
|
1578 | 1580 | * @param string|array $encoding2 The second encoding |
1579 | 1581 | * @param bool $strict When this parameter is TRUE the comparison ignores aliases of encodings. |
1580 | 1582 | * When the parameter is FALSE, aliases are taken into account. |
@@ -1678,6 +1680,7 @@ discard block |
||
1678 | 1680 | /** |
1679 | 1681 | * Checks a string for UTF-8 validity. |
1680 | 1682 | * |
1683 | + * @param string $string |
|
1681 | 1684 | */ |
1682 | 1685 | function api_is_valid_utf8(&$string) |
1683 | 1686 | { |
@@ -1820,7 +1823,7 @@ discard block |
||
1820 | 1823 | /** |
1821 | 1824 | * Replaces non-valid formats for person names with the default (English) format. |
1822 | 1825 | * @param string $format The input format to be verified. |
1823 | - * @return bool Returns the same format if is is valid, otherwise returns a valid English format. |
|
1826 | + * @return string Returns the same format if is is valid, otherwise returns a valid English format. |
|
1824 | 1827 | */ |
1825 | 1828 | function _api_validate_person_name_format($format) { |
1826 | 1829 | if (empty($format) || stripos($format, '%f') === false || stripos($format, '%l') === false) { |
@@ -1947,6 +1950,9 @@ discard block |
||
1947 | 1950 | |
1948 | 1951 | // This function checks whether the function _api_convert_encoding() (the php- |
1949 | 1952 | // implementation) is able to convert from/to a given encoding. |
1953 | +/** |
|
1954 | + * @param string $encoding |
|
1955 | + */ |
|
1950 | 1956 | function _api_convert_encoding_supports($encoding) { |
1951 | 1957 | static $supports = array(); |
1952 | 1958 | if (!isset($supports[$encoding])) { |
@@ -1957,7 +1963,7 @@ discard block |
||
1957 | 1963 | |
1958 | 1964 | /** |
1959 | 1965 | * Given a date object, return a human or ISO format, with or without h:m:s |
1960 | - * @param object $date The Date object |
|
1966 | + * @param DateTime $date The Date object |
|
1961 | 1967 | * @param bool $showTime Whether to show the time and date (true) or only the date (false) |
1962 | 1968 | * @param bool $humanForm Whether to show day-month-year (true) or year-month-day (false) |
1963 | 1969 | * @return string Formatted date |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
176 | - * @param string $pluginName |
|
177 | - * @param int $urlId |
|
178 | - */ |
|
176 | + * @param string $pluginName |
|
177 | + * @param int $urlId |
|
178 | + */ |
|
179 | 179 | public function uninstall($pluginName, $urlId = null) |
180 | 180 | { |
181 | 181 | if (empty($urlId)) { |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
255 | - * @param string $region |
|
256 | - * @param string $template |
|
257 | - * @param bool $forced |
|
258 | - * |
|
259 | - * @return null|string |
|
260 | - */ |
|
255 | + * @param string $region |
|
256 | + * @param string $template |
|
257 | + * @param bool $forced |
|
258 | + * |
|
259 | + * @return null|string |
|
260 | + */ |
|
261 | 261 | public function load_region($region, $template, $forced = false) |
262 | 262 | { |
263 | 263 | if ($region == 'course_tool_plugin') { |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | //extra options |
426 | 426 | $plugin_settings = api_get_settings_params( |
427 | 427 | array( |
428 | - "subkey = ? AND category = ? AND type = ? " => array($plugin_name, 'Plugins','setting') |
|
428 | + "subkey = ? AND category = ? AND type = ? " => array($plugin_name, 'Plugins', 'setting') |
|
429 | 429 | ) |
430 | 430 | ); |
431 | 431 | $settings_filtered = array(); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | if (!empty($obj->course_settings)) { |
531 | 531 | if (is_file(api_get_path(SYS_CODE_PATH).'img/icons/'.ICON_SIZE_SMALL.'/'.$plugin_name.'.png')) { |
532 | 532 | $icon = Display::return_icon( |
533 | - $plugin_name . '.png', |
|
533 | + $plugin_name.'.png', |
|
534 | 534 | Security::remove_XSS($pluginTitle), |
535 | 535 | '', |
536 | 536 | ICON_SIZE_SMALL |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @param string $template |
257 | 257 | * @param bool $forced |
258 | 258 | * |
259 | - * @return null|string |
|
259 | + * @return string |
|
260 | 260 | */ |
261 | 261 | public function load_region($region, $template, $forced = false) |
262 | 262 | { |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | |
629 | 629 | /** |
630 | 630 | * Get first SMS plugin name |
631 | - * @return string|boolean |
|
631 | + * @return string|false |
|
632 | 632 | */ |
633 | 633 | public function getSMSPluginName() |
634 | 634 | { |
@@ -34,9 +34,9 @@ |
||
34 | 34 | public $search_did = 0; |
35 | 35 | public $audio = ""; |
36 | 36 | |
37 | - public function __construct($in_c_id=0, $in_id=0) |
|
37 | + public function __construct($in_c_id = 0, $in_id = 0) |
|
38 | 38 | { |
39 | - if ($in_c_id > 0 && $in_id >0) { |
|
39 | + if ($in_c_id > 0 && $in_id > 0) { |
|
40 | 40 | $item_view_table = Database::get_course_table(TABLE_LP_ITEM); |
41 | 41 | $sql = "SELECT * FROM $item_view_table |
42 | 42 | WHERE |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | $exemplary_content |
66 | 66 | ) { |
67 | 67 | $wanted_code = trim($wanted_code); |
68 | - $user_id = (int)$user_id; |
|
69 | - $exemplary_content = (bool)$exemplary_content ? 1 : 0; |
|
68 | + $user_id = (int) $user_id; |
|
69 | + $exemplary_content = (bool) $exemplary_content ? 1 : 0; |
|
70 | 70 | |
71 | 71 | if ($wanted_code == '') { |
72 | 72 | return false; |
@@ -254,10 +254,10 @@ discard block |
||
254 | 254 | $user_id, |
255 | 255 | $exemplary_content |
256 | 256 | ) { |
257 | - $id = (int)$id; |
|
257 | + $id = (int) $id; |
|
258 | 258 | $wanted_code = trim($wanted_code); |
259 | - $user_id = (int)$user_id; |
|
260 | - $exemplary_content = (bool)$exemplary_content ? 1 : 0; |
|
259 | + $user_id = (int) $user_id; |
|
260 | + $exemplary_content = (bool) $exemplary_content ? 1 : 0; |
|
261 | 261 | |
262 | 262 | if ($wanted_code == '') { |
263 | 263 | return false; |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | */ |
361 | 361 | public static function delete_course_request($id) |
362 | 362 | { |
363 | - $id = (int)$id; |
|
363 | + $id = (int) $id; |
|
364 | 364 | $sql = "DELETE FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." |
365 | 365 | WHERE id = ".$id; |
366 | 366 | $result = Database::query($sql); |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | if (is_null($status)) { |
378 | 378 | $sql = "SELECT COUNT(id) AS number FROM ".$course_table; |
379 | 379 | } else { |
380 | - $status = (int)$status; |
|
380 | + $status = (int) $status; |
|
381 | 381 | $sql = "SELECT COUNT(id) AS number FROM ".$course_table." |
382 | 382 | WHERE status = ".$status; |
383 | 383 | } |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | */ |
396 | 396 | public static function get_course_request_info($id) |
397 | 397 | { |
398 | - $id = (int)$id; |
|
398 | + $id = (int) $id; |
|
399 | 399 | $sql = "SELECT * |
400 | 400 | FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." |
401 | 401 | WHERE id = ".$id; |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | */ |
414 | 414 | public static function get_course_request_code($id) |
415 | 415 | { |
416 | - $id = (int)$id; |
|
416 | + $id = (int) $id; |
|
417 | 417 | $sql = "SELECT code |
418 | 418 | FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." |
419 | 419 | WHERE id = ".$id; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | */ |
435 | 435 | public static function accept_course_request($id) |
436 | 436 | { |
437 | - $id = (int)$id; |
|
437 | + $id = (int) $id; |
|
438 | 438 | |
439 | 439 | // Retrieve request's data |
440 | 440 | $course_request_info = self::get_course_request_info($id); |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | return false; |
448 | 448 | }*/ |
449 | 449 | |
450 | - $user_id = (int)$course_request_info['user_id']; |
|
450 | + $user_id = (int) $course_request_info['user_id']; |
|
451 | 451 | if ($user_id <= 0) { |
452 | 452 | return false; |
453 | 453 | } |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | */ |
532 | 532 | public static function reject_course_request($id) |
533 | 533 | { |
534 | - $id = (int)$id; |
|
534 | + $id = (int) $id; |
|
535 | 535 | // Retrieve request's data |
536 | 536 | $course_request_info = self::get_course_request_info($id); |
537 | 537 | if (!is_array($course_request_info)) { |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | */ |
610 | 610 | public static function ask_for_additional_info($id) |
611 | 611 | { |
612 | - $id = (int)$id; |
|
612 | + $id = (int) $id; |
|
613 | 613 | |
614 | 614 | // Retrieve request's data |
615 | 615 | $course_request_info = self::get_course_request_info($id); |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | */ |
701 | 701 | public static function additional_info_asked($id) |
702 | 702 | { |
703 | - $id = (int)$id; |
|
703 | + $id = (int) $id; |
|
704 | 704 | $sql = "SELECT id FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." |
705 | 705 | WHERE (id = ".$id." AND info > 0)"; |
706 | 706 | $result = Database::num_rows(Database::query($sql)); |
@@ -51,7 +51,7 @@ |
||
51 | 51 | * @param string $objetives |
52 | 52 | * @param string $target_audience |
53 | 53 | * @param int $user_id |
54 | - * @return mixed The database id of the newly created course request or FALSE on failure. |
|
54 | + * @return false|string The database id of the newly created course request or FALSE on failure. |
|
55 | 55 | */ |
56 | 56 | public static function create_course_request( |
57 | 57 | $wanted_code, |