@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | session_cache_limiter("none"); |
12 | 12 | |
13 | 13 | require '../inc/global.inc.php'; |
14 | -require api_get_path(LIBRARY_PATH) . 'geometry.lib.php'; |
|
14 | +require api_get_path(LIBRARY_PATH).'geometry.lib.php'; |
|
15 | 15 | |
16 | 16 | // set vars |
17 | 17 | $questionId = intval($_GET['modifyAnswers']); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $course_id = api_get_course_int_id(); |
30 | 30 | |
31 | 31 | // Query db for answers |
32 | -if ($answer_type==HOT_SPOT_DELINEATION) { |
|
32 | +if ($answer_type == HOT_SPOT_DELINEATION) { |
|
33 | 33 | $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS |
34 | 34 | WHERE c_id = $course_id AND question_id = ".intval($questionId)." AND hotspot_type = 'delineation' ORDER BY id"; |
35 | 35 | } else { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $hotSpot['answer'] = $hotspot['answer']; |
76 | 76 | |
77 | 77 | // Square or rectancle |
78 | - if ($hotspot['hotspot_type'] == 'square' ) |
|
78 | + if ($hotspot['hotspot_type'] == 'square') |
|
79 | 79 | { |
80 | 80 | $hotSpot['type'] = 'square'; |
81 | 81 | } |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | |
33 | 33 | // Query db for answers |
34 | 34 | if ($answer_type==HOT_SPOT_DELINEATION) { |
35 | - $sql = "SELECT iid, id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS |
|
35 | + $sql = "SELECT iid, id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS |
|
36 | 36 | WHERE c_id = $course_id AND question_id = ".intval($questionId)." AND hotspot_type = 'delineation' ORDER BY iid"; |
37 | 37 | } else { |
38 | - $sql = "SELECT iid, id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS |
|
38 | + $sql = "SELECT iid, id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS |
|
39 | 39 | WHERE c_id = $course_id AND question_id = ".intval($questionId)." ORDER BY iid"; |
40 | 40 | } |
41 | 41 | $result = Database::query($sql); |
@@ -77,37 +77,37 @@ discard block |
||
77 | 77 | $hotSpot['iid'] = $hotspot['iid']; |
78 | 78 | $hotSpot['answer'] = $hotspot['answer']; |
79 | 79 | |
80 | - // Square or rectancle |
|
81 | - if ($hotspot['hotspot_type'] == 'square' ) |
|
82 | - { |
|
80 | + // Square or rectancle |
|
81 | + if ($hotspot['hotspot_type'] == 'square' ) |
|
82 | + { |
|
83 | 83 | $hotSpot['type'] = 'square'; |
84 | - } |
|
85 | - // Circle or ovale |
|
86 | - if ($hotspot['hotspot_type'] == 'circle') |
|
87 | - { |
|
84 | + } |
|
85 | + // Circle or ovale |
|
86 | + if ($hotspot['hotspot_type'] == 'circle') |
|
87 | + { |
|
88 | 88 | $hotSpot['type'] = 'circle'; |
89 | - } |
|
90 | - // Polygon |
|
91 | - if ($hotspot['hotspot_type'] == 'poly') |
|
92 | - { |
|
89 | + } |
|
90 | + // Polygon |
|
91 | + if ($hotspot['hotspot_type'] == 'poly') |
|
92 | + { |
|
93 | 93 | $hotSpot['type'] = 'poly'; |
94 | - } |
|
95 | - // Delineation |
|
96 | - if ($hotspot['hotspot_type'] == 'delineation') |
|
97 | - { |
|
94 | + } |
|
95 | + // Delineation |
|
96 | + if ($hotspot['hotspot_type'] == 'delineation') |
|
97 | + { |
|
98 | 98 | $hotSpot['type'] = 'delineation'; |
99 | - } |
|
100 | - // No error |
|
101 | - if ($hotspot['hotspot_type'] == 'noerror') |
|
102 | - { |
|
99 | + } |
|
100 | + // No error |
|
101 | + if ($hotspot['hotspot_type'] == 'noerror') |
|
102 | + { |
|
103 | 103 | $hotSpot['type'] = 'noerror'; |
104 | - } |
|
104 | + } |
|
105 | 105 | |
106 | - // This is a good answer, count + 1 for nmbr of clicks |
|
107 | - if ($hotspot['hotspot_type'] > 0) |
|
108 | - { |
|
109 | - $nmbrTries++; |
|
110 | - } |
|
106 | + // This is a good answer, count + 1 for nmbr of clicks |
|
107 | + if ($hotspot['hotspot_type'] > 0) |
|
108 | + { |
|
109 | + $nmbrTries++; |
|
110 | + } |
|
111 | 111 | |
112 | 112 | $hotSpot['coord'] = $hotspot['hotspot_coordinates']; |
113 | 113 |
@@ -171,10 +171,11 @@ |
||
171 | 171 | } |
172 | 172 | echo '</div>'; |
173 | 173 | |
174 | - if ($objExercise->feedback_type == 1) |
|
175 | - Display::display_normal_message( |
|
174 | + if ($objExercise->feedback_type == 1) { |
|
175 | + Display::display_normal_message( |
|
176 | 176 | get_lang('DirectFeedbackCantModifyTypeQuestion') |
177 | 177 | ); |
178 | + } |
|
178 | 179 | |
179 | 180 | if (api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { |
180 | 181 | Display::display_error_message(get_lang('SearchXapianModuleNotInstalled')); |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | $gradebook = $_SESSION['gradebook']; |
167 | 167 | } |
168 | 168 | |
169 | - if (!empty($gradebook) && $gradebook=='view') { |
|
170 | - $interbreadcrumb[]= array ( |
|
169 | + if (!empty($gradebook) && $gradebook == 'view') { |
|
170 | + $interbreadcrumb[] = array( |
|
171 | 171 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
172 | 172 | 'name' => get_lang('ToolGradebook') |
173 | 173 | ); |
@@ -187,19 +187,19 @@ discard block |
||
187 | 187 | echo '<div class="actions">'; |
188 | 188 | |
189 | 189 | if ($objExercise->id != 0) { |
190 | - echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">' . |
|
190 | + echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'. |
|
191 | 191 | Display :: return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>'; |
192 | 192 | } else { |
193 | - if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])){ |
|
194 | - if (!empty($_POST['lp_id'])){ |
|
193 | + if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) { |
|
194 | + if (!empty($_POST['lp_id'])) { |
|
195 | 195 | $lp_id = intval($_POST['lp_id']); |
196 | 196 | //TODO:this remains to be implemented after press the first post |
197 | 197 | } else { |
198 | 198 | $lp_id = intval($_GET['lp_id']); |
199 | 199 | } |
200 | - echo "<a href=\"../lp/lp_controller.php?".api_get_cidreq()."&gradebook=&action=add_item&type=step&lp_id=".$lp_id."#resource_tab-2\">".Display::return_icon('back.png', get_lang("BackTo").' '.get_lang("LearningPaths"),'',ICON_SIZE_MEDIUM)."</a>"; |
|
200 | + echo "<a href=\"../lp/lp_controller.php?".api_get_cidreq()."&gradebook=&action=add_item&type=step&lp_id=".$lp_id."#resource_tab-2\">".Display::return_icon('back.png', get_lang("BackTo").' '.get_lang("LearningPaths"), '', ICON_SIZE_MEDIUM)."</a>"; |
|
201 | 201 | } else { |
202 | - echo '<a href="exercise.php?'.api_get_cidreq().'">' . |
|
202 | + echo '<a href="exercise.php?'.api_get_cidreq().'">'. |
|
203 | 203 | Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM). |
204 | 204 | '</a>'; |
205 | 205 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | get_lang('DirectFeedbackCantModifyTypeQuestion') |
212 | 212 | ); |
213 | 213 | |
214 | - if (api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { |
|
214 | + if (api_get_setting('search_enabled') == 'true' && !extension_loaded('xapian')) { |
|
215 | 215 | Display::display_error_message(get_lang('SearchXapianModuleNotInstalled')); |
216 | 216 | } |
217 | 217 |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | /** |
9 | 9 | * Code |
10 | 10 | */ |
11 | -include_once dirname(__FILE__) . '/../../../global.inc.php'; |
|
12 | -require_once dirname(__FILE__) . '/search_processor.class.php'; |
|
11 | +include_once dirname(__FILE__).'/../../../global.inc.php'; |
|
12 | +require_once dirname(__FILE__).'/search_processor.class.php'; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Process exercises before pass it to search listing scripts |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $visibility = api_get_item_visibility(api_get_course_info($courseid), TOOL_QUIZ, $exercise_id); |
71 | 71 | if ($visibility) { |
72 | 72 | list($thumbnail, $image, $name, $author) = $this->get_information($courseid, $exercise_id); |
73 | - $url = api_get_path(WEB_CODE_PATH) . 'exercise/exercise_submit.php?cidReq=%s&exerciseId=%s'; |
|
73 | + $url = api_get_path(WEB_CODE_PATH).'exercise/exercise_submit.php?cidReq=%s&exerciseId=%s'; |
|
74 | 74 | $url = sprintf($url, $courseid, $exercise_id); |
75 | 75 | $result = array( |
76 | 76 | 'toolid' => TOOL_QUIZ, |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | /** |
217 | 217 | * Import the aicc object (as a result from the parse_config_files function) into the database structure |
218 | 218 | * @param string $course_code |
219 | - * @return bool Returns -1 on error |
|
219 | + * @return false|null Returns -1 on error |
|
220 | 220 | */ |
221 | 221 | public function import_aicc($course_code) |
222 | 222 | { |
@@ -780,7 +780,8 @@ discard block |
||
780 | 780 | * Static function to parse AICC ini files. |
781 | 781 | * Based on work by sinedeo at gmail dot com published on php.net (parse_ini_file()). |
782 | 782 | * @param string File path |
783 | - * @return array Structured array |
|
783 | + * @param string $f |
|
784 | + * @return string Structured array |
|
784 | 785 | */ |
785 | 786 | function parse_ini_file_quotes_safe($f) { |
786 | 787 | $null = ''; |
@@ -831,7 +832,7 @@ discard block |
||
831 | 832 | * Based on work by sinedeo at gmail dot com published on php.net (parse_ini_file()). |
832 | 833 | * @param string INI File string |
833 | 834 | * @param array List of names of sections that should be considered as containing only hard string data (no variables), provided in lower case |
834 | - * @return array Structured array |
|
835 | + * @return string Structured array |
|
835 | 836 | */ |
836 | 837 | function parse_ini_string_quotes_safe($s, $pure_strings = array()) { |
837 | 838 | $null = ''; |
@@ -894,6 +895,7 @@ discard block |
||
894 | 895 | * @param string CSV delimiter |
895 | 896 | * @param string CSV enclosure |
896 | 897 | * @param boolean Might one field name happen more than once on the same line? (then split by comma in the values) |
898 | + * @param string $f |
|
897 | 899 | * @return array Simple structured array |
898 | 900 | */ |
899 | 901 | function parse_csv_file($f, $delim = ',', $enclosure = '"', $multiples = false) { |
@@ -320,12 +320,12 @@ discard block |
||
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | - /** |
|
324 | - * Intermediate to import_package only to allow import from local zip files |
|
325 | - * @param string Path to the zip file, from the dokeos sys root |
|
326 | - * @param string Current path (optional) |
|
327 | - * @return string Absolute path to the AICC description files or empty string on error |
|
328 | - */ |
|
323 | + /** |
|
324 | + * Intermediate to import_package only to allow import from local zip files |
|
325 | + * @param string Path to the zip file, from the dokeos sys root |
|
326 | + * @param string Current path (optional) |
|
327 | + * @return string Absolute path to the AICC description files or empty string on error |
|
328 | + */ |
|
329 | 329 | function import_local_package($file_path, $current_dir = '') |
330 | 330 | { |
331 | 331 | // TODO: Prepare info as given by the $_FILES[''] vector. |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | $current_dir = api_replace_dangerous_char(trim($current_dir)); // Current dir we are in, inside scorm/ |
356 | 356 | if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Current_dir = '.$current_dir, 0); } |
357 | 357 | |
358 | - //$uploaded_filename = $_FILES['userFile']['name']; |
|
358 | + //$uploaded_filename = $_FILES['userFile']['name']; |
|
359 | 359 | // Get the name of the zip file without the extension. |
360 | 360 | if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Received zip file name: '.$zip_file_path, 0); } |
361 | 361 | $file_info = pathinfo($zip_file_name); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | class aicc extends learnpath |
13 | 13 | { |
14 | 14 | public $config = array(); |
15 | - public $config_basename = ''; // The configuration files might be multiple and might have |
|
15 | + public $config_basename = ''; // The configuration files might be multiple and might have |
|
16 | 16 | // funny names. We need to keep the name of that file while we |
17 | 17 | // install the content. |
18 | 18 | public $config_files = array(); |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | public $cstlist = array(); |
33 | 33 | public $orelist = array(); |
34 | 34 | |
35 | - public $subdir = ''; // Path between the scorm/ directory and the config files e.g. maritime_nav/maritime_nav. This is the path that will be used in the lp_path when importing a package. |
|
36 | - public $zipname = ''; // Keeps the zipfile safe for the object's life so that we can use it if there is no title available. |
|
37 | - public $lastzipnameindex = 0; // Keeps an index of the number of uses of the zipname so far. |
|
35 | + public $subdir = ''; // Path between the scorm/ directory and the config files e.g. maritime_nav/maritime_nav. This is the path that will be used in the lp_path when importing a package. |
|
36 | + public $zipname = ''; // Keeps the zipfile safe for the object's life so that we can use it if there is no title available. |
|
37 | + public $lastzipnameindex = 0; // Keeps an index of the number of uses of the zipname so far. |
|
38 | 38 | public $config_encoding = 'ISO-8859-1'; |
39 | 39 | public $debug = 0; |
40 | 40 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | //echo '<pre>des:'.print_r($des_params, true).'</pre>'; |
133 | 133 | if ($this->debug > 1) { error_log('New LP - In aicc::parse_config_files() - '.$des_file.' has been parsed', 0); } |
134 | 134 | // Distribute des params into the aicc object. |
135 | - foreach ($des_params as $des){ |
|
135 | + foreach ($des_params as $des) { |
|
136 | 136 | // One AU in AICC is equivalent to one SCO in SCORM (scormItem class). |
137 | 137 | $oDes = new aiccResource('config', $des); |
138 | 138 | $this->deslist[$oDes->identifier] = $oDes; |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | |
243 | 243 | $this->config_encoding = "ISO-8859-1"; // TODO: We may apply detection for this value, see the function api_detect_encoding(). |
244 | 244 | |
245 | - $sql = "INSERT INTO $new_lp (c_id, lp_type, name, ref, description, path, force_commit, default_view_mod, default_encoding, js_lib, content_maker,display_order)" . |
|
246 | - "VALUES " . |
|
247 | - "($course_id, 3, '".$this->course_title."', '".$this->course_id."','".$this->course_description."'," . |
|
248 | - "'".$this->subdir."', 0, 'embedded', '".$this->config_encoding."'," . |
|
245 | + $sql = "INSERT INTO $new_lp (c_id, lp_type, name, ref, description, path, force_commit, default_view_mod, default_encoding, js_lib, content_maker,display_order)". |
|
246 | + "VALUES ". |
|
247 | + "($course_id, 3, '".$this->course_title."', '".$this->course_id."','".$this->course_description."',". |
|
248 | + "'".$this->subdir."', 0, 'embedded', '".$this->config_encoding."',". |
|
249 | 249 | "'aicc_api.php','".$this->course_creator."',$dsp)"; |
250 | - if ($this->debug > 2) { error_log('New LP - In import_aicc(), inserting path: '. $sql, 0); } |
|
250 | + if ($this->debug > 2) { error_log('New LP - In import_aicc(), inserting path: '.$sql, 0); } |
|
251 | 251 | Database::query($sql); |
252 | 252 | $lp_id = Database::insert_id(); |
253 | 253 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | $previous = 0; |
278 | 278 | foreach ($this->aulist as $identifier => $dummy) { |
279 | - $oAu =& $this->aulist[$identifier]; |
|
279 | + $oAu = & $this->aulist[$identifier]; |
|
280 | 280 | //echo "Item ".$oAu->identifier; |
281 | 281 | $field_add = ''; |
282 | 282 | $value_add = ''; |
@@ -294,12 +294,12 @@ discard block |
||
294 | 294 | $parent = 0; // TODO: Deal with the parent. |
295 | 295 | $previous = 0; |
296 | 296 | $prereq = $oAu->prereq_string; |
297 | - $sql_item = "INSERT INTO $new_lp_item (c_id, lp_id,item_type,ref,title, path,min_score,max_score, $field_add parent_item_id,previous_item_id,next_item_id, prerequisite,display_order,parameters) " . |
|
298 | - "VALUES " . |
|
299 | - "($course_id, $lp_id, 'au','".$oAu->identifier."','".$title."'," . |
|
300 | - "'$path',0,100, $value_add" . |
|
301 | - "$parent, $previous, 0, " . |
|
302 | - "'$prereq', 0,'".(!empty($oAu->parameters)?Database::escape_string($oAu->parameters):'')."'" . |
|
297 | + $sql_item = "INSERT INTO $new_lp_item (c_id, lp_id,item_type,ref,title, path,min_score,max_score, $field_add parent_item_id,previous_item_id,next_item_id, prerequisite,display_order,parameters) ". |
|
298 | + "VALUES ". |
|
299 | + "($course_id, $lp_id, 'au','".$oAu->identifier."','".$title."',". |
|
300 | + "'$path',0,100, $value_add". |
|
301 | + "$parent, $previous, 0, ". |
|
302 | + "'$prereq', 0,'".(!empty($oAu->parameters) ? Database::escape_string($oAu->parameters) : '')."'". |
|
303 | 303 | ")"; |
304 | 304 | Database::query($sql_item); |
305 | 305 | if ($this->debug > 1) { error_log('New LP - In aicc::import_aicc() - inserting item : '.$sql_item.' : ', 0); } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | $zip_file_name = $zip_file_info['name']; |
351 | 351 | |
352 | 352 | if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Zip file path = '.$zip_file_path.', zip file name = '.$zip_file_name, 0); } |
353 | - $course_rel_dir = api_get_course_path().'/scorm'; // Scorm dir web path starting from /courses |
|
353 | + $course_rel_dir = api_get_course_path().'/scorm'; // Scorm dir web path starting from /courses |
|
354 | 354 | $course_sys_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path of this course. |
355 | 355 | $current_dir = api_replace_dangerous_char(trim($current_dir)); // Current dir we are in, inside scorm/ |
356 | 356 | if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Current_dir = '.$current_dir, 0); } |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Base file name is : '.$file_base_name, 0); } |
368 | 368 | $new_dir = api_replace_dangerous_char(trim($file_base_name)); |
369 | 369 | $this->subdir = $new_dir; |
370 | - if($this->debug > 0) { error_log('New LP - aicc::import_package() - Subdir is first set to : '.$this->subdir, 0); } |
|
370 | + if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Subdir is first set to : '.$this->subdir, 0); } |
|
371 | 371 | |
372 | 372 | /* |
373 | 373 | if (check_name_exist($course_sys_dir.$current_dir.'/'.$new_dir)) { |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | $subdir_isset = true; |
414 | 414 | } else { |
415 | 415 | if (!$subdir_isset) { |
416 | - if (preg_match('?^.*/aicc$?i',dirname($thisContent['filename']))) { |
|
416 | + if (preg_match('?^.*/aicc$?i', dirname($thisContent['filename']))) { |
|
417 | 417 | //echo "Cutting subdir<br/>"; |
418 | 418 | $this->subdir .= '/'.substr(dirname($thisContent['filename']), 0, -5); |
419 | 419 | } else { |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | // TODO: RENAMING FILES CAN BE VERY DANGEROUS AICC-WISE, avoid that as much as possible! |
517 | 517 | //$safe_file = api_replace_dangerous_char($file, 'strict'); |
518 | 518 | $find_str = array('\\', '.php', '.phtml'); |
519 | - $repl_str = array('/', '.txt', '.txt'); |
|
519 | + $repl_str = array('/', '.txt', '.txt'); |
|
520 | 520 | $safe_file = str_replace($find_str, $repl_str, $file); |
521 | 521 | |
522 | 522 | if ($safe_file != $file) { |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | if ($this->debug > 0) { error_log('In aicc::get_res_path('.$id.') method', 0); } |
718 | 718 | $path = ''; |
719 | 719 | if (isset($this->resources[$id])) { |
720 | - $oRes =& $this->resources[$id]; |
|
720 | + $oRes = & $this->resources[$id]; |
|
721 | 721 | $path = @$oRes->get_path(); |
722 | 722 | } |
723 | 723 | return $path; |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | if ($this->debug > 0) { error_log('In aicc::get_res_type('.$id.') method', 0); } |
734 | 734 | $type = ''; |
735 | 735 | if (isset($this->resources[$id])) { |
736 | - $oRes =& $this->resources[$id]; |
|
736 | + $oRes = & $this->resources[$id]; |
|
737 | 737 | $temptype = $oRes->get_scorm_type(); |
738 | 738 | if (!empty($temptype)) { |
739 | 739 | $type = $temptype; |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | * Gets the default organisation's title |
747 | 747 | * @return string The organization's title |
748 | 748 | */ |
749 | - function get_title(){ |
|
749 | + function get_title() { |
|
750 | 750 | if ($this->debug > 0) { error_log('In aicc::get_title() method', 0); } |
751 | 751 | $title = ''; |
752 | 752 | if (isset($this->config['organizations']['default'])) { |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | $chr = $data{$i}; |
908 | 908 | switch ($chr) { |
909 | 909 | case $enclosure: |
910 | - if ($enclosed && $data{$i+1} == $enclosure) { |
|
910 | + if ($enclosed && $data{$i + 1} == $enclosure) { |
|
911 | 911 | $fldval .= $chr; |
912 | 912 | ++$i; // Skip the next character. |
913 | 913 | } else |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | $fldval .= $chr; |
922 | 922 | break; |
923 | 923 | case "\r": |
924 | - if (!$enclosed&&$data{$i+1} == "\n") |
|
924 | + if (!$enclosed && $data{$i + 1} == "\n") |
|
925 | 925 | continue; |
926 | 926 | case "\n": |
927 | 927 | if (!$enclosed) { |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | $fldval .= $chr; |
933 | 933 | break; |
934 | 934 | case "\\r": |
935 | - if (!$enclosed&&$data{$i+1} == "\\n") |
|
935 | + if (!$enclosed && $data{$i + 1} == "\\n") |
|
936 | 936 | continue; |
937 | 937 | case "\\n": |
938 | 938 | if (!$enclosed) { |
@@ -509,7 +509,9 @@ discard block |
||
509 | 509 | if ($file != '.' && $file != '..') { |
510 | 510 | $filetype = 'file'; |
511 | 511 | |
512 | - if (is_dir($course_sys_dir.$new_dir.$file)) $filetype = 'folder'; |
|
512 | + if (is_dir($course_sys_dir.$new_dir.$file)) { |
|
513 | + $filetype = 'folder'; |
|
514 | + } |
|
513 | 515 | |
514 | 516 | // TODO: RENAMING FILES CAN BE VERY DANGEROUS AICC-WISE, avoid that as much as possible! |
515 | 517 | //$safe_file = api_replace_dangerous_char($file, 'strict'); |
@@ -908,37 +910,43 @@ discard block |
||
908 | 910 | if ($enclosed && $data{$i+1} == $enclosure) { |
909 | 911 | $fldval .= $chr; |
910 | 912 | ++$i; // Skip the next character. |
911 | - } else |
|
912 | - $enclosed = !$enclosed; |
|
913 | + } else { |
|
914 | + $enclosed = !$enclosed; |
|
915 | + } |
|
913 | 916 | break; |
914 | 917 | case $delim: |
915 | 918 | if (!$enclosed) { |
916 | 919 | $ret_array[$linecount][$fldcount++] = $fldval; |
917 | 920 | $fldval = ''; |
918 | - } else |
|
919 | - $fldval .= $chr; |
|
921 | + } else { |
|
922 | + $fldval .= $chr; |
|
923 | + } |
|
920 | 924 | break; |
921 | 925 | case "\r": |
922 | - if (!$enclosed&&$data{$i+1} == "\n") |
|
923 | - continue; |
|
926 | + if (!$enclosed&&$data{$i+1} == "\n") { |
|
927 | + continue; |
|
928 | + } |
|
924 | 929 | case "\n": |
925 | 930 | if (!$enclosed) { |
926 | 931 | $ret_array[$linecount++][$fldcount] = $fldval; |
927 | 932 | $fldcount = 0; |
928 | 933 | $fldval = ''; |
929 | - } else |
|
930 | - $fldval .= $chr; |
|
934 | + } else { |
|
935 | + $fldval .= $chr; |
|
936 | + } |
|
931 | 937 | break; |
932 | 938 | case "\\r": |
933 | - if (!$enclosed&&$data{$i+1} == "\\n") |
|
934 | - continue; |
|
939 | + if (!$enclosed&&$data{$i+1} == "\\n") { |
|
940 | + continue; |
|
941 | + } |
|
935 | 942 | case "\\n": |
936 | 943 | if (!$enclosed) { |
937 | 944 | $ret_array[$linecount++][$fldcount] = $fldval; |
938 | 945 | $fldcount = 0; |
939 | 946 | $fldval = ''; |
940 | - } else |
|
941 | - $fldval .= $chr; |
|
947 | + } else { |
|
948 | + $fldval .= $chr; |
|
949 | + } |
|
942 | 950 | break; |
943 | 951 | default: |
944 | 952 | $fldval .= $chr; |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * @param int $categoryId |
35 | 35 | * @param bool $ignoreCategoryFilter |
36 | 36 | * |
37 | - * @return void |
|
37 | + * @return false|null |
|
38 | 38 | */ |
39 | 39 | public function __construct( |
40 | 40 | $user_id, |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | // it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility()) |
119 | 119 | // is done using domesticate() |
120 | 120 | $myname = domesticate($row->getName()); |
121 | - $mylink = 'lp/lp_controller.php?action=view&lp_id=' . $row->getIid() . '&id_session='.$session_id; |
|
121 | + $mylink = 'lp/lp_controller.php?action=view&lp_id='.$row->getIid().'&id_session='.$session_id; |
|
122 | 122 | |
123 | 123 | $sql2 = "SELECT * FROM $tbl_tool |
124 | 124 | WHERE |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | |
220 | 220 | $lessons = array(); |
221 | 221 | while ($row = Database::fetch_array($result)) { |
222 | - if (api_get_item_visibility($course, 'learnpath', $row['id'], $session_id)) { |
|
222 | + if (api_get_item_visibility($course, 'learnpath', $row['id'], $session_id)) { |
|
223 | 223 | $lessons[$row['id']] = $row; |
224 | 224 | } |
225 | 225 | } |
@@ -20,9 +20,9 @@ |
||
20 | 20 | * @param int $user_id User ID |
21 | 21 | * @param int $view_id View ID |
22 | 22 | * @param int $item_id Item ID |
23 | - * @param float $score Current score |
|
24 | - * @param float $max Maximum score |
|
25 | - * @param float $min Minimum score |
|
23 | + * @param integer $score Current score |
|
24 | + * @param integer $max Maximum score |
|
25 | + * @param integer $min Minimum score |
|
26 | 26 | * @param string $status Lesson status |
27 | 27 | * @param int $time Session time |
28 | 28 | * @param string $suspend Suspend data |
@@ -458,7 +458,7 @@ |
||
458 | 458 | } |
459 | 459 | |
460 | 460 | if ($myLP->get_type() == 2) { |
461 | - $return .= "update_stats();"; |
|
461 | + $return .= "update_stats();"; |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | // To be sure progress is updated. |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | // Set status to completed for hotpotatoes if score > 80%. |
164 | 164 | if ($my_type == 'hotpotatoes') { |
165 | 165 | if ((empty($status) || $status == 'undefined' || $status == 'not attempted') && $max > 0) { |
166 | - if (($score/$max) > 0.8) { |
|
166 | + if (($score / $max) > 0.8) { |
|
167 | 167 | $myStatus = 'completed'; |
168 | 168 | if ($debug > 1) { |
169 | 169 | error_log('Calling set_status('.$myStatus.') for hotpotatoes', 0); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | error_log('Done calling set_status for hotpotatoes - now '.$myLPI->get_status(false), 0); |
175 | 175 | } |
176 | 176 | } |
177 | - } elseif ($status == 'completed' && $max > 0 && ($score/$max) < 0.8) { |
|
177 | + } elseif ($status == 'completed' && $max > 0 && ($score / $max) < 0.8) { |
|
178 | 178 | $myStatus = 'failed'; |
179 | 179 | if ($debug > 1) { |
180 | 180 | error_log('Calling set_status('.$myStatus.') for hotpotatoes', 0); |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | $myLPI->current_data = $suspend; |
368 | 368 | } |
369 | 369 | |
370 | - if (isset($location) && $location != '' && $location!='undefined') { |
|
370 | + if (isset($location) && $location != '' && $location != 'undefined') { |
|
371 | 371 | $myLPI->set_lesson_location($location); |
372 | 372 | } |
373 | 373 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | /** |
10 | 10 | * Start a timer and hand it back to the JS by assigning the current time (of start) to |
11 | 11 | * var asset_timer |
12 | - * @return string JavaScript time intializer |
|
12 | + * @return integer JavaScript time intializer |
|
13 | 13 | */ |
14 | 14 | function start_timer() { |
15 | 15 | $time = time(); |
@@ -116,7 +116,7 @@ |
||
116 | 116 | * @param int $sessionId |
117 | 117 | * @param string $downloadCertificateLink |
118 | 118 | * @param string $badgeLink |
119 | - * @return mixed|string |
|
119 | + * @return string |
|
120 | 120 | */ |
121 | 121 | function generateLPFinalItemTemplate($lpItemId, $courseCode, $sessionId=0, $downloadCertificateLink='', $badgeLink='') |
122 | 122 | { |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // Initialize context |
9 | 9 | $_in_course = true; |
10 | 10 | |
11 | -require_once __DIR__ . '/../inc/global.inc.php'; |
|
11 | +require_once __DIR__.'/../inc/global.inc.php'; |
|
12 | 12 | |
13 | 13 | $current_course_tool = TOOL_GRADEBOOK; |
14 | 14 | |
@@ -170,19 +170,19 @@ discard block |
||
170 | 170 | <div class='row'> |
171 | 171 | <div class='col-md-2 col-xs-4'> |
172 | 172 | <div class='thumbnail'> |
173 | - <img class='skill-badge-img' src='" . $skill->getWebIconPath() . "' > |
|
173 | + <img class='skill-badge-img' src='" . $skill->getWebIconPath()."' > |
|
174 | 174 | </div> |
175 | 175 | </div> |
176 | 176 | <div class='col-md-8 col-xs-8'> |
177 | - <h5><b>" . $skill->getName() . "</b></h5> |
|
178 | - " . $skill->getDescription() . " |
|
177 | + <h5><b>" . $skill->getName()."</b></h5> |
|
178 | + " . $skill->getDescription()." |
|
179 | 179 | </div> |
180 | 180 | <div class='col-md-2 col-xs-12'> |
181 | - <h5><b>" . get_lang('ShareWithYourFriends') . "</b></h5> |
|
182 | - <a href='http://www.facebook.com/sharer.php?u=" . api_get_path(WEB_PATH) . "badge/" . $skill->getId() . "/user/" . $userId . "' target='_new'> |
|
181 | + <h5><b>" . get_lang('ShareWithYourFriends')."</b></h5> |
|
182 | + <a href='http://www.facebook.com/sharer.php?u=" . api_get_path(WEB_PATH)."badge/".$skill->getId()."/user/".$userId."' target='_new'> |
|
183 | 183 | <em class='fa fa-facebook-square fa-3x text-info' aria-hidden='true'></em> |
184 | 184 | </a> |
185 | - <a href='https://twitter.com/home?status=" . sprintf(get_lang('IHaveObtainedSkillXOnY'), '"' . $skill->getName() . '"', api_get_setting('siteName')) . ' - ' . api_get_path(WEB_PATH) . 'badge/' . $skill->getId() . '/user/' . $userId . "' target='_new'> |
|
185 | + <a href='https://twitter.com/home?status=" . sprintf(get_lang('IHaveObtainedSkillXOnY'), '"'.$skill->getName().'"', api_get_setting('siteName')).' - '.api_get_path(WEB_PATH).'badge/'.$skill->getId().'/user/'.$userId."' target='_new'> |
|
186 | 186 | <em class='fa fa-twitter-square fa-3x text-light' aria-hidden='true'></em> |
187 | 187 | </a> |
188 | 188 | </div> |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $badgeLink .= " |
193 | 193 | <div class='panel panel-default'> |
194 | 194 | <div class='panel-body'> |
195 | - <h3 class='text-center'>" . get_lang('AdditionallyYouHaveObtainedTheFollowingSkills') . "</h3> |
|
195 | + <h3 class='text-center'>" . get_lang('AdditionallyYouHaveObtainedTheFollowingSkills')."</h3> |
|
196 | 196 | $skillList |
197 | 197 | </div> |
198 | 198 | </div> |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | function generateLPFinalItemTemplateCertificateLinks($certificate) |
210 | 210 | { |
211 | 211 | $downloadCertificateLink = Display::url( |
212 | - Display::returnFontAwesomeIcon('file-pdf-o') . get_lang('DownloadCertificatePdf'), |
|
212 | + Display::returnFontAwesomeIcon('file-pdf-o').get_lang('DownloadCertificatePdf'), |
|
213 | 213 | $certificate['pdf_url'], |
214 | 214 | ['class' => 'btn btn-default'] |
215 | 215 | ); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $downloadCertificateLink = " |
218 | 218 | <div class='panel panel-default'> |
219 | 219 | <div class='panel-body'> |
220 | - <h3 class='text-center'>" . get_lang('NowDownloadYourCertificateClickHere') . "</h3> |
|
220 | + <h3 class='text-center'>" . get_lang('NowDownloadYourCertificateClickHere')."</h3> |
|
221 | 221 | <div class='text-center'>$downloadCertificateLink $viewCertificateLink</div> |
222 | 222 | </div> |
223 | 223 | </div> |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * Gets html pages and compose them into a learning path |
40 | 40 | * @param array The files that will compose the generated learning path. Unused so far. |
41 | - * @return boolean False if file does not exit. Nothing otherwise. |
|
41 | + * @return false|null False if file does not exit. Nothing otherwise. |
|
42 | 42 | */ |
43 | 43 | public function make_lp($files = array()) |
44 | 44 | { |
@@ -92,6 +92,7 @@ discard block |
||
92 | 92 | * Manages chapter splitting |
93 | 93 | * @param string Chapter header |
94 | 94 | * @param string Content |
95 | + * @param string $content |
|
95 | 96 | * @return void |
96 | 97 | */ |
97 | 98 | function dealPerChapter($header, $content) |
@@ -164,6 +165,7 @@ discard block |
||
164 | 165 | * Manages page splitting |
165 | 166 | * @param string Page header |
166 | 167 | * @param string Page body |
168 | + * @param string $body |
|
167 | 169 | * @return void |
168 | 170 | */ |
169 | 171 | function dealPerPage($header, $body) |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | if (empty($matches[1][$i])) |
127 | 127 | continue; |
128 | 128 | |
129 | - $content = strstr($content,$matches[0][$i]); |
|
129 | + $content = strstr($content, $matches[0][$i]); |
|
130 | 130 | if ($i + 1 !== count($matches[0])) { |
131 | 131 | $chapter_content = substr($content, 0, strpos($content, $matches[0][$i + 1])); |
132 | 132 | } else { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | $document_id = add_document($_course, $this->created_dir.'/'.$html_file, 'file', filesize($this->base_work_dir.$this->created_dir.'/'.$html_file), $html_file); |
150 | 150 | |
151 | - if ($document_id){ |
|
151 | + if ($document_id) { |
|
152 | 152 | |
153 | 153 | // Put the document in item_property update. |
154 | 154 | api_item_property_update( |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | foreach ($specific_fields as $specific_field) { |
255 | 255 | if (isset($_REQUEST[$specific_field['code']])) { |
256 | 256 | $sterms = trim($_REQUEST[$specific_field['code']]); |
257 | - $all_specific_terms .= ' '. $sterms; |
|
257 | + $all_specific_terms .= ' '.$sterms; |
|
258 | 258 | if (!empty($sterms)) { |
259 | 259 | $sterms = explode(',', $sterms); |
260 | 260 | foreach ($sterms as $sterm) { |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | } |
264 | 264 | } |
265 | 265 | } |
266 | - $page_content = $all_specific_terms .' '. $page_content; |
|
266 | + $page_content = $all_specific_terms.' '.$page_content; |
|
267 | 267 | $ic_slide->addValue('content', $page_content); |
268 | 268 | // Add a comment to say terms separated by commas. |
269 | - $courseid=api_get_course_id(); |
|
269 | + $courseid = api_get_course_id(); |
|
270 | 270 | $ic_slide->addCourseId($courseid); |
271 | 271 | $ic_slide->addToolId(TOOL_LEARNPATH); |
272 | 272 | $lp_id = $this->lp_id; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | SE_COURSE_ID => $courseid, |
275 | 275 | SE_TOOL_ID => TOOL_LEARNPATH, |
276 | 276 | SE_DATA => array('lp_id' => $lp_id, 'lp_item'=> $previous, 'document_id' => $document_id), |
277 | - SE_USER => (int)api_get_user_id(), |
|
277 | + SE_USER => (int) api_get_user_id(), |
|
278 | 278 | ); |
279 | 279 | $ic_slide->xapian_data = serialize($xapian_data); |
280 | 280 | $di->addChunk($ic_slide); |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | * Returns additional Java command parameters |
299 | 299 | * @return string The additional parameters to be used in the Java call |
300 | 300 | */ |
301 | - function add_command_parameters(){ |
|
301 | + function add_command_parameters() { |
|
302 | 302 | return ' -d woogie "'.$this->base_work_dir.'/'.$this->file_path.'" "'.$this->base_work_dir.$this->created_dir.'/'.$this->file_name.'.html"'; |
303 | 303 | } |
304 | 304 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | */ |
311 | 311 | function format_page_content($header, $content) { |
312 | 312 | // Limit the width of the doc. |
313 | - list($max_width, $max_height) = explode('x',api_get_setting('service_ppt2lp','size')); |
|
313 | + list($max_width, $max_height) = explode('x', api_get_setting('service_ppt2lp', 'size')); |
|
314 | 314 | |
315 | 315 | $content = preg_replace("|<body[^>]*>|i", "\\0\r\n<div style=\"width:".$max_width."\">", $content, -1, $count); |
316 | 316 | if ($count < 1) { |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | } |
344 | 344 | |
345 | 345 | } elseif ($img_width > $max_width - 10) { |
346 | - $picture_resized = str_ireplace('width='.$img_width, 'width="'.($max_width-10).'"', $images[0][$key]); |
|
346 | + $picture_resized = str_ireplace('width='.$img_width, 'width="'.($max_width - 10).'"', $images[0][$key]); |
|
347 | 347 | $content = str_replace($images[0][$key], $picture_resized, $content); |
348 | 348 | } |
349 | 349 | } |
@@ -119,8 +119,9 @@ |
||
119 | 119 | |
120 | 120 | for ($i = 0; $i<count($matches[0]); $i++) { |
121 | 121 | |
122 | - if (empty($matches[1][$i])) |
|
123 | - continue; |
|
122 | + if (empty($matches[1][$i])) { |
|
123 | + continue; |
|
124 | + } |
|
124 | 125 | |
125 | 126 | $content = api_strstr($content, $matches[0][$i]); |
126 | 127 | if ($i + 1 !== count($matches[0])) { |