@@ -666,9 +666,10 @@ |
||
666 | 666 | $result = ''; |
667 | 667 | for ($i = $min; $i <= $max; $i ++) { |
668 | 668 | $result .= '<option value="'.$i.'"'; |
669 | - if (is_int($selected_num)) |
|
670 | - if ($selected_num == $i) { |
|
669 | + if (is_int($selected_num)) { |
|
670 | + if ($selected_num == $i) { |
|
671 | 671 | $result .= ' selected="selected"'; |
672 | + } |
|
672 | 673 | } |
673 | 674 | $result .= '>'.$i.'</option>'; |
674 | 675 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | - * @return array |
|
35 | + * @return string[] |
|
36 | 36 | */ |
37 | 37 | public static function toolList() |
38 | 38 | { |
@@ -290,7 +290,6 @@ discard block |
||
290 | 290 | * 'page_nr' = The page to display |
291 | 291 | * 'hide_navigation' = true to hide the navigation |
292 | 292 | * @param array $query_vars Additional variables to add in the query-string |
293 | - * @param array $form actions Additional variables to add in the query-string |
|
294 | 293 | * @param mixed An array with bool values to know which columns show. |
295 | 294 | * i.e: $visibility_options= array(true, false) we will only show the first column |
296 | 295 | * Can be also only a bool value. TRUE: show all columns, FALSE: show nothing |
@@ -331,7 +330,6 @@ discard block |
||
331 | 330 | * 'page_nr' = The page to display |
332 | 331 | * 'hide_navigation' = true to hide the navigation |
333 | 332 | * @param array $query_vars Additional variables to add in the query-string |
334 | - * @param array $form actions Additional variables to add in the query-string |
|
335 | 333 | * @param mixed An array with bool values to know which columns show. i.e: |
336 | 334 | * $visibility_options= array(true, false) we will only show the first column |
337 | 335 | * Can be also only a bool value. TRUE: show all columns, FALSE: show nothing |
@@ -388,10 +386,11 @@ discard block |
||
388 | 386 | * 'per_page' = number of items to show per page |
389 | 387 | * 'page_nr' = The page to display |
390 | 388 | * @param array $query_vars Additional variables to add in the query-string |
391 | - * @param array $column_show Array of binaries 1= show columns 0. hide a column |
|
389 | + * @param integer[] $column_show Array of binaries 1= show columns 0. hide a column |
|
392 | 390 | * @param array $column_order An array of integers that let us decide how the columns are going to be sort. |
393 | 391 | * i.e: $column_order=array('1''4','3','4'); The 2nd column will be order like the 4th column |
394 | 392 | * @param array $form_actions Set optional forms actions |
393 | + * @param string $table_name |
|
395 | 394 | * |
396 | 395 | * @author Julio Montoya |
397 | 396 | */ |
@@ -444,7 +443,7 @@ discard block |
||
444 | 443 | * @param bool $filter (true) or not (false) |
445 | 444 | * @param bool $returnValue |
446 | 445 | * |
447 | - * @return void |
|
446 | + * @return string|null |
|
448 | 447 | */ |
449 | 448 | public static function display_normal_message($message, $filter = true, $returnValue = false) |
450 | 449 | { |
@@ -474,7 +473,7 @@ discard block |
||
474 | 473 | /** |
475 | 474 | * Displays an confirmation message. Use this if something has been done successfully |
476 | 475 | * @param bool Filter (true) or not (false) |
477 | - * @return void |
|
476 | + * @return string|null |
|
478 | 477 | */ |
479 | 478 | public static function display_confirmation_message ($message, $filter = true, $returnValue = false) |
480 | 479 | { |
@@ -491,7 +490,7 @@ discard block |
||
491 | 490 | * @param string $message - include any additional html |
492 | 491 | * tags if you need them |
493 | 492 | * @param bool Filter (true) or not (false) |
494 | - * @return void |
|
493 | + * @return string|null |
|
495 | 494 | */ |
496 | 495 | public static function display_error_message ($message, $filter = true, $returnValue = false) |
497 | 496 | { |
@@ -681,6 +680,7 @@ discard block |
||
681 | 680 | * @param string The alt text (probably a language variable) |
682 | 681 | * @param array additional attributes (for instance height, width, onclick, ...) |
683 | 682 | * @param integer The wanted width of the icon (to be looked for in the corresponding img/icons/ folder) |
683 | + * @param string $image |
|
684 | 684 | * @return void |
685 | 685 | */ |
686 | 686 | public static function display_icon( |
@@ -886,6 +886,7 @@ discard block |
||
886 | 886 | /** |
887 | 887 | * Displays an HTML input tag |
888 | 888 | * |
889 | + * @param string $type |
|
889 | 890 | */ |
890 | 891 | public static function input($type, $name, $value, $attributes = array()) |
891 | 892 | { |
@@ -902,8 +903,8 @@ discard block |
||
902 | 903 | } |
903 | 904 | |
904 | 905 | /** |
905 | - * @param $name |
|
906 | - * @param $value |
|
906 | + * @param string $name |
|
907 | + * @param string $value |
|
907 | 908 | * @param array $attributes |
908 | 909 | * @return string |
909 | 910 | */ |
@@ -918,6 +919,7 @@ discard block |
||
918 | 919 | /** |
919 | 920 | * Displays an HTML select tag |
920 | 921 | * |
922 | + * @param string $blank_item_text |
|
921 | 923 | */ |
922 | 924 | public static function select( |
923 | 925 | $name, |
@@ -984,8 +986,8 @@ discard block |
||
984 | 986 | $( "#tabs" ).tabs(); |
985 | 987 | }); |
986 | 988 | </script> |
987 | - * @param array $headers list of the tab titles |
|
988 | - * @param array $items |
|
989 | + * @param string[] $headers list of the tab titles |
|
990 | + * @param string[] $items |
|
989 | 991 | * @param string $id id of the container of the tab in the example "tabs" |
990 | 992 | * @param array $attributes for the ul |
991 | 993 | * @param array $ul_attributes |
@@ -1039,7 +1041,7 @@ discard block |
||
1039 | 1041 | |
1040 | 1042 | /** |
1041 | 1043 | * @param $headers |
1042 | - * @param null $selected |
|
1044 | + * @param integer $selected |
|
1043 | 1045 | * |
1044 | 1046 | * @return string |
1045 | 1047 | */ |
@@ -1077,6 +1079,7 @@ discard block |
||
1077 | 1079 | * As you can see both function use the same "my_grid_name" this is very important otherwise nothing will work |
1078 | 1080 | * |
1079 | 1081 | * @param string the div id, this value must be the same with the first parameter of Display::grid_js() |
1082 | + * @param string $div_id |
|
1080 | 1083 | * @return string html |
1081 | 1084 | * |
1082 | 1085 | */ |
@@ -1632,6 +1635,8 @@ discard block |
||
1632 | 1635 | * @param string url that will be added (for jquery see hot_courses.tpl) |
1633 | 1636 | * @param string point info array see function CourseManager::get_course_ranking() |
1634 | 1637 | * @param bool add a div wrapper |
1638 | + * @param string $id |
|
1639 | + * @param string $url |
|
1635 | 1640 | * @todo use templates |
1636 | 1641 | **/ |
1637 | 1642 | public static function return_rating_system($id, $url, $point_info = array(), $add_div_wrapper = true) |
@@ -1727,6 +1732,9 @@ discard block |
||
1727 | 1732 | return '<'.$size.'>'.Security::remove_XSS($title).'</'.$size.'>'; |
1728 | 1733 | } |
1729 | 1734 | |
1735 | + /** |
|
1736 | + * @param string $title |
|
1737 | + */ |
|
1730 | 1738 | public static function page_subheader2($title, $second_title = null) |
1731 | 1739 | { |
1732 | 1740 | return self::page_header($title, $second_title, 'h4'); |
@@ -1957,6 +1965,7 @@ discard block |
||
1957 | 1965 | |
1958 | 1966 | /** |
1959 | 1967 | * @todo use twig |
1968 | + * @param string $title |
|
1960 | 1969 | */ |
1961 | 1970 | public static function group_button($title, $elements) |
1962 | 1971 | { |
@@ -2174,9 +2183,9 @@ discard block |
||
2174 | 2183 | |
2175 | 2184 | /** |
2176 | 2185 | * @param int $id |
2177 | - * @param array $content |
|
2186 | + * @param string[] $content |
|
2178 | 2187 | * @param int $col |
2179 | - * @param bool|true $right |
|
2188 | + * @param boolean $right |
|
2180 | 2189 | * @return string |
2181 | 2190 | */ |
2182 | 2191 | public static function toolbarAction($id, $content = array(), $col = 2, $right = true) |
@@ -2258,10 +2267,10 @@ discard block |
||
2258 | 2267 | /** |
2259 | 2268 | * @param string $title |
2260 | 2269 | * @param string $content |
2261 | - * @param null $id |
|
2270 | + * @param string $id |
|
2262 | 2271 | * @param array $params |
2263 | - * @param null $idAccordion |
|
2264 | - * @param null $idCollapse |
|
2272 | + * @param string $idAccordion |
|
2273 | + * @param string $idCollapse |
|
2265 | 2274 | * @param bool|true $open |
2266 | 2275 | * @param bool|false $fullClickable |
2267 | 2276 | * @return null|string |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | ); |
50 | 50 | } |
51 | 51 | |
52 | - /** |
|
53 | - * Displays the page header |
|
54 | - * @param string The name of the page (will be showed in the page title) |
|
55 | - * @param string Optional help file name |
|
56 | - * @param string $page_header |
|
57 | - */ |
|
52 | + /** |
|
53 | + * Displays the page header |
|
54 | + * @param string The name of the page (will be showed in the page title) |
|
55 | + * @param string Optional help file name |
|
56 | + * @param string $page_header |
|
57 | + */ |
|
58 | 58 | public static function display_header($tool_name ='', $help = null, $page_header = null) |
59 | 59 | { |
60 | 60 | $origin = api_get_origin(); |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | */ |
449 | 449 | public static function display_normal_message($message, $filter = true, $returnValue = false) |
450 | 450 | { |
451 | - $message = self::return_message($message, 'normal', $filter); |
|
451 | + $message = self::return_message($message, 'normal', $filter); |
|
452 | 452 | if ($returnValue) { |
453 | 453 | return $message; |
454 | 454 | } else { |
@@ -528,22 +528,22 @@ discard block |
||
528 | 528 | } |
529 | 529 | |
530 | 530 | if ($filter) { |
531 | - $message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding()); |
|
531 | + $message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding()); |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | $class = ""; |
535 | 535 | switch($type) { |
536 | 536 | case 'warning': |
537 | 537 | $class .= 'alert alert-warning'; |
538 | - break; |
|
538 | + break; |
|
539 | 539 | case 'error': |
540 | 540 | $class .= 'alert alert-danger'; |
541 | - break; |
|
541 | + break; |
|
542 | 542 | case 'confirmation': |
543 | 543 | case 'confirm': |
544 | 544 | case 'success': |
545 | 545 | $class .= 'alert alert-success'; |
546 | - break; |
|
546 | + break; |
|
547 | 547 | case 'normal': |
548 | 548 | default: |
549 | 549 | $class .= 'alert alert-info'; |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | * @param array additional attributes (for instance height, width, onclick, ...) |
687 | 687 | * @param integer The wanted width of the icon (to be looked for in the corresponding img/icons/ folder) |
688 | 688 | * @return void |
689 | - */ |
|
689 | + */ |
|
690 | 690 | public static function display_icon( |
691 | 691 | $image, |
692 | 692 | $alt_text = '', |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | * @author Julio Montoya 2010 Function improved, adding image constants |
723 | 723 | * @author Yannick Warnier 2011 Added size handler |
724 | 724 | * @version Feb 2011 |
725 | - */ |
|
725 | + */ |
|
726 | 726 | public static function return_icon( |
727 | 727 | $image, |
728 | 728 | $alt_text = '', |
@@ -911,14 +911,14 @@ discard block |
||
911 | 911 | */ |
912 | 912 | public static function input($type, $name, $value, $attributes = array()) |
913 | 913 | { |
914 | - if (isset($type)) { |
|
915 | - $attributes['type']= $type; |
|
916 | - } |
|
917 | - if (isset($name)) { |
|
918 | - $attributes['name']= $name; |
|
919 | - } |
|
920 | - if (isset($value)) { |
|
921 | - $attributes['value']= $value; |
|
914 | + if (isset($type)) { |
|
915 | + $attributes['type']= $type; |
|
916 | + } |
|
917 | + if (isset($name)) { |
|
918 | + $attributes['name']= $name; |
|
919 | + } |
|
920 | + if (isset($value)) { |
|
921 | + $attributes['value']= $value; |
|
922 | 922 | } |
923 | 923 | return self::tag('input', '', $attributes); |
924 | 924 | } |
@@ -931,10 +931,10 @@ discard block |
||
931 | 931 | */ |
932 | 932 | public static function button($name, $value, $attributes = array()) |
933 | 933 | { |
934 | - if (!empty($name)) { |
|
934 | + if (!empty($name)) { |
|
935 | 935 | $attributes['name'] = $name; |
936 | - } |
|
937 | - return self::tag('button', $value, $attributes); |
|
936 | + } |
|
937 | + return self::tag('button', $value, $attributes); |
|
938 | 938 | } |
939 | 939 | |
940 | 940 | /** |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | * in the $htmlHeadXtra variable before the display_header |
1002 | 1002 | * Add this script |
1003 | 1003 | * @example |
1004 | - * <script> |
|
1004 | + * <script> |
|
1005 | 1005 | $(function() { |
1006 | 1006 | $( "#tabs" ).tabs(); |
1007 | 1007 | }); |
@@ -1067,20 +1067,20 @@ discard block |
||
1067 | 1067 | */ |
1068 | 1068 | public static function tabsOnlyLink($headers, $selected = null) |
1069 | 1069 | { |
1070 | - $id = uniqid(); |
|
1071 | - $i = 1; |
|
1072 | - $lis = null; |
|
1073 | - foreach ($headers as $item) { |
|
1070 | + $id = uniqid(); |
|
1071 | + $i = 1; |
|
1072 | + $lis = null; |
|
1073 | + foreach ($headers as $item) { |
|
1074 | 1074 | $class = null; |
1075 | 1075 | if ($i == $selected) { |
1076 | 1076 | $class = 'active'; |
1077 | 1077 | } |
1078 | - $item = self::tag( |
|
1079 | - 'a', |
|
1080 | - $item['content'], |
|
1081 | - array('id' => $id.'-'.$i, 'href' => $item['url']) |
|
1082 | - ); |
|
1083 | - $lis .= self::tag('li', $item, array('class' => $class)); |
|
1078 | + $item = self::tag( |
|
1079 | + 'a', |
|
1080 | + $item['content'], |
|
1081 | + array('id' => $id.'-'.$i, 'href' => $item['url']) |
|
1082 | + ); |
|
1083 | + $lis .= self::tag('li', $item, array('class' => $class)); |
|
1084 | 1084 | $i++; |
1085 | 1085 | } |
1086 | 1086 | return self::tag('ul', $lis, array('class' => 'nav nav-tabs tabs-margin')); |
@@ -1292,8 +1292,8 @@ discard block |
||
1292 | 1292 | */ |
1293 | 1293 | public static function table($headers, $rows, $attributes = array()) |
1294 | 1294 | { |
1295 | - if (empty($attributes)) { |
|
1296 | - $attributes['class'] = 'data_table'; |
|
1295 | + if (empty($attributes)) { |
|
1296 | + $attributes['class'] = 'data_table'; |
|
1297 | 1297 | } |
1298 | 1298 | $table = new HTML_Table($attributes); |
1299 | 1299 | $row = 0; |
@@ -1301,17 +1301,17 @@ discard block |
||
1301 | 1301 | |
1302 | 1302 | // Course headers |
1303 | 1303 | if (!empty($headers)) { |
1304 | - foreach ($headers as $item) { |
|
1305 | - $table->setHeaderContents($row, $column, $item); |
|
1306 | - $column++; |
|
1307 | - } |
|
1308 | - $row = 1; |
|
1309 | - $column = 0; |
|
1304 | + foreach ($headers as $item) { |
|
1305 | + $table->setHeaderContents($row, $column, $item); |
|
1306 | + $column++; |
|
1307 | + } |
|
1308 | + $row = 1; |
|
1309 | + $column = 0; |
|
1310 | 1310 | } |
1311 | 1311 | |
1312 | 1312 | if (!empty($rows)) { |
1313 | - foreach($rows as $content) { |
|
1314 | - $table->setCellContents($row, $column, $content); |
|
1313 | + foreach($rows as $content) { |
|
1314 | + $table->setCellContents($row, $column, $content); |
|
1315 | 1315 | $row++; |
1316 | 1316 | } |
1317 | 1317 | } |
@@ -1417,7 +1417,7 @@ discard block |
||
1417 | 1417 | //$item_property['tool'] != TOOL_DROPBOX && |
1418 | 1418 | $item_property['tool'] != TOOL_NOTEBOOK && |
1419 | 1419 | $item_property['tool'] != TOOL_CHAT) |
1420 | - ) |
|
1420 | + ) |
|
1421 | 1421 | ) |
1422 | 1422 | // Take only what's visible or "invisible but where the user is a teacher" or where the visibility is unset. |
1423 | 1423 | && ($item_property['visibility'] == '1' |
@@ -1433,7 +1433,7 @@ discard block |
||
1433 | 1433 | ($item_property['to_user_id'] != $user_id) && |
1434 | 1434 | (!isset($item_property['to_group_id']) || !in_array($item_property['to_group_id'], $group_ids))) |
1435 | 1435 | ) { |
1436 | - continue; |
|
1436 | + continue; |
|
1437 | 1437 | } |
1438 | 1438 | |
1439 | 1439 | // If it's a survey, make sure the user's invited. Otherwise drop it. |
@@ -1651,21 +1651,21 @@ discard block |
||
1651 | 1651 | * |
1652 | 1652 | * @param string id of the rating ul element |
1653 | 1653 | * @param string url that will be added (for jquery see hot_courses.tpl) |
1654 | - * @param string point info array see function CourseManager::get_course_ranking() |
|
1655 | - * @param bool add a div wrapper |
|
1656 | - * @todo use templates |
|
1654 | + * @param string point info array see function CourseManager::get_course_ranking() |
|
1655 | + * @param bool add a div wrapper |
|
1656 | + * @todo use templates |
|
1657 | 1657 | **/ |
1658 | 1658 | public static function return_rating_system($id, $url, $point_info = array(), $add_div_wrapper = true) |
1659 | 1659 | { |
1660 | - $number_of_users_who_voted = isset($point_info['users_who_voted']) ? $point_info['users_who_voted'] : null; |
|
1661 | - $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0; |
|
1660 | + $number_of_users_who_voted = isset($point_info['users_who_voted']) ? $point_info['users_who_voted'] : null; |
|
1661 | + $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0; |
|
1662 | 1662 | |
1663 | - if (!empty($percentage)) { |
|
1663 | + if (!empty($percentage)) { |
|
1664 | 1664 | $percentage = $percentage*125/100; |
1665 | 1665 | } |
1666 | - $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
1666 | + $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
1667 | 1667 | |
1668 | - $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']); |
|
1668 | + $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']); |
|
1669 | 1669 | |
1670 | 1670 | $html = '<ul id="'.$id.'" class="star-rating"> |
1671 | 1671 | <li class="current-rating" style="width:'.$percentage.'px;"></li> |
@@ -1676,26 +1676,26 @@ discard block |
||
1676 | 1676 | <li><a href="javascript:void(0);" data-link="'.$url.'&star=5" title="'.$star_label.'" class="five-stars">5</a></li> |
1677 | 1677 | </ul>'; |
1678 | 1678 | |
1679 | - $labels = array(); |
|
1679 | + $labels = array(); |
|
1680 | 1680 | |
1681 | - $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
1682 | - $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
1683 | - /* if (!empty($number_of_users_who_voted)) { |
|
1681 | + $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
1682 | + $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
1683 | + /* if (!empty($number_of_users_who_voted)) { |
|
1684 | 1684 | $labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5'; |
1685 | 1685 | } */ |
1686 | 1686 | |
1687 | - $labels[]= $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] '; |
|
1687 | + $labels[]= $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] '; |
|
1688 | 1688 | |
1689 | - if (!$add_div_wrapper && api_is_anonymous()) { |
|
1690 | - $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
1691 | - } |
|
1689 | + if (!$add_div_wrapper && api_is_anonymous()) { |
|
1690 | + $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
1691 | + } |
|
1692 | 1692 | |
1693 | 1693 | $html .= Display::div(implode(' | ', $labels) , array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info')); |
1694 | 1694 | $html .= ' '.Display::span(' ', array('id' => 'vote_label2_'.$id)); |
1695 | 1695 | |
1696 | 1696 | if ($add_div_wrapper) { |
1697 | - $html = Display::div($html, array('id' => 'rating_wrapper_'.$id)); |
|
1698 | - } |
|
1697 | + $html = Display::div($html, array('id' => 'rating_wrapper_'.$id)); |
|
1698 | + } |
|
1699 | 1699 | |
1700 | 1700 | return $html; |
1701 | 1701 | } |
@@ -1733,8 +1733,8 @@ discard block |
||
1733 | 1733 | return self::page_header($title, $second_title); |
1734 | 1734 | } |
1735 | 1735 | |
1736 | - public static function page_subheader_and_translate($title, $second_title = null) |
|
1737 | - { |
|
1736 | + public static function page_subheader_and_translate($title, $second_title = null) |
|
1737 | + { |
|
1738 | 1738 | $title = get_lang($title); |
1739 | 1739 | return self::page_subheader($title, $second_title); |
1740 | 1740 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param string Optional help file name |
57 | 57 | * @param string $page_header |
58 | 58 | */ |
59 | - public static function display_header($tool_name ='', $help = null, $page_header = null) |
|
59 | + public static function display_header($tool_name = '', $help = null, $page_header = null) |
|
60 | 60 | { |
61 | 61 | $origin = api_get_origin(); |
62 | 62 | $showHeader = true; |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $grid_class = array(), |
355 | 355 | $elementCount = 0 |
356 | 356 | ) { |
357 | - $column = 0; |
|
357 | + $column = 0; |
|
358 | 358 | $default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20; |
359 | 359 | |
360 | 360 | $table = new SortableTableFromArray($content, $column, $default_items_per_page, $name); |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | * @deprecated use Display::addFlash with Display::return_message |
484 | 484 | * @return void |
485 | 485 | */ |
486 | - public static function display_confirmation_message ($message, $filter = true, $returnValue = false) |
|
486 | + public static function display_confirmation_message($message, $filter = true, $returnValue = false) |
|
487 | 487 | { |
488 | 488 | $message = self::return_message($message, 'confirm', $filter); |
489 | 489 | if ($returnValue) { |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | * |
503 | 503 | * @return void |
504 | 504 | */ |
505 | - public static function display_error_message ($message, $filter = true, $returnValue = false) |
|
505 | + public static function display_error_message($message, $filter = true, $returnValue = false) |
|
506 | 506 | { |
507 | 507 | $message = self::return_message($message, 'error', $filter); |
508 | 508 | if ($returnValue) { |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | * @param string $type |
518 | 518 | * @param bool $filter |
519 | 519 | */ |
520 | - public static function return_message_and_translate($message, $type='normal', $filter = true) |
|
520 | + public static function return_message_and_translate($message, $type = 'normal', $filter = true) |
|
521 | 521 | { |
522 | 522 | $message = get_lang($message); |
523 | 523 | echo self::return_message($message, $type, $filter); |
@@ -584,14 +584,14 @@ discard block |
||
584 | 584 | } |
585 | 585 | // Encrypt email |
586 | 586 | $hmail = ''; |
587 | - for ($i = 0; $i < strlen($email); $i ++) { |
|
587 | + for ($i = 0; $i < strlen($email); $i++) { |
|
588 | 588 | $hmail .= '&#'.ord($email { |
589 | 589 | $i }).';'; |
590 | 590 | } |
591 | 591 | $hclickable_text = null; |
592 | 592 | // Encrypt clickable text if @ is present |
593 | 593 | if (strpos($clickable_text, '@')) { |
594 | - for ($i = 0; $i < strlen($clickable_text); $i ++) { |
|
594 | + for ($i = 0; $i < strlen($clickable_text); $i++) { |
|
595 | 595 | $hclickable_text .= '&#'.ord($clickable_text { |
596 | 596 | $i }).';'; |
597 | 597 | } |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | } |
624 | 624 | // Encrypt email |
625 | 625 | $hmail = ''; |
626 | - for ($i = 0; $i < strlen($email); $i ++) { |
|
626 | + for ($i = 0; $i < strlen($email); $i++) { |
|
627 | 627 | $hmail .= '&#'.ord($email { |
628 | 628 | $i }).';'; |
629 | 629 | } |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | public static function get_alphabet_options($selected_letter = '') |
644 | 644 | { |
645 | 645 | $result = ''; |
646 | - for ($i = 65; $i <= 90; $i ++) { |
|
646 | + for ($i = 65; $i <= 90; $i++) { |
|
647 | 647 | $letter = chr($i); |
648 | 648 | $result .= '<option value="'.$letter.'"'; |
649 | 649 | if ($selected_letter == $letter) { |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | public static function get_numeric_options($min, $max, $selected_num = 0) |
665 | 665 | { |
666 | 666 | $result = ''; |
667 | - for ($i = $min; $i <= $max; $i ++) { |
|
667 | + for ($i = $min; $i <= $max; $i++) { |
|
668 | 668 | $result .= '<option value="'.$i.'"'; |
669 | 669 | if (is_int($selected_num)) |
670 | 670 | if ($selected_num == $i) { |
@@ -734,8 +734,8 @@ discard block |
||
734 | 734 | // important to use the public path (i.e. web/css/) rather than the |
735 | 735 | // internal path (/app/Resource/public/css/) because the path used |
736 | 736 | // in the end must be the public path |
737 | - $alternateCssPath = api_get_path(SYS_PUBLIC_PATH) . 'css/'; |
|
738 | - $alternateWebCssPath = api_get_path(WEB_PUBLIC_PATH) . 'css/'; |
|
737 | + $alternateCssPath = api_get_path(SYS_PUBLIC_PATH).'css/'; |
|
738 | + $alternateWebCssPath = api_get_path(WEB_PUBLIC_PATH).'css/'; |
|
739 | 739 | |
740 | 740 | $image = trim($image); |
741 | 741 | |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | $size = ICON_SIZE_SMALL; |
746 | 746 | } |
747 | 747 | |
748 | - $size_extra = $size . '/'; |
|
748 | + $size_extra = $size.'/'; |
|
749 | 749 | |
750 | 750 | // Checking the img/ folder |
751 | 751 | $icon = $w_code_path.'img/'.$image; |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | $theme = 'themes/chamilo/icons/'; |
754 | 754 | |
755 | 755 | if ($loadThemeIcon) { |
756 | - $theme = 'themes/' . api_get_visual_theme() . '/icons/'; |
|
756 | + $theme = 'themes/'.api_get_visual_theme().'/icons/'; |
|
757 | 757 | // Checking the theme icons folder example: app/Resources/public/css/themes/chamilo/icons/XXX |
758 | 758 | if (is_file($alternateCssPath.$theme.$size_extra.$image)) { |
759 | 759 | $icon = $alternateWebCssPath.$theme.$size_extra.$image; |
@@ -775,11 +775,11 @@ discard block |
||
775 | 775 | // ask for the SVG version directly |
776 | 776 | $svgIcons = api_get_setting('icons_mode_svg'); |
777 | 777 | if ($svgIcons == 'true' && $return_only_path == false) { |
778 | - $svgImage = substr($image, 0, -3) . 'svg'; |
|
779 | - if (is_file($code_path . $theme . 'svg/' . $svgImage)) { |
|
780 | - $icon = $w_code_path . $theme . 'svg/' . $svgImage; |
|
781 | - } elseif (is_file($code_path . 'img/icons/svg/' . $svgImage)) { |
|
782 | - $icon = $w_code_path . 'img/icons/svg/' . $svgImage; |
|
778 | + $svgImage = substr($image, 0, -3).'svg'; |
|
779 | + if (is_file($code_path.$theme.'svg/'.$svgImage)) { |
|
780 | + $icon = $w_code_path.$theme.'svg/'.$svgImage; |
|
781 | + } elseif (is_file($code_path.'img/icons/svg/'.$svgImage)) { |
|
782 | + $icon = $w_code_path.'img/icons/svg/'.$svgImage; |
|
783 | 783 | } |
784 | 784 | |
785 | 785 | if (empty($additional_attributes['height'])) { |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | } |
869 | 869 | } |
870 | 870 | //some tags don't have this </XXX> |
871 | - if (in_array($tag, array('img','input','br'))) { |
|
871 | + if (in_array($tag, array('img', 'input', 'br'))) { |
|
872 | 872 | $return_value = '<'.$tag.' '.$attribute_list.' />'; |
873 | 873 | } else { |
874 | 874 | $return_value = '<'.$tag.' '.$attribute_list.' >'.$content.'</'.$tag.'>'; |
@@ -921,13 +921,13 @@ discard block |
||
921 | 921 | public static function input($type, $name, $value, $attributes = array()) |
922 | 922 | { |
923 | 923 | if (isset($type)) { |
924 | - $attributes['type']= $type; |
|
924 | + $attributes['type'] = $type; |
|
925 | 925 | } |
926 | 926 | if (isset($name)) { |
927 | - $attributes['name']= $name; |
|
927 | + $attributes['name'] = $name; |
|
928 | 928 | } |
929 | 929 | if (isset($value)) { |
930 | - $attributes['value']= $value; |
|
930 | + $attributes['value'] = $value; |
|
931 | 931 | } |
932 | 932 | return self::tag('input', '', $attributes); |
933 | 933 | } |
@@ -960,14 +960,14 @@ discard block |
||
960 | 960 | ) { |
961 | 961 | $html = ''; |
962 | 962 | $extra = ''; |
963 | - $default_id = 'id="' . $name . '" '; |
|
963 | + $default_id = 'id="'.$name.'" '; |
|
964 | 964 | foreach ($extra_attributes as $key => $parameter) { |
965 | 965 | if ($key == 'id') { |
966 | 966 | $default_id = ''; |
967 | 967 | } |
968 | - $extra .= $key . '="' . $parameter . '" '; |
|
968 | + $extra .= $key.'="'.$parameter.'" '; |
|
969 | 969 | } |
970 | - $html .= '<select name="' . $name . '" ' . $default_id . ' ' . $extra . '>'; |
|
970 | + $html .= '<select name="'.$name.'" '.$default_id.' '.$extra.'>'; |
|
971 | 971 | |
972 | 972 | if ($show_blank_item) { |
973 | 973 | if (empty($blank_item_text)) { |
@@ -975,14 +975,14 @@ discard block |
||
975 | 975 | } else { |
976 | 976 | $blank_item_text = Security::remove_XSS($blank_item_text); |
977 | 977 | } |
978 | - $html .= self::tag('option', '-- ' . $blank_item_text . ' --', array('value' => '-1')); |
|
978 | + $html .= self::tag('option', '-- '.$blank_item_text.' --', array('value' => '-1')); |
|
979 | 979 | } |
980 | 980 | if ($values) { |
981 | 981 | foreach ($values as $key => $value) { |
982 | 982 | if (is_array($value) && isset($value['name'])) { |
983 | 983 | $value = $value['name']; |
984 | 984 | } |
985 | - $html .= '<option value="' . $key . '"'; |
|
985 | + $html .= '<option value="'.$key.'"'; |
|
986 | 986 | |
987 | 987 | if (is_array($default)) { |
988 | 988 | foreach ($default as $item) { |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | } |
998 | 998 | } |
999 | 999 | |
1000 | - $html .= '>' . $value . '</option>'; |
|
1000 | + $html .= '>'.$value.'</option>'; |
|
1001 | 1001 | } |
1002 | 1002 | } |
1003 | 1003 | $html .= '</select>'; |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | */ |
1026 | 1026 | public static function tabs($headers, $items, $id = 'tabs', $attributes = array(), $ul_attributes = array()) |
1027 | 1027 | { |
1028 | - if (empty($headers) || count($headers) == 0 ) { |
|
1028 | + if (empty($headers) || count($headers) == 0) { |
|
1029 | 1029 | return ''; |
1030 | 1030 | } |
1031 | 1031 | |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | if ($i == 1) { |
1037 | 1037 | $active = ' active'; |
1038 | 1038 | } |
1039 | - $item = self::tag('a', $item, array('href'=>'#'.$id.'-'.$i, 'role'=> 'tab', 'data-toggle' => 'tab', 'id' => $id . $i)); |
|
1039 | + $item = self::tag('a', $item, array('href'=>'#'.$id.'-'.$i, 'role'=> 'tab', 'data-toggle' => 'tab', 'id' => $id.$i)); |
|
1040 | 1040 | $ul_attributes['role'] = 'presentation'; |
1041 | 1041 | $ul_attributes['class'] = $active; |
1042 | 1042 | $lis .= self::tag('li', $item, $ul_attributes); |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | |
1066 | 1066 | $main_div = self::tag('div', $ul.self::tag('div', $divs, ['class' => 'tab-content']), $attributes); |
1067 | 1067 | |
1068 | - return $main_div ; |
|
1068 | + return $main_div; |
|
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | /** |
@@ -1113,8 +1113,8 @@ discard block |
||
1113 | 1113 | */ |
1114 | 1114 | public static function grid_html($div_id) |
1115 | 1115 | { |
1116 | - $table = self::tag('table','', array('id' => $div_id)); |
|
1117 | - $table .= self::tag('div','', array('id' => $div_id.'_pager')); |
|
1116 | + $table = self::tag('table', '', array('id' => $div_id)); |
|
1117 | + $table .= self::tag('div', '', array('id' => $div_id.'_pager')); |
|
1118 | 1118 | return $table; |
1119 | 1119 | } |
1120 | 1120 | |
@@ -1175,7 +1175,7 @@ discard block |
||
1175 | 1175 | $obj->colNames = $column_names; |
1176 | 1176 | $obj->colModel = $column_model; |
1177 | 1177 | $obj->pager = '#'.$div_id.'_pager'; |
1178 | - $obj->datatype = 'json'; |
|
1178 | + $obj->datatype = 'json'; |
|
1179 | 1179 | $obj->viewrecords = 'true'; |
1180 | 1180 | |
1181 | 1181 | $all_value = 10000000; |
@@ -1236,10 +1236,10 @@ discard block |
||
1236 | 1236 | // Adding static data. |
1237 | 1237 | if (!empty($data)) { |
1238 | 1238 | $data_var = $div_id.'_data'; |
1239 | - $json.=' var '.$data_var.' = '.json_encode($data).';'; |
|
1239 | + $json .= ' var '.$data_var.' = '.json_encode($data).';'; |
|
1240 | 1240 | $obj->data = $data_var; |
1241 | 1241 | $obj->datatype = 'local'; |
1242 | - $json.="\n"; |
|
1242 | + $json .= "\n"; |
|
1243 | 1243 | } |
1244 | 1244 | |
1245 | 1245 | $obj->end = 'end'; |
@@ -1253,12 +1253,12 @@ discard block |
||
1253 | 1253 | } |
1254 | 1254 | |
1255 | 1255 | // Fixing true/false js values that doesn't need the "" |
1256 | - $json_encode = str_replace(':"true"',':true',$json_encode); |
|
1256 | + $json_encode = str_replace(':"true"', ':true', $json_encode); |
|
1257 | 1257 | // wrap_cell is not a valid jqgrid attributes is a hack to wrap a text |
1258 | 1258 | $json_encode = str_replace('"wrap_cell":true', 'cellattr : function(rowId, value, rowObject, colModel, arrData) { return \'class = "jqgrid_whitespace"\'; }', $json_encode); |
1259 | - $json_encode = str_replace(':"false"',':false',$json_encode); |
|
1259 | + $json_encode = str_replace(':"false"', ':false', $json_encode); |
|
1260 | 1260 | $json_encode = str_replace('"formatter":"action_formatter"', 'formatter:action_formatter', $json_encode); |
1261 | - $json_encode = str_replace(array('{"first":"first",','"end":"end"}'), '', $json_encode); |
|
1261 | + $json_encode = str_replace(array('{"first":"first",', '"end":"end"}'), '', $json_encode); |
|
1262 | 1262 | |
1263 | 1263 | // Creating the jqgrid element. |
1264 | 1264 | $json .= '$("#'.$div_id.'").jqGrid({'; |
@@ -1273,22 +1273,22 @@ discard block |
||
1273 | 1273 | $groups = ''; |
1274 | 1274 | foreach ($extra_params['groupHeaders'] as $group) { |
1275 | 1275 | //{ "startColumnName" : "courses", "numberOfColumns" : 1, "titleText" : "Order Info" }, |
1276 | - $groups .= '{ "startColumnName" : "' . $group['startColumnName'] . '", "numberOfColumns" : ' . $group['numberOfColumns'] . ', "titleText" : "' . $group['titleText'] . '" },'; |
|
1276 | + $groups .= '{ "startColumnName" : "'.$group['startColumnName'].'", "numberOfColumns" : '.$group['numberOfColumns'].', "titleText" : "'.$group['titleText'].'" },'; |
|
1277 | 1277 | |
1278 | 1278 | } |
1279 | 1279 | $json .= '$("#'.$div_id.'").jqGrid("setGroupHeaders", { |
1280 | 1280 | "useColSpanStyle" : false, |
1281 | 1281 | "groupHeaders" : [ |
1282 | - ' . $groups . ' |
|
1282 | + ' . $groups.' |
|
1283 | 1283 | ] |
1284 | 1284 | });'; |
1285 | 1285 | } |
1286 | 1286 | |
1287 | 1287 | $all_text = addslashes(get_lang('All')); |
1288 | 1288 | $json .= '$("'.$obj->pager.' option[value='.$all_value.']").text("'.$all_text.'");'; |
1289 | - $json.= "\n"; |
|
1289 | + $json .= "\n"; |
|
1290 | 1290 | // Adding edit/delete icons. |
1291 | - $json.= $formatter; |
|
1291 | + $json .= $formatter; |
|
1292 | 1292 | |
1293 | 1293 | return $json; |
1294 | 1294 | } |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | } |
1320 | 1320 | |
1321 | 1321 | if (!empty($rows)) { |
1322 | - foreach($rows as $content) { |
|
1322 | + foreach ($rows as $content) { |
|
1323 | 1323 | $table->setCellContents($row, $column, $content); |
1324 | 1324 | $row++; |
1325 | 1325 | } |
@@ -1481,7 +1481,7 @@ discard block |
||
1481 | 1481 | |
1482 | 1482 | // Show all tool icons where there is something new. |
1483 | 1483 | $return = ' '; |
1484 | - foreach($notifications as $notification) { |
|
1484 | + foreach ($notifications as $notification) { |
|
1485 | 1485 | $lastDate = date('d/m/Y H:i', convert_sql_date($notification['lastedit_date'])); |
1486 | 1486 | $type = $notification['lastedit_type']; |
1487 | 1487 | $label = get_lang('TitleNotification').": ".get_lang($type)." ($lastDate)"; |
@@ -1524,9 +1524,9 @@ discard block |
||
1524 | 1524 | $main_user_table = Database :: get_main_table(TABLE_MAIN_USER); |
1525 | 1525 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
1526 | 1526 | // Request for the name of the general coach |
1527 | - $sql ='SELECT tu.lastname, tu.firstname, ts.* |
|
1527 | + $sql = 'SELECT tu.lastname, tu.firstname, ts.* |
|
1528 | 1528 | FROM '.$tbl_session.' ts |
1529 | - LEFT JOIN '.$main_user_table .' tu |
|
1529 | + LEFT JOIN '.$main_user_table.' tu |
|
1530 | 1530 | ON ts.id_coach = tu.user_id |
1531 | 1531 | WHERE ts.id = '.intval($session_id); |
1532 | 1532 | $rs = Database::query($sql); |
@@ -1538,7 +1538,7 @@ discard block |
||
1538 | 1538 | $session['title'] = $session_info['name']; |
1539 | 1539 | $session['id_coach'] = $session_info['id_coach']; |
1540 | 1540 | $session['coach'] = ''; |
1541 | - $session['dates'] = ''; |
|
1541 | + $session['dates'] = ''; |
|
1542 | 1542 | |
1543 | 1543 | if (($session_info['access_end_date'] == '0000-00-00 00:00:00' && $session_info['access_start_date'] == '0000-00-00 00:00:00') || |
1544 | 1544 | ($session_info['access_end_date'] == '0000-00-00 00:00:00' && $session_info['access_start_date'] == '0000-00-00 00:00:00') || |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | $session['dates'] = $dates['access']; |
1611 | 1611 | |
1612 | 1612 | |
1613 | - if (api_get_setting('show_session_coach') === 'true' ) { |
|
1613 | + if (api_get_setting('show_session_coach') === 'true') { |
|
1614 | 1614 | $session['coach'] = api_get_person_name( |
1615 | 1615 | $session_info['firstname'], |
1616 | 1616 | $session_info['lastname'] |
@@ -1664,9 +1664,9 @@ discard block |
||
1664 | 1664 | $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0; |
1665 | 1665 | |
1666 | 1666 | if (!empty($percentage)) { |
1667 | - $percentage = $percentage*125/100; |
|
1667 | + $percentage = $percentage * 125 / 100; |
|
1668 | 1668 | } |
1669 | - $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
1669 | + $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
1670 | 1670 | |
1671 | 1671 | $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']); |
1672 | 1672 | |
@@ -1681,19 +1681,19 @@ discard block |
||
1681 | 1681 | |
1682 | 1682 | $labels = array(); |
1683 | 1683 | |
1684 | - $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
1685 | - $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
1684 | + $labels[] = $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
1685 | + $labels[] = $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
1686 | 1686 | /* if (!empty($number_of_users_who_voted)) { |
1687 | 1687 | $labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5'; |
1688 | 1688 | } */ |
1689 | 1689 | |
1690 | - $labels[]= $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] '; |
|
1690 | + $labels[] = $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote').' [?] '; |
|
1691 | 1691 | |
1692 | 1692 | if (!$add_div_wrapper && api_is_anonymous()) { |
1693 | - $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
1693 | + $labels[] = Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
1694 | 1694 | } |
1695 | 1695 | |
1696 | - $html .= Display::div(implode(' | ', $labels) , array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info')); |
|
1696 | + $html .= Display::div(implode(' | ', $labels), array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info')); |
|
1697 | 1697 | $html .= ' '.Display::span(' ', array('id' => 'vote_label2_'.$id)); |
1698 | 1698 | |
1699 | 1699 | if ($add_div_wrapper) { |
@@ -1766,8 +1766,8 @@ discard block |
||
1766 | 1766 | if (!empty($list)) { |
1767 | 1767 | $html = '<dl class="dl-horizontal">'; |
1768 | 1768 | foreach ($list as $item) { |
1769 | - $html .= '<dt>' . $item['title'] . '</dt>'; |
|
1770 | - $html .= '<dd>' . $item['content'] . '</dd>'; |
|
1769 | + $html .= '<dt>'.$item['title'].'</dt>'; |
|
1770 | + $html .= '<dd>'.$item['content'].'</dd>'; |
|
1771 | 1771 | } |
1772 | 1772 | $html .= '</dl>'; |
1773 | 1773 | } |
@@ -1809,7 +1809,7 @@ discard block |
||
1809 | 1809 | * @param string $type |
1810 | 1810 | * @return null|string |
1811 | 1811 | */ |
1812 | - public static function badge($count, $type ="warning") |
|
1812 | + public static function badge($count, $type = "warning") |
|
1813 | 1813 | { |
1814 | 1814 | $class = ''; |
1815 | 1815 | |
@@ -1885,7 +1885,7 @@ discard block |
||
1885 | 1885 | if (!empty($content)) { |
1886 | 1886 | $html = '<span class="label '.$class.'">'; |
1887 | 1887 | $html .= $content; |
1888 | - $html .='</span>'; |
|
1888 | + $html .= '</span>'; |
|
1889 | 1889 | } |
1890 | 1890 | |
1891 | 1891 | return $html; |
@@ -1906,7 +1906,7 @@ discard block |
||
1906 | 1906 | $class = 'class ="active"'; |
1907 | 1907 | } |
1908 | 1908 | |
1909 | - if (basename($_SERVER['REQUEST_URI']) == basename($value['url']) ) { |
|
1909 | + if (basename($_SERVER['REQUEST_URI']) == basename($value['url'])) { |
|
1910 | 1910 | $class = 'class ="active"'; |
1911 | 1911 | } |
1912 | 1912 | $html .= "<li $class >"; |
@@ -2160,7 +2160,7 @@ discard block |
||
2160 | 2160 | } |
2161 | 2161 | $label = $nextValue + $localCounter + 1; |
2162 | 2162 | if ($isMedia) { |
2163 | - $label = ($fixedValue + 1) .' '.chr(97 + $localCounter); |
|
2163 | + $label = ($fixedValue + 1).' '.chr(97 + $localCounter); |
|
2164 | 2164 | $link_to_show = $link.$fixedValue.'#questionanchor'.$itemId; |
2165 | 2165 | } |
2166 | 2166 | $link = Display::url($label.' ', $link_to_show, $linkAttributes); |
@@ -2341,7 +2341,7 @@ discard block |
||
2341 | 2341 | $attributes['title'] = isset($attributes['title']) ? $attributes['title'] : $text; |
2342 | 2342 | |
2343 | 2343 | if (!$includeText) { |
2344 | - $text = '<span class="sr-only">' . $text . '</span>'; |
|
2344 | + $text = '<span class="sr-only">'.$text.'</span>'; |
|
2345 | 2345 | } |
2346 | 2346 | |
2347 | 2347 | return self::url("$icon $text", $url, $attributes); |
@@ -2356,9 +2356,9 @@ discard block |
||
2356 | 2356 | */ |
2357 | 2357 | public static function toolbarAction($id, $content = array(), $col = 2, $right = true) |
2358 | 2358 | { |
2359 | - $columns = 12/$col; |
|
2359 | + $columns = 12 / $col; |
|
2360 | 2360 | $html = ''; |
2361 | - $html .= '<div id="' . $id . '" class="actions">'; |
|
2361 | + $html .= '<div id="'.$id.'" class="actions">'; |
|
2362 | 2362 | $html .= '<div class="row">'; |
2363 | 2363 | if ($col > 4) { |
2364 | 2364 | $html = '<div class="alert alert-warning" role="alert"> |
@@ -2366,7 +2366,7 @@ discard block |
||
2366 | 2366 | </div>'; |
2367 | 2367 | } else { |
2368 | 2368 | for ($i = 0; $i < $col; $i++) { |
2369 | - $html .= '<div class="col-md-' . $columns . '">'; |
|
2369 | + $html .= '<div class="col-md-'.$columns.'">'; |
|
2370 | 2370 | if ($col == 2 && $i == 1) { |
2371 | 2371 | if ($right === true) { |
2372 | 2372 | $html .= '<div class="pull-right">'; |
@@ -2482,9 +2482,9 @@ discard block |
||
2482 | 2482 | $params['class'] = 'panel panel-default'; |
2483 | 2483 | $html = null; |
2484 | 2484 | if (!empty($title)) { |
2485 | - $html .= '<div class="panel-heading">'.$title.'</div>' . PHP_EOL; |
|
2485 | + $html .= '<div class="panel-heading">'.$title.'</div>'.PHP_EOL; |
|
2486 | 2486 | } |
2487 | - $html.= '<div class="panel-body">'.$content.'</div>' . PHP_EOL; |
|
2487 | + $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL; |
|
2488 | 2488 | $html = Display::div($html, $params); |
2489 | 2489 | } |
2490 | 2490 | return $html; |
@@ -333,8 +333,12 @@ discard block |
||
333 | 333 | ) { |
334 | 334 | global $debug; |
335 | 335 | |
336 | - if ($debug) error_log('Called to update_event_exercice'); |
|
337 | - if ($debug) error_log('duration:' . $duration); |
|
336 | + if ($debug) { |
|
337 | + error_log('Called to update_event_exercice'); |
|
338 | + } |
|
339 | + if ($debug) { |
|
340 | + error_log('duration:' . $duration); |
|
341 | + } |
|
338 | 342 | |
339 | 343 | if ($exeid != '') { |
340 | 344 | /* |
@@ -386,8 +390,12 @@ discard block |
||
386 | 390 | WHERE exe_id = '".Database::escape_string($exeid)."'"; |
387 | 391 | $res = Database::query($sql); |
388 | 392 | |
389 | - if ($debug) error_log('update_event_exercice called'); |
|
390 | - if ($debug) error_log("$sql"); |
|
393 | + if ($debug) { |
|
394 | + error_log('update_event_exercice called'); |
|
395 | + } |
|
396 | + if ($debug) { |
|
397 | + error_log("$sql"); |
|
398 | + } |
|
391 | 399 | |
392 | 400 | //Deleting control time session track |
393 | 401 | //ExerciseLib::exercise_time_control_delete($exo_id); |
@@ -77,9 +77,7 @@ discard block |
||
77 | 77 | Database::query($sql); |
78 | 78 | |
79 | 79 | // Auto subscribe |
80 | - $user_status = $userInfo['status'] == SESSIONADMIN ? 'sessionadmin' : |
|
81 | - $userInfo['status'] == COURSEMANAGER ? 'teacher' : |
|
82 | - $userInfo['status'] == DRH ? 'DRH' : 'student'; |
|
80 | + $user_status = $userInfo['status'] == SESSIONADMIN ? 'sessionadmin' : $userInfo['status'] == COURSEMANAGER ? 'teacher' : $userInfo['status'] == DRH ? 'DRH' : 'student'; |
|
83 | 81 | $autoSubscribe = api_get_setting($user_status.'_autosubscribe'); |
84 | 82 | if ($autoSubscribe) { |
85 | 83 | $autoSubscribe = explode('|', $autoSubscribe); |
@@ -336,7 +334,7 @@ discard block |
||
336 | 334 | global $debug; |
337 | 335 | |
338 | 336 | if ($debug) error_log('Called to update_event_exercice'); |
339 | - if ($debug) error_log('duration:' . $duration); |
|
337 | + if ($debug) error_log('duration:'.$duration); |
|
340 | 338 | |
341 | 339 | if ($exeid != '') { |
342 | 340 | /* |
@@ -384,7 +382,7 @@ discard block |
||
384 | 382 | status = '".$status."', |
385 | 383 | questions_to_check = '".$remind_list."', |
386 | 384 | data_tracking = '".implode(',', $question_list)."', |
387 | - user_ip = '" . Database::escape_string(api_get_real_ip()) . "' |
|
385 | + user_ip = '" . Database::escape_string(api_get_real_ip())."' |
|
388 | 386 | WHERE exe_id = '".Database::escape_string($exeid)."'"; |
389 | 387 | $res = Database::query($sql); |
390 | 388 | |
@@ -1055,15 +1053,15 @@ discard block |
||
1055 | 1053 | |
1056 | 1054 | if (!empty($exe_list) && is_array($exe_list) && count($exe_list) > 0) { |
1057 | 1055 | $sql = "DELETE FROM $track_e_exercises |
1058 | - WHERE exe_id IN (" . implode(',', $exe_list) . ")"; |
|
1056 | + WHERE exe_id IN (".implode(',', $exe_list).")"; |
|
1059 | 1057 | Database::query($sql); |
1060 | 1058 | |
1061 | 1059 | $sql = "DELETE FROM $track_attempts |
1062 | - WHERE exe_id IN (" . implode(',', $exe_list) . ")"; |
|
1060 | + WHERE exe_id IN (".implode(',', $exe_list).")"; |
|
1063 | 1061 | Database::query($sql); |
1064 | 1062 | |
1065 | 1063 | $sql = "DELETE FROM $recording_table |
1066 | - WHERE exe_id IN (" . implode(',', $exe_list) . ")"; |
|
1064 | + WHERE exe_id IN (".implode(',', $exe_list).")"; |
|
1067 | 1065 | Database::query($sql); |
1068 | 1066 | } |
1069 | 1067 | |
@@ -1105,7 +1103,7 @@ discard block |
||
1105 | 1103 | Event::addEvent( |
1106 | 1104 | LOG_EXERCISE_RESULT_DELETE, |
1107 | 1105 | LOG_EXERCISE_AND_USER_ID, |
1108 | - $exercise_id . '-' . $user_id, |
|
1106 | + $exercise_id.'-'.$user_id, |
|
1109 | 1107 | null, |
1110 | 1108 | null, |
1111 | 1109 | $course_id, |
@@ -1705,7 +1703,7 @@ discard block |
||
1705 | 1703 | Event::addEvent( |
1706 | 1704 | LOG_QUESTION_RESULT_DELETE, |
1707 | 1705 | LOG_EXERCISE_ATTEMPT_QUESTION_ID, |
1708 | - $exe_id . '-' . $question_id, |
|
1706 | + $exe_id.'-'.$question_id, |
|
1709 | 1707 | null, |
1710 | 1708 | null, |
1711 | 1709 | $courseId, |
@@ -1741,7 +1739,7 @@ discard block |
||
1741 | 1739 | Event::addEvent( |
1742 | 1740 | LOG_QUESTION_RESULT_DELETE, |
1743 | 1741 | LOG_EXERCISE_ATTEMPT_QUESTION_ID, |
1744 | - $exe_id . '-' . $question_id, |
|
1742 | + $exe_id.'-'.$question_id, |
|
1745 | 1743 | null, |
1746 | 1744 | null, |
1747 | 1745 | $courseId, |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
242 | - * @param doc_id id of document (id in mainDb.document table) |
|
242 | + * @param doc_id string of document (id in mainDb.document table) |
|
243 | 243 | * @author Sebastien Piraux <[email protected]> |
244 | 244 | * @desc Record information for upload event |
245 | 245 | * used in the works tool to record informations when |
@@ -313,6 +313,9 @@ discard block |
||
313 | 313 | * @param int session_id |
314 | 314 | * @param int learnpath_id (id of the learnpath) |
315 | 315 | * @param int learnpath_item_id (id of the learnpath_item) |
316 | + * @param integer $score |
|
317 | + * @param integer $weighting |
|
318 | + * @param integer $session_id |
|
316 | 319 | * |
317 | 320 | * @author Sebastien Piraux <[email protected]> |
318 | 321 | * @author Julio Montoya Armas <[email protected]> Reworked 2010 |
@@ -414,7 +417,9 @@ discard block |
||
414 | 417 | * @param integer Session ID (from the session table). Default value of null means "get from context". |
415 | 418 | * @param integer Learnpath ID (from c_lp table). Default value of null means "get from context". |
416 | 419 | * @param integer Learnpath item ID (from the c_lp_item table). Default value of null means "get from context". |
417 | - * @return boolean Result of the insert query |
|
420 | + * @param integer $exe_id |
|
421 | + * @param integer $position |
|
422 | + * @return false|string Result of the insert query |
|
418 | 423 | */ |
419 | 424 | public static function saveQuestionAttempt( |
420 | 425 | $score, |
@@ -588,6 +593,8 @@ discard block |
||
588 | 593 | * @param int Whether this answer is correct (1) or not (0) |
589 | 594 | * @param string Coordinates of this point (e.g. 123;324) |
590 | 595 | * @param bool update results? |
596 | + * @param integer $exe_id |
|
597 | + * @param integer $correct |
|
591 | 598 | * @return boolean Result of the insert query |
592 | 599 | * @uses Course code and user_id from global scope $_cid and $_user |
593 | 600 | */ |
@@ -800,11 +807,11 @@ discard block |
||
800 | 807 | /** |
801 | 808 | * Save the new message for one event and for one language |
802 | 809 | * |
803 | - * @param string $eventName |
|
810 | + * @param string $event_name |
|
804 | 811 | * @param array $users |
805 | 812 | * @param string $message |
806 | 813 | * @param string $subject |
807 | - * @param string $eventMessageLanguage |
|
814 | + * @param string $event_message_language |
|
808 | 815 | * @param int $activated |
809 | 816 | */ |
810 | 817 | public static function save_event_type_message($event_name, $users, $message, $subject, $event_message_language, $activated) |
@@ -938,10 +945,10 @@ discard block |
||
938 | 945 | } |
939 | 946 | |
940 | 947 | /** |
941 | - * @param $user_id |
|
948 | + * @param integer $user_id |
|
942 | 949 | * @param $exerciseId |
943 | - * @param $lp_id |
|
944 | - * @param $lp_item_id |
|
950 | + * @param integer $lp_id |
|
951 | + * @param integer $lp_item_id |
|
945 | 952 | * @return int |
946 | 953 | */ |
947 | 954 | public static function get_attempt_count_not_finished($user_id, $exerciseId, $lp_id, $lp_item_id) |
@@ -1118,6 +1125,7 @@ discard block |
||
1118 | 1125 | * @param int exercise id |
1119 | 1126 | * @param int $courseId |
1120 | 1127 | * @param int session id |
1128 | + * @param integer $user_id |
|
1121 | 1129 | * @return array with the results |
1122 | 1130 | * |
1123 | 1131 | */ |
@@ -1213,6 +1221,7 @@ discard block |
||
1213 | 1221 | * @param int exercise id |
1214 | 1222 | * @param int $courseId |
1215 | 1223 | * @param int session id |
1224 | + * @param integer $user_id |
|
1216 | 1225 | * @return array with the results |
1217 | 1226 | * |
1218 | 1227 | */ |
@@ -1301,6 +1310,8 @@ discard block |
||
1301 | 1310 | * @param int lp id |
1302 | 1311 | * @param int lp item id |
1303 | 1312 | * @param string order asc or desc |
1313 | + * @param integer $courseId |
|
1314 | + * @param string $order |
|
1304 | 1315 | * @return array with the results |
1305 | 1316 | * |
1306 | 1317 | */ |
@@ -1367,7 +1378,7 @@ discard block |
||
1367 | 1378 | * @param int exercise id |
1368 | 1379 | * @param int $courseId |
1369 | 1380 | * @param int session id |
1370 | - * @return array with the results |
|
1381 | + * @return string with the results |
|
1371 | 1382 | * |
1372 | 1383 | */ |
1373 | 1384 | public static function count_exercise_attempts_by_user($user_id, $exercise_id, $courseId, $session_id = 0) |
@@ -1538,7 +1549,7 @@ discard block |
||
1538 | 1549 | * @param int exercise id |
1539 | 1550 | * @param int course id |
1540 | 1551 | * @param int session id |
1541 | - * @return array with the results |
|
1552 | + * @return integer with the results |
|
1542 | 1553 | * |
1543 | 1554 | */ |
1544 | 1555 | public static function get_count_exercises_attempted_by_course($courseId, $session_id = 0) |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | if ($course_visibility != COURSE_VISIBILITY_HIDDEN && |
511 | 511 | ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER) |
512 | 512 | ) { |
513 | - $result .= '<span class="title">' . $course_title . '<span>'; |
|
513 | + $result .= '<span class="title">' . $course_title . '<span>'; |
|
514 | 514 | } else { |
515 | 515 | $result .= $course_title." "." ".get_lang('CourseClosed').""; |
516 | 516 | } |
@@ -1414,7 +1414,7 @@ discard block |
||
1414 | 1414 | } |
1415 | 1415 | $media .= '<div class="user-image">'; |
1416 | 1416 | $media .= '<a href="'.$url.'" ><img src="'. $users[$userIdLoop]['avatar'] . |
1417 | - '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>'; |
|
1417 | + '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>'; |
|
1418 | 1418 | $media .= '</div>'; |
1419 | 1419 | $media .= '<div class="user-data">'; |
1420 | 1420 | $media .= '<div class="username">' . '<a href="'.$url.'">'.$nameComplete.'</a></div>'; |
@@ -1645,10 +1645,10 @@ discard block |
||
1645 | 1645 | return $name; |
1646 | 1646 | } |
1647 | 1647 | /** |
1648 | - * Delete messages delete logic |
|
1649 | - * @param int $id id message to delete. |
|
1650 | - * @return bool status query |
|
1651 | - */ |
|
1648 | + * Delete messages delete logic |
|
1649 | + * @param int $id id message to delete. |
|
1650 | + * @return bool status query |
|
1651 | + */ |
|
1652 | 1652 | public static function deleteMessage($id) |
1653 | 1653 | { |
1654 | 1654 | $id = intval($id); |
@@ -1761,7 +1761,9 @@ |
||
1761 | 1761 | $friendHtml.= '<ul class="nav nav-list">'; |
1762 | 1762 | $j = 1; |
1763 | 1763 | for ($k=0; $k < $number_friends; $k++) { |
1764 | - if ($j > $number_of_images) break; |
|
1764 | + if ($j > $number_of_images) { |
|
1765 | + break; |
|
1766 | + } |
|
1765 | 1767 | |
1766 | 1768 | if (isset($friends[$k])) { |
1767 | 1769 | $friend = $friends[$k]; |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | friend_user_id<>'.((int) $user_id).' AND |
114 | 114 | user_id='.((int) $user_id); |
115 | 115 | if (isset($id_group) && $id_group > 0) { |
116 | - $sql.=' AND relation_type='.$id_group; |
|
116 | + $sql .= ' AND relation_type='.$id_group; |
|
117 | 117 | } |
118 | 118 | if (isset($search_name)) { |
119 | 119 | $search_name = trim($search_name); |
120 | 120 | $search_name = str_replace(' ', '', $search_name); |
121 | - $sql.=' AND friend_user_id IN ( |
|
121 | + $sql .= ' AND friend_user_id IN ( |
|
122 | 122 | SELECT user_id FROM '.$tbl_my_user.' |
123 | 123 | WHERE |
124 | 124 | firstName LIKE "%'.Database::escape_string($search_name).'%" OR |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | { |
433 | 433 | $user_info = api_get_user_info($userId); |
434 | 434 | $success = get_lang('MessageSentTo'); |
435 | - $success.= ' : '.api_get_person_name($user_info['firstName'], $user_info['lastName']); |
|
435 | + $success .= ' : '.api_get_person_name($user_info['firstName'], $user_info['lastName']); |
|
436 | 436 | |
437 | 437 | if (isset($subject) && isset($content) && isset($userId)) { |
438 | 438 | $result = MessageManager::send_message($userId, $subject, $content); |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | $user_in_course_status = CourseManager :: get_user_in_course_status(api_get_user_id(), $course_code); |
499 | 499 | |
500 | 500 | //$valor = api_get_settings_params(); |
501 | - $course_path = api_get_path(SYS_COURSE_PATH).$course_directory; // course path |
|
501 | + $course_path = api_get_path(SYS_COURSE_PATH).$course_directory; // course path |
|
502 | 502 | if (api_get_setting('course_images_in_courses_list') === 'true') { |
503 | 503 | if (file_exists($course_path.'/course-pic85x85.png')) { |
504 | 504 | $image = $my_course['course_info']['course_image']; |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | if ($course_visibility != COURSE_VISIBILITY_HIDDEN && |
527 | 527 | ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER) |
528 | 528 | ) { |
529 | - $result .= '<span class="title">' . $course_title . '<span>'; |
|
529 | + $result .= '<span class="title">'.$course_title.'<span>'; |
|
530 | 530 | } else { |
531 | 531 | $result .= $course_title." ".get_lang('CourseClosed'); |
532 | 532 | } |
@@ -734,57 +734,57 @@ discard block |
||
734 | 734 | $links = '<ul class="nav nav-pills nav-stacked">'; |
735 | 735 | $active = $show == 'home' ? 'active' : null; |
736 | 736 | $links .= ' |
737 | - <li class="home-icon ' . $active . '"> |
|
738 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php"> |
|
739 | - ' . $homeIcon . ' ' . get_lang('Home') . ' |
|
737 | + <li class="home-icon ' . $active.'"> |
|
738 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/home.php"> |
|
739 | + ' . $homeIcon.' '.get_lang('Home').' |
|
740 | 740 | </a> |
741 | 741 | </li>'; |
742 | 742 | $active = $show == 'messages' ? 'active' : null; |
743 | 743 | $links .= ' |
744 | - <li class="messages-icon ' . $active . '"> |
|
745 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social"> |
|
746 | - ' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . ' |
|
744 | + <li class="messages-icon ' . $active.'"> |
|
745 | + <a href="' . api_get_path(WEB_CODE_PATH).'messages/inbox.php?f=social"> |
|
746 | + ' . $messagesIcon.' '.get_lang('Messages').$count_unread_message.' |
|
747 | 747 | </a> |
748 | 748 | </li>'; |
749 | 749 | |
750 | 750 | //Invitations |
751 | 751 | $active = $show == 'invitations' ? 'active' : null; |
752 | 752 | $links .= ' |
753 | - <li class="invitations-icon ' . $active . '"> |
|
754 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php"> |
|
755 | - ' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . ' |
|
753 | + <li class="invitations-icon ' . $active.'"> |
|
754 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/invitations.php"> |
|
755 | + ' . $invitationsIcon.' '.get_lang('Invitations').$total_invitations.' |
|
756 | 756 | </a> |
757 | 757 | </li>'; |
758 | 758 | |
759 | 759 | //Shared profile and groups |
760 | 760 | $active = $show == 'shared_profile' ? 'active' : null; |
761 | 761 | $links .= ' |
762 | - <li class="shared-profile-icon' . $active . '"> |
|
763 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php"> |
|
764 | - ' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . ' |
|
762 | + <li class="shared-profile-icon' . $active.'"> |
|
763 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/profile.php"> |
|
764 | + ' . $sharedProfileIcon.' '.get_lang('ViewMySharedProfile').' |
|
765 | 765 | </a> |
766 | 766 | </li>'; |
767 | 767 | $active = $show == 'friends' ? 'active' : null; |
768 | 768 | $links .= ' |
769 | - <li class="friends-icon ' . $active . '"> |
|
770 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php"> |
|
771 | - ' . $friendsIcon . ' ' . get_lang('Friends') . ' |
|
769 | + <li class="friends-icon ' . $active.'"> |
|
770 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/friends.php"> |
|
771 | + ' . $friendsIcon.' '.get_lang('Friends').' |
|
772 | 772 | </a> |
773 | 773 | </li>'; |
774 | 774 | $active = $show == 'browse_groups' ? 'active' : null; |
775 | 775 | $links .= ' |
776 | - <li class="browse-groups-icon ' . $active . '"> |
|
777 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php"> |
|
778 | - ' . $groupsIcon . ' ' . get_lang('SocialGroups') . ' |
|
776 | + <li class="browse-groups-icon ' . $active.'"> |
|
777 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/groups.php"> |
|
778 | + ' . $groupsIcon.' '.get_lang('SocialGroups').' |
|
779 | 779 | </a> |
780 | 780 | </li>'; |
781 | 781 | |
782 | 782 | //Search users |
783 | 783 | $active = $show == 'search' ? 'active' : null; |
784 | 784 | $links .= ' |
785 | - <li class="search-icon ' . $active . '"> |
|
786 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php"> |
|
787 | - ' . $searchIcon . ' ' . get_lang('Search') . ' |
|
785 | + <li class="search-icon ' . $active.'"> |
|
786 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/search.php"> |
|
787 | + ' . $searchIcon.' '.get_lang('Search').' |
|
788 | 788 | </a> |
789 | 789 | </li>'; |
790 | 790 | |
@@ -792,9 +792,9 @@ discard block |
||
792 | 792 | $active = $show == 'myfiles' ? 'active' : null; |
793 | 793 | |
794 | 794 | $myFiles = ' |
795 | - <li class="myfiles-icon ' . $active . '"> |
|
796 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php"> |
|
797 | - ' . $filesIcon . ' ' . get_lang('MyFiles') . ' |
|
795 | + <li class="myfiles-icon ' . $active.'"> |
|
796 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/myfiles.php"> |
|
797 | + ' . $filesIcon.' '.get_lang('MyFiles').' |
|
798 | 798 | </a> |
799 | 799 | </li>'; |
800 | 800 | |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | $myFiles = ''; |
803 | 803 | } |
804 | 804 | $links .= $myFiles; |
805 | - $links .='</ul>'; |
|
805 | + $links .= '</ul>'; |
|
806 | 806 | |
807 | 807 | $html .= Display::panelCollapse( |
808 | 808 | get_lang('SocialNetwork'), |
@@ -823,57 +823,57 @@ discard block |
||
823 | 823 | } |
824 | 824 | |
825 | 825 | if ($show == 'shared_profile') { |
826 | - $links = '<ul class="nav nav-pills nav-stacked">'; |
|
826 | + $links = '<ul class="nav nav-pills nav-stacked">'; |
|
827 | 827 | // My own profile |
828 | 828 | if ($show_full_profile && $user_id == intval(api_get_user_id())) { |
829 | 829 | $links .= ' |
830 | - <li class="home-icon ' . $active . '"> |
|
831 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php"> |
|
832 | - ' . $homeIcon . ' ' . get_lang('Home') . ' |
|
830 | + <li class="home-icon ' . $active.'"> |
|
831 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/home.php"> |
|
832 | + ' . $homeIcon.' '.get_lang('Home').' |
|
833 | 833 | </a> |
834 | 834 | </li> |
835 | - <li class="messages-icon ' . $active . '"> |
|
836 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social"> |
|
837 | - ' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . ' |
|
835 | + <li class="messages-icon ' . $active.'"> |
|
836 | + <a href="' . api_get_path(WEB_CODE_PATH).'messages/inbox.php?f=social"> |
|
837 | + ' . $messagesIcon.' '.get_lang('Messages').$count_unread_message.' |
|
838 | 838 | </a> |
839 | 839 | </li>'; |
840 | 840 | $active = $show == 'invitations' ? 'active' : null; |
841 | 841 | $links .= ' |
842 | - <li class="invitations-icon' . $active . '"> |
|
843 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php"> |
|
844 | - ' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . ' |
|
842 | + <li class="invitations-icon' . $active.'"> |
|
843 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/invitations.php"> |
|
844 | + ' . $invitationsIcon.' '.get_lang('Invitations').$total_invitations.' |
|
845 | 845 | </a> |
846 | 846 | </li>'; |
847 | 847 | |
848 | 848 | $links .= ' |
849 | 849 | <li class="shared-profile-icon active"> |
850 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php"> |
|
851 | - ' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . ' |
|
850 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/profile.php"> |
|
851 | + ' . $sharedProfileIcon.' '.get_lang('ViewMySharedProfile').' |
|
852 | 852 | </a> |
853 | 853 | </li> |
854 | 854 | <li class="friends-icon"> |
855 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php"> |
|
856 | - ' . $friendsIcon . ' ' . get_lang('Friends') . ' |
|
855 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/friends.php"> |
|
856 | + ' . $friendsIcon.' '.get_lang('Friends').' |
|
857 | 857 | </a> |
858 | 858 | </li> |
859 | 859 | <li class="browse-groups-icon"> |
860 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php"> |
|
861 | - ' . $groupsIcon . ' ' . get_lang('SocialGroups') . ' |
|
860 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/groups.php"> |
|
861 | + ' . $groupsIcon.' '.get_lang('SocialGroups').' |
|
862 | 862 | </a> |
863 | 863 | </li>'; |
864 | 864 | $active = $show == 'search' ? 'active' : null; |
865 | 865 | $links .= ' |
866 | - <li class="search-icon ' . $active . '"> |
|
867 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php"> |
|
868 | - ' . $searchIcon . ' ' . get_lang('Search') . ' |
|
866 | + <li class="search-icon ' . $active.'"> |
|
867 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/search.php"> |
|
868 | + ' . $searchIcon.' '.get_lang('Search').' |
|
869 | 869 | </a> |
870 | 870 | </li>'; |
871 | 871 | $active = $show == 'myfiles' ? 'active' : null; |
872 | 872 | |
873 | 873 | $myFiles = ' |
874 | - <li class="myfiles-icon ' . $active . '"> |
|
875 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php"> |
|
876 | - ' . $filesIcon . ' ' . get_lang('MyFiles') . ' |
|
874 | + <li class="myfiles-icon ' . $active.'"> |
|
875 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/myfiles.php"> |
|
876 | + ' . $filesIcon.' '.get_lang('MyFiles').' |
|
877 | 877 | </a> |
878 | 878 | </li>'; |
879 | 879 | |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | $links .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'social/invitations.php">'.Display::return_icon('invitation.png', get_lang('YouAlreadySentAnInvitation')).' '.get_lang('YouAlreadySentAnInvitation').'</a></li>'; |
920 | 920 | } else { |
921 | 921 | if (!$show_full_profile) { |
922 | - $links .= '<li><a class="btn-to-send-invitation" href="#" data-send-to="' . $user_id . '" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('invitation.png', get_lang('SocialInvitationToFriends')).' '.get_lang('SendInvitation').'</a></li>'; |
|
922 | + $links .= '<li><a class="btn-to-send-invitation" href="#" data-send-to="'.$user_id.'" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('invitation.png', get_lang('SocialInvitationToFriends')).' '.get_lang('SendInvitation').'</a></li>'; |
|
923 | 923 | } |
924 | 924 | } |
925 | 925 | |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | foreach ($user_list as $uid) { |
1027 | 1027 | $user_info = api_get_user_info($uid, $checkIfUserOnline = true); |
1028 | 1028 | $lastname = $user_info['lastname']; |
1029 | - $firstname = $user_info['firstname']; |
|
1029 | + $firstname = $user_info['firstname']; |
|
1030 | 1030 | $completeName = $firstname.', '.$lastname; |
1031 | 1031 | |
1032 | 1032 | $user_rol = $user_info['status'] == 1 ? Display::return_icon('teacher.png', get_lang('Teacher'), null, ICON_SIZE_TINY) : Display::return_icon('user.png', get_lang('Student'), null, ICON_SIZE_TINY); |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | } |
1045 | 1045 | $img = '<img class="img-responsive img-circle" title="'.$completeName.'" alt="'.$completeName.'" src="'.$userPicture.'">'; |
1046 | 1046 | |
1047 | - $url = null; |
|
1047 | + $url = null; |
|
1048 | 1048 | // Anonymous users can't have access to the profile |
1049 | 1049 | if (!api_is_anonymous()) { |
1050 | 1050 | if (api_get_setting('allow_social_tool') === 'true') { |
@@ -1199,13 +1199,13 @@ discard block |
||
1199 | 1199 | case SOCIAL_CENTER_PLUGIN: |
1200 | 1200 | $social_plugins = array(1, 2); |
1201 | 1201 | if (is_array($social_plugins) && count($social_plugins) > 0) { |
1202 | - $content.= '<div id="social-plugins">'; |
|
1202 | + $content .= '<div id="social-plugins">'; |
|
1203 | 1203 | foreach ($social_plugins as $plugin) { |
1204 | - $content.= '<div class="social-plugin-item">'; |
|
1205 | - $content.= $plugin; |
|
1206 | - $content.= '</div>'; |
|
1204 | + $content .= '<div class="social-plugin-item">'; |
|
1205 | + $content .= $plugin; |
|
1206 | + $content .= '</div>'; |
|
1207 | 1207 | } |
1208 | - $content.= '</div>'; |
|
1208 | + $content .= '</div>'; |
|
1209 | 1209 | } |
1210 | 1210 | break; |
1211 | 1211 | case SOCIAL_LEFT_PLUGIN: |
@@ -1276,12 +1276,12 @@ discard block |
||
1276 | 1276 | if (!in_array($extension, $allowedTypes)) { |
1277 | 1277 | $flag = false; |
1278 | 1278 | } else { |
1279 | - $newFileName = uniqid('') . '.' . $extension; |
|
1279 | + $newFileName = uniqid('').'.'.$extension; |
|
1280 | 1280 | if (!file_exists($pathMessageAttach)) { |
1281 | 1281 | @mkdir($pathMessageAttach, api_get_permissions_for_new_directories(), true); |
1282 | 1282 | } |
1283 | 1283 | |
1284 | - $newPath = $pathMessageAttach . $newFileName; |
|
1284 | + $newPath = $pathMessageAttach.$newFileName; |
|
1285 | 1285 | if (is_uploaded_file($fileAttach['tmp_name'])) { |
1286 | 1286 | @copy($fileAttach['tmp_name'], $newPath); |
1287 | 1287 | } |
@@ -1290,9 +1290,9 @@ discard block |
||
1290 | 1290 | $medium = self::resize_picture($newPath, IMAGE_WALL_MEDIUM_SIZE); |
1291 | 1291 | |
1292 | 1292 | $big = new Image($newPath); |
1293 | - $ok = $small && $small->send_image($pathMessageAttach . IMAGE_WALL_SMALL . '_' . $newFileName) && |
|
1294 | - $medium && $medium->send_image($pathMessageAttach . IMAGE_WALL_MEDIUM .'_' . $newFileName) && |
|
1295 | - $big && $big->send_image($pathMessageAttach . IMAGE_WALL_BIG . '_' . $newFileName); |
|
1293 | + $ok = $small && $small->send_image($pathMessageAttach.IMAGE_WALL_SMALL.'_'.$newFileName) && |
|
1294 | + $medium && $medium->send_image($pathMessageAttach.IMAGE_WALL_MEDIUM.'_'.$newFileName) && |
|
1295 | + $big && $big->send_image($pathMessageAttach.IMAGE_WALL_BIG.'_'.$newFileName); |
|
1296 | 1296 | |
1297 | 1297 | // Insert |
1298 | 1298 | $newFileName = $social.$newFileName; |
@@ -1386,7 +1386,7 @@ discard block |
||
1386 | 1386 | $start = '0000-00-00'; |
1387 | 1387 | } |
1388 | 1388 | |
1389 | - $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId); |
|
1389 | + $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId); |
|
1390 | 1390 | $messages = self::getWallMessages($userId, MESSAGE_STATUS_WALL, $idMessage, $start, $limit, $offset); |
1391 | 1391 | $formattedList = '<div class="sub-mediapost">'; |
1392 | 1392 | $users = array(); |
@@ -1401,20 +1401,20 @@ discard block |
||
1401 | 1401 | } |
1402 | 1402 | |
1403 | 1403 | $nameComplete = api_is_western_name_order() |
1404 | - ? $users[$userIdLoop]['firstname'] .' ' . $users[$userIdLoop]['lastname'] |
|
1405 | - : $users[$userIdLoop]['lastname'] . ' ' . $users[$userIdLoop]['firstname']; |
|
1404 | + ? $users[$userIdLoop]['firstname'].' '.$users[$userIdLoop]['lastname'] |
|
1405 | + : $users[$userIdLoop]['lastname'].' '.$users[$userIdLoop]['firstname']; |
|
1406 | 1406 | $url = api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$userIdLoop; |
1407 | 1407 | $media = ''; |
1408 | 1408 | $media .= '<div class="rep-post">'; |
1409 | 1409 | $media .= '<div class="col-md-2 col-xs-2 social-post-answers">'; |
1410 | 1410 | $media .= '<div class="user-image pull-right">'; |
1411 | - $media .= '<a href="'.$url.'" ><img src="'. $users[$userIdLoop]['avatar'] . |
|
1411 | + $media .= '<a href="'.$url.'" ><img src="'.$users[$userIdLoop]['avatar']. |
|
1412 | 1412 | '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>'; |
1413 | 1413 | $media .= '</div>'; |
1414 | 1414 | $media .= '</div>'; |
1415 | 1415 | $media .= '<div class="col-md-9 col-xs-9 social-post-answers">'; |
1416 | 1416 | $media .= '<div class="user-data">'; |
1417 | - $media .= '<div class="username">' . '<a href="'.$url.'">'.$nameComplete.'</a> <span>'.Security::remove_XSS($message['content']).'</span></div>'; |
|
1417 | + $media .= '<div class="username">'.'<a href="'.$url.'">'.$nameComplete.'</a> <span>'.Security::remove_XSS($message['content']).'</span></div>'; |
|
1418 | 1418 | $media .= '<div class="time timeago" title="'.$date.'">'.$date.'</div>'; |
1419 | 1419 | $media .= '<br />'; |
1420 | 1420 | $media .= '</div>'; |
@@ -1457,12 +1457,12 @@ discard block |
||
1457 | 1457 | * @param int $offset Wall messages offset |
1458 | 1458 | * @return array $data return user's starting wall messages along with message extra data |
1459 | 1459 | */ |
1460 | - public static function getWallMessagesPostHTML($userId, $friendId = 0, $start = null, $limit = 10, $offset= 0) |
|
1460 | + public static function getWallMessagesPostHTML($userId, $friendId = 0, $start = null, $limit = 10, $offset = 0) |
|
1461 | 1461 | { |
1462 | 1462 | if (empty($start)) { |
1463 | 1463 | $start = '0000-00-00'; |
1464 | 1464 | } |
1465 | - $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId); |
|
1465 | + $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId); |
|
1466 | 1466 | $messages = self::getWallMessages($userId, MESSAGE_STATUS_WALL_POST, null, $start, $limit, $offset); |
1467 | 1467 | $users = array(); |
1468 | 1468 | $data = array(); |
@@ -1521,7 +1521,7 @@ discard block |
||
1521 | 1521 | |
1522 | 1522 | $htmlReceiver = ''; |
1523 | 1523 | if ($authorId != $receiverId) { |
1524 | - $htmlReceiver = ' > <a href="'.$urlReceiver.'">' . $nameCompleteReceiver . '</a> '; |
|
1524 | + $htmlReceiver = ' > <a href="'.$urlReceiver.'">'.$nameCompleteReceiver.'</a> '; |
|
1525 | 1525 | } |
1526 | 1526 | |
1527 | 1527 | $wallImage = ''; |
@@ -1556,7 +1556,7 @@ discard block |
||
1556 | 1556 | $html .= '<div class="img-post">'; |
1557 | 1557 | $html .= $wallImage; |
1558 | 1558 | $html .= '</div>'; |
1559 | - $html .= '<p>'. Security::remove_XSS($message['content']).'</p>'; |
|
1559 | + $html .= '<p>'.Security::remove_XSS($message['content']).'</p>'; |
|
1560 | 1560 | $html .= '</div>'; |
1561 | 1561 | $html .= '</div>'; // end mediaPost |
1562 | 1562 | |
@@ -1732,18 +1732,18 @@ discard block |
||
1732 | 1732 | if ($number_friends != 0) { |
1733 | 1733 | if ($number_friends > $number_of_images) { |
1734 | 1734 | if (api_get_user_id() == $user_id) { |
1735 | - $friendHtml.= ' <span><a href="friends.php">'.get_lang('SeeAll').'</a></span>'; |
|
1735 | + $friendHtml .= ' <span><a href="friends.php">'.get_lang('SeeAll').'</a></span>'; |
|
1736 | 1736 | } else { |
1737 | - $friendHtml.= ' <span>' |
|
1737 | + $friendHtml .= ' <span>' |
|
1738 | 1738 | .'<a href="'.api_get_path(WEB_CODE_PATH).'social/profile_friends_and_groups.inc.php' |
1739 | 1739 | .'?view=friends&height=390&width=610&user_id='.$user_id.'"' |
1740 | 1740 | .'class="ajax" data-title="'.get_lang('SeeAll').'" title="'.get_lang('SeeAll').'" >'.get_lang('SeeAll').'</a></span>'; |
1741 | 1741 | } |
1742 | 1742 | } |
1743 | 1743 | |
1744 | - $friendHtml.= '<ul class="nav nav-list">'; |
|
1744 | + $friendHtml .= '<ul class="nav nav-list">'; |
|
1745 | 1745 | $j = 1; |
1746 | - for ($k=0; $k < $number_friends; $k++) { |
|
1746 | + for ($k = 0; $k < $number_friends; $k++) { |
|
1747 | 1747 | if ($j > $number_of_images) break; |
1748 | 1748 | |
1749 | 1749 | if (isset($friends[$k])) { |
@@ -1757,26 +1757,26 @@ discard block |
||
1757 | 1757 | $statusIcon = Display::span('', array('class' => 'offline_user_in_text')); |
1758 | 1758 | } |
1759 | 1759 | |
1760 | - $friendHtml.= '<li>'; |
|
1761 | - $friendHtml.= '<div>'; |
|
1760 | + $friendHtml .= '<li>'; |
|
1761 | + $friendHtml .= '<div>'; |
|
1762 | 1762 | |
1763 | 1763 | // the height = 92 must be the same in the image_friend_network span style in default.css |
1764 | 1764 | $friends_profile = UserManager::getUserPicture($friend['friend_user_id'], USER_IMAGE_SIZE_SMALL); |
1765 | - $friendHtml.= '<img src="'.$friends_profile.'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'"/>'; |
|
1765 | + $friendHtml .= '<img src="'.$friends_profile.'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'"/>'; |
|
1766 | 1766 | $link_shared = (empty($link_shared)) ? '' : '&'.$link_shared; |
1767 | - $friendHtml.= $statusIcon .'<a href="profile.php?' .'u=' . $friend['friend_user_id'] . $link_shared . '">' . $name_user .'</a>'; |
|
1768 | - $friendHtml.= '</div>'; |
|
1769 | - $friendHtml.= '</li>'; |
|
1767 | + $friendHtml .= $statusIcon.'<a href="profile.php?'.'u='.$friend['friend_user_id'].$link_shared.'">'.$name_user.'</a>'; |
|
1768 | + $friendHtml .= '</div>'; |
|
1769 | + $friendHtml .= '</li>'; |
|
1770 | 1770 | } |
1771 | 1771 | $j++; |
1772 | 1772 | } |
1773 | - $friendHtml.='</ul>'; |
|
1773 | + $friendHtml .= '</ul>'; |
|
1774 | 1774 | } else { |
1775 | - $friendHtml.= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />' |
|
1776 | - .'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '. get_lang('TryAndFindSomeFriends').'</a></div>'; |
|
1775 | + $friendHtml .= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />' |
|
1776 | + .'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>'; |
|
1777 | 1777 | } |
1778 | 1778 | |
1779 | - $friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' (' . $number_friends . ')' ); |
|
1779 | + $friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' ('.$number_friends.')'); |
|
1780 | 1780 | |
1781 | 1781 | return $friendHtml; |
1782 | 1782 | } |
@@ -1797,9 +1797,9 @@ discard block |
||
1797 | 1797 | |
1798 | 1798 | if ($number_friends != 0) { |
1799 | 1799 | |
1800 | - $friendHtml.= '<div class="list-group">'; |
|
1800 | + $friendHtml .= '<div class="list-group">'; |
|
1801 | 1801 | $j = 1; |
1802 | - for ($k=0; $k < $number_friends; $k++) { |
|
1802 | + for ($k = 0; $k < $number_friends; $k++) { |
|
1803 | 1803 | if ($j > $number_of_images) { |
1804 | 1804 | break; |
1805 | 1805 | } |
@@ -1809,11 +1809,11 @@ discard block |
||
1809 | 1809 | $user_info_friend = api_get_user_info($friend['friend_user_id'], true); |
1810 | 1810 | |
1811 | 1811 | if ($user_info_friend['user_is_online']) { |
1812 | - $statusIcon = Display::return_icon('statusonline.png',get_lang('Online')); |
|
1813 | - $status=1; |
|
1812 | + $statusIcon = Display::return_icon('statusonline.png', get_lang('Online')); |
|
1813 | + $status = 1; |
|
1814 | 1814 | } else { |
1815 | - $statusIcon = Display::return_icon('statusoffline.png',get_lang('Offline')); |
|
1816 | - $status=0; |
|
1815 | + $statusIcon = Display::return_icon('statusoffline.png', get_lang('Offline')); |
|
1816 | + $status = 0; |
|
1817 | 1817 | } |
1818 | 1818 | |
1819 | 1819 | $friendAvatarMedium = UserManager::getUserPicture($friend['friend_user_id'], USER_IMAGE_SIZE_MEDIUM); |
@@ -1822,24 +1822,24 @@ discard block |
||
1822 | 1822 | $showLinkToChat = api_is_global_chat_enabled() && |
1823 | 1823 | $friend['friend_user_id'] != api_get_user_id(); |
1824 | 1824 | |
1825 | - if ($showLinkToChat){ |
|
1825 | + if ($showLinkToChat) { |
|
1826 | 1826 | $friendHtml .= '<a onclick="javascript:chatWith(\''.$friend['friend_user_id'].'\', \''.$name_user.'\', \''.$status.'\',\''.$friendAvatarSmall.'\')" href="javascript:void(0);" class="list-group-item">'; |
1827 | - $friendHtml .= $friend_avatar.' <span class="username">' . $name_user . '</span>'; |
|
1828 | - $friendHtml .= '<span class="status">' . $statusIcon . '</span>'; |
|
1827 | + $friendHtml .= $friend_avatar.' <span class="username">'.$name_user.'</span>'; |
|
1828 | + $friendHtml .= '<span class="status">'.$statusIcon.'</span>'; |
|
1829 | 1829 | } else { |
1830 | 1830 | $link_shared = empty($link_shared) ? '' : '&'.$link_shared; |
1831 | - $friendHtml .= '<a href="profile.php?' .'u=' . $friend['friend_user_id'] . $link_shared . '" class="list-group-item">'; |
|
1832 | - $friendHtml .= $friend_avatar.' <span class="username-all">' . $name_user . '</span>'; |
|
1831 | + $friendHtml .= '<a href="profile.php?'.'u='.$friend['friend_user_id'].$link_shared.'" class="list-group-item">'; |
|
1832 | + $friendHtml .= $friend_avatar.' <span class="username-all">'.$name_user.'</span>'; |
|
1833 | 1833 | } |
1834 | 1834 | |
1835 | 1835 | $friendHtml .= '</a>'; |
1836 | 1836 | } |
1837 | 1837 | $j++; |
1838 | 1838 | } |
1839 | - $friendHtml.='</div>'; |
|
1839 | + $friendHtml .= '</div>'; |
|
1840 | 1840 | } else { |
1841 | - $friendHtml.= '<div class="help">'.get_lang('NoFriendsInYourContactList').' ' |
|
1842 | - .'<a href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '. get_lang('TryAndFindSomeFriends').'</a></div>'; |
|
1841 | + $friendHtml .= '<div class="help">'.get_lang('NoFriendsInYourContactList').' ' |
|
1842 | + .'<a href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>'; |
|
1843 | 1843 | } |
1844 | 1844 | |
1845 | 1845 | return $friendHtml; |
@@ -1857,7 +1857,7 @@ discard block |
||
1857 | 1857 | 'post', |
1858 | 1858 | api_get_path(WEB_CODE_PATH).'social/profile.php'.$userId, |
1859 | 1859 | null, |
1860 | - array('enctype' => 'multipart/form-data') , |
|
1860 | + array('enctype' => 'multipart/form-data'), |
|
1861 | 1861 | FormValidator::LAYOUT_HORIZONTAL |
1862 | 1862 | ); |
1863 | 1863 |
@@ -67,6 +67,8 @@ discard block |
||
67 | 67 | * @param int user id |
68 | 68 | * @param int user friend id |
69 | 69 | * @param string |
70 | + * @param integer $user_id |
|
71 | + * @param integer $user_friend |
|
70 | 72 | * @author isaac flores paz |
71 | 73 | */ |
72 | 74 | public static function get_relation_between_contacts($user_id, $user_friend) |
@@ -98,6 +100,8 @@ discard block |
||
98 | 100 | * @param int group id |
99 | 101 | * @param string name to search |
100 | 102 | * @param bool true will load firstname, lastname, and image name |
103 | + * @param integer $user_id |
|
104 | + * @param integer $id_group |
|
101 | 105 | * @return array |
102 | 106 | * @author Julio Montoya <[email protected]> Cleaning code, function renamed, $load_extra_info option added |
103 | 107 | * @author isaac flores paz |
@@ -174,6 +178,9 @@ discard block |
||
174 | 178 | * @param int user friend id |
175 | 179 | * @param string title of the message |
176 | 180 | * @param string content of the message |
181 | + * @param integer $user_id |
|
182 | + * @param string $message_title |
|
183 | + * @param string $message_content |
|
177 | 184 | * @return boolean |
178 | 185 | * @author isaac flores paz |
179 | 186 | * @author Julio Montoya <[email protected]> Cleaning code |
@@ -248,6 +255,7 @@ discard block |
||
248 | 255 | * Get number messages of the inbox |
249 | 256 | * @author isaac flores paz |
250 | 257 | * @param int user receiver id |
258 | + * @param integer $user_receiver_id |
|
251 | 259 | * @return int |
252 | 260 | */ |
253 | 261 | public static function get_message_number_invitation_by_user_id($user_receiver_id) |
@@ -290,6 +298,7 @@ discard block |
||
290 | 298 | * Get invitation list sent by user |
291 | 299 | * @author Julio Montoya <[email protected]> |
292 | 300 | * @param int user id |
301 | + * @param integer $user_id |
|
293 | 302 | * @return array() |
294 | 303 | */ |
295 | 304 | public static function get_list_invitation_sent_by_user_id($user_id) |
@@ -332,6 +341,7 @@ discard block |
||
332 | 341 | * Denies invitation |
333 | 342 | * @param int user sender id |
334 | 343 | * @param int user receiver id |
344 | + * @param integer $user_receiver_id |
|
335 | 345 | * @author isaac flores paz |
336 | 346 | * @author Julio Montoya <[email protected]> Cleaning code |
337 | 347 | */ |
@@ -426,7 +436,7 @@ discard block |
||
426 | 436 | * @param string $subject |
427 | 437 | * @param string $content |
428 | 438 | * |
429 | - * @return string message invitation |
|
439 | + * @return false|null message invitation |
|
430 | 440 | */ |
431 | 441 | public static function sendInvitationToUser($userId, $subject = '', $content = '') |
432 | 442 | { |
@@ -1223,7 +1233,7 @@ discard block |
||
1223 | 1233 | * @param string $messageContent of the message |
1224 | 1234 | * @param int $messageId id parent |
1225 | 1235 | * @param string $messageStatus status type of message |
1226 | - * @return boolean |
|
1236 | + * @return false|string |
|
1227 | 1237 | * @author Yannick Warnier |
1228 | 1238 | */ |
1229 | 1239 | public static function sendWallMessage($userId, $friendId, $messageContent, $messageId = 0, $messageStatus = '') |
@@ -1315,7 +1325,7 @@ discard block |
||
1315 | 1325 | * Gets all messages from someone's wall (within specific limits) |
1316 | 1326 | * @param int $userId id of wall shown |
1317 | 1327 | * @param string $messageStatus status wall message |
1318 | - * @param int|string $parentId id message (Post main) |
|
1328 | + * @param integer|null $parentId id message (Post main) |
|
1319 | 1329 | * @param date $start Date from which we want to show the messages, in UTC time |
1320 | 1330 | * @param int $limit Limit for the number of parent messages we want to show |
1321 | 1331 | * @param int $offset Wall message query offset |
@@ -1600,7 +1610,7 @@ discard block |
||
1600 | 1610 | |
1601 | 1611 | /** |
1602 | 1612 | * verify if Url Exist - Using Curl |
1603 | - * @param $uri url |
|
1613 | + * @param string $uri url |
|
1604 | 1614 | * |
1605 | 1615 | * @return boolean |
1606 | 1616 | */ |
@@ -1626,7 +1636,7 @@ discard block |
||
1626 | 1636 | /** |
1627 | 1637 | * Delete messages delete logic |
1628 | 1638 | * @param int $id id message to delete. |
1629 | - * @return bool status query |
|
1639 | + * @return Statement|null status query |
|
1630 | 1640 | */ |
1631 | 1641 | public static function deleteMessage($id) |
1632 | 1642 | { |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | $sql = "SELECT MAX(description_type) as MAX |
178 | 178 | FROM $tbl_course_description |
179 | - WHERE c_id = $course_id AND session_id='" . $this->session_id . "'"; |
|
179 | + WHERE c_id = $course_id AND session_id='".$this->session_id."'"; |
|
180 | 180 | $rs = Database::query($sql); |
181 | 181 | $max = Database::fetch_array($rs); |
182 | 182 | $description_type = $max['MAX'] + 1; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | 'session_id' => $this->session_id |
212 | 212 | ]; |
213 | 213 | |
214 | - $last_id = Database::insert($table, $params); |
|
214 | + $last_id = Database::insert($table, $params); |
|
215 | 215 | |
216 | 216 | if ($last_id > 0) { |
217 | 217 | $sql = "UPDATE $table SET id = iid WHERE iid = $last_id"; |
@@ -319,8 +319,8 @@ discard block |
||
319 | 319 | $sql = "DELETE FROM $tbl_course_description |
320 | 320 | WHERE |
321 | 321 | c_id = $course_id AND |
322 | - id = '" . intval($this->id) . "' AND |
|
323 | - session_id = '" . intval($this->session_id) . "'"; |
|
322 | + id = '".intval($this->id)."' AND |
|
323 | + session_id = '" . intval($this->session_id)."'"; |
|
324 | 324 | $result = Database::query($sql); |
325 | 325 | $affected_rows = Database::affected_rows($result); |
326 | 326 | if ($this->id > 0) { |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | $course_id = api_get_course_int_id(); |
350 | 350 | |
351 | 351 | $sql = "SELECT id FROM $tbl_course_description |
352 | - WHERE c_id = $course_id AND description_type = '" . intval($description_type) . "'"; |
|
352 | + WHERE c_id = $course_id AND description_type = '".intval($description_type)."'"; |
|
353 | 353 | $rs = Database::query($sql); |
354 | 354 | $row = Database::fetch_array($rs); |
355 | 355 | $description_id = $row['id']; |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | /** |
361 | 361 | * Get description titles by default |
362 | - * @return array |
|
362 | + * @return string[] |
|
363 | 363 | */ |
364 | 364 | public function get_default_description_title() |
365 | 365 | { |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | |
379 | 379 | /** |
380 | 380 | * Get description titles editable by default |
381 | - * @return array |
|
381 | + * @return boolean[] |
|
382 | 382 | */ |
383 | 383 | public function get_default_description_title_editable() |
384 | 384 | { |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | |
398 | 398 | /** |
399 | 399 | * Get description icons by default |
400 | - * @return array |
|
400 | + * @return string[] |
|
401 | 401 | */ |
402 | 402 | public function get_default_description_icon() |
403 | 403 | { |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | |
418 | 418 | /** |
419 | 419 | * Get questions by default for help |
420 | - * @return array |
|
420 | + * @return string[] |
|
421 | 421 | */ |
422 | 422 | public function get_default_question() |
423 | 423 | { |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | |
437 | 437 | /** |
438 | 438 | * Get informations by default for help |
439 | - * @return array |
|
439 | + * @return string[] |
|
440 | 440 | */ |
441 | 441 | public function get_default_information() |
442 | 442 | { |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | /** |
575 | 575 | * get progress of a description |
576 | 576 | * |
577 | - * @return int |
|
577 | + * @return string |
|
578 | 578 | */ |
579 | 579 | public function get_progress() |
580 | 580 | { |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
36 | - * This function is for editing profile info from profile_id. |
|
37 | - * @param int $profileId |
|
38 | - * @param string $name |
|
39 | - * @param string $description |
|
40 | - */ |
|
36 | + * This function is for editing profile info from profile_id. |
|
37 | + * @param int $profileId |
|
38 | + * @param string $name |
|
39 | + * @param string $description |
|
40 | + */ |
|
41 | 41 | public function updateProfileInfo($profileId, $name, $description) |
42 | 42 | { |
43 | 43 | $profileId = intval($profileId); |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | - * This function is for getting profile info from profile_id. |
|
132 | - * @param int $profileId |
|
133 | - */ |
|
131 | + * This function is for getting profile info from profile_id. |
|
132 | + * @param int $profileId |
|
133 | + */ |
|
134 | 134 | |
135 | 135 | public function getProfileInfo($profileId) |
136 | 136 | { |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | { |
735 | 735 | $skill_rel_skill = new SkillRelSkill(); |
736 | 736 | $skills = $skill_rel_skill->get_direct_parents($skill_id, true); |
737 | - foreach($skills as &$skill) { |
|
737 | + foreach ($skills as &$skill) { |
|
738 | 738 | $skill['data'] = self::get($skill['skill_id']); |
739 | 739 | $skill_info2 = $skill_rel_skill->get_skill_info($skill['skill_id']); |
740 | 740 | $skill['data']['parent_id'] = $skill_info2['parent_id']; |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | $attributes = array( |
773 | 773 | 'skill_id' => $skill_id, |
774 | 774 | 'parent_id' => $parent_id, |
775 | - 'relation_type' => (isset($params['relation_type'])?$params['relation_type']:0), |
|
775 | + 'relation_type' => (isset($params['relation_type']) ? $params['relation_type'] : 0), |
|
776 | 776 | //'level' => $params['level'], |
777 | 777 | ); |
778 | 778 | $skill_rel_skill->save($attributes); |
@@ -969,8 +969,8 @@ discard block |
||
969 | 969 | // 2nd node |
970 | 970 | $skills[$skill_id] = $skill_info; |
971 | 971 | // Uncomment code below to hide the searched skill |
972 | - $skills[$skill_id]['data']['parent_id'] = $skill_info['extra']['parent_id']; |
|
973 | - $skills[$skill_id]['parent_id'] = 1; |
|
972 | + $skills[$skill_id]['data']['parent_id'] = $skill_info['extra']['parent_id']; |
|
973 | + $skills[$skill_id]['parent_id'] = 1; |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | } |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | $skill['data']['skill_has_gradebook'] = true; |
1034 | 1034 | } |
1035 | 1035 | $refs[$skill['id']] = &$skill; |
1036 | - $flat_array[$skill['id']] = &$skill; |
|
1036 | + $flat_array[$skill['id']] = &$skill; |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | // Checking family value |
@@ -1054,7 +1054,7 @@ discard block |
||
1054 | 1054 | $refs['root']['children'][0] = $skills[1]; |
1055 | 1055 | $skills[$skill_id]['data']['family_id'] = 1; |
1056 | 1056 | $refs['root']['children'][0]['children'][0] = $skills[$skill_id]; |
1057 | - $flat_array[$skill_id] = $skills[$skill_id]; |
|
1057 | + $flat_array[$skill_id] = $skills[$skill_id]; |
|
1058 | 1058 | } else { |
1059 | 1059 | // Moving node to the children index of their parents |
1060 | 1060 | |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | $skill['data']['family_id'] = $new_family_array[$skill['id']]; |
1064 | 1064 | } |
1065 | 1065 | $refs[$skill['parent_id']]['children'][] = &$skill; |
1066 | - $flat_array[$my_skill_id] = $skill; |
|
1066 | + $flat_array[$my_skill_id] = $skill; |
|
1067 | 1067 | } |
1068 | 1068 | } |
1069 | 1069 | |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | INNER JOIN {$this->table_skill_rel_user} su |
1162 | 1162 | ON (s.id = su.skill_id) |
1163 | 1163 | WHERE user_id = $user_id"; |
1164 | - $result = Database::query($sql); |
|
1164 | + $result = Database::query($sql); |
|
1165 | 1165 | if (Database::num_rows($result)) { |
1166 | 1166 | $result = Database::fetch_row($result); |
1167 | 1167 | return $result[0]; |
@@ -1203,7 +1203,7 @@ discard block |
||
1203 | 1203 | */ |
1204 | 1204 | public function get_user_list_skill_ranking_count() |
1205 | 1205 | { |
1206 | - $sql = "SELECT count(*) FROM ( |
|
1206 | + $sql = "SELECT count(*) FROM ( |
|
1207 | 1207 | SELECT count(distinct 1) |
1208 | 1208 | FROM {$this->table} s |
1209 | 1209 | INNER JOIN {$this->table_skill_rel_user} su |
@@ -1256,7 +1256,7 @@ discard block |
||
1256 | 1256 | ON c.code = g.course_code |
1257 | 1257 | WHERE sg.skill_id = $skill_id |
1258 | 1258 | AND (g.session_id IS NULL OR g.session_id = 0)"; |
1259 | - $result = Database::query($sql); |
|
1259 | + $result = Database::query($sql); |
|
1260 | 1260 | |
1261 | 1261 | return Database::store_result($result, 'ASSOC'); |
1262 | 1262 | } |
@@ -1443,7 +1443,7 @@ discard block |
||
1443 | 1443 | WHERE sg.skill_id = $skillId |
1444 | 1444 | AND g.session_id > 0"; |
1445 | 1445 | |
1446 | - $result = Database::query($sql); |
|
1446 | + $result = Database::query($sql); |
|
1447 | 1447 | |
1448 | 1448 | return Database::store_result($result, 'ASSOC'); |
1449 | 1449 | } |
@@ -326,6 +326,7 @@ discard block |
||
326 | 326 | |
327 | 327 | /** |
328 | 328 | * Gets an element |
329 | + * @param integer $gradebook_id |
|
329 | 330 | */ |
330 | 331 | public function get_skill_info($skill_id, $gradebook_id) |
331 | 332 | { |
@@ -544,7 +545,7 @@ discard block |
||
544 | 545 | * Gets an element |
545 | 546 | * @param int $id |
546 | 547 | * |
547 | - * @return array|mixed |
|
548 | + * @return integer |
|
548 | 549 | */ |
549 | 550 | public function get($id) |
550 | 551 | { |
@@ -885,7 +886,7 @@ discard block |
||
885 | 886 | /** |
886 | 887 | * Get user's skills |
887 | 888 | * |
888 | - * @param int $userId User's id |
|
889 | + * @param integer $user_id User's id |
|
889 | 890 | * @param bool $get_skill_data |
890 | 891 | */ |
891 | 892 | public function get_user_skills($user_id, $get_skill_data = false) |
@@ -1090,7 +1091,7 @@ discard block |
||
1090 | 1091 | * @param bool return a flat array or not |
1091 | 1092 | * @param int depth of the skills |
1092 | 1093 | * @param bool filter status |
1093 | - * @return json |
|
1094 | + * @return string |
|
1094 | 1095 | */ |
1095 | 1096 | public function get_skills_tree_json($user_id = null, $skill_id = null, $return_flat_array = false, $main_depth = 2, $filter_status = false) |
1096 | 1097 | { |
@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | * Code |
9 | 9 | */ |
10 | 10 | require_once 'xapian.php'; |
11 | -require_once dirname(__FILE__) . '/../IndexableChunk.class.php'; |
|
11 | +require_once dirname(__FILE__).'/../IndexableChunk.class.php'; |
|
12 | 12 | //TODO: think another way without including specific fields here |
13 | -require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
13 | +require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
14 | 14 | |
15 | -define('XAPIAN_DB', api_get_path(SYS_UPLOAD_PATH) . 'plugins/xapian/searchdb/'); |
|
15 | +define('XAPIAN_DB', api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb/'); |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Queries the database. |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | // process each specific field prefix |
97 | 97 | foreach ($specific_fields as $specific_field) { |
98 | - $results[$count]['sf-' . $specific_field['code']] = xapian_get_doc_terms($document, $specific_field['code']); |
|
98 | + $results[$count]['sf-'.$specific_field['code']] = xapian_get_doc_terms($document, $specific_field['code']); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | // rest of data |
@@ -261,6 +261,6 @@ discard block |
||
261 | 261 | } else { |
262 | 262 | $message_error = get_lang('SearchOtherXapianError'); |
263 | 263 | } |
264 | - $display_message = get_lang('Error') . ' : ' . $message_error; |
|
264 | + $display_message = get_lang('Error').' : '.$message_error; |
|
265 | 265 | Display::display_error_message($display_message); |
266 | 266 | } |
@@ -239,6 +239,7 @@ |
||
239 | 239 | /** |
240 | 240 | * @author Isaac flores paz <[email protected]> |
241 | 241 | * @param String The xapian error message |
242 | + * @param string $xapian_error_message |
|
242 | 243 | * @return String The chamilo error message |
243 | 244 | */ |
244 | 245 | function display_xapian_error($xapian_error_message) { |
@@ -48,7 +48,9 @@ discard block |
||
48 | 48 | |
49 | 49 | foreach ($sf_term_array as $raw_term) { |
50 | 50 | $term = substr($raw_term, 1); |
51 | - if (empty($term)) continue; |
|
51 | + if (empty($term)) { |
|
52 | + continue; |
|
53 | + } |
|
52 | 54 | $html_term = htmlspecialchars($term, ENT_QUOTES, $charset); |
53 | 55 | $selected = ''; |
54 | 56 | if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term,$_REQUEST['sf_'.$prefix])) { |
@@ -69,7 +71,9 @@ discard block |
||
69 | 71 | $max = count($sf_terms); |
70 | 72 | $multiple_selects .=''; |
71 | 73 | foreach ($sf_terms as $prefix => $sf_term_array) { |
72 | - if ($prefix == $prefilter_prefix) continue; |
|
74 | + if ($prefix == $prefilter_prefix) { |
|
75 | + continue; |
|
76 | + } |
|
73 | 77 | $multiple_select = ''; |
74 | 78 | if ($i>0) { |
75 | 79 | //print "+" image |
@@ -342,9 +346,10 @@ discard block |
||
342 | 346 | |
343 | 347 | // Tool introduction |
344 | 348 | // TODO: Settings for the online editor to be checked (insert an image for example). Probably this is a special case here. |
345 | - if (api_get_course_id() !== -1) |
|
346 | - if (!empty($groupId)) { |
|
349 | + if (api_get_course_id() !== -1) { |
|
350 | + if (!empty($groupId)) { |
|
347 | 351 | Display::display_introduction_section(TOOL_SEARCH.$groupId); |
352 | + } |
|
348 | 353 | } else { |
349 | 354 | Display::display_introduction_section(TOOL_SEARCH); |
350 | 355 | } |
@@ -366,7 +371,9 @@ discard block |
||
366 | 371 | break; |
367 | 372 | } |
368 | 373 | } |
369 | - if ($thesaurus_decided) break; |
|
374 | + if ($thesaurus_decided) { |
|
375 | + break; |
|
376 | + } |
|
370 | 377 | } |
371 | 378 | } |
372 | 379 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * Get one term html select |
31 | 31 | */ |
32 | 32 | function format_one_specific_field_select($prefix, $sf_term_array, $op, $extra_select_attr='size="7" class="sf-select-multiple"') { |
33 | - global $charset; |
|
33 | + global $charset; |
|
34 | 34 | $multiple_select = '<select '. $extra_select_attr .' title="'. $prefix .'" id="sf-'. $prefix .'" name="sf_'. $prefix .'[]">'; |
35 | 35 | |
36 | 36 | $all_selected = ''; |
@@ -119,20 +119,20 @@ discard block |
||
119 | 119 | * could not send a form in pagination |
120 | 120 | */ |
121 | 121 | |
122 | - if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) { |
|
123 | - $action='index.php'; |
|
124 | - } |
|
125 | - $navigator_info = api_get_navigator(); |
|
122 | + if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) { |
|
123 | + $action='index.php'; |
|
124 | + } |
|
125 | + $navigator_info = api_get_navigator(); |
|
126 | 126 | |
127 | - if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') { |
|
128 | - $submit_button1 = '<input type="submit" id="submit" value="'. get_lang('Search') .'" />'; |
|
129 | - $submit_button2 = '<input class="lower-submit" type="submit" value="'. get_lang('Search') .'" />'; |
|
127 | + if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') { |
|
128 | + $submit_button1 = '<input type="submit" id="submit" value="'. get_lang('Search') .'" />'; |
|
129 | + $submit_button2 = '<input class="lower-submit" type="submit" value="'. get_lang('Search') .'" />'; |
|
130 | 130 | $reset_button = '<input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />'; |
131 | - } else { |
|
132 | - $submit_button1 = '<button class="search" type="submit" id="submit" value="'. get_lang("Search") .'" /> '. get_lang('Search') .'</button>'; |
|
133 | - $submit_button2 = '<button class="search" type="submit" value="'. get_lang('Search') .'" />'. get_lang('Search') .'</button>'; |
|
131 | + } else { |
|
132 | + $submit_button1 = '<button class="search" type="submit" id="submit" value="'. get_lang("Search") .'" /> '. get_lang('Search') .'</button>'; |
|
133 | + $submit_button2 = '<button class="search" type="submit" value="'. get_lang('Search') .'" />'. get_lang('Search') .'</button>'; |
|
134 | 134 | $reset_button = '<button class="save" type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />'. get_lang('SearchResetKeywords') .'</button> '; |
135 | - } |
|
135 | + } |
|
136 | 136 | |
137 | 137 | $form = '<form id="chamilo_search" action="'. $action .'" method="GET"> |
138 | 138 | <input type="text" id="query" name="query" size="40" value="'.stripslashes(Security::remove_XSS($_REQUEST['query'])).'" /> |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | * SortableTableFromArray pagination is done with simple links, so now we |
198 | 198 | * could not send a form in pagination |
199 | 199 | */ |
200 | - if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) { |
|
201 | - $action='index.php'; |
|
202 | - } |
|
200 | + if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) { |
|
201 | + $action='index.php'; |
|
202 | + } |
|
203 | 203 | |
204 | 204 | $form = ' |
205 | 205 | <form id="chamilo_search" action="'. $action .'" method="GET"> |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | </table> |
265 | 265 | </div>'; |
266 | 266 | } |
267 | - $form .= ' |
|
267 | + $form .= ' |
|
268 | 268 | </form> |
269 | 269 | <br style="clear: both;"/>'; |
270 | 270 | |
@@ -322,10 +322,10 @@ discard block |
||
322 | 322 | foreach ($specific_fields as $specific_field) { |
323 | 323 | $temp = array(); |
324 | 324 | if (is_array($dkterms) && count($dkterms)>0) { |
325 | - foreach($dkterms[1] as $obj) { |
|
326 | - $temp = array_merge($obj['sf-'.$specific_field['code']], $temp); |
|
327 | - } |
|
328 | - } |
|
325 | + foreach($dkterms[1] as $obj) { |
|
326 | + $temp = array_merge($obj['sf-'.$specific_field['code']], $temp); |
|
327 | + } |
|
328 | + } |
|
329 | 329 | $sf_terms[$specific_field['code']] = $temp; |
330 | 330 | $url_params[] = 'sf_'.$specific_field['code']; |
331 | 331 | unset($temp); |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | } |
341 | 341 | echo '<h2>'.get_lang('Search').'</h2>'; |
342 | 342 | |
343 | - // Tool introduction |
|
343 | + // Tool introduction |
|
344 | 344 | // TODO: Settings for the online editor to be checked (insert an image for example). Probably this is a special case here. |
345 | 345 | if (api_get_course_id() !== -1) |
346 | 346 | if (!empty($groupId)) { |
@@ -187,6 +187,7 @@ discard block |
||
187 | 187 | * Build the prefilter form. |
188 | 188 | * |
189 | 189 | * This type allow filter all other multiple select terms by one term in a dinamic way |
190 | + * @param string $prefilter_prefix |
|
190 | 191 | */ |
191 | 192 | function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix=NULL) { |
192 | 193 | $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon')); |
@@ -277,6 +278,8 @@ discard block |
||
277 | 278 | |
278 | 279 | /** |
279 | 280 | * Show search form |
281 | + * @param string $action |
|
282 | + * @param boolean $show_thesaurus |
|
280 | 283 | */ |
281 | 284 | function display_search_form($action, $show_thesaurus, $sf_terms, $op) { |
282 | 285 | $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal'); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | /** |
8 | 8 | * Code |
9 | 9 | */ |
10 | -require_once dirname(__FILE__) . '/IndexableChunk.class.php'; |
|
10 | +require_once dirname(__FILE__).'/IndexableChunk.class.php'; |
|
11 | 11 | require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
12 | 12 | |
13 | 13 | /** |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * Get one term html select |
31 | 31 | */ |
32 | -function format_one_specific_field_select($prefix, $sf_term_array, $op, $extra_select_attr='size="7" class="sf-select-multiple"') { |
|
32 | +function format_one_specific_field_select($prefix, $sf_term_array, $op, $extra_select_attr = 'size="7" class="sf-select-multiple"') { |
|
33 | 33 | global $charset; |
34 | - $multiple_select = '<select '. $extra_select_attr .' title="'. $prefix .'" id="sf-'. $prefix .'" name="sf_'. $prefix .'[]">'; |
|
34 | + $multiple_select = '<select '.$extra_select_attr.' title="'.$prefix.'" id="sf-'.$prefix.'" name="sf_'.$prefix.'[]">'; |
|
35 | 35 | |
36 | 36 | $all_selected = ''; |
37 | - if (!empty($_REQUEST['sf_'. $prefix]) ) { |
|
38 | - if (in_array('__all__', $_REQUEST['sf_'. $prefix])) { |
|
37 | + if (!empty($_REQUEST['sf_'.$prefix])) { |
|
38 | + if (in_array('__all__', $_REQUEST['sf_'.$prefix])) { |
|
39 | 39 | $all_selected = 'selected="selected"'; |
40 | 40 | } |
41 | 41 | } |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | } else if ($op == 'or') { |
45 | 45 | $all_selected_name = get_lang('Any'); |
46 | 46 | } |
47 | - $multiple_select .= '<option value="__all__" '. $all_selected .' >-- '. $all_selected_name .' --</option>'; |
|
47 | + $multiple_select .= '<option value="__all__" '.$all_selected.' >-- '.$all_selected_name.' --</option>'; |
|
48 | 48 | |
49 | 49 | foreach ($sf_term_array as $raw_term) { |
50 | 50 | $term = substr($raw_term, 1); |
51 | 51 | if (empty($term)) continue; |
52 | 52 | $html_term = htmlspecialchars($term, ENT_QUOTES, $charset); |
53 | 53 | $selected = ''; |
54 | - if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term,$_REQUEST['sf_'.$prefix])) { |
|
54 | + if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term, $_REQUEST['sf_'.$prefix])) { |
|
55 | 55 | $selected = 'selected="selected"'; |
56 | 56 | } |
57 | - $multiple_select .= '<option value="'. $html_term .'" '.$selected.'>'. $html_term .'</option>'; |
|
57 | + $multiple_select .= '<option value="'.$html_term.'" '.$selected.'>'.$html_term.'</option>'; |
|
58 | 58 | } |
59 | 59 | $multiple_select .= '</select>'; |
60 | 60 | return $multiple_select; |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | /** |
64 | 64 | * Get terms html selects |
65 | 65 | */ |
66 | -function format_specific_fields_selects($sf_terms, $op, $prefilter_prefix='') { |
|
66 | +function format_specific_fields_selects($sf_terms, $op, $prefilter_prefix = '') { |
|
67 | 67 | // Process each prefix type term |
68 | 68 | $i = 0; |
69 | 69 | $max = count($sf_terms); |
70 | - $multiple_selects =''; |
|
70 | + $multiple_selects = ''; |
|
71 | 71 | foreach ($sf_terms as $prefix => $sf_term_array) { |
72 | 72 | if ($prefix == $prefilter_prefix) continue; |
73 | 73 | $multiple_select = ''; |
74 | - if ($i>0) { |
|
74 | + if ($i > 0) { |
|
75 | 75 | //print "+" image |
76 | 76 | $multiple_select .= '<td><img class="sf-select-splitter" src="../img/search-big-plus.gif" alt="plus-sign-decoration"/></td>'; |
77 | 77 | } |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | |
90 | 90 | $sf_copy = $sf_term_array; |
91 | 91 | // get specific field name |
92 | - $sf_value = get_specific_field_list(array( 'code' => "'$prefix'" )); |
|
92 | + $sf_value = get_specific_field_list(array('code' => "'$prefix'")); |
|
93 | 93 | $sf_value = array_shift($sf_value); |
94 | - $multiple_select .= '<td><label class="sf-select-multiple-title" for="sf_'. $prefix .'[]">' . $sf_value['name'].'</label><br />'; |
|
94 | + $multiple_select .= '<td><label class="sf-select-multiple-title" for="sf_'.$prefix.'[]">'.$sf_value['name'].'</label><br />'; |
|
95 | 95 | $multiple_select .= format_one_specific_field_select($prefix, $sf_term_array, $op, 'multiple="multiple" size="7" class="sf-select-multiple"'); |
96 | 96 | $multiple_select .= '</td>'; |
97 | 97 | $multiple_selects .= $multiple_select; |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | */ |
108 | 108 | function search_widget_normal_form($action, $show_thesaurus, $sf_terms, $op) { |
109 | 109 | $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon')); |
110 | - $advanced_options = '<a id="tags-toggle" href="#">'. get_lang('SearchAdvancedOptions') .'</a>'; |
|
111 | - $display_thesaurus = ($show_thesaurus==true? 'block': 'none'); |
|
112 | - $help = '<h3>'. get_lang('SearchKeywordsHelpTitle') .'</h3>'. get_lang('SearchKeywordsHelpComment'); |
|
113 | - $mode = (!empty($_REQUEST['mode'])? htmlentities($_REQUEST['mode']): 'gallery'); |
|
114 | - $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal'); |
|
110 | + $advanced_options = '<a id="tags-toggle" href="#">'.get_lang('SearchAdvancedOptions').'</a>'; |
|
111 | + $display_thesaurus = ($show_thesaurus == true ? 'block' : 'none'); |
|
112 | + $help = '<h3>'.get_lang('SearchKeywordsHelpTitle').'</h3>'.get_lang('SearchKeywordsHelpComment'); |
|
113 | + $mode = (!empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery'); |
|
114 | + $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal'); |
|
115 | 115 | |
116 | 116 | /** |
117 | 117 | * POST avoid long urls, but we are using GET because |
@@ -119,36 +119,36 @@ discard block |
||
119 | 119 | * could not send a form in pagination |
120 | 120 | */ |
121 | 121 | |
122 | - if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) { |
|
123 | - $action='index.php'; |
|
122 | + if (isset($_GET['action']) && strcmp(trim($_GET['action']), 'search') === 0) { |
|
123 | + $action = 'index.php'; |
|
124 | 124 | } |
125 | 125 | $navigator_info = api_get_navigator(); |
126 | 126 | |
127 | - if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') { |
|
128 | - $submit_button1 = '<input type="submit" id="submit" value="'. get_lang('Search') .'" />'; |
|
129 | - $submit_button2 = '<input class="lower-submit" type="submit" value="'. get_lang('Search') .'" />'; |
|
130 | - $reset_button = '<input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />'; |
|
127 | + if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') { |
|
128 | + $submit_button1 = '<input type="submit" id="submit" value="'.get_lang('Search').'" />'; |
|
129 | + $submit_button2 = '<input class="lower-submit" type="submit" value="'.get_lang('Search').'" />'; |
|
130 | + $reset_button = '<input type="submit" id="tags-clean" value="'.get_lang('SearchResetKeywords').'" />'; |
|
131 | 131 | } else { |
132 | - $submit_button1 = '<button class="search" type="submit" id="submit" value="'. get_lang("Search") .'" /> '. get_lang('Search') .'</button>'; |
|
133 | - $submit_button2 = '<button class="search" type="submit" value="'. get_lang('Search') .'" />'. get_lang('Search') .'</button>'; |
|
134 | - $reset_button = '<button class="save" type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />'. get_lang('SearchResetKeywords') .'</button> '; |
|
132 | + $submit_button1 = '<button class="search" type="submit" id="submit" value="'.get_lang("Search").'" /> '.get_lang('Search').'</button>'; |
|
133 | + $submit_button2 = '<button class="search" type="submit" value="'.get_lang('Search').'" />'.get_lang('Search').'</button>'; |
|
134 | + $reset_button = '<button class="save" type="submit" id="tags-clean" value="'.get_lang('SearchResetKeywords').'" />'.get_lang('SearchResetKeywords').'</button> '; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | $query = isset($_REQUEST['query']) ? Security::remove_XSS($_REQUEST['query']) : null; |
138 | 138 | |
139 | - $form = '<form id="chamilo_search" action="'. $action .'" method="GET"> |
|
140 | - <input type="text" id="query" name="query" size="40" value="' . $query . '" /> |
|
141 | - <input type="hidden" name="mode" value="'. $mode .'"/> |
|
142 | - <input type="hidden" name="type" value="'. $type .'"/> |
|
139 | + $form = '<form id="chamilo_search" action="'.$action.'" method="GET"> |
|
140 | + <input type="text" id="query" name="query" size="40" value="' . $query.'" /> |
|
141 | + <input type="hidden" name="mode" value="'. $mode.'"/> |
|
142 | + <input type="hidden" name="type" value="'. $type.'"/> |
|
143 | 143 | <input type="hidden" name="tablename_page_nr" value="1" /> |
144 | 144 | '.$submit_button1.' |
145 | 145 | <br /><br />'; |
146 | 146 | $list = get_specific_field_list(); |
147 | 147 | |
148 | - if(!empty($list)) { |
|
149 | - $form .= '<span class="search-links-box">'. $advanced_options .' </span> |
|
150 | - <div id="tags" class="tags" style="display:'. $display_thesaurus .';"> |
|
151 | - <div class="search-help-box">'. $help .'</div> |
|
148 | + if (!empty($list)) { |
|
149 | + $form .= '<span class="search-links-box">'.$advanced_options.' </span> |
|
150 | + <div id="tags" class="tags" style="display:'. $display_thesaurus.';"> |
|
151 | + <div class="search-help-box">'. $help.'</div> |
|
152 | 152 | <table> |
153 | 153 | <tr>'; |
154 | 154 | $form .= format_specific_fields_selects($sf_terms, $op); |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | $form .= '</tr> |
163 | 163 | <tr> |
164 | 164 | <td id="operator-select"> |
165 | - '. get_lang('SearchCombineSearchWith') .':<br /> |
|
166 | - <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked .'>'. api_strtoupper(get_lang('Or')) .'</input> |
|
167 | - <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked .'>'. api_strtoupper(get_lang('And')) .'</input> |
|
165 | + '. get_lang('SearchCombineSearchWith').':<br /> |
|
166 | + <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked.'>'.api_strtoupper(get_lang('Or')).'</input> |
|
167 | + <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked.'>'.api_strtoupper(get_lang('And')).'</input> |
|
168 | 168 | </td> |
169 | 169 | <td></td> |
170 | 170 | <td> |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | </table> |
177 | 177 | </div>'; |
178 | 178 | } |
179 | - $form .='</form> |
|
179 | + $form .= '</form> |
|
180 | 180 | <br style="clear: both;"/>'; |
181 | 181 | return $form; |
182 | 182 | } |
@@ -186,36 +186,36 @@ discard block |
||
186 | 186 | * |
187 | 187 | * This type allow filter all other multiple select terms by one term in a dinamic way |
188 | 188 | */ |
189 | -function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix=NULL) { |
|
189 | +function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix = NULL) { |
|
190 | 190 | $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon')); |
191 | - $advanced_options = '<a id="tags-toggle" href="#">'. get_lang('SearchAdvancedOptions') .'</a>'; |
|
192 | - $display_thesaurus = ($show_thesaurus==true? 'block': 'none'); |
|
193 | - $help = '<h3>'. get_lang('SearchKeywordsHelpTitle') .'</h3>'. get_lang('SearchKeywordsHelpComment'); |
|
194 | - $mode = (!empty($_REQUEST['mode'])? htmlentities($_REQUEST['mode']): 'gallery'); |
|
195 | - $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal'); |
|
191 | + $advanced_options = '<a id="tags-toggle" href="#">'.get_lang('SearchAdvancedOptions').'</a>'; |
|
192 | + $display_thesaurus = ($show_thesaurus == true ? 'block' : 'none'); |
|
193 | + $help = '<h3>'.get_lang('SearchKeywordsHelpTitle').'</h3>'.get_lang('SearchKeywordsHelpComment'); |
|
194 | + $mode = (!empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery'); |
|
195 | + $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal'); |
|
196 | 196 | |
197 | 197 | /** |
198 | 198 | * POST avoid long urls, but we are using GET because |
199 | 199 | * SortableTableFromArray pagination is done with simple links, so now we |
200 | 200 | * could not send a form in pagination |
201 | 201 | */ |
202 | - if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) { |
|
203 | - $action='index.php'; |
|
202 | + if (isset($_GET['action']) && strcmp(trim($_GET['action']), 'search') === 0) { |
|
203 | + $action = 'index.php'; |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | $form = ' |
207 | - <form id="chamilo_search" action="'. $action .'" method="GET"> |
|
207 | + <form id="chamilo_search" action="'. $action.'" method="GET"> |
|
208 | 208 | <input type="text" id="query" name="query" size="40" /> |
209 | - <input type="hidden" name="mode" value="'. $mode .'"/> |
|
210 | - <input type="hidden" name="type" value="'. $type .'"/> |
|
209 | + <input type="hidden" name="mode" value="'. $mode.'"/> |
|
210 | + <input type="hidden" name="type" value="'. $type.'"/> |
|
211 | 211 | <input type="hidden" name="tablename_page_nr" value="1" /> |
212 | - <input type="submit" id="submit" value="'. get_lang("Search") .'" /> |
|
212 | + <input type="submit" id="submit" value="'. get_lang("Search").'" /> |
|
213 | 213 | <br /><br />'; |
214 | 214 | $list = get_specific_field_list(); |
215 | - if(!empty($list)) { |
|
216 | - $form .=' <span class="search-links-box">'. $thesaurus_icon . $advanced_options .' </span> |
|
217 | - <div id="tags" class="tags" style="display:'. $display_thesaurus .';"> |
|
218 | - <div class="search-help-box">'. $help .'</div> |
|
215 | + if (!empty($list)) { |
|
216 | + $form .= ' <span class="search-links-box">'.$thesaurus_icon.$advanced_options.' </span> |
|
217 | + <div id="tags" class="tags" style="display:'. $display_thesaurus.';"> |
|
218 | + <div class="search-help-box">'. $help.'</div> |
|
219 | 219 | <table> |
220 | 220 | <tr>'; |
221 | 221 | if (!is_null($prefilter_prefix)) { |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | $sf_term_array = $temp; |
231 | 231 | |
232 | 232 | // get specific field name |
233 | - $sf_value = get_specific_field_list(array( 'code' => "'$prefilter_prefix'" )); |
|
233 | + $sf_value = get_specific_field_list(array('code' => "'$prefilter_prefix'")); |
|
234 | 234 | $sf_value = array_shift($sf_value); |
235 | - $form .= '<label class="sf-select-multiple-title" for="sf_'. $prefix .'[]">'.$icons_for_search_terms[$prefix].' '.$sf_value['name'].'</label><br />'; |
|
235 | + $form .= '<label class="sf-select-multiple-title" for="sf_'.$prefix.'[]">'.$icons_for_search_terms[$prefix].' '.$sf_value['name'].'</label><br />'; |
|
236 | 236 | |
237 | 237 | $form .= format_one_specific_field_select($prefilter_prefix, $sf_term_array, $op, 'id="prefilter"'); |
238 | 238 | $form .= format_specific_fields_selects($sf_terms, $op, $prefilter_prefix); |
@@ -252,15 +252,15 @@ discard block |
||
252 | 252 | </tr> |
253 | 253 | <tr> |
254 | 254 | <td id="operator-select"> |
255 | - '. get_lang('SearchCombineSearchWith') .':<br /> |
|
256 | - <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked .'>'. api_strtoupper(get_lang('Or')) .'</input> |
|
257 | - <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked .'>'. api_strtoupper(get_lang('And')) .'</input> |
|
255 | + '. get_lang('SearchCombineSearchWith').':<br /> |
|
256 | + <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked.'>'.api_strtoupper(get_lang('Or')).'</input> |
|
257 | + <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked.'>'.api_strtoupper(get_lang('And')).'</input> |
|
258 | 258 | </td> |
259 | 259 | <td></td> |
260 | 260 | <td> |
261 | 261 | <br /> |
262 | - <input class="lower-submit" type="submit" value="'. get_lang('Search') .'" /> |
|
263 | - <input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" /> |
|
262 | + <input class="lower-submit" type="submit" value="'. get_lang('Search').'" /> |
|
263 | + <input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords').'" /> |
|
264 | 264 | </td> |
265 | 265 | </tr> |
266 | 266 | </table> |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * Show search form |
278 | 278 | */ |
279 | 279 | function display_search_form($action, $show_thesaurus, $sf_terms, $op) { |
280 | - $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal'); |
|
280 | + $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal'); |
|
281 | 281 | |
282 | 282 | switch ($type) { |
283 | 283 | case 'prefilter': |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @param string $action Just in case your action is not |
305 | 305 | * index.php |
306 | 306 | */ |
307 | -function search_widget_show($action='index.php') |
|
307 | +function search_widget_show($action = 'index.php') |
|
308 | 308 | { |
309 | 309 | require_once api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php'; |
310 | 310 | // TODO: load images dinamically when they're avalaible from specific field ui to add |
@@ -317,14 +317,14 @@ discard block |
||
317 | 317 | if (($cid = api_get_course_id()) != -1) { // with cid |
318 | 318 | |
319 | 319 | // get search engine terms |
320 | - $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid); |
|
320 | + $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID.$cid); |
|
321 | 321 | $dkterms = chamilo_query_simple_query('', 0, 1000, array($course_filter)); |
322 | 322 | |
323 | 323 | //prepare specific fields names (and also get possible URL param names) |
324 | 324 | foreach ($specific_fields as $specific_field) { |
325 | 325 | $temp = array(); |
326 | - if (is_array($dkterms) && count($dkterms)>0) { |
|
327 | - foreach($dkterms[1] as $obj) { |
|
326 | + if (is_array($dkterms) && count($dkterms) > 0) { |
|
327 | + foreach ($dkterms[1] as $obj) { |
|
328 | 328 | $temp = array_merge($obj['sf-'.$specific_field['code']], $temp); |
329 | 329 | } |
330 | 330 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | } |
353 | 353 | |
354 | 354 | $op = 'or'; |
355 | - if (!empty($_REQUEST['operator']) && in_array($op,array('or','and'))) { |
|
355 | + if (!empty($_REQUEST['operator']) && in_array($op, array('or', 'and'))) { |
|
356 | 356 | $op = $_REQUEST['operator']; |
357 | 357 | } |
358 | 358 |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | return; |
18 | 18 | } |
19 | 19 | |
20 | -require_once dirname(__FILE__) . '../../../global.inc.php'; |
|
21 | -require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloQuery.php'; |
|
20 | +require_once dirname(__FILE__).'../../../global.inc.php'; |
|
21 | +require_once api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php'; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * search with filter and build base array avoding repeated terms |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | if (is_array($dkterms) && is_array($dkterms[1])) { |
34 | 34 | foreach ($specific_fields as $specific_field) { |
35 | 35 | foreach ($dkterms[1] as $obj) { |
36 | - foreach ($obj['sf-' . $specific_field['code']] as $raw_term) { |
|
36 | + foreach ($obj['sf-'.$specific_field['code']] as $raw_term) { |
|
37 | 37 | if (count($raw_term['name']) > 1) { |
38 | 38 | $normal_term = substr($raw_term['name'], 1); |
39 | 39 | $sf_terms[$specific_field['code']][$normal_term] = $normal_term; |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | |
55 | 55 | if (($cid = api_get_course_id()) != -1) { // with cid |
56 | 56 | // course filter |
57 | - $filter[] = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid); |
|
57 | + $filter[] = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID.$cid); |
|
58 | 58 | // term filter |
59 | 59 | if ($term != '__all__') { |
60 | - $filter[] = chamilo_get_boolean_query($prefix . $term); |
|
60 | + $filter[] = chamilo_get_boolean_query($prefix.$term); |
|
61 | 61 | // always and between term and courseid |
62 | 62 | $filter = chamilo_join_queries($filter, null, 'and'); |
63 | 63 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $sf_terms = get_usual_sf_terms($filter, $specific_fields); |
66 | 66 | } else { // without cid |
67 | 67 | if ($term != '__all__') { |
68 | - $filter[] = chamilo_get_boolean_query($prefix . $term); |
|
68 | + $filter[] = chamilo_get_boolean_query($prefix.$term); |
|
69 | 69 | |
70 | 70 | $sf_terms = get_usual_sf_terms($filter, $specific_fields); |
71 | 71 | } else { // no cid and all/any terms |
@@ -150,7 +150,7 @@ |
||
150 | 150 | $data = substr($png,$ipos,$chunk['size']); |
151 | 151 | $sections = explode("\0", $data); |
152 | 152 | if ($sections[0] == $key) { |
153 | - return $sections; |
|
153 | + return $sections; |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | // Extract the data and the CRC |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | foreach (array_keys($this->_chunks[$type]) as $typekey) { |
52 | 52 | list($key, $data) = explode("\0", $this->_chunks[$type][$typekey]); |
53 | 53 | if (strcmp($key, $check) == 0) { |
54 | - echo 'Key "' . $check . '" already exists in "' . $type . '" chunk.'; |
|
54 | + echo 'Key "'.$check.'" already exists in "'.$type.'" chunk.'; |
|
55 | 55 | return false; |
56 | 56 | } |
57 | 57 | } |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function addChunk($chunkType, $key, $value) { |
72 | 72 | |
73 | - $chunkData = $key . "\0" . $value; |
|
74 | - $crc = pack("N", crc32($chunkType . $chunkData)); |
|
73 | + $chunkData = $key."\0".$value; |
|
74 | + $crc = pack("N", crc32($chunkType.$chunkData)); |
|
75 | 75 | $len = pack("N", strlen($chunkData)); |
76 | 76 | |
77 | - $newChunk = $len . $chunkType . $chunkData . $crc; |
|
77 | + $newChunk = $len.$chunkType.$chunkData.$crc; |
|
78 | 78 | $result = substr($this->_contents, 0, $this->_size - 12) |
79 | 79 | . $newChunk |
80 | 80 | . substr($this->_contents, $this->_size - 12, 12); |
@@ -92,30 +92,30 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function removeChunks($chunkType, $key, $png) { |
94 | 94 | // Read the magic bytes and verify |
95 | - $retval = substr($png,0,8); |
|
95 | + $retval = substr($png, 0, 8); |
|
96 | 96 | $ipos = 8; |
97 | 97 | if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") |
98 | 98 | throw new Exception('Is not a valid PNG image'); |
99 | 99 | // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type |
100 | - $chunkHeader = substr($png,$ipos,8); |
|
100 | + $chunkHeader = substr($png, $ipos, 8); |
|
101 | 101 | $ipos = $ipos + 8; |
102 | 102 | while ($chunkHeader) { |
103 | 103 | // Extract length and type from binary data |
104 | 104 | $chunk = @unpack('Nsize/a4type', $chunkHeader); |
105 | 105 | $skip = false; |
106 | - if ( $chunk['type'] == $chunkType ) { |
|
107 | - $data = substr($png,$ipos,$chunk['size']); |
|
106 | + if ($chunk['type'] == $chunkType) { |
|
107 | + $data = substr($png, $ipos, $chunk['size']); |
|
108 | 108 | $sections = explode("\0", $data); |
109 | 109 | print_r($sections); |
110 | - if ( $sections[0] == $key ) $skip = true; |
|
110 | + if ($sections[0] == $key) $skip = true; |
|
111 | 111 | } |
112 | 112 | // Extract the data and the CRC |
113 | - $data = substr($png,$ipos,$chunk['size']+4); |
|
113 | + $data = substr($png, $ipos, $chunk['size'] + 4); |
|
114 | 114 | $ipos = $ipos + $chunk['size'] + 4; |
115 | 115 | // Add in the header, data, and CRC |
116 | - if ( ! $skip ) $retval = $retval . $chunkHeader . $data; |
|
116 | + if (!$skip) $retval = $retval.$chunkHeader.$data; |
|
117 | 117 | // Read next chunk header |
118 | - $chunkHeader = substr($png,$ipos,8); |
|
118 | + $chunkHeader = substr($png, $ipos, 8); |
|
119 | 119 | $ipos = $ipos + 8; |
120 | 120 | } |
121 | 121 | return $retval; |
@@ -131,34 +131,34 @@ discard block |
||
131 | 131 | * If there is PNG information that matches the key an array is returned |
132 | 132 | * |
133 | 133 | */ |
134 | - public function extractBadgeInfo($png, $key='openbadges') { |
|
134 | + public function extractBadgeInfo($png, $key = 'openbadges') { |
|
135 | 135 | // Read the magic bytes and verify |
136 | - $retval = substr($png,0,8); |
|
136 | + $retval = substr($png, 0, 8); |
|
137 | 137 | $ipos = 8; |
138 | 138 | if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") { |
139 | 139 | return false; |
140 | 140 | } |
141 | 141 | |
142 | 142 | // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type |
143 | - $chunkHeader = substr($png,$ipos,8); |
|
143 | + $chunkHeader = substr($png, $ipos, 8); |
|
144 | 144 | $ipos = $ipos + 8; |
145 | 145 | while ($chunkHeader) { |
146 | 146 | // Extract length and type from binary data |
147 | 147 | $chunk = @unpack('Nsize/a4type', $chunkHeader); |
148 | 148 | $skip = false; |
149 | 149 | if ($chunk['type'] == 'tEXt') { |
150 | - $data = substr($png,$ipos,$chunk['size']); |
|
150 | + $data = substr($png, $ipos, $chunk['size']); |
|
151 | 151 | $sections = explode("\0", $data); |
152 | 152 | if ($sections[0] == $key) { |
153 | 153 | return $sections; |
154 | 154 | } |
155 | 155 | } |
156 | 156 | // Extract the data and the CRC |
157 | - $data = substr($png,$ipos,$chunk['size']+4); |
|
157 | + $data = substr($png, $ipos, $chunk['size'] + 4); |
|
158 | 158 | $ipos = $ipos + $chunk['size'] + 4; |
159 | 159 | |
160 | 160 | // Read next chunk header |
161 | - $chunkHeader = substr($png,$ipos,8); |
|
161 | + $chunkHeader = substr($png, $ipos, 8); |
|
162 | 162 | $ipos = $ipos + 8; |
163 | 163 | } |
164 | 164 | } |
@@ -94,8 +94,9 @@ discard block |
||
94 | 94 | // Read the magic bytes and verify |
95 | 95 | $retval = substr($png,0,8); |
96 | 96 | $ipos = 8; |
97 | - if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") |
|
98 | - throw new Exception('Is not a valid PNG image'); |
|
97 | + if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") { |
|
98 | + throw new Exception('Is not a valid PNG image'); |
|
99 | + } |
|
99 | 100 | // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type |
100 | 101 | $chunkHeader = substr($png,$ipos,8); |
101 | 102 | $ipos = $ipos + 8; |
@@ -107,13 +108,17 @@ discard block |
||
107 | 108 | $data = substr($png,$ipos,$chunk['size']); |
108 | 109 | $sections = explode("\0", $data); |
109 | 110 | print_r($sections); |
110 | - if ( $sections[0] == $key ) $skip = true; |
|
111 | + if ( $sections[0] == $key ) { |
|
112 | + $skip = true; |
|
113 | + } |
|
111 | 114 | } |
112 | 115 | // Extract the data and the CRC |
113 | 116 | $data = substr($png,$ipos,$chunk['size']+4); |
114 | 117 | $ipos = $ipos + $chunk['size'] + 4; |
115 | 118 | // Add in the header, data, and CRC |
116 | - if ( ! $skip ) $retval = $retval . $chunkHeader . $data; |
|
119 | + if ( ! $skip ) { |
|
120 | + $retval = $retval . $chunkHeader . $data; |
|
121 | + } |
|
117 | 122 | // Read next chunk header |
118 | 123 | $chunkHeader = substr($png,$ipos,8); |
119 | 124 | $ipos = $ipos + 8; |