@@ -98,7 +98,7 @@ |
||
| 98 | 98 | foreach ($this->items as $id => $dummy) { |
| 99 | 99 | $abs_order = 0; |
| 100 | 100 | // Passes the array as a pointer so it is modified in $list directly. |
| 101 | - $this->items[$id]->get_flat_list($list,$abs_order, $i, 0); |
|
| 101 | + $this->items[$id]->get_flat_list($list, $abs_order, $i, 0); |
|
| 102 | 102 | $i++; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -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) { |
@@ -78,33 +78,33 @@ discard block |
||
| 78 | 78 | var commit = false ; |
| 79 | 79 | |
| 80 | 80 | // Strictly SCORM variables. |
| 81 | -var score=<?php echo $oItem->get_score();?>; |
|
| 82 | -var max=<?php echo $oItem->get_max();?>; |
|
| 83 | -var min=<?php echo $oItem->get_min();?>; |
|
| 84 | -var lesson_status='<?php echo $oItem->get_status();?>'; |
|
| 85 | -var session_time='<?php echo $oItem->get_scorm_time('js');?>'; |
|
| 86 | -var suspend_data = '<?php echo $oItem->get_suspend_data();?>'; |
|
| 87 | -var lesson_location = '<?php echo $oItem->get_lesson_location();?>'; |
|
| 88 | -var total_time = '<?php echo $oItem->get_scorm_time('js');?>'; |
|
| 81 | +var score=<?php echo $oItem->get_score(); ?>; |
|
| 82 | +var max=<?php echo $oItem->get_max(); ?>; |
|
| 83 | +var min=<?php echo $oItem->get_min(); ?>; |
|
| 84 | +var lesson_status='<?php echo $oItem->get_status(); ?>'; |
|
| 85 | +var session_time='<?php echo $oItem->get_scorm_time('js'); ?>'; |
|
| 86 | +var suspend_data = '<?php echo $oItem->get_suspend_data(); ?>'; |
|
| 87 | +var lesson_location = '<?php echo $oItem->get_lesson_location(); ?>'; |
|
| 88 | +var total_time = '<?php echo $oItem->get_scorm_time('js'); ?>'; |
|
| 89 | 89 | |
| 90 | 90 | // Chamilo internal variables. |
| 91 | 91 | var saved_lesson_status = 'not attempted'; |
| 92 | -var lms_lp_id = <?php echo $oLP->get_id();?>; |
|
| 93 | -var lms_item_id = <?php echo $oItem->get_id();?>; |
|
| 92 | +var lms_lp_id = <?php echo $oLP->get_id(); ?>; |
|
| 93 | +var lms_item_id = <?php echo $oItem->get_id(); ?>; |
|
| 94 | 94 | //var lms_new_item_id = 0; //temporary value (only there between a load_item() and a LMSInitialize()) |
| 95 | 95 | var lms_been_synchronized = 0; |
| 96 | 96 | var lms_initialized = 0; |
| 97 | 97 | var lms_total_lessons = <?php echo $oLP->get_total_items_count(); ?>; |
| 98 | -var lms_complete_lessons = <?php echo $oLP->get_complete_items_count();?>; |
|
| 99 | -var lms_progress_bar_mode = '<?php echo $oLP->progress_bar_mode;?>'; |
|
| 98 | +var lms_complete_lessons = <?php echo $oLP->get_complete_items_count(); ?>; |
|
| 99 | +var lms_progress_bar_mode = '<?php echo $oLP->progress_bar_mode; ?>'; |
|
| 100 | 100 | if(lms_progress_bar_mode == ''){lms_progress_bar_mode='%';} |
| 101 | -var lms_view_id = '<?php echo $oLP->get_view();?>'; |
|
| 101 | +var lms_view_id = '<?php echo $oLP->get_view(); ?>'; |
|
| 102 | 102 | if(lms_view_id == ''){ lms_view_id = 1;} |
| 103 | -var lms_user_id = '<?php echo $_user['user_id'];?>'; |
|
| 104 | -var lms_next_item = '<?php echo $oLP->get_next_item_id();?>'; |
|
| 105 | -var lms_previous_item = '<?php echo $oLP->get_previous_item_id();?>'; |
|
| 106 | -var lms_lp_type = '<?php echo $oLP->get_type();?>'; |
|
| 107 | -var lms_item_type = '<?php echo $oItem->get_type();?>'; |
|
| 103 | +var lms_user_id = '<?php echo $_user['user_id']; ?>'; |
|
| 104 | +var lms_next_item = '<?php echo $oLP->get_next_item_id(); ?>'; |
|
| 105 | +var lms_previous_item = '<?php echo $oLP->get_previous_item_id(); ?>'; |
|
| 106 | +var lms_lp_type = '<?php echo $oLP->get_type(); ?>'; |
|
| 107 | +var lms_item_type = '<?php echo $oItem->get_type(); ?>'; |
|
| 108 | 108 | |
| 109 | 109 | // Backup for old values. |
| 110 | 110 | var old_score = 0; |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | }else if(param == 'cmi.core.lesson_mode'){ |
| 163 | 163 | result='normal'; |
| 164 | 164 | }else if(param == 'cmi.suspend_data'){ |
| 165 | - result='<?php echo $oItem->get_suspend_data();?>'; |
|
| 165 | + result='<?php echo $oItem->get_suspend_data(); ?>'; |
|
| 166 | 166 | }else if(param == 'cmi.launch_data'){ |
| 167 | 167 | result=''; |
| 168 | 168 | }else if(param == 'cmi.objectives._count'){ |
| 169 | - result='<?php echo $oItem->get_view_count();?>'; |
|
| 169 | + result='<?php echo $oItem->get_view_count(); ?>'; |
|
| 170 | 170 | } |
| 171 | 171 | /* |
| 172 | 172 | // Switch not working??? WTF??? |
@@ -227,13 +227,13 @@ discard block |
||
| 227 | 227 | result='normal'; |
| 228 | 228 | break; |
| 229 | 229 | case 'cmi.suspend_data' : |
| 230 | - result='<?php echo $oItem->get_suspend_data();?>'; |
|
| 230 | + result='<?php echo $oItem->get_suspend_data(); ?>'; |
|
| 231 | 231 | break; |
| 232 | 232 | case 'cmi.launch_data' : |
| 233 | 233 | result=''; |
| 234 | 234 | break; |
| 235 | 235 | case 'cmi.objectives._count': |
| 236 | - result='<?php echo $oItem->get_view_count();?>'; |
|
| 236 | + result='<?php echo $oItem->get_view_count(); ?>'; |
|
| 237 | 237 | break; |
| 238 | 238 | default : |
| 239 | 239 | result=''; |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $url = $_SERVER['HTTP_HOST'].$self; |
| 286 | 286 | $url = substr($url, 0, -14); // 14 is the length of this file's name (/scorm_api.php). |
| 287 | 287 | echo $url; |
| 288 | - ?>/lp_controller.php?<?php echo api_get_cidreq(); ?>&action=save&lp_id=<?php echo $oLP->get_id();?>&" + param + ""; |
|
| 288 | + ?>/lp_controller.php?<?php echo api_get_cidreq(); ?>&action=save&lp_id=<?php echo $oLP->get_id(); ?>&" + param + ""; |
|
| 289 | 289 | logit_lms('saving data (status='+lesson_status+')',1); |
| 290 | 290 | xajax_save_item(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, score, max, min, lesson_status, session_time, suspend_data, lesson_location); |
| 291 | 291 | //xajax_update_pgs(); |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | //$keep_href = ''; |
| 89 | 89 | if (is_array($attributes)) { |
| 90 | 90 | foreach ($attributes as $attrib) { |
| 91 | - if (trim($attrib->value) != ''){ |
|
| 91 | + if (trim($attrib->value) != '') { |
|
| 92 | 92 | $this->attribs[$attrib->name] = $attrib->value; |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | if (isset($_GET['lp_item_id'])) { |
| 21 | 21 | |
| 22 | 22 | // Get parameter only came from lp_view.php. |
| 23 | - $lp_item_id = intval($_GET['lp_item_id']); |
|
| 23 | + $lp_item_id = intval($_GET['lp_item_id']); |
|
| 24 | 24 | if (isset($_SESSION['lpobject'])) { |
| 25 | 25 | $oLP = unserialize($_SESSION['lpobject']); |
| 26 | 26 | } |
@@ -73,13 +73,13 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | $course_id = api_get_course_int_id(); |
| 75 | 75 | $sql_query = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND id = $learnpath_id"; |
| 76 | -$result=Database::query($sql_query); |
|
| 76 | +$result = Database::query($sql_query); |
|
| 77 | 77 | $therow = Database::fetch_array($result); |
| 78 | 78 | |
| 79 | 79 | /* SHOWING THE ADMIN TOOLS */ |
| 80 | 80 | |
| 81 | 81 | if (api_is_in_gradebook()) { |
| 82 | - $interbreadcrumb[] = array ( |
|
| 82 | + $interbreadcrumb[] = array( |
|
| 83 | 83 | 'url' => api_get_path(WEB_CODE_PATH).'gradebook/index.php?'.api_get_cidreq(), |
| 84 | 84 | 'name' => get_lang('ToolGradebook') |
| 85 | 85 | ); |
@@ -198,7 +198,7 @@ |
||
| 198 | 198 | //"lms_progress_bar_mode='".$myprogress_mode."';" . |
| 199 | 199 | "olms.lms_view_id=".$view_id.";". |
| 200 | 200 | "olms.lms_user_id=".$user_id.";". |
| 201 | - "olms.next_item=".$new_item_id.";". // This one is very important to replace possible literal strings. |
|
| 201 | + "olms.next_item=".$new_item_id.";".// This one is very important to replace possible literal strings. |
|
| 202 | 202 | "olms.lms_next_item=".$mynext.";". |
| 203 | 203 | "olms.lms_previous_item=".$myprevious.";". |
| 204 | 204 | "olms.lms_item_type = '".$myitemtype."';". |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | if (!empty($gradebook) && $gradebook == 'view') { |
| 102 | - $interbreadcrumb[] = array ( |
|
| 102 | + $interbreadcrumb[] = array( |
|
| 103 | 103 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
| 104 | 104 | 'name' => get_lang('ToolGradebook') |
| 105 | 105 | ); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $show_learn_path = true; |
| 113 | 113 | $lp_theme_css = $_SESSION['oLP']->get_theme(); |
| 114 | 114 | |
| 115 | -Display::display_header(get_lang('Edit'),'Path'); |
|
| 115 | +Display::display_header(get_lang('Edit'), 'Path'); |
|
| 116 | 116 | $suredel = trim(get_lang('AreYouSureToDeleteJS')); |
| 117 | 117 | |
| 118 | 118 | ?> |
@@ -165,8 +165,8 @@ discard block |
||
| 165 | 165 | $path_item = isset($_GET['path_item']) ? $_GET['path_item'] : 0; |
| 166 | 166 | $path_item = Database::escape_string($path_item); |
| 167 | 167 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
| 168 | -$sql_doc = "SELECT path FROM " . $tbl_doc . " |
|
| 169 | - WHERE c_id = $course_id AND id = '". $path_item."' "; |
|
| 168 | +$sql_doc = "SELECT path FROM ".$tbl_doc." |
|
| 169 | + WHERE c_id = $course_id AND id = '".$path_item."' "; |
|
| 170 | 170 | |
| 171 | 171 | $res_doc = Database::query($sql_doc); |
| 172 | 172 | $path_file = Database::result($res_doc, 0, 0); |
@@ -28,10 +28,10 @@ |
||
| 28 | 28 | error_log('In xajax_save_objectives('.$lp_id.','.$user_id.','.$view_id.','.$item_id.',"'.(count($objectives) > 0 ? count($objectives) : '').'")', 0); |
| 29 | 29 | } |
| 30 | 30 | $mylp = learnpath::getLpFromSession(api_get_course_id(), $lp_id, $user_id); |
| 31 | - $mylpi =& $mylp->items[$item_id]; |
|
| 32 | - if (is_array($objectives) && count($objectives)>0){ |
|
| 33 | - foreach ($objectives as $index=>$objective){ |
|
| 34 | - $mylpi->add_objective($index,$objectives[$index]); |
|
| 31 | + $mylpi = & $mylp->items[$item_id]; |
|
| 32 | + if (is_array($objectives) && count($objectives) > 0) { |
|
| 33 | + foreach ($objectives as $index=>$objective) { |
|
| 34 | + $mylpi->add_objective($index, $objectives[$index]); |
|
| 35 | 35 | } |
| 36 | 36 | $mylpi->write_objectives_to_db(); |
| 37 | 37 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $intro_content = api_substr($content, 0, api_strpos($content, $matches[0][0])); |
| 118 | 118 | $items_to_create[get_lang('Introduction')] = $intro_content; |
| 119 | 119 | |
| 120 | - for ($i = 0; $i<count($matches[0]); $i++) { |
|
| 120 | + for ($i = 0; $i < count($matches[0]); $i++) { |
|
| 121 | 121 | |
| 122 | 122 | if (empty($matches[1][$i])) |
| 123 | 123 | continue; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | $first_item = 0; |
| 176 | 176 | |
| 177 | - foreach($pages as $key => $page_content) { |
|
| 177 | + foreach ($pages as $key => $page_content) { |
|
| 178 | 178 | // For every pages, we create a new file. |
| 179 | 179 | |
| 180 | 180 | $key += 1; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | foreach ($specific_fields as $specific_field) { |
| 214 | 214 | if (isset($_REQUEST[$specific_field['code']])) { |
| 215 | 215 | $sterms = trim($_REQUEST[$specific_field['code']]); |
| 216 | - $all_specific_terms .= ' '. $sterms; |
|
| 216 | + $all_specific_terms .= ' '.$sterms; |
|
| 217 | 217 | if (!empty($sterms)) { |
| 218 | 218 | $sterms = explode(',', $sterms); |
| 219 | 219 | foreach ($sterms as $sterm) { |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | - $page_content = $all_specific_terms .' '. $page_content; |
|
| 225 | + $page_content = $all_specific_terms.' '.$page_content; |
|
| 226 | 226 | $ic_slide->addValue('content', $page_content); |
| 227 | 227 | // Add a comment to say terms separated by commas. |
| 228 | 228 | $courseid = api_get_course_id(); |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | SE_COURSE_ID => $courseid, |
| 234 | 234 | SE_TOOL_ID => TOOL_LEARNPATH, |
| 235 | 235 | SE_DATA => array('lp_id' => $lp_id, 'lp_item' => $previous, 'document_id' => $document_id), |
| 236 | - SE_USER => (int)api_get_user_id(), |
|
| 236 | + SE_USER => (int) api_get_user_id(), |
|
| 237 | 237 | ); |
| 238 | 238 | $ic_slide->xapian_data = serialize($xapian_data); |
| 239 | 239 | $di->addChunk($ic_slide); |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $content = '<body><div style="width:'.$max_width.'">'.$content; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - $content = preg_replace('|</body>|i','</div>\\0', $content, -1, $count); |
|
| 279 | + $content = preg_replace('|</body>|i', '</div>\\0', $content, -1, $count); |
|
| 280 | 280 | if ($count < 1) { |
| 281 | 281 | $content = $content.'</div></body>'; |
| 282 | 282 | } |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | } elseif ($img_width > $max_width - 10) { |
| 307 | - $picture_resized = str_ireplace('width='.$img_width, 'width="'.($max_width-10).'"', $images[0][$key]); |
|
| 307 | + $picture_resized = str_ireplace('width='.$img_width, 'width="'.($max_width - 10).'"', $images[0][$key]); |
|
| 308 | 308 | $content = str_replace($images[0][$key], $picture_resized, $content); |
| 309 | 309 | } |
| 310 | 310 | } |