@@ -57,6 +57,7 @@ discard block |
||
57 | 57 | * Add a value to the indexed item |
58 | 58 | * @param string Key |
59 | 59 | * @param string Value |
60 | + * @param string $key |
|
60 | 61 | * @return void |
61 | 62 | */ |
62 | 63 | function addValue($key, $value) { |
@@ -109,6 +110,7 @@ discard block |
||
109 | 110 | |
110 | 111 | /** |
111 | 112 | * Let add tool id term |
113 | + * @param string $tool_id |
|
112 | 114 | */ |
113 | 115 | public function addToolId($tool_id) |
114 | 116 | { |
@@ -59,7 +59,8 @@ discard block |
||
59 | 59 | * @param string Value |
60 | 60 | * @return void |
61 | 61 | */ |
62 | - function addValue($key, $value) { |
|
62 | + function addValue($key, $value) |
|
63 | + { |
|
63 | 64 | $this->data[$key] = $value; |
64 | 65 | } |
65 | 66 | |
@@ -68,7 +69,8 @@ discard block |
||
68 | 69 | * @param string Term |
69 | 70 | * @param string Flag (one character) |
70 | 71 | */ |
71 | - public function addTerm($term, $flag) { |
|
72 | + public function addTerm($term, $flag) |
|
73 | + { |
|
72 | 74 | global $charset; |
73 | 75 | if (strlen($flag) == 1) { |
74 | 76 | $this->terms[] = array('name' => api_convert_encoding(stripslashes($term), 'UTF-8', $charset), 'flag' => $flag); |
@@ -78,14 +80,16 @@ discard block |
||
78 | 80 | /** |
79 | 81 | * Class constructor. Just generates an empty 'data' array attribute |
80 | 82 | */ |
81 | - function __construct() { |
|
83 | + function __construct() |
|
84 | + { |
|
82 | 85 | $this->data = array(); |
83 | 86 | } |
84 | 87 | |
85 | 88 | /** |
86 | 89 | * Class desctructor. Unsets attributes. |
87 | 90 | */ |
88 | - function __destruct() { |
|
91 | + function __destruct() |
|
92 | + { |
|
89 | 93 | unset($this->data); |
90 | 94 | unset($this->terms); |
91 | 95 | } |
@@ -187,6 +187,7 @@ discard block |
||
187 | 187 | * Build the prefilter form. |
188 | 188 | * |
189 | 189 | * This type allow filter all other multiple select terms by one term in a dinamic way |
190 | + * @param string $prefilter_prefix |
|
190 | 191 | */ |
191 | 192 | function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix=NULL) { |
192 | 193 | $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon')); |
@@ -277,6 +278,8 @@ discard block |
||
277 | 278 | |
278 | 279 | /** |
279 | 280 | * Show search form |
281 | + * @param string $action |
|
282 | + * @param boolean $show_thesaurus |
|
280 | 283 | */ |
281 | 284 | function display_search_form($action, $show_thesaurus, $sf_terms, $op) { |
282 | 285 | $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal'); |
@@ -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 | $query = isset($_REQUEST['query']) ? Security::remove_XSS($_REQUEST['query']) : null; |
138 | 138 | |
@@ -199,9 +199,9 @@ discard block |
||
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'; |
|
204 | - } |
|
202 | + if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) { |
|
203 | + $action='index.php'; |
|
204 | + } |
|
205 | 205 | |
206 | 206 | $form = ' |
207 | 207 | <form id="chamilo_search" action="'. $action .'" method="GET"> |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | </table> |
267 | 267 | </div>'; |
268 | 268 | } |
269 | - $form .= ' |
|
269 | + $form .= ' |
|
270 | 270 | </form> |
271 | 271 | <br style="clear: both;"/>'; |
272 | 272 | |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | foreach ($specific_fields as $specific_field) { |
325 | 325 | $temp = array(); |
326 | 326 | if (is_array($dkterms) && count($dkterms)>0) { |
327 | - foreach($dkterms[1] as $obj) { |
|
328 | - $temp = array_merge($obj['sf-'.$specific_field['code']], $temp); |
|
329 | - } |
|
330 | - } |
|
327 | + foreach($dkterms[1] as $obj) { |
|
328 | + $temp = array_merge($obj['sf-'.$specific_field['code']], $temp); |
|
329 | + } |
|
330 | + } |
|
331 | 331 | $sf_terms[$specific_field['code']] = $temp; |
332 | 332 | $url_params[] = 'sf_'.$specific_field['code']; |
333 | 333 | unset($temp); |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | } |
343 | 343 | echo '<h2>'.get_lang('Search').'</h2>'; |
344 | 344 | |
345 | - // Tool introduction |
|
345 | + // Tool introduction |
|
346 | 346 | // TODO: Settings for the online editor to be checked (insert an image for example). Probably this is a special case here. |
347 | 347 | if (api_get_course_id() !== -1) |
348 | 348 | if (!empty($groupId)) { |
@@ -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 |
@@ -186,7 +186,7 @@ |
||
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 | 191 | $advanced_options = '<a id="tags-toggle" href="#">'. get_lang('SearchAdvancedOptions') .'</a>'; |
192 | 192 | $display_thesaurus = ($show_thesaurus==true? 'block': 'none'); |
@@ -18,7 +18,8 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @param array $htmlHeadXtra A reference to the doc $htmlHeadXtra |
20 | 20 | */ |
21 | -function search_widget_prepare(&$htmlHeadXtra) { |
|
21 | +function search_widget_prepare(&$htmlHeadXtra) |
|
22 | +{ |
|
22 | 23 | $htmlHeadXtra[] = ' |
23 | 24 | <script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_JS_PATH).'search/search_widget.js"></script> |
24 | 25 | <link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'jquery.autocomplete.css" /> |
@@ -28,7 +29,8 @@ discard block |
||
28 | 29 | /** |
29 | 30 | * Get one term html select |
30 | 31 | */ |
31 | -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 | +{ |
|
32 | 34 | global $charset; |
33 | 35 | $multiple_select = '<select '. $extra_select_attr .' title="'. $prefix .'" id="sf-'. $prefix .'" name="sf_'. $prefix .'[]">'; |
34 | 36 | |
@@ -47,7 +49,9 @@ discard block |
||
47 | 49 | |
48 | 50 | foreach ($sf_term_array as $raw_term) { |
49 | 51 | $term = substr($raw_term, 1); |
50 | - if (empty($term)) continue; |
|
52 | + if (empty($term)) { |
|
53 | + continue; |
|
54 | + } |
|
51 | 55 | $html_term = htmlspecialchars($term, ENT_QUOTES, $charset); |
52 | 56 | $selected = ''; |
53 | 57 | if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term,$_REQUEST['sf_'.$prefix])) { |
@@ -62,13 +66,16 @@ discard block |
||
62 | 66 | /** |
63 | 67 | * Get terms html selects |
64 | 68 | */ |
65 | -function format_specific_fields_selects($sf_terms, $op, $prefilter_prefix='') { |
|
69 | +function format_specific_fields_selects($sf_terms, $op, $prefilter_prefix='') |
|
70 | +{ |
|
66 | 71 | // Process each prefix type term |
67 | 72 | $i = 0; |
68 | 73 | $max = count($sf_terms); |
69 | 74 | $multiple_selects =''; |
70 | 75 | foreach ($sf_terms as $prefix => $sf_term_array) { |
71 | - if ($prefix == $prefilter_prefix) continue; |
|
76 | + if ($prefix == $prefilter_prefix) { |
|
77 | + continue; |
|
78 | + } |
|
72 | 79 | $multiple_select = ''; |
73 | 80 | if ($i>0) { |
74 | 81 | //print "+" image |
@@ -104,7 +111,8 @@ discard block |
||
104 | 111 | * |
105 | 112 | * First, natural way. |
106 | 113 | */ |
107 | -function search_widget_normal_form($action, $show_thesaurus, $sf_terms, $op) { |
|
114 | +function search_widget_normal_form($action, $show_thesaurus, $sf_terms, $op) |
|
115 | +{ |
|
108 | 116 | $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon')); |
109 | 117 | $advanced_options = '<a id="tags-toggle" href="#">'. get_lang('SearchAdvancedOptions') .'</a>'; |
110 | 118 | $display_thesaurus = ($show_thesaurus==true? 'block': 'none'); |
@@ -185,7 +193,8 @@ discard block |
||
185 | 193 | * |
186 | 194 | * This type allow filter all other multiple select terms by one term in a dinamic way |
187 | 195 | */ |
188 | -function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix=NULL) { |
|
196 | +function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix=NULL) |
|
197 | +{ |
|
189 | 198 | $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon')); |
190 | 199 | $advanced_options = '<a id="tags-toggle" href="#">'. get_lang('SearchAdvancedOptions') .'</a>'; |
191 | 200 | $display_thesaurus = ($show_thesaurus==true? 'block': 'none'); |
@@ -275,7 +284,8 @@ discard block |
||
275 | 284 | /** |
276 | 285 | * Show search form |
277 | 286 | */ |
278 | -function display_search_form($action, $show_thesaurus, $sf_terms, $op) { |
|
287 | +function display_search_form($action, $show_thesaurus, $sf_terms, $op) |
|
288 | +{ |
|
279 | 289 | $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal'); |
280 | 290 | |
281 | 291 | switch ($type) { |
@@ -313,7 +323,8 @@ discard block |
||
313 | 323 | $specific_fields = get_specific_field_list(); |
314 | 324 | $url_params = array(); |
315 | 325 | |
316 | - if (($cid = api_get_course_id()) != -1) { // with cid |
|
326 | + if (($cid = api_get_course_id()) != -1) { |
|
327 | +// with cid |
|
317 | 328 | |
318 | 329 | // get search engine terms |
319 | 330 | $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid); |
@@ -331,7 +342,8 @@ discard block |
||
331 | 342 | $url_params[] = 'sf_'.$specific_field['code']; |
332 | 343 | unset($temp); |
333 | 344 | } |
334 | - } else { // without cid |
|
345 | + } else { |
|
346 | +// without cid |
|
335 | 347 | // prepare specific fields names (and also get possible URL param names) |
336 | 348 | foreach ($specific_fields as $specific_field) { |
337 | 349 | //get Xapian terms for a specific term prefix, in ISO, apparently |
@@ -343,9 +355,10 @@ discard block |
||
343 | 355 | |
344 | 356 | // Tool introduction |
345 | 357 | // TODO: Settings for the online editor to be checked (insert an image for example). Probably this is a special case here. |
346 | - if (api_get_course_id() !== -1) |
|
347 | - if (!empty($groupId)) { |
|
358 | + if (api_get_course_id() !== -1) { |
|
359 | + if (!empty($groupId)) { |
|
348 | 360 | Display::display_introduction_section(TOOL_SEARCH.$groupId); |
361 | + } |
|
349 | 362 | } else { |
350 | 363 | Display::display_introduction_section(TOOL_SEARCH); |
351 | 364 | } |
@@ -367,7 +380,9 @@ discard block |
||
367 | 380 | break; |
368 | 381 | } |
369 | 382 | } |
370 | - if ($thesaurus_decided) break; |
|
383 | + if ($thesaurus_decided) { |
|
384 | + break; |
|
385 | + } |
|
371 | 386 | } |
372 | 387 | } |
373 | 388 |
@@ -79,6 +79,7 @@ discard block |
||
79 | 79 | /** |
80 | 80 | * Available driver list. |
81 | 81 | * @param array |
82 | + * @param string[] $list |
|
82 | 83 | */ |
83 | 84 | public function setDriverList($list) |
84 | 85 | { |
@@ -87,7 +88,7 @@ discard block |
||
87 | 88 | |
88 | 89 | /** |
89 | 90 | * Available driver list. |
90 | - * @return array |
|
91 | + * @return string[] |
|
91 | 92 | */ |
92 | 93 | private function getDefaultDriverList() |
93 | 94 | { |
@@ -328,7 +328,7 @@ |
||
328 | 328 | { |
329 | 329 | return strpos(basename($path), '.') === 0 // if file/folder begins with '.' (dot) |
330 | 330 | ? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true |
331 | - : null; // else elFinder decide it itself |
|
331 | + : null; // else elFinder decide it itself |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -149,7 +149,7 @@ |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
152 | - * @param $action |
|
152 | + * @param string $action |
|
153 | 153 | * @param MenuItemInterface $menu |
154 | 154 | * @return MenuItemInterface |
155 | 155 | */ |
@@ -38,9 +38,6 @@ discard block |
||
38 | 38 | * @Route("/", name="home") |
39 | 39 | * @Method({"GET"}) |
40 | 40 | * |
41 | - * @param string $type courses|sessions|mycoursecategories |
|
42 | - * @param string $filter for the userportal courses page. Only works when setting 'history' |
|
43 | - * @param int $page |
|
44 | 41 | * |
45 | 42 | * @return Response |
46 | 43 | */ |
@@ -137,7 +134,7 @@ discard block |
||
137 | 134 | * @Method({"GET"}) |
138 | 135 | * @param Request $request |
139 | 136 | * |
140 | - * @return Response |
|
137 | + * @return string |
|
141 | 138 | */ |
142 | 139 | public function toggleStudentViewAction(Request $request) |
143 | 140 | { |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
395 | - * @return ArrayCollection |
|
395 | + * @return CTool[] |
|
396 | 396 | */ |
397 | 397 | public function getTools() |
398 | 398 | { |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | } |
428 | 428 | |
429 | 429 | /** |
430 | - * @param $urls |
|
430 | + * @param ArrayCollection $urls |
|
431 | 431 | */ |
432 | 432 | public function setUrls($urls) |
433 | 433 | { |
@@ -1244,7 +1244,7 @@ discard block |
||
1244 | 1244 | } |
1245 | 1245 | |
1246 | 1246 | /** |
1247 | - * @return array |
|
1247 | + * @return string[] |
|
1248 | 1248 | */ |
1249 | 1249 | public static function getStatusList() |
1250 | 1250 | { |
@@ -148,7 +148,7 @@ |
||
148 | 148 | * Set user |
149 | 149 | * |
150 | 150 | * @param User $user |
151 | - * @return UsergroupRelUser |
|
151 | + * @return CourseRequest |
|
152 | 152 | */ |
153 | 153 | public function setUser(User $user) |
154 | 154 | { |
@@ -253,7 +253,7 @@ |
||
253 | 253 | /** |
254 | 254 | * Returns the parent resource. |
255 | 255 | * |
256 | - * @return AbstractResource |
|
256 | + * @return null|ResourceNode |
|
257 | 257 | */ |
258 | 258 | public function getParent() |
259 | 259 | { |
@@ -123,7 +123,7 @@ |
||
123 | 123 | */ |
124 | 124 | public function __toString() |
125 | 125 | { |
126 | - return (string)$this->getPath(); |
|
126 | + return (string) $this->getPath(); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -177,6 +177,9 @@ |
||
177 | 177 | ); |
178 | 178 | } |
179 | 179 | |
180 | + /** |
|
181 | + * @param string $key |
|
182 | + */ |
|
180 | 183 | private function isOn($key) |
181 | 184 | { |
182 | 185 | $value = ini_get($key); |