@@ -73,7 +73,7 @@ |
||
| 73 | 73 | |
| 74 | 74 | echo '<div class="actions">'; |
| 75 | 75 | echo '<a href="lp_controller.php?'.api_get_cidreq().'">'. |
| 76 | - Display::return_icon('back.png', get_lang('ReturnToLearningPaths'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 76 | + Display::return_icon('back.png', get_lang('ReturnToLearningPaths'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 77 | 77 | echo '</div>'; |
| 78 | 78 | |
| 79 | 79 | $form->display(); |
@@ -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) { |
@@ -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 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | if ((!$is_allowed_to_edit) || ($isStudentView)) { |
| 41 | 41 | error_log('New LP - User not authorized in lp_edit_item_prereq.php'); |
| 42 | - header('location:lp_controller.php?action=view&lp_id=' . $learnpath_id); |
|
| 42 | + header('location:lp_controller.php?action=view&lp_id='.$learnpath_id); |
|
| 43 | 43 | } |
| 44 | 44 | $course_id = api_get_course_int_id(); |
| 45 | 45 | |
@@ -55,14 +55,14 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | if (!empty($gradebook) && $gradebook == 'view') { |
| 57 | 57 | $interbreadcrumb[] = array( |
| 58 | - 'url' => '../gradebook/' . $_SESSION['gradebook_dest'], |
|
| 58 | + 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
|
| 59 | 59 | 'name' => get_lang('ToolGradebook') |
| 60 | 60 | ); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths')); |
| 64 | -$interbreadcrumb[] = array('url' => api_get_self() . "?action=build&lp_id=$learnpath_id", 'name' => stripslashes("{$therow['name']}")); |
|
| 65 | -$interbreadcrumb[] = array('url' => api_get_self() . "?action=add_item&type=step&lp_id=$learnpath_id", 'name' => get_lang('NewStep')); |
|
| 64 | +$interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=$learnpath_id", 'name' => stripslashes("{$therow['name']}")); |
|
| 65 | +$interbreadcrumb[] = array('url' => api_get_self()."?action=add_item&type=step&lp_id=$learnpath_id", 'name' => get_lang('NewStep')); |
|
| 66 | 66 | |
| 67 | 67 | // Theme calls. |
| 68 | 68 | $show_learn_path = true; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | // View |
| 108 | 108 | $interbreadcrumb[] = [ |
| 109 | - 'url' => api_get_path(WEB_CODE_PATH) . 'newscorm/lp_controller.php?'.api_get_cidreq(), |
|
| 109 | + 'url' => api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq(), |
|
| 110 | 110 | 'name' => get_lang('LearningPaths') |
| 111 | 111 | ]; |
| 112 | 112 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | array(), |
| 118 | 118 | ICON_SIZE_MEDIUM |
| 119 | 119 | ), |
| 120 | - api_get_path(WEB_CODE_PATH) . 'newscorm/lp_controller.php?' . api_get_cidreq() |
|
| 120 | + api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq() |
|
| 121 | 121 | ); |
| 122 | 122 | |
| 123 | 123 | $template = new Template(get_lang('StudentScore')); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | // Create the directory |
| 53 | 53 | $this->base_work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
| 54 | 54 | ///learning_path/ppt_dirname directory |
| 55 | - $this->created_dir = substr($result['dir'], 0, strlen($result['dir']) -1); |
|
| 55 | + $this->created_dir = substr($result['dir'], 0, strlen($result['dir']) - 1); |
|
| 56 | 56 | $this->file_path = $this->created_dir.'/'.api_replace_dangerous_char($file['name']); |
| 57 | 57 | |
| 58 | 58 | //var_dump($this->file_name, $this->file_path, $this->base_work_dir, $this->created_dir); |
@@ -89,18 +89,18 @@ discard block |
||
| 89 | 89 | $perm = api_get_setting('permissions_for_new_files'); |
| 90 | 90 | |
| 91 | 91 | if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php |
| 92 | - $converter_path = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'); |
|
| 93 | - $class_path = $converter_path . ';' . $converter_path . '/jodconverter-2.2.2.jar;' . $converter_path . '/jodconverter-cli-2.2.2.jar'; |
|
| 92 | + $converter_path = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png'); |
|
| 93 | + $class_path = $converter_path.';'.$converter_path.'/jodconverter-2.2.2.jar;'.$converter_path.'/jodconverter-cli-2.2.2.jar'; |
|
| 94 | 94 | //$cmd = 'java -cp "'.$class_path.'" DokeosConverter'; |
| 95 | - $cmd = 'java -Dfile.encoding=UTF-8 -cp "' . $class_path . '" DokeosConverter'; |
|
| 95 | + $cmd = 'java -Dfile.encoding=UTF-8 -cp "'.$class_path.'" DokeosConverter'; |
|
| 96 | 96 | } else { |
| 97 | - $converter_path = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'; |
|
| 97 | + $converter_path = api_get_path(SYS_PATH).'main/inc/lib/ppt2png'; |
|
| 98 | 98 | //$class_path = '-cp .:jodconverter-2.2.1.jar:jodconverter-cli-2.2.1.jar'; |
| 99 | 99 | $class_path = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar'; |
| 100 | - $cmd = 'cd ' . $converter_path . ' && java ' . $class_path . ' DokeosConverter'; |
|
| 100 | + $cmd = 'cd '.$converter_path.' && java '.$class_path.' DokeosConverter'; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port'); |
|
| 103 | + $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port'); |
|
| 104 | 104 | // Call to the function implemented by child. |
| 105 | 105 | $cmd .= $this->add_command_parameters(); |
| 106 | 106 | // To allow openoffice to manipulate docs. |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | @chmod($this->base_work_dir.$this->file_path, 0777); |
| 110 | 110 | |
| 111 | 111 | $locale = $this->original_locale; // TODO: Improve it because we're not sure this locale is present everywhere. |
| 112 | - putenv('LC_ALL=' . $locale); |
|
| 112 | + putenv('LC_ALL='.$locale); |
|
| 113 | 113 | |
| 114 | 114 | $files = array(); |
| 115 | 115 | $return = 0; |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | if (!empty($result['images'])) { |
| 140 | 140 | foreach ($result['images'] as $image => $img_data) { |
| 141 | 141 | $image_path = $this->base_work_dir.$this->created_dir; |
| 142 | - @file_put_contents($image_path . '/' . $image, base64_decode($img_data)); |
|
| 143 | - @chmod($image_path . '/' . $image, 0777); |
|
| 142 | + @file_put_contents($image_path.'/'.$image, base64_decode($img_data)); |
|
| 143 | + @chmod($image_path.'/'.$image, 0777); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
@@ -233,38 +233,38 @@ discard block |
||
| 233 | 233 | $ppt2lpHost = api_get_setting('service_ppt2lp', 'host'); |
| 234 | 234 | $permissionFile = api_get_permissions_for_new_files(); |
| 235 | 235 | $permissionFolder = api_get_permissions_for_new_directories(); |
| 236 | - if (file_exists($this->base_work_dir . '/' . $this->created_dir)) { |
|
| 236 | + if (file_exists($this->base_work_dir.'/'.$this->created_dir)) { |
|
| 237 | 237 | |
| 238 | 238 | return $ids; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | if ($ppt2lpHost == 'localhost') { |
| 242 | 242 | if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php |
| 243 | - $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'); |
|
| 244 | - $classPath = $converterPath . ';' . $converterPath . '/jodconverter-2.2.2.jar;' . $converterPath . '/jodconverter-cli-2.2.2.jar'; |
|
| 245 | - $cmd = 'java -Dfile.encoding=UTF-8 -jar "' . $classPath . '/jodconverter-2.2.2.jar"'; |
|
| 243 | + $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png'); |
|
| 244 | + $classPath = $converterPath.';'.$converterPath.'/jodconverter-2.2.2.jar;'.$converterPath.'/jodconverter-cli-2.2.2.jar'; |
|
| 245 | + $cmd = 'java -Dfile.encoding=UTF-8 -jar "'.$classPath.'/jodconverter-2.2.2.jar"'; |
|
| 246 | 246 | } else { |
| 247 | - $converterPath = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'; |
|
| 247 | + $converterPath = api_get_path(SYS_PATH).'main/inc/lib/ppt2png'; |
|
| 248 | 248 | $classPath = ' -Dfile.encoding=UTF-8 -jar jodconverter-cli-2.2.2.jar'; |
| 249 | - $cmd = 'cd ' . $converterPath . ' && java ' . $classPath . ' '; |
|
| 249 | + $cmd = 'cd '.$converterPath.' && java '.$classPath.' '; |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port'); |
|
| 252 | + $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port'); |
|
| 253 | 253 | // Call to the function implemented by child. |
| 254 | - $cmd .= ' "' . $this->base_work_dir . '/' . $this->file_path . '" "' . $this->base_work_dir . '/' . $this->created_dir . '"'; |
|
| 254 | + $cmd .= ' "'.$this->base_work_dir.'/'.$this->file_path.'" "'.$this->base_work_dir.'/'.$this->created_dir.'"'; |
|
| 255 | 255 | // To allow openoffice to manipulate docs. |
| 256 | 256 | @chmod($this->base_work_dir, $permissionFolder); |
| 257 | - @chmod($this->base_work_dir . '/' . $this->file_path, $permissionFile); |
|
| 257 | + @chmod($this->base_work_dir.'/'.$this->file_path, $permissionFile); |
|
| 258 | 258 | |
| 259 | 259 | $locale = $this->original_locale; // TODO: Improve it because we're not sure this locale is present everywhere. |
| 260 | - putenv('LC_ALL=' . $locale); |
|
| 260 | + putenv('LC_ALL='.$locale); |
|
| 261 | 261 | |
| 262 | 262 | $files = array(); |
| 263 | 263 | $return = 0; |
| 264 | 264 | $shell = exec($cmd, $files, $return); |
| 265 | 265 | // TODO: Chown is not working, root keep user privileges, should be www-data |
| 266 | - @chown($this->base_work_dir . '/' . $this->created_dir, 'www-data'); |
|
| 267 | - @chmod($this->base_work_dir . '/' . $this->created_dir, $permissionFile); |
|
| 266 | + @chown($this->base_work_dir.'/'.$this->created_dir, 'www-data'); |
|
| 267 | + @chmod($this->base_work_dir.'/'.$this->created_dir, $permissionFile); |
|
| 268 | 268 | |
| 269 | 269 | if ($return != 0) { // If the java application returns an error code. |
| 270 | 270 | switch ($return) { |
@@ -303,14 +303,14 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - if (file_exists($this->base_work_dir . '/' . $this->created_dir)) { |
|
| 306 | + if (file_exists($this->base_work_dir.'/'.$this->created_dir)) { |
|
| 307 | 307 | |
| 308 | 308 | // Register Files to Document tool |
| 309 | 309 | $ids[] = add_document( |
| 310 | 310 | $_course, |
| 311 | - '/' . $this->created_dir, |
|
| 311 | + '/'.$this->created_dir, |
|
| 312 | 312 | 'file', |
| 313 | - filesize($this->base_work_dir . '/' . $this->created_dir), |
|
| 313 | + filesize($this->base_work_dir.'/'.$this->created_dir), |
|
| 314 | 314 | $convertedTitle, |
| 315 | 315 | sprintf( |
| 316 | 316 | get_lang('FileConvertedFromXToY'), |
@@ -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 | } |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | $a_dir = realpath($dir.'/../../archive/'); |
| 16 | 16 | $list = scandir($a_dir); |
| 17 | 17 | // calculate 7 days |
| 18 | -$t = time()-(86400*7); |
|
| 18 | +$t = time() - (86400 * 7); |
|
| 19 | 19 | foreach ($list as $item) { |
| 20 | - if (substr($item,0,1) == '.') { |
|
| 20 | + if (substr($item, 0, 1) == '.') { |
|
| 21 | 21 | continue; |
| 22 | 22 | } |
| 23 | 23 | $stat = @stat($a_dir.'/'.$item); |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | * Delete a file or recursively delete a directory |
| 35 | 35 | * @param string $str Path to file or directory |
| 36 | 36 | */ |
| 37 | -function recursive_delete($str){ |
|
| 37 | +function recursive_delete($str) { |
|
| 38 | 38 | if (is_file($str)) { |
| 39 | 39 | return @unlink($str); |
| 40 | 40 | } elseif (is_dir($str)) { |
| 41 | - $scan = glob(rtrim($str,'/').'/*'); |
|
| 41 | + $scan = glob(rtrim($str, '/').'/*'); |
|
| 42 | 42 | foreach ($scan as $index=>$path) { |
| 43 | 43 | recursive_delete($path); |
| 44 | 44 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * @package chamilo.cron |
| 6 | 6 | * @author Imanol Losada <[email protected]> |
| 7 | 7 | */ |
| 8 | -require_once __DIR__ . '/../inc/global.inc.php'; |
|
| 8 | +require_once __DIR__.'/../inc/global.inc.php'; |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Initialization |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | foreach ($sessions as $sessionId => $userIds) { |
| 66 | 66 | $userId = 0; |
| 67 | - $userIds = $userIds ? " AND sessionUser.user_id NOT IN (" . implode(", ", $userIds) . ")" : null; |
|
| 67 | + $userIds = $userIds ? " AND sessionUser.user_id NOT IN (".implode(", ", $userIds).")" : null; |
|
| 68 | 68 | $query = " |
| 69 | 69 | SELECT sessionUser.session_id, sessionUser.user_id, session.name, session.access_end_date |
| 70 | 70 | FROM $sessionUserTable AS sessionUser |
@@ -156,10 +156,10 @@ discard block |
||
| 156 | 156 | $administrator['completeName'], |
| 157 | 157 | $administrator['email'] |
| 158 | 158 | ); |
| 159 | - echo "Email sent to $userCompleteName (" . $user['email'] . ")\n"; |
|
| 160 | - echo "Session: " . $session['name'] . "\n"; |
|
| 161 | - echo "Date end: " . $session['access_end_date'] . "\n"; |
|
| 162 | - echo "Days remaining: " . $daysRemaining->format("%d") . "\n\n"; |
|
| 159 | + echo "Email sent to $userCompleteName (".$user['email'].")\n"; |
|
| 160 | + echo "Session: ".$session['name']."\n"; |
|
| 161 | + echo "Date end: ".$session['access_end_date']."\n"; |
|
| 162 | + echo "Days remaining: ".$daysRemaining->format("%d")."\n\n"; |
|
| 163 | 163 | } |
| 164 | 164 | echo "======================================================================\n\n"; |
| 165 | 165 | } |