@@ -15,36 +15,36 @@ discard block |
||
15 | 15 | api_protect_admin_script(); |
16 | 16 | |
17 | 17 | // Breadcrumb |
18 | -$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
19 | -$interbreadcrumb[] = array ('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings')); |
|
18 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
19 | +$interbreadcrumb[] = array('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings')); |
|
20 | 20 | |
21 | 21 | $libpath = api_get_path(LIBRARY_PATH); |
22 | 22 | |
23 | 23 | include_once $libpath.'specific_fields_manager.lib.php'; |
24 | 24 | |
25 | 25 | // Create an add-field box |
26 | -$form = new FormValidator('add_field','post','','',null,false); |
|
27 | -$renderer =& $form->defaultRenderer(); |
|
26 | +$form = new FormValidator('add_field', 'post', '', '', null, false); |
|
27 | +$renderer = & $form->defaultRenderer(); |
|
28 | 28 | $renderer->setCustomElementTemplate('<span>{element}</span> '); |
29 | -$form->addElement('static','search_advanced_link',null,'<a href="specific_fields_add.php">'.Display::return_icon('fieldadd.gif').get_lang('AddSpecificSearchField').'</a>'); |
|
29 | +$form->addElement('static', 'search_advanced_link', null, '<a href="specific_fields_add.php">'.Display::return_icon('fieldadd.gif').get_lang('AddSpecificSearchField').'</a>'); |
|
30 | 30 | |
31 | 31 | // Create a sortable table with specific fields data |
32 | -$column_show = array(1,1,1); |
|
33 | -$column_order = array(3,2,1); |
|
32 | +$column_show = array(1, 1, 1); |
|
33 | +$column_order = array(3, 2, 1); |
|
34 | 34 | $extra_fields = get_specific_field_list(); |
35 | 35 | $number_of_extra_fields = count($extra_fields); |
36 | 36 | |
37 | -$table = new SortableTableFromArrayConfig($extra_fields,2,50,'',$column_show,$column_order); |
|
38 | -$table->set_header(0, ' ', false,null,'width="2%"', 'style="display:none"'); |
|
37 | +$table = new SortableTableFromArrayConfig($extra_fields, 2, 50, '', $column_show, $column_order); |
|
38 | +$table->set_header(0, ' ', false, null, 'width="2%"', 'style="display:none"'); |
|
39 | 39 | $table->set_header(1, get_lang('Code'), TRUE, 'width="10%"'); |
40 | 40 | $table->set_header(2, get_lang('Name')); |
41 | -$table->set_header(3, get_lang('Modify'),false,'width="10%"'); |
|
41 | +$table->set_header(3, get_lang('Modify'), false, 'width="10%"'); |
|
42 | 42 | $table->set_column_filter(3, 'edit_filter'); |
43 | 43 | |
44 | -function edit_filter($id,$url_params,$row) { |
|
44 | +function edit_filter($id, $url_params, $row) { |
|
45 | 45 | global $charset; |
46 | - $return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>'; |
|
47 | - $return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a>'; |
|
46 | + $return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>'; |
|
47 | + $return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>'; |
|
48 | 48 | return $return; |
49 | 49 | } |
50 | 50 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | Display::display_header(get_lang('SpecificSearchFields')); |
61 | 61 | echo Display::display_normal_message(get_lang('SpecificSearchFieldsIntro')); |
62 | 62 | |
63 | -if(!empty($_GET['message'])) { |
|
63 | +if (!empty($_GET['message'])) { |
|
64 | 64 | Display::display_confirmation_message($_GET['message']); |
65 | 65 | } |
66 | 66 |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | // Create the form |
33 | 33 | $form = new FormValidator('specific_fields_add'); |
34 | 34 | // Field variable name |
35 | -$form->addElement('hidden','field_id', $fieldId); |
|
36 | -$form->addElement('text','field_name',get_lang('FieldName')); |
|
37 | -$form->applyFilter('field_name','html_filter'); |
|
38 | -$form->applyFilter('field_name','trim'); |
|
35 | +$form->addElement('hidden', 'field_id', $fieldId); |
|
36 | +$form->addElement('text', 'field_name', get_lang('FieldName')); |
|
37 | +$form->applyFilter('field_name', 'html_filter'); |
|
38 | +$form->applyFilter('field_name', 'trim'); |
|
39 | 39 | $form->addRule('field_name', get_lang('ThisFieldIsRequired'), 'required'); |
40 | 40 | $form->addRule('field_name', get_lang('OnlyLettersAndNumbersAllowed'), 'username'); |
41 | -$form->addRule('field_name', '', 'maxlength',20); |
|
41 | +$form->addRule('field_name', '', 'maxlength', 20); |
|
42 | 42 | |
43 | 43 | // Set default values (only not empty when editing) |
44 | 44 | $defaults = array(); |
45 | 45 | if ($fieldId) { |
46 | - $form_information = get_specific_field_list(array( 'id' => $fieldId )); |
|
46 | + $form_information = get_specific_field_list(array('id' => $fieldId)); |
|
47 | 47 | $defaults['field_name'] = $form_information[0]['name']; |
48 | 48 | } |
49 | 49 | $form->setDefaults($defaults); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | if ($form->validate()) { |
55 | 55 | $field = $form->exportValues(); |
56 | 56 | $field_name = $field['field_name']; |
57 | - if (is_numeric($field['field_id']) && $field['field_id']<>0 && !empty($field['field_id'])) { |
|
57 | + if (is_numeric($field['field_id']) && $field['field_id'] <> 0 && !empty($field['field_id'])) { |
|
58 | 58 | edit_specific_field($field['field_id'], $field['field_name']); |
59 | 59 | $message = get_lang('FieldEdited'); |
60 | 60 | } else { |
@@ -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 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | if ($action == 'delete') { |
27 | 27 | CourseCategory::deleteNode($categoryId); |
28 | 28 | Display::addFlash(Display::return_message(get_lang('Deleted'))); |
29 | - header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category)); |
|
29 | + header('Location: '.api_get_self().'?category='.Security::remove_XSS($category)); |
|
30 | 30 | exit(); |
31 | 31 | } elseif (($action == 'add' || $action == 'edit') && isset($_POST['formSent']) && $_POST['formSent']) { |
32 | 32 | if ($action == 'add') { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | } elseif ($action == 'moveUp') { |
56 | 56 | CourseCategory::moveNodeUp($categoryId, $_GET['tree_pos'], $category); |
57 | - header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category)); |
|
57 | + header('Location: '.api_get_self().'?category='.Security::remove_XSS($category)); |
|
58 | 58 | Display::addFlash(Display::return_message(get_lang('Updated'))); |
59 | 59 | exit(); |
60 | 60 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $form_title = ($action == 'add') ? get_lang('AddACategory') : get_lang('EditNode'); |
80 | 80 | if (!empty($category)) { |
81 | - $form_title .= ' ' . get_lang('Into') . ' ' . Security::remove_XSS($category); |
|
81 | + $form_title .= ' '.get_lang('Into').' '.Security::remove_XSS($category); |
|
82 | 82 | } |
83 | 83 | $url = api_get_self().'?action='.Security::remove_XSS($action).'&category='.Security::remove_XSS($category).'&id='.Security::remove_XSS($categoryId); |
84 | 84 | $form = new FormValidator('course_category', 'post', $url); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $vimeoMatch = preg_match('#://player.vimeo.com/#i', $matches[1]); |
62 | 62 | $googleMapsMatch = preg_match('#src="https://maps.google.com/#i', $matches[1]); |
63 | 63 | $slideShare = preg_match('#src="(https?:)?//www.slideshare.net/#', $matches[1]); |
64 | - $platformDomain = preg_match('#src="https?://(.+\.)?' . $hostName[1] . '#i', $matches[1]); |
|
64 | + $platformDomain = preg_match('#src="https?://(.+\.)?'.$hostName[1].'#i', $matches[1]); |
|
65 | 65 | |
66 | 66 | if ($youTubeMatch || $vimeoMatch || $googleMapsMatch || $slideShare || $platformDomain) { |
67 | 67 | $extra = ' frameborder="0"'; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } elseif ($vimeoMatch) { |
71 | 71 | $extra .= ' webkitAllowFullScreen mozallowfullscreen allowFullScreen'; |
72 | 72 | } |
73 | - return '<iframe ' . $matches[1] . $extra . '></iframe>'; |
|
73 | + return '<iframe '.$matches[1].$extra.'></iframe>'; |
|
74 | 74 | } else { |
75 | 75 | return ''; |
76 | 76 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | 0, //howMany |
75 | 75 | 1, //$orderby = 1 |
76 | 76 | 'ASC', |
77 | - -1, //visibility |
|
77 | + -1, //visibility |
|
78 | 78 | $_GET['q'], |
79 | 79 | null, //$urlId |
80 | 80 | true //AlsoSearchCode |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | if (!empty($course['category_code'])) { |
98 | 98 | $parents = CourseCategory::getParentsToString($course['category_code']); |
99 | - $title = $parents . $course['title']; |
|
99 | + $title = $parents.$course['title']; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $results['items'][] = array( |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | INNER JOIN $session_course_user r ON u.user_id = r.user_id |
177 | 177 | WHERE session_id = %d AND c_id = '%s' |
178 | 178 | AND (u.firstname LIKE '%s' OR u.username LIKE '%s' OR u.lastname LIKE '%s')"; |
179 | - $needle = '%' . $_GET['q'] . '%'; |
|
179 | + $needle = '%'.$_GET['q'].'%'; |
|
180 | 180 | $sql_query = sprintf($sql, $_GET['session_id'], $course['real_id'], $needle, $needle, $needle); |
181 | 181 | |
182 | 182 | $result = Database::query($sql_query); |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | case 'search_exercise_by_course': |
196 | 196 | if (api_is_platform_admin()) { |
197 | 197 | $course = api_get_course_info_by_id($_GET['course_id']); |
198 | - $session_id = (!empty($_GET['session_id'])) ? intval($_GET['session_id']) : 0 ; |
|
198 | + $session_id = (!empty($_GET['session_id'])) ? intval($_GET['session_id']) : 0; |
|
199 | 199 | $exercises = ExerciseLib::get_all_exercises($course, $session_id, false, $_GET['q'], true, 3); |
200 | 200 | |
201 | 201 | foreach ($exercises as $exercise) { |
202 | - $data[] = array('id' => $exercise['id'], 'text' => html_entity_decode($exercise['title']) ); |
|
202 | + $data[] = array('id' => $exercise['id'], 'text' => html_entity_decode($exercise['title'])); |
|
203 | 203 | } |
204 | 204 | if (!empty($data)) { |
205 | 205 | $data[] = array('id' => 'T', 'text' => 'TODOS'); |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | $sql, |
225 | 225 | intval($_GET['course_id']), |
226 | 226 | intval($_GET['session_id']), |
227 | - '%' . Database::escape_string($_GET['q']).'%' |
|
227 | + '%'.Database::escape_string($_GET['q']).'%' |
|
228 | 228 | ); |
229 | 229 | $result = Database::query($sql_query); |
230 | 230 | while ($survey = Database::fetch_assoc($result)) { |
231 | - $survey['title'] .= ($survey['anonymous'] == 1) ? ' (' . get_lang('Anonymous') . ')' : ''; |
|
231 | + $survey['title'] .= ($survey['anonymous'] == 1) ? ' ('.get_lang('Anonymous').')' : ''; |
|
232 | 232 | $data[] = array( |
233 | 233 | 'id' => $survey['id'], |
234 | 234 | 'text' => strip_tags(html_entity_decode($survey['title'])) |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | $post = strpos($file_logged_in, "_logged_in"); |
21 | 21 | if ($post !== false) { |
22 | - $file_logged_out = str_replace('_logged_in','', $file_logged_in); |
|
22 | + $file_logged_out = str_replace('_logged_in', '', $file_logged_in); |
|
23 | 23 | //variables initialization |
24 | 24 | $data_logged_out = array(); |
25 | 25 | $data_logged_in = array(); |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | //we read the file with all links |
28 | 28 | $file = file($file_logged_in); |
29 | 29 | foreach ($file as $line) { |
30 | - $line = str_replace("\n", '',$line); |
|
30 | + $line = str_replace("\n", '', $line); |
|
31 | 31 | //not logged user only sees public links |
32 | - if (!preg_match('/::private/',$line)) { |
|
32 | + if (!preg_match('/::private/', $line)) { |
|
33 | 33 | $data_logged_out[] = $line; |
34 | 34 | } |
35 | 35 | //logged user only sees all links |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $tbl_category = Database::get_main_table(TABLE_MAIN_CATEGORY); |
75 | 75 | $tool_name = get_lang('ConfigureHomePage'); |
76 | 76 | $_languages = api_get_languages(); |
77 | -$selfUrl = api_get_self(); |
|
77 | +$selfUrl = api_get_self(); |
|
78 | 78 | $interbreadcrumb[] = array( |
79 | 79 | 'url' => 'index.php', |
80 | 80 | 'name' => get_lang('PlatformAdmin') |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | if (EventsMail::check_if_using_class('portal_homepage_edited')) { |
265 | - EventsDispatcher::events('portal_homepage_edited',array('about_user' => api_get_user_id())); |
|
265 | + EventsDispatcher::events('portal_homepage_edited', array('about_user' => api_get_user_id())); |
|
266 | 266 | } |
267 | 267 | Event::addEvent( |
268 | 268 | LOG_HOMEPAGE_CHANGED, |
@@ -394,9 +394,9 @@ discard block |
||
394 | 394 | if ($link_url == 'http://' || $link_url == 'https://') { |
395 | 395 | $link_url = ''; |
396 | 396 | } elseif (!empty($link_url) && !strstr($link_url, '://')) { |
397 | - $link_url='http://'.$link_url; |
|
397 | + $link_url = 'http://'.$link_url; |
|
398 | 398 | } |
399 | - $menuf = ($action == 'insert_tabs' || $action == 'edit_tabs')? $mtloggedin : $menuf; |
|
399 | + $menuf = ($action == 'insert_tabs' || $action == 'edit_tabs') ? $mtloggedin : $menuf; |
|
400 | 400 | |
401 | 401 | if (!is_writable($homep.$menuf.'_'.$lang.$ext)) { |
402 | 402 | $errorMsg = get_lang('HomePageFilesNotWritable'); |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | } |
415 | 415 | // If the typical language suffix is not found in the file name, |
416 | 416 | // replace the ".html" suffix by "_en.html" or the active menu language |
417 | - if (!strstr($filename,'_'.$lang.$ext)) { |
|
417 | + if (!strstr($filename, '_'.$lang.$ext)) { |
|
418 | 418 | $filename = str_replace($ext, '_'.$lang.$ext, $filename); |
419 | 419 | } |
420 | 420 | // Get the contents of home_menu_en.html (or active menu language |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | // |
437 | 437 | // If the given link url is empty, then replace the link url by a link to the link file created |
438 | 438 | |
439 | - if (empty($link_url) || $link_url == 'http://' || $link_url == 'https://') { |
|
439 | + if (empty($link_url) || $link_url == 'http://' || $link_url == 'https://') { |
|
440 | 440 | $link_url = api_get_path(WEB_PATH).'index.php?include='.urlencode($filename); |
441 | 441 | // If the file doesn't exist, then create it and |
442 | 442 | // fill it with default text |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | } |
456 | 456 | // If the requested action is to edit a link, open the file and |
457 | 457 | // write to it (if the file doesn't exist, create it) |
458 | - if (in_array($action, array('edit_link')) && !empty($link_html)) { |
|
458 | + if (in_array($action, array('edit_link')) && !empty($link_html)) { |
|
459 | 459 | $fp = @fopen($homep.$filename, 'w'); |
460 | 460 | if ($fp) { |
461 | 461 | fputs($fp, $link_html); |
@@ -482,10 +482,10 @@ discard block |
||
482 | 482 | break; |
483 | 483 | } |
484 | 484 | } |
485 | - $home_menu[$insert_where + 1] = '<li ' . $class_add_in_tab . '><a href="'.$link_url.'" target="'.($target_blank ? '_blank' : '_self').'">'. $link_name .'</a></li>'; |
|
485 | + $home_menu[$insert_where + 1] = '<li '.$class_add_in_tab.'><a href="'.$link_url.'" target="'.($target_blank ? '_blank' : '_self').'">'.$link_name.'</a></li>'; |
|
486 | 486 | } else { |
487 | 487 | // If the request is about a link edition, change the link |
488 | - $home_menu[$link_index]='<li ' . $class_add_in_tab . '><a href="'.$link_url.'" target="'.($target_blank?'_blank':'_self').'">'. $link_name .'</a></li>'; |
|
488 | + $home_menu[$link_index] = '<li '.$class_add_in_tab.'><a href="'.$link_url.'" target="'.($target_blank ? '_blank' : '_self').'">'.$link_name.'</a></li>'; |
|
489 | 489 | } |
490 | 490 | // Re-build the file from the home_menu array |
491 | 491 | $home_menu = implode("\n", $home_menu); |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | Event::addEvent( |
540 | 540 | LOG_HOMEPAGE_CHANGED, |
541 | 541 | $action, |
542 | - cut($link_name . ':' . $link_url, 254), |
|
542 | + cut($link_name.':'.$link_url, 254), |
|
543 | 543 | api_get_utc_datetime(), |
544 | 544 | api_get_user_id() |
545 | 545 | ); |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | // A link is deleted by getting the file into an array, removing the |
563 | 563 | // link and re-writing the array to the file |
564 | 564 | $link_index = intval($_GET['link_index']); |
565 | - $menuf = ($action == 'delete_tabs')? $mtloggedin : $menuf; |
|
565 | + $menuf = ($action == 'delete_tabs') ? $mtloggedin : $menuf; |
|
566 | 566 | $home_menu = @file($homep.$menuf.'_'.$lang.$ext); |
567 | 567 | if (empty($home_menu)) { |
568 | 568 | $home_menu = array(); |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | fclose($fp); |
584 | 584 | if (file_exists($homep.$menuf.$ext)) { |
585 | 585 | if (is_writable($homep.$menuf.$ext)) { |
586 | - $fpo = fopen($homep.$menuf.$ext,'w'); |
|
586 | + $fpo = fopen($homep.$menuf.$ext, 'w'); |
|
587 | 587 | fputs($fpo, $home_menu); |
588 | 588 | home_tabs($homep.$menuf.$ext); |
589 | 589 | fclose($fpo); |
@@ -596,9 +596,9 @@ discard block |
||
596 | 596 | // This request is only the preparation for the update of the home_top |
597 | 597 | $home_top = ''; |
598 | 598 | if (is_file($homep.$topf.'_'.$lang.$ext) && is_readable($homep.$topf.'_'.$lang.$ext)) { |
599 | - $home_top = @(string)file_get_contents($homep.$topf.'_'.$lang.$ext); |
|
599 | + $home_top = @(string) file_get_contents($homep.$topf.'_'.$lang.$ext); |
|
600 | 600 | } elseif (is_file($homep.$topf.$lang.$ext) && is_readable($homep.$topf.$lang.$ext)) { |
601 | - $home_top = @(string)file_get_contents($homep.$topf.$lang.$ext); |
|
601 | + $home_top = @(string) file_get_contents($homep.$topf.$lang.$ext); |
|
602 | 602 | } else { |
603 | 603 | $errorMsg = get_lang('HomePageFilesNotReadable'); |
604 | 604 | } |
@@ -626,9 +626,9 @@ discard block |
||
626 | 626 | // This request is the preparation for the update of the home_news page |
627 | 627 | $home_news = ''; |
628 | 628 | if (is_file($homep.$newsf.'_'.$lang.$ext) && is_readable($homep.$newsf.'_'.$lang.$ext)) { |
629 | - $home_news = @(string)file_get_contents($homep.$newsf.'_'.$lang.$ext); |
|
629 | + $home_news = @(string) file_get_contents($homep.$newsf.'_'.$lang.$ext); |
|
630 | 630 | } elseif (is_file($homep.$newsf.$lang.$ext) && is_readable($homep.$newsf.$lang.$ext)) { |
631 | - $home_news = @(string)file_get_contents($homep.$newsf.$lang.$ext); |
|
631 | + $home_news = @(string) file_get_contents($homep.$newsf.$lang.$ext); |
|
632 | 632 | } else { |
633 | 633 | $errorMsg = get_lang('HomePageFilesNotReadable'); |
634 | 634 | } |
@@ -637,10 +637,10 @@ discard block |
||
637 | 637 | case 'insert_link': |
638 | 638 | // This request is the preparation for the addition of an item in home_menu |
639 | 639 | $home_menu = ''; |
640 | - $menuf = ($action == 'edit_tabs')? $mtloggedin : $menuf; |
|
640 | + $menuf = ($action == 'edit_tabs') ? $mtloggedin : $menuf; |
|
641 | 641 | if (is_file($homep.$menuf.'_'.$lang.$ext) && is_readable($homep.$menuf.'_'.$lang.$ext)) { |
642 | 642 | $home_menu = @file($homep.$menuf.'_'.$lang.$ext); |
643 | - } elseif(is_file($homep.$menuf.$lang.$ext) && is_readable($homep.$menuf.$lang.$ext)) { |
|
643 | + } elseif (is_file($homep.$menuf.$lang.$ext) && is_readable($homep.$menuf.$lang.$ext)) { |
|
644 | 644 | $home_menu = @file($homep.$menuf.$lang.$ext); |
645 | 645 | } else { |
646 | 646 | $errorMsg = get_lang('HomePageFilesNotReadable'); |
@@ -681,10 +681,10 @@ discard block |
||
681 | 681 | case 'edit_link': |
682 | 682 | // This request is the preparation for the edition of the links array |
683 | 683 | $home_menu = ''; |
684 | - $menuf = ($action == 'edit_tabs')? $mtloggedin : $menuf; |
|
684 | + $menuf = ($action == 'edit_tabs') ? $mtloggedin : $menuf; |
|
685 | 685 | if (is_file($homep.$menuf.'_'.$lang.$ext) && is_readable($homep.$menuf.'_'.$lang.$ext)) { |
686 | 686 | $home_menu = @file($homep.$menuf.'_'.$lang.$ext); |
687 | - } elseif(is_file($homep.$menuf.$lang.$ext) && is_readable($homep.$menuf.$lang.$ext)) { |
|
687 | + } elseif (is_file($homep.$menuf.$lang.$ext) && is_readable($homep.$menuf.$lang.$ext)) { |
|
688 | 688 | $home_menu = @file($homep.$menuf.$lang.$ext); |
689 | 689 | } else { |
690 | 690 | $errorMsg = get_lang('HomePageFilesNotReadable'); |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | $link_name = strip_tags($enreg); |
748 | 748 | |
749 | 749 | // Get the contents of "href" attribute in $link_url |
750 | - $enreg = explode('href="',$enreg); |
|
750 | + $enreg = explode('href="', $enreg); |
|
751 | 751 | list($link_url) = explode('"', $enreg[sizeof($enreg) - 1]); |
752 | 752 | |
753 | 753 | // If the link contains the web root of this portal, then strip |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | case 'open_link': |
786 | 786 | if (!empty($link)) { |
787 | 787 | // $link is only set in case of action=open_link and is filtered |
788 | - $open = @(string)file_get_contents($homep.$link); |
|
788 | + $open = @(string) file_get_contents($homep.$link); |
|
789 | 789 | $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
790 | 790 | echo $open; |
791 | 791 | } |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | } |
850 | 850 | $default = array(); |
851 | 851 | $form = new FormValidator('configure_homepage_'.$action, 'post', $selfUrl.'?action='.$action, '', array('style' => 'margin: 0px;')); |
852 | - $renderer =& $form->defaultRenderer(); |
|
852 | + $renderer = & $form->defaultRenderer(); |
|
853 | 853 | |
854 | 854 | $form->addElement('header', '', $tool_name); |
855 | 855 | $form->addElement('hidden', 'formSent', '1'); |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | |
871 | 871 | if ($action == 'insert_link' || $action == 'insert_tabs') { |
872 | 872 | $add_in_tab = 1; |
873 | - if (is_array($home_menu)){ |
|
873 | + if (is_array($home_menu)) { |
|
874 | 874 | foreach ($home_menu as $key => $enreg) { |
875 | 875 | if (strlen($enreg = trim(strip_tags($enreg))) > 0) { |
876 | 876 | $options[$key] = get_lang('After').' "'.$enreg.'"'; |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | } |
881 | 881 | } |
882 | 882 | $default['insert_link'] = $selected; |
883 | - $form->addElement('select', 'insert_where', get_lang('InsertThisLink') , $options); |
|
883 | + $form->addElement('select', 'insert_where', get_lang('InsertThisLink'), $options); |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | $target_blank_checkbox = $form->addElement('checkbox', 'target_blank', null, get_lang('OpenInNewWindow'), 1); |
@@ -895,15 +895,15 @@ discard block |
||
895 | 895 | if ($action == 'edit_link' && (empty($link_url) || $link_url == 'http://' || $link_url == 'https://')) { |
896 | 896 | $default['link_html'] = isset($_POST['link_html']) ? $_POST['link_html'] : $link_html; |
897 | 897 | $form->addHtmlEditor('link_html', get_lang('Content'), false, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400')); |
898 | - $form->addButtonSave(get_lang('Save'),'submit'); |
|
898 | + $form->addButtonSave(get_lang('Save'), 'submit'); |
|
899 | 899 | |
900 | 900 | } else { |
901 | - if (in_array($action, array('edit_tabs','insert_tabs'))) { |
|
901 | + if (in_array($action, array('edit_tabs', 'insert_tabs'))) { |
|
902 | 902 | $default['link_html'] = isset($_POST['link_html']) ? $_POST['link_html'] : (!empty($link_html) ? $link_html : ''); |
903 | 903 | $form->addHtmlEditor('link_html', get_lang('Content'), false, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400')); |
904 | 904 | } |
905 | 905 | $form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), array('id' => 'all_langs')); |
906 | - $form->addElement('html','<table id="table_langs" style="margin-left:159px;"><tr>'); |
|
906 | + $form->addElement('html', '<table id="table_langs" style="margin-left:159px;"><tr>'); |
|
907 | 907 | $i = 0; |
908 | 908 | foreach ($_languages['name'] as $key => $value) { |
909 | 909 | $i++; |
@@ -916,8 +916,8 @@ discard block |
||
916 | 916 | } |
917 | 917 | $form->addElement('html', $html_langs); |
918 | 918 | } |
919 | - $form->addElement('html','</tr></table><br/>'); |
|
920 | - $form->addButtonSave(get_lang('Save'),'submit'); |
|
919 | + $form->addElement('html', '</tr></table><br/>'); |
|
920 | + $form->addButtonSave(get_lang('Save'), 'submit'); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | $form->setDefaults($default); |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | $open = $home_top; |
932 | 932 | } else { |
933 | 933 | $name = $newsf; |
934 | - $open = @(string)file_get_contents($homep.$newsf.'_'.$lang.$ext); |
|
934 | + $open = @(string) file_get_contents($homep.$newsf.'_'.$lang.$ext); |
|
935 | 935 | } |
936 | 936 | $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
937 | 937 | |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | '', |
948 | 948 | array('style' => 'margin: 0px;') |
949 | 949 | ); |
950 | - $renderer =& $form->defaultRenderer(); |
|
950 | + $renderer = & $form->defaultRenderer(); |
|
951 | 951 | $renderer->setHeaderTemplate(''); |
952 | 952 | $renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>'); |
953 | 953 | $renderer->setCustomElementTemplate('<tr><td>{element}</td></tr>'); |
@@ -973,8 +973,8 @@ discard block |
||
973 | 973 | |
974 | 974 | $default[$name] = str_replace('{rel_path}', api_get_path(REL_PATH), $open); |
975 | 975 | $form->addHtmlEditor($name, '', true, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400')); |
976 | - $form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'),array('id' => 'all_langs')); |
|
977 | - $form->addElement('html','<table id="table_langs" style="margin-left:5px;"><tr>'); |
|
976 | + $form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), array('id' => 'all_langs')); |
|
977 | + $form->addElement('html', '<table id="table_langs" style="margin-left:5px;"><tr>'); |
|
978 | 978 | |
979 | 979 | $currentLanguage = api_get_interface_language(); |
980 | 980 | $i = 0; |
@@ -983,7 +983,7 @@ discard block |
||
983 | 983 | $i++; |
984 | 984 | |
985 | 985 | $checked = null; |
986 | - if ($languageGet == $lang_name) { |
|
986 | + if ($languageGet == $lang_name) { |
|
987 | 987 | $checked = "checked"; |
988 | 988 | } |
989 | 989 | $html_langs = '<td width="300">'; |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | } |
995 | 995 | $form->addElement('html', $html_langs); |
996 | 996 | } |
997 | - $form->addElement('html','</tr></table><br/>'); |
|
997 | + $form->addElement('html', '</tr></table><br/>'); |
|
998 | 998 | $form->addButtonSave(get_lang('Save')); |
999 | 999 | $form->setDefaults($default); |
1000 | 1000 | $form->display(); |
@@ -1047,9 +1047,9 @@ discard block |
||
1047 | 1047 | <?php |
1048 | 1048 | $home_notice = ''; |
1049 | 1049 | if (file_exists($homep.$noticef.'_'.$lang.$ext)) { |
1050 | - $home_notice = @(string)file_get_contents($homep.$noticef.'_'.$lang.$ext); |
|
1050 | + $home_notice = @(string) file_get_contents($homep.$noticef.'_'.$lang.$ext); |
|
1051 | 1051 | } else { |
1052 | - $home_notice = @(string)file_get_contents($homep.$noticef.$ext); |
|
1052 | + $home_notice = @(string) file_get_contents($homep.$noticef.$ext); |
|
1053 | 1053 | } |
1054 | 1054 | $home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice))); |
1055 | 1055 | echo '<div class="homepage_notice">'; |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | </div> |
1075 | 1075 | <div id="links-list" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne"> |
1076 | 1076 | <div class="panel-body"> |
1077 | - <a href="<?php echo $selfUrl; ?>?action=insert_link"><?php echo Display::return_icon('add.png', get_lang('InsertLink')).' '. get_lang('InsertLink'); ?> |
|
1077 | + <a href="<?php echo $selfUrl; ?>?action=insert_link"><?php echo Display::return_icon('add.png', get_lang('InsertLink')).' '.get_lang('InsertLink'); ?> |
|
1078 | 1078 | </a> |
1079 | 1079 | <ul class="menulist"> |
1080 | 1080 | <?php |
@@ -1113,16 +1113,16 @@ discard block |
||
1113 | 1113 | <div class="col-md-9"> |
1114 | 1114 | <div class="actions"> |
1115 | 1115 | <a href="<?php echo $selfUrl; ?>?action=edit_top&language=<?php echo $languageGet; ?>"> |
1116 | - <?php echo Display::return_icon('edit.png', get_lang('EditHomePage'),null,ICON_SIZE_SMALL).' '. get_lang('EditHomePage'); ?> |
|
1116 | + <?php echo Display::return_icon('edit.png', get_lang('EditHomePage'), null, ICON_SIZE_SMALL).' '.get_lang('EditHomePage'); ?> |
|
1117 | 1117 | </a> |
1118 | 1118 | </div> |
1119 | 1119 | <section id="homepage-home"> |
1120 | 1120 | <?php |
1121 | 1121 | //print home_top contents |
1122 | 1122 | if (file_exists($homep.$topf.'_'.$lang.$ext)) { |
1123 | - $home_top_temp = @(string)file_get_contents($homep.$topf.'_'.$lang.$ext); |
|
1123 | + $home_top_temp = @(string) file_get_contents($homep.$topf.'_'.$lang.$ext); |
|
1124 | 1124 | } else { |
1125 | - $home_top_temp = @(string)file_get_contents($homep.$topf.$ext); |
|
1125 | + $home_top_temp = @(string) file_get_contents($homep.$topf.$ext); |
|
1126 | 1126 | } |
1127 | 1127 | $open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp); |
1128 | 1128 | $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
@@ -1158,11 +1158,11 @@ discard block |
||
1158 | 1158 | |
1159 | 1159 | <?php |
1160 | 1160 | if (file_exists($homep.$newsf.'_'.$lang.$ext)) { |
1161 | - $open = @(string)file_get_contents($homep.$newsf.'_'.$lang.$ext); |
|
1161 | + $open = @(string) file_get_contents($homep.$newsf.'_'.$lang.$ext); |
|
1162 | 1162 | $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
1163 | 1163 | echo $open; |
1164 | 1164 | } else { |
1165 | - $open = @(string)file_get_contents($homep.$newsf.$ext); |
|
1165 | + $open = @(string) file_get_contents($homep.$newsf.$ext); |
|
1166 | 1166 | $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
1167 | 1167 | echo $open; |
1168 | 1168 | } |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | $tab_string = str_replace(array('href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'), |
1200 | 1200 | array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($selfUrl).'?action=open_link&link=', $edit_link.$delete_link.'</li>'), |
1201 | 1201 | $enreg); |
1202 | - $tab_string = str_replace(array('<li>', '</li>','class="hide_menu"', 'hide_menu'), '', $tab_string); |
|
1202 | + $tab_string = str_replace(array('<li>', '</li>', 'class="hide_menu"', 'hide_menu'), '', $tab_string); |
|
1203 | 1203 | $link_list .= Display::tag('li', $tab_string, array('class' => 'list-group-item')); |
1204 | 1204 | $tab_counter++; |
1205 | 1205 | } |
@@ -1207,7 +1207,7 @@ discard block |
||
1207 | 1207 | ?> |
1208 | 1208 | <div class="actions"> |
1209 | 1209 | <a href="<?php echo $selfUrl; ?>?action=insert_tabs"> |
1210 | - <?php echo Display::return_icon('add.png', get_lang('InsertLink')) .' '. get_lang('InsertLink'); ?> |
|
1210 | + <?php echo Display::return_icon('add.png', get_lang('InsertLink')).' '.get_lang('InsertLink'); ?> |
|
1211 | 1211 | </a> |
1212 | 1212 | </div> |
1213 | 1213 | <?php |
@@ -41,7 +41,7 @@ |
||
41 | 41 | $glossary_all_data = implode('[|.|_|.|-|.|]', $glossary_all_data); |
42 | 42 | echo api_xml_http_response_encode($glossary_all_data); |
43 | 43 | } |
44 | -} elseif(isset($_POST['glossary_name'])) { |
|
44 | +} elseif (isset($_POST['glossary_name'])) { |
|
45 | 45 | $my_glossary_name = Security::remove_XSS($_POST['glossary_name']); |
46 | 46 | $my_glossary_name = api_convert_encoding($my_glossary_name, $charset, 'UTF-8'); |
47 | 47 | $my_glossary_name = trim($my_glossary_name); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | echo "Chamilo Bulk Nodes Creation v.1.0\n"; |
14 | 14 | echo "=================================\n"; |
15 | 15 | require_once('../../../main/inc/global.inc.php'); |
16 | -require_once('clilib.php'); // cli only functions |
|
16 | +require_once('clilib.php'); // cli only functions |
|
17 | 17 | // Ensure errors are well explained |
18 | 18 | ini_set('debug_display', 1); |
19 | 19 | ini_set('debug_level', E_ALL); |
@@ -68,26 +68,26 @@ discard block |
||
68 | 68 | |
69 | 69 | if (!empty($options['config'])) { |
70 | 70 | echo "Loading config : ".$options['config']; |
71 | - if (!file_exists($options['config'])){ |
|
71 | + if (!file_exists($options['config'])) { |
|
72 | 72 | cli_error('Config file mentioned but not found'); |
73 | 73 | } |
74 | 74 | |
75 | 75 | $content = file($options['config']); |
76 | - foreach($content as $l) { |
|
76 | + foreach ($content as $l) { |
|
77 | 77 | if (preg_match('/^\s+$/', $l)) continue; // Empty lines. |
78 | 78 | if (preg_match('/^[#\/!;]/', $l)) continue; // Comments (any form). |
79 | 79 | if (preg_match('/^(.*?)=(.*)$/', $l, $matches)) { |
80 | - if (in_array($matches[1], $expectedoptions)){ |
|
80 | + if (in_array($matches[1], $expectedoptions)) { |
|
81 | 81 | $options[trim($matches[1])] = trim($matches[2]); |
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | -require_once($_configuration['root_sys'].'local/classes/database.class.php'); // cli only functions |
|
88 | -require_once($_configuration['root_sys'].'local/classes/textlib.class.php'); // cli only functions |
|
89 | -require_once($_configuration['root_sys'].'local/classes/mootochamlib.php'); // moodle like API |
|
90 | -require_once($_configuration['root_sys'] . '/plugin/vchamilo/lib/vchamilo_plugin.class.php'); |
|
87 | +require_once($_configuration['root_sys'].'local/classes/database.class.php'); // cli only functions |
|
88 | +require_once($_configuration['root_sys'].'local/classes/textlib.class.php'); // cli only functions |
|
89 | +require_once($_configuration['root_sys'].'local/classes/mootochamlib.php'); // moodle like API |
|
90 | +require_once($_configuration['root_sys'].'/plugin/vchamilo/lib/vchamilo_plugin.class.php'); |
|
91 | 91 | |
92 | 92 | global $DB; |
93 | 93 | if ($options['verbose']) echo "building database manager\n"; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | // Get main admin for further replacement. |
118 | 118 | $admin = $DB->get_record('user', array('username' => 'admin')); |
119 | 119 | |
120 | -foreach($nodes as $data) { |
|
120 | +foreach ($nodes as $data) { |
|
121 | 121 | |
122 | 122 | ctrace('Making node '.$data->root_web); |
123 | 123 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $settingrec->access_url = 1; |
164 | 164 | $settingrec->selected_value = $value; |
165 | 165 | ctrace("Setting up {$settingrec->variable}|{$settingrec->subkey} to $value\n"); |
166 | - if ($oldrec = $NDB->get_record('settings_current', array('variable' => $settingrec->variable, 'subkey' => $settingrec->subkey, 'type' => $settingrec->type))){ |
|
166 | + if ($oldrec = $NDB->get_record('settings_current', array('variable' => $settingrec->variable, 'subkey' => $settingrec->subkey, 'type' => $settingrec->type))) { |
|
167 | 167 | $settingrec->id = $oldrec->id; |
168 | 168 | $NDB->update_record('settings_current', $settingrec, 'id'); |
169 | 169 | } else { |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | |
209 | 209 | if ($interactive) { |
210 | 210 | $input = readline("Continue (y/n|r) ?\n"); |
211 | - if ($input == 'r' || $input == 'R'){ |
|
211 | + if ($input == 'r' || $input == 'R') { |
|
212 | 212 | // do nothing, just continue |
213 | - } elseif ($input == 'n' || $input == 'N'){ |
|
213 | + } elseif ($input == 'n' || $input == 'N') { |
|
214 | 214 | echo "finishing\n"; |
215 | 215 | exit; |
216 | 216 | } |