@@ -27,7 +27,7 @@ |
||
27 | 27 | $tool_name = get_lang('AddSpecificSearchField'); |
28 | 28 | |
29 | 29 | if (isset($_GET['action']) && $_GET['action'] === 'edit') { |
30 | - $tool_name = get_lang('EditSpecificSearchField'); |
|
30 | + $tool_name = get_lang('EditSpecificSearchField'); |
|
31 | 31 | } |
32 | 32 | // Create the form |
33 | 33 | $form = new FormValidator('specific_fields_add'); |
@@ -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 |
@@ -44,19 +44,19 @@ discard block |
||
44 | 44 | define('PLATFORM_ADMIN', 11); |
45 | 45 | define('SESSION_COURSE_COACH', 12); |
46 | 46 | define('SESSION_GENERAL_COACH', 13); |
47 | -define('COURSE_STUDENT', 14); //student subscribed in a course |
|
48 | -define('SESSION_STUDENT', 15); //student subscribed in a session course |
|
47 | +define('COURSE_STUDENT', 14); //student subscribed in a course |
|
48 | +define('SESSION_STUDENT', 15); //student subscribed in a session course |
|
49 | 49 | define('COURSE_TUTOR', 16); // student is tutor of a course (NOT in session) |
50 | 50 | define('STUDENT_BOSS', 17); // student is boss |
51 | 51 | define('INVITEE', 20); |
52 | 52 | |
53 | 53 | // Table of status |
54 | -$_status_list[COURSEMANAGER] = 'teacher'; // 1 |
|
55 | -$_status_list[SESSIONADMIN] = 'session_admin'; // 3 |
|
56 | -$_status_list[DRH] = 'drh'; // 4 |
|
57 | -$_status_list[STUDENT] = 'user'; // 5 |
|
58 | -$_status_list[ANONYMOUS] = 'anonymous'; // 6 |
|
59 | -$_status_list[INVITEE] = 'invited'; // 20 |
|
54 | +$_status_list[COURSEMANAGER] = 'teacher'; // 1 |
|
55 | +$_status_list[SESSIONADMIN] = 'session_admin'; // 3 |
|
56 | +$_status_list[DRH] = 'drh'; // 4 |
|
57 | +$_status_list[STUDENT] = 'user'; // 5 |
|
58 | +$_status_list[ANONYMOUS] = 'anonymous'; // 6 |
|
59 | +$_status_list[INVITEE] = 'invited'; // 20 |
|
60 | 60 | |
61 | 61 | // COURSE VISIBILITY CONSTANTS |
62 | 62 | /** only visible for course admin */ |
@@ -269,14 +269,14 @@ discard block |
||
269 | 269 | define('IS_WINDOWS_OS', api_is_windows_os()); |
270 | 270 | |
271 | 271 | // Checks for installed optional php-extensions. |
272 | -define('INTL_INSTALLED', function_exists('intl_get_error_code')); // intl extension (from PECL), it is installed by default as of PHP 5.3.0 |
|
273 | -define('ICONV_INSTALLED', function_exists('iconv')); // iconv extension, for PHP5 on Windows it is installed by default. |
|
274 | -define('MBSTRING_INSTALLED', function_exists('mb_strlen')); // mbstring extension. |
|
272 | +define('INTL_INSTALLED', function_exists('intl_get_error_code')); // intl extension (from PECL), it is installed by default as of PHP 5.3.0 |
|
273 | +define('ICONV_INSTALLED', function_exists('iconv')); // iconv extension, for PHP5 on Windows it is installed by default. |
|
274 | +define('MBSTRING_INSTALLED', function_exists('mb_strlen')); // mbstring extension. |
|
275 | 275 | |
276 | 276 | // Patterns for processing paths. // Examples: |
277 | -define('REPEATED_SLASHES_PURIFIER', '/\/{2,}/'); // $path = preg_replace(REPEATED_SLASHES_PURIFIER, '/', $path); |
|
278 | -define('VALID_WEB_PATH', '/https?:\/\/[^\/]*(\/.*)?/i'); // $is_valid_path = preg_match(VALID_WEB_PATH, $path); |
|
279 | -define('VALID_WEB_SERVER_BASE', '/https?:\/\/[^\/]*/i'); // $new_path = preg_replace(VALID_WEB_SERVER_BASE, $new_base, $path); |
|
277 | +define('REPEATED_SLASHES_PURIFIER', '/\/{2,}/'); // $path = preg_replace(REPEATED_SLASHES_PURIFIER, '/', $path); |
|
278 | +define('VALID_WEB_PATH', '/https?:\/\/[^\/]*(\/.*)?/i'); // $is_valid_path = preg_match(VALID_WEB_PATH, $path); |
|
279 | +define('VALID_WEB_SERVER_BASE', '/https?:\/\/[^\/]*/i'); // $new_path = preg_replace(VALID_WEB_SERVER_BASE, $new_base, $path); |
|
280 | 280 | |
281 | 281 | // Constants for api_get_path() and api_get_path_type(), etc. - registered path types. |
282 | 282 | define('WEB_PATH', 'WEB_PATH'); |
@@ -382,19 +382,19 @@ discard block |
||
382 | 382 | define('LINK_HOTPOTATOES', 9); |
383 | 383 | |
384 | 384 | // Score display types constants |
385 | -define('SCORE_DIV', 1); // X / Y |
|
386 | -define('SCORE_PERCENT', 2); // XX % |
|
387 | -define('SCORE_DIV_PERCENT', 3); // X / Y (XX %) |
|
388 | -define('SCORE_AVERAGE', 4); // XX % |
|
389 | -define('SCORE_DECIMAL', 5); // 0.50 (X/Y) |
|
390 | -define('SCORE_BAR', 6); // Uses the Display::bar_progress function |
|
391 | -define('SCORE_SIMPLE', 7); // X |
|
392 | -define('SCORE_IGNORE_SPLIT', 8); // ?? |
|
393 | -define('SCORE_DIV_PERCENT_WITH_CUSTOM', 9); // X / Y (XX %) - Good! |
|
394 | -define('SCORE_CUSTOM', 10); // Good! |
|
395 | -define('SCORE_DIV_SIMPLE_WITH_CUSTOM', 11); // X - Good! |
|
396 | -define('SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS', 12); // X - Good! |
|
397 | -define('SCORE_ONLY_SCORE', 13); // X - Good! |
|
385 | +define('SCORE_DIV', 1); // X / Y |
|
386 | +define('SCORE_PERCENT', 2); // XX % |
|
387 | +define('SCORE_DIV_PERCENT', 3); // X / Y (XX %) |
|
388 | +define('SCORE_AVERAGE', 4); // XX % |
|
389 | +define('SCORE_DECIMAL', 5); // 0.50 (X/Y) |
|
390 | +define('SCORE_BAR', 6); // Uses the Display::bar_progress function |
|
391 | +define('SCORE_SIMPLE', 7); // X |
|
392 | +define('SCORE_IGNORE_SPLIT', 8); // ?? |
|
393 | +define('SCORE_DIV_PERCENT_WITH_CUSTOM', 9); // X / Y (XX %) - Good! |
|
394 | +define('SCORE_CUSTOM', 10); // Good! |
|
395 | +define('SCORE_DIV_SIMPLE_WITH_CUSTOM', 11); // X - Good! |
|
396 | +define('SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS', 12); // X - Good! |
|
397 | +define('SCORE_ONLY_SCORE', 13); // X - Good! |
|
398 | 398 | |
399 | 399 | define('SCORE_BOTH', 1); |
400 | 400 | define('SCORE_ONLY_DEFAULT', 2); |
@@ -562,8 +562,8 @@ discard block |
||
562 | 562 | define('TIMELINE_STATUS_INACTIVE', '2'); |
563 | 563 | |
564 | 564 | // Event email template class |
565 | -define ('EVENT_EMAIL_TEMPLATE_ACTIVE', 1); |
|
566 | -define ('EVENT_EMAIL_TEMPLATE_INACTIVE', 0); |
|
565 | +define('EVENT_EMAIL_TEMPLATE_ACTIVE', 1); |
|
566 | +define('EVENT_EMAIL_TEMPLATE_INACTIVE', 0); |
|
567 | 567 | |
568 | 568 | // Course home |
569 | 569 | define('SHORTCUTS_HORIZONTAL', 0); |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | $sys_course_code = |
962 | 962 | isset($courseCode) // User is inside a course? |
963 | 963 | ? $courseCode // Yes, then use course's directory name. |
964 | - : '{SYS_COURSE_CODE}'; // No, then use a fake code, it may be processed later. |
|
964 | + : '{SYS_COURSE_CODE}'; // No, then use a fake code, it may be processed later. |
|
965 | 965 | $path = $matches[1].'courses/'.$sys_course_code.'/document/'.str_replace('//', '/', $matches[3].'/'.$matches[2]); |
966 | 966 | } |
967 | 967 | } |
@@ -1430,10 +1430,10 @@ discard block |
||
1430 | 1430 | |
1431 | 1431 | if (isset($user['email'])) { |
1432 | 1432 | $result['mail'] = isset($user['email']) ? $user['email'] : null; |
1433 | - $result['email'] = isset($user['email'])? $user['email'] : null; |
|
1433 | + $result['email'] = isset($user['email']) ? $user['email'] : null; |
|
1434 | 1434 | } else { |
1435 | 1435 | $result['mail'] = isset($user['mail']) ? $user['mail'] : null; |
1436 | - $result['email'] = isset($user['mail'])? $user['mail'] : null; |
|
1436 | + $result['email'] = isset($user['mail']) ? $user['mail'] : null; |
|
1437 | 1437 | } |
1438 | 1438 | $user_id = intval($user['user_id']); |
1439 | 1439 | // Maintain the user_id index for backwards compatibility |
@@ -1953,7 +1953,7 @@ discard block |
||
1953 | 1953 | foreach ($param_list1 as $key => $enreg) { |
1954 | 1954 | list ($param_list1_keys[$key], $param_list1_vals[$key]) = explode('=', $enreg); |
1955 | 1955 | } |
1956 | - $param_list1 = array ('keys' => $param_list1_keys, 'vals' => $param_list1_vals); |
|
1956 | + $param_list1 = array('keys' => $param_list1_keys, 'vals' => $param_list1_vals); |
|
1957 | 1957 | foreach ($param_list2 as $enreg) { |
1958 | 1958 | $enreg = explode('=', $enreg); |
1959 | 1959 | $key = array_search($enreg[0], $param_list1['keys']); |
@@ -1983,7 +1983,7 @@ discard block |
||
1983 | 1983 | $length = 2; |
1984 | 1984 | } |
1985 | 1985 | $password = ''; |
1986 | - for ($i = 0; $i < $length; $i ++) { |
|
1986 | + for ($i = 0; $i < $length; $i++) { |
|
1987 | 1987 | $password .= $characters[rand() % strlen($characters)]; |
1988 | 1988 | } |
1989 | 1989 | return $password; |
@@ -2010,10 +2010,10 @@ discard block |
||
2010 | 2010 | $digits = 0; |
2011 | 2011 | $consequent_characters = 0; |
2012 | 2012 | $previous_character_code = 0; |
2013 | - for ($i = 0; $i < $password_length; $i ++) { |
|
2013 | + for ($i = 0; $i < $password_length; $i++) { |
|
2014 | 2014 | $current_character_code = api_ord(api_substr($password, $i, 1)); |
2015 | 2015 | if ($i && abs($current_character_code - $previous_character_code) <= 1) { |
2016 | - $consequent_characters ++; |
|
2016 | + $consequent_characters++; |
|
2017 | 2017 | if ($consequent_characters == 3) { |
2018 | 2018 | return false; |
2019 | 2019 | } |
@@ -2021,9 +2021,9 @@ discard block |
||
2021 | 2021 | $consequent_characters = 1; |
2022 | 2022 | } |
2023 | 2023 | if ($current_character_code >= 97 && $current_character_code <= 122) { |
2024 | - $letters ++; |
|
2024 | + $letters++; |
|
2025 | 2025 | } elseif ($current_character_code >= 48 && $current_character_code <= 57) { |
2026 | - $digits ++; |
|
2026 | + $digits++; |
|
2027 | 2027 | } else { |
2028 | 2028 | return false; |
2029 | 2029 | } |
@@ -2134,7 +2134,7 @@ discard block |
||
2134 | 2134 | if (empty($session_id)) { return null; } |
2135 | 2135 | } |
2136 | 2136 | $t = Database::get_main_table(TABLE_MAIN_SESSION); |
2137 | - $s = "SELECT name FROM $t WHERE id = ".(int)$session_id; |
|
2137 | + $s = "SELECT name FROM $t WHERE id = ".(int) $session_id; |
|
2138 | 2138 | $r = Database::query($s); |
2139 | 2139 | $c = Database::num_rows($r); |
2140 | 2140 | if ($c > 0) { |
@@ -2159,7 +2159,7 @@ discard block |
||
2159 | 2159 | $sql = "SELECT * FROM $tbl_session WHERE id = $session_id"; |
2160 | 2160 | $result = Database::query($sql); |
2161 | 2161 | |
2162 | - if (Database::num_rows($result)>0) { |
|
2162 | + if (Database::num_rows($result) > 0) { |
|
2163 | 2163 | $data = Database::fetch_array($result, 'ASSOC'); |
2164 | 2164 | } |
2165 | 2165 | } |
@@ -2319,9 +2319,9 @@ discard block |
||
2319 | 2319 | */ |
2320 | 2320 | function api_get_session_image($session_id, $status_id) |
2321 | 2321 | { |
2322 | - $session_id = (int)$session_id; |
|
2322 | + $session_id = (int) $session_id; |
|
2323 | 2323 | $session_img = ''; |
2324 | - if ((int)$status_id != 5) { //check whether is not a student |
|
2324 | + if ((int) $status_id != 5) { //check whether is not a student |
|
2325 | 2325 | if ($session_id > 0) { |
2326 | 2326 | $session_img = " ".Display::return_icon( |
2327 | 2327 | 'star.png', |
@@ -2464,7 +2464,7 @@ discard block |
||
2464 | 2464 | $filename = api_get_path(SYS_PATH).api_get_home_path().'header_extra_content.txt'; |
2465 | 2465 | if (file_exists($filename)) { |
2466 | 2466 | $value = file_get_contents($filename); |
2467 | - return $value ; |
|
2467 | + return $value; |
|
2468 | 2468 | } else { |
2469 | 2469 | return ''; |
2470 | 2470 | } |
@@ -2473,7 +2473,7 @@ discard block |
||
2473 | 2473 | $filename = api_get_path(SYS_PATH).api_get_home_path().'footer_extra_content.txt'; |
2474 | 2474 | if (file_exists($filename)) { |
2475 | 2475 | $value = file_get_contents($filename); |
2476 | - return $value ; |
|
2476 | + return $value; |
|
2477 | 2477 | } else { |
2478 | 2478 | return ''; |
2479 | 2479 | } |
@@ -2686,7 +2686,7 @@ discard block |
||
2686 | 2686 | } |
2687 | 2687 | $group_id = api_get_group_id(); |
2688 | 2688 | $course_id = api_get_course_int_id(); |
2689 | - $course_code= api_get_course_id(); |
|
2689 | + $course_code = api_get_course_id(); |
|
2690 | 2690 | $session_id = api_get_session_id(); |
2691 | 2691 | |
2692 | 2692 | //Group (in course) |
@@ -2694,7 +2694,7 @@ discard block |
||
2694 | 2694 | $group_status = array(); |
2695 | 2695 | $is_subscribed = GroupManager::is_subscribed($user_id, $group_id); |
2696 | 2696 | if ($is_subscribed) { |
2697 | - $group_status = array('id'=> $group_id , 'status' => 'student'); |
|
2697 | + $group_status = array('id'=> $group_id, 'status' => 'student'); |
|
2698 | 2698 | $is_tutor = GroupManager::is_tutor_of_group($user_id, $group_id); |
2699 | 2699 | if ($is_tutor) { |
2700 | 2700 | $group_status['status'] = 'tutor'; |
@@ -2728,7 +2728,7 @@ discard block |
||
2728 | 2728 | } |
2729 | 2729 | $status['session'] = $session_status; |
2730 | 2730 | |
2731 | - } elseif($course_id) { |
|
2731 | + } elseif ($course_id) { |
|
2732 | 2732 | //Course |
2733 | 2733 | $course_status = array(); |
2734 | 2734 | if ($course_id) { |
@@ -2736,7 +2736,7 @@ discard block |
||
2736 | 2736 | |
2737 | 2737 | if ($user_course_status) { |
2738 | 2738 | $course_status = array('id'=> $course_id); |
2739 | - switch($user_course_status) { |
|
2739 | + switch ($user_course_status) { |
|
2740 | 2740 | case 1; |
2741 | 2741 | $course_status['status'] = 'teacher'; |
2742 | 2742 | break; |
@@ -2766,7 +2766,7 @@ discard block |
||
2766 | 2766 | function api_is_course_session_coach($user_id, $courseId, $session_id) |
2767 | 2767 | { |
2768 | 2768 | $session_table = Database::get_main_table(TABLE_MAIN_SESSION); |
2769 | - $session_rel_course_rel_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
2769 | + $session_rel_course_rel_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
2770 | 2770 | |
2771 | 2771 | $user_id = intval($user_id); |
2772 | 2772 | $session_id = intval($session_id); |
@@ -2838,7 +2838,7 @@ discard block |
||
2838 | 2838 | ORDER BY access_start_date, access_end_date, name"; |
2839 | 2839 | $result = Database::query($sql); |
2840 | 2840 | if (!empty($sessionIsCoach)) { |
2841 | - $sessionIsCoach = array_merge($sessionIsCoach , Database::store_result($result)); |
|
2841 | + $sessionIsCoach = array_merge($sessionIsCoach, Database::store_result($result)); |
|
2842 | 2842 | } else { |
2843 | 2843 | $sessionIsCoach = Database::store_result($result); |
2844 | 2844 | } |
@@ -3015,7 +3015,7 @@ discard block |
||
3015 | 3015 | return ''; |
3016 | 3016 | } |
3017 | 3017 | $sourceurl = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')); |
3018 | - $sourceurl = str_replace('newscorm/lp_header.php', 'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.intval($_GET['lp_id']).'&isStudentView='.($_SESSION['studentview']=='studentview' ? 'false' : 'true'), $sourceurl); |
|
3018 | + $sourceurl = str_replace('newscorm/lp_header.php', 'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.intval($_GET['lp_id']).'&isStudentView='.($_SESSION['studentview'] == 'studentview' ? 'false' : 'true'), $sourceurl); |
|
3019 | 3019 | //showinframes doesn't handle student view anyway... |
3020 | 3020 | //return ''; |
3021 | 3021 | $is_framed = true; |
@@ -3440,7 +3440,7 @@ discard block |
||
3440 | 3440 | } |
3441 | 3441 | $content .= '<div class="well_login">'; |
3442 | 3442 | $content .= $form->return_form(); |
3443 | - $content .='</div>'; |
|
3443 | + $content .= '</div>'; |
|
3444 | 3444 | if (api_is_cas_activated()) { |
3445 | 3445 | $content .= "</div>"; |
3446 | 3446 | } |
@@ -3459,7 +3459,7 @@ discard block |
||
3459 | 3459 | exit; |
3460 | 3460 | } |
3461 | 3461 | |
3462 | - if ($user_id !=0 && !api_is_anonymous()) { |
|
3462 | + if ($user_id != 0 && !api_is_anonymous()) { |
|
3463 | 3463 | $tpl->display_one_col_template(); |
3464 | 3464 | exit; |
3465 | 3465 | } |
@@ -3490,7 +3490,7 @@ discard block |
||
3490 | 3490 | } |
3491 | 3491 | $msg .= '<div class="well">'; |
3492 | 3492 | $msg .= $form->return_form(); |
3493 | - $msg .='</div>'; |
|
3493 | + $msg .= '</div>'; |
|
3494 | 3494 | if (api_is_cas_activated()) { |
3495 | 3495 | $msg .= "</div>"; |
3496 | 3496 | } |
@@ -3526,7 +3526,7 @@ discard block |
||
3526 | 3526 | list ($last_post_date, $last_post_time) = explode(' ', $last_post_datetime); |
3527 | 3527 | list ($year, $month, $day) = explode('-', $last_post_date); |
3528 | 3528 | list ($hour, $min, $sec) = explode(':', $last_post_time); |
3529 | - return mktime((int)$hour, (int)$min, (int)$sec, (int)$month, (int)$day, (int)$year); |
|
3529 | + return mktime((int) $hour, (int) $min, (int) $sec, (int) $month, (int) $day, (int) $year); |
|
3530 | 3530 | } |
3531 | 3531 | |
3532 | 3532 | /** |
@@ -3977,7 +3977,7 @@ discard block |
||
3977 | 3977 | c_id = $course_id AND |
3978 | 3978 | tool = '$tool' |
3979 | 3979 | $session_condition "; |
3980 | - $rs = Database::query($sql); |
|
3980 | + $rs = Database::query($sql); |
|
3981 | 3981 | $list = array(); |
3982 | 3982 | if (Database::num_rows($rs) > 0) { |
3983 | 3983 | while ($row = Database::fetch_array($rs, 'ASSOC')) { |
@@ -4057,7 +4057,7 @@ discard block |
||
4057 | 4057 | tool = '$tool' AND |
4058 | 4058 | ref = $ref |
4059 | 4059 | $sessionCondition"; |
4060 | - $rs = Database::query($sql); |
|
4060 | + $rs = Database::query($sql); |
|
4061 | 4061 | $item_property_id = ''; |
4062 | 4062 | if (Database::num_rows($rs) > 0) { |
4063 | 4063 | $row = Database::fetch_array($rs); |
@@ -4115,7 +4115,7 @@ discard block |
||
4115 | 4115 | WHERE item_property_id = $item_property_id AND course_id = $course_id |
4116 | 4116 | ORDER BY lastedit_date DESC"; |
4117 | 4117 | $result = Database::query($sql); |
4118 | - $result = Database::store_result($result,'ASSOC'); |
|
4118 | + $result = Database::store_result($result, 'ASSOC'); |
|
4119 | 4119 | return $result; |
4120 | 4120 | } |
4121 | 4121 | |
@@ -4165,7 +4165,7 @@ discard block |
||
4165 | 4165 | $rs = Database::query($sql); |
4166 | 4166 | $row = array(); |
4167 | 4167 | if (Database::num_rows($rs) > 0) { |
4168 | - $row = Database::fetch_array($rs,'ASSOC'); |
|
4168 | + $row = Database::fetch_array($rs, 'ASSOC'); |
|
4169 | 4169 | } |
4170 | 4170 | |
4171 | 4171 | return $row; |
@@ -4192,7 +4192,7 @@ discard block |
||
4192 | 4192 | |
4193 | 4193 | $default = api_get_user_language(); |
4194 | 4194 | |
4195 | - $ret .= '<select name="' . $name . '" id="language_chosen" class="selectpicker show-tick form-control">'; |
|
4195 | + $ret .= '<select name="'.$name.'" id="language_chosen" class="selectpicker show-tick form-control">'; |
|
4196 | 4196 | foreach ($languages as $iso => $value) { |
4197 | 4197 | if ($iso == $default) { |
4198 | 4198 | $selected = ' selected="selected"'; |
@@ -4270,8 +4270,8 @@ discard block |
||
4270 | 4270 | //--> |
4271 | 4271 | </script>'; |
4272 | 4272 | $html .= '<form id="lang_form" name="lang_form" method="post" action="'.api_get_self().'">'; |
4273 | - $html .= '<label style="display: none;" for="language_list">' . get_lang('Language') . '</label>'; |
|
4274 | - $html .= '<select id="language_list" class="selectpicker show-tick form-control" name="language_list" >'; |
|
4273 | + $html .= '<label style="display: none;" for="language_list">'.get_lang('Language').'</label>'; |
|
4274 | + $html .= '<select id="language_list" class="selectpicker show-tick form-control" name="language_list" >'; |
|
4275 | 4275 | |
4276 | 4276 | foreach ($language_list as $iso => $value) { |
4277 | 4277 | if ($iso == $user_selected_language) { |
@@ -4279,13 +4279,13 @@ discard block |
||
4279 | 4279 | } else { |
4280 | 4280 | $option_end = '>'; |
4281 | 4281 | } |
4282 | - $html .= '<option value="'.api_get_self().'?language='.$iso.'"'.$option_end; |
|
4282 | + $html .= '<option value="'.api_get_self().'?language='.$iso.'"'.$option_end; |
|
4283 | 4283 | //echo substr($value, 0, 16); // Cut string to keep 800x600 aspect. |
4284 | - $html .= $value.'</option>'; |
|
4284 | + $html .= $value.'</option>'; |
|
4285 | 4285 | } |
4286 | - $html .= '</select>'; |
|
4287 | - $html .= '<noscript><input type="submit" name="user_select_language" value="'.get_lang('Ok').'" /></noscript>'; |
|
4288 | - $html .= '</form>'; |
|
4286 | + $html .= '</select>'; |
|
4287 | + $html .= '<noscript><input type="submit" name="user_select_language" value="'.get_lang('Ok').'" /></noscript>'; |
|
4288 | + $html .= '</form>'; |
|
4289 | 4289 | return $html; |
4290 | 4290 | } |
4291 | 4291 | |
@@ -4402,7 +4402,7 @@ discard block |
||
4402 | 4402 | $rs = Database::query($sql); |
4403 | 4403 | $language_info = array(); |
4404 | 4404 | if (Database::num_rows($rs)) { |
4405 | - $language_info = Database::fetch_array($rs,'ASSOC'); |
|
4405 | + $language_info = Database::fetch_array($rs, 'ASSOC'); |
|
4406 | 4406 | } |
4407 | 4407 | return $language_info; |
4408 | 4408 | } |
@@ -4477,7 +4477,7 @@ discard block |
||
4477 | 4477 | * Note: Directory names (names of themes) in the file system should contain ASCII-characters only. |
4478 | 4478 | */ |
4479 | 4479 | function api_get_themes() { |
4480 | - $cssdir = api_get_path(SYS_CSS_PATH) . 'themes/'; |
|
4480 | + $cssdir = api_get_path(SYS_CSS_PATH).'themes/'; |
|
4481 | 4481 | $list_dir = array(); |
4482 | 4482 | $list_name = array(); |
4483 | 4483 | |
@@ -4673,7 +4673,7 @@ discard block |
||
4673 | 4673 | if (is_file($dirname) || is_link($dirname)) { |
4674 | 4674 | $res = unlink($dirname); |
4675 | 4675 | if ($res === false) { |
4676 | - error_log(__FILE__.' line '.__LINE__.': '.((bool)ini_get('track_errors') ? $php_errormsg : 'Error not recorded because track_errors is off in your php.ini'), 0); |
|
4676 | + error_log(__FILE__.' line '.__LINE__.': '.((bool) ini_get('track_errors') ? $php_errormsg : 'Error not recorded because track_errors is off in your php.ini'), 0); |
|
4677 | 4677 | } |
4678 | 4678 | return $res; |
4679 | 4679 | } |
@@ -4710,7 +4710,7 @@ discard block |
||
4710 | 4710 | if ($delete_only_content_in_folder == false) { |
4711 | 4711 | $res = rmdir($dirname); |
4712 | 4712 | if ($res === false) { |
4713 | - error_log(__FILE__.' line '.__LINE__.': '.((bool)ini_get('track_errors') ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
4713 | + error_log(__FILE__.' line '.__LINE__.': '.((bool) ini_get('track_errors') ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
4714 | 4714 | } |
4715 | 4715 | } |
4716 | 4716 | return $res; |
@@ -4788,7 +4788,7 @@ discard block |
||
4788 | 4788 | |
4789 | 4789 | $course_id = $course_info['real_id']; |
4790 | 4790 | |
4791 | - $folders = explode(DIRECTORY_SEPARATOR,str_replace($base_path_document.DIRECTORY_SEPARATOR,'',$pathname)); |
|
4791 | + $folders = explode(DIRECTORY_SEPARATOR, str_replace($base_path_document.DIRECTORY_SEPARATOR, '', $pathname)); |
|
4792 | 4792 | |
4793 | 4793 | $new_pathname = $base_path_document; |
4794 | 4794 | $path = ''; |
@@ -4806,7 +4806,7 @@ discard block |
||
4806 | 4806 | path = '$path' AND |
4807 | 4807 | filetype = 'folder' AND |
4808 | 4808 | session_id = '$session_id'"; |
4809 | - $rs1 = Database::query($sql); |
|
4809 | + $rs1 = Database::query($sql); |
|
4810 | 4810 | $num_rows = Database::num_rows($rs1); |
4811 | 4811 | |
4812 | 4812 | if ($num_rows == 0) { |
@@ -4963,7 +4963,7 @@ discard block |
||
4963 | 4963 | foreach (array('key', 'value1', 'value2', 'value3') as $var) { |
4964 | 4964 | $$var = isset($match[++$i]) ? $match[$i] : ''; |
4965 | 4965 | } |
4966 | - $value = stripslashes(substr($value1, 1, -1)) . stripslashes(substr($value2, 1, -1)) . $value3; |
|
4966 | + $value = stripslashes(substr($value1, 1, -1)).stripslashes(substr($value2, 1, -1)).$value3; |
|
4967 | 4967 | |
4968 | 4968 | // Parse array syntax. |
4969 | 4969 | $keys = preg_split('/\]?\[/', rtrim($key, ']')); |
@@ -5119,7 +5119,7 @@ discard block |
||
5119 | 5119 | $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
5120 | 5120 | $var = Database::escape_string($var); |
5121 | 5121 | $value = Database::escape_string($value); |
5122 | - $access_url = (int)$access_url; |
|
5122 | + $access_url = (int) $access_url; |
|
5123 | 5123 | if (empty($access_url)) { $access_url = 1; } |
5124 | 5124 | $select = "SELECT id FROM $t_settings WHERE variable = '$var' "; |
5125 | 5125 | if (!empty($subvar)) { |
@@ -5141,7 +5141,7 @@ discard block |
||
5141 | 5141 | // Found item for this access_url. |
5142 | 5142 | $row = Database::fetch_array($res); |
5143 | 5143 | $sql = "UPDATE $t_settings SET selected_value = '$value' |
5144 | - WHERE id = ".$row['id'] ; |
|
5144 | + WHERE id = ".$row['id']; |
|
5145 | 5145 | Database::query($sql); |
5146 | 5146 | } else { |
5147 | 5147 | // Item not found for this access_url, we have to check if it exist with access_url = 1 |
@@ -5162,11 +5162,11 @@ discard block |
||
5162 | 5162 | $row = Database::fetch_array($res); |
5163 | 5163 | $insert = "INSERT INTO $t_settings (variable, subkey, type,category, selected_value, title, comment, scope, subkeytext, access_url) |
5164 | 5164 | VALUES |
5165 | - ('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," . |
|
5166 | - "'".$row['type']."','".$row['category']."'," . |
|
5167 | - "'$value','".$row['title']."'," . |
|
5168 | - "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," . |
|
5169 | - "".(!empty($row['subkeytext'])?"'".$row['subkeytext']."'":"NULL").",$access_url)"; |
|
5165 | + ('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",". |
|
5166 | + "'".$row['type']."','".$row['category']."',". |
|
5167 | + "'$value','".$row['title']."',". |
|
5168 | + "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",". |
|
5169 | + "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url)"; |
|
5170 | 5170 | Database::query($insert); |
5171 | 5171 | } else { // Such a setting does not exist. |
5172 | 5172 | error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all', 0); |
@@ -5186,16 +5186,16 @@ discard block |
||
5186 | 5186 | if ($row['access_url_changeable'] == 1) { |
5187 | 5187 | $insert = "INSERT INTO $t_settings (variable,subkey, type,category, selected_value,title, comment,scope, subkeytext,access_url, access_url_changeable) VALUES |
5188 | 5188 | ('".$row['variable']."',". |
5189 | - (!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," . |
|
5190 | - "'".$row['type']."','".$row['category']."'," . |
|
5191 | - "'$value','".$row['title']."'," . |
|
5189 | + (!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",". |
|
5190 | + "'".$row['type']."','".$row['category']."',". |
|
5191 | + "'$value','".$row['title']."',". |
|
5192 | 5192 | "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",". |
5193 | - (!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," . |
|
5193 | + (!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",". |
|
5194 | 5194 | "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url,".$row['access_url_changeable'].")"; |
5195 | 5195 | Database::query($insert); |
5196 | 5196 | } |
5197 | 5197 | } else { // Such a setting does not exist. |
5198 | - error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ',0); |
|
5198 | + error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ', 0); |
|
5199 | 5199 | } |
5200 | 5200 | } |
5201 | 5201 | } |
@@ -5221,10 +5221,10 @@ discard block |
||
5221 | 5221 | $value = Database::escape_string($value); |
5222 | 5222 | $sql = "UPDATE $t_s SET selected_value = '$value' |
5223 | 5223 | WHERE category = '$category' AND access_url = $access_url"; |
5224 | - if (is_array($fieldtype) && count($fieldtype)>0) { |
|
5224 | + if (is_array($fieldtype) && count($fieldtype) > 0) { |
|
5225 | 5225 | $sql .= " AND ( "; |
5226 | 5226 | $i = 0; |
5227 | - foreach ($fieldtype as $type){ |
|
5227 | + foreach ($fieldtype as $type) { |
|
5228 | 5228 | if ($i > 0) { |
5229 | 5229 | $sql .= ' OR '; |
5230 | 5230 | } |
@@ -5239,10 +5239,10 @@ discard block |
||
5239 | 5239 | } else { |
5240 | 5240 | $sql = "UPDATE $t_s SET selected_value = NULL |
5241 | 5241 | WHERE category = '$category' AND access_url = $access_url"; |
5242 | - if (is_array($fieldtype) && count($fieldtype)>0) { |
|
5242 | + if (is_array($fieldtype) && count($fieldtype) > 0) { |
|
5243 | 5243 | $sql .= " AND ( "; |
5244 | 5244 | $i = 0; |
5245 | - foreach ($fieldtype as $type){ |
|
5245 | + foreach ($fieldtype as $type) { |
|
5246 | 5246 | if ($i > 0) { |
5247 | 5247 | $sql .= ' OR '; |
5248 | 5248 | } |
@@ -5388,7 +5388,7 @@ discard block |
||
5388 | 5388 | function & api_get_settings_categories($exceptions = array(), $access_url = 1) { |
5389 | 5389 | $access_url = (int) $access_url; |
5390 | 5390 | $t_cs = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
5391 | - $list = "'".implode("','",$exceptions)."'"; |
|
5391 | + $list = "'".implode("','", $exceptions)."'"; |
|
5392 | 5392 | $sql = "SELECT DISTINCT category FROM $t_cs WHERE category is NOT NULL "; |
5393 | 5393 | if ($list != "'',''" && $list != "''" && !empty($list)) { |
5394 | 5394 | $sql .= " AND category NOT IN ($list) "; |
@@ -5484,12 +5484,12 @@ discard block |
||
5484 | 5484 | |
5485 | 5485 | // Item not found for this access_url, we have to check if the whole thing is missing |
5486 | 5486 | // (in which case we ignore the insert) or if there *is* a record but just for access_url = 1 |
5487 | - $insert = "INSERT INTO $t_settings " . |
|
5488 | - "(variable,selected_value," . |
|
5489 | - "type,category," . |
|
5490 | - "subkey,title," . |
|
5491 | - "comment,scope," . |
|
5492 | - "subkeytext,access_url,access_url_changeable)" . |
|
5487 | + $insert = "INSERT INTO $t_settings ". |
|
5488 | + "(variable,selected_value,". |
|
5489 | + "type,category,". |
|
5490 | + "subkey,title,". |
|
5491 | + "comment,scope,". |
|
5492 | + "subkeytext,access_url,access_url_changeable)". |
|
5493 | 5493 | " VALUES ('$var','$val',"; |
5494 | 5494 | if (isset($type)) { |
5495 | 5495 | $type = Database::escape_string($type); |
@@ -5655,7 +5655,7 @@ discard block |
||
5655 | 5655 | $result = Database::query($sql); |
5656 | 5656 | |
5657 | 5657 | //if ($row = Database::fetch_array($result)) { |
5658 | - if (Database::num_rows($result) > 0 ) { |
|
5658 | + if (Database::num_rows($result) > 0) { |
|
5659 | 5659 | $is_courseMember = true; |
5660 | 5660 | $is_courseTutor = true; |
5661 | 5661 | $is_courseCoach = true; |
@@ -5975,7 +5975,7 @@ discard block |
||
5975 | 5975 | } else { |
5976 | 5976 | return false; |
5977 | 5977 | } |
5978 | - return strtolower(substr((string)$os, 0, 3 )) == 'win'; |
|
5978 | + return strtolower(substr((string) $os, 0, 3)) == 'win'; |
|
5979 | 5979 | } |
5980 | 5980 | |
5981 | 5981 | /** |
@@ -6514,7 +6514,7 @@ discard block |
||
6514 | 6514 | function api_get_jquery_ui_js($include_jqgrid = false) { |
6515 | 6515 | $libraries = array(); |
6516 | 6516 | if ($include_jqgrid) { |
6517 | - $libraries[]='jqgrid'; |
|
6517 | + $libraries[] = 'jqgrid'; |
|
6518 | 6518 | } |
6519 | 6519 | return api_get_jquery_libraries_js($libraries); |
6520 | 6520 | } |
@@ -6536,12 +6536,12 @@ discard block |
||
6536 | 6536 | |
6537 | 6537 | //jqgrid js and css |
6538 | 6538 | if (in_array('jqgrid', $libraries)) { |
6539 | - $language = 'en'; |
|
6539 | + $language = 'en'; |
|
6540 | 6540 | $isoCode = strtolower(api_get_language_isocode()); |
6541 | 6541 | |
6542 | 6542 | // languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n |
6543 | 6543 | $langs = array( |
6544 | - 'bg', 'bg1251', 'cat','cn','cs','da','de','el','en','es','fa','fi','fr','gl','he','hu','is','it','ja','nl','no','pl','pt-br','pt','ro','ru','sk','sr','sv','tr','ua' |
|
6544 | + 'bg', 'bg1251', 'cat', 'cn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'gl', 'he', 'hu', 'is', 'it', 'ja', 'nl', 'no', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sr', 'sv', 'tr', 'ua' |
|
6545 | 6545 | ); |
6546 | 6546 | |
6547 | 6547 | if (in_array($isoCode, $langs)) { |
@@ -6554,7 +6554,7 @@ discard block |
||
6554 | 6554 | |
6555 | 6555 | // jquery datepicker |
6556 | 6556 | if (in_array('datepicker', $libraries)) { |
6557 | - $language = 'en-GB'; |
|
6557 | + $language = 'en-GB'; |
|
6558 | 6558 | $isoCode = strtolower(api_get_language_isocode()); |
6559 | 6559 | |
6560 | 6560 | // languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n |
@@ -6655,7 +6655,7 @@ discard block |
||
6655 | 6655 | $clean_url = str_replace('/', '-', $clean_url); |
6656 | 6656 | $clean_url .= '/'; |
6657 | 6657 | |
6658 | - $home = 'app/home/' . $clean_url; |
|
6658 | + $home = 'app/home/'.$clean_url; |
|
6659 | 6659 | |
6660 | 6660 | } |
6661 | 6661 | |
@@ -6722,7 +6722,7 @@ discard block |
||
6722 | 6722 | * @return void |
6723 | 6723 | */ |
6724 | 6724 | function api_check_php_version($my_inc_path = null) { |
6725 | - if (!function_exists('version_compare') || version_compare( phpversion(), REQUIRED_PHP_VERSION, '<')) { |
|
6725 | + if (!function_exists('version_compare') || version_compare(phpversion(), REQUIRED_PHP_VERSION, '<')) { |
|
6726 | 6726 | $global_error_code = 1; |
6727 | 6727 | // Incorrect PHP version |
6728 | 6728 | $global_page = $my_inc_path.'global_error_message.inc.php'; |
@@ -6738,7 +6738,7 @@ discard block |
||
6738 | 6738 | */ |
6739 | 6739 | function api_check_archive_dir() { |
6740 | 6740 | if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) && !is_writable(api_get_path(SYS_ARCHIVE_PATH))) { |
6741 | - $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'),'warning'); |
|
6741 | + $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'), 'warning'); |
|
6742 | 6742 | api_not_allowed(true, $message); |
6743 | 6743 | } |
6744 | 6744 | } |
@@ -6803,7 +6803,7 @@ discard block |
||
6803 | 6803 | * @author Jorge Frisancho Jibaja <[email protected]>, USIL - Some changes to allow the use of real IP using reverse proxy |
6804 | 6804 | * @version CEV CHANGE 24APR2012 |
6805 | 6805 | */ |
6806 | -function api_get_real_ip(){ |
|
6806 | +function api_get_real_ip() { |
|
6807 | 6807 | // Guess the IP if behind a reverse proxy |
6808 | 6808 | global $debug; |
6809 | 6809 | $ip = trim($_SERVER['REMOTE_ADDR']); |
@@ -6828,23 +6828,23 @@ discard block |
||
6828 | 6828 | * @author Yannick Warnier for improvements and managment of multiple ranges |
6829 | 6829 | * @todo check for IPv6 support |
6830 | 6830 | */ |
6831 | -function api_check_ip_in_range($ip,$range) |
|
6831 | +function api_check_ip_in_range($ip, $range) |
|
6832 | 6832 | { |
6833 | 6833 | if (empty($ip) or empty($range)) { |
6834 | 6834 | return false; |
6835 | 6835 | } |
6836 | - $ip_ip = ip2long ($ip); |
|
6836 | + $ip_ip = ip2long($ip); |
|
6837 | 6837 | // divide range param into array of elements |
6838 | - if (strpos($range,',')!==false) { |
|
6839 | - $ranges = explode(',',$range); |
|
6838 | + if (strpos($range, ',') !== false) { |
|
6839 | + $ranges = explode(',', $range); |
|
6840 | 6840 | } else { |
6841 | 6841 | $ranges = array($range); |
6842 | 6842 | } |
6843 | 6843 | foreach ($ranges as $range) { |
6844 | 6844 | $range = trim($range); |
6845 | 6845 | if (empty($range)) { continue; } |
6846 | - if (strpos($range,'/')===false) { |
|
6847 | - if (strcmp($ip,$range)===0) { |
|
6846 | + if (strpos($range, '/') === false) { |
|
6847 | + if (strcmp($ip, $range) === 0) { |
|
6848 | 6848 | return true; // there is a direct IP match, return OK |
6849 | 6849 | } |
6850 | 6850 | continue; //otherwise, get to the next range |
@@ -6852,7 +6852,7 @@ discard block |
||
6852 | 6852 | // the range contains a "/", so analyse completely |
6853 | 6853 | list ($net, $mask) = explode("/", $range); |
6854 | 6854 | |
6855 | - $ip_net = ip2long ($net); |
|
6855 | + $ip_net = ip2long($net); |
|
6856 | 6856 | // mask binary magic |
6857 | 6857 | $ip_mask = ~((1 << (32 - $mask)) - 1); |
6858 | 6858 | |
@@ -7126,14 +7126,14 @@ discard block |
||
7126 | 7126 | * @assert (0) === true |
7127 | 7127 | * @assert ('1G') === true |
7128 | 7128 | */ |
7129 | -function api_set_memory_limit($mem){ |
|
7129 | +function api_set_memory_limit($mem) { |
|
7130 | 7130 | //if ini_set() not available, this function is useless |
7131 | 7131 | if (!function_exists('ini_set') || is_null($mem) || $mem == -1) { |
7132 | 7132 | return false; |
7133 | 7133 | } |
7134 | 7134 | |
7135 | 7135 | $memory_limit = ini_get('memory_limit'); |
7136 | - if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)){ |
|
7136 | + if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)) { |
|
7137 | 7137 | ini_set('memory_limit', $mem); |
7138 | 7138 | return true; |
7139 | 7139 | } |
@@ -7150,21 +7150,21 @@ discard block |
||
7150 | 7150 | * @assert ('1m') === 1048576 |
7151 | 7151 | * @assert ('100k') === 102400 |
7152 | 7152 | */ |
7153 | -function api_get_bytes_memory_limit($mem){ |
|
7154 | - $size = strtolower(substr($mem,-1)); |
|
7153 | +function api_get_bytes_memory_limit($mem) { |
|
7154 | + $size = strtolower(substr($mem, -1)); |
|
7155 | 7155 | |
7156 | 7156 | switch ($size) { |
7157 | 7157 | case 't': |
7158 | - $mem = intval(substr($mem,-1))*1024*1024*1024*1024; |
|
7158 | + $mem = intval(substr($mem, -1)) * 1024 * 1024 * 1024 * 1024; |
|
7159 | 7159 | break; |
7160 | 7160 | case 'g': |
7161 | - $mem = intval(substr($mem,0,-1))*1024*1024*1024; |
|
7161 | + $mem = intval(substr($mem, 0, -1)) * 1024 * 1024 * 1024; |
|
7162 | 7162 | break; |
7163 | 7163 | case 'm': |
7164 | - $mem = intval(substr($mem,0,-1))*1024*1024; |
|
7164 | + $mem = intval(substr($mem, 0, -1)) * 1024 * 1024; |
|
7165 | 7165 | break; |
7166 | 7166 | case 'k': |
7167 | - $mem = intval(substr($mem,0,-1))*1024; |
|
7167 | + $mem = intval(substr($mem, 0, -1)) * 1024; |
|
7168 | 7168 | break; |
7169 | 7169 | default: |
7170 | 7170 | // we assume it's integer only |
@@ -7219,7 +7219,7 @@ discard block |
||
7219 | 7219 | get_lang('PasswordVeryStrong'), |
7220 | 7220 | ); |
7221 | 7221 | $js = api_get_js('js/strength/strength.js'); |
7222 | - $js .= "<script> |
|
7222 | + $js .= "<script> |
|
7223 | 7223 | |
7224 | 7224 | var verdicts = ['".implode("','", $verdicts)."']; |
7225 | 7225 | var errorMessages = { |
@@ -7275,7 +7275,7 @@ discard block |
||
7275 | 7275 | return false; |
7276 | 7276 | } |
7277 | 7277 | $minutesToBlock = api_get_setting('captcha_time_to_block'); |
7278 | - $time = time() + $minutesToBlock*60; |
|
7278 | + $time = time() + $minutesToBlock * 60; |
|
7279 | 7279 | UserManager::update_extra_field_value( |
7280 | 7280 | $userInfo['user_id'], |
7281 | 7281 | 'captcha_blocked_until_date', |
@@ -7348,7 +7348,7 @@ discard block |
||
7348 | 7348 | $out_res = str_replace('"', "''", $out_res); |
7349 | 7349 | } |
7350 | 7350 | // avoid text stuck together when tags are removed, adding a space after > |
7351 | - $out_res = str_replace (">", "> ", $out_res); |
|
7351 | + $out_res = str_replace(">", "> ", $out_res); |
|
7352 | 7352 | $out_res = strip_tags($out_res); |
7353 | 7353 | |
7354 | 7354 | return $out_res; |
@@ -7459,12 +7459,12 @@ discard block |
||
7459 | 7459 | { |
7460 | 7460 | // Clean query |
7461 | 7461 | $bt = debug_backtrace(); |
7462 | - $caller = array_shift($bt);; |
|
7462 | + $caller = array_shift($bt); ; |
|
7463 | 7463 | if ($dump == 1) { |
7464 | 7464 | $string = print_r($string, 1); |
7465 | 7465 | } else { |
7466 | 7466 | $string = str_replace(array("\r", "\n", "\t", "\10"), '', $string); |
7467 | - $string = str_replace(' ',' ', $string); |
|
7467 | + $string = str_replace(' ', ' ', $string); |
|
7468 | 7468 | } |
7469 | 7469 | |
7470 | 7470 | error_log("-------------------------------------"); |
@@ -7566,7 +7566,7 @@ discard block |
||
7566 | 7566 | $subject = get_lang('HostingWarningReached'); |
7567 | 7567 | $body = get_lang('PortalName').': '.api_get_path(WEB_PATH)." \n "; |
7568 | 7568 | $body .= get_lang('PortalLimitType').': '.$limitName." \n "; |
7569 | - $body .= get_lang('Value') . ': ' . $limit; |
|
7569 | + $body .= get_lang('Value').': '.$limit; |
|
7570 | 7570 | |
7571 | 7571 | api_mail_html(null, $email, $subject, $body); |
7572 | 7572 | } |
@@ -7690,7 +7690,7 @@ discard block |
||
7690 | 7690 | */ |
7691 | 7691 | function api_set_site_use_cookie_warning_cookie() |
7692 | 7692 | { |
7693 | - setcookie("ChamiloUsesCookies", "ok", time()+31556926); |
|
7693 | + setcookie("ChamiloUsesCookies", "ok", time() + 31556926); |
|
7694 | 7694 | } |
7695 | 7695 | |
7696 | 7696 | /** |
@@ -7738,10 +7738,10 @@ discard block |
||
7738 | 7738 | return false; |
7739 | 7739 | } |
7740 | 7740 | |
7741 | - $fullPath = $parentDirectory . api_replace_dangerous_char($name); |
|
7741 | + $fullPath = $parentDirectory.api_replace_dangerous_char($name); |
|
7742 | 7742 | |
7743 | 7743 | if (mkdir($fullPath, api_get_permissions_for_new_directories(), true)) { |
7744 | - $fp = fopen($fullPath . '/index.html', 'w'); |
|
7744 | + $fp = fopen($fullPath.'/index.html', 'w'); |
|
7745 | 7745 | |
7746 | 7746 | if ($fp) { |
7747 | 7747 | if (fwrite($fp, '<html><head></head><body></body></html>')) { |
@@ -8027,13 +8027,13 @@ discard block |
||
8027 | 8027 | * @param int $key key to find to compare |
8028 | 8028 | * |
8029 | 8029 | */ |
8030 | -function api_unique_multidim_array($array, $key){ |
|
8030 | +function api_unique_multidim_array($array, $key) { |
|
8031 | 8031 | $temp_array = array(); |
8032 | 8032 | $i = 0; |
8033 | 8033 | $key_array = array(); |
8034 | 8034 | |
8035 | - foreach($array as $val){ |
|
8036 | - if(!in_array($val[$key],$key_array)){ |
|
8035 | + foreach ($array as $val) { |
|
8036 | + if (!in_array($val[$key], $key_array)) { |
|
8037 | 8037 | $key_array[$i] = $val[$key]; |
8038 | 8038 | $temp_array[$i] = $val; |
8039 | 8039 | } |
@@ -14,36 +14,36 @@ discard block |
||
14 | 14 | api_protect_admin_script(); |
15 | 15 | |
16 | 16 | // Breadcrumb |
17 | -$interbreadcrumb[] = array ('url' => Container::getRouter()->generate('administration'), 'name' => get_lang('PlatformAdmin')); |
|
18 | -$interbreadcrumb[] = array ('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings')); |
|
17 | +$interbreadcrumb[] = array('url' => Container::getRouter()->generate('administration'), 'name' => get_lang('PlatformAdmin')); |
|
18 | +$interbreadcrumb[] = array('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings')); |
|
19 | 19 | |
20 | 20 | $libpath = api_get_path(LIBRARY_PATH); |
21 | 21 | |
22 | 22 | include_once $libpath.'specific_fields_manager.lib.php'; |
23 | 23 | |
24 | 24 | // Create an add-field box |
25 | -$form = new FormValidator('add_field','post','','',null,false); |
|
26 | -$renderer =& $form->defaultRenderer(); |
|
25 | +$form = new FormValidator('add_field', 'post', '', '', null, false); |
|
26 | +$renderer = & $form->defaultRenderer(); |
|
27 | 27 | $renderer->setCustomElementTemplate('<span>{element}</span> '); |
28 | -$form->addElement('static','search_advanced_link',null,'<a href="specific_fields_add.php">'.Display::return_icon('fieldadd.gif').get_lang('AddSpecificSearchField').'</a>'); |
|
28 | +$form->addElement('static', 'search_advanced_link', null, '<a href="specific_fields_add.php">'.Display::return_icon('fieldadd.gif').get_lang('AddSpecificSearchField').'</a>'); |
|
29 | 29 | |
30 | 30 | // Create a sortable table with specific fields data |
31 | -$column_show = array(1,1,1); |
|
32 | -$column_order = array(3,2,1); |
|
31 | +$column_show = array(1, 1, 1); |
|
32 | +$column_order = array(3, 2, 1); |
|
33 | 33 | $extra_fields = get_specific_field_list(); |
34 | 34 | $number_of_extra_fields = count($extra_fields); |
35 | 35 | |
36 | -$table = new SortableTableFromArrayConfig($extra_fields,2,50,'',$column_show,$column_order); |
|
37 | -$table->set_header(0, ' ', false,null,'width="2%"', 'style="display:none"'); |
|
36 | +$table = new SortableTableFromArrayConfig($extra_fields, 2, 50, '', $column_show, $column_order); |
|
37 | +$table->set_header(0, ' ', false, null, 'width="2%"', 'style="display:none"'); |
|
38 | 38 | $table->set_header(1, get_lang('Code'), TRUE, 'width="10%"'); |
39 | 39 | $table->set_header(2, get_lang('Name')); |
40 | -$table->set_header(3, get_lang('Modify'),false,'width="10%"'); |
|
40 | +$table->set_header(3, get_lang('Modify'), false, 'width="10%"'); |
|
41 | 41 | $table->set_column_filter(3, 'edit_filter'); |
42 | 42 | |
43 | -function edit_filter($id,$url_params,$row) { |
|
43 | +function edit_filter($id, $url_params, $row) { |
|
44 | 44 | global $charset; |
45 | - $return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>'; |
|
46 | - $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>'; |
|
45 | + $return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>'; |
|
46 | + $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>'; |
|
47 | 47 | return $return; |
48 | 48 | } |
49 | 49 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | Display::display_header(get_lang('SpecificSearchFields')); |
60 | 60 | echo Display::display_normal_message(get_lang('SpecificSearchFieldsIntro')); |
61 | 61 | |
62 | -if(!empty($_GET['message'])) { |
|
62 | +if (!empty($_GET['message'])) { |
|
63 | 63 | Display::display_confirmation_message($_GET['message']); |
64 | 64 | } |
65 | 65 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public $feedback_type; |
30 | 30 | public $end_time; |
31 | 31 | public $start_time; |
32 | - public $questionList; // array with the list of this exercise's questions |
|
32 | + public $questionList; // array with the list of this exercise's questions |
|
33 | 33 | public $results_disabled; |
34 | 34 | public $expired_time; |
35 | 35 | public $course; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST); |
100 | 100 | $table_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
101 | 101 | |
102 | - $id = intval($id); |
|
102 | + $id = intval($id); |
|
103 | 103 | if (empty($this->course_id)) { |
104 | 104 | return false; |
105 | 105 | } |
@@ -156,17 +156,17 @@ discard block |
||
156 | 156 | } |
157 | 157 | |
158 | 158 | if ($object->end_time != '0000-00-00 00:00:00') { |
159 | - $this->end_time = $object->end_time; |
|
159 | + $this->end_time = $object->end_time; |
|
160 | 160 | } |
161 | 161 | if ($object->start_time != '0000-00-00 00:00:00') { |
162 | - $this->start_time = $object->start_time; |
|
162 | + $this->start_time = $object->start_time; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | //control time |
166 | - $this->expired_time = $object->expired_time; |
|
166 | + $this->expired_time = $object->expired_time; |
|
167 | 167 | |
168 | 168 | //Checking if question_order is correctly set |
169 | - $this->questionList = $this->selectQuestionList(true); |
|
169 | + $this->questionList = $this->selectQuestionList(true); |
|
170 | 170 | |
171 | 171 | //overload questions list with recorded questions list |
172 | 172 | //load questions only for exercises of type 'one question per page' |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | */ |
385 | 385 | public function isRandom() |
386 | 386 | { |
387 | - if($this->random > 0 || $this->random == -1) { |
|
387 | + if ($this->random > 0 || $this->random == -1) { |
|
388 | 388 | return true; |
389 | 389 | } else { |
390 | 390 | return false; |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | public function selectQuestionList($from_db = false) |
430 | 430 | { |
431 | 431 | if ($from_db && !empty($this->id)) { |
432 | - $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
|
432 | + $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
|
433 | 433 | $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
434 | 434 | |
435 | 435 | $sql = "SELECT DISTINCT e.question_order |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $question_list = array(); |
457 | 457 | |
458 | 458 | while ($new_object = Database::fetch_object($result)) { |
459 | - $question_list[$new_object->question_order]= $new_object->question_id; |
|
459 | + $question_list[$new_object->question_order] = $new_object->question_id; |
|
460 | 460 | $temp_question_list[$counter] = $new_object->question_id; |
461 | 461 | $counter++; |
462 | 462 | } |
@@ -502,16 +502,16 @@ discard block |
||
502 | 502 | */ |
503 | 503 | public function selectRandomList() |
504 | 504 | { |
505 | - $nbQuestions = $this->selectNbrQuestions(); |
|
506 | - $temp_list = $this->questionList; |
|
505 | + $nbQuestions = $this->selectNbrQuestions(); |
|
506 | + $temp_list = $this->questionList; |
|
507 | 507 | |
508 | 508 | //Not a random exercise, or if there are not at least 2 questions |
509 | - if($this->random == 0 || $nbQuestions < 2) { |
|
509 | + if ($this->random == 0 || $nbQuestions < 2) { |
|
510 | 510 | return $this->questionList; |
511 | 511 | } |
512 | 512 | if ($nbQuestions != 0) { |
513 | 513 | shuffle($temp_list); |
514 | - $my_random_list = array_combine(range(1,$nbQuestions),$temp_list); |
|
514 | + $my_random_list = array_combine(range(1, $nbQuestions), $temp_list); |
|
515 | 515 | $my_question_list = array(); |
516 | 516 | // $this->random == -1 if random with all questions |
517 | 517 | if ($this->random > 0) { |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | public function isInList($questionId) |
542 | 542 | { |
543 | 543 | if (is_array($this->questionList)) |
544 | - return in_array($questionId,$this->questionList); |
|
544 | + return in_array($questionId, $this->questionList); |
|
545 | 545 | else |
546 | 546 | return false; |
547 | 547 | } |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | */ |
555 | 555 | public function updateTitle($title) |
556 | 556 | { |
557 | - $this->exercise=$title; |
|
557 | + $this->exercise = $title; |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | /** |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | */ |
565 | 565 | public function updateAttempts($attempts) |
566 | 566 | { |
567 | - $this->attempts=$attempts; |
|
567 | + $this->attempts = $attempts; |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | /** |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | */ |
575 | 575 | public function updateFeedbackType($feedback_type) |
576 | 576 | { |
577 | - $this->feedback_type=$feedback_type; |
|
577 | + $this->feedback_type = $feedback_type; |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | /** |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | */ |
586 | 586 | public function updateDescription($description) |
587 | 587 | { |
588 | - $this->description=$description; |
|
588 | + $this->description = $description; |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | /** |
@@ -630,23 +630,23 @@ discard block |
||
630 | 630 | * @param string $sound - exercise sound file |
631 | 631 | * @param string $delete - ask to delete the file |
632 | 632 | */ |
633 | - public function updateSound($sound,$delete) |
|
633 | + public function updateSound($sound, $delete) |
|
634 | 634 | { |
635 | 635 | global $audioPath, $documentPath; |
636 | 636 | $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
637 | 637 | |
638 | - if ($sound['size'] && (strstr($sound['type'],'audio') || strstr($sound['type'],'video'))) { |
|
639 | - $this->sound=$sound['name']; |
|
638 | + if ($sound['size'] && (strstr($sound['type'], 'audio') || strstr($sound['type'], 'video'))) { |
|
639 | + $this->sound = $sound['name']; |
|
640 | 640 | |
641 | - if (@move_uploaded_file($sound['tmp_name'],$audioPath.'/'.$this->sound)) { |
|
641 | + if (@move_uploaded_file($sound['tmp_name'], $audioPath.'/'.$this->sound)) { |
|
642 | 642 | $query = "SELECT 1 FROM $TBL_DOCUMENT |
643 | - WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath,'',$audioPath).'/'.$this->sound."'"; |
|
644 | - $result=Database::query($query); |
|
643 | + WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath, '', $audioPath).'/'.$this->sound."'"; |
|
644 | + $result = Database::query($query); |
|
645 | 645 | |
646 | 646 | if (!Database::num_rows($result)) { |
647 | 647 | $id = add_document( |
648 | 648 | $this->course, |
649 | - str_replace($documentPath,'',$audioPath).'/'.$this->sound, |
|
649 | + str_replace($documentPath, '', $audioPath).'/'.$this->sound, |
|
650 | 650 | 'file', |
651 | 651 | $sound['size'], |
652 | 652 | $sound['name'] |
@@ -665,8 +665,8 @@ discard block |
||
665 | 665 | ); |
666 | 666 | } |
667 | 667 | } |
668 | - } elseif($delete && is_file($audioPath.'/'.$this->sound)) { |
|
669 | - $this->sound=''; |
|
668 | + } elseif ($delete && is_file($audioPath.'/'.$this->sound)) { |
|
669 | + $this->sound = ''; |
|
670 | 670 | } |
671 | 671 | } |
672 | 672 | |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | */ |
679 | 679 | public function updateType($type) |
680 | 680 | { |
681 | - $this->type=$type; |
|
681 | + $this->type = $type; |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | /** |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | */ |
715 | 715 | public function enable() |
716 | 716 | { |
717 | - $this->active=1; |
|
717 | + $this->active = 1; |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | /** |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | */ |
725 | 725 | public function disable() |
726 | 726 | { |
727 | - $this->active=0; |
|
727 | + $this->active = 0; |
|
728 | 728 | } |
729 | 729 | |
730 | 730 | /** |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | public function removeFromList($questionId) |
991 | 991 | { |
992 | 992 | // searches the position of the question ID in the list |
993 | - $pos = array_search($questionId,$this->questionList); |
|
993 | + $pos = array_search($questionId, $this->questionList); |
|
994 | 994 | |
995 | 995 | // question not found |
996 | 996 | if ($pos === false) { |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | * Creates the form to create / edit an exercise |
1038 | 1038 | * @param FormValidator $form |
1039 | 1039 | */ |
1040 | - public function createForm($form, $type='full') |
|
1040 | + public function createForm($form, $type = 'full') |
|
1041 | 1041 | { |
1042 | 1042 | if (empty($type)) { |
1043 | 1043 | $type = 'full'; |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | 'Width' => '100%', |
1069 | 1069 | 'Height' => '150', |
1070 | 1070 | ); |
1071 | - if (is_array($type)){ |
|
1071 | + if (is_array($type)) { |
|
1072 | 1072 | $editor_config = array_merge($editor_config, $type); |
1073 | 1073 | } |
1074 | 1074 | |
@@ -1122,13 +1122,13 @@ discard block |
||
1122 | 1122 | '2', |
1123 | 1123 | array('id' => 'exerciseType_2') |
1124 | 1124 | ); |
1125 | - $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions')), ''); |
|
1125 | + $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions')), ''); |
|
1126 | 1126 | |
1127 | 1127 | // Type of results display on the final page |
1128 | 1128 | $radios_results_disabled = array(); |
1129 | 1129 | $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0')); |
1130 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()')); |
|
1131 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2')); |
|
1130 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()')); |
|
1131 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2')); |
|
1132 | 1132 | //$radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ExamModeWithFinalScoreShowOnlyFinalScoreWithCategoriesIfAvailable'), '3', array('id'=>'result_disabled_3','onclick' => 'check_results_disabled()')); |
1133 | 1133 | |
1134 | 1134 | $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), ''); |
@@ -1136,8 +1136,8 @@ discard block |
||
1136 | 1136 | // Type of questions disposition on page |
1137 | 1137 | $radios = array(); |
1138 | 1138 | |
1139 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
1140 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
1139 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
1140 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
1141 | 1141 | |
1142 | 1142 | $form->addGroup($radios, null, get_lang('QuestionsPerPage'), ''); |
1143 | 1143 | |
@@ -1147,33 +1147,33 @@ discard block |
||
1147 | 1147 | |
1148 | 1148 | // feedback type |
1149 | 1149 | $radios_feedback = array(); |
1150 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'),'0',array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()')); |
|
1150 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'), '0', array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()')); |
|
1151 | 1151 | |
1152 | 1152 | if (api_get_setting('exercise.enable_quiz_scenario') == 'true') { |
1153 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1' , 'onclick' => 'check_direct_feedback()')); |
|
1153 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1', 'onclick' => 'check_direct_feedback()')); |
|
1154 | 1154 | } |
1155 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'),'2',array('id' =>'exerciseType_2')); |
|
1156 | - $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions'))); |
|
1155 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'), '2', array('id' =>'exerciseType_2')); |
|
1156 | + $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions'))); |
|
1157 | 1157 | |
1158 | 1158 | //$form->addElement('select', 'exerciseFeedbackType',get_lang('FeedbackType'),$feedback_option,'onchange="javascript:feedbackselection()"'); |
1159 | 1159 | $radios_results_disabled = array(); |
1160 | 1160 | $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0')); |
1161 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()')); |
|
1162 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()')); |
|
1163 | - $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'),''); |
|
1161 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()')); |
|
1162 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()')); |
|
1163 | + $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), ''); |
|
1164 | 1164 | |
1165 | 1165 | // Type of questions disposition on page |
1166 | 1166 | $radios = array(); |
1167 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1'); |
|
1168 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2'); |
|
1167 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1'); |
|
1168 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2'); |
|
1169 | 1169 | $form->addGroup($radios, null, get_lang('ExerciseType')); |
1170 | 1170 | |
1171 | 1171 | } else { |
1172 | 1172 | //Show options freeze |
1173 | 1173 | $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0')); |
1174 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()')); |
|
1175 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()')); |
|
1176 | - $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'),''); |
|
1174 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()')); |
|
1175 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()')); |
|
1176 | + $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), ''); |
|
1177 | 1177 | $result_disable_group->freeze(); |
1178 | 1178 | |
1179 | 1179 | //we force the options to the DirectFeedback exercisetype |
@@ -1181,8 +1181,8 @@ discard block |
||
1181 | 1181 | $form->addElement('hidden', 'exerciseType', ONE_PER_PAGE); |
1182 | 1182 | |
1183 | 1183 | // Type of questions disposition on page |
1184 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
1185 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
1184 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
1185 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
1186 | 1186 | |
1187 | 1187 | $type_group = $form->addGroup($radios, null, get_lang('QuestionsPerPage'), ''); |
1188 | 1188 | $type_group->freeze(); |
@@ -1191,26 +1191,26 @@ discard block |
||
1191 | 1191 | |
1192 | 1192 | // number of random question |
1193 | 1193 | |
1194 | - $max = ($this->id > 0) ? $this->selectNbrQuestions() : 10 ; |
|
1195 | - $option = range(0,$max); |
|
1194 | + $max = ($this->id > 0) ? $this->selectNbrQuestions() : 10; |
|
1195 | + $option = range(0, $max); |
|
1196 | 1196 | $option[0] = get_lang('No'); |
1197 | 1197 | $option[-1] = get_lang('AllQuestionsShort'); |
1198 | - $form->addElement('select', 'randomQuestions',array(get_lang('RandomQuestions'), get_lang('RandomQuestionsHelp')), $option, array('id'=>'randomQuestions')); |
|
1198 | + $form->addElement('select', 'randomQuestions', array(get_lang('RandomQuestions'), get_lang('RandomQuestionsHelp')), $option, array('id'=>'randomQuestions')); |
|
1199 | 1199 | |
1200 | 1200 | // Random answers |
1201 | 1201 | $radios_random_answers = array(); |
1202 | - $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('Yes'),'1'); |
|
1203 | - $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('No'),'0'); |
|
1202 | + $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('Yes'), '1'); |
|
1203 | + $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('No'), '0'); |
|
1204 | 1204 | $form->addGroup($radios_random_answers, null, get_lang('RandomAnswers'), ''); |
1205 | 1205 | |
1206 | 1206 | // Random by category |
1207 | - $form->addElement('html','<div class="clear"> </div>'); |
|
1207 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
1208 | 1208 | $radiocat = array(); |
1209 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesShuffled'),'1'); |
|
1210 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesSorted'),'2'); |
|
1211 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('No'),'0'); |
|
1209 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesShuffled'), '1'); |
|
1210 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesSorted'), '2'); |
|
1211 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('No'), '0'); |
|
1212 | 1212 | $radioCatGroup = $form->addGroup($radiocat, null, get_lang('RandomQuestionByCategory'), ''); |
1213 | - $form->addElement('html','<div class="clear"> </div>'); |
|
1213 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
1214 | 1214 | |
1215 | 1215 | // add the radio display the category name for student |
1216 | 1216 | $radio_display_cat_name = array(); |
@@ -1231,36 +1231,36 @@ discard block |
||
1231 | 1231 | ); |
1232 | 1232 | |
1233 | 1233 | // Exercise time limit |
1234 | - $form->addElement('checkbox', 'activate_start_date_check',null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()')); |
|
1234 | + $form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()')); |
|
1235 | 1235 | |
1236 | 1236 | $var = Exercise::selectTimeLimit(); |
1237 | 1237 | |
1238 | 1238 | if (($this->start_time != '0000-00-00 00:00:00')) |
1239 | - $form->addElement('html','<div id="start_date_div" style="display:block;">'); |
|
1239 | + $form->addElement('html', '<div id="start_date_div" style="display:block;">'); |
|
1240 | 1240 | else |
1241 | - $form->addElement('html','<div id="start_date_div" style="display:none;">'); |
|
1241 | + $form->addElement('html', '<div id="start_date_div" style="display:none;">'); |
|
1242 | 1242 | |
1243 | 1243 | $form->addElement('date_time_picker', 'start_time'); |
1244 | 1244 | |
1245 | - $form->addElement('html','</div>'); |
|
1245 | + $form->addElement('html', '</div>'); |
|
1246 | 1246 | |
1247 | - $form->addElement('checkbox', 'activate_end_date_check', null , get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
|
1247 | + $form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
|
1248 | 1248 | |
1249 | 1249 | if (($this->end_time != '0000-00-00 00:00:00')) |
1250 | - $form->addElement('html','<div id="end_date_div" style="display:block;">'); |
|
1250 | + $form->addElement('html', '<div id="end_date_div" style="display:block;">'); |
|
1251 | 1251 | else |
1252 | - $form->addElement('html','<div id="end_date_div" style="display:none;">'); |
|
1252 | + $form->addElement('html', '<div id="end_date_div" style="display:none;">'); |
|
1253 | 1253 | |
1254 | 1254 | $form->addElement('date_time_picker', 'end_time'); |
1255 | - $form->addElement('html','</div>'); |
|
1255 | + $form->addElement('html', '</div>'); |
|
1256 | 1256 | |
1257 | 1257 | //$check_option=$this->selectType(); |
1258 | 1258 | $diplay = 'block'; |
1259 | 1259 | $form->addElement('checkbox', 'propagate_neg', null, get_lang('PropagateNegativeResults')); |
1260 | - $form->addElement('html','<div class="clear"> </div>'); |
|
1260 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
1261 | 1261 | $form->addElement('checkbox', 'review_answers', null, get_lang('ReviewAnswers')); |
1262 | 1262 | |
1263 | - $form->addElement('html','<div id="divtimecontrol" style="display:'.$diplay.';">'); |
|
1263 | + $form->addElement('html', '<div id="divtimecontrol" style="display:'.$diplay.';">'); |
|
1264 | 1264 | |
1265 | 1265 | //Timer control |
1266 | 1266 | //$time_hours_option = range(0,12); |
@@ -1276,12 +1276,12 @@ discard block |
||
1276 | 1276 | 'onload' => 'check_load_time()', |
1277 | 1277 | ) |
1278 | 1278 | ); |
1279 | - $expired_date = (int)$this->selectExpiredTime(); |
|
1279 | + $expired_date = (int) $this->selectExpiredTime(); |
|
1280 | 1280 | |
1281 | - if (($expired_date!='0')) { |
|
1282 | - $form->addElement('html','<div id="timercontrol" style="display:block;">'); |
|
1281 | + if (($expired_date != '0')) { |
|
1282 | + $form->addElement('html', '<div id="timercontrol" style="display:block;">'); |
|
1283 | 1283 | } else { |
1284 | - $form->addElement('html','<div id="timercontrol" style="display:none;">'); |
|
1284 | + $form->addElement('html', '<div id="timercontrol" style="display:none;">'); |
|
1285 | 1285 | } |
1286 | 1286 | $form->addText( |
1287 | 1287 | 'enabletimercontroltotalminutes', |
@@ -1292,7 +1292,7 @@ discard block |
||
1292 | 1292 | 'cols-size' => [2, 2, 8] |
1293 | 1293 | ] |
1294 | 1294 | ); |
1295 | - $form->addElement('html','</div>'); |
|
1295 | + $form->addElement('html', '</div>'); |
|
1296 | 1296 | |
1297 | 1297 | $form->addElement( |
1298 | 1298 | 'text', |
@@ -1314,23 +1314,23 @@ discard block |
||
1314 | 1314 | $defaults = array(); |
1315 | 1315 | |
1316 | 1316 | if (api_get_setting('search.search_enabled') === 'true') { |
1317 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
1317 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
1318 | 1318 | |
1319 | - $form->addElement ('checkbox', 'index_document','', get_lang('SearchFeatureDoIndexDocument')); |
|
1320 | - $form->addElement ('select_language', 'language', get_lang('SearchFeatureDocumentLanguage')); |
|
1319 | + $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument')); |
|
1320 | + $form->addElement('select_language', 'language', get_lang('SearchFeatureDocumentLanguage')); |
|
1321 | 1321 | |
1322 | 1322 | $specific_fields = get_specific_field_list(); |
1323 | 1323 | |
1324 | 1324 | foreach ($specific_fields as $specific_field) { |
1325 | - $form->addElement ('text', $specific_field['code'], $specific_field['name']); |
|
1325 | + $form->addElement('text', $specific_field['code'], $specific_field['name']); |
|
1326 | 1326 | $filter = array( |
1327 | 1327 | 'c_id' => api_get_course_int_id(), |
1328 | 1328 | 'field_id' => $specific_field['id'], |
1329 | 1329 | 'ref_id' => $this->id, |
1330 | - 'tool_id' => "'" . TOOL_QUIZ . "'" |
|
1330 | + 'tool_id' => "'".TOOL_QUIZ."'" |
|
1331 | 1331 | ); |
1332 | 1332 | $values = get_specific_field_values_list($filter, array('value')); |
1333 | - if ( !empty($values) ) { |
|
1333 | + if (!empty($values)) { |
|
1334 | 1334 | $arr_str_values = array(); |
1335 | 1335 | foreach ($values as $value) { |
1336 | 1336 | $arr_str_values[] = $value['value']; |
@@ -1341,8 +1341,8 @@ discard block |
||
1341 | 1341 | //$form->addElement ('html','</div>'); |
1342 | 1342 | } |
1343 | 1343 | |
1344 | - $form->addElement('html','</div>'); //End advanced setting |
|
1345 | - $form->addElement('html','</div>'); |
|
1344 | + $form->addElement('html', '</div>'); //End advanced setting |
|
1345 | + $form->addElement('html', '</div>'); |
|
1346 | 1346 | } |
1347 | 1347 | |
1348 | 1348 | // submit |
@@ -1362,10 +1362,10 @@ discard block |
||
1362 | 1362 | } |
1363 | 1363 | |
1364 | 1364 | // defaults |
1365 | - if ($type=='full') { |
|
1365 | + if ($type == 'full') { |
|
1366 | 1366 | if ($this->id > 0) { |
1367 | 1367 | if ($this->random > $this->selectNbrQuestions()) { |
1368 | - $defaults['randomQuestions'] = $this->selectNbrQuestions(); |
|
1368 | + $defaults['randomQuestions'] = $this->selectNbrQuestions(); |
|
1369 | 1369 | } else { |
1370 | 1370 | $defaults['randomQuestions'] = $this->random; |
1371 | 1371 | } |
@@ -1391,8 +1391,8 @@ discard block |
||
1391 | 1391 | $defaults['activate_end_date_check'] = 1; |
1392 | 1392 | } |
1393 | 1393 | |
1394 | - $defaults['start_time'] = ($this->start_time!='0000-00-00 00:00:00') ? api_get_local_time($this->start_time) : date('Y-m-d 12:00:00'); |
|
1395 | - $defaults['end_time'] = ($this->end_time!='0000-00-00 00:00:00') ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time()+84600); |
|
1394 | + $defaults['start_time'] = ($this->start_time != '0000-00-00 00:00:00') ? api_get_local_time($this->start_time) : date('Y-m-d 12:00:00'); |
|
1395 | + $defaults['end_time'] = ($this->end_time != '0000-00-00 00:00:00') ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time() + 84600); |
|
1396 | 1396 | |
1397 | 1397 | // Get expired time |
1398 | 1398 | if ($this->expired_time != '0') { |
@@ -1413,7 +1413,7 @@ discard block |
||
1413 | 1413 | $defaults['text_when_finished'] = ""; |
1414 | 1414 | $defaults['start_time'] = date('Y-m-d 12:00:00'); |
1415 | 1415 | $defaults['display_category_name'] = 1; |
1416 | - $defaults['end_time'] = date('Y-m-d 12:00:00', time()+84600); |
|
1416 | + $defaults['end_time'] = date('Y-m-d 12:00:00', time() + 84600); |
|
1417 | 1417 | $defaults['pass_percentage'] = ''; |
1418 | 1418 | } |
1419 | 1419 | } else { |
@@ -1480,7 +1480,7 @@ discard block |
||
1480 | 1480 | $end_time = $form->getSubmitValue('end_time'); |
1481 | 1481 | $this->end_time = api_get_utc_datetime($end_time); |
1482 | 1482 | } else { |
1483 | - $this->end_time = '0000-00-00 00:00:00'; |
|
1483 | + $this->end_time = '0000-00-00 00:00:00'; |
|
1484 | 1484 | } |
1485 | 1485 | |
1486 | 1486 | if ($form->getSubmitValue('enabletimercontrol') == 1) { |
@@ -1493,9 +1493,9 @@ discard block |
||
1493 | 1493 | } |
1494 | 1494 | |
1495 | 1495 | if ($form->getSubmitValue('randomAnswers') == 1) { |
1496 | - $this->random_answers=1; |
|
1496 | + $this->random_answers = 1; |
|
1497 | 1497 | } else { |
1498 | - $this->random_answers=0; |
|
1498 | + $this->random_answers = 0; |
|
1499 | 1499 | } |
1500 | 1500 | $this->save($type); |
1501 | 1501 | } |
@@ -1510,9 +1510,9 @@ discard block |
||
1510 | 1510 | |
1511 | 1511 | $course = $em->find('ChamiloCoreBundle:Course', api_get_course_int_id()); |
1512 | 1512 | |
1513 | - require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'; |
|
1514 | - require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'; |
|
1515 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
1513 | + require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
|
1514 | + require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'; |
|
1515 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
1516 | 1516 | |
1517 | 1517 | $specific_fields = get_specific_field_list(); |
1518 | 1518 | $ic_slide = new IndexableChunk(); |
@@ -1522,7 +1522,7 @@ discard block |
||
1522 | 1522 | if (isset($_REQUEST[$specific_field['code']])) { |
1523 | 1523 | $sterms = trim($_REQUEST[$specific_field['code']]); |
1524 | 1524 | if (!empty($sterms)) { |
1525 | - $all_specific_terms .= ' '. $sterms; |
|
1525 | + $all_specific_terms .= ' '.$sterms; |
|
1526 | 1526 | $sterms = explode(',', $sterms); |
1527 | 1527 | foreach ($sterms as $sterm) { |
1528 | 1528 | $ic_slide->addTerm(trim($sterm), $specific_field['code']); |
@@ -1539,15 +1539,15 @@ discard block |
||
1539 | 1539 | $xapian_data = array( |
1540 | 1540 | SE_COURSE_ID => $course->getCode(), |
1541 | 1541 | SE_TOOL_ID => TOOL_QUIZ, |
1542 | - SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id), |
|
1543 | - SE_USER => (int)api_get_user_id(), |
|
1542 | + SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id), |
|
1543 | + SE_USER => (int) api_get_user_id(), |
|
1544 | 1544 | ); |
1545 | 1545 | $ic_slide->xapian_data = serialize($xapian_data); |
1546 | - $exercise_description = $all_specific_terms .' '. $this->description; |
|
1546 | + $exercise_description = $all_specific_terms.' '.$this->description; |
|
1547 | 1547 | $ic_slide->addValue("content", $exercise_description); |
1548 | 1548 | |
1549 | 1549 | $di = new ChamiloIndexer(); |
1550 | - isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english'; |
|
1550 | + isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; |
|
1551 | 1551 | $di->connectDb(NULL, NULL, $lang); |
1552 | 1552 | $di->addChunk($ic_slide); |
1553 | 1553 | |
@@ -1589,9 +1589,9 @@ discard block |
||
1589 | 1589 | ]); |
1590 | 1590 | |
1591 | 1591 | if ($se_ref) { |
1592 | - require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'); |
|
1593 | - require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'); |
|
1594 | - require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'); |
|
1592 | + require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'); |
|
1593 | + require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'); |
|
1594 | + require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'); |
|
1595 | 1595 | |
1596 | 1596 | $specific_fields = get_specific_field_list(); |
1597 | 1597 | $ic_slide = new IndexableChunk(); |
@@ -1606,7 +1606,7 @@ discard block |
||
1606 | 1606 | ); |
1607 | 1607 | if (isset($_REQUEST[$specific_field['code']])) { |
1608 | 1608 | $sterms = trim($_REQUEST[$specific_field['code']]); |
1609 | - $all_specific_terms .= ' '. $sterms; |
|
1609 | + $all_specific_terms .= ' '.$sterms; |
|
1610 | 1610 | $sterms = explode(',', $sterms); |
1611 | 1611 | foreach ($sterms as $sterm) { |
1612 | 1612 | $ic_slide->addTerm(trim($sterm), $specific_field['code']); |
@@ -1628,15 +1628,15 @@ discard block |
||
1628 | 1628 | $xapian_data = array( |
1629 | 1629 | SE_COURSE_ID => $course->getCode(), |
1630 | 1630 | SE_TOOL_ID => TOOL_QUIZ, |
1631 | - SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id), |
|
1632 | - SE_USER => (int)api_get_user_id(), |
|
1631 | + SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id), |
|
1632 | + SE_USER => (int) api_get_user_id(), |
|
1633 | 1633 | ); |
1634 | 1634 | $ic_slide->xapian_data = serialize($xapian_data); |
1635 | - $exercise_description = $all_specific_terms .' '. $this->description; |
|
1635 | + $exercise_description = $all_specific_terms.' '.$this->description; |
|
1636 | 1636 | $ic_slide->addValue("content", $exercise_description); |
1637 | 1637 | |
1638 | 1638 | $di = new ChamiloIndexer(); |
1639 | - isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english'; |
|
1639 | + isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; |
|
1640 | 1640 | $di->connectDb(NULL, NULL, $lang); |
1641 | 1641 | $di->remove_document($se_ref->getSearchDid()); |
1642 | 1642 | $di->addChunk($ic_slide); |
@@ -1687,19 +1687,19 @@ discard block |
||
1687 | 1687 | |
1688 | 1688 | if (count($res) > 0) { |
1689 | 1689 | $row = current($res); |
1690 | - require_once(api_get_path(LIBRARY_PATH) .'search/ChamiloIndexer.class.php'); |
|
1690 | + require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'); |
|
1691 | 1691 | $di = new ChamiloIndexer(); |
1692 | 1692 | $di->remove_document($row->getSearchDid()); |
1693 | 1693 | unset($di); |
1694 | 1694 | $tbl_quiz_question = Database::get_course_table(TABLE_QUIZ_QUESTION); |
1695 | - foreach ( $this->questionList as $question_i) { |
|
1695 | + foreach ($this->questionList as $question_i) { |
|
1696 | 1696 | $sql = 'SELECT type FROM %s WHERE id=%s'; |
1697 | 1697 | $sql = sprintf($sql, $tbl_quiz_question, $question_i); |
1698 | 1698 | $qres = Database::query($sql); |
1699 | 1699 | if (Database::num_rows($qres) > 0) { |
1700 | 1700 | $qrow = Database::fetch_array($qres); |
1701 | 1701 | $objQuestion = Question::getInstance($qrow['type']); |
1702 | - $objQuestion = Question::read((int)$question_i); |
|
1702 | + $objQuestion = Question::read((int) $question_i); |
|
1703 | 1703 | $objQuestion->search_engine_edit($this->id, FALSE, TRUE); |
1704 | 1704 | unset($objQuestion); |
1705 | 1705 | } |
@@ -1716,7 +1716,7 @@ discard block |
||
1716 | 1716 | ->execute([1 => $course, 2 => TOOL_QUIZ, 3 => $this->id]); |
1717 | 1717 | |
1718 | 1718 | // remove terms from db |
1719 | - require_once api_get_path(LIBRARY_PATH) .'specific_fields_manager.lib.php'; |
|
1719 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
1720 | 1720 | delete_all_values_for_item($course->getCode(), TOOL_QUIZ, $this->id); |
1721 | 1721 | } |
1722 | 1722 | } |
@@ -1817,7 +1817,7 @@ discard block |
||
1817 | 1817 | */ |
1818 | 1818 | public function copy_exercise() |
1819 | 1819 | { |
1820 | - $exercise_obj= new Exercise(); |
|
1820 | + $exercise_obj = new Exercise(); |
|
1821 | 1821 | $exercise_obj = $this; |
1822 | 1822 | |
1823 | 1823 | // force the creation of a new exercise |
@@ -1889,25 +1889,25 @@ discard block |
||
1889 | 1889 | $lp_id = 0; |
1890 | 1890 | } |
1891 | 1891 | if (empty($lp_item_id)) { |
1892 | - $lp_item_id = 0; |
|
1892 | + $lp_item_id = 0; |
|
1893 | 1893 | } |
1894 | 1894 | if (empty($lp_item_view_id)) { |
1895 | 1895 | $lp_item_view_id = 0; |
1896 | 1896 | } |
1897 | - $condition = ' WHERE exe_exo_id = ' . "'" . $this->id . "'" .' AND |
|
1898 | - exe_user_id = ' . "'" . api_get_user_id() . "'" . ' AND |
|
1899 | - c_id = ' . api_get_course_int_id() . ' AND |
|
1900 | - status = ' . "'" . Database::escape_string($status). "'" . ' AND |
|
1901 | - orig_lp_id = ' . "'" . $lp_id . "'" . ' AND |
|
1902 | - orig_lp_item_id = ' . "'" . $lp_item_id . "'" . ' AND |
|
1903 | - orig_lp_item_view_id = ' . "'" . $lp_item_view_id . "'" . ' AND |
|
1904 | - session_id = ' . "'" . api_get_session_id() . "' LIMIT 1"; //Adding limit 1 just in case |
|
1897 | + $condition = ' WHERE exe_exo_id = '."'".$this->id."'".' AND |
|
1898 | + exe_user_id = ' . "'".api_get_user_id()."'".' AND |
|
1899 | + c_id = ' . api_get_course_int_id().' AND |
|
1900 | + status = ' . "'".Database::escape_string($status)."'".' AND |
|
1901 | + orig_lp_id = ' . "'".$lp_id."'".' AND |
|
1902 | + orig_lp_item_id = ' . "'".$lp_item_id."'".' AND |
|
1903 | + orig_lp_item_view_id = ' . "'".$lp_item_view_id."'".' AND |
|
1904 | + session_id = ' . "'".api_get_session_id()."' LIMIT 1"; //Adding limit 1 just in case |
|
1905 | 1905 | |
1906 | 1906 | $sql_track = 'SELECT * FROM '.$track_exercises.$condition; |
1907 | 1907 | |
1908 | 1908 | $result = Database::query($sql_track); |
1909 | 1909 | $new_array = array(); |
1910 | - if (Database::num_rows($result) > 0 ) { |
|
1910 | + if (Database::num_rows($result) > 0) { |
|
1911 | 1911 | $new_array = Database::fetch_array($result, 'ASSOC'); |
1912 | 1912 | $new_array['num_exe'] = Database::num_rows($result); |
1913 | 1913 | } |
@@ -1950,12 +1950,12 @@ discard block |
||
1950 | 1950 | $questionList = array_map('intval', $questionList); |
1951 | 1951 | |
1952 | 1952 | $params = array( |
1953 | - 'exe_exo_id' => $this->id , |
|
1953 | + 'exe_exo_id' => $this->id, |
|
1954 | 1954 | 'exe_user_id' => api_get_user_id(), |
1955 | 1955 | 'c_id' => api_get_course_int_id(), |
1956 | 1956 | 'status' => 'incomplete', |
1957 | 1957 | 'session_id' => api_get_session_id(), |
1958 | - 'data_tracking' => implode(',', $questionList) , |
|
1958 | + 'data_tracking' => implode(',', $questionList), |
|
1959 | 1959 | 'start_date' => api_get_utc_datetime(), |
1960 | 1960 | 'orig_lp_id' => $safe_lp_id, |
1961 | 1961 | 'orig_lp_item_id' => $safe_lp_item_id, |
@@ -1987,7 +1987,7 @@ discard block |
||
1987 | 1987 | $nbrQuestions = $this->get_count_question_list(); |
1988 | 1988 | |
1989 | 1989 | $all_button = $html = $label = ''; |
1990 | - $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']):null; |
|
1990 | + $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']) : null; |
|
1991 | 1991 | |
1992 | 1992 | if ($this->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT && $this->type == ONE_PER_PAGE) { |
1993 | 1993 | $urlTitle = get_lang('ContinueTest'); |
@@ -1998,7 +1998,7 @@ discard block |
||
1998 | 1998 | |
1999 | 1999 | $html .= Display::url( |
2000 | 2000 | $urlTitle, |
2001 | - 'exercise_submit_modal.php?' . http_build_query([ |
|
2001 | + 'exercise_submit_modal.php?'.http_build_query([ |
|
2002 | 2002 | 'learnpath_id' => $safe_lp_id, |
2003 | 2003 | 'learnpath_item_id' => $safe_lp_item_id, |
2004 | 2004 | 'learnpath_item_view_id' => $safe_lp_item_view_id, |
@@ -2015,7 +2015,7 @@ discard block |
||
2015 | 2015 | 'data-size' => 'md' |
2016 | 2016 | ] |
2017 | 2017 | ); |
2018 | - $html .='<br />'; |
|
2018 | + $html .= '<br />'; |
|
2019 | 2019 | } else { |
2020 | 2020 | // User |
2021 | 2021 | if (api_is_allowed_to_session_edit()) { |
@@ -2040,7 +2040,7 @@ discard block |
||
2040 | 2040 | |
2041 | 2041 | //Next question |
2042 | 2042 | if (!empty($questions_in_media)) { |
2043 | - $questions_in_media = "['".implode("','",$questions_in_media)."']"; |
|
2043 | + $questions_in_media = "['".implode("','", $questions_in_media)."']"; |
|
2044 | 2044 | $all_button .= ' <a href="javascript://" class="'.$class.'" onclick="save_question_list('.$questions_in_media.'); ">'.$label.'</a>'; |
2045 | 2045 | } else { |
2046 | 2046 | $all_button .= ' <a href="javascript://" class="'.$class.'" onclick="save_now('.$question_id.', \'\', \''.$currentAnswer.'\'); ">'.$label.'</a>'; |
@@ -2058,7 +2058,7 @@ discard block |
||
2058 | 2058 | } |
2059 | 2059 | $class .= ' question-validate-btn'; // used to select it with jquery |
2060 | 2060 | $all_button = ' <a href="javascript://" class="'.$class.'" onclick="validate_all(); ">'.$all_label.'</a>'; |
2061 | - $all_button .= ' ' . Display::span(null, ['id' => 'save_all_reponse']); |
|
2061 | + $all_button .= ' '.Display::span(null, ['id' => 'save_all_reponse']); |
|
2062 | 2062 | $html .= $all_button; |
2063 | 2063 | } |
2064 | 2064 | } |
@@ -2302,8 +2302,8 @@ discard block |
||
2302 | 2302 | $params = array(); |
2303 | 2303 | $params['course_id'] = $course_id; |
2304 | 2304 | $params['session_id'] = api_get_session_id(); |
2305 | - $params['user_id'] = isset($exe_info['exe_user_id'])? $exe_info['exe_user_id'] : api_get_user_id(); |
|
2306 | - $params['exercise_id'] = isset($exe_info['exe_exo_id'])? $exe_info['exe_exo_id'] : $this->id; |
|
2305 | + $params['user_id'] = isset($exe_info['exe_user_id']) ? $exe_info['exe_user_id'] : api_get_user_id(); |
|
2306 | + $params['exercise_id'] = isset($exe_info['exe_exo_id']) ? $exe_info['exe_exo_id'] : $this->id; |
|
2307 | 2307 | $params['question_id'] = $questionId; |
2308 | 2308 | $params['exe_id'] = isset($exe_info['exe_id']) ? $exe_info['exe_id'] : $exeId; |
2309 | 2309 | |
@@ -2359,10 +2359,10 @@ discard block |
||
2359 | 2359 | $answer = $objAnswerTmp->selectAnswer($answerId); |
2360 | 2360 | $answerComment = $objAnswerTmp->selectComment($answerId); |
2361 | 2361 | $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
2362 | - $answerWeighting = (float)$objAnswerTmp->selectWeighting($answerId); |
|
2362 | + $answerWeighting = (float) $objAnswerTmp->selectWeighting($answerId); |
|
2363 | 2363 | $answerAutoId = $objAnswerTmp->selectAutoId($answerId); |
2364 | 2364 | |
2365 | - $answer_correct_array[$answerId] = (bool)$answerCorrect; |
|
2365 | + $answer_correct_array[$answerId] = (bool) $answerCorrect; |
|
2366 | 2366 | |
2367 | 2367 | if ($debug) { |
2368 | 2368 | error_log("answer auto id: $answerAutoId "); |
@@ -2371,7 +2371,7 @@ discard block |
||
2371 | 2371 | |
2372 | 2372 | // Delineation |
2373 | 2373 | $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1); |
2374 | - $answer_delineation_destination=$objAnswerTmp->selectDestination(1); |
|
2374 | + $answer_delineation_destination = $objAnswerTmp->selectDestination(1); |
|
2375 | 2375 | |
2376 | 2376 | switch ($answerType) { |
2377 | 2377 | // for unique answer |
@@ -2384,7 +2384,7 @@ discard block |
||
2384 | 2384 | exe_id = '".$exeId."' AND |
2385 | 2385 | question_id= '".$questionId."'"; |
2386 | 2386 | $result = Database::query($sql); |
2387 | - $choice = Database::result($result,0,"answer"); |
|
2387 | + $choice = Database::result($result, 0, "answer"); |
|
2388 | 2388 | |
2389 | 2389 | $studentChoice = $choice == $answerAutoId ? 1 : 0; |
2390 | 2390 | if ($studentChoice) { |
@@ -2435,7 +2435,7 @@ discard block |
||
2435 | 2435 | } else { |
2436 | 2436 | // If no result then the user just hit don't know |
2437 | 2437 | $studentChoice = 3; |
2438 | - $questionScore += $doubt_score; |
|
2438 | + $questionScore += $doubt_score; |
|
2439 | 2439 | } |
2440 | 2440 | $totalScore = $questionScore; |
2441 | 2441 | break; |
@@ -2451,17 +2451,17 @@ discard block |
||
2451 | 2451 | } |
2452 | 2452 | |
2453 | 2453 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
2454 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
2454 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
2455 | 2455 | |
2456 | 2456 | if ($studentChoice) { |
2457 | - $questionScore +=$answerWeighting; |
|
2457 | + $questionScore += $answerWeighting; |
|
2458 | 2458 | } |
2459 | 2459 | } else { |
2460 | 2460 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
2461 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
2461 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
2462 | 2462 | |
2463 | 2463 | if (isset($studentChoice)) { |
2464 | - $questionScore += $answerWeighting; |
|
2464 | + $questionScore += $answerWeighting; |
|
2465 | 2465 | } |
2466 | 2466 | } |
2467 | 2467 | $totalScore += $answerWeighting; |
@@ -2479,16 +2479,16 @@ discard block |
||
2479 | 2479 | $choice[$ind] = 1; |
2480 | 2480 | } |
2481 | 2481 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
2482 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
2482 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
2483 | 2483 | if ($studentChoice) { |
2484 | - $questionScore +=$answerWeighting; |
|
2484 | + $questionScore += $answerWeighting; |
|
2485 | 2485 | } |
2486 | 2486 | } else { |
2487 | 2487 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
2488 | 2488 | if (isset($studentChoice)) { |
2489 | 2489 | $questionScore += $answerWeighting; |
2490 | 2490 | } |
2491 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
2491 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
2492 | 2492 | } |
2493 | 2493 | $totalScore += $answerWeighting; |
2494 | 2494 | if ($debug) error_log("studentChoice: $studentChoice"); |
@@ -2500,7 +2500,7 @@ discard block |
||
2500 | 2500 | $resultans = Database::query($sql); |
2501 | 2501 | while ($row = Database::fetch_array($resultans)) { |
2502 | 2502 | $ind = $row['answer']; |
2503 | - $result = explode(':',$ind); |
|
2503 | + $result = explode(':', $ind); |
|
2504 | 2504 | if (isset($result[0])) { |
2505 | 2505 | $my_answer_id = isset($result[0]) ? $result[0] : ''; |
2506 | 2506 | $option = isset($result[1]) ? $result[1] : ''; |
@@ -2621,10 +2621,10 @@ discard block |
||
2621 | 2621 | } |
2622 | 2622 | // adds the piece of text that is before the blank |
2623 | 2623 | //and ends with '[' into a general storage array |
2624 | - $real_text[] = api_substr($temp, 0, $pos +1); |
|
2625 | - $answer .= api_substr($temp, 0, $pos +1); |
|
2624 | + $real_text[] = api_substr($temp, 0, $pos + 1); |
|
2625 | + $answer .= api_substr($temp, 0, $pos + 1); |
|
2626 | 2626 | //take the string remaining (after the last "[" we found) |
2627 | - $temp = api_substr($temp, $pos +1); |
|
2627 | + $temp = api_substr($temp, $pos + 1); |
|
2628 | 2628 | // quit the loop if there are no more blanks, and update $pos to the position of next ']' |
2629 | 2629 | if (($pos = api_strpos($temp, ']')) === false) { |
2630 | 2630 | // adds the end of the text |
@@ -2660,7 +2660,7 @@ discard block |
||
2660 | 2660 | //put the contents of the [] answer tag into correct_tags[] |
2661 | 2661 | $correct_tags[] = api_substr($temp, 0, $pos); |
2662 | 2662 | $j++; |
2663 | - $temp = api_substr($temp, $pos +1); |
|
2663 | + $temp = api_substr($temp, $pos + 1); |
|
2664 | 2664 | } |
2665 | 2665 | $answer = ''; |
2666 | 2666 | $real_correct_tags = $correct_tags; |
@@ -2683,7 +2683,7 @@ discard block |
||
2683 | 2683 | } elseif (!empty($user_tags[$i])) { |
2684 | 2684 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
2685 | 2685 | // adds the word in red at the end of the string, and strikes it |
2686 | - $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>'; |
|
2686 | + $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>'; |
|
2687 | 2687 | } else { |
2688 | 2688 | // adds a tabulation if no word has been typed by the student |
2689 | 2689 | $answer .= ''; // remove that causes issue |
@@ -2702,17 +2702,17 @@ discard block |
||
2702 | 2702 | } elseif (!empty ($user_tags[$i])) { |
2703 | 2703 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
2704 | 2704 | // adds the word in red at the end of the string, and strikes it |
2705 | - $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>'; |
|
2705 | + $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>'; |
|
2706 | 2706 | } else { |
2707 | 2707 | // adds a tabulation if no word has been typed by the student |
2708 | - $answer .= ''; // remove that causes issue |
|
2708 | + $answer .= ''; // remove that causes issue |
|
2709 | 2709 | } |
2710 | 2710 | } |
2711 | 2711 | |
2712 | 2712 | // adds the correct word, followed by ] to close the blank |
2713 | - $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]'; |
|
2714 | - if (isset($real_text[$i +1])) { |
|
2715 | - $answer .= $real_text[$i +1]; |
|
2713 | + $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]'; |
|
2714 | + if (isset($real_text[$i + 1])) { |
|
2715 | + $answer .= $real_text[$i + 1]; |
|
2716 | 2716 | } |
2717 | 2717 | } |
2718 | 2718 | } else { |
@@ -2849,10 +2849,10 @@ discard block |
||
2849 | 2849 | } |
2850 | 2850 | // adds the piece of text that is before the blank |
2851 | 2851 | //and ends with '[' into a general storage array |
2852 | - $realText[] = api_substr($temp, 0, $pos +1); |
|
2853 | - $answer .= api_substr($temp, 0, $pos +1); |
|
2852 | + $realText[] = api_substr($temp, 0, $pos + 1); |
|
2853 | + $answer .= api_substr($temp, 0, $pos + 1); |
|
2854 | 2854 | //take the string remaining (after the last "[" we found) |
2855 | - $temp = api_substr($temp, $pos +1); |
|
2855 | + $temp = api_substr($temp, $pos + 1); |
|
2856 | 2856 | // quit the loop if there are no more blanks, and update $pos to the position of next ']' |
2857 | 2857 | if (($pos = api_strpos($temp, ']')) === false) { |
2858 | 2858 | // adds the end of the text |
@@ -2886,7 +2886,7 @@ discard block |
||
2886 | 2886 | //put the contents of the [] answer tag into correct_tags[] |
2887 | 2887 | $correctTags[] = api_substr($temp, 0, $pos); |
2888 | 2888 | $j++; |
2889 | - $temp = api_substr($temp, $pos +1); |
|
2889 | + $temp = api_substr($temp, $pos + 1); |
|
2890 | 2890 | } |
2891 | 2891 | $answer = ''; |
2892 | 2892 | $realCorrectTags = $correctTags; |
@@ -2906,22 +2906,22 @@ discard block |
||
2906 | 2906 | } elseif (!empty($userTags[$i])) { |
2907 | 2907 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
2908 | 2908 | // adds the word in red at the end of the string, and strikes it |
2909 | - $answer .= '<font color="red"><s>' . $userTags[$i] . '</s></font>'; |
|
2909 | + $answer .= '<font color="red"><s>'.$userTags[$i].'</s></font>'; |
|
2910 | 2910 | } else { |
2911 | 2911 | // adds a tabulation if no word has been typed by the student |
2912 | 2912 | $answer .= ''; // remove that causes issue |
2913 | 2913 | } |
2914 | 2914 | // adds the correct word, followed by ] to close the blank |
2915 | - $answer .= ' / <font color="green"><b>' . $realCorrectTags[$i] . '</b></font>]'; |
|
2916 | - if (isset($realText[$i +1])) { |
|
2917 | - $answer .= $realText[$i +1]; |
|
2915 | + $answer .= ' / <font color="green"><b>'.$realCorrectTags[$i].'</b></font>]'; |
|
2916 | + if (isset($realText[$i + 1])) { |
|
2917 | + $answer .= $realText[$i + 1]; |
|
2918 | 2918 | } |
2919 | 2919 | } |
2920 | 2920 | break; |
2921 | 2921 | // for free answer |
2922 | 2922 | case FREE_ANSWER: |
2923 | 2923 | if ($from_database) { |
2924 | - $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
|
2924 | + $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
|
2925 | 2925 | WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'"; |
2926 | 2926 | $resq = Database::query($query); |
2927 | 2927 | $data = Database::fetch_array($resq); |
@@ -2932,9 +2932,9 @@ discard block |
||
2932 | 2932 | $questionScore = $data['marks']; |
2933 | 2933 | |
2934 | 2934 | if ($questionScore == -1) { |
2935 | - $totalScore+= 0; |
|
2935 | + $totalScore += 0; |
|
2936 | 2936 | } else { |
2937 | - $totalScore+= $questionScore; |
|
2937 | + $totalScore += $questionScore; |
|
2938 | 2938 | } |
2939 | 2939 | if ($questionScore == '') { |
2940 | 2940 | $questionScore = 0; |
@@ -2955,14 +2955,14 @@ discard block |
||
2955 | 2955 | $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
2956 | 2956 | WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'"; |
2957 | 2957 | $resq = Database::query($query); |
2958 | - $choice = Database::result($resq,0,'answer'); |
|
2958 | + $choice = Database::result($resq, 0, 'answer'); |
|
2959 | 2959 | $choice = str_replace('\r\n', '', $choice); |
2960 | 2960 | $choice = stripslashes($choice); |
2961 | - $questionScore = Database::result($resq,0,"marks"); |
|
2962 | - if ($questionScore==-1) { |
|
2963 | - $totalScore+=0; |
|
2961 | + $questionScore = Database::result($resq, 0, "marks"); |
|
2962 | + if ($questionScore == -1) { |
|
2963 | + $totalScore += 0; |
|
2964 | 2964 | } else { |
2965 | - $totalScore+=$questionScore; |
|
2965 | + $totalScore += $questionScore; |
|
2966 | 2966 | } |
2967 | 2967 | $arrques = $questionName; |
2968 | 2968 | $arrans = $choice; |
@@ -3007,7 +3007,7 @@ discard block |
||
3007 | 3007 | |
3008 | 3008 | while ($a_answers = Database::fetch_array($res_answers)) { |
3009 | 3009 | $i_answer_id = $a_answers['id']; //3 |
3010 | - $s_answer_label = $a_answers['answer']; // your daddy - your mother |
|
3010 | + $s_answer_label = $a_answers['answer']; // your daddy - your mother |
|
3011 | 3011 | $i_answer_correct_answer = $a_answers['correct']; //1 - 2 |
3012 | 3012 | $i_answer_id_auto = $a_answers['id_auto']; // 3 - 4 |
3013 | 3013 | |
@@ -3059,8 +3059,8 @@ discard block |
||
3059 | 3059 | |
3060 | 3060 | if ($show_result) { |
3061 | 3061 | echo '<tr>'; |
3062 | - echo '<td>' . $s_answer_label . '</td>'; |
|
3063 | - echo '<td>' . $user_answer; |
|
3062 | + echo '<td>'.$s_answer_label.'</td>'; |
|
3063 | + echo '<td>'.$user_answer; |
|
3064 | 3064 | |
3065 | 3065 | if (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) { |
3066 | 3066 | if (isset($real_list[$i_answer_correct_answer])) { |
@@ -3180,13 +3180,13 @@ discard block |
||
3180 | 3180 | |
3181 | 3181 | // THIS is very important otherwise the poly_compile will throw an error!! |
3182 | 3182 | // round-up the coordinates |
3183 | - $coords = explode('/',$user_answer); |
|
3183 | + $coords = explode('/', $user_answer); |
|
3184 | 3184 | $user_array = ''; |
3185 | 3185 | foreach ($coords as $coord) { |
3186 | - list($x,$y) = explode(';',$coord); |
|
3186 | + list($x, $y) = explode(';', $coord); |
|
3187 | 3187 | $user_array .= round($x).';'.round($y).'/'; |
3188 | 3188 | } |
3189 | - $user_array = substr($user_array,0,-1); |
|
3189 | + $user_array = substr($user_array, 0, -1); |
|
3190 | 3190 | } else { |
3191 | 3191 | if (!empty($studentChoice)) { |
3192 | 3192 | $newquestionList[] = $questionId; |
@@ -3196,13 +3196,13 @@ discard block |
||
3196 | 3196 | $studentChoice = $choice[$answerId]; |
3197 | 3197 | $questionScore += $answerWeighting; |
3198 | 3198 | |
3199 | - if ($hotspot_delineation_result[1]==1) { |
|
3199 | + if ($hotspot_delineation_result[1] == 1) { |
|
3200 | 3200 | $totalScore += $answerWeighting; //adding the total |
3201 | 3201 | } |
3202 | 3202 | } |
3203 | 3203 | } |
3204 | - $_SESSION['hotspot_coord'][1] = $delineation_cord; |
|
3205 | - $_SESSION['hotspot_dest'][1] = $answer_delineation_destination; |
|
3204 | + $_SESSION['hotspot_coord'][1] = $delineation_cord; |
|
3205 | + $_SESSION['hotspot_dest'][1] = $answer_delineation_destination; |
|
3206 | 3206 | break; |
3207 | 3207 | } // end switch Answertype |
3208 | 3208 | |
@@ -3260,7 +3260,7 @@ discard block |
||
3260 | 3260 | $results_disabled |
3261 | 3261 | ); |
3262 | 3262 | //} |
3263 | - } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE ) { |
|
3263 | + } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { |
|
3264 | 3264 | // if ($origin!='learnpath') { |
3265 | 3265 | ExerciseShowFunctions::display_multiple_answer_combination_true_false( |
3266 | 3266 | $feedback_type, |
@@ -3277,11 +3277,11 @@ discard block |
||
3277 | 3277 | //} |
3278 | 3278 | } elseif ($answerType == FILL_IN_BLANKS) { |
3279 | 3279 | //if ($origin!='learnpath') { |
3280 | - ExerciseShowFunctions::display_fill_in_blanks_answer($feedback_type, $answer,0,0, $results_disabled); |
|
3280 | + ExerciseShowFunctions::display_fill_in_blanks_answer($feedback_type, $answer, 0, 0, $results_disabled); |
|
3281 | 3281 | // } |
3282 | 3282 | } elseif ($answerType == CALCULATED_ANSWER) { |
3283 | 3283 | //if ($origin!='learnpath') { |
3284 | - ExerciseShowFunctions::display_calculated_answer($feedback_type, $answer,0,0); |
|
3284 | + ExerciseShowFunctions::display_calculated_answer($feedback_type, $answer, 0, 0); |
|
3285 | 3285 | // } |
3286 | 3286 | } elseif ($answerType == FREE_ANSWER) { |
3287 | 3287 | //if($origin != 'learnpath') { |
@@ -3335,13 +3335,13 @@ discard block |
||
3335 | 3335 | $user_answer = $_SESSION['exerciseResultCoordinates'][$questionId]; |
3336 | 3336 | |
3337 | 3337 | //round-up the coordinates |
3338 | - $coords = explode('/',$user_answer); |
|
3338 | + $coords = explode('/', $user_answer); |
|
3339 | 3339 | $user_array = ''; |
3340 | 3340 | foreach ($coords as $coord) { |
3341 | - list($x,$y) = explode(';',$coord); |
|
3341 | + list($x, $y) = explode(';', $coord); |
|
3342 | 3342 | $user_array .= round($x).';'.round($y).'/'; |
3343 | 3343 | } |
3344 | - $user_array = substr($user_array,0,-1); |
|
3344 | + $user_array = substr($user_array, 0, -1); |
|
3345 | 3345 | |
3346 | 3346 | if ($next) { |
3347 | 3347 | |
@@ -3368,7 +3368,7 @@ discard block |
||
3368 | 3368 | //$overlap = round(polygons_overlap($poly_answer,$poly_user)); |
3369 | 3369 | // //this is an area in pixels |
3370 | 3370 | if ($debug > 0) { |
3371 | - error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0); |
|
3371 | + error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); |
|
3372 | 3372 | } |
3373 | 3373 | |
3374 | 3374 | if ($overlap < 1) { |
@@ -3381,43 +3381,43 @@ discard block |
||
3381 | 3381 | // that is overlapped by the user's polygon |
3382 | 3382 | $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100); |
3383 | 3383 | if ($debug > 1) { |
3384 | - error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0); |
|
3384 | + error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); |
|
3385 | 3385 | } |
3386 | 3386 | // the final missing area is the percentage of the initial polygon |
3387 | 3387 | // that is not overlapped by the user's polygon |
3388 | 3388 | $final_missing = 100 - $final_overlap; |
3389 | 3389 | if ($debug > 1) { |
3390 | - error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0); |
|
3390 | + error_log(__LINE__.' - Final missing is '.$final_missing, 0); |
|
3391 | 3391 | } |
3392 | 3392 | // the final excess area is the percentage of the initial polygon's size |
3393 | 3393 | // that is covered by the user's polygon outside of the initial polygon |
3394 | 3394 | $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100); |
3395 | 3395 | if ($debug > 1) { |
3396 | - error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0); |
|
3396 | + error_log(__LINE__.' - Final excess is '.$final_excess, 0); |
|
3397 | 3397 | } |
3398 | 3398 | } |
3399 | 3399 | |
3400 | 3400 | //checking the destination parameters parsing the "@@" |
3401 | - $destination_items= explode('@@', $answerDestination); |
|
3401 | + $destination_items = explode('@@', $answerDestination); |
|
3402 | 3402 | $threadhold_total = $destination_items[0]; |
3403 | - $threadhold_items=explode(';',$threadhold_total); |
|
3403 | + $threadhold_items = explode(';', $threadhold_total); |
|
3404 | 3404 | $threadhold1 = $threadhold_items[0]; // overlap |
3405 | 3405 | $threadhold2 = $threadhold_items[1]; // excess |
3406 | - $threadhold3 = $threadhold_items[2]; //missing |
|
3406 | + $threadhold3 = $threadhold_items[2]; //missing |
|
3407 | 3407 | |
3408 | 3408 | // if is delineation |
3409 | - if ($answerId===1) { |
|
3409 | + if ($answerId === 1) { |
|
3410 | 3410 | //setting colors |
3411 | - if ($final_overlap>=$threadhold1) { |
|
3412 | - $overlap_color=true; //echo 'a'; |
|
3411 | + if ($final_overlap >= $threadhold1) { |
|
3412 | + $overlap_color = true; //echo 'a'; |
|
3413 | 3413 | } |
3414 | 3414 | //echo $excess.'-'.$threadhold2; |
3415 | - if ($final_excess<=$threadhold2) { |
|
3416 | - $excess_color=true; //echo 'b'; |
|
3415 | + if ($final_excess <= $threadhold2) { |
|
3416 | + $excess_color = true; //echo 'b'; |
|
3417 | 3417 | } |
3418 | 3418 | //echo '--------'.$missing.'-'.$threadhold3; |
3419 | - if ($final_missing<=$threadhold3) { |
|
3420 | - $missing_color=true; //echo 'c'; |
|
3419 | + if ($final_missing <= $threadhold3) { |
|
3420 | + $missing_color = true; //echo 'c'; |
|
3421 | 3421 | } |
3422 | 3422 | |
3423 | 3423 | // if pass |
@@ -3426,67 +3426,67 @@ discard block |
||
3426 | 3426 | $final_missing <= $threadhold3 && |
3427 | 3427 | $final_excess <= $threadhold2 |
3428 | 3428 | ) { |
3429 | - $next=1; //go to the oars |
|
3430 | - $result_comment=get_lang('Acceptable'); |
|
3431 | - $final_answer = 1; // do not update with update_exercise_attempt |
|
3429 | + $next = 1; //go to the oars |
|
3430 | + $result_comment = get_lang('Acceptable'); |
|
3431 | + $final_answer = 1; // do not update with update_exercise_attempt |
|
3432 | 3432 | } else { |
3433 | - $next=0; |
|
3434 | - $result_comment=get_lang('Unacceptable'); |
|
3435 | - $comment=$answerDestination=$objAnswerTmp->selectComment(1); |
|
3436 | - $answerDestination=$objAnswerTmp->selectDestination(1); |
|
3433 | + $next = 0; |
|
3434 | + $result_comment = get_lang('Unacceptable'); |
|
3435 | + $comment = $answerDestination = $objAnswerTmp->selectComment(1); |
|
3436 | + $answerDestination = $objAnswerTmp->selectDestination(1); |
|
3437 | 3437 | //checking the destination parameters parsing the "@@" |
3438 | - $destination_items= explode('@@', $answerDestination); |
|
3438 | + $destination_items = explode('@@', $answerDestination); |
|
3439 | 3439 | } |
3440 | - } elseif($answerId>1) { |
|
3440 | + } elseif ($answerId > 1) { |
|
3441 | 3441 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
3442 | - if ($debug>0) { |
|
3443 | - error_log(__LINE__.' - answerId is of type noerror',0); |
|
3442 | + if ($debug > 0) { |
|
3443 | + error_log(__LINE__.' - answerId is of type noerror', 0); |
|
3444 | 3444 | } |
3445 | 3445 | //type no error shouldn't be treated |
3446 | 3446 | $next = 1; |
3447 | 3447 | continue; |
3448 | 3448 | } |
3449 | - if ($debug>0) { |
|
3450 | - error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0); |
|
3449 | + if ($debug > 0) { |
|
3450 | + error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); |
|
3451 | 3451 | } |
3452 | 3452 | //check the intersection between the oar and the user |
3453 | 3453 | //echo 'user'; print_r($x_user_list); print_r($y_user_list); |
3454 | 3454 | //echo 'official';print_r($x_list);print_r($y_list); |
3455 | 3455 | //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list); |
3456 | - $inter= $result['success']; |
|
3456 | + $inter = $result['success']; |
|
3457 | 3457 | |
3458 | 3458 | //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); |
3459 | - $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); |
|
3459 | + $delineation_cord = $objAnswerTmp->selectHotspotCoordinates($answerId); |
|
3460 | 3460 | |
3461 | - $poly_answer = convert_coordinates($delineation_cord,'|'); |
|
3462 | - $max_coord = poly_get_max($poly_user,$poly_answer); |
|
3463 | - $poly_answer_compiled = poly_compile($poly_answer,$max_coord); |
|
3464 | - $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord); |
|
3461 | + $poly_answer = convert_coordinates($delineation_cord, '|'); |
|
3462 | + $max_coord = poly_get_max($poly_user, $poly_answer); |
|
3463 | + $poly_answer_compiled = poly_compile($poly_answer, $max_coord); |
|
3464 | + $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord); |
|
3465 | 3465 | |
3466 | 3466 | if ($overlap == false) { |
3467 | 3467 | //all good, no overlap |
3468 | 3468 | $next = 1; |
3469 | 3469 | continue; |
3470 | 3470 | } else { |
3471 | - if ($debug>0) { |
|
3472 | - error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0); |
|
3471 | + if ($debug > 0) { |
|
3472 | + error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); |
|
3473 | 3473 | } |
3474 | 3474 | $organs_at_risk_hit++; |
3475 | 3475 | //show the feedback |
3476 | - $next=0; |
|
3477 | - $comment=$answerDestination=$objAnswerTmp->selectComment($answerId); |
|
3478 | - $answerDestination=$objAnswerTmp->selectDestination($answerId); |
|
3479 | - |
|
3480 | - $destination_items= explode('@@', $answerDestination); |
|
3481 | - $try_hotspot=$destination_items[1]; |
|
3482 | - $lp_hotspot=$destination_items[2]; |
|
3483 | - $select_question_hotspot=$destination_items[3]; |
|
3484 | - $url_hotspot=$destination_items[4]; |
|
3476 | + $next = 0; |
|
3477 | + $comment = $answerDestination = $objAnswerTmp->selectComment($answerId); |
|
3478 | + $answerDestination = $objAnswerTmp->selectDestination($answerId); |
|
3479 | + |
|
3480 | + $destination_items = explode('@@', $answerDestination); |
|
3481 | + $try_hotspot = $destination_items[1]; |
|
3482 | + $lp_hotspot = $destination_items[2]; |
|
3483 | + $select_question_hotspot = $destination_items[3]; |
|
3484 | + $url_hotspot = $destination_items[4]; |
|
3485 | 3485 | } |
3486 | 3486 | } |
3487 | 3487 | } else { // the first delineation feedback |
3488 | - if ($debug>0) { |
|
3489 | - error_log(__LINE__.' first',0); |
|
3488 | + if ($debug > 0) { |
|
3489 | + error_log(__LINE__.' first', 0); |
|
3490 | 3490 | } |
3491 | 3491 | } |
3492 | 3492 | } elseif (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) { |
@@ -3494,7 +3494,7 @@ discard block |
||
3494 | 3494 | echo Display::tag('td', $answerMatching[$answerId]); |
3495 | 3495 | echo Display::tag( |
3496 | 3496 | 'td', |
3497 | - "$user_answer / " . Display::tag( |
|
3497 | + "$user_answer / ".Display::tag( |
|
3498 | 3498 | 'strong', |
3499 | 3499 | $answerMatching[$answerCorrect], |
3500 | 3500 | ['style' => 'color: #008000; font-weight: bold;'] |
@@ -3634,7 +3634,7 @@ discard block |
||
3634 | 3634 | $exeId, |
3635 | 3635 | $questionId, |
3636 | 3636 | $nano |
3637 | - ) . '</td> |
|
3637 | + ).'</td> |
|
3638 | 3638 | </tr> |
3639 | 3639 | </table>'; |
3640 | 3640 | break; |
@@ -3693,7 +3693,7 @@ discard block |
||
3693 | 3693 | |
3694 | 3694 | //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels |
3695 | 3695 | if ($debug > 0) { |
3696 | - error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0); |
|
3696 | + error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); |
|
3697 | 3697 | } |
3698 | 3698 | if ($overlap < 1) { |
3699 | 3699 | //shortcut to avoid complicated calculations |
@@ -3704,17 +3704,17 @@ discard block |
||
3704 | 3704 | // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon |
3705 | 3705 | $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100); |
3706 | 3706 | if ($debug > 1) { |
3707 | - error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0); |
|
3707 | + error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); |
|
3708 | 3708 | } |
3709 | 3709 | // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon |
3710 | 3710 | $final_missing = 100 - $final_overlap; |
3711 | 3711 | if ($debug > 1) { |
3712 | - error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0); |
|
3712 | + error_log(__LINE__.' - Final missing is '.$final_missing, 0); |
|
3713 | 3713 | } |
3714 | 3714 | // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon |
3715 | 3715 | $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100); |
3716 | 3716 | if ($debug > 1) { |
3717 | - error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0); |
|
3717 | + error_log(__LINE__.' - Final excess is '.$final_excess, 0); |
|
3718 | 3718 | } |
3719 | 3719 | } |
3720 | 3720 | |
@@ -3724,7 +3724,7 @@ discard block |
||
3724 | 3724 | $threadhold_items = explode(';', $threadhold_total); |
3725 | 3725 | $threadhold1 = $threadhold_items[0]; // overlap |
3726 | 3726 | $threadhold2 = $threadhold_items[1]; // excess |
3727 | - $threadhold3 = $threadhold_items[2]; //missing |
|
3727 | + $threadhold3 = $threadhold_items[2]; //missing |
|
3728 | 3728 | // if is delineation |
3729 | 3729 | if ($answerId === 1) { |
3730 | 3730 | //setting colors |
@@ -3756,14 +3756,14 @@ discard block |
||
3756 | 3756 | } elseif ($answerId > 1) { |
3757 | 3757 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
3758 | 3758 | if ($debug > 0) { |
3759 | - error_log(__LINE__ . ' - answerId is of type noerror', 0); |
|
3759 | + error_log(__LINE__.' - answerId is of type noerror', 0); |
|
3760 | 3760 | } |
3761 | 3761 | //type no error shouldn't be treated |
3762 | 3762 | $next = 1; |
3763 | 3763 | continue; |
3764 | 3764 | } |
3765 | 3765 | if ($debug > 0) { |
3766 | - error_log(__LINE__ . ' - answerId is >1 so we\'re probably in OAR', 0); |
|
3766 | + error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); |
|
3767 | 3767 | } |
3768 | 3768 | //check the intersection between the oar and the user |
3769 | 3769 | //echo 'user'; print_r($x_user_list); print_r($y_user_list); |
@@ -3777,7 +3777,7 @@ discard block |
||
3777 | 3777 | $poly_answer = convert_coordinates($delineation_cord, '|'); |
3778 | 3778 | $max_coord = poly_get_max($poly_user, $poly_answer); |
3779 | 3779 | $poly_answer_compiled = poly_compile($poly_answer, $max_coord); |
3780 | - $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord); |
|
3780 | + $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord); |
|
3781 | 3781 | |
3782 | 3782 | if ($overlap == false) { |
3783 | 3783 | //all good, no overlap |
@@ -3785,7 +3785,7 @@ discard block |
||
3785 | 3785 | continue; |
3786 | 3786 | } else { |
3787 | 3787 | if ($debug > 0) { |
3788 | - error_log(__LINE__ . ' - Overlap is ' . $overlap . ': OAR hit', 0); |
|
3788 | + error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); |
|
3789 | 3789 | } |
3790 | 3790 | $organs_at_risk_hit++; |
3791 | 3791 | //show the feedback |
@@ -3797,12 +3797,12 @@ discard block |
||
3797 | 3797 | $try_hotspot = $destination_items[1]; |
3798 | 3798 | $lp_hotspot = $destination_items[2]; |
3799 | 3799 | $select_question_hotspot = $destination_items[3]; |
3800 | - $url_hotspot=$destination_items[4]; |
|
3800 | + $url_hotspot = $destination_items[4]; |
|
3801 | 3801 | } |
3802 | 3802 | } |
3803 | 3803 | } else { // the first delineation feedback |
3804 | 3804 | if ($debug > 0) { |
3805 | - error_log(__LINE__ . ' first', 0); |
|
3805 | + error_log(__LINE__.' first', 0); |
|
3806 | 3806 | } |
3807 | 3807 | } |
3808 | 3808 | break; |
@@ -3824,7 +3824,7 @@ discard block |
||
3824 | 3824 | echo Display::tag('td', $answerMatching[$answerId]); |
3825 | 3825 | echo Display::tag( |
3826 | 3826 | 'td', |
3827 | - "$user_answer / " . Display::tag( |
|
3827 | + "$user_answer / ".Display::tag( |
|
3828 | 3828 | 'strong', |
3829 | 3829 | $answerMatching[$answerCorrect], |
3830 | 3830 | ['style' => 'color: #008000; font-weight: bold;'] |
@@ -3910,7 +3910,7 @@ discard block |
||
3910 | 3910 | // we use the results from the session (from_db=0) |
3911 | 3911 | // TODO Change this, because it is wrong to show the user |
3912 | 3912 | // some results that haven't been stored in the database yet |
3913 | - if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) { |
|
3913 | + if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION) { |
|
3914 | 3914 | |
3915 | 3915 | if ($debug) error_log('$from AND this is a hotspot kind of question '); |
3916 | 3916 | |
@@ -3919,19 +3919,19 @@ discard block |
||
3919 | 3919 | if ($answerType == HOT_SPOT_DELINEATION) { |
3920 | 3920 | if (0) { |
3921 | 3921 | if ($overlap_color) { |
3922 | - $overlap_color='green'; |
|
3922 | + $overlap_color = 'green'; |
|
3923 | 3923 | } else { |
3924 | - $overlap_color='red'; |
|
3924 | + $overlap_color = 'red'; |
|
3925 | 3925 | } |
3926 | 3926 | if ($missing_color) { |
3927 | - $missing_color='green'; |
|
3927 | + $missing_color = 'green'; |
|
3928 | 3928 | } else { |
3929 | - $missing_color='red'; |
|
3929 | + $missing_color = 'red'; |
|
3930 | 3930 | } |
3931 | 3931 | if ($excess_color) { |
3932 | - $excess_color='green'; |
|
3932 | + $excess_color = 'green'; |
|
3933 | 3933 | } else { |
3934 | - $excess_color='red'; |
|
3934 | + $excess_color = 'red'; |
|
3935 | 3935 | } |
3936 | 3936 | if (!is_numeric($final_overlap)) { |
3937 | 3937 | $final_overlap = 0; |
@@ -3943,33 +3943,33 @@ discard block |
||
3943 | 3943 | $final_excess = 0; |
3944 | 3944 | } |
3945 | 3945 | |
3946 | - if ($final_overlap>100) { |
|
3946 | + if ($final_overlap > 100) { |
|
3947 | 3947 | $final_overlap = 100; |
3948 | 3948 | } |
3949 | 3949 | |
3950 | - $table_resume='<table class="data_table"> |
|
3950 | + $table_resume = '<table class="data_table"> |
|
3951 | 3951 | <tr class="row_odd" > |
3952 | 3952 | <td></td> |
3953 | - <td ><b>' . get_lang('Requirements') . '</b></td> |
|
3954 | - <td><b>' . get_lang('YourAnswer') . '</b></td> |
|
3953 | + <td ><b>' . get_lang('Requirements').'</b></td> |
|
3954 | + <td><b>' . get_lang('YourAnswer').'</b></td> |
|
3955 | 3955 | </tr> |
3956 | 3956 | <tr class="row_even"> |
3957 | - <td><b>' . get_lang('Overlap') . '</b></td> |
|
3958 | - <td>' . get_lang('Min') . ' ' . $threadhold1 . '</td> |
|
3959 | - <td><div style="color:' . $overlap_color . '">' |
|
3960 | - . (($final_overlap < 0) ? 0 : intval($final_overlap)) . '</div></td> |
|
3957 | + <td><b>' . get_lang('Overlap').'</b></td> |
|
3958 | + <td>' . get_lang('Min').' '.$threadhold1.'</td> |
|
3959 | + <td><div style="color:' . $overlap_color.'">' |
|
3960 | + . (($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td> |
|
3961 | 3961 | </tr> |
3962 | 3962 | <tr> |
3963 | - <td><b>' . get_lang('Excess') . '</b></td> |
|
3964 | - <td>' . get_lang('Max') . ' ' . $threadhold2 . '</td> |
|
3965 | - <td><div style="color:' . $excess_color . '">' |
|
3966 | - . (($final_excess < 0) ? 0 : intval($final_excess)) . '</div></td> |
|
3963 | + <td><b>' . get_lang('Excess').'</b></td> |
|
3964 | + <td>' . get_lang('Max').' '.$threadhold2.'</td> |
|
3965 | + <td><div style="color:' . $excess_color.'">' |
|
3966 | + . (($final_excess < 0) ? 0 : intval($final_excess)).'</div></td> |
|
3967 | 3967 | </tr> |
3968 | 3968 | <tr class="row_even"> |
3969 | - <td><b>' . get_lang('Missing') . '</b></td> |
|
3970 | - <td>' . get_lang('Max') . ' ' . $threadhold3 . '</td> |
|
3971 | - <td><div style="color:' . $missing_color . '">' |
|
3972 | - . (($final_missing < 0) ? 0 : intval($final_missing)) . '</div></td> |
|
3969 | + <td><b>' . get_lang('Missing').'</b></td> |
|
3970 | + <td>' . get_lang('Max').' '.$threadhold3.'</td> |
|
3971 | + <td><div style="color:' . $missing_color.'">' |
|
3972 | + . (($final_missing < 0) ? 0 : intval($final_missing)).'</div></td> |
|
3973 | 3973 | </tr> |
3974 | 3974 | </table>'; |
3975 | 3975 | if ($next == 0) { |
@@ -3984,20 +3984,20 @@ discard block |
||
3984 | 3984 | $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
3985 | 3985 | } |
3986 | 3986 | |
3987 | - echo '<h1><div style="color:#333;">' . get_lang('Feedback') . '</div></h1> |
|
3987 | + echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1> |
|
3988 | 3988 | <p style="text-align:center">'; |
3989 | 3989 | |
3990 | - $message = '<p>' . get_lang('YourDelineation') . '</p>'; |
|
3990 | + $message = '<p>'.get_lang('YourDelineation').'</p>'; |
|
3991 | 3991 | $message .= $table_resume; |
3992 | - $message .= '<br />' . get_lang('ResultIs') . ' ' . $result_comment . '<br />'; |
|
3992 | + $message .= '<br />'.get_lang('ResultIs').' '.$result_comment.'<br />'; |
|
3993 | 3993 | if ($organs_at_risk_hit > 0) { |
3994 | - $message .= '<p><b>' . get_lang('OARHit') . '</b></p>'; |
|
3994 | + $message .= '<p><b>'.get_lang('OARHit').'</b></p>'; |
|
3995 | 3995 | } |
3996 | - $message .='<p>' . $comment . '</p>'; |
|
3996 | + $message .= '<p>'.$comment.'</p>'; |
|
3997 | 3997 | echo $message; |
3998 | 3998 | } else { |
3999 | 3999 | echo $hotspot_delineation_result[0]; //prints message |
4000 | - $from_database = 1; // the hotspot_solution.swf needs this variable |
|
4000 | + $from_database = 1; // the hotspot_solution.swf needs this variable |
|
4001 | 4001 | } |
4002 | 4002 | |
4003 | 4003 | //save the score attempts |
@@ -4019,20 +4019,20 @@ discard block |
||
4019 | 4019 | $exerciseResultCoordinates[$quesId] |
4020 | 4020 | ); |
4021 | 4021 | } else { |
4022 | - if ($final_answer==0) { |
|
4022 | + if ($final_answer == 0) { |
|
4023 | 4023 | $questionScore = 0; |
4024 | - $answer=0; |
|
4024 | + $answer = 0; |
|
4025 | 4025 | Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0); |
4026 | 4026 | if (is_array($exerciseResultCoordinates[$quesId])) { |
4027 | - foreach($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
4028 | - Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,0,$val); |
|
4027 | + foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
4028 | + Event::saveExerciseAttemptHotspot($exeId, $quesId, $idx, 0, $val); |
|
4029 | 4029 | } |
4030 | 4030 | } |
4031 | 4031 | } else { |
4032 | 4032 | Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0); |
4033 | 4033 | if (is_array($exerciseResultCoordinates[$quesId])) { |
4034 | - foreach($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
4035 | - Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,$choice[$idx],$val); |
|
4034 | + foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
4035 | + Event::saveExerciseAttemptHotspot($exeId, $quesId, $idx, $choice[$idx], $val); |
|
4036 | 4036 | } |
4037 | 4037 | } |
4038 | 4038 | } |
@@ -4051,7 +4051,7 @@ discard block |
||
4051 | 4051 | echo " |
4052 | 4052 | <tr> |
4053 | 4053 | <td colspan=\"2\"> |
4054 | - <p><em>" . get_lang('HotSpot') . "</em></p> |
|
4054 | + <p><em>" . get_lang('HotSpot')."</em></p> |
|
4055 | 4055 | |
4056 | 4056 | <div id=\"hotspot-solution-$questionId\"></div> |
4057 | 4057 | |
@@ -4089,7 +4089,7 @@ discard block |
||
4089 | 4089 | |
4090 | 4090 | if ($saved_results) { |
4091 | 4091 | if ($debug) error_log("Save question results $saved_results"); |
4092 | - if ($debug) error_log(print_r($choice ,1 )); |
|
4092 | + if ($debug) error_log(print_r($choice, 1)); |
|
4093 | 4093 | |
4094 | 4094 | if (empty($choice)) { |
4095 | 4095 | $choice = 0; |
@@ -4101,14 +4101,14 @@ discard block |
||
4101 | 4101 | $ans = $reply[$i]; |
4102 | 4102 | Event::saveQuestionAttempt( |
4103 | 4103 | $questionScore, |
4104 | - $ans . ':' . $choice[$ans], |
|
4104 | + $ans.':'.$choice[$ans], |
|
4105 | 4105 | $quesId, |
4106 | 4106 | $exeId, |
4107 | 4107 | $i, |
4108 | 4108 | $this->id |
4109 | 4109 | ); |
4110 | 4110 | if ($debug) { |
4111 | - error_log('result =>' . $questionScore . ' ' . $ans . ':' . $choice[$ans]); |
|
4111 | + error_log('result =>'.$questionScore.' '.$ans.':'.$choice[$ans]); |
|
4112 | 4112 | } |
4113 | 4113 | } |
4114 | 4114 | } else { |
@@ -4119,7 +4119,7 @@ discard block |
||
4119 | 4119 | $reply = array_keys($choice); |
4120 | 4120 | |
4121 | 4121 | if ($debug) { |
4122 | - error_log("reply " . print_r($reply, 1) . ""); |
|
4122 | + error_log("reply ".print_r($reply, 1).""); |
|
4123 | 4123 | } |
4124 | 4124 | for ($i = 0; $i < sizeof($reply); $i++) { |
4125 | 4125 | $ans = $reply[$i]; |
@@ -4178,7 +4178,7 @@ discard block |
||
4178 | 4178 | |
4179 | 4179 | Event::saveQuestionAttempt($questionScore, implode('|', $answer), $quesId, $exeId, 0, $this->id); |
4180 | 4180 | } else { |
4181 | - Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0,$this->id); |
|
4181 | + Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id); |
|
4182 | 4182 | } |
4183 | 4183 | } |
4184 | 4184 | |
@@ -4188,8 +4188,8 @@ discard block |
||
4188 | 4188 | |
4189 | 4189 | if ($saved_results) { |
4190 | 4190 | $stat_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
4191 | - $sql = 'UPDATE ' . $stat_table . ' SET |
|
4192 | - exe_result = exe_result + ' . floatval($questionScore) . ' |
|
4191 | + $sql = 'UPDATE '.$stat_table.' SET |
|
4192 | + exe_result = exe_result + ' . floatval($questionScore).' |
|
4193 | 4193 | WHERE exe_id = ' . $exeId; |
4194 | 4194 | if ($debug) error_log($sql); |
4195 | 4195 | Database::query($sql); |
@@ -4213,7 +4213,7 @@ discard block |
||
4213 | 4213 | */ |
4214 | 4214 | public function send_mail_notification_for_exam($question_list_answers, $origin, $exe_id) |
4215 | 4215 | { |
4216 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
4216 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
4217 | 4217 | return null; |
4218 | 4218 | } |
4219 | 4219 | // Email configuration settings |
@@ -4264,7 +4264,7 @@ discard block |
||
4264 | 4264 | $msg = str_replace("#course#", $courseInfo['name'], $msg1); |
4265 | 4265 | |
4266 | 4266 | if ($origin != 'learnpath') { |
4267 | - $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
4267 | + $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
4268 | 4268 | } |
4269 | 4269 | $msg1 = str_replace("#url#", $url_email, $msg); |
4270 | 4270 | $mail_content = $msg1; |
@@ -4293,7 +4293,7 @@ discard block |
||
4293 | 4293 | */ |
4294 | 4294 | function send_notification_for_open_questions($question_list_answers, $origin, $exe_id) |
4295 | 4295 | { |
4296 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
4296 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
4297 | 4297 | return null; |
4298 | 4298 | } |
4299 | 4299 | // Email configuration settings |
@@ -4356,11 +4356,11 @@ discard block |
||
4356 | 4356 | $msg .= '</table><br />'; |
4357 | 4357 | |
4358 | 4358 | |
4359 | - $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
|
4360 | - $msg = str_replace("#firstName#", $user_info['firstname'],$msg1); |
|
4361 | - $msg1 = str_replace("#lastName#", $user_info['lastname'],$msg); |
|
4362 | - $msg = str_replace("#mail#", $user_info['email'],$msg1); |
|
4363 | - $msg = str_replace("#course#", $course_info['name'],$msg1); |
|
4359 | + $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
|
4360 | + $msg = str_replace("#firstName#", $user_info['firstname'], $msg1); |
|
4361 | + $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg); |
|
4362 | + $msg = str_replace("#mail#", $user_info['email'], $msg1); |
|
4363 | + $msg = str_replace("#course#", $course_info['name'], $msg1); |
|
4364 | 4364 | |
4365 | 4365 | if ($origin != 'learnpath') { |
4366 | 4366 | $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
@@ -4391,7 +4391,7 @@ discard block |
||
4391 | 4391 | |
4392 | 4392 | function send_notification_for_oral_questions($question_list_answers, $origin, $exe_id) |
4393 | 4393 | { |
4394 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
4394 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
4395 | 4395 | return null; |
4396 | 4396 | } |
4397 | 4397 | // Email configuration settings |
@@ -4415,7 +4415,7 @@ discard block |
||
4415 | 4415 | $answer_type = $item['answer_type']; |
4416 | 4416 | |
4417 | 4417 | if (!empty($question) && !empty($answer) && $answer_type == ORAL_EXPRESSION) { |
4418 | - $oral_question_list.='<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">' |
|
4418 | + $oral_question_list .= '<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">' |
|
4419 | 4419 | .'<tr>' |
4420 | 4420 | .'<td width="220" valign="top" bgcolor="#E5EDF8"> '.get_lang('Question').'</td>' |
4421 | 4421 | .'<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>' |
@@ -4448,7 +4448,7 @@ discard block |
||
4448 | 4448 | .'<td> #mail#</td>' |
4449 | 4449 | .'</tr>' |
4450 | 4450 | .'</table>'; |
4451 | - $msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'),$oral_question_list).'<br />'; |
|
4451 | + $msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'), $oral_question_list).'<br />'; |
|
4452 | 4452 | $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
4453 | 4453 | $msg = str_replace("#firstName#", $user_info['firstname'], $msg1); |
4454 | 4454 | $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg); |
@@ -4456,7 +4456,7 @@ discard block |
||
4456 | 4456 | $msg = str_replace("#course#", $course_info['name'], $msg1); |
4457 | 4457 | |
4458 | 4458 | if ($origin != 'learnpath') { |
4459 | - $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
4459 | + $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
4460 | 4460 | } |
4461 | 4461 | $msg1 = str_replace("#url#", $url_email, $msg); |
4462 | 4462 | $mail_content = $msg1; |
@@ -4524,10 +4524,10 @@ discard block |
||
4524 | 4524 | } |
4525 | 4525 | $html = '<div class="question-result">'; |
4526 | 4526 | $html .= Display::page_header( |
4527 | - Display::return_icon('test-quiz.png', get_lang('Result'),null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result') |
|
4527 | + Display::return_icon('test-quiz.png', get_lang('Result'), null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result') |
|
4528 | 4528 | ); |
4529 | 4529 | $html .= Display::description($array); |
4530 | - $html .="</div>"; |
|
4530 | + $html .= "</div>"; |
|
4531 | 4531 | return $html; |
4532 | 4532 | } |
4533 | 4533 | |
@@ -4644,7 +4644,7 @@ discard block |
||
4644 | 4644 | false, |
4645 | 4645 | $objExercise->selectPropagateNeg() |
4646 | 4646 | ); |
4647 | - $totalScore += $question_result['score']; |
|
4647 | + $totalScore += $question_result['score']; |
|
4648 | 4648 | } |
4649 | 4649 | |
4650 | 4650 | if ($objExercise->selectPropagateNeg() == 0 && $totalScore < 0) { |
@@ -4788,7 +4788,7 @@ discard block |
||
4788 | 4788 | } |
4789 | 4789 | } |
4790 | 4790 | |
4791 | - if (!empty($message)){ |
|
4791 | + if (!empty($message)) { |
|
4792 | 4792 | $message = Display::return_message($message, 'warning', false); |
4793 | 4793 | } |
4794 | 4794 | |
@@ -4802,7 +4802,7 @@ discard block |
||
4802 | 4802 | { |
4803 | 4803 | $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM); |
4804 | 4804 | $sql = "SELECT max_score FROM $TBL_LP_ITEM |
4805 | - WHERE c_id = {$this->course_id} AND item_type = '" . TOOL_QUIZ . "' AND path = '{$this->id}'"; |
|
4805 | + WHERE c_id = {$this->course_id} AND item_type = '".TOOL_QUIZ."' AND path = '{$this->id}'"; |
|
4806 | 4806 | $result = Database::query($sql); |
4807 | 4807 | if (Database::num_rows($result) > 0) { |
4808 | 4808 | return true; |
@@ -4968,7 +4968,7 @@ discard block |
||
4968 | 4968 | $sql_track = "SELECT * FROM $track_exercises WHERE exe_id = $exe_id "; |
4969 | 4969 | $result = Database::query($sql_track); |
4970 | 4970 | $new_array = array(); |
4971 | - if (Database::num_rows($result) > 0 ) { |
|
4971 | + if (Database::num_rows($result) > 0) { |
|
4972 | 4972 | $new_array = Database::fetch_array($result, 'ASSOC'); |
4973 | 4973 | |
4974 | 4974 | $new_array['duration'] = null; |
@@ -4980,11 +4980,11 @@ discard block |
||
4980 | 4980 | $start_date = api_strtotime($start_date, 'UTC'); |
4981 | 4981 | $end_date = api_strtotime($end_date, 'UTC'); |
4982 | 4982 | if ($start_date && $end_date) { |
4983 | - $mytime = $end_date- $start_date; |
|
4983 | + $mytime = $end_date - $start_date; |
|
4984 | 4984 | $new_learnpath_item = new learnpathItem(null); |
4985 | 4985 | $time_attemp = $new_learnpath_item->get_scorm_time('js', $mytime); |
4986 | 4986 | $h = get_lang('h'); |
4987 | - $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); |
|
4987 | + $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp); |
|
4988 | 4988 | $new_array['duration'] = $time_attemp; |
4989 | 4989 | } |
4990 | 4990 | } |
@@ -5006,7 +5006,7 @@ discard block |
||
5006 | 5006 | $result = Database::query($sql); |
5007 | 5007 | } |
5008 | 5008 | } else { |
5009 | - $remind_list = explode(',',$exercise_info['questions_to_check']); |
|
5009 | + $remind_list = explode(',', $exercise_info['questions_to_check']); |
|
5010 | 5010 | |
5011 | 5011 | $remind_list_string = ''; |
5012 | 5012 | if ($action == 'add') { |
@@ -5018,7 +5018,7 @@ discard block |
||
5018 | 5018 | } |
5019 | 5019 | $remind_list_string = implode(',', $remind_list); |
5020 | 5020 | } |
5021 | - } elseif ($action == 'delete') { |
|
5021 | + } elseif ($action == 'delete') { |
|
5022 | 5022 | if (!empty($remind_list)) { |
5023 | 5023 | if (in_array($question_id, $remind_list)) { |
5024 | 5024 | $remind_list = array_flip($remind_list); |
@@ -5119,7 +5119,7 @@ discard block |
||
5119 | 5119 | public function get_max_score() |
5120 | 5120 | { |
5121 | 5121 | $out_max_score = 0; |
5122 | - $tab_question_list = $this->selectQuestionList(true); // list of question's id !!! the array key start at 1 !!! |
|
5122 | + $tab_question_list = $this->selectQuestionList(true); // list of question's id !!! the array key start at 1 !!! |
|
5123 | 5123 | // test is randomQuestions - see field random of test |
5124 | 5124 | if ($this->random > 0 && $this->randomByCat == 0) { |
5125 | 5125 | $nb_random_questions = $this->random; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | if (empty($document_data)) { |
73 | - $document_id = $parent_id = 0; |
|
73 | + $document_id = $parent_id = 0; |
|
74 | 74 | $path = '/'; |
75 | 75 | } else { |
76 | 76 | $document_id = $document_data['id']; |
@@ -203,16 +203,16 @@ discard block |
||
203 | 203 | |
204 | 204 | // Link back to the documents overview |
205 | 205 | if ($is_certificate_mode) { |
206 | - $actions = '<a href="document.php?id='.$document_id.'&selectcat=' . $selectcat.'&'.api_get_cidreq().'">'. |
|
207 | - Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
206 | + $actions = '<a href="document.php?id='.$document_id.'&selectcat='.$selectcat.'&'.api_get_cidreq().'">'. |
|
207 | + Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('CertificateOverview'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
208 | 208 | } else { |
209 | 209 | $actions = '<a href="document.php?id='.$document_id.'&'.api_get_cidreq().'">'. |
210 | - Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
210 | + Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | // Link to create a folder |
214 | 214 | |
215 | -echo $toolbar = Display::toolbarAction('toolbar-upload', array( 0 => $actions), 1); |
|
215 | +echo $toolbar = Display::toolbarAction('toolbar-upload', array(0 => $actions), 1); |
|
216 | 216 | // Form to select directory |
217 | 217 | $folders = DocumentManager::get_all_document_folders($_course, $groupId, $is_allowed_to_edit); |
218 | 218 | if (!$is_certificate_mode) { |