@@ -260,10 +260,11 @@ |
||
260 | 260 | <td colspan="3" align="center"> |
261 | 261 | <br /> |
262 | 262 | <?php |
263 | - if(isset($_GET['add'])) |
|
264 | - echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>'; |
|
265 | - else |
|
266 | - echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>'; |
|
263 | + if(isset($_GET['add'])) { |
|
264 | + echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>'; |
|
265 | + } else { |
|
266 | + echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>'; |
|
267 | + } |
|
267 | 268 | ?> |
268 | 269 | </td> |
269 | 270 | </tr> |
@@ -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; |
@@ -13,7 +13,9 @@ discard block |
||
13 | 13 | $use_anonymous = true; |
14 | 14 | |
15 | 15 | $debug = 0; |
16 | -if ($debug > 0) error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0); |
|
16 | +if ($debug > 0) { |
|
17 | + error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0); |
|
18 | +} |
|
17 | 19 | |
18 | 20 | // Language files that needs to be included. |
19 | 21 | if (isset($_GET['action'])) { |
@@ -209,10 +211,14 @@ discard block |
||
209 | 211 | // If refresh is set, we regenerate the oLP object from the database (kind of flush). |
210 | 212 | Session::erase('refresh'); |
211 | 213 | $myrefresh = 1; |
212 | - if ($debug > 0) error_log('New LP - Refresh asked', 0); |
|
213 | -} |
|
214 | + if ($debug > 0) { |
|
215 | + error_log('New LP - Refresh asked', 0); |
|
216 | + } |
|
217 | + } |
|
214 | 218 | |
215 | -if ($debug > 0) error_log('New LP - Passed refresh check', 0); |
|
219 | +if ($debug > 0) { |
|
220 | + error_log('New LP - Passed refresh check', 0); |
|
221 | +} |
|
216 | 222 | |
217 | 223 | if (!empty($_REQUEST['dialog_box'])) { |
218 | 224 | $dialog_box = stripslashes(urldecode($_REQUEST['dialog_box'])); |
@@ -222,17 +228,23 @@ discard block |
||
222 | 228 | $lp_found = false; |
223 | 229 | |
224 | 230 | if (isset($_SESSION['lpobject'])) { |
225 | - if ($debug > 0) error_log('New LP - SESSION[lpobject] is defined', 0); |
|
231 | + if ($debug > 0) { |
|
232 | + error_log('New LP - SESSION[lpobject] is defined', 0); |
|
233 | + } |
|
226 | 234 | $oLP = unserialize($_SESSION['lpobject']); |
227 | 235 | if (isset($oLP) && is_object($oLP)) { |
228 | - if ($debug > 0) error_log('New LP - oLP is object', 0); |
|
236 | + if ($debug > 0) { |
|
237 | + error_log('New LP - oLP is object', 0); |
|
238 | + } |
|
229 | 239 | if ($myrefresh == 1 || |
230 | 240 | empty($oLP->cc) || |
231 | 241 | $oLP->cc != api_get_course_id() || |
232 | 242 | $oLP->lp_view_session_id != $session_id || |
233 | 243 | $oLP->scorm_debug == '1' |
234 | 244 | ) { |
235 | - if ($debug > 0) error_log('New LP - Course has changed, discard lp object', 0); |
|
245 | + if ($debug > 0) { |
|
246 | + error_log('New LP - Course has changed, discard lp object', 0); |
|
247 | + } |
|
236 | 248 | if ($myrefresh == 1) { $myrefresh_id = $oLP->get_id(); } |
237 | 249 | $oLP = null; |
238 | 250 | Session::erase('oLP'); |
@@ -246,13 +258,19 @@ discard block |
||
246 | 258 | |
247 | 259 | $course_id = api_get_course_int_id(); |
248 | 260 | |
249 | -if ($debug>0) error_log('New LP - Passed data remains check', 0); |
|
261 | +if ($debug>0) { |
|
262 | + error_log('New LP - Passed data remains check', 0); |
|
263 | +} |
|
250 | 264 | |
251 | 265 | if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) { |
252 | - if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0); |
|
266 | + if ($debug > 0) { |
|
267 | + error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0); |
|
268 | + } |
|
253 | 269 | // Regenerate a new lp object? Not always as some pages don't need the object (like upload?) |
254 | 270 | if (!empty($_REQUEST['lp_id']) || !empty($myrefresh_id)) { |
255 | - if ($debug > 0) error_log('New LP - lp_id is defined', 0); |
|
271 | + if ($debug > 0) { |
|
272 | + error_log('New LP - lp_id is defined', 0); |
|
273 | + } |
|
256 | 274 | // Select the lp in the database and check which type it is (scorm/dokeos/aicc) to generate the |
257 | 275 | // right object. |
258 | 276 | if (!empty($_REQUEST['lp_id'])) { |
@@ -264,16 +282,22 @@ discard block |
||
264 | 282 | $lp_table = Database::get_course_table(TABLE_LP_MAIN); |
265 | 283 | if (is_numeric($lp_id)) { |
266 | 284 | $sel = "SELECT lp_type FROM $lp_table WHERE c_id = $course_id AND id = $lp_id"; |
267 | - if ($debug > 0) error_log('New LP - querying '.$sel, 0); |
|
285 | + if ($debug > 0) { |
|
286 | + error_log('New LP - querying '.$sel, 0); |
|
287 | + } |
|
268 | 288 | $res = Database::query($sel); |
269 | 289 | |
270 | 290 | if (Database::num_rows($res)) { |
271 | 291 | $row = Database::fetch_array($res); |
272 | 292 | $type = $row['lp_type']; |
273 | - if ($debug > 0) error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
293 | + if ($debug > 0) { |
|
294 | + error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
295 | + } |
|
274 | 296 | switch ($type) { |
275 | 297 | case 1: |
276 | - if ($debug > 0) error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
298 | + if ($debug > 0) { |
|
299 | + error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
300 | + } |
|
277 | 301 | |
278 | 302 | $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id()); |
279 | 303 | if ($oLP !== false) { |
@@ -283,7 +307,9 @@ discard block |
||
283 | 307 | } |
284 | 308 | break; |
285 | 309 | case 2: |
286 | - if ($debug > 0) error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
310 | + if ($debug > 0) { |
|
311 | + error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
312 | + } |
|
287 | 313 | $oLP = new scorm(api_get_course_id(), $lp_id, api_get_user_id()); |
288 | 314 | if ($oLP !== false) { |
289 | 315 | $lp_found = true; |
@@ -292,7 +318,9 @@ discard block |
||
292 | 318 | } |
293 | 319 | break; |
294 | 320 | case 3: |
295 | - if ($debug > 0) error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
321 | + if ($debug > 0) { |
|
322 | + error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
323 | + } |
|
296 | 324 | $oLP = new aicc(api_get_course_id(), $lp_id, api_get_user_id()); |
297 | 325 | if ($oLP !== false) { |
298 | 326 | $lp_found = true; |
@@ -301,7 +329,9 @@ discard block |
||
301 | 329 | } |
302 | 330 | break; |
303 | 331 | default: |
304 | - if ($debug > 0) error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
332 | + if ($debug > 0) { |
|
333 | + error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
334 | + } |
|
305 | 335 | $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id()); |
306 | 336 | if ($oLP !== false) { |
307 | 337 | $lp_found = true; |
@@ -312,17 +342,23 @@ discard block |
||
312 | 342 | } |
313 | 343 | } |
314 | 344 | } else { |
315 | - if ($debug > 0) error_log('New LP - Request[lp_id] is not numeric', 0); |
|
345 | + if ($debug > 0) { |
|
346 | + error_log('New LP - Request[lp_id] is not numeric', 0); |
|
347 | + } |
|
316 | 348 | } |
317 | 349 | } else { |
318 | - if ($debug > 0) error_log('New LP - Request[lp_id] and refresh_id were empty', 0); |
|
350 | + if ($debug > 0) { |
|
351 | + error_log('New LP - Request[lp_id] and refresh_id were empty', 0); |
|
352 | + } |
|
319 | 353 | } |
320 | 354 | if ($lp_found) { |
321 | 355 | $_SESSION['oLP'] = $oLP; |
322 | 356 | } |
323 | 357 | } |
324 | 358 | |
325 | -if ($debug > 0) error_log('New LP - Passed oLP creation check', 0); |
|
359 | +if ($debug > 0) { |
|
360 | + error_log('New LP - Passed oLP creation check', 0); |
|
361 | +} |
|
326 | 362 | |
327 | 363 | $is_allowed_to_edit = api_is_allowed_to_edit(false, true, false, false); |
328 | 364 | |
@@ -359,7 +395,9 @@ discard block |
||
359 | 395 | } |
360 | 396 | |
361 | 397 | $redirectTo = ''; |
362 | -if ($debug > 0) error_log('New LP - action "'.$action.'" triggered'); |
|
398 | +if ($debug > 0) { |
|
399 | + error_log('New LP - action "'.$action.'" triggered'); |
|
400 | +} |
|
363 | 401 | |
364 | 402 | switch ($action) { |
365 | 403 | case 'add_item': |
@@ -368,7 +406,9 @@ discard block |
||
368 | 406 | } |
369 | 407 | if (!$lp_found) { |
370 | 408 | //check if the learnpath ID was defined, otherwise send back to list |
371 | - if ($debug > 0) error_log('New LP - No learnpath given for add item', 0); |
|
409 | + if ($debug > 0) { |
|
410 | + error_log('New LP - No learnpath given for add item', 0); |
|
411 | + } |
|
372 | 412 | require 'lp_list.php'; |
373 | 413 | } else { |
374 | 414 | $_SESSION['refresh'] = 1; |
@@ -458,7 +498,9 @@ discard block |
||
458 | 498 | } |
459 | 499 | if (!$lp_found) { |
460 | 500 | //check if the learnpath ID was defined, otherwise send back to list |
461 | - if ($debug > 0) error_log('New LP - No learnpath given for add audio', 0); |
|
501 | + if ($debug > 0) { |
|
502 | + error_log('New LP - No learnpath given for add audio', 0); |
|
503 | + } |
|
462 | 504 | require 'lp_list.php'; |
463 | 505 | } else { |
464 | 506 | $_SESSION['refresh'] = 1; |
@@ -606,8 +648,7 @@ discard block |
||
606 | 648 | if (!$is_allowed_to_edit) { |
607 | 649 | api_not_allowed(true); |
608 | 650 | } |
609 | - if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; } |
|
610 | - else { |
|
651 | + if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; } else { |
|
611 | 652 | $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']); |
612 | 653 | require 'lp_list.php'; |
613 | 654 | exit; |
@@ -688,8 +729,7 @@ discard block |
||
688 | 729 | if (!$is_allowed_to_edit) { |
689 | 730 | api_not_allowed(true); |
690 | 731 | } |
691 | - if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } |
|
692 | - else { |
|
732 | + if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } else { |
|
693 | 733 | if (isset($_POST['submit_button'])) { |
694 | 734 | //Updating the lp.modified_on |
695 | 735 | $_SESSION['oLP']->set_modified_on(); |
@@ -983,8 +1023,9 @@ discard block |
||
983 | 1023 | ); |
984 | 1024 | $extraFieldValue->saveFieldValues($_REQUEST); |
985 | 1025 | |
986 | - if ($_FILES['lp_preview_image']['size'] > 0) |
|
987 | - $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']); |
|
1026 | + if ($_FILES['lp_preview_image']['size'] > 0) { |
|
1027 | + $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']); |
|
1028 | + } |
|
988 | 1029 | |
989 | 1030 | if (api_get_setting('search_enabled') === 'true') { |
990 | 1031 | require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
@@ -1117,16 +1158,24 @@ discard block |
||
1117 | 1158 | } |
1118 | 1159 | break; |
1119 | 1160 | case 'content': |
1120 | - if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0); |
|
1161 | + if ($debug > 0) { |
|
1162 | + error_log('New LP - Item id is '.intval($_GET['item_id']), 0); |
|
1163 | + } |
|
1121 | 1164 | if (!$lp_found) { |
1122 | 1165 | error_log('New LP - No learnpath given for content', 0); |
1123 | 1166 | require 'lp_list.php'; |
1124 | 1167 | } else { |
1125 | - if ($debug > 0) error_log('New LP - save_last()', 0); |
|
1168 | + if ($debug > 0) { |
|
1169 | + error_log('New LP - save_last()', 0); |
|
1170 | + } |
|
1126 | 1171 | $_SESSION['oLP']->save_last(); |
1127 | - if ($debug > 0) error_log('New LP - set_current_item()', 0); |
|
1172 | + if ($debug > 0) { |
|
1173 | + error_log('New LP - set_current_item()', 0); |
|
1174 | + } |
|
1128 | 1175 | $_SESSION['oLP']->set_current_item($_GET['item_id']); |
1129 | - if ($debug > 0) error_log('New LP - start_current_item()', 0); |
|
1176 | + if ($debug > 0) { |
|
1177 | + error_log('New LP - start_current_item()', 0); |
|
1178 | + } |
|
1130 | 1179 | $_SESSION['oLP']->start_current_item(); |
1131 | 1180 | require 'lp_content.php'; |
1132 | 1181 | } |
@@ -1242,8 +1291,7 @@ discard block |
||
1242 | 1291 | require 'lp_message.php'; |
1243 | 1292 | break; |
1244 | 1293 | case 'return_to_course_homepage': |
1245 | - if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } |
|
1246 | - else { |
|
1294 | + if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else { |
|
1247 | 1295 | $_SESSION['oLP']->save_current(); |
1248 | 1296 | $_SESSION['oLP']->save_last(); |
1249 | 1297 | $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id(); |
@@ -1436,8 +1484,10 @@ discard block |
||
1436 | 1484 | |
1437 | 1485 | if (!empty($_SESSION['oLP'])) { |
1438 | 1486 | $_SESSION['lpobject'] = serialize($_SESSION['oLP']); |
1439 | - if ($debug > 0) error_log('New LP - lpobject is serialized in session', 0); |
|
1440 | -} |
|
1487 | + if ($debug > 0) { |
|
1488 | + error_log('New LP - lpobject is serialized in session', 0); |
|
1489 | + } |
|
1490 | + } |
|
1441 | 1491 | |
1442 | 1492 | if (!empty($redirectTo)) { |
1443 | 1493 | header("Location: $redirectTo"); |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | ?> |
136 | 136 | <div id="message" style="display: none"> |
137 | 137 | <?php |
138 | - if(!empty($message)) |
|
139 | - Display::display_normal_message($message) |
|
138 | + if(!empty($message)) { |
|
139 | + Display::display_normal_message($message) |
|
140 | 140 | ?> |
141 | 141 | </div> |
142 | 142 | |
@@ -150,7 +150,9 @@ discard block |
||
150 | 150 | </div> |
151 | 151 | <div class="row"> |
152 | 152 | <div class="col-md-5"> |
153 | - <?php Display::display_icon('screenshot_ppt2lp.jpg', get_lang('Ppt2lp'), array('class'=>'img-responsive')); ?> |
|
153 | + <?php Display::display_icon('screenshot_ppt2lp.jpg', get_lang('Ppt2lp'), array('class'=>'img-responsive')); |
|
154 | + } |
|
155 | + ?> |
|
154 | 156 | </div> |
155 | 157 | <div class="col-md-7"> |
156 | 158 | <form method="POST" class="form-horizontal" action="<?php echo api_get_self(); ?>"> |