@@ -273,6 +273,8 @@ |
||
| 273 | 273 | |
| 274 | 274 | /** |
| 275 | 275 | * Show search form |
| 276 | + * @param string $action |
|
| 277 | + * @param boolean $show_thesaurus |
|
| 276 | 278 | */ |
| 277 | 279 | function display_search_form($action, $show_thesaurus, $sf_terms, $op) { |
| 278 | 280 | $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal'); |
@@ -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)) { |
@@ -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 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * Simple getter for the db attribute |
| 101 | - * @return object The db attribute |
|
| 101 | + * @return null|XapianWritableDatabase The db attribute |
|
| 102 | 102 | */ |
| 103 | 103 | function getDb() |
| 104 | 104 | { |
@@ -108,6 +108,7 @@ discard block |
||
| 108 | 108 | /** |
| 109 | 109 | * Add this chunk to the chunk array attribute |
| 110 | 110 | * @param string Chunk of text |
| 111 | + * @param IndexableChunk $chunk |
|
| 111 | 112 | * @return void |
| 112 | 113 | */ |
| 113 | 114 | function addChunk($chunk) |
@@ -179,7 +180,7 @@ discard block |
||
| 179 | 180 | * Get document data on a xapian document |
| 180 | 181 | * |
| 181 | 182 | * @param XapianDocument $doc xapian document to push into the db |
| 182 | - * @return mixed xapian document data or FALSE if error |
|
| 183 | + * @return string xapian document data or FALSE if error |
|
| 183 | 184 | */ |
| 184 | 185 | function get_document_data($doc) |
| 185 | 186 | { |
@@ -286,7 +287,7 @@ discard block |
||
| 286 | 287 | * Replace a document in the actual db |
| 287 | 288 | * |
| 288 | 289 | * @param XapianDocument $doc xapian document to push into the db |
| 289 | - * @param Xapian::docid $did xapian document id of the document to replace |
|
| 290 | + * @param integer $did xapian document id of the document to replace |
|
| 290 | 291 | */ |
| 291 | 292 | function replace_document($doc, $did) |
| 292 | 293 | { |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | require_once 'xapian.php'; |
| 9 | -require_once dirname(__FILE__) . '/../IndexableChunk.class.php'; |
|
| 9 | +require_once dirname(__FILE__).'/../IndexableChunk.class.php'; |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * Abstract helper class |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | if (!empty($chunk->terms)) { |
| 131 | 131 | foreach ($chunk->terms as $term) { |
| 132 | 132 | /* FIXME: think of getting weight */ |
| 133 | - $doc->add_term($term['flag'] . $term['name'], 1); |
|
| 133 | + $doc->add_term($term['flag'].$term['name'], 1); |
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $doc->clear_terms(); |
| 216 | 216 | foreach ($terms as $term) { |
| 217 | 217 | //add directly |
| 218 | - $doc->add_term($prefix . $term, 1); |
|
| 218 | + $doc->add_term($prefix.$term, 1); |
|
| 219 | 219 | } |
| 220 | 220 | $this->db->replace_document($did, $doc); |
| 221 | 221 | $this->db->flush(); |
@@ -70,13 +70,16 @@ |
||
| 70 | 70 | */ |
| 71 | 71 | function connectDb($path = null, $dbMode = null, $lang = 'english') |
| 72 | 72 | { |
| 73 | - if ($this->db != null) |
|
| 74 | - return $this->db; |
|
| 75 | - if ($dbMode == null) |
|
| 76 | - $dbMode = Xapian::DB_CREATE_OR_OPEN; |
|
| 73 | + if ($this->db != null) { |
|
| 74 | + return $this->db; |
|
| 75 | + } |
|
| 76 | + if ($dbMode == null) { |
|
| 77 | + $dbMode = Xapian::DB_CREATE_OR_OPEN; |
|
| 78 | + } |
|
| 77 | 79 | |
| 78 | - if ($path == null) |
|
| 79 | - $path = api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb/'; |
|
| 80 | + if ($path == null) { |
|
| 81 | + $path = api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb/'; |
|
| 82 | + } |
|
| 80 | 83 | |
| 81 | 84 | try { |
| 82 | 85 | $this->db = new XapianWritableDatabase($path, $dbMode); |
@@ -45,6 +45,8 @@ discard block |
||
| 45 | 45 | * checker path (directory) |
| 46 | 46 | * @param string Absolute path to be checked (with trailing slash) |
| 47 | 47 | * @param string Checker path under which the path should be (absolute path, with trailing slash, get it from api_get_path(SYS_COURSE_PATH)) |
| 48 | + * @param string $abs_path |
|
| 49 | + * @param string $checker_path |
|
| 48 | 50 | * @return bool True if the path is under the checker, false otherwise |
| 49 | 51 | */ |
| 50 | 52 | public static function check_abs_path($abs_path, $checker_path) |
@@ -300,6 +302,7 @@ discard block |
||
| 300 | 302 | * @param string The variable to filter for XSS, this params can be a string or an array (example : array(x,y)) |
| 301 | 303 | * @param int The user status,constant allowed (STUDENT, COURSEMANAGER, ANONYMOUS, COURSEMANAGERLOWSECURITY) |
| 302 | 304 | * @param bool $filter_terms |
| 305 | + * @param integer $user_status |
|
| 303 | 306 | * @return mixed Filtered string or array |
| 304 | 307 | */ |
| 305 | 308 | public static function remove_XSS($var, $user_status = null, $filter_terms = false) |
@@ -453,7 +456,7 @@ discard block |
||
| 453 | 456 | * This method provides specific protection (against XSS and other kinds of attacks) for static images (icons) used by the system. |
| 454 | 457 | * Image paths are supposed to be given by programmers - people who know what they do, anyway, this method encourages |
| 455 | 458 | * a safe practice for generating icon paths, without using heavy solutions based on HTMLPurifier for example. |
| 456 | - * @param string $img_path The input path of the image, it could be relative or absolute URL. |
|
| 459 | + * @param string $image_path The input path of the image, it could be relative or absolute URL. |
|
| 457 | 460 | * @return string Returns sanitized image path or an empty string when the image path is not secure. |
| 458 | 461 | * @author Ivan Tcholakov, March 2011 |
| 459 | 462 | */ |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $rel_path = '/'.$rel_path; |
| 92 | 92 | } |
| 93 | 93 | $abs_path = $current_path.$rel_path; |
| 94 | - $true_path=str_replace("\\", '/', realpath($abs_path)); |
|
| 94 | + $true_path = str_replace("\\", '/', realpath($abs_path)); |
|
| 95 | 95 | $found = strpos($true_path.'/', $checker_path); |
| 96 | 96 | if ($found === 0) { |
| 97 | 97 | return true; |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | if ($user_status == COURSEMANAGERLOWSECURITY) { |
| 324 | - return $var; // No filtering. |
|
| 324 | + return $var; // No filtering. |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | static $purifier = array(); |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | // Shows _target attribute in anchors |
| 347 | - $config->set('Attr.AllowedFrameTargets', array('_blank','_top','_self', '_parent')); |
|
| 347 | + $config->set('Attr.AllowedFrameTargets', array('_blank', '_top', '_self', '_parent')); |
|
| 348 | 348 | |
| 349 | 349 | if ($user_status == STUDENT) { |
| 350 | 350 | global $allowed_html_student; |
@@ -304,9 +304,9 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | public static function remove_XSS($var, $user_status = null, $filter_terms = false) |
| 306 | 306 | { |
| 307 | - if ($filter_terms) { |
|
| 308 | - $var = self::filter_terms($var); |
|
| 309 | - } |
|
| 307 | + if ($filter_terms) { |
|
| 308 | + $var = self::filter_terms($var); |
|
| 309 | + } |
|
| 310 | 310 | |
| 311 | 311 | if (empty($user_status)) { |
| 312 | 312 | if (api_is_anonymous()) { |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | */ |
| 402 | 402 | public static function filter_terms($text) |
| 403 | 403 | { |
| 404 | - static $bad_terms = array(); |
|
| 404 | + static $bad_terms = array(); |
|
| 405 | 405 | |
| 406 | 406 | if (empty($bad_terms)) { |
| 407 | 407 | $list = api_get_setting('filter_terms'); |
@@ -422,14 +422,14 @@ discard block |
||
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - $replace = '***'; |
|
| 426 | - if (!empty($bad_terms)) { |
|
| 427 | - // Fast way |
|
| 428 | - $new_text = str_ireplace($bad_terms, $replace, $text, $count); |
|
| 429 | - $text = $new_text; |
|
| 430 | - } |
|
| 425 | + $replace = '***'; |
|
| 426 | + if (!empty($bad_terms)) { |
|
| 427 | + // Fast way |
|
| 428 | + $new_text = str_ireplace($bad_terms, $replace, $text, $count); |
|
| 429 | + $text = $new_text; |
|
| 430 | + } |
|
| 431 | 431 | |
| 432 | - return $text; |
|
| 432 | + return $text; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | |
@@ -30,6 +30,9 @@ |
||
| 30 | 30 | $this->center_x = intval($offset_x + $this->canvas_x/2 - $this->block_size/2); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | + /** |
|
| 34 | + * @param string $class |
|
| 35 | + */ |
|
| 33 | 36 | function prepare_skill_box($skill, $position, $class) |
| 34 | 37 | { |
| 35 | 38 | $block_id = $skill['id']; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | $this->skills = $skills; |
| 29 | 29 | $this->type = $type; |
| 30 | - $this->center_x = intval($offset_x + $this->canvas_x/2 - $this->block_size/2); |
|
| 30 | + $this->center_x = intval($offset_x + $this->canvas_x / 2 - $this->block_size / 2); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | function prepare_skill_box($skill, $position, $class) |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | $extra_class = 'second_window'; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $this->html .= '<div id="block_'.$block_id.'" class = "open_block window '.$extra_class.' '.$class.'" style = "top:' . $position['y'] . 'px; left:' . $position['x'] . 'px;">'; |
|
| 42 | + $this->html .= '<div id="block_'.$block_id.'" class = "open_block window '.$extra_class.' '.$class.'" style = "top:'.$position['y'].'px; left:'.$position['x'].'px;">'; |
|
| 43 | 43 | |
| 44 | - $content = $skill['name']; |
|
| 44 | + $content = $skill['name']; |
|
| 45 | 45 | $content .= '<div class="btn-group">'; |
| 46 | 46 | $content .= Display::url(get_lang('Edit'), '#', array('id'=>'edit_block_'.$block_id, 'class'=>'edit_block btn')); |
| 47 | 47 | $content .= Display::url('+', '#', array('id'=>'edit_block_'.$block_id, 'class'=>'edit_block btn')); |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | //default_arrow_color |
| 89 | 89 | |
| 90 | - $this->js .= 'var e'.$block_id.' = prepare("block_' . $block_id.'", '.$end_point.');'."\n"; |
|
| 91 | - $this->js .= 'var e'.$skill['parent_id'].' = prepare("block_' . $skill['parent_id'].'", '.$end_point.');'."\n"; |
|
| 92 | - $this->js .= 'jsPlumb.connect({source: e'.$block_id.', target:e'.$skill['parent_id'].'});'."\n";; |
|
| 90 | + $this->js .= 'var e'.$block_id.' = prepare("block_'.$block_id.'", '.$end_point.');'."\n"; |
|
| 91 | + $this->js .= 'var e'.$skill['parent_id'].' = prepare("block_'.$skill['parent_id'].'", '.$end_point.');'."\n"; |
|
| 92 | + $this->js .= 'jsPlumb.connect({source: e'.$block_id.', target:e'.$skill['parent_id'].'});'."\n"; ; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -125,10 +125,10 @@ discard block |
||
| 125 | 125 | $brothers = array(); |
| 126 | 126 | |
| 127 | 127 | foreach ($this->skills as &$skill) { |
| 128 | - if (!in_array($skill['parent_id'], array(0,1))) { |
|
| 128 | + if (!in_array($skill['parent_id'], array(0, 1))) { |
|
| 129 | 129 | continue; |
| 130 | 130 | } |
| 131 | - $childs = isset($skill['children']) ? count($skill['children']) : 0 ; |
|
| 131 | + $childs = isset($skill['children']) ? count($skill['children']) : 0; |
|
| 132 | 132 | |
| 133 | 133 | //$x = round($this->offsetX * sin(deg2rad($corner * $count))); |
| 134 | 134 | //$y = round($this->offsetY * cos(deg2rad($corner * $count))); |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | if ($skill['parent_id'] == 0) { |
| 145 | 145 | //$x = 130*$childs/2; |
| 146 | 146 | //$x = $this->space_between_blocks_x*$childs/2; |
| 147 | - $x = $this->canvas_x/2 - $this->block_size/2; |
|
| 147 | + $x = $this->canvas_x / 2 - $this->block_size / 2; |
|
| 148 | 148 | } else { |
| 149 | 149 | $max = isset($this->skills[$skill['parent_id']]['children']) ? count($this->skills[$skill['parent_id']]['children']) : 0; |
| 150 | - foreach($this->skills[$skill['parent_id']]['children'] as $id => $sk) { |
|
| 150 | + foreach ($this->skills[$skill['parent_id']]['children'] as $id => $sk) { |
|
| 151 | 151 | if ($skill['id'] == $sk['id']) { |
| 152 | 152 | break; |
| 153 | 153 | } |
@@ -155,17 +155,17 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | $parent_x = isset($this->skills[$skill['parent_id']]['x']) ? $this->skills[$skill['parent_id']]['x'] : 0; |
| 157 | 157 | //$x = $my_count*$this->space_between_blocks_x + $parent_x + $this->block_size - ($this->space_between_blocks_x*$max/2) ; |
| 158 | - $x = $my_count*$this->space_between_blocks_x + $parent_x + $this->block_size - ($this->canvas_x/2 ) ; |
|
| 158 | + $x = $my_count * $this->space_between_blocks_x + $parent_x + $this->block_size - ($this->canvas_x / 2); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - $y = $skill['level']*$this->space_between_blocks_y; |
|
| 161 | + $y = $skill['level'] * $this->space_between_blocks_y; |
|
| 162 | 162 | |
| 163 | 163 | $skill['x'] = $x; |
| 164 | 164 | $skill['y'] = $y; |
| 165 | 165 | |
| 166 | 166 | //$skill['description'] = "{$brothers[$skill['parent_id']]} $x - $y"; |
| 167 | 167 | //$skill['name'] = $skill['name']." | $x = $my_count * 150 + $parent_x - (150* $max/2) - 10*$childs "; |
| 168 | - $this->add_item($skill, array('x' => $this->offset_x + $x, 'y' => $this->offset_y +$y)); |
|
| 168 | + $this->add_item($skill, array('x' => $this->offset_x + $x, 'y' => $this->offset_y + $y)); |
|
| 169 | 169 | } |
| 170 | 170 | return $this->get_html(); |
| 171 | 171 | } |
@@ -63,6 +63,8 @@ discard block |
||
| 63 | 63 | * @param int user id |
| 64 | 64 | * @param int user friend id |
| 65 | 65 | * @param string |
| 66 | + * @param integer $user_id |
|
| 67 | + * @param integer $user_friend |
|
| 66 | 68 | * @author isaac flores paz |
| 67 | 69 | */ |
| 68 | 70 | public static function get_relation_between_contacts($user_id, $user_friend) |
@@ -94,6 +96,8 @@ discard block |
||
| 94 | 96 | * @param int group id |
| 95 | 97 | * @param string name to search |
| 96 | 98 | * @param bool true will load firstname, lastname, and image name |
| 99 | + * @param integer $user_id |
|
| 100 | + * @param integer $id_group |
|
| 97 | 101 | * @return array |
| 98 | 102 | * @author Julio Montoya <[email protected]> Cleaning code, function renamed, $load_extra_info option added |
| 99 | 103 | * @author isaac flores paz |
@@ -170,6 +174,9 @@ discard block |
||
| 170 | 174 | * @param int user friend id |
| 171 | 175 | * @param string title of the message |
| 172 | 176 | * @param string content of the message |
| 177 | + * @param integer $user_id |
|
| 178 | + * @param string $message_title |
|
| 179 | + * @param string $message_content |
|
| 173 | 180 | * @return boolean |
| 174 | 181 | * @author isaac flores paz |
| 175 | 182 | * @author Julio Montoya <[email protected]> Cleaning code |
@@ -241,6 +248,7 @@ discard block |
||
| 241 | 248 | * Get number messages of the inbox |
| 242 | 249 | * @author isaac flores paz |
| 243 | 250 | * @param int user receiver id |
| 251 | + * @param integer $user_receiver_id |
|
| 244 | 252 | * @return int |
| 245 | 253 | */ |
| 246 | 254 | public static function get_message_number_invitation_by_user_id($user_receiver_id) |
@@ -283,6 +291,7 @@ discard block |
||
| 283 | 291 | * Get invitation list sent by user |
| 284 | 292 | * @author Julio Montoya <[email protected]> |
| 285 | 293 | * @param int user id |
| 294 | + * @param integer $user_id |
|
| 286 | 295 | * @return array() |
| 287 | 296 | */ |
| 288 | 297 | public static function get_list_invitation_sent_by_user_id($user_id) |
@@ -325,6 +334,7 @@ discard block |
||
| 325 | 334 | * Denies invitation |
| 326 | 335 | * @param int user sender id |
| 327 | 336 | * @param int user receiver id |
| 337 | + * @param integer $user_receiver_id |
|
| 328 | 338 | * @author isaac flores paz |
| 329 | 339 | * @author Julio Montoya <[email protected]> Cleaning code |
| 330 | 340 | */ |
@@ -360,7 +370,7 @@ discard block |
||
| 360 | 370 | * @author Isaac Flores Paz <[email protected]> |
| 361 | 371 | * @author Julio Montoya <[email protected]> Cleaning code |
| 362 | 372 | * @param void |
| 363 | - * @return string message invitation |
|
| 373 | + * @return false|null message invitation |
|
| 364 | 374 | */ |
| 365 | 375 | public static function send_invitation_friend_user($userfriend_id, $subject_message = '', $content_message = '') |
| 366 | 376 | { |
@@ -1229,7 +1239,7 @@ discard block |
||
| 1229 | 1239 | * @param string $messageContent of the message |
| 1230 | 1240 | * @param int $messageId id parent |
| 1231 | 1241 | * @param string $messageStatus status type of message |
| 1232 | - * @return boolean |
|
| 1242 | + * @return false|string |
|
| 1233 | 1243 | * @author Yannick Warnier |
| 1234 | 1244 | */ |
| 1235 | 1245 | public static function sendWallMessage($userId, $friendId, $messageContent, $messageId = 0, $messageStatus = '') |
@@ -1318,7 +1328,7 @@ discard block |
||
| 1318 | 1328 | * Gets all messages from someone's wall (within specific limits) |
| 1319 | 1329 | * @param int $userId id of wall shown |
| 1320 | 1330 | * @param string $messageStatus status wall message |
| 1321 | - * @param int|string $parentId id message (Post main) |
|
| 1331 | + * @param integer|null $parentId id message (Post main) |
|
| 1322 | 1332 | * @param date $start Date from which we want to show the messages, in UTC time |
| 1323 | 1333 | * @param int $limit Limit for the number of parent messages we want to show |
| 1324 | 1334 | * @param int $offset Wall message query offset |
@@ -1647,7 +1657,7 @@ discard block |
||
| 1647 | 1657 | /** |
| 1648 | 1658 | * Delete messages delete logic |
| 1649 | 1659 | * @param int $id id message to delete. |
| 1650 | - * @return bool status query |
|
| 1660 | + * @return Statement|null status query |
|
| 1651 | 1661 | */ |
| 1652 | 1662 | public static function deleteMessage($id) |
| 1653 | 1663 | { |
@@ -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); |
@@ -1644,11 +1644,11 @@ discard block |
||
| 1644 | 1644 | |
| 1645 | 1645 | if ($size == IMAGE_WALL_SMALL) { |
| 1646 | 1646 | $name = IMAGE_WALL_SMALL. '_' . $array[2]; |
| 1647 | - }else if($size == IMAGE_WALL_MEDIUM){ |
|
| 1647 | + } else if($size == IMAGE_WALL_MEDIUM){ |
|
| 1648 | 1648 | $name = IMAGE_WALL_MEDIUM. '_' . $array[2]; |
| 1649 | - }else if($size == IMAGE_WALL_BIG){ |
|
| 1649 | + } else if($size == IMAGE_WALL_BIG){ |
|
| 1650 | 1650 | $name = IMAGE_WALL_BIG. '_' . $array[2]; |
| 1651 | - }else { |
|
| 1651 | + } else { |
|
| 1652 | 1652 | $name = IMAGE_WALL_SMALL. '_' . $array[2]; |
| 1653 | 1653 | } |
| 1654 | 1654 | $lessImage = str_replace($array[2], '', $path); |
@@ -1772,7 +1772,9 @@ discard block |
||
| 1772 | 1772 | $friendHtml.= '<ul class="nav nav-list">'; |
| 1773 | 1773 | $j = 1; |
| 1774 | 1774 | for ($k=0; $k < $number_friends; $k++) { |
| 1775 | - if ($j > $number_of_images) break; |
|
| 1775 | + if ($j > $number_of_images) { |
|
| 1776 | + break; |
|
| 1777 | + } |
|
| 1776 | 1778 | |
| 1777 | 1779 | if (isset($friends[$k])) { |
| 1778 | 1780 | $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']; |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | if ($course_visibility != COURSE_VISIBILITY_HIDDEN && |
| 524 | 524 | ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER) |
| 525 | 525 | ) { |
| 526 | - $result .= '<span class="title">' . $course_title . '<span>'; |
|
| 526 | + $result .= '<span class="title">'.$course_title.'<span>'; |
|
| 527 | 527 | } else { |
| 528 | 528 | $result .= $course_title." "." ".get_lang('CourseClosed').""; |
| 529 | 529 | } |
@@ -742,57 +742,57 @@ discard block |
||
| 742 | 742 | $links = '<ul class="nav nav-pills nav-stacked">'; |
| 743 | 743 | $active = $show == 'home' ? 'active' : null; |
| 744 | 744 | $links .= ' |
| 745 | - <li class="home-icon ' . $active . '"> |
|
| 746 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php"> |
|
| 747 | - ' . $homeIcon . ' ' . get_lang('Home') . ' |
|
| 745 | + <li class="home-icon ' . $active.'"> |
|
| 746 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/home.php"> |
|
| 747 | + ' . $homeIcon.' '.get_lang('Home').' |
|
| 748 | 748 | </a> |
| 749 | 749 | </li>'; |
| 750 | 750 | $active = $show == 'messages' ? 'active' : null; |
| 751 | 751 | $links .= ' |
| 752 | - <li class="messages-icon ' . $active . '"> |
|
| 753 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social"> |
|
| 754 | - ' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . ' |
|
| 752 | + <li class="messages-icon ' . $active.'"> |
|
| 753 | + <a href="' . api_get_path(WEB_CODE_PATH).'messages/inbox.php?f=social"> |
|
| 754 | + ' . $messagesIcon.' '.get_lang('Messages').$count_unread_message.' |
|
| 755 | 755 | </a> |
| 756 | 756 | </li>'; |
| 757 | 757 | |
| 758 | 758 | //Invitations |
| 759 | 759 | $active = $show == 'invitations' ? 'active' : null; |
| 760 | 760 | $links .= ' |
| 761 | - <li class="invitations-icon ' . $active . '"> |
|
| 762 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php"> |
|
| 763 | - ' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . ' |
|
| 761 | + <li class="invitations-icon ' . $active.'"> |
|
| 762 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/invitations.php"> |
|
| 763 | + ' . $invitationsIcon.' '.get_lang('Invitations').$total_invitations.' |
|
| 764 | 764 | </a> |
| 765 | 765 | </li>'; |
| 766 | 766 | |
| 767 | 767 | //Shared profile and groups |
| 768 | 768 | $active = $show == 'shared_profile' ? 'active' : null; |
| 769 | 769 | $links .= ' |
| 770 | - <li class="shared-profile-icon' . $active . '"> |
|
| 771 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php"> |
|
| 772 | - ' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . ' |
|
| 770 | + <li class="shared-profile-icon' . $active.'"> |
|
| 771 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/profile.php"> |
|
| 772 | + ' . $sharedProfileIcon.' '.get_lang('ViewMySharedProfile').' |
|
| 773 | 773 | </a> |
| 774 | 774 | </li>'; |
| 775 | 775 | $active = $show == 'friends' ? 'active' : null; |
| 776 | 776 | $links .= ' |
| 777 | - <li class="friends-icon ' . $active . '"> |
|
| 778 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php"> |
|
| 779 | - ' . $friendsIcon . ' ' . get_lang('Friends') . ' |
|
| 777 | + <li class="friends-icon ' . $active.'"> |
|
| 778 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/friends.php"> |
|
| 779 | + ' . $friendsIcon.' '.get_lang('Friends').' |
|
| 780 | 780 | </a> |
| 781 | 781 | </li>'; |
| 782 | 782 | $active = $show == 'browse_groups' ? 'active' : null; |
| 783 | 783 | $links .= ' |
| 784 | - <li class="browse-groups-icon ' . $active . '"> |
|
| 785 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php"> |
|
| 786 | - ' . $groupsIcon . ' ' . get_lang('SocialGroups') . ' |
|
| 784 | + <li class="browse-groups-icon ' . $active.'"> |
|
| 785 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/groups.php"> |
|
| 786 | + ' . $groupsIcon.' '.get_lang('SocialGroups').' |
|
| 787 | 787 | </a> |
| 788 | 788 | </li>'; |
| 789 | 789 | |
| 790 | 790 | //Search users |
| 791 | 791 | $active = $show == 'search' ? 'active' : null; |
| 792 | 792 | $links .= ' |
| 793 | - <li class="search-icon ' . $active . '"> |
|
| 794 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php"> |
|
| 795 | - ' . $searchIcon . ' ' . get_lang('Search') . ' |
|
| 793 | + <li class="search-icon ' . $active.'"> |
|
| 794 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/search.php"> |
|
| 795 | + ' . $searchIcon.' '.get_lang('Search').' |
|
| 796 | 796 | </a> |
| 797 | 797 | </li>'; |
| 798 | 798 | |
@@ -800,9 +800,9 @@ discard block |
||
| 800 | 800 | $active = $show == 'myfiles' ? 'active' : null; |
| 801 | 801 | |
| 802 | 802 | $myFiles = ' |
| 803 | - <li class="myfiles-icon ' . $active . '"> |
|
| 804 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php"> |
|
| 805 | - ' . $filesIcon . ' ' . get_lang('MyFiles') . ' |
|
| 803 | + <li class="myfiles-icon ' . $active.'"> |
|
| 804 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/myfiles.php"> |
|
| 805 | + ' . $filesIcon.' '.get_lang('MyFiles').' |
|
| 806 | 806 | </a> |
| 807 | 807 | </li>'; |
| 808 | 808 | |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | } |
| 812 | 812 | $links .= $myFiles; |
| 813 | 813 | |
| 814 | - $links .='</ul>'; |
|
| 814 | + $links .= '</ul>'; |
|
| 815 | 815 | |
| 816 | 816 | $html .= Display::panelCollapse( |
| 817 | 817 | get_lang('SocialNetwork'), |
@@ -832,57 +832,57 @@ discard block |
||
| 832 | 832 | } |
| 833 | 833 | |
| 834 | 834 | if ($show == 'shared_profile') { |
| 835 | - $links = '<ul class="nav nav-pills nav-stacked">'; |
|
| 835 | + $links = '<ul class="nav nav-pills nav-stacked">'; |
|
| 836 | 836 | // My own profile |
| 837 | 837 | if ($show_full_profile && $user_id == intval(api_get_user_id())) { |
| 838 | 838 | $links .= ' |
| 839 | - <li class="home-icon ' . $active . '"> |
|
| 840 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php"> |
|
| 841 | - ' . $homeIcon . ' ' . get_lang('Home') . ' |
|
| 839 | + <li class="home-icon ' . $active.'"> |
|
| 840 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/home.php"> |
|
| 841 | + ' . $homeIcon.' '.get_lang('Home').' |
|
| 842 | 842 | </a> |
| 843 | 843 | </li> |
| 844 | - <li class="messages-icon ' . $active . '"> |
|
| 845 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social"> |
|
| 846 | - ' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . ' |
|
| 844 | + <li class="messages-icon ' . $active.'"> |
|
| 845 | + <a href="' . api_get_path(WEB_CODE_PATH).'messages/inbox.php?f=social"> |
|
| 846 | + ' . $messagesIcon.' '.get_lang('Messages').$count_unread_message.' |
|
| 847 | 847 | </a> |
| 848 | 848 | </li>'; |
| 849 | 849 | $active = $show == 'invitations' ? 'active' : null; |
| 850 | 850 | $links .= ' |
| 851 | - <li class="invitations-icon' . $active . '"> |
|
| 852 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php"> |
|
| 853 | - ' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . ' |
|
| 851 | + <li class="invitations-icon' . $active.'"> |
|
| 852 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/invitations.php"> |
|
| 853 | + ' . $invitationsIcon.' '.get_lang('Invitations').$total_invitations.' |
|
| 854 | 854 | </a> |
| 855 | 855 | </li>'; |
| 856 | 856 | |
| 857 | 857 | $links .= ' |
| 858 | 858 | <li class="shared-profile-icon active"> |
| 859 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php"> |
|
| 860 | - ' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . ' |
|
| 859 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/profile.php"> |
|
| 860 | + ' . $sharedProfileIcon.' '.get_lang('ViewMySharedProfile').' |
|
| 861 | 861 | </a> |
| 862 | 862 | </li> |
| 863 | 863 | <li class="friends-icon"> |
| 864 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php"> |
|
| 865 | - ' . $friendsIcon . ' ' . get_lang('Friends') . ' |
|
| 864 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/friends.php"> |
|
| 865 | + ' . $friendsIcon.' '.get_lang('Friends').' |
|
| 866 | 866 | </a> |
| 867 | 867 | </li> |
| 868 | 868 | <li class="browse-groups-icon"> |
| 869 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php"> |
|
| 870 | - ' . $groupsIcon . ' ' . get_lang('SocialGroups') . ' |
|
| 869 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/groups.php"> |
|
| 870 | + ' . $groupsIcon.' '.get_lang('SocialGroups').' |
|
| 871 | 871 | </a> |
| 872 | 872 | </li>'; |
| 873 | 873 | $active = $show == 'search' ? 'active' : null; |
| 874 | 874 | $links .= ' |
| 875 | - <li class="search-icon ' . $active . '"> |
|
| 876 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php"> |
|
| 877 | - ' . $searchIcon . ' ' . get_lang('Search') . ' |
|
| 875 | + <li class="search-icon ' . $active.'"> |
|
| 876 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/search.php"> |
|
| 877 | + ' . $searchIcon.' '.get_lang('Search').' |
|
| 878 | 878 | </a> |
| 879 | 879 | </li>'; |
| 880 | 880 | $active = $show == 'myfiles' ? 'active' : null; |
| 881 | 881 | |
| 882 | 882 | $myFiles = ' |
| 883 | - <li class="myfiles-icon ' . $active . '"> |
|
| 884 | - <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php"> |
|
| 885 | - ' . $filesIcon . ' ' . get_lang('MyFiles') . ' |
|
| 883 | + <li class="myfiles-icon ' . $active.'"> |
|
| 884 | + <a href="' . api_get_path(WEB_CODE_PATH).'social/myfiles.php"> |
|
| 885 | + ' . $filesIcon.' '.get_lang('MyFiles').' |
|
| 886 | 886 | </a> |
| 887 | 887 | </li>'; |
| 888 | 888 | |
@@ -928,7 +928,7 @@ discard block |
||
| 928 | 928 | $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>'; |
| 929 | 929 | } else { |
| 930 | 930 | if (!$show_full_profile) { |
| 931 | - $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>'; |
|
| 931 | + $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>'; |
|
| 932 | 932 | } |
| 933 | 933 | } |
| 934 | 934 | |
@@ -1040,10 +1040,10 @@ discard block |
||
| 1040 | 1040 | foreach ($user_list as $uid) { |
| 1041 | 1041 | $user_info = api_get_user_info($uid, $checkIfUserOnline = true); |
| 1042 | 1042 | $lastname = $user_info['lastname']; |
| 1043 | - $firstname = $user_info['firstname']; |
|
| 1043 | + $firstname = $user_info['firstname']; |
|
| 1044 | 1044 | $completeName = $firstname.', '.$lastname; |
| 1045 | 1045 | |
| 1046 | - $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); |
|
| 1046 | + $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); |
|
| 1047 | 1047 | $status_icon_chat = null; |
| 1048 | 1048 | if ($user_info['user_is_online_in_chat'] == 1) { |
| 1049 | 1049 | $status_icon_chat = Display::return_icon('online.png', get_lang('Online')); |
@@ -1058,7 +1058,7 @@ discard block |
||
| 1058 | 1058 | } |
| 1059 | 1059 | $img = '<img class="img-responsive img-circle" title="'.$completeName.'" alt="'.$completeName.'" src="'.$userPicture.'">'; |
| 1060 | 1060 | |
| 1061 | - $url = null; |
|
| 1061 | + $url = null; |
|
| 1062 | 1062 | // Anonymous users can't have access to the profile |
| 1063 | 1063 | if (!api_is_anonymous()) { |
| 1064 | 1064 | if (api_get_setting('allow_social_tool') == 'true') { |
@@ -1225,13 +1225,13 @@ discard block |
||
| 1225 | 1225 | case SOCIAL_CENTER_PLUGIN: |
| 1226 | 1226 | $social_plugins = array(1, 2); |
| 1227 | 1227 | if (is_array($social_plugins) && count($social_plugins) > 0) { |
| 1228 | - $content.= '<div id="social-plugins">'; |
|
| 1228 | + $content .= '<div id="social-plugins">'; |
|
| 1229 | 1229 | foreach ($social_plugins as $plugin) { |
| 1230 | - $content.= '<div class="social-plugin-item">'; |
|
| 1231 | - $content.= $plugin; |
|
| 1232 | - $content.= '</div>'; |
|
| 1230 | + $content .= '<div class="social-plugin-item">'; |
|
| 1231 | + $content .= $plugin; |
|
| 1232 | + $content .= '</div>'; |
|
| 1233 | 1233 | } |
| 1234 | - $content.= '</div>'; |
|
| 1234 | + $content .= '</div>'; |
|
| 1235 | 1235 | } |
| 1236 | 1236 | break; |
| 1237 | 1237 | case SOCIAL_LEFT_PLUGIN: |
@@ -1302,12 +1302,12 @@ discard block |
||
| 1302 | 1302 | if (!in_array($extension, $allowedTypes)) { |
| 1303 | 1303 | $flag = false; |
| 1304 | 1304 | } else { |
| 1305 | - $newFileName = uniqid('') . '.' . $extension; |
|
| 1305 | + $newFileName = uniqid('').'.'.$extension; |
|
| 1306 | 1306 | if (!file_exists($pathMessageAttach)) { |
| 1307 | 1307 | @mkdir($pathMessageAttach, api_get_permissions_for_new_directories(), true); |
| 1308 | 1308 | } |
| 1309 | 1309 | |
| 1310 | - $newPath = $pathMessageAttach . $newFileName; |
|
| 1310 | + $newPath = $pathMessageAttach.$newFileName; |
|
| 1311 | 1311 | if (is_uploaded_file($fileAttach['tmp_name'])) { |
| 1312 | 1312 | @copy($fileAttach['tmp_name'], $newPath); |
| 1313 | 1313 | } |
@@ -1316,9 +1316,9 @@ discard block |
||
| 1316 | 1316 | $medium = self::resize_picture($newPath, IMAGE_WALL_MEDIUM_SIZE); |
| 1317 | 1317 | |
| 1318 | 1318 | $big = new Image($newPath); |
| 1319 | - $ok = $small && $small->send_image($pathMessageAttach . IMAGE_WALL_SMALL . '_' . $newFileName) && |
|
| 1320 | - $medium && $medium->send_image($pathMessageAttach . IMAGE_WALL_MEDIUM .'_' . $newFileName) && |
|
| 1321 | - $big && $big->send_image($pathMessageAttach . IMAGE_WALL_BIG . '_' . $newFileName); |
|
| 1319 | + $ok = $small && $small->send_image($pathMessageAttach.IMAGE_WALL_SMALL.'_'.$newFileName) && |
|
| 1320 | + $medium && $medium->send_image($pathMessageAttach.IMAGE_WALL_MEDIUM.'_'.$newFileName) && |
|
| 1321 | + $big && $big->send_image($pathMessageAttach.IMAGE_WALL_BIG.'_'.$newFileName); |
|
| 1322 | 1322 | |
| 1323 | 1323 | // Insert |
| 1324 | 1324 | $newFileName = $social.$newFileName; |
@@ -1409,7 +1409,7 @@ discard block |
||
| 1409 | 1409 | $start = '0000-00-00'; |
| 1410 | 1410 | } |
| 1411 | 1411 | |
| 1412 | - $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId); |
|
| 1412 | + $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId); |
|
| 1413 | 1413 | $messages = self::getWallMessages($userId, MESSAGE_STATUS_WALL, $idMessage, $start, $limit, $offset); |
| 1414 | 1414 | $formattedList = '<div class="sub-mediapost">'; |
| 1415 | 1415 | $users = array(); |
@@ -1424,20 +1424,20 @@ discard block |
||
| 1424 | 1424 | } |
| 1425 | 1425 | |
| 1426 | 1426 | $nameComplete = api_is_western_name_order() |
| 1427 | - ? $users[$userIdLoop]['firstname'] .' ' . $users[$userIdLoop]['lastname'] |
|
| 1428 | - : $users[$userIdLoop]['lastname'] . ' ' . $users[$userIdLoop]['firstname']; |
|
| 1427 | + ? $users[$userIdLoop]['firstname'].' '.$users[$userIdLoop]['lastname'] |
|
| 1428 | + : $users[$userIdLoop]['lastname'].' '.$users[$userIdLoop]['firstname']; |
|
| 1429 | 1429 | $url = api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$userIdLoop; |
| 1430 | 1430 | $media = ''; |
| 1431 | 1431 | $media .= '<div class="rep-post">'; |
| 1432 | 1432 | $media .= '<div class="col-md-2 col-xs-2 social-post-answers">'; |
| 1433 | 1433 | $media .= '<div class="user-image pull-right">'; |
| 1434 | - $media .= '<a href="'.$url.'" ><img src="'. $users[$userIdLoop]['avatar'] . |
|
| 1434 | + $media .= '<a href="'.$url.'" ><img src="'.$users[$userIdLoop]['avatar']. |
|
| 1435 | 1435 | '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>'; |
| 1436 | 1436 | $media .= '</div>'; |
| 1437 | 1437 | $media .= '</div>'; |
| 1438 | 1438 | $media .= '<div class="col-md-9 col-xs-9 social-post-answers">'; |
| 1439 | 1439 | $media .= '<div class="user-data">'; |
| 1440 | - $media .= '<div class="username">' . '<a href="'.$url.'">'.$nameComplete.'</a> <span>'.Security::remove_XSS($message['content']).'</span></div>'; |
|
| 1440 | + $media .= '<div class="username">'.'<a href="'.$url.'">'.$nameComplete.'</a> <span>'.Security::remove_XSS($message['content']).'</span></div>'; |
|
| 1441 | 1441 | $media .= '<div class="time timeago" title="'.$date.'">'.$date.'</div>'; |
| 1442 | 1442 | $media .= '<br />'; |
| 1443 | 1443 | $media .= '</div>'; |
@@ -1480,12 +1480,12 @@ discard block |
||
| 1480 | 1480 | * @param int $offset Wall messages offset |
| 1481 | 1481 | * @return array $data return user's starting wall messages along with message extra data |
| 1482 | 1482 | */ |
| 1483 | - public static function getWallMessagesPostHTML($userId, $friendId = 0, $start = null, $limit = 10, $offset= 0) |
|
| 1483 | + public static function getWallMessagesPostHTML($userId, $friendId = 0, $start = null, $limit = 10, $offset = 0) |
|
| 1484 | 1484 | { |
| 1485 | 1485 | if (empty($start)) { |
| 1486 | 1486 | $start = '0000-00-00'; |
| 1487 | 1487 | } |
| 1488 | - $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId); |
|
| 1488 | + $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId); |
|
| 1489 | 1489 | $messages = self::getWallMessages($userId, MESSAGE_STATUS_WALL_POST, null, $start, $limit, $offset); |
| 1490 | 1490 | $users = array(); |
| 1491 | 1491 | $data = array(); |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | |
| 1545 | 1545 | $htmlReceiver = ''; |
| 1546 | 1546 | if ($authorId != $receiverId) { |
| 1547 | - $htmlReceiver = ' > <a href="'.$urlReceiver.'">' . $nameCompleteReceiver . '</a> '; |
|
| 1547 | + $htmlReceiver = ' > <a href="'.$urlReceiver.'">'.$nameCompleteReceiver.'</a> '; |
|
| 1548 | 1548 | } |
| 1549 | 1549 | |
| 1550 | 1550 | $wallImage = ''; |
@@ -1579,7 +1579,7 @@ discard block |
||
| 1579 | 1579 | $html .= '<div class="img-post">'; |
| 1580 | 1580 | $html .= $wallImage; |
| 1581 | 1581 | $html .= '</div>'; |
| 1582 | - $html .= '<p>'. Security::remove_XSS($message['content']).'</p>'; |
|
| 1582 | + $html .= '<p>'.Security::remove_XSS($message['content']).'</p>'; |
|
| 1583 | 1583 | $html .= '</div>'; |
| 1584 | 1584 | $html .= '</div>'; // end mediaPost |
| 1585 | 1585 | |
@@ -1659,16 +1659,16 @@ discard block |
||
| 1659 | 1659 | if (isset($array[2]) && !empty($array[2])) { |
| 1660 | 1660 | |
| 1661 | 1661 | if ($size == IMAGE_WALL_SMALL) { |
| 1662 | - $name = IMAGE_WALL_SMALL. '_' . $array[2]; |
|
| 1663 | - }else if($size == IMAGE_WALL_MEDIUM){ |
|
| 1664 | - $name = IMAGE_WALL_MEDIUM. '_' . $array[2]; |
|
| 1665 | - }else if($size == IMAGE_WALL_BIG){ |
|
| 1666 | - $name = IMAGE_WALL_BIG. '_' . $array[2]; |
|
| 1667 | - }else { |
|
| 1668 | - $name = IMAGE_WALL_SMALL. '_' . $array[2]; |
|
| 1662 | + $name = IMAGE_WALL_SMALL.'_'.$array[2]; |
|
| 1663 | + } else if ($size == IMAGE_WALL_MEDIUM) { |
|
| 1664 | + $name = IMAGE_WALL_MEDIUM.'_'.$array[2]; |
|
| 1665 | + } else if ($size == IMAGE_WALL_BIG) { |
|
| 1666 | + $name = IMAGE_WALL_BIG.'_'.$array[2]; |
|
| 1667 | + } else { |
|
| 1668 | + $name = IMAGE_WALL_SMALL.'_'.$array[2]; |
|
| 1669 | 1669 | } |
| 1670 | 1670 | $lessImage = str_replace($array[2], '', $path); |
| 1671 | - $name = $lessImage . $name; |
|
| 1671 | + $name = $lessImage.$name; |
|
| 1672 | 1672 | } |
| 1673 | 1673 | |
| 1674 | 1674 | return $name; |
@@ -1777,18 +1777,18 @@ discard block |
||
| 1777 | 1777 | if ($number_friends != 0) { |
| 1778 | 1778 | if ($number_friends > $number_of_images) { |
| 1779 | 1779 | if (api_get_user_id() == $user_id) { |
| 1780 | - $friendHtml.= ' <span><a href="friends.php">'.get_lang('SeeAll').'</a></span>'; |
|
| 1780 | + $friendHtml .= ' <span><a href="friends.php">'.get_lang('SeeAll').'</a></span>'; |
|
| 1781 | 1781 | } else { |
| 1782 | - $friendHtml.= ' <span>' |
|
| 1782 | + $friendHtml .= ' <span>' |
|
| 1783 | 1783 | .'<a href="'.api_get_path(WEB_CODE_PATH).'social/profile_friends_and_groups.inc.php' |
| 1784 | 1784 | .'?view=friends&height=390&width=610&user_id='.$user_id.'"' |
| 1785 | 1785 | .'class="ajax" data-title="'.get_lang('SeeAll').'" title="'.get_lang('SeeAll').'" >'.get_lang('SeeAll').'</a></span>'; |
| 1786 | 1786 | } |
| 1787 | 1787 | } |
| 1788 | 1788 | |
| 1789 | - $friendHtml.= '<ul class="nav nav-list">'; |
|
| 1789 | + $friendHtml .= '<ul class="nav nav-list">'; |
|
| 1790 | 1790 | $j = 1; |
| 1791 | - for ($k=0; $k < $number_friends; $k++) { |
|
| 1791 | + for ($k = 0; $k < $number_friends; $k++) { |
|
| 1792 | 1792 | if ($j > $number_of_images) break; |
| 1793 | 1793 | |
| 1794 | 1794 | if (isset($friends[$k])) { |
@@ -1802,26 +1802,26 @@ discard block |
||
| 1802 | 1802 | $statusIcon = Display::span('', array('class' => 'offline_user_in_text')); |
| 1803 | 1803 | } |
| 1804 | 1804 | |
| 1805 | - $friendHtml.= '<li>'; |
|
| 1806 | - $friendHtml.= '<div>'; |
|
| 1805 | + $friendHtml .= '<li>'; |
|
| 1806 | + $friendHtml .= '<div>'; |
|
| 1807 | 1807 | |
| 1808 | 1808 | // the height = 92 must be the same in the image_friend_network span style in default.css |
| 1809 | 1809 | $friends_profile = UserManager::getUserPicture($friend['friend_user_id'], USER_IMAGE_SIZE_SMALL); |
| 1810 | - $friendHtml.= '<img src="'.$friends_profile.'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'"/>'; |
|
| 1810 | + $friendHtml .= '<img src="'.$friends_profile.'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'"/>'; |
|
| 1811 | 1811 | $link_shared = (empty($link_shared)) ? '' : '&'.$link_shared; |
| 1812 | - $friendHtml.= $statusIcon .'<a href="profile.php?' .'u=' . $friend['friend_user_id'] . $link_shared . '">' . $name_user .'</a>'; |
|
| 1813 | - $friendHtml.= '</div>'; |
|
| 1814 | - $friendHtml.= '</li>'; |
|
| 1812 | + $friendHtml .= $statusIcon.'<a href="profile.php?'.'u='.$friend['friend_user_id'].$link_shared.'">'.$name_user.'</a>'; |
|
| 1813 | + $friendHtml .= '</div>'; |
|
| 1814 | + $friendHtml .= '</li>'; |
|
| 1815 | 1815 | } |
| 1816 | 1816 | $j++; |
| 1817 | 1817 | } |
| 1818 | - $friendHtml.='</ul>'; |
|
| 1818 | + $friendHtml .= '</ul>'; |
|
| 1819 | 1819 | } else { |
| 1820 | - $friendHtml.= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />' |
|
| 1821 | - .'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '. get_lang('TryAndFindSomeFriends').'</a></div>'; |
|
| 1820 | + $friendHtml .= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />' |
|
| 1821 | + .'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>'; |
|
| 1822 | 1822 | } |
| 1823 | 1823 | |
| 1824 | - $friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' (' . $number_friends . ')' ); |
|
| 1824 | + $friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' ('.$number_friends.')'); |
|
| 1825 | 1825 | |
| 1826 | 1826 | return $friendHtml; |
| 1827 | 1827 | } |
@@ -1842,9 +1842,9 @@ discard block |
||
| 1842 | 1842 | |
| 1843 | 1843 | if ($number_friends != 0) { |
| 1844 | 1844 | |
| 1845 | - $friendHtml.= '<div class="list-group">'; |
|
| 1845 | + $friendHtml .= '<div class="list-group">'; |
|
| 1846 | 1846 | $j = 1; |
| 1847 | - for ($k=0; $k < $number_friends; $k++) { |
|
| 1847 | + for ($k = 0; $k < $number_friends; $k++) { |
|
| 1848 | 1848 | if ($j > $number_of_images) { |
| 1849 | 1849 | break; |
| 1850 | 1850 | } |
@@ -1854,11 +1854,11 @@ discard block |
||
| 1854 | 1854 | $user_info_friend = api_get_user_info($friend['friend_user_id'], true); |
| 1855 | 1855 | |
| 1856 | 1856 | if ($user_info_friend['user_is_online']) { |
| 1857 | - $statusIcon = Display::return_icon('statusonline.png',get_lang('Online')); |
|
| 1858 | - $status=1; |
|
| 1857 | + $statusIcon = Display::return_icon('statusonline.png', get_lang('Online')); |
|
| 1858 | + $status = 1; |
|
| 1859 | 1859 | } else { |
| 1860 | - $statusIcon = Display::return_icon('statusoffline.png',get_lang('Offline')); |
|
| 1861 | - $status=0; |
|
| 1860 | + $statusIcon = Display::return_icon('statusoffline.png', get_lang('Offline')); |
|
| 1861 | + $status = 0; |
|
| 1862 | 1862 | } |
| 1863 | 1863 | |
| 1864 | 1864 | $friendAvatarMedium = UserManager::getUserPicture($friend['friend_user_id'], USER_IMAGE_SIZE_MEDIUM); |
@@ -1867,24 +1867,24 @@ discard block |
||
| 1867 | 1867 | $showLinkToChat = api_is_global_chat_enabled() && |
| 1868 | 1868 | $friend['friend_user_id'] != api_get_user_id(); |
| 1869 | 1869 | |
| 1870 | - if ($showLinkToChat){ |
|
| 1870 | + if ($showLinkToChat) { |
|
| 1871 | 1871 | $friendHtml .= '<a onclick="javascript:chatWith(\''.$friend['friend_user_id'].'\', \''.$name_user.'\', \''.$status.'\',\''.$friendAvatarSmall.'\')" href="javascript:void(0);" class="list-group-item">'; |
| 1872 | - $friendHtml .= $friend_avatar.' <span class="username">' . $name_user . '</span>'; |
|
| 1873 | - $friendHtml .= '<span class="status">' . $statusIcon . '</span>'; |
|
| 1872 | + $friendHtml .= $friend_avatar.' <span class="username">'.$name_user.'</span>'; |
|
| 1873 | + $friendHtml .= '<span class="status">'.$statusIcon.'</span>'; |
|
| 1874 | 1874 | } else { |
| 1875 | 1875 | $link_shared = empty($link_shared) ? '' : '&'.$link_shared; |
| 1876 | - $friendHtml .= '<a href="profile.php?' .'u=' . $friend['friend_user_id'] . $link_shared . '" class="list-group-item">'; |
|
| 1877 | - $friendHtml .= $friend_avatar.' <span class="username-all">' . $name_user . '</span>'; |
|
| 1876 | + $friendHtml .= '<a href="profile.php?'.'u='.$friend['friend_user_id'].$link_shared.'" class="list-group-item">'; |
|
| 1877 | + $friendHtml .= $friend_avatar.' <span class="username-all">'.$name_user.'</span>'; |
|
| 1878 | 1878 | } |
| 1879 | 1879 | |
| 1880 | 1880 | $friendHtml .= '</a>'; |
| 1881 | 1881 | } |
| 1882 | 1882 | $j++; |
| 1883 | 1883 | } |
| 1884 | - $friendHtml.='</div>'; |
|
| 1884 | + $friendHtml .= '</div>'; |
|
| 1885 | 1885 | } else { |
| 1886 | - $friendHtml.= '<div class="help">'.get_lang('NoFriendsInYourContactList').' ' |
|
| 1887 | - .'<a href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '. get_lang('TryAndFindSomeFriends').'</a></div>'; |
|
| 1886 | + $friendHtml .= '<div class="help">'.get_lang('NoFriendsInYourContactList').' ' |
|
| 1887 | + .'<a href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>'; |
|
| 1888 | 1888 | } |
| 1889 | 1889 | |
| 1890 | 1890 | return $friendHtml; |
@@ -1902,7 +1902,7 @@ discard block |
||
| 1902 | 1902 | 'post', |
| 1903 | 1903 | api_get_path(WEB_CODE_PATH).'social/profile.php'.$userId, |
| 1904 | 1904 | null, |
| 1905 | - array('enctype' => 'multipart/form-data') , |
|
| 1905 | + array('enctype' => 'multipart/form-data'), |
|
| 1906 | 1906 | FormValidator::LAYOUT_HORIZONTAL |
| 1907 | 1907 | ); |
| 1908 | 1908 | |
@@ -443,6 +443,7 @@ |
||
| 443 | 443 | * @param bool hide navigation optionally |
| 444 | 444 | * @param int content per page when show navigation (optional) |
| 445 | 445 | * @param bool sort data optionally |
| 446 | + * @param boolean $visibility_options |
|
| 446 | 447 | * @return string grid html |
| 447 | 448 | */ |
| 448 | 449 | public function display_simple_grid($visibility_options, $hide_navigation = true, $per_page = 20, $sort_data = true, $grid_class = array()) |
@@ -339,9 +339,9 @@ discard block |
||
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | /** |
| 342 | - * This function shows the content of a table in a grid. |
|
| 343 | - * Should not be use to edit information (edit/delete rows) only. |
|
| 344 | - **/ |
|
| 342 | + * This function shows the content of a table in a grid. |
|
| 343 | + * Should not be use to edit information (edit/delete rows) only. |
|
| 344 | + **/ |
|
| 345 | 345 | public function display_grid() |
| 346 | 346 | { |
| 347 | 347 | |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | //$param[$tablename.'_direction'] = $_GET[$tablename.'_direction']; |
| 791 | 791 | $my_get_direction = $_GET[$tablename.'_direction']; |
| 792 | 792 | if (!in_array($my_get_direction, array('ASC', 'DESC'))) { |
| 793 | - $param[$tablename.'_direction'] = 'ASC'; |
|
| 793 | + $param[$tablename.'_direction'] = 'ASC'; |
|
| 794 | 794 | } else { |
| 795 | 795 | $param[$tablename.'_direction'] = $my_get_direction; |
| 796 | 796 | } |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | if (is_array($row)) { |
| 918 | 918 | foreach ($row as & $value) { |
| 919 | 919 | if (empty($value)) { |
| 920 | - $value = '-'; |
|
| 920 | + $value = '-'; |
|
| 921 | 921 | } |
| 922 | 922 | } |
| 923 | 923 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $params['spacesBeforeSeparator'] = ''; |
| 216 | 216 | $params['spacesAfterSeparator'] = ''; |
| 217 | 217 | $query_vars = array_keys($_GET); |
| 218 | - $query_vars_needed = array ($this->param_prefix.'column', $this->param_prefix.'direction', $this->param_prefix.'per_page'); |
|
| 218 | + $query_vars_needed = array($this->param_prefix.'column', $this->param_prefix.'direction', $this->param_prefix.'per_page'); |
|
| 219 | 219 | if (count($this->additional_parameters) > 0) { |
| 220 | 220 | $query_vars_needed = array_merge($query_vars_needed, array_keys($this->additional_parameters)); |
| 221 | 221 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | if (!$empty_table) { |
| 287 | 287 | if (!empty($this->additional_parameters)) { |
| 288 | - foreach($this->additional_parameters as $key => $value) { |
|
| 288 | + foreach ($this->additional_parameters as $key => $value) { |
|
| 289 | 289 | $html .= '<input type="hidden" name ="'.Security::remove_XSS($key).'" value ="'.Security::remove_XSS($value).'" />'; |
| 290 | 290 | } |
| 291 | 291 | } |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | $html .= '<li><a data-action ="'.$action.'" href="#" onclick="javascript:action_click(this, \''.$table_id.'\');">'.$label.'</a></li>'; |
| 311 | 311 | } |
| 312 | 312 | $html .= '</ul>'; |
| 313 | - $html .= '</div>';//btn-group |
|
| 313 | + $html .= '</div>'; //btn-group |
|
| 314 | 314 | $html .= '</div>'; //toolbar |
| 315 | 315 | } else { |
| 316 | 316 | $html .= $form; |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - return '<div class="table-responsive">' . $html . '</div>'; |
|
| 337 | + return '<div class="table-responsive">'.$html.'</div>'; |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | /** |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | $html .= '<div class="clear"></div>'; |
| 390 | 390 | if (count($this->form_actions) > 0) { |
| 391 | - $script= '<script> |
|
| 391 | + $script = '<script> |
|
| 392 | 392 | /*<![CDATA[*/ |
| 393 | 393 | function setCheckbox(value) { |
| 394 | 394 | d = document.form_'.$this->table_name.'; |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | 412 | // Getting the items of the table |
| 413 | - $items = $this->get_clean_html(false); //no sort |
|
| 413 | + $items = $this->get_clean_html(false); //no sort |
|
| 414 | 414 | |
| 415 | 415 | // Generation of style classes must be improved. Maybe we need a a table name to create style on the fly: |
| 416 | 416 | // i.e: .whoisonline_table_grid_container instead of .grid_container |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | |
| 479 | 479 | $html .= '<div class="clear"></div>'; |
| 480 | 480 | if (count($this->form_actions) > 0) { |
| 481 | - $script= '<script> |
|
| 481 | + $script = '<script> |
|
| 482 | 482 | /*<![CDATA[*/ |
| 483 | 483 | function setCheckbox(value) { |
| 484 | 484 | d = document.form_'.$this->table_name.'; |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | $counter = 0; |
| 587 | 587 | foreach ($row as $index => $rowInfo) { |
| 588 | 588 | if (!isset($this->columnsToHide[$index])) { |
| 589 | - $newRow[$counter] = $rowInfo ; |
|
| 589 | + $newRow[$counter] = $rowInfo; |
|
| 590 | 590 | $counter++; |
| 591 | 591 | } |
| 592 | 592 | } |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | if ($this->odd_even_rows_enabled == true) { |
| 604 | - $this->altRowAttributes(0, array ('class' => 'row_odd'), array ('class' => 'row_even'), true); |
|
| 604 | + $this->altRowAttributes(0, array('class' => 'row_odd'), array('class' => 'row_even'), true); |
|
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | foreach ($this->th_attributes as $column => $attributes) { |
@@ -663,11 +663,11 @@ discard block |
||
| 663 | 663 | } |
| 664 | 664 | $result[] = '<select name="'.$this->param_prefix.'per_page" onchange="javascript: this.form.submit();">'; |
| 665 | 665 | for ($nr = 10; $nr <= min(50, $total_number_of_items); $nr += 10) { |
| 666 | - $result[] = '<option value="'.$nr.'" '. ($nr == $this->per_page ? 'selected="selected"' : '').'>'.$nr.'</option>'; |
|
| 666 | + $result[] = '<option value="'.$nr.'" '.($nr == $this->per_page ? 'selected="selected"' : '').'>'.$nr.'</option>'; |
|
| 667 | 667 | } |
| 668 | 668 | // @todo no limits |
| 669 | 669 | //if ($total_number_of_items < 500) { |
| 670 | - $result[] = '<option value="'.$total_number_of_items.'" '. ($total_number_of_items == $this->per_page ? 'selected="selected"' : '').'>'.api_ucfirst(get_lang('All')).'</option>'; |
|
| 670 | + $result[] = '<option value="'.$total_number_of_items.'" '.($total_number_of_items == $this->per_page ? 'selected="selected"' : '').'>'.api_ucfirst(get_lang('All')).'</option>'; |
|
| 671 | 671 | //} |
| 672 | 672 | $result[] = '</select>'; |
| 673 | 673 | $result[] = '<noscript>'; |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | */ |
| 786 | 786 | public function get_additional_url_paramstring() |
| 787 | 787 | { |
| 788 | - $param_string_parts = array (); |
|
| 788 | + $param_string_parts = array(); |
|
| 789 | 789 | if (is_array($this->additional_parameters) && count($this->additional_parameters) > 0) { |
| 790 | 790 | foreach ($this->additional_parameters as $key => & $value) { |
| 791 | 791 | $param_string_parts[] = urlencode($key).'='.urlencode($value); |
@@ -798,7 +798,7 @@ discard block |
||
| 798 | 798 | //$param[$tablename.'_direction'] = $_GET[$tablename.'_direction']; |
| 799 | 799 | $my_get_direction = $_GET[$tablename.'_direction']; |
| 800 | 800 | if (!in_array($my_get_direction, array('ASC', 'DESC'))) { |
| 801 | - $param[$tablename.'_direction'] = 'ASC'; |
|
| 801 | + $param[$tablename.'_direction'] = 'ASC'; |
|
| 802 | 802 | } else { |
| 803 | 803 | $param[$tablename.'_direction'] = $my_get_direction; |
| 804 | 804 | } |
@@ -812,7 +812,7 @@ discard block |
||
| 812 | 812 | if (isset($_GET[$tablename.'_column'])) { |
| 813 | 813 | $param[$tablename.'_column'] = intval($_GET[$tablename.'_column']); |
| 814 | 814 | } |
| 815 | - $param_string_parts = array (); |
|
| 815 | + $param_string_parts = array(); |
|
| 816 | 816 | foreach ($param as $key => & $value) { |
| 817 | 817 | $param_string_parts[] = urlencode($key).'='.urlencode($value); |
| 818 | 818 | } |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | $param[$this->param_prefix.'page_nr'] = $this->page_nr; |
| 834 | 834 | $param[$this->param_prefix.'per_page'] = $this->per_page; |
| 835 | 835 | $param[$this->param_prefix.'column'] = $this->column; |
| 836 | - $param_string_parts = array (); |
|
| 836 | + $param_string_parts = array(); |
|
| 837 | 837 | foreach ($param as $key => & $value) { |
| 838 | 838 | $param_string_parts[] = urlencode($key).'='.urlencode($value); |
| 839 | 839 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | 102 | * @param array $conditions a list of condition (exemple : status=>STUDENT) |
| 103 | - * @param array $order_by a list of fields on which sort |
|
| 103 | + * @param string[] $order_by a list of fields on which sort |
|
| 104 | 104 | * @return array An array with all users of the platform. |
| 105 | 105 | */ |
| 106 | 106 | function get_specific_field_values_list( |
@@ -235,6 +235,7 @@ discard block |
||
| 235 | 235 | * @param string Course code |
| 236 | 236 | * @param string Tool ID |
| 237 | 237 | * @param int Internal ID used in specific tool table |
| 238 | + * @param string $tool_id |
|
| 238 | 239 | */ |
| 239 | 240 | function delete_all_values_for_item($course_id, $tool_id, $ref_id) { |
| 240 | 241 | $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); |
@@ -248,6 +249,7 @@ discard block |
||
| 248 | 249 | * Defaults to the first letter of the name, otherwise iterate through available |
| 249 | 250 | * letters |
| 250 | 251 | * @param string Name |
| 252 | + * @param string $name |
|
| 251 | 253 | * @return string One-letter code, upper-case |
| 252 | 254 | */ |
| 253 | 255 | function get_specific_field_code_from_name($name) { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | function delete_specific_field($id) |
| 43 | 43 | { |
| 44 | 44 | $table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD); |
| 45 | - $id = (int)$id; |
|
| 45 | + $id = (int) $id; |
|
| 46 | 46 | if (!is_numeric($id)) { |
| 47 | 47 | return false; |
| 48 | 48 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | function edit_specific_field($id, $name) |
| 61 | 61 | { |
| 62 | 62 | $table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD); |
| 63 | - $id = (int)$id; |
|
| 63 | + $id = (int) $id; |
|
| 64 | 64 | if (!is_numeric($id)) { |
| 65 | 65 | return false; |
| 66 | 66 | } |
@@ -237,10 +237,10 @@ |
||
| 237 | 237 | * @param int Internal ID used in specific tool table |
| 238 | 238 | */ |
| 239 | 239 | function delete_all_values_for_item($course_id, $tool_id, $ref_id) { |
| 240 | - $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); |
|
| 241 | - $sql = 'DELETE FROM %s WHERE course_code = \'%s\' AND tool_id = \'%s\' AND ref_id = %s'; |
|
| 242 | - $sql = sprintf($sql, $table_sf_values, $course_id, $tool_id, $ref_id); |
|
| 243 | - Database::query($sql); |
|
| 240 | + $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); |
|
| 241 | + $sql = 'DELETE FROM %s WHERE course_code = \'%s\' AND tool_id = \'%s\' AND ref_id = %s'; |
|
| 242 | + $sql = sprintf($sql, $table_sf_values, $course_id, $tool_id, $ref_id); |
|
| 243 | + Database::query($sql); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -85,6 +85,7 @@ |
||
| 85 | 85 | /** |
| 86 | 86 | * @author Sebastien Piraux <[email protected]> |
| 87 | 87 | * @param sql : a sql query (as a string) |
| 88 | + * @param integer $X |
|
| 88 | 89 | * @desc Return many results of a query in a X column tab |
| 89 | 90 | * in $resu[$i][0], $resu[$i][1],$resu[$i][2],... |
| 90 | 91 | * this function is more 'standard' but use a little |
@@ -107,14 +107,14 @@ |
||
| 107 | 107 | return $resu; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - /** |
|
| 111 | - * @author Sebastien Piraux <[email protected]> |
|
| 112 | - * @param sql : a sql query (as a string) |
|
| 113 | - * @return hours_array |
|
| 114 | - * @desc Return an assoc array. Keys are the hours, values are |
|
| 115 | - * the number of time this hours was found. |
|
| 116 | - * key 'total' return the sum of all number of time hours |
|
| 117 | - * appear |
|
| 110 | + /** |
|
| 111 | + * @author Sebastien Piraux <[email protected]> |
|
| 112 | + * @param sql : a sql query (as a string) |
|
| 113 | + * @return hours_array |
|
| 114 | + * @desc Return an assoc array. Keys are the hours, values are |
|
| 115 | + * the number of time this hours was found. |
|
| 116 | + * key 'total' return the sum of all number of time hours |
|
| 117 | + * appear |
|
| 118 | 118 | */ |
| 119 | 119 | public static function hoursTab($sql) |
| 120 | 120 | { |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $last_day = -1; |
| 156 | 156 | while ($row = Database::fetch_row($res)) { |
| 157 | 157 | $date_array = getdate($row[0]); |
| 158 | - $display_date = $date_array['mday'] . ' ' . $MonthsShort[$date_array['mon'] - 1] . ' ' . $date_array['year']; |
|
| 158 | + $display_date = $date_array['mday'].' '.$MonthsShort[$date_array['mon'] - 1].' '.$date_array['year']; |
|
| 159 | 159 | if ($date_array['mday'] == $last_day) { |
| 160 | 160 | $days_array[$display_date]++; |
| 161 | 161 | } else { |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | </td> |
| 223 | 223 | <td width='10%'> |
| 224 | - <b>" . get_lang('Hits') . "</b> |
|
| 224 | + <b>".get_lang('Hits')."</b> |
|
| 225 | 225 | </td> |
| 226 | 226 | <td width='15%'> |
| 227 | 227 | <b>%</b> |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | echo "<img src='".Display::returnIconPath('bar_1m.gif')."' width='1' height='12' alt='$periodPiece : $cpt hits – $pourcent %' />"; |
| 250 | 250 | } |
| 251 | 251 | if ($pourcent != 100) { |
| 252 | - echo "<img src='".Display::returnIconPath('bar_1r.gif')."' width='" . ($maxSize - $barwidth) . "' height='12' alt='$periodPiece : $cpt hits – $pourcent %' />"; |
|
| 252 | + echo "<img src='".Display::returnIconPath('bar_1r.gif')."' width='".($maxSize - $barwidth)."' height='12' alt='$periodPiece : $cpt hits – $pourcent %' />"; |
|
| 253 | 253 | } |
| 254 | 254 | echo "<img src='".Display::returnIconPath('bar_1.gif')."' width='1' height='12' alt='$periodPiece : $cpt hits – $pourcent %' /> |
| 255 | 255 | </td> |
@@ -265,13 +265,13 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | echo "<tr bgcolor='#E6E6E6'> |
| 267 | 267 | <td width='15%' align='center'> |
| 268 | - " . get_lang('Total') . " |
|
| 268 | + " . get_lang('Total')." |
|
| 269 | 269 | </td> |
| 270 | 270 | <td align='right' width='60%'> |
| 271 | 271 | |
| 272 | 272 | </td> |
| 273 | 273 | <td align='center' width='10%'> |
| 274 | - " . $period_array['total'] . " |
|
| 274 | + " . $period_array['total']." |
|
| 275 | 275 | </td> |
| 276 | 276 | <td width='15%'> |
| 277 | 277 | |
@@ -18,6 +18,7 @@ discard block |
||
| 18 | 18 | * Get all files of lang folder (forum.inc.php,gradebook.inc.php,notebook.inc.php) |
| 19 | 19 | * @param String The lang path folder (/var/www/my_lms/main/lang/spanish) |
| 20 | 20 | * @param bool true if we only want the "subname" trad4all instead of trad4all.inc.php |
| 21 | + * @param string $path |
|
| 21 | 22 | * |
| 22 | 23 | * @return Array All file of lang folder |
| 23 | 24 | */ |
@@ -68,6 +69,7 @@ discard block |
||
| 68 | 69 | /** |
| 69 | 70 | * Get all information of language |
| 70 | 71 | * @param Integer The parent id(Language father id) |
| 72 | + * @param integer $parent_id |
|
| 71 | 73 | * @return Array All information about language |
| 72 | 74 | */ |
| 73 | 75 | public static function get_all_information_of_language($parent_id) |
@@ -86,6 +88,7 @@ discard block |
||
| 86 | 88 | /** |
| 87 | 89 | * Get all information of chamilo file |
| 88 | 90 | * @param String The chamilo path file (/var/www/chamilo/main/lang/spanish/gradebook.inc.php) |
| 91 | + * @param string $system_path_file |
|
| 89 | 92 | * @patam Bool Whether we want to remove the '$' prefix in the results or not |
| 90 | 93 | * @return Array Contains all information of chamilo file |
| 91 | 94 | */ |
@@ -345,7 +348,7 @@ discard block |
||
| 345 | 348 | /** |
| 346 | 349 | * Make available the language |
| 347 | 350 | * @param Integer The language id |
| 348 | - * @return void |
|
| 351 | + * @return boolean |
|
| 349 | 352 | */ |
| 350 | 353 | public static function make_available_language($language_id) |
| 351 | 354 | { |
@@ -29,8 +29,9 @@ |
||
| 29 | 29 | while (($file = readdir($dh)) !== false) { |
| 30 | 30 | if ($file[0] <> '.' && substr($file, -4, strlen($file)) == '.php') { |
| 31 | 31 | if ($only_main_name) { |
| 32 | - if ($file != '' && strpos($file, '.inc.php')) |
|
| 33 | - $content_dir[] = substr($file, 0, strpos($file, '.inc.php')); |
|
| 32 | + if ($file != '' && strpos($file, '.inc.php')) { |
|
| 33 | + $content_dir[] = substr($file, 0, strpos($file, '.inc.php')); |
|
| 34 | + } |
|
| 34 | 35 | } else { |
| 35 | 36 | $content_dir[] = $file; |
| 36 | 37 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | public static function getAllLanguages() |
| 22 | 22 | { |
| 23 | 23 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 24 | - $sql = 'SELECT * FROM ' . $table; |
|
| 24 | + $sql = 'SELECT * FROM '.$table; |
|
| 25 | 25 | $rs = Database::query($sql); |
| 26 | 26 | $all_languages = []; |
| 27 | 27 | while ($row = Database::fetch_array($rs, 'ASSOC')) { |
@@ -70,10 +70,10 @@ discard block |
||
| 70 | 70 | public static function get_all_information_of_sub_language($parent_id, $sub_language_id) |
| 71 | 71 | { |
| 72 | 72 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 73 | - $sql = 'SELECT * FROM ' . $table . ' |
|
| 73 | + $sql = 'SELECT * FROM '.$table.' |
|
| 74 | 74 | WHERE |
| 75 | 75 | parent_id= ' . intval($parent_id).' AND |
| 76 | - id= ' . intval($sub_language_id) . ''; |
|
| 76 | + id= ' . intval($sub_language_id).''; |
|
| 77 | 77 | $rs = Database::query($sql); |
| 78 | 78 | $all_information = array(); |
| 79 | 79 | while ($row = Database::fetch_array($rs, 'ASSOC')) { |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | public static function get_all_information_of_language($parent_id) |
| 92 | 92 | { |
| 93 | 93 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 94 | - $sql = 'SELECT * FROM ' . $table . ' WHERE id = "' . intval($parent_id) . '"'; |
|
| 94 | + $sql = 'SELECT * FROM '.$table.' WHERE id = "'.intval($parent_id).'"'; |
|
| 95 | 95 | $rs = Database::query($sql); |
| 96 | 96 | $all_information = array(); |
| 97 | 97 | while ($row = Database::fetch_array($rs, 'ASSOC')) { |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public static function add_file_in_language_directory($system_path_file) |
| 139 | 139 | { |
| 140 | - $return_value = @file_put_contents($system_path_file, '<?php' . PHP_EOL); |
|
| 140 | + $return_value = @file_put_contents($system_path_file, '<?php'.PHP_EOL); |
|
| 141 | 141 | |
| 142 | 142 | return $return_value; |
| 143 | 143 | } |
@@ -152,10 +152,10 @@ discard block |
||
| 152 | 152 | public static function write_data_in_file($path_file, $new_term, $new_variable) |
| 153 | 153 | { |
| 154 | 154 | $return_value = false; |
| 155 | - $new_data = $new_variable . '=' . $new_term; |
|
| 155 | + $new_data = $new_variable.'='.$new_term; |
|
| 156 | 156 | $resource = @fopen($path_file, "a"); |
| 157 | 157 | if (file_exists($path_file) && $resource) { |
| 158 | - if (fwrite($resource, $new_data . PHP_EOL) === false) { |
|
| 158 | + if (fwrite($resource, $new_data.PHP_EOL) === false) { |
|
| 159 | 159 | //not allow to write |
| 160 | 160 | $return_value = false; |
| 161 | 161 | } else { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | if (empty($sub_language_dir)) { |
| 178 | 178 | return false; |
| 179 | 179 | } |
| 180 | - $dir = api_get_path(SYS_LANG_PATH) . $sub_language_dir; |
|
| 180 | + $dir = api_get_path(SYS_LANG_PATH).$sub_language_dir; |
|
| 181 | 181 | if (is_dir($dir)) { |
| 182 | 182 | return true; |
| 183 | 183 | } //even if the dir already exists, we reach the objective of having the directory there |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | return false; |
| 202 | 202 | } |
| 203 | 203 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 204 | - $sql = 'SELECT dokeos_folder FROM ' . $table . ' |
|
| 205 | - WHERE parent_id = ' . $parent_id . ' and id = ' . $sub_language_id; |
|
| 204 | + $sql = 'SELECT dokeos_folder FROM '.$table.' |
|
| 205 | + WHERE parent_id = ' . $parent_id.' and id = '.$sub_language_id; |
|
| 206 | 206 | $res = Database::query($sql); |
| 207 | 207 | if ($res === false or Database::num_rows($res) < 1) { |
| 208 | 208 | return false; |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | if ($res === false) { |
| 213 | 213 | return false; |
| 214 | 214 | } //can't delete dir, so do not delete language record |
| 215 | - $sql = 'DELETE FROM ' . $table . ' |
|
| 215 | + $sql = 'DELETE FROM '.$table.' |
|
| 216 | 216 | WHERE id= ' . intval($sub_language_id); |
| 217 | 217 | $res = Database::query($sql); |
| 218 | 218 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | if (empty($sub_language_dir)) { |
| 230 | 230 | return false; |
| 231 | 231 | } |
| 232 | - $dir = api_get_path(SYS_LANG_PATH) . $sub_language_dir; |
|
| 232 | + $dir = api_get_path(SYS_LANG_PATH).$sub_language_dir; |
|
| 233 | 233 | if (!is_dir($dir)) { |
| 234 | 234 | return true; |
| 235 | 235 | } //even if the dir does not exist, we reach the objective of not having the directory there |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | if (count($content) > 0) { |
| 239 | 239 | foreach ($content as $value_content) { |
| 240 | - $path_file = $dir . '/' . $value_content; |
|
| 240 | + $path_file = $dir.'/'.$value_content; |
|
| 241 | 241 | unlink($path_file); |
| 242 | 242 | } |
| 243 | 243 | return @rmdir($dir); |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | { |
| 256 | 256 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 257 | 257 | $sql = 'SELECT count(*) as count |
| 258 | - FROM ' . $table . ' |
|
| 259 | - WHERE id="' . intval($language_id) . '"'; |
|
| 258 | + FROM ' . $table.' |
|
| 259 | + WHERE id="' . intval($language_id).'"'; |
|
| 260 | 260 | $rs = Database::query($sql); |
| 261 | 261 | if (Database::num_rows($rs) > 0) { |
| 262 | 262 | if (Database::result($rs, 0, 'count') == 1) { |
@@ -278,8 +278,8 @@ discard block |
||
| 278 | 278 | { |
| 279 | 279 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 280 | 280 | $sql = 'SELECT original_name |
| 281 | - FROM ' . $table . ' |
|
| 282 | - WHERE id= ' . intval($language_id) . ''; |
|
| 281 | + FROM ' . $table.' |
|
| 282 | + WHERE id= ' . intval($language_id).''; |
|
| 283 | 283 | $rs = Database::query($sql); |
| 284 | 284 | if (Database::num_rows($rs) > 0) { |
| 285 | 285 | return Database::result($rs, 0, 'original_name'); |
@@ -297,8 +297,8 @@ discard block |
||
| 297 | 297 | public static function check_if_language_is_sub_language($language_id) |
| 298 | 298 | { |
| 299 | 299 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 300 | - $sql = 'SELECT count(*) AS count FROM ' . $table . ' |
|
| 301 | - WHERE id = ' . intval($language_id) . ' AND NOT ISNULL(parent_id)'; |
|
| 300 | + $sql = 'SELECT count(*) AS count FROM '.$table.' |
|
| 301 | + WHERE id = ' . intval($language_id).' AND NOT ISNULL(parent_id)'; |
|
| 302 | 302 | $rs = Database::query($sql); |
| 303 | 303 | |
| 304 | 304 | if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') == 1) { |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | { |
| 317 | 317 | $language_info = self::get_all_information_of_language($language_id); |
| 318 | 318 | $table = Database :: get_main_table(TABLE_MAIN_USER); |
| 319 | - $sql = 'SELECT count(*) AS count FROM ' . $table . ' |
|
| 319 | + $sql = 'SELECT count(*) AS count FROM '.$table.' |
|
| 320 | 320 | WHERE language ="' . Database::escape_string($language_info['english_name']).'"'; |
| 321 | 321 | $rs = Database::query($sql); |
| 322 | 322 | if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') >= 1) { |
@@ -334,8 +334,8 @@ discard block |
||
| 334 | 334 | public static function check_if_language_is_father($language_id) |
| 335 | 335 | { |
| 336 | 336 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 337 | - $sql = 'SELECT count(*) AS count FROM ' . $table . ' |
|
| 338 | - WHERE parent_id= ' . intval($language_id) . ' AND NOT ISNULL(parent_id);'; |
|
| 337 | + $sql = 'SELECT count(*) AS count FROM '.$table.' |
|
| 338 | + WHERE parent_id= ' . intval($language_id).' AND NOT ISNULL(parent_id);'; |
|
| 339 | 339 | $rs = Database::query($sql); |
| 340 | 340 | |
| 341 | 341 | if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') == 1) { |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | { |
| 355 | 355 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 356 | 356 | $sql = "UPDATE $tbl_admin_languages SET available='0' |
| 357 | - WHERE id = " . intval($language_id) . ""; |
|
| 357 | + WHERE id = ".intval($language_id).""; |
|
| 358 | 358 | $result = Database::query($sql); |
| 359 | 359 | |
| 360 | 360 | return $result !== false; //only return false on sql error |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | { |
| 370 | 370 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 371 | 371 | $sql = "UPDATE $tbl_admin_languages SET available='1' |
| 372 | - WHERE id = " . intval($language_id) . ""; |
|
| 372 | + WHERE id = ".intval($language_id).""; |
|
| 373 | 373 | $result = Database::query($sql); |
| 374 | 374 | |
| 375 | 375 | return $result !== false; //only return false on sql error |
@@ -387,11 +387,11 @@ discard block |
||
| 387 | 387 | } |
| 388 | 388 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 389 | 389 | $tbl_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
| 390 | - $sql = "SELECT english_name FROM " . $tbl_admin_languages . " |
|
| 391 | - WHERE id= " . intval($language_id) . ""; |
|
| 390 | + $sql = "SELECT english_name FROM ".$tbl_admin_languages." |
|
| 391 | + WHERE id= " . intval($language_id).""; |
|
| 392 | 392 | $result = Database::query($sql); |
| 393 | 393 | $lang = Database::fetch_array($result); |
| 394 | - $sql_update_2 = "UPDATE " . $tbl_settings_current . " SET selected_value='" . $lang['english_name'] . "' |
|
| 394 | + $sql_update_2 = "UPDATE ".$tbl_settings_current." SET selected_value='".$lang['english_name']."' |
|
| 395 | 395 | WHERE variable='platformLanguage'"; |
| 396 | 396 | $result_2 = Database::query($sql_update_2); |
| 397 | 397 | Event::addEvent( |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | { |
| 412 | 412 | $name = api_get_setting('platformLanguage'); |
| 413 | 413 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 414 | - $sql = "SELECT id FROM " . $tbl_admin_languages . " WHERE english_name ='$name'"; |
|
| 414 | + $sql = "SELECT id FROM ".$tbl_admin_languages." WHERE english_name ='$name'"; |
|
| 415 | 415 | $res = Database::query($sql); |
| 416 | 416 | if (Database::num_rows($res) < 1) { |
| 417 | 417 | return false; |
@@ -430,10 +430,10 @@ discard block |
||
| 430 | 430 | { |
| 431 | 431 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 432 | 432 | $sql = "SELECT dokeos_folder |
| 433 | - FROM " . $tbl_admin_languages . " |
|
| 433 | + FROM " . $tbl_admin_languages." |
|
| 434 | 434 | WHERE id = ( |
| 435 | - SELECT parent_id FROM " . $tbl_admin_languages . " |
|
| 436 | - WHERE dokeos_folder = '" . Database::escape_string($language_path) . "' |
|
| 435 | + SELECT parent_id FROM " . $tbl_admin_languages." |
|
| 436 | + WHERE dokeos_folder = '" . Database::escape_string($language_path)."' |
|
| 437 | 437 | ) |
| 438 | 438 | "; |
| 439 | 439 | $result = Database::query($sql); |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | $adminLanguagesTable = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 456 | 456 | // select language - if case several languages match, get the last (more recent) one |
| 457 | 457 | $sql = "SELECT english_name |
| 458 | - FROM " . $adminLanguagesTable . " |
|
| 458 | + FROM " . $adminLanguagesTable." |
|
| 459 | 459 | WHERE |
| 460 | 460 | isocode ='$isocode' AND |
| 461 | 461 | available = 1 |