@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $userId = api_get_user_id(); |
23 | 23 | |
24 | 24 | $this_section = SECTION_COURSES; |
25 | -$current_course_tool = TOOL_GROUP; |
|
25 | +$current_course_tool = TOOL_GROUP; |
|
26 | 26 | |
27 | 27 | // Notice for unauthorized people. |
28 | 28 | api_protect_course_script(true); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | Display::return_icon('add-groups.png', get_lang('NewGroupCreate'), '', ICON_SIZE_MEDIUM).'</a>'; |
171 | 171 | |
172 | 172 | if (api_get_setting('allow_group_categories') === 'true') { |
173 | - $actionsLeft .= '<a href="group_category.php?'.api_get_cidreq().'&action=add_category">'. |
|
173 | + $actionsLeft .= '<a href="group_category.php?'.api_get_cidreq().'&action=add_category">'. |
|
174 | 174 | Display::return_icon('new_folder.png', get_lang('AddCategory'), '', ICON_SIZE_MEDIUM).'</a>'; |
175 | 175 | } else { |
176 | 176 | $actionsLeft .= '<a href="group_category.php?'.api_get_cidreq().'&id=2">'. |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $actions = null; |
226 | 226 | if (api_is_allowed_to_edit(false, true) && !empty($categoryId)) { |
227 | 227 | $actions .= '<a href="group_category.php?'.api_get_cidreq().'&id='.$categoryId.'" title="'.get_lang('Edit').'">'. |
228 | - Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).'</a>'; |
|
228 | + Display::return_icon('edit.png', get_lang('EditGroup'), '', ICON_SIZE_SMALL).'</a>'; |
|
229 | 229 | $actions .= |
230 | 230 | Display::url( |
231 | 231 | Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL), |
@@ -235,17 +235,17 @@ discard block |
||
235 | 235 | ) |
236 | 236 | ); |
237 | 237 | if ($index != 0) { |
238 | - $actions .= ' <a href="group.php?'.api_get_cidreq().'&action=swap_cat_order&id1='.$categoryId.'&id2='.$group_cats[$index -1]['id'].'">'. |
|
239 | - Display::return_icon('up.png',' ','',ICON_SIZE_SMALL).'</a>'; |
|
238 | + $actions .= ' <a href="group.php?'.api_get_cidreq().'&action=swap_cat_order&id1='.$categoryId.'&id2='.$group_cats[$index - 1]['id'].'">'. |
|
239 | + Display::return_icon('up.png', ' ', '', ICON_SIZE_SMALL).'</a>'; |
|
240 | 240 | } |
241 | 241 | if ($index != count($group_cats) - 1) { |
242 | - $actions .= ' <a href="group.php?'.api_get_cidreq().'&action=swap_cat_order&id1='.$categoryId.'&id2='.$group_cats[$index +1]['id'].'">'. |
|
243 | - Display::return_icon('down.png',' ','',ICON_SIZE_SMALL).'</a>'; |
|
242 | + $actions .= ' <a href="group.php?'.api_get_cidreq().'&action=swap_cat_order&id1='.$categoryId.'&id2='.$group_cats[$index + 1]['id'].'">'. |
|
243 | + Display::return_icon('down.png', ' ', '', ICON_SIZE_SMALL).'</a>'; |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
247 | 247 | echo Display::page_header( |
248 | - Security::remove_XSS($category['title'].' '. $label.' ').$actions, |
|
248 | + Security::remove_XSS($category['title'].' '.$label.' ').$actions, |
|
249 | 249 | null, |
250 | 250 | 'h4', |
251 | 251 | false |
@@ -16,7 +16,7 @@ |
||
16 | 16 | api_protect_admin_script(true); |
17 | 17 | |
18 | 18 | // setting breadcrumbs |
19 | -$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
|
19 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
20 | 20 | |
21 | 21 | $form = new FormValidator('archive_cleanup_form', 'post', '', '', array(), FormValidator::LAYOUT_BOX); |
22 | 22 | $form->addButtonSend(get_lang('ArchiveDirCleanupProceedButton')); |
@@ -99,27 +99,27 @@ discard block |
||
99 | 99 | $form = new FormValidator('user_add'); |
100 | 100 | $form->addElement('header', '', $tool_name); |
101 | 101 | if (api_is_western_name_order()) { |
102 | - // Firstname |
|
103 | - $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
104 | - $form->applyFilter('firstname', 'html_filter'); |
|
105 | - $form->applyFilter('firstname', 'trim'); |
|
106 | - $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
107 | - // Lastname |
|
108 | - $form->addElement('text', 'lastname', get_lang('LastName')); |
|
109 | - $form->applyFilter('lastname', 'html_filter'); |
|
110 | - $form->applyFilter('lastname', 'trim'); |
|
111 | - $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
102 | + // Firstname |
|
103 | + $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
104 | + $form->applyFilter('firstname', 'html_filter'); |
|
105 | + $form->applyFilter('firstname', 'trim'); |
|
106 | + $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
107 | + // Lastname |
|
108 | + $form->addElement('text', 'lastname', get_lang('LastName')); |
|
109 | + $form->applyFilter('lastname', 'html_filter'); |
|
110 | + $form->applyFilter('lastname', 'trim'); |
|
111 | + $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
112 | 112 | } else { |
113 | - // Lastname |
|
114 | - $form->addElement('text', 'lastname', get_lang('LastName')); |
|
115 | - $form->applyFilter('lastname', 'html_filter'); |
|
116 | - $form->applyFilter('lastname', 'trim'); |
|
117 | - $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
118 | - // Firstname |
|
119 | - $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
120 | - $form->applyFilter('firstname', 'html_filter'); |
|
121 | - $form->applyFilter('firstname', 'trim'); |
|
122 | - $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
113 | + // Lastname |
|
114 | + $form->addElement('text', 'lastname', get_lang('LastName')); |
|
115 | + $form->applyFilter('lastname', 'html_filter'); |
|
116 | + $form->applyFilter('lastname', 'trim'); |
|
117 | + $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
118 | + // Firstname |
|
119 | + $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
120 | + $form->applyFilter('firstname', 'html_filter'); |
|
121 | + $form->applyFilter('firstname', 'trim'); |
|
122 | + $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
123 | 123 | } |
124 | 124 | // Official code |
125 | 125 | $form->addElement('text', 'official_code', get_lang('OfficialCode'), array('size' => '40')); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $auth_sources = 0; //make available wider as we need it in case of form reset (see below) |
164 | 164 | $nb_ext_auth_source_added = 0; |
165 | 165 | if (isset($extAuthSource) && count($extAuthSource) > 0) { |
166 | - $auth_sources = array(); |
|
166 | + $auth_sources = array(); |
|
167 | 167 | foreach ($extAuthSource as $key => $info) { |
168 | 168 | // @todo : make uniform external authentification configuration (ex : cas and external_login ldap) |
169 | 169 | // Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | $nb_ext_auth_source_added++; |
175 | 175 | } |
176 | 176 | } |
177 | - if ($nb_ext_auth_source_added > 0) { |
|
178 | - $group[] = $form->createElement('radio', 'password_auto', null, get_lang('ExternalAuthentication').' ', 2); |
|
179 | - $group[] = $form->createElement('select', 'auth_source', null, $auth_sources); |
|
180 | - $group[] = $form->createElement('static', '', '', '<br />'); |
|
177 | + if ($nb_ext_auth_source_added > 0) { |
|
178 | + $group[] = $form->createElement('radio', 'password_auto', null, get_lang('ExternalAuthentication').' ', 2); |
|
179 | + $group[] = $form->createElement('select', 'auth_source', null, $auth_sources); |
|
180 | + $group[] = $form->createElement('static', '', '', '<br />'); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
@@ -246,12 +246,12 @@ discard block |
||
246 | 246 | $form->addElement('html', '<div id="drh_list" style="display:'.$display.';">'); |
247 | 247 | |
248 | 248 | if (isset($drh_list) && is_array($drh_list)) { |
249 | - foreach ($drh_list as $drh) { |
|
249 | + foreach ($drh_list as $drh) { |
|
250 | 250 | $drh_select->addOption( |
251 | 251 | api_get_person_name($drh['firstname'], $drh['lastname']), |
252 | 252 | $drh['user_id'] |
253 | 253 | ); |
254 | - } |
|
254 | + } |
|
255 | 255 | } |
256 | 256 | $form->addElement('html', '</div>'); |
257 | 257 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | |
326 | 326 | // Validate form |
327 | 327 | if ($form->validate()) { |
328 | - $check = Security::check_token('post'); |
|
328 | + $check = Security::check_token('post'); |
|
329 | 329 | if ($check) { |
330 | 330 | $user = $form->exportValues(); |
331 | 331 | $lastname = $user['lastname']; |
@@ -341,15 +341,15 @@ discard block |
||
341 | 341 | $send_mail = intval($user['mail']['send_mail']); |
342 | 342 | $hr_dept_id = isset($user['hr_dept_id']) ? intval($user['hr_dept_id']) : 0; |
343 | 343 | |
344 | - if (isset($extAuthSource) && count($extAuthSource) > 0 && |
|
344 | + if (isset($extAuthSource) && count($extAuthSource) > 0 && |
|
345 | 345 | $user['password']['password_auto'] == '2' |
346 | 346 | ) { |
347 | - $auth_source = $user['password']['auth_source']; |
|
348 | - $password = 'PLACEHOLDER'; |
|
349 | - } else { |
|
350 | - $auth_source = PLATFORM_AUTH_SOURCE; |
|
351 | - $password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password']; |
|
352 | - } |
|
347 | + $auth_source = $user['password']['auth_source']; |
|
348 | + $password = 'PLACEHOLDER'; |
|
349 | + } else { |
|
350 | + $auth_source = PLATFORM_AUTH_SOURCE; |
|
351 | + $password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password']; |
|
352 | + } |
|
353 | 353 | |
354 | 354 | if ($user['radio_expiration_date'] == '1') { |
355 | 355 | $expiration_date = $user['expiration_date']; |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $expiration_date = null; |
358 | 358 | } |
359 | 359 | |
360 | - $active = intval($user['active']); |
|
360 | + $active = intval($user['active']); |
|
361 | 361 | |
362 | 362 | if (api_get_setting('login_is_email') == 'true') { |
363 | 363 | $username = $email; |
@@ -388,12 +388,12 @@ discard block |
||
388 | 388 | $extra, |
389 | 389 | null, |
390 | 390 | $send_mail, |
391 | - $platform_admin |
|
391 | + $platform_admin |
|
392 | 392 | ); |
393 | 393 | |
394 | - Security::clear_token(); |
|
395 | - $tok = Security::get_token(); |
|
396 | - if (!empty($user_id)) { |
|
394 | + Security::clear_token(); |
|
395 | + $tok = Security::get_token(); |
|
396 | + if (!empty($user_id)) { |
|
397 | 397 | if (!empty($picture['name'])) { |
398 | 398 | $picture_uri = UserManager::update_user_picture( |
399 | 399 | $user_id, |
@@ -420,37 +420,37 @@ discard block |
||
420 | 420 | null, |
421 | 421 | $language |
422 | 422 | ); |
423 | - } |
|
423 | + } |
|
424 | 424 | |
425 | 425 | $extraFieldValues = new ExtraFieldValue('user'); |
426 | 426 | $user['item_id'] = $user_id; |
427 | 427 | $extraFieldValues->saveFieldValues($user); |
428 | - $message = get_lang('UserAdded'); |
|
429 | - } |
|
428 | + $message = get_lang('UserAdded'); |
|
429 | + } |
|
430 | 430 | |
431 | - if (isset($user['submit_plus'])) { |
|
432 | - //we want to add more. Prepare report message and redirect to the same page (to clean the form) |
|
431 | + if (isset($user['submit_plus'])) { |
|
432 | + //we want to add more. Prepare report message and redirect to the same page (to clean the form) |
|
433 | 433 | Display::addFlash(Display::return_message($message)); |
434 | - header('Location: user_add.php?sec_token='.$tok); |
|
435 | - exit; |
|
436 | - } else { |
|
437 | - $tok = Security::get_token(); |
|
434 | + header('Location: user_add.php?sec_token='.$tok); |
|
435 | + exit; |
|
436 | + } else { |
|
437 | + $tok = Security::get_token(); |
|
438 | 438 | Display::addFlash(Display::return_message($message)); |
439 | - header('Location: user_list.php?sec_token='.$tok); |
|
440 | - exit; |
|
441 | - } |
|
442 | - } |
|
439 | + header('Location: user_list.php?sec_token='.$tok); |
|
440 | + exit; |
|
441 | + } |
|
442 | + } |
|
443 | 443 | } else { |
444 | - if (isset($_POST['submit'])) { |
|
445 | - Security::clear_token(); |
|
446 | - } |
|
447 | - $token = Security::get_token(); |
|
448 | - $form->addElement('hidden', 'sec_token'); |
|
449 | - $form->setConstants(array('sec_token' => $token)); |
|
444 | + if (isset($_POST['submit'])) { |
|
445 | + Security::clear_token(); |
|
446 | + } |
|
447 | + $token = Security::get_token(); |
|
448 | + $form->addElement('hidden', 'sec_token'); |
|
449 | + $form->setConstants(array('sec_token' => $token)); |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | if (!empty($message)){ |
453 | - $message = Display::return_message(stripslashes($message)); |
|
453 | + $message = Display::return_message(stripslashes($message)); |
|
454 | 454 | } |
455 | 455 | $content = $form->returnForm(); |
456 | 456 |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | if (api_get_setting('login_is_email') == 'true') { |
136 | - $form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
|
136 | + $form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
|
137 | 137 | $form->addRule('email', get_lang('UserTaken'), 'username_available'); |
138 | 138 | } |
139 | 139 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | if (api_get_setting('login_is_email') != 'true') { |
154 | 154 | $form->addElement('text', 'username', get_lang('LoginName'), array('id'=> 'username', 'maxlength' => USERNAME_MAX_LENGTH, 'autocomplete' => 'off')); |
155 | 155 | $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required'); |
156 | - $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
|
156 | + $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
|
157 | 157 | $form->addRule('username', get_lang('OnlyLettersAndNumbersAllowed'), 'username'); |
158 | 158 | $form->addRule('username', get_lang('UserTaken'), 'username_available'); |
159 | 159 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | ); |
241 | 241 | |
242 | 242 | //drh list (display only if student) |
243 | -$display = isset($_POST['status']) && $_POST['status'] == STUDENT || !isset($_POST['status']) ? 'block' : 'none'; |
|
243 | +$display = isset($_POST['status']) && $_POST['status'] == STUDENT || !isset($_POST['status']) ? 'block' : 'none'; |
|
244 | 244 | |
245 | 245 | //@todo remove the drh list here. This code is unused |
246 | 246 | $form->addElement('html', '<div id="drh_list" style="display:'.$display.';">'); |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | $form->addGroup($group, 'mail', get_lang('SendMailToNewUser')); |
275 | 275 | // Expiration Date |
276 | 276 | $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0); |
277 | -$group = array (); |
|
277 | +$group = array(); |
|
278 | 278 | $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1); |
279 | 279 | $group[] = $form->createElement( |
280 | 280 | 'DateTimePicker', |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | $jquery_ready_content = $returnParams['jquery_ready_content']; |
296 | 296 | |
297 | 297 | // the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function |
298 | -$htmlHeadXtra[] ='<script> |
|
298 | +$htmlHeadXtra[] = '<script> |
|
299 | 299 | $(document).ready(function(){ |
300 | 300 | '.$jquery_ready_content.' |
301 | 301 | }); |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | $form->setConstants(array('sec_token' => $token)); |
450 | 450 | } |
451 | 451 | |
452 | -if (!empty($message)){ |
|
452 | +if (!empty($message)) { |
|
453 | 453 | $message = Display::return_message(stripslashes($message)); |
454 | 454 | } |
455 | 455 | $content = $form->returnForm(); |
@@ -36,22 +36,22 @@ discard block |
||
36 | 36 | if (substr($url, strlen($url) - 1, strlen($url)) == '/') { |
37 | 37 | UrlManager::update($url_id, $url, $description, $active); |
38 | 38 | } else { |
39 | - UrlManager::update($url_id, $url . '/', $description, $active); |
|
39 | + UrlManager::update($url_id, $url.'/', $description, $active); |
|
40 | 40 | } |
41 | 41 | // URL Images |
42 | - $url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/'; |
|
42 | + $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/'; |
|
43 | 43 | $image_fields = array("url_image_1", "url_image_2", "url_image_3"); |
44 | 44 | foreach ($image_fields as $image_field) { |
45 | 45 | if ($_FILES[$image_field]['error'] == 0) { |
46 | 46 | // Hardcoded: only PNG files allowed |
47 | 47 | $fileFields = explode('.', $_FILES[$image_field]['name']); |
48 | 48 | if (end($fileFields) == 'png') { |
49 | - if (file_exists($url_images_dir . $url_id . '_' . $image_field . '.png')) { |
|
49 | + if (file_exists($url_images_dir.$url_id.'_'.$image_field.'.png')) { |
|
50 | 50 | // if the file exists, we have to remove it before move_uploaded_file |
51 | - unlink($url_images_dir . $url_id . '_' . $image_field . '.png'); |
|
51 | + unlink($url_images_dir.$url_id.'_'.$image_field.'.png'); |
|
52 | 52 | } |
53 | 53 | move_uploaded_file( |
54 | - $_FILES[$image_field]['tmp_name'], $url_images_dir . $url_id . '_' . $image_field . '.png' |
|
54 | + $_FILES[$image_field]['tmp_name'], $url_images_dir.$url_id.'_'.$image_field.'.png' |
|
55 | 55 | ); |
56 | 56 | } |
57 | 57 | // else fail silently |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | UrlManager::add($url, $description, $active); |
69 | 69 | } else { |
70 | 70 | //create |
71 | - UrlManager::add($url . '/', $description, $active); |
|
71 | + UrlManager::add($url.'/', $description, $active); |
|
72 | 72 | } |
73 | 73 | $message = get_lang('URLAdded'); |
74 | 74 | $url_to_go = 'access_urls.php'; |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | // URL Images |
80 | 80 | $url .= (substr($url, strlen($url) - 1, strlen($url)) == '/') ? '' : '/'; |
81 | 81 | $url_id = UrlManager::get_url_id($url); |
82 | - $url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/'; |
|
82 | + $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/'; |
|
83 | 83 | $image_fields = array("url_image_1", "url_image_2", "url_image_3"); |
84 | 84 | foreach ($image_fields as $image_field) { |
85 | 85 | if ($_FILES[$image_field]['error'] == 0) { |
86 | 86 | // Hardcoded: only PNG files allowed |
87 | 87 | $fileFields = explode('.', $_FILES[$image_field]['name']); |
88 | 88 | if (end($fileFields) == 'png') { |
89 | - move_uploaded_file($_FILES[$image_field]['tmp_name'], $url_images_dir . $url_id . '_' . $image_field . '.png'); |
|
89 | + move_uploaded_file($_FILES[$image_field]['tmp_name'], $url_images_dir.$url_id.'_'.$image_field.'.png'); |
|
90 | 90 | } |
91 | 91 | // else fail silently |
92 | 92 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | Security::clear_token(); |
97 | 97 | $tok = Security::get_token(); |
98 | 98 | Display::addFlash(Display::return_message($message)); |
99 | - header('Location: ' . $url_to_go . '?sec_token=' . $tok); |
|
99 | + header('Location: '.$url_to_go.'?sec_token='.$tok); |
|
100 | 100 | exit(); |
101 | 101 | } |
102 | 102 | } else { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | WHERE |
43 | 43 | course_user.status='1' AND |
44 | 44 | course_user.user_id=user.user_id AND |
45 | - course_user.c_id ='" . $courseId . "'" . |
|
45 | + course_user.c_id ='".$courseId."'". |
|
46 | 46 | $order_clause; |
47 | 47 | $res = Database::query($sql); |
48 | 48 | $course_teachers = array(); |
@@ -58,18 +58,18 @@ discard block |
||
58 | 58 | INNER JOIN $access_url_rel_user_table url_rel_user |
59 | 59 | ON (u.user_id=url_rel_user.user_id) |
60 | 60 | WHERE |
61 | - url_rel_user.access_url_id=" . api_get_current_access_url_id() . " AND |
|
61 | + url_rel_user.access_url_id=".api_get_current_access_url_id()." AND |
|
62 | 62 | status=1" . $order_clause; |
63 | 63 | } else { |
64 | 64 | $sql = "SELECT user_id, lastname, firstname |
65 | - FROM $table_user WHERE status='1'" . $order_clause; |
|
65 | + FROM $table_user WHERE status='1'".$order_clause; |
|
66 | 66 | } |
67 | 67 | $courseInfo['tutor_name'] = null; |
68 | 68 | |
69 | 69 | $res = Database::query($sql); |
70 | 70 | $teachers = array(); |
71 | 71 | $allTeachers = array(); |
72 | -$platform_teachers[0] = '-- ' . get_lang('NoManager') . ' --'; |
|
72 | +$platform_teachers[0] = '-- '.get_lang('NoManager').' --'; |
|
73 | 73 | while ($obj = Database::fetch_object($res)) { |
74 | 74 | $allTeachers[$obj->user_id] = api_get_person_name($obj->firstname, $obj->lastname); |
75 | 75 | if (!array_key_exists($obj->user_id, $course_teachers)) { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | // Case where there is no teacher in the course |
89 | 89 | if (count($course_teachers) == 0) { |
90 | - $sql = 'SELECT tutor_name FROM ' . $course_table . ' WHERE code="' . $course_code . '"'; |
|
90 | + $sql = 'SELECT tutor_name FROM '.$course_table.' WHERE code="'.$course_code.'"'; |
|
91 | 91 | $res = Database::query($sql); |
92 | 92 | $tutor_name = Database::result($res, 0, 0); |
93 | 93 | $courseInfo['tutor_name'] = array_search($tutor_name, $platform_teachers); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | // Build the form |
97 | 97 | $form = new FormValidator('update_course', 'post', api_get_self().'?id='.$courseId); |
98 | -$form->addElement('header', get_lang('Course') . ' #' . $courseInfo['real_id'] . ' ' . $course_code); |
|
98 | +$form->addElement('header', get_lang('Course').' #'.$courseInfo['real_id'].' '.$course_code); |
|
99 | 99 | $form->addElement('hidden', 'code', $course_code); |
100 | 100 | |
101 | 101 | //title |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | - $groupName = 'session_coaches[' . $sessionId . ']'; |
|
155 | - $platformTeacherId = 'platform_teachers_by_session_' . $sessionId; |
|
156 | - $coachId = 'coaches_by_session_' . $sessionId; |
|
154 | + $groupName = 'session_coaches['.$sessionId.']'; |
|
155 | + $platformTeacherId = 'platform_teachers_by_session_'.$sessionId; |
|
156 | + $coachId = 'coaches_by_session_'.$sessionId; |
|
157 | 157 | |
158 | 158 | $platformTeacherName = 'platform_teachers_by_session'; |
159 | 159 | $coachName = 'coaches_by_session'; |
160 | 160 | |
161 | - $sessionUrl = api_get_path(WEB_CODE_PATH) . 'session/resume_session.php?id_session=' . $sessionId; |
|
161 | + $sessionUrl = api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$sessionId; |
|
162 | 162 | $form->addElement( |
163 | 163 | 'advmultiselect', |
164 | 164 | $groupName, |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $session['name'], |
167 | 167 | $sessionUrl, |
168 | 168 | array('target' => '_blank') |
169 | - ) . ' - ' . get_lang('Coaches'), |
|
169 | + ).' - '.get_lang('Coaches'), |
|
170 | 170 | $allTeachers |
171 | 171 | ); |
172 | 172 | $courseInfo[$groupName] = $sessionTeachers; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } |
175 | 175 | |
176 | 176 | // Category code |
177 | -$url = api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=search_category'; |
|
177 | +$url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_category'; |
|
178 | 178 | |
179 | 179 | $categorySelect = $form->addElement( |
180 | 180 | 'select_ajax', |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | $form->applyFilter('select_language', 'html_filter'); |
202 | 202 | |
203 | 203 | $group = array(); |
204 | -$group[]= $form->createElement('radio', 'visibility', get_lang("CourseAccess"), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD); |
|
205 | -$group[]= $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM); |
|
206 | -$group[]= $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED); |
|
207 | -$group[]= $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED); |
|
208 | -$group[]= $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN); |
|
204 | +$group[] = $form->createElement('radio', 'visibility', get_lang("CourseAccess"), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD); |
|
205 | +$group[] = $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM); |
|
206 | +$group[] = $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED); |
|
207 | +$group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED); |
|
208 | +$group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN); |
|
209 | 209 | $form->addGroup($group, '', get_lang('CourseAccess')); |
210 | 210 | |
211 | 211 | $group = array(); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $htmlHeadXtra[] = ' |
230 | 230 | <script> |
231 | 231 | $(function() { |
232 | - ' . $extra['jquery_ready_content'] . ' |
|
232 | + ' . $extra['jquery_ready_content'].' |
|
233 | 233 | }); |
234 | 234 | </script>'; |
235 | 235 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | foreach ($list as $course_temp) { |
285 | 285 | if ($course_temp['code'] != $course_code) { |
286 | 286 | $visual_code_is_used = true; |
287 | - $warn .= ' ' . $course_temp['title'] . ' (' . $course_temp['code'] . '),'; |
|
287 | + $warn .= ' '.$course_temp['title'].' ('.$course_temp['code'].'),'; |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 | $warn = substr($warn, 0, -1); |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $course['course_code'] = $course_code; |
304 | 304 | |
305 | 305 | if (!stristr($department_url, 'http://')) { |
306 | - $department_url = 'http://' . $department_url; |
|
306 | + $department_url = 'http://'.$department_url; |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | Database::query($sql); |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | if (array_key_exists('add_teachers_to_sessions_courses', $courseInfo)) { |
369 | 369 | $sql = "UPDATE $course_table SET |
370 | 370 | add_teachers_to_sessions_courses = '$addTeacherToSessionCourses' |
371 | - WHERE id = " . $courseInfo['real_id']; |
|
371 | + WHERE id = ".$courseInfo['real_id']; |
|
372 | 372 | Database::query($sql); |
373 | 373 | } |
374 | 374 |
@@ -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> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | $xajax = new xajax(); |
13 | 13 | $xajax->registerFunction( |
14 | - array('search_courses', 'Accessurleditcoursestourl', 'search_courses') |
|
14 | + array('search_courses', 'Accessurleditcoursestourl', 'search_courses') |
|
15 | 15 | ); |
16 | 16 | |
17 | 17 | // setting the section (for the tabs) |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | // Access restrictions |
21 | 21 | api_protect_global_admin_script(); |
22 | 22 | if (!api_get_multiple_access_url()) { |
23 | - header('Location: index.php'); |
|
24 | - exit; |
|
23 | + header('Location: index.php'); |
|
24 | + exit; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // Database Table Definitions |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | |
37 | 37 | $add_type = 'multiple'; |
38 | 38 | if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!='') { |
39 | - $add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
39 | + $add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $access_url_id = 1; |
43 | 43 | if (isset($_REQUEST['access_url_id']) && $_REQUEST['access_url_id']!='') { |
44 | - $access_url_id = Security::remove_XSS($_REQUEST['access_url_id']); |
|
44 | + $access_url_id = Security::remove_XSS($_REQUEST['access_url_id']); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $xajax -> processRequests(); |
@@ -162,22 +162,22 @@ discard block |
||
162 | 162 | <select name="access_url_id" onchange="javascript:send();"> |
163 | 163 | <option value="0">-- <?php echo get_lang('SelectUrl')?> -- </option> |
164 | 164 | <?php |
165 | - $url_selected=''; |
|
166 | - foreach ($url_list as $url_obj) { |
|
167 | - $checked = ''; |
|
168 | - if (!empty($access_url_id)) { |
|
169 | - if ($url_obj[0]==$access_url_id) { |
|
170 | - $checked = 'selected=true'; |
|
171 | - $url_selected=$url_obj[1]; |
|
172 | - } |
|
173 | - } |
|
174 | - if ($url_obj['active']==1) { |
|
175 | - ?> |
|
165 | + $url_selected=''; |
|
166 | + foreach ($url_list as $url_obj) { |
|
167 | + $checked = ''; |
|
168 | + if (!empty($access_url_id)) { |
|
169 | + if ($url_obj[0]==$access_url_id) { |
|
170 | + $checked = 'selected=true'; |
|
171 | + $url_selected=$url_obj[1]; |
|
172 | + } |
|
173 | + } |
|
174 | + if ($url_obj['active']==1) { |
|
175 | + ?> |
|
176 | 176 | <option <?php echo $checked;?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?></option> |
177 | 177 | <?php |
178 | - } |
|
179 | - } |
|
180 | - ?> |
|
178 | + } |
|
179 | + } |
|
180 | + ?> |
|
181 | 181 | </select> |
182 | 182 | <br /><br /> |
183 | 183 | <input type="hidden" name="form_sent" value="1" /> |
@@ -196,38 +196,38 @@ discard block |
||
196 | 196 | <td align="center"> |
197 | 197 | <div id="content_source"> |
198 | 198 | <?php |
199 | - if($ajax_search) { |
|
200 | - ?> |
|
199 | + if($ajax_search) { |
|
200 | + ?> |
|
201 | 201 | <input type="text" id="course_to_add" onkeyup="xajax_search_courses(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)" /> |
202 | 202 | <div id="ajax_list_courses"></div> |
203 | 203 | <?php |
204 | - } else { |
|
205 | - ?> |
|
204 | + } else { |
|
205 | + ?> |
|
206 | 206 | <select id="origin_users" name="no_course_list[]" multiple="multiple" size="15" style="width:380px;"> |
207 | 207 | <?php |
208 | - foreach($no_course_list as $no_course) { |
|
209 | - ?> |
|
208 | + foreach($no_course_list as $no_course) { |
|
209 | + ?> |
|
210 | 210 | <option value="<?php echo $no_course['id']; ?>"><?php echo $no_course['title'].' ('.$no_course['code'].')'; ?></option> |
211 | 211 | <?php |
212 | - } |
|
213 | - unset($no_course_list); |
|
214 | - ?> |
|
212 | + } |
|
213 | + unset($no_course_list); |
|
214 | + ?> |
|
215 | 215 | </select> |
216 | 216 | <?php |
217 | - } |
|
218 | - ?> |
|
217 | + } |
|
218 | + ?> |
|
219 | 219 | </div> |
220 | 220 | </td> |
221 | 221 | <td width="10%" valign="middle" align="center"> |
222 | 222 | <?php |
223 | - if($ajax_search) { |
|
224 | - ?> |
|
223 | + if($ajax_search) { |
|
224 | + ?> |
|
225 | 225 | <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('destination_users'))" > |
226 | 226 | <em class="fa fa-arrow-left"></em> |
227 | 227 | </button> |
228 | 228 | <?php |
229 | - } else { |
|
230 | - ?> |
|
229 | + } else { |
|
230 | + ?> |
|
231 | 231 | <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" > |
232 | 232 | <em class="fa fa-arrow-right"></em> |
233 | 233 | </button> |
@@ -236,21 +236,21 @@ discard block |
||
236 | 236 | <em class="fa fa-arrow-left"></em> |
237 | 237 | </button> |
238 | 238 | <?php |
239 | - } |
|
240 | - ?> |
|
239 | + } |
|
240 | + ?> |
|
241 | 241 | <br /><br /><br /><br /><br /><br /> |
242 | 242 | </td> |
243 | 243 | <td align="center"> |
244 | 244 | <select id="destination_users" name="course_list[]" multiple="multiple" size="15" style="width:380px;"> |
245 | 245 | <?php |
246 | - foreach($course_list as $course) { |
|
247 | - $courseInfo = api_get_course_info_by_id($course['id']); |
|
248 | - ?> |
|
246 | + foreach($course_list as $course) { |
|
247 | + $courseInfo = api_get_course_info_by_id($course['id']); |
|
248 | + ?> |
|
249 | 249 | <option value="<?php echo $course['id']; ?>"><?php echo $course['title'].' ('.$courseInfo['code'].')'; ?></option> |
250 | 250 | <?php |
251 | - } |
|
252 | - unset($course_list); |
|
253 | - ?> |
|
251 | + } |
|
252 | + unset($course_list); |
|
253 | + ?> |
|
254 | 254 | |
255 | 255 | </select></td> |
256 | 256 | </tr> |
@@ -258,11 +258,11 @@ discard block |
||
258 | 258 | <td colspan="3" align="center"> |
259 | 259 | <br /> |
260 | 260 | <?php |
261 | - if(isset($_GET['add'])) |
|
262 | - echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>'; |
|
263 | - else |
|
264 | - echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>'; |
|
265 | - ?> |
|
261 | + if(isset($_GET['add'])) |
|
262 | + echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>'; |
|
263 | + else |
|
264 | + echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>'; |
|
265 | + ?> |
|
266 | 266 | </td> |
267 | 267 | </tr> |
268 | 268 | </table> |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | $interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')); |
36 | 36 | |
37 | 37 | $add_type = 'multiple'; |
38 | -if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!='') { |
|
38 | +if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') { |
|
39 | 39 | $add_type = Security::remove_XSS($_REQUEST['add_type']); |
40 | 40 | } |
41 | 41 | |
42 | 42 | $access_url_id = 1; |
43 | -if (isset($_REQUEST['access_url_id']) && $_REQUEST['access_url_id']!='') { |
|
43 | +if (isset($_REQUEST['access_url_id']) && $_REQUEST['access_url_id'] != '') { |
|
44 | 44 | $access_url_id = Security::remove_XSS($_REQUEST['access_url_id']); |
45 | 45 | } |
46 | 46 | |
@@ -157,23 +157,23 @@ discard block |
||
157 | 157 | <?php echo $link_add_type_unique ?> | <?php echo $link_add_type_multiple ?> |
158 | 158 | </div> |
159 | 159 | <br /><br /> |
160 | - <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?> > |
|
160 | + <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?> > |
|
161 | 161 | <?php echo get_lang('SelectUrl').' : '; ?> |
162 | 162 | <select name="access_url_id" onchange="javascript:send();"> |
163 | 163 | <option value="0">-- <?php echo get_lang('SelectUrl')?> -- </option> |
164 | 164 | <?php |
165 | - $url_selected=''; |
|
165 | + $url_selected = ''; |
|
166 | 166 | foreach ($url_list as $url_obj) { |
167 | 167 | $checked = ''; |
168 | 168 | if (!empty($access_url_id)) { |
169 | - if ($url_obj[0]==$access_url_id) { |
|
169 | + if ($url_obj[0] == $access_url_id) { |
|
170 | 170 | $checked = 'selected=true'; |
171 | - $url_selected=$url_obj[1]; |
|
171 | + $url_selected = $url_obj[1]; |
|
172 | 172 | } |
173 | 173 | } |
174 | - if ($url_obj['active']==1) { |
|
174 | + if ($url_obj['active'] == 1) { |
|
175 | 175 | ?> |
176 | - <option <?php echo $checked;?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?></option> |
|
176 | + <option <?php echo $checked; ?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?></option> |
|
177 | 177 | <?php |
178 | 178 | } |
179 | 179 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | <td align="center"> |
197 | 197 | <div id="content_source"> |
198 | 198 | <?php |
199 | - if($ajax_search) { |
|
199 | + if ($ajax_search) { |
|
200 | 200 | ?> |
201 | 201 | <input type="text" id="course_to_add" onkeyup="xajax_search_courses(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)" /> |
202 | 202 | <div id="ajax_list_courses"></div> |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | ?> |
206 | 206 | <select id="origin_users" name="no_course_list[]" multiple="multiple" size="15" style="width:380px;"> |
207 | 207 | <?php |
208 | - foreach($no_course_list as $no_course) { |
|
208 | + foreach ($no_course_list as $no_course) { |
|
209 | 209 | ?> |
210 | 210 | <option value="<?php echo $no_course['id']; ?>"><?php echo $no_course['title'].' ('.$no_course['code'].')'; ?></option> |
211 | 211 | <?php |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | </td> |
221 | 221 | <td width="10%" valign="middle" align="center"> |
222 | 222 | <?php |
223 | - if($ajax_search) { |
|
223 | + if ($ajax_search) { |
|
224 | 224 | ?> |
225 | 225 | <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('destination_users'))" > |
226 | 226 | <em class="fa fa-arrow-left"></em> |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | <td align="center"> |
244 | 244 | <select id="destination_users" name="course_list[]" multiple="multiple" size="15" style="width:380px;"> |
245 | 245 | <?php |
246 | - foreach($course_list as $course) { |
|
246 | + foreach ($course_list as $course) { |
|
247 | 247 | $courseInfo = api_get_course_info_by_id($course['id']); |
248 | 248 | ?> |
249 | 249 | <option value="<?php echo $course['id']; ?>"><?php echo $course['title'].' ('.$courseInfo['code'].')'; ?></option> |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | <td colspan="3" align="center"> |
259 | 259 | <br /> |
260 | 260 | <?php |
261 | - if(isset($_GET['add'])) |
|
261 | + if (isset($_GET['add'])) |
|
262 | 262 | echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>'; |
263 | 263 | else |
264 | 264 | echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>'; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | WHERE status=1".$order_clause; |
24 | 24 | // Filtering teachers when creating a course. |
25 | 25 | if (api_is_multiple_url_enabled()) { |
26 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
26 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
27 | 27 | $sql = "SELECT u.user_id,lastname,firstname |
28 | 28 | FROM $table_user as u |
29 | 29 | INNER JOIN $access_url_rel_user_table url_rel_user |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | ); |
93 | 93 | |
94 | 94 | // Course department |
95 | -$form->addText('department_name', get_lang('CourseDepartment'), false, array ('size' => '60')); |
|
95 | +$form->addText('department_name', get_lang('CourseDepartment'), false, array('size' => '60')); |
|
96 | 96 | $form->applyFilter('department_name', 'html_filter'); |
97 | 97 | $form->applyFilter('department_name', 'trim'); |
98 | 98 | |
99 | 99 | // Department URL |
100 | -$form->addText('department_url', get_lang('CourseDepartmentURL'), false, array ('size' => '60')); |
|
100 | +$form->addText('department_url', get_lang('CourseDepartmentURL'), false, array('size' => '60')); |
|
101 | 101 | $form->applyFilter('department_url', 'html_filter'); |
102 | 102 | |
103 | 103 | // Course language. |
@@ -125,32 +125,32 @@ discard block |
||
125 | 125 | get_lang('PickACourseAsATemplateForThisNewCourse'), |
126 | 126 | ], |
127 | 127 | null, |
128 | - ['url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=search_course'] |
|
128 | + ['url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_course'] |
|
129 | 129 | ); |
130 | 130 | } |
131 | 131 | |
132 | 132 | $form->addElement('checkbox', 'exemplary_content', '', get_lang('FillWithExemplaryContent')); |
133 | 133 | |
134 | 134 | $group = array(); |
135 | -$group[]= $form->createElement('radio', 'visibility', get_lang('CourseAccess'), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD); |
|
136 | -$group[]= $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM); |
|
137 | -$group[]= $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED); |
|
138 | -$group[]= $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED); |
|
139 | -$group[]= $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN); |
|
135 | +$group[] = $form->createElement('radio', 'visibility', get_lang('CourseAccess'), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD); |
|
136 | +$group[] = $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM); |
|
137 | +$group[] = $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED); |
|
138 | +$group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED); |
|
139 | +$group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN); |
|
140 | 140 | |
141 | -$form->addGroup($group,'', get_lang('CourseAccess')); |
|
141 | +$form->addGroup($group, '', get_lang('CourseAccess')); |
|
142 | 142 | |
143 | 143 | $group = array(); |
144 | -$group[]= $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1); |
|
145 | -$group[]= $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0); |
|
146 | -$form->addGroup($group,'', get_lang('Subscription')); |
|
144 | +$group[] = $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1); |
|
145 | +$group[] = $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0); |
|
146 | +$form->addGroup($group, '', get_lang('Subscription')); |
|
147 | 147 | |
148 | 148 | $group = array(); |
149 | -$group[]= $form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1); |
|
150 | -$group[]= $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0); |
|
149 | +$group[] = $form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1); |
|
150 | +$group[] = $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0); |
|
151 | 151 | $form->addGroup($group, '', get_lang('Unsubscription')); |
152 | 152 | |
153 | -$form->addElement('text','disk_quota',array(get_lang('CourseQuota'), null, get_lang('MB'))); |
|
153 | +$form->addElement('text', 'disk_quota', array(get_lang('CourseQuota'), null, get_lang('MB'))); |
|
154 | 154 | $form->addRule('disk_quota', get_lang('ThisFieldShouldBeNumeric'), 'numeric'); |
155 | 155 | |
156 | 156 | $obj = new GradeModel(); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $extra_field = new ExtraField('course'); |
161 | 161 | $extra = $extra_field->addElements($form); |
162 | 162 | |
163 | -$htmlHeadXtra[] =' |
|
163 | +$htmlHeadXtra[] = ' |
|
164 | 164 | <script> |
165 | 165 | |
166 | 166 | $(function() { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | // Set some default values. |
175 | 175 | $values['course_language'] = api_get_setting('platformLanguage'); |
176 | -$values['disk_quota'] = round(api_get_setting('default_document_quotum')/1024/1024, 1); |
|
176 | +$values['disk_quota'] = round(api_get_setting('default_document_quotum') / 1024 / 1024, 1); |
|
177 | 177 | |
178 | 178 | $default_course_visibility = api_get_setting('courses_default_creation_visibility'); |
179 | 179 | |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | $course = $form->exportValues(); |
194 | 194 | |
195 | 195 | $course_teachers = isset($course['course_teachers']) ? $course['course_teachers'] : null; |
196 | - $course['disk_quota'] = $course['disk_quota']*1024*1024; |
|
196 | + $course['disk_quota'] = $course['disk_quota'] * 1024 * 1024; |
|
197 | 197 | $course['exemplary_content'] = empty($course['exemplary_content']) ? false : true; |
198 | 198 | $course['teachers'] = $course_teachers; |
199 | 199 | $course['wanted_code'] = $course['visual_code']; |
200 | - $course['gradebook_model_id'] = isset($course['gradebook_model_id']) ? $course['gradebook_model_id'] : null; |
|
200 | + $course['gradebook_model_id'] = isset($course['gradebook_model_id']) ? $course['gradebook_model_id'] : null; |
|
201 | 201 | // Fixing category code |
202 | - $course['course_category'] = isset($course['category_code']) ? $course['category_code'] : ''; |
|
202 | + $course['course_category'] = isset($course['category_code']) ? $course['category_code'] : ''; |
|
203 | 203 | |
204 | - include_once api_get_path(SYS_CODE_PATH) . 'lang/english/trad4all.inc.php'; |
|
205 | - $file_to_include = api_get_path(SYS_CODE_PATH) . 'lang/' . $course['course_language'] . '/trad4all.inc.php'; |
|
204 | + include_once api_get_path(SYS_CODE_PATH).'lang/english/trad4all.inc.php'; |
|
205 | + $file_to_include = api_get_path(SYS_CODE_PATH).'lang/'.$course['course_language'].'/trad4all.inc.php'; |
|
206 | 206 | |
207 | 207 | if (file_exists($file_to_include)) { |
208 | 208 | include $file_to_include; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @param string $course Course code |
88 | 88 | * @param integer $lp_id |
89 | 89 | * @param integer $user_id |
90 | - * @return mixed True on success, false on error |
|
90 | + * @return boolean True on success, false on error |
|
91 | 91 | */ |
92 | 92 | public function __construct($course, $lp_id, $user_id) |
93 | 93 | { |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | * @param int $max_time_allowed |
492 | 492 | * @param int $userId |
493 | 493 | * |
494 | - * @return int |
|
494 | + * @return false|string |
|
495 | 495 | */ |
496 | 496 | public function add_item( |
497 | 497 | $parent, |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | * @param array $courseInfo |
1044 | 1044 | * @param integer Learnpath ID |
1045 | 1045 | * @param string Whether to delete data or keep it (default: 'keep', others: 'remove') |
1046 | - * @return boolean True on success, false on failure (might change that to return number of elements deleted) |
|
1046 | + * @return false|null True on success, false on failure (might change that to return number of elements deleted) |
|
1047 | 1047 | */ |
1048 | 1048 | public function delete($courseInfo = null, $id = null, $delete = 'keep') |
1049 | 1049 | { |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | * @param integer $id Elem ID (0 if first) |
1183 | 1183 | * @param integer $remove Whether to remove the resource/data from the |
1184 | 1184 | * system or leave it (default: 'keep', others 'remove') |
1185 | - * @return integer Number of elements moved |
|
1185 | + * @return false|null Number of elements moved |
|
1186 | 1186 | * @todo implement resource removal |
1187 | 1187 | */ |
1188 | 1188 | public function delete_item($id, $remove = 'keep') |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | * @param array $audio The array resulting of the $_FILES[mp3] element |
1265 | 1265 | * @param int $max_time_allowed |
1266 | 1266 | * @param string $url |
1267 | - * @return boolean True on success, false on error |
|
1267 | + * @return false|null True on success, false on error |
|
1268 | 1268 | */ |
1269 | 1269 | public function edit_item( |
1270 | 1270 | $id, |
@@ -1783,7 +1783,7 @@ discard block |
||
1783 | 1783 | |
1784 | 1784 | /** |
1785 | 1785 | * Gets the first element URL. |
1786 | - * @return string URL to load into the viewer |
|
1786 | + * @return false|null URL to load into the viewer |
|
1787 | 1787 | */ |
1788 | 1788 | public function first() |
1789 | 1789 | { |
@@ -2297,6 +2297,7 @@ discard block |
||
2297 | 2297 | * @param int $student_id |
2298 | 2298 | * @param string Course code (optional) |
2299 | 2299 | * @param int $sessionId |
2300 | + * @param string $courseCode |
|
2300 | 2301 | * @return bool |
2301 | 2302 | */ |
2302 | 2303 | public static function is_lp_visible_for_student( |
@@ -2594,7 +2595,7 @@ discard block |
||
2594 | 2595 | |
2595 | 2596 | /** |
2596 | 2597 | * Gets the learnpath session id |
2597 | - * @return string Learnpath theme |
|
2598 | + * @return integer Learnpath theme |
|
2598 | 2599 | */ |
2599 | 2600 | public function get_lp_session_id() |
2600 | 2601 | { |
@@ -2627,7 +2628,7 @@ discard block |
||
2627 | 2628 | /** |
2628 | 2629 | * @param string $size |
2629 | 2630 | * @param string $path_type |
2630 | - * @return bool|string |
|
2631 | + * @return string|false |
|
2631 | 2632 | */ |
2632 | 2633 | public function get_preview_image_path($size = null, $path_type = 'web') |
2633 | 2634 | { |
@@ -2773,6 +2774,8 @@ discard block |
||
2773 | 2774 | * Returns the XML DOM document's node |
2774 | 2775 | * @param resource Reference to a list of objects to search for the given ITEM_* |
2775 | 2776 | * @param string The identifier to look for |
2777 | + * @param DOMNodeList $children |
|
2778 | + * @param string $id |
|
2776 | 2779 | * @return mixed The reference to the element found with that identifier. False if not found |
2777 | 2780 | */ |
2778 | 2781 | public function get_scorm_xml_node(& $children, $id) |
@@ -3020,7 +3023,7 @@ discard block |
||
3020 | 3023 | /** |
3021 | 3024 | * Generate and return the table of contents for this learnpath. The (flat) table returned can be |
3022 | 3025 | * used by get_html_toc() to be ready to display |
3023 | - * @return array TOC as a table with 4 elements per row: title, link, status and level |
|
3026 | + * @return boolean TOC as a table with 4 elements per row: title, link, status and level |
|
3024 | 3027 | */ |
3025 | 3028 | public function get_toc() |
3026 | 3029 | { |
@@ -3156,7 +3159,7 @@ discard block |
||
3156 | 3159 | } |
3157 | 3160 | |
3158 | 3161 | /** |
3159 | - * @return array |
|
3162 | + * @return string[] |
|
3160 | 3163 | */ |
3161 | 3164 | public static function getChapterTypes() |
3162 | 3165 | { |
@@ -4062,7 +4065,7 @@ discard block |
||
4062 | 4065 | * Open a resource = initialise all local variables relative to this resource. Depending on the child |
4063 | 4066 | * class, this might be redefined to allow several behaviours depending on the document type. |
4064 | 4067 | * @param integer Resource ID |
4065 | - * @return boolean True on success, false otherwise |
|
4068 | + * @return boolean|null True on success, false otherwise |
|
4066 | 4069 | */ |
4067 | 4070 | public function open($id) |
4068 | 4071 | { |
@@ -4191,7 +4194,7 @@ discard block |
||
4191 | 4194 | * Can be used as abstract |
4192 | 4195 | * @param integer $lp_id Learnpath id |
4193 | 4196 | * @param string $set_visibility New visibility (v/i - visible/invisible) |
4194 | - * @return bool |
|
4197 | + * @return false|null |
|
4195 | 4198 | */ |
4196 | 4199 | public static function toggle_publish($lp_id, $set_visibility = 'v') |
4197 | 4200 | { |
@@ -4276,7 +4279,7 @@ discard block |
||
4276 | 4279 | * Make sure the results are saved with anoter method. This method should probably be |
4277 | 4280 | * redefined in children classes. |
4278 | 4281 | * To use a similar method statically, use the create_new_attempt() method |
4279 | - * @return string URL to load in the viewer |
|
4282 | + * @return boolean URL to load in the viewer |
|
4280 | 4283 | */ |
4281 | 4284 | public function restart() |
4282 | 4285 | { |
@@ -4354,6 +4357,7 @@ discard block |
||
4354 | 4357 | * Saves the given item |
4355 | 4358 | * @param integer $item_id. Optional (will take from $_REQUEST if null) |
4356 | 4359 | * @param boolean $from_outside Save from url params (true) or from current attributes (false). Optional. Defaults to true |
4360 | + * @param integer $item_id |
|
4357 | 4361 | * @return boolean |
4358 | 4362 | */ |
4359 | 4363 | public function save_item($item_id = null, $from_outside = true) |
@@ -4851,7 +4855,7 @@ discard block |
||
4851 | 4855 | |
4852 | 4856 | /** |
4853 | 4857 | * Sets use_max_score |
4854 | - * @param string $use_max_score Optional string giving the new location of this learnpath |
|
4858 | + * @param integer $use_max_score Optional string giving the new location of this learnpath |
|
4855 | 4859 | * @return boolean True on success / False on error |
4856 | 4860 | */ |
4857 | 4861 | public function set_use_max_score($use_max_score = 1) |
@@ -5254,6 +5258,7 @@ discard block |
||
5254 | 5258 | * Register the attempt mode into db thanks to flags prevent_reinit and seriousgame_mode flags |
5255 | 5259 | * |
5256 | 5260 | * @param string 'seriousgame', 'single' or 'multiple' |
5261 | + * @param string $mode |
|
5257 | 5262 | * @return boolean |
5258 | 5263 | * @author ndiechburg <[email protected]> |
5259 | 5264 | **/ |
@@ -5296,7 +5301,7 @@ discard block |
||
5296 | 5301 | /** |
5297 | 5302 | * Switch between multiple attempt, single attempt or serious_game mode (only for scorm) |
5298 | 5303 | * |
5299 | - * @return boolean |
|
5304 | + * @return boolean|null |
|
5300 | 5305 | * @author ndiechburg <[email protected]> |
5301 | 5306 | **/ |
5302 | 5307 | public function switch_attempt_mode() |
@@ -5487,7 +5492,6 @@ discard block |
||
5487 | 5492 | /** |
5488 | 5493 | * Function that creates a html list of learning path items so that we can add audio files to them |
5489 | 5494 | * @author Kevin Van Den Haute |
5490 | - * @param int $lp_id |
|
5491 | 5495 | * @return string |
5492 | 5496 | */ |
5493 | 5497 | public function overview() |
@@ -6501,7 +6505,7 @@ discard block |
||
6501 | 6505 | /** |
6502 | 6506 | * Function that displays a list with al the resources that |
6503 | 6507 | * could be added to the learning path |
6504 | - * @return string |
|
6508 | + * @return boolean |
|
6505 | 6509 | */ |
6506 | 6510 | public function display_resources() |
6507 | 6511 | { |
@@ -10046,7 +10050,7 @@ discard block |
||
10046 | 10050 | |
10047 | 10051 | /** |
10048 | 10052 | * @param int $lp_id |
10049 | - * @return bool |
|
10053 | + * @return false|null |
|
10050 | 10054 | */ |
10051 | 10055 | public function scorm_export_to_pdf($lp_id) |
10052 | 10056 | { |
@@ -10581,7 +10585,7 @@ discard block |
||
10581 | 10585 | |
10582 | 10586 | /** |
10583 | 10587 | * @param int $itemId |
10584 | - * @return learnpathItem|false |
|
10588 | + * @return string |
|
10585 | 10589 | */ |
10586 | 10590 | public function getItem($itemId) |
10587 | 10591 | { |
@@ -10631,7 +10635,6 @@ discard block |
||
10631 | 10635 | /** |
10632 | 10636 | * Set whether this is a learning path with the possibility to subscribe |
10633 | 10637 | * users or not |
10634 | - * @param int $subscribeUsers (0 = false, 1 = true) |
|
10635 | 10638 | */ |
10636 | 10639 | public function setSubscribeUsers($value) |
10637 | 10640 | { |
@@ -10756,7 +10759,7 @@ discard block |
||
10756 | 10759 | |
10757 | 10760 | /** |
10758 | 10761 | * Get the item of exercise type (evaluation type) |
10759 | - * @return array The final evaluation. Otherwise return false |
|
10762 | + * @return integer The final evaluation. Otherwise return false |
|
10760 | 10763 | */ |
10761 | 10764 | public function getFinalEvaluationItem() |
10762 | 10765 | { |
@@ -10980,7 +10983,7 @@ discard block |
||
10980 | 10983 | /** |
10981 | 10984 | * Create a forum for this learning path |
10982 | 10985 | * @param type $forumCategoryId |
10983 | - * @return int The forum ID if was created. Otherwise return false |
|
10986 | + * @return false|string The forum ID if was created. Otherwise return false |
|
10984 | 10987 | */ |
10985 | 10988 | public function createForum($forumCategoryId) |
10986 | 10989 | { |
@@ -3938,8 +3938,9 @@ discard block |
||
3938 | 3938 | WHERE c_id = ".$course_id." |
3939 | 3939 | ORDER BY display_order"; |
3940 | 3940 | $res = Database::query($sql); |
3941 | - if ($res === false) |
|
3942 | - return false; |
|
3941 | + if ($res === false) { |
|
3942 | + return false; |
|
3943 | + } |
|
3943 | 3944 | $lps = array (); |
3944 | 3945 | $lp_order = array (); |
3945 | 3946 | $num = Database :: num_rows($res); |
@@ -4539,8 +4540,9 @@ discard block |
||
4539 | 4540 | if ($this->debug > 0) { |
4540 | 4541 | error_log('New LP - In learnpath::set_maker()', 0); |
4541 | 4542 | } |
4542 | - if (empty ($name)) |
|
4543 | - return false; |
|
4543 | + if (empty ($name)) { |
|
4544 | + return false; |
|
4545 | + } |
|
4544 | 4546 | $this->maker = $name; |
4545 | 4547 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4546 | 4548 | $course_id = api_get_course_int_id(); |
@@ -4605,8 +4607,9 @@ discard block |
||
4605 | 4607 | public function set_terms_by_prefix($terms_string, $prefix) |
4606 | 4608 | { |
4607 | 4609 | $course_id = api_get_course_int_id(); |
4608 | - if (api_get_setting('search_enabled') !== 'true') |
|
4609 | - return false; |
|
4610 | + if (api_get_setting('search_enabled') !== 'true') { |
|
4611 | + return false; |
|
4612 | + } |
|
4610 | 4613 | |
4611 | 4614 | if (!extension_loaded('xapian')) { |
4612 | 4615 | return false; |
@@ -4619,8 +4622,9 @@ discard block |
||
4619 | 4622 | $stored_terms = $this->get_common_index_terms_by_prefix($prefix); |
4620 | 4623 | |
4621 | 4624 | // Don't do anything if no change, verify only at DB, not the search engine. |
4622 | - if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) |
|
4623 | - return false; |
|
4625 | + if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) { |
|
4626 | + return false; |
|
4627 | + } |
|
4624 | 4628 | |
4625 | 4629 | require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API. |
4626 | 4630 | require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
@@ -4812,8 +4816,9 @@ discard block |
||
4812 | 4816 | if ($this->debug > 0) { |
4813 | 4817 | error_log('New LP - In learnpath::set_proximity()', 0); |
4814 | 4818 | } |
4815 | - if (empty ($name)) |
|
4816 | - return false; |
|
4819 | + if (empty ($name)) { |
|
4820 | + return false; |
|
4821 | + } |
|
4817 | 4822 | |
4818 | 4823 | $this->proximity = $name; |
4819 | 4824 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
@@ -5157,8 +5162,9 @@ discard block |
||
5157 | 5162 | |
5158 | 5163 | $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." ORDER BY display_order"; |
5159 | 5164 | $res = Database::query($sql); |
5160 | - if ($res === false) |
|
5161 | - return false; |
|
5165 | + if ($res === false) { |
|
5166 | + return false; |
|
5167 | + } |
|
5162 | 5168 | |
5163 | 5169 | $num = Database :: num_rows($res); |
5164 | 5170 | // First check the order is correct, globally (might be wrong because |
@@ -5469,8 +5475,9 @@ discard block |
||
5469 | 5475 | $position[$key] = $row['display_order']; |
5470 | 5476 | } |
5471 | 5477 | |
5472 | - if (count($array) > 0) |
|
5473 | - array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array); |
|
5478 | + if (count($array) > 0) { |
|
5479 | + array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array); |
|
5480 | + } |
|
5474 | 5481 | |
5475 | 5482 | return $array; |
5476 | 5483 | } |
@@ -6242,10 +6249,12 @@ discard block |
||
6242 | 6249 | if ($new_comment || $new_title) { |
6243 | 6250 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6244 | 6251 | $ct = ''; |
6245 | - if ($new_comment) |
|
6246 | - $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
6247 | - if ($new_title) |
|
6248 | - $ct .= ", title='" . Database::escape_string($new_title)."' "; |
|
6252 | + if ($new_comment) { |
|
6253 | + $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
6254 | + } |
|
6255 | + if ($new_title) { |
|
6256 | + $ct .= ", title='" . Database::escape_string($new_title)."' "; |
|
6257 | + } |
|
6249 | 6258 | |
6250 | 6259 | $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)." |
6251 | 6260 | WHERE c_id = ".$course_id." AND id = " . $document_id; |
@@ -6269,17 +6278,21 @@ discard block |
||
6269 | 6278 | // Please, do not modify this dirname formatting. |
6270 | 6279 | $dir = isset($_GET['dir']) ? $_GET['dir'] : $_POST['dir']; |
6271 | 6280 | |
6272 | - if (strstr($dir, '..')) |
|
6273 | - $dir = '/'; |
|
6281 | + if (strstr($dir, '..')) { |
|
6282 | + $dir = '/'; |
|
6283 | + } |
|
6274 | 6284 | |
6275 | - if ($dir[0] == '.') |
|
6276 | - $dir = substr($dir, 1); |
|
6285 | + if ($dir[0] == '.') { |
|
6286 | + $dir = substr($dir, 1); |
|
6287 | + } |
|
6277 | 6288 | |
6278 | - if ($dir[0] != '/') |
|
6279 | - $dir = '/' . $dir; |
|
6289 | + if ($dir[0] != '/') { |
|
6290 | + $dir = '/' . $dir; |
|
6291 | + } |
|
6280 | 6292 | |
6281 | - if ($dir[strlen($dir) - 1] != '/') |
|
6282 | - $dir .= '/'; |
|
6293 | + if ($dir[strlen($dir) - 1] != '/') { |
|
6294 | + $dir .= '/'; |
|
6295 | + } |
|
6283 | 6296 | |
6284 | 6297 | $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir; |
6285 | 6298 | |
@@ -6344,8 +6357,9 @@ discard block |
||
6344 | 6357 | } |
6345 | 6358 | $return .= '<div style="padding:10px;">'; |
6346 | 6359 | |
6347 | - if ($msg != '') |
|
6348 | - $return .= $msg; |
|
6360 | + if ($msg != '') { |
|
6361 | + $return .= $msg; |
|
6362 | + } |
|
6349 | 6363 | |
6350 | 6364 | $return .= '<h3>'.$row['title'].'</h3>'; |
6351 | 6365 | switch ($row['item_type']) { |
@@ -6606,10 +6620,11 @@ discard block |
||
6606 | 6620 | $item_title = Security::remove_XSS($item_title); |
6607 | 6621 | $item_description = Security::remove_XSS($item_description); |
6608 | 6622 | |
6609 | - if ($id != 0 && is_array($extra_info)) |
|
6610 | - $parent = $extra_info['parent_item_id']; |
|
6611 | - else |
|
6612 | - $parent = 0; |
|
6623 | + if ($id != 0 && is_array($extra_info)) { |
|
6624 | + $parent = $extra_info['parent_item_id']; |
|
6625 | + } else { |
|
6626 | + $parent = 0; |
|
6627 | + } |
|
6613 | 6628 | |
6614 | 6629 | $sql = "SELECT * FROM " . $tbl_lp_item . " |
6615 | 6630 | WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
@@ -6909,8 +6924,9 @@ discard block |
||
6909 | 6924 | $arrHide[] = $arrLP[$i]['id']; |
6910 | 6925 | } |
6911 | 6926 | } else { |
6912 | - if ($arrLP[$i]['item_type'] == 'dir') |
|
6913 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6927 | + if ($arrLP[$i]['item_type'] == 'dir') { |
|
6928 | + $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6929 | + } |
|
6914 | 6930 | } |
6915 | 6931 | } |
6916 | 6932 | |
@@ -6928,11 +6944,13 @@ discard block |
||
6928 | 6944 | |
6929 | 6945 | for ($i = 0; $i < count($arrLP); $i++) { |
6930 | 6946 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
6931 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
6947 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
6948 | + $selected = 'selected="selected" '; |
|
6949 | + } elseif ($action == 'add') { |
|
6932 | 6950 | $selected = 'selected="selected" '; |
6933 | - elseif ($action == 'add') $selected = 'selected="selected" '; |
|
6934 | - else |
|
6935 | - $selected = ''; |
|
6951 | + } else { |
|
6952 | + $selected = ''; |
|
6953 | + } |
|
6936 | 6954 | |
6937 | 6955 | $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
6938 | 6956 | } |
@@ -6959,9 +6977,11 @@ discard block |
||
6959 | 6977 | $arrHide = array (); |
6960 | 6978 | for ($i = 0; $i < count($arrLP); $i++) { |
6961 | 6979 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
6962 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
6963 | - $s_selected_position = $arrLP[$i]['id']; |
|
6964 | - elseif ($action == 'add') $s_selected_position = 0; |
|
6980 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
6981 | + $s_selected_position = $arrLP[$i]['id']; |
|
6982 | + } elseif ($action == 'add') { |
|
6983 | + $s_selected_position = 0; |
|
6984 | + } |
|
6965 | 6985 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
6966 | 6986 | } |
6967 | 6987 | } |
@@ -7153,9 +7173,11 @@ discard block |
||
7153 | 7173 | $arrHide = array(); |
7154 | 7174 | for ($i = 0; $i < count($arrLP); $i++) { |
7155 | 7175 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
7156 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7157 | - $s_selected_position = $arrLP[$i]['id']; |
|
7158 | - elseif ($action == 'add') $s_selected_position = 0; |
|
7176 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7177 | + $s_selected_position = $arrLP[$i]['id']; |
|
7178 | + } elseif ($action == 'add') { |
|
7179 | + $s_selected_position = 0; |
|
7180 | + } |
|
7159 | 7181 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7160 | 7182 | } |
7161 | 7183 | } |
@@ -7350,9 +7372,11 @@ discard block |
||
7350 | 7372 | |
7351 | 7373 | for ($i = 0; $i < count($arrLP); $i++) { |
7352 | 7374 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
7353 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7354 | - $s_selected_position = $arrLP[$i]['id']; |
|
7355 | - elseif ($action == 'add') $s_selected_position = 0; |
|
7375 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7376 | + $s_selected_position = $arrLP[$i]['id']; |
|
7377 | + } elseif ($action == 'add') { |
|
7378 | + $s_selected_position = 0; |
|
7379 | + } |
|
7356 | 7380 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7357 | 7381 | |
7358 | 7382 | } |
@@ -7386,8 +7410,7 @@ discard block |
||
7386 | 7410 | |
7387 | 7411 | if (is_numeric($extra_info)) { |
7388 | 7412 | $form->addHidden('path', $extra_info); |
7389 | - } |
|
7390 | - elseif (is_array($extra_info)) { |
|
7413 | + } elseif (is_array($extra_info)) { |
|
7391 | 7414 | $form->addHidden('path', $extra_info['path']); |
7392 | 7415 | } |
7393 | 7416 | |
@@ -7440,8 +7463,9 @@ discard block |
||
7440 | 7463 | lp_id = " . $this->lp_id . " AND |
7441 | 7464 | id != $id"; |
7442 | 7465 | |
7443 | - if ($item_type == 'dir') |
|
7444 | - $sql .= " AND parent_item_id = 0"; |
|
7466 | + if ($item_type == 'dir') { |
|
7467 | + $sql .= " AND parent_item_id = 0"; |
|
7468 | + } |
|
7445 | 7469 | |
7446 | 7470 | $result = Database::query($sql); |
7447 | 7471 | $arrLP = array (); |
@@ -7842,9 +7866,11 @@ discard block |
||
7842 | 7866 | $arrHide = array(); |
7843 | 7867 | for ($i = 0; $i < count($arrLP); $i++) { |
7844 | 7868 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir' && $arrLP[$i]['item_type'] !== TOOL_LP_FINAL_ITEM) { |
7845 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7869 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7870 | + $s_selected_position = $arrLP[$i]['id']; |
|
7871 | + } elseif ($action == 'add') { |
|
7846 | 7872 | $s_selected_position = $arrLP[$i]['id']; |
7847 | - elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id']; |
|
7873 | + } |
|
7848 | 7874 | |
7849 | 7875 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7850 | 7876 | |
@@ -7855,17 +7881,18 @@ discard block |
||
7855 | 7881 | $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null; |
7856 | 7882 | $edit = isset($_GET['edit']) ? $_GET['edit'] : null; |
7857 | 7883 | if (($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $item_type == TOOL_LP_FINAL_ITEM || $edit == 'true')) { |
7858 | - if (isset ($_POST['content'])) |
|
7859 | - $content = stripslashes($_POST['content']); |
|
7860 | - elseif (is_array($extra_info)) { |
|
7884 | + if (isset ($_POST['content'])) { |
|
7885 | + $content = stripslashes($_POST['content']); |
|
7886 | + } elseif (is_array($extra_info)) { |
|
7861 | 7887 | //If it's an html document or a text file |
7862 | 7888 | if (!$no_display_edit_textarea) { |
7863 | 7889 | $content = $this->display_document($extra_info['path'], false, false); |
7864 | 7890 | } |
7865 | - } elseif (is_numeric($extra_info)) |
|
7866 | - $content = $this->display_document($extra_info, false, false); |
|
7867 | - else |
|
7868 | - $content = ''; |
|
7891 | + } elseif (is_numeric($extra_info)) { |
|
7892 | + $content = $this->display_document($extra_info, false, false); |
|
7893 | + } else { |
|
7894 | + $content = ''; |
|
7895 | + } |
|
7869 | 7896 | |
7870 | 7897 | if (!$no_display_edit_textarea) { |
7871 | 7898 | // We need to calculate here some specific settings for the online editor. |
@@ -8129,9 +8156,11 @@ discard block |
||
8129 | 8156 | $arrHide = array(); |
8130 | 8157 | for ($i = 0; $i < count($arrLP); $i++) { |
8131 | 8158 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
8132 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
8133 | - $s_selected_position = $arrLP[$i]['id']; |
|
8134 | - elseif ($action == 'add') $s_selected_position = 0; |
|
8159 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
8160 | + $s_selected_position = $arrLP[$i]['id']; |
|
8161 | + } elseif ($action == 'add') { |
|
8162 | + $s_selected_position = 0; |
|
8163 | + } |
|
8135 | 8164 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
8136 | 8165 | |
8137 | 8166 | } |
@@ -8327,9 +8356,11 @@ discard block |
||
8327 | 8356 | $arrHide = array (); |
8328 | 8357 | for ($i = 0; $i < count($arrLP); $i++) { |
8329 | 8358 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
8330 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
8331 | - $s_selected_position = $arrLP[$i]['id']; |
|
8332 | - elseif ($action == 'add') $s_selected_position = 0; |
|
8359 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
8360 | + $s_selected_position = $arrLP[$i]['id']; |
|
8361 | + } elseif ($action == 'add') { |
|
8362 | + $s_selected_position = 0; |
|
8363 | + } |
|
8333 | 8364 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
8334 | 8365 | |
8335 | 8366 | } |
@@ -9381,10 +9412,11 @@ discard block |
||
9381 | 9412 | |
9382 | 9413 | // Dependency to other files - not yet supported. |
9383 | 9414 | $i = 1; |
9384 | - if ($inc_docs) |
|
9385 | - foreach ($inc_docs as $doc_info) { |
|
9415 | + if ($inc_docs) { |
|
9416 | + foreach ($inc_docs as $doc_info) { |
|
9386 | 9417 | if (count($doc_info) < 1 || empty($doc_info[0])) { |
9387 | 9418 | continue; |
9419 | + } |
|
9388 | 9420 | } |
9389 | 9421 | $my_dep = $xmldoc->createElement('resource'); |
9390 | 9422 | $res_id = 'RESOURCE_'.$item->get_id().'_'.$i; |
@@ -6038,8 +6038,8 @@ discard block |
||
6038 | 6038 | $course_id = api_get_course_int_id(); |
6039 | 6039 | } |
6040 | 6040 | |
6041 | - $creatorId = empty($creatorId) ? api_get_user_id() : $creatorId; |
|
6042 | - $sessionId = api_get_session_id(); |
|
6041 | + $creatorId = empty($creatorId) ? api_get_user_id() : $creatorId; |
|
6042 | + $sessionId = api_get_session_id(); |
|
6043 | 6043 | |
6044 | 6044 | // Generates folder |
6045 | 6045 | $result = $this->generate_lp_folder($courseInfo); |
@@ -11114,7 +11114,7 @@ discard block |
||
11114 | 11114 | $lpItemId = []; |
11115 | 11115 | $typeListNotToVerify = self::getChapterTypes(); |
11116 | 11116 | |
11117 | - // Using get_toc() function instead $this->items because returns the correct order of the items |
|
11117 | + // Using get_toc() function instead $this->items because returns the correct order of the items |
|
11118 | 11118 | foreach ($this->get_toc() as $item) { |
11119 | 11119 | if (!in_array($item['type'], $typeListNotToVerify)) { |
11120 | 11120 | $lpItemId[] = $item['id']; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | // Percentage progress as saved in the db. |
58 | 58 | public $progress_db = '0'; |
59 | 59 | public $proximity; // Wether the content is distant or local or unknown. |
60 | - public $refs_list = array (); //list of items by ref => db_id. Used only for prerequisites match. |
|
60 | + public $refs_list = array(); //list of items by ref => db_id. Used only for prerequisites match. |
|
61 | 61 | // !!!This array (refs_list) is built differently depending on the nature of the LP. |
62 | 62 | // If SCORM, uses ref, if Chamilo, uses id to keep a unique value. |
63 | 63 | public $type; //type of learnpath. Could be 'dokeos', 'scorm', 'scorm2004', 'aicc', ... |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | if (!empty($row['expired_on'])) { |
162 | - $this->expired_on = $row['expired_on']; |
|
162 | + $this->expired_on = $row['expired_on']; |
|
163 | 163 | } |
164 | 164 | if ($this->type == 2) { |
165 | 165 | if ($row['force_commit'] == 1) { |
@@ -203,12 +203,12 @@ discard block |
||
203 | 203 | ORDER BY view_count DESC"; |
204 | 204 | $res = Database::query($sql); |
205 | 205 | if ($this->debug > 2) { |
206 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - querying lp_view: ' . $sql, 0); |
|
206 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - querying lp_view: '.$sql, 0); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | if (Database :: num_rows($res) > 0) { |
210 | 210 | if ($this->debug > 2) { |
211 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - Found previous view', 0); |
|
211 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - Found previous view', 0); |
|
212 | 212 | } |
213 | 213 | $row = Database :: fetch_array($res); |
214 | 214 | $this->attempt = $row['view_count']; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $this->lp_view_session_id = $row['session_id']; |
219 | 219 | } else if (!api_is_invitee()) { |
220 | 220 | if ($this->debug > 2) { |
221 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - NOT Found previous view', 0); |
|
221 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - NOT Found previous view', 0); |
|
222 | 222 | } |
223 | 223 | $this->attempt = 1; |
224 | 224 | $params = [ |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $this->lp_view_id = Database::insert_id(); |
234 | 234 | |
235 | 235 | if ($this->debug > 2) { |
236 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - inserting new lp_view: ' . $sql, 0); |
|
236 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - inserting new lp_view: '.$sql, 0); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | $sql = "UPDATE $lp_table SET id = iid WHERE iid = ".$this->lp_view_id; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $res = Database::query($sql); |
249 | 249 | |
250 | 250 | if ($this->debug > 2) { |
251 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - query lp items: ' . $sql, 0); |
|
251 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - query lp items: '.$sql, 0); |
|
252 | 252 | error_log('-- Start while--', 0); |
253 | 253 | } |
254 | 254 | |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | $this->refs_list[$oItem->ref] = $my_item_id; |
269 | 269 | if ($this->debug > 2) { |
270 | 270 | error_log( |
271 | - 'New LP - learnpath::__construct() - ' . |
|
272 | - 'aicc object with id ' . $my_item_id . |
|
271 | + 'New LP - learnpath::__construct() - '. |
|
272 | + 'aicc object with id '.$my_item_id. |
|
273 | 273 | ' set in items[]', |
274 | 274 | 0 |
275 | 275 | ); |
@@ -288,19 +288,19 @@ discard block |
||
288 | 288 | |
289 | 289 | $this->refs_list[$oItem->ref] = $my_item_id; |
290 | 290 | if ($this->debug > 2) { |
291 | - error_log('New LP - object with id ' . $my_item_id . ' set in items[]', 0); |
|
291 | + error_log('New LP - object with id '.$my_item_id.' set in items[]', 0); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | break; |
295 | 295 | case 1: |
296 | 296 | default: |
297 | 297 | if ($this->debug > 2) { |
298 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - calling learnpathItem', 0); |
|
298 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - calling learnpathItem', 0); |
|
299 | 299 | } |
300 | 300 | $oItem = new learnpathItem($row['id'], $user_id, $course_id, $row); |
301 | 301 | |
302 | 302 | if ($this->debug > 2) { |
303 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - end calling learnpathItem', 0); |
|
303 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - end calling learnpathItem', 0); |
|
304 | 304 | } |
305 | 305 | if (is_object($oItem)) { |
306 | 306 | $my_item_id = $oItem->get_id(); |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | $this->refs_list[$my_item_id] = $my_item_id; |
312 | 312 | if ($this->debug > 2) { |
313 | 313 | error_log( |
314 | - 'New LP - learnpath::__construct() ' . __LINE__ . |
|
315 | - ' - object with id ' . $my_item_id . ' set in items[]', |
|
314 | + 'New LP - learnpath::__construct() '.__LINE__. |
|
315 | + ' - object with id '.$my_item_id.' set in items[]', |
|
316 | 316 | 0 |
317 | 317 | ); |
318 | 318 | } |
@@ -331,13 +331,13 @@ discard block |
||
331 | 331 | $this->items[$row['id']]->set_lp_view($this->lp_view_id, $course_id); |
332 | 332 | if ($this->items[$row['id']]->get_type() == TOOL_HOTPOTATOES) { |
333 | 333 | $this->items[$row['id']]->current_start_time = 0; |
334 | - $this->items[$row['id']]->current_stop_time = 0; |
|
334 | + $this->items[$row['id']]->current_stop_time = 0; |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
339 | 339 | if ($this->debug > 2) { |
340 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' ----- end while ----', 0); |
|
340 | + error_log('New LP - learnpath::__construct() '.__LINE__.' ----- end while ----', 0); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | if (!empty($lp_item_id_list)) { |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | // TODO: Define the current item better. |
430 | 430 | $this->first(); |
431 | 431 | if ($this->debug > 2) { |
432 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - End of learnpath constructor for learnpath ' . $this->get_id(), 0); |
|
432 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - End of learnpath constructor for learnpath '.$this->get_id(), 0); |
|
433 | 433 | } |
434 | 434 | return true; |
435 | 435 | } |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | ) { |
507 | 507 | $course_id = $this->course_info['real_id']; |
508 | 508 | if ($this->debug > 0) { |
509 | - error_log('New LP - In learnpath::add_item(' . $parent . ',' . $previous . ',' . $type . ',' . $id . ',' . $title . ')', 0); |
|
509 | + error_log('New LP - In learnpath::add_item('.$parent.','.$previous.','.$type.','.$id.','.$title.')', 0); |
|
510 | 510 | } |
511 | 511 | if (empty($course_id)) { |
512 | 512 | // Sometimes Oogie doesn't catch the course info but sets $this->cc |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | FROM $tbl_lp_item |
529 | 529 | WHERE |
530 | 530 | c_id = $course_id AND |
531 | - lp_id = " . $this->get_id() . " AND |
|
531 | + lp_id = ".$this->get_id()." AND |
|
532 | 532 | parent_item_id = " . $parent; |
533 | 533 | |
534 | 534 | $res_count = Database::query($sql); |
@@ -538,11 +538,11 @@ discard block |
||
538 | 538 | if ($num > 0) { |
539 | 539 | if ($previous == 0) { |
540 | 540 | $sql = "SELECT id, next_item_id, display_order |
541 | - FROM " . $tbl_lp_item . " |
|
541 | + FROM " . $tbl_lp_item." |
|
542 | 542 | WHERE |
543 | 543 | c_id = $course_id AND |
544 | - lp_id = " . $this->get_id() . " AND |
|
545 | - parent_item_id = " . $parent . " AND |
|
544 | + lp_id = ".$this->get_id()." AND |
|
545 | + parent_item_id = " . $parent." AND |
|
546 | 546 | previous_item_id = 0 OR |
547 | 547 | previous_item_id=" . $parent; |
548 | 548 | $result = Database::query($sql); |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | FROM $tbl_lp_item |
557 | 557 | WHERE |
558 | 558 | c_id = $course_id AND |
559 | - lp_id = " . $this->get_id() . " AND |
|
559 | + lp_id = ".$this->get_id()." AND |
|
560 | 560 | id = " . $previous; |
561 | 561 | |
562 | 562 | $result = Database::query($sql); |
@@ -576,8 +576,8 @@ discard block |
||
576 | 576 | $typeCleaned = Database::escape_string($type); |
577 | 577 | if ($type == 'quiz') { |
578 | 578 | $sql = 'SELECT SUM(ponderation) |
579 | - FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION) . ' as quiz_question |
|
580 | - INNER JOIN ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION) . ' as quiz_rel_question |
|
579 | + FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION).' as quiz_question |
|
580 | + INNER JOIN ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question |
|
581 | 581 | ON |
582 | 582 | quiz_question.id = quiz_rel_question.question_id AND |
583 | 583 | quiz_question.c_id = quiz_rel_question.c_id |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | $new_item_id = Database::insert($tbl_lp_item, $params); |
624 | 624 | |
625 | 625 | if ($this->debug > 2) { |
626 | - error_log('New LP - Inserting dir/chapter: ' . $new_item_id, 0); |
|
626 | + error_log('New LP - Inserting dir/chapter: '.$new_item_id, 0); |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | if ($new_item_id) { |
@@ -639,28 +639,28 @@ discard block |
||
639 | 639 | Database::query($sql); |
640 | 640 | |
641 | 641 | // Update all the items after the new item. |
642 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
642 | + $sql = "UPDATE ".$tbl_lp_item." |
|
643 | 643 | SET display_order = display_order + 1 |
644 | 644 | WHERE |
645 | 645 | c_id = $course_id AND |
646 | - lp_id = " . $this->get_id() . " AND |
|
647 | - id <> " . $new_item_id . " AND |
|
648 | - parent_item_id = " . $parent . " AND |
|
646 | + lp_id = ".$this->get_id()." AND |
|
647 | + id <> " . $new_item_id." AND |
|
648 | + parent_item_id = " . $parent." AND |
|
649 | 649 | display_order > " . $display_order; |
650 | 650 | Database::query($sql); |
651 | 651 | |
652 | 652 | // Update the item that should come after the new item. |
653 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
654 | - SET ref = " . $new_item_id . " |
|
655 | - WHERE c_id = $course_id AND id = " . $new_item_id; |
|
653 | + $sql = "UPDATE ".$tbl_lp_item." |
|
654 | + SET ref = " . $new_item_id." |
|
655 | + WHERE c_id = $course_id AND id = ".$new_item_id; |
|
656 | 656 | Database::query($sql); |
657 | 657 | |
658 | 658 | // Upload audio. |
659 | 659 | if (!empty($_FILES['mp3']['name'])) { |
660 | 660 | // Create the audio folder if it does not exist yet. |
661 | - $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/'; |
|
662 | - if (!is_dir($filepath . 'audio')) { |
|
663 | - mkdir($filepath . 'audio', api_get_permissions_for_new_directories()); |
|
661 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
662 | + if (!is_dir($filepath.'audio')) { |
|
663 | + mkdir($filepath.'audio', api_get_permissions_for_new_directories()); |
|
664 | 664 | $audio_id = add_document( |
665 | 665 | $_course, |
666 | 666 | '/audio', |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | $file_path = handle_uploaded_document( |
704 | 704 | $_course, |
705 | 705 | $_FILES['mp3'], |
706 | - api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document', |
|
706 | + api_get_path(SYS_COURSE_PATH).$_course['path'].'/document', |
|
707 | 707 | '/audio', |
708 | 708 | $userId, |
709 | 709 | '', |
@@ -719,8 +719,8 @@ discard block |
||
719 | 719 | |
720 | 720 | // Store the mp3 file in the lp_item table. |
721 | 721 | $sql = "UPDATE $tbl_lp_item SET |
722 | - audio = '" . Database::escape_string($file) . "' |
|
723 | - WHERE id = '" . intval($new_item_id) . "'"; |
|
722 | + audio = '".Database::escape_string($file)."' |
|
723 | + WHERE id = '" . intval($new_item_id)."'"; |
|
724 | 724 | Database::query($sql); |
725 | 725 | } |
726 | 726 | } |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | while (Database :: num_rows($res_name)) { |
798 | 798 | // There is already one such name, update the current one a bit. |
799 | 799 | $i++; |
800 | - $name = $name . ' - ' . $i; |
|
800 | + $name = $name.' - '.$i; |
|
801 | 801 | $check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '$name'"; |
802 | 802 | $res_name = Database::query($check_name); |
803 | 803 | } |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | // if $item points to an object and there is a parent. |
911 | 911 | if ($debug) { |
912 | 912 | error_log( |
913 | - 'Autocompleting parent of item ' . $item . ' "'.$currentItem->get_title().'" (item ' . $parent_id . ' "'.$parent->get_title().'") ', |
|
913 | + 'Autocompleting parent of item '.$item.' "'.$currentItem->get_title().'" (item '.$parent_id.' "'.$parent->get_title().'") ', |
|
914 | 914 | 0 |
915 | 915 | ); |
916 | 916 | } |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | if ($childItemId != $item) { |
939 | 939 | if ($debug) { |
940 | 940 | error_log( |
941 | - 'Looking at brother #'.$childItemId . ' "' . $childItem->get_title() . '", status is ' . $childItem->get_status(), |
|
941 | + 'Looking at brother #'.$childItemId.' "'.$childItem->get_title().'", status is '.$childItem->get_status(), |
|
942 | 942 | 0 |
943 | 943 | ); |
944 | 944 | } |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | } else { |
959 | 959 | if ($debug > 2) { |
960 | 960 | error_log( |
961 | - 'Found one incomplete child of parent #' . $parent_id . ': child #'.$childItemId . ' "' . $childItem->get_title() . '", is ' . $childItem->get_status().' db_item_view_id:#'.$childItem->db_item_view_id, |
|
961 | + 'Found one incomplete child of parent #'.$parent_id.': child #'.$childItemId.' "'.$childItem->get_title().'", is '.$childItem->get_status().' db_item_view_id:#'.$childItem->db_item_view_id, |
|
962 | 962 | 0 |
963 | 963 | ); |
964 | 964 | } |
@@ -1064,15 +1064,15 @@ discard block |
||
1064 | 1064 | // Delete lp item id. |
1065 | 1065 | foreach ($this->items as $id => $dummy) { |
1066 | 1066 | $sql = "DELETE FROM $lp_item_view |
1067 | - WHERE c_id = $course_id AND lp_item_id = '" . $id . "'"; |
|
1067 | + WHERE c_id = $course_id AND lp_item_id = '".$id."'"; |
|
1068 | 1068 | Database::query($sql); |
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | // Proposed by Christophe (nickname: clefevre) |
1072 | - $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
1072 | + $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
1073 | 1073 | Database::query($sql); |
1074 | 1074 | |
1075 | - $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
1075 | + $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
1076 | 1076 | Database::query($sql); |
1077 | 1077 | |
1078 | 1078 | self::toggle_publish($this->lp_id, 'i'); |
@@ -1080,33 +1080,33 @@ discard block |
||
1080 | 1080 | if ($this->type == 2 || $this->type == 3) { |
1081 | 1081 | // This is a scorm learning path, delete the files as well. |
1082 | 1082 | $sql = "SELECT path FROM $lp |
1083 | - WHERE c_id = ".$course_id." AND id = " . $this->lp_id; |
|
1083 | + WHERE c_id = ".$course_id." AND id = ".$this->lp_id; |
|
1084 | 1084 | $res = Database::query($sql); |
1085 | 1085 | if (Database :: num_rows($res) > 0) { |
1086 | 1086 | $row = Database :: fetch_array($res); |
1087 | 1087 | $path = $row['path']; |
1088 | 1088 | $sql = "SELECT id FROM $lp |
1089 | - WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id; |
|
1089 | + WHERE c_id = ".$course_id." AND path = '$path' AND id != ".$this->lp_id; |
|
1090 | 1090 | $res = Database::query($sql); |
1091 | 1091 | if (Database :: num_rows($res) > 0) { |
1092 | 1092 | // Another learning path uses this directory, so don't delete it. |
1093 | 1093 | if ($this->debug > 2) { |
1094 | - error_log('New LP - In learnpath::delete(), found other LP using path ' . $path . ', keeping directory', 0); |
|
1094 | + error_log('New LP - In learnpath::delete(), found other LP using path '.$path.', keeping directory', 0); |
|
1095 | 1095 | } |
1096 | 1096 | } else { |
1097 | 1097 | // No other LP uses that directory, delete it. |
1098 | - $course_rel_dir = api_get_course_path() . '/scorm/'; // scorm dir web path starting from /courses |
|
1099 | - $course_scorm_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir; // The absolute system path for this course. |
|
1100 | - if ($delete == 'remove' && is_dir($course_scorm_dir . $path) and !empty ($course_scorm_dir)) { |
|
1098 | + $course_rel_dir = api_get_course_path().'/scorm/'; // scorm dir web path starting from /courses |
|
1099 | + $course_scorm_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path for this course. |
|
1100 | + if ($delete == 'remove' && is_dir($course_scorm_dir.$path) and !empty ($course_scorm_dir)) { |
|
1101 | 1101 | if ($this->debug > 2) { |
1102 | - error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: ' . $course_scorm_dir . $path, 0); |
|
1102 | + error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: '.$course_scorm_dir.$path, 0); |
|
1103 | 1103 | } |
1104 | 1104 | // Proposed by Christophe (clefevre). |
1105 | 1105 | if (strcmp(substr($path, -2), "/.") == 0) { |
1106 | 1106 | $path = substr($path, 0, -1); // Remove "." at the end. |
1107 | 1107 | } |
1108 | 1108 | //exec('rm -rf ' . $course_scorm_dir . $path); // See Bug #5208, this is not OS-portable way. |
1109 | - rmdirr($course_scorm_dir . $path); |
|
1109 | + rmdirr($course_scorm_dir.$path); |
|
1110 | 1110 | } |
1111 | 1111 | } |
1112 | 1112 | } |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')"; |
1120 | 1120 | Database::query($sql); |
1121 | 1121 | |
1122 | - $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id; |
|
1122 | + $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = ".$this->lp_id; |
|
1123 | 1123 | Database::query($sql); |
1124 | 1124 | // Updates the display order of all lps. |
1125 | 1125 | $this->update_display_order(); |
@@ -1157,7 +1157,7 @@ discard block |
||
1157 | 1157 | { |
1158 | 1158 | $course_id = $this->course_info['real_id']; |
1159 | 1159 | if ($this->debug > 0) { |
1160 | - error_log('New LP - In learnpath::delete_children_items(' . $id . ')', 0); |
|
1160 | + error_log('New LP - In learnpath::delete_children_items('.$id.')', 0); |
|
1161 | 1161 | } |
1162 | 1162 | $num = 0; |
1163 | 1163 | if (empty ($id) || $id != strval(intval($id))) { |
@@ -1168,7 +1168,7 @@ discard block |
||
1168 | 1168 | $res = Database::query($sql); |
1169 | 1169 | while ($row = Database :: fetch_array($res)) { |
1170 | 1170 | $num += $this->delete_children_items($row['id']); |
1171 | - $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = " . $row['id']; |
|
1171 | + $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = ".$row['id']; |
|
1172 | 1172 | Database::query($sql_del); |
1173 | 1173 | $num++; |
1174 | 1174 | } |
@@ -1209,12 +1209,12 @@ discard block |
||
1209 | 1209 | // Delete children items. |
1210 | 1210 | $num = $this->delete_children_items($id); |
1211 | 1211 | if ($this->debug > 2) { |
1212 | - error_log('New LP - learnpath::delete_item() - deleted ' . $num . ' children of element ' . $id, 0); |
|
1212 | + error_log('New LP - learnpath::delete_item() - deleted '.$num.' children of element '.$id, 0); |
|
1213 | 1213 | } |
1214 | 1214 | // Now delete the item. |
1215 | 1215 | $sql_del = "DELETE FROM $lp_item WHERE c_id = $course_id AND id = $id"; |
1216 | 1216 | if ($this->debug > 2) { |
1217 | - error_log('New LP - Deleting item: ' . $sql_del, 0); |
|
1217 | + error_log('New LP - Deleting item: '.$sql_del, 0); |
|
1218 | 1218 | } |
1219 | 1219 | Database::query($sql_del); |
1220 | 1220 | // Now update surrounding items. |
@@ -1289,15 +1289,15 @@ discard block |
||
1289 | 1289 | } |
1290 | 1290 | |
1291 | 1291 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
1292 | - $sql_select = "SELECT * FROM " . $tbl_lp_item . " WHERE c_id = ".$course_id." AND id = " . $id; |
|
1292 | + $sql_select = "SELECT * FROM ".$tbl_lp_item." WHERE c_id = ".$course_id." AND id = ".$id; |
|
1293 | 1293 | $res_select = Database::query($sql_select); |
1294 | 1294 | $row_select = Database :: fetch_array($res_select); |
1295 | 1295 | $audio_update_sql = ''; |
1296 | 1296 | if (is_array($audio) && !empty ($audio['tmp_name']) && $audio['error'] === 0) { |
1297 | 1297 | // Create the audio folder if it does not exist yet. |
1298 | - $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/'; |
|
1299 | - if (!is_dir($filepath . 'audio')) { |
|
1300 | - mkdir($filepath . 'audio', api_get_permissions_for_new_directories()); |
|
1298 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
1299 | + if (!is_dir($filepath.'audio')) { |
|
1300 | + mkdir($filepath.'audio', api_get_permissions_for_new_directories()); |
|
1301 | 1301 | $audio_id = add_document( |
1302 | 1302 | $_course, |
1303 | 1303 | '/audio', |
@@ -1335,11 +1335,11 @@ discard block |
||
1335 | 1335 | $pi = pathinfo($audio['name']); |
1336 | 1336 | if ($pi['extension'] == 'mp3') { |
1337 | 1337 | $c_det = api_get_course_info($this->cc); |
1338 | - $bp = api_get_path(SYS_COURSE_PATH) . $c_det['path'] . '/document'; |
|
1338 | + $bp = api_get_path(SYS_COURSE_PATH).$c_det['path'].'/document'; |
|
1339 | 1339 | $path = handle_uploaded_document($c_det, $audio, $bp, '/audio', api_get_user_id(), 0, null, 0, 'rename', false, 0); |
1340 | 1340 | $path = substr($path, 7); |
1341 | 1341 | // Update reference in lp_item - audio path is the path from inside de document/audio/ dir. |
1342 | - $audio_update_sql = ", audio = '" . Database::escape_string($path) . "' "; |
|
1342 | + $audio_update_sql = ", audio = '".Database::escape_string($path)."' "; |
|
1343 | 1343 | } |
1344 | 1344 | } |
1345 | 1345 | |
@@ -1349,13 +1349,13 @@ discard block |
||
1349 | 1349 | // TODO: htmlspecialchars to be checked for encoding related problems. |
1350 | 1350 | if ($same_parent && $same_previous) { |
1351 | 1351 | // Only update title and description. |
1352 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1353 | - SET title = '" . Database::escape_string($title) . "', |
|
1354 | - prerequisite = '" . $prerequisites . "', |
|
1355 | - description = '" . Database::escape_string($description) . "' |
|
1356 | - " . $audio_update_sql . ", |
|
1357 | - max_time_allowed = '" . Database::escape_string($max_time_allowed) . "' |
|
1358 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
1352 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1353 | + SET title = '" . Database::escape_string($title)."', |
|
1354 | + prerequisite = '" . $prerequisites."', |
|
1355 | + description = '" . Database::escape_string($description)."' |
|
1356 | + " . $audio_update_sql.", |
|
1357 | + max_time_allowed = '" . Database::escape_string($max_time_allowed)."' |
|
1358 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
1359 | 1359 | Database::query($sql); |
1360 | 1360 | } else { |
1361 | 1361 | $old_parent = $row_select['parent_item_id']; |
@@ -1370,27 +1370,27 @@ discard block |
||
1370 | 1370 | |
1371 | 1371 | if ($old_previous != 0) { |
1372 | 1372 | // Next |
1373 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1374 | - SET next_item_id = " . $old_next . " |
|
1375 | - WHERE c_id = ".$course_id." AND id = " . $old_previous; |
|
1373 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1374 | + SET next_item_id = " . $old_next." |
|
1375 | + WHERE c_id = ".$course_id." AND id = ".$old_previous; |
|
1376 | 1376 | Database::query($sql); |
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | if ($old_next != 0) { |
1380 | 1380 | // Previous |
1381 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1382 | - SET previous_item_id = " . $old_previous . " |
|
1383 | - WHERE c_id = ".$course_id." AND id = " . $old_next; |
|
1381 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1382 | + SET previous_item_id = " . $old_previous." |
|
1383 | + WHERE c_id = ".$course_id." AND id = ".$old_next; |
|
1384 | 1384 | Database::query($sql); |
1385 | 1385 | } |
1386 | 1386 | |
1387 | 1387 | // display_order - 1 for every item with a display_order bigger then the display_order of the current item. |
1388 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1388 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1389 | 1389 | SET display_order = display_order - 1 |
1390 | 1390 | WHERE |
1391 | 1391 | c_id = ".$course_id." AND |
1392 | - display_order > " . $old_order . " AND |
|
1393 | - lp_id = " . $this->lp_id . " AND |
|
1392 | + display_order > " . $old_order." AND |
|
1393 | + lp_id = " . $this->lp_id." AND |
|
1394 | 1394 | parent_item_id = " . $old_parent; |
1395 | 1395 | Database::query($sql); |
1396 | 1396 | /* END -- virtually remove the current item id */ |
@@ -1400,11 +1400,11 @@ discard block |
||
1400 | 1400 | if ($previous == 0) { |
1401 | 1401 | // Select the data of the item that should come after the current item. |
1402 | 1402 | $sql = "SELECT id, display_order |
1403 | - FROM " . $tbl_lp_item . " |
|
1403 | + FROM " . $tbl_lp_item." |
|
1404 | 1404 | WHERE |
1405 | 1405 | c_id = ".$course_id." AND |
1406 | - lp_id = " . $this->lp_id . " AND |
|
1407 | - parent_item_id = " . $parent . " AND |
|
1406 | + lp_id = " . $this->lp_id." AND |
|
1407 | + parent_item_id = " . $parent." AND |
|
1408 | 1408 | previous_item_id = " . $previous; |
1409 | 1409 | $res_select_old = Database::query($sql); |
1410 | 1410 | $row_select_old = Database::fetch_array($res_select_old); |
@@ -1420,8 +1420,8 @@ discard block |
||
1420 | 1420 | } else { |
1421 | 1421 | // Select the data of the item that should come before the current item. |
1422 | 1422 | $sql = "SELECT next_item_id, display_order |
1423 | - FROM " . $tbl_lp_item . " |
|
1424 | - WHERE c_id = ".$course_id." AND id = " . $previous; |
|
1423 | + FROM " . $tbl_lp_item." |
|
1424 | + WHERE c_id = ".$course_id." AND id = ".$previous; |
|
1425 | 1425 | $res_select_old = Database::query($sql); |
1426 | 1426 | $row_select_old = Database :: fetch_array($res_select_old); |
1427 | 1427 | $new_next = $row_select_old['next_item_id']; |
@@ -1430,57 +1430,57 @@ discard block |
||
1430 | 1430 | |
1431 | 1431 | // TODO: htmlspecialchars to be checked for encoding related problems. |
1432 | 1432 | // Update the current item with the new data. |
1433 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1433 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1434 | 1434 | SET |
1435 | - title = '" . Database::escape_string($title) . "', |
|
1436 | - description = '" . Database::escape_string($description) . "', |
|
1437 | - parent_item_id = " . $parent . ", |
|
1438 | - previous_item_id = " . $previous . ", |
|
1439 | - next_item_id = " . $new_next . ", |
|
1440 | - display_order = " . $new_order . " |
|
1441 | - " . $audio_update_sql . " |
|
1442 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
1435 | + title = '" . Database::escape_string($title)."', |
|
1436 | + description = '" . Database::escape_string($description)."', |
|
1437 | + parent_item_id = " . $parent.", |
|
1438 | + previous_item_id = " . $previous.", |
|
1439 | + next_item_id = " . $new_next.", |
|
1440 | + display_order = " . $new_order." |
|
1441 | + " . $audio_update_sql." |
|
1442 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
1443 | 1443 | Database::query($sql); |
1444 | 1444 | |
1445 | 1445 | if ($previous != 0) { |
1446 | 1446 | // Update the previous item's next_item_id. |
1447 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1448 | - SET next_item_id = " . $id . " |
|
1449 | - WHERE c_id = ".$course_id." AND id = " . $previous; |
|
1447 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1448 | + SET next_item_id = " . $id." |
|
1449 | + WHERE c_id = ".$course_id." AND id = ".$previous; |
|
1450 | 1450 | Database::query($sql); |
1451 | 1451 | } |
1452 | 1452 | |
1453 | 1453 | if ($new_next != 0) { |
1454 | 1454 | // Update the next item's previous_item_id. |
1455 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1456 | - SET previous_item_id = " . $id . " |
|
1457 | - WHERE c_id = ".$course_id." AND id = " . $new_next; |
|
1455 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1456 | + SET previous_item_id = " . $id." |
|
1457 | + WHERE c_id = ".$course_id." AND id = ".$new_next; |
|
1458 | 1458 | Database::query($sql); |
1459 | 1459 | } |
1460 | 1460 | |
1461 | 1461 | if ($old_prerequisite != $prerequisites) { |
1462 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1463 | - SET prerequisite = '" . $prerequisites . "' |
|
1464 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
1462 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1463 | + SET prerequisite = '" . $prerequisites."' |
|
1464 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
1465 | 1465 | Database::query($sql); |
1466 | 1466 | } |
1467 | 1467 | |
1468 | 1468 | if ($old_max_time_allowed != $max_time_allowed) { |
1469 | 1469 | // update max time allowed |
1470 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1471 | - SET max_time_allowed = " . $max_time_allowed . " |
|
1472 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
1470 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1471 | + SET max_time_allowed = " . $max_time_allowed." |
|
1472 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
1473 | 1473 | Database::query($sql); |
1474 | 1474 | } |
1475 | 1475 | |
1476 | 1476 | // Update all the items with the same or a bigger display_order than the current item. |
1477 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1477 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1478 | 1478 | SET display_order = display_order + 1 |
1479 | 1479 | WHERE |
1480 | 1480 | c_id = ".$course_id." AND |
1481 | - lp_id = " . $this->get_id() . " AND |
|
1482 | - id <> " . $id . " AND |
|
1483 | - parent_item_id = " . $parent . " AND |
|
1481 | + lp_id = " . $this->get_id()." AND |
|
1482 | + id <> " . $id." AND |
|
1483 | + parent_item_id = " . $parent." AND |
|
1484 | 1484 | display_order >= " . $new_order; |
1485 | 1485 | |
1486 | 1486 | Database::query($sql); |
@@ -1506,7 +1506,7 @@ discard block |
||
1506 | 1506 | { |
1507 | 1507 | $course_id = api_get_course_int_id(); |
1508 | 1508 | if ($this->debug > 0) { |
1509 | - error_log('New LP - In learnpath::edit_item_prereq(' . $id . ',' . $prerequisite_id . ',' . $mastery_score . ',' . $max_score . ')', 0); |
|
1509 | + error_log('New LP - In learnpath::edit_item_prereq('.$id.','.$prerequisite_id.','.$mastery_score.','.$max_score.')', 0); |
|
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | if (empty($id) || ($id != strval(intval($id))) || empty ($prerequisite_id)) { |
@@ -1595,7 +1595,7 @@ discard block |
||
1595 | 1595 | |
1596 | 1596 | if (empty($id) || $id != strval(intval($id))) { |
1597 | 1597 | |
1598 | - return array (); |
|
1598 | + return array(); |
|
1599 | 1599 | } |
1600 | 1600 | |
1601 | 1601 | $lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
@@ -1635,7 +1635,7 @@ discard block |
||
1635 | 1635 | { |
1636 | 1636 | $course_id = api_get_course_int_id(); |
1637 | 1637 | if ($this->debug > 0) { |
1638 | - error_log('New LP - In learnpath::get_brother_items(' . $id . ')', 0); |
|
1638 | + error_log('New LP - In learnpath::get_brother_items('.$id.')', 0); |
|
1639 | 1639 | } |
1640 | 1640 | |
1641 | 1641 | if (empty ($id) || $id != strval(intval($id))) { |
@@ -1651,13 +1651,13 @@ discard block |
||
1651 | 1651 | $sql_bros = "SELECT * FROM $lp_item WHERE c_id = ".$course_id." AND parent_item_id = $parent |
1652 | 1652 | ORDER BY display_order"; |
1653 | 1653 | $res_bros = Database::query($sql_bros); |
1654 | - $list = array (); |
|
1654 | + $list = array(); |
|
1655 | 1655 | while ($row_bro = Database :: fetch_array($res_bros)) { |
1656 | 1656 | $list[] = $row_bro; |
1657 | 1657 | } |
1658 | 1658 | return $list; |
1659 | 1659 | } |
1660 | - return array (); |
|
1660 | + return array(); |
|
1661 | 1661 | } |
1662 | 1662 | |
1663 | 1663 | /** |
@@ -1730,7 +1730,7 @@ discard block |
||
1730 | 1730 | $current = $this->current; |
1731 | 1731 | } |
1732 | 1732 | if ($this->debug > 2) { |
1733 | - error_log('New LP - In learnpath::get_current_item_id() - Returning ' . $current, 0); |
|
1733 | + error_log('New LP - In learnpath::get_current_item_id() - Returning '.$current, 0); |
|
1734 | 1734 | } |
1735 | 1735 | return $current; |
1736 | 1736 | } |
@@ -1809,7 +1809,7 @@ discard block |
||
1809 | 1809 | //&& !$this->items[$this->last_item_seen]->is_done() |
1810 | 1810 | ) { |
1811 | 1811 | if ($this->debug > 2) { |
1812 | - error_log('New LP - In learnpath::first() - Last item seen is ' . $this->last_item_seen.' of type '.$this->items[$this->last_item_seen]->get_type(), 0); |
|
1812 | + error_log('New LP - In learnpath::first() - Last item seen is '.$this->last_item_seen.' of type '.$this->items[$this->last_item_seen]->get_type(), 0); |
|
1813 | 1813 | } |
1814 | 1814 | $index = -1; |
1815 | 1815 | foreach ($this->ordered_items as $myindex => $item_id) { |
@@ -1821,7 +1821,7 @@ discard block |
||
1821 | 1821 | if ($index == -1) { |
1822 | 1822 | // Index hasn't changed, so item not found - panic (this shouldn't happen). |
1823 | 1823 | if ($this->debug > 2) { |
1824 | - error_log('New LP - Last item (' . $this->last_item_seen . ') was found in items but not in ordered_items, panic!', 0); |
|
1824 | + error_log('New LP - Last item ('.$this->last_item_seen.') was found in items but not in ordered_items, panic!', 0); |
|
1825 | 1825 | } |
1826 | 1826 | return false; |
1827 | 1827 | } else { |
@@ -1836,7 +1836,7 @@ discard block |
||
1836 | 1836 | $index = 0; |
1837 | 1837 | // Loop through all ordered items and stop at the first item that is |
1838 | 1838 | // not a directory *and* that has not been completed yet. |
1839 | - while ( !empty($this->ordered_items[$index]) AND |
|
1839 | + while (!empty($this->ordered_items[$index]) AND |
|
1840 | 1840 | is_a($this->items[$this->ordered_items[$index]], 'learnpathItem') AND |
1841 | 1841 | ( |
1842 | 1842 | $this->items[$this->ordered_items[$index]]->get_type() == 'dir' OR |
@@ -1849,14 +1849,14 @@ discard block |
||
1849 | 1849 | $this->current = isset($this->ordered_items[$index]) ? $this->ordered_items[$index] : null; |
1850 | 1850 | $this->index = $index; |
1851 | 1851 | if ($this->debug > 2) { |
1852 | - error_log('$index ' . $index); |
|
1852 | + error_log('$index '.$index); |
|
1853 | 1853 | } |
1854 | 1854 | if ($this->debug > 2) { |
1855 | - error_log('New LP - In learnpath::first() - No last item seen. New last = ' . $this->last . '(' . $this->ordered_items[$index] . ')', 0); |
|
1855 | + error_log('New LP - In learnpath::first() - No last item seen. New last = '.$this->last.'('.$this->ordered_items[$index].')', 0); |
|
1856 | 1856 | } |
1857 | 1857 | } |
1858 | 1858 | if ($this->debug > 2) { |
1859 | - error_log('New LP - In learnpath::first() - First item is ' . $this->get_current_item_id()); |
|
1859 | + error_log('New LP - In learnpath::first() - First item is '.$this->get_current_item_id()); |
|
1860 | 1860 | } |
1861 | 1861 | } |
1862 | 1862 | |
@@ -1869,7 +1869,7 @@ discard block |
||
1869 | 1869 | public function get_js_info($item_id = 0) |
1870 | 1870 | { |
1871 | 1871 | if ($this->debug > 0) { |
1872 | - error_log('New LP - In learnpath::get_js_info(' . $item_id . ')', 0); |
|
1872 | + error_log('New LP - In learnpath::get_js_info('.$item_id.')', 0); |
|
1873 | 1873 | } |
1874 | 1874 | |
1875 | 1875 | $info = ''; |
@@ -1879,34 +1879,34 @@ discard block |
||
1879 | 1879 | //if item is defined, return values from DB |
1880 | 1880 | $oItem = $this->items[$item_id]; |
1881 | 1881 | $info .= '<script language="javascript">'; |
1882 | - $info .= "top.set_score(" . $oItem->get_score() . ");\n"; |
|
1883 | - $info .= "top.set_max(" . $oItem->get_max() . ");\n"; |
|
1884 | - $info .= "top.set_min(" . $oItem->get_min() . ");\n"; |
|
1885 | - $info .= "top.set_lesson_status('" . $oItem->get_status() . "');"; |
|
1886 | - $info .= "top.set_session_time('" . $oItem->get_scorm_time('js') . "');"; |
|
1887 | - $info .= "top.set_suspend_data('" . $oItem->get_suspend_data() . "');"; |
|
1888 | - $info .= "top.set_saved_lesson_status('" . $oItem->get_status() . "');"; |
|
1882 | + $info .= "top.set_score(".$oItem->get_score().");\n"; |
|
1883 | + $info .= "top.set_max(".$oItem->get_max().");\n"; |
|
1884 | + $info .= "top.set_min(".$oItem->get_min().");\n"; |
|
1885 | + $info .= "top.set_lesson_status('".$oItem->get_status()."');"; |
|
1886 | + $info .= "top.set_session_time('".$oItem->get_scorm_time('js')."');"; |
|
1887 | + $info .= "top.set_suspend_data('".$oItem->get_suspend_data()."');"; |
|
1888 | + $info .= "top.set_saved_lesson_status('".$oItem->get_status()."');"; |
|
1889 | 1889 | $info .= "top.set_flag_synchronized();"; |
1890 | 1890 | $info .= '</script>'; |
1891 | 1891 | if ($this->debug > 2) { |
1892 | - error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0); |
|
1892 | + error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0); |
|
1893 | 1893 | } |
1894 | 1894 | return $info; |
1895 | 1895 | |
1896 | 1896 | } else { |
1897 | 1897 | // If item_id is empty, just update to default SCORM data. |
1898 | 1898 | $info .= '<script language="javascript">'; |
1899 | - $info .= "top.set_score(" . learnpathItem :: get_score() . ");\n"; |
|
1900 | - $info .= "top.set_max(" . learnpathItem :: get_max() . ");\n"; |
|
1901 | - $info .= "top.set_min(" . learnpathItem :: get_min() . ");\n"; |
|
1902 | - $info .= "top.set_lesson_status('" . learnpathItem :: get_status() . "');"; |
|
1903 | - $info .= "top.set_session_time('" . learnpathItem :: getScormTimeFromParameter('js') . "');"; |
|
1904 | - $info .= "top.set_suspend_data('" . learnpathItem :: get_suspend_data() . "');"; |
|
1905 | - $info .= "top.set_saved_lesson_status('" . learnpathItem :: get_status() . "');"; |
|
1899 | + $info .= "top.set_score(".learnpathItem :: get_score().");\n"; |
|
1900 | + $info .= "top.set_max(".learnpathItem :: get_max().");\n"; |
|
1901 | + $info .= "top.set_min(".learnpathItem :: get_min().");\n"; |
|
1902 | + $info .= "top.set_lesson_status('".learnpathItem :: get_status()."');"; |
|
1903 | + $info .= "top.set_session_time('".learnpathItem :: getScormTimeFromParameter('js')."');"; |
|
1904 | + $info .= "top.set_suspend_data('".learnpathItem :: get_suspend_data()."');"; |
|
1905 | + $info .= "top.set_saved_lesson_status('".learnpathItem :: get_status()."');"; |
|
1906 | 1906 | $info .= "top.set_flag_synchronized();"; |
1907 | 1907 | $info .= '</script>'; |
1908 | 1908 | if ($this->debug > 2) { |
1909 | - error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0); |
|
1909 | + error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0); |
|
1910 | 1910 | } |
1911 | 1911 | return $info; |
1912 | 1912 | } |
@@ -1964,8 +1964,8 @@ discard block |
||
1964 | 1964 | if ($this->debug > 0) { |
1965 | 1965 | error_log('New LP - In learnpath::get_navigation_bar()', 0); |
1966 | 1966 | } |
1967 | - if(empty($idBar)){ |
|
1968 | - $idBar='control-top'; |
|
1967 | + if (empty($idBar)) { |
|
1968 | + $idBar = 'control-top'; |
|
1969 | 1969 | } |
1970 | 1970 | /* if(empty($display)){ |
1971 | 1971 | $display='display:block'; |
@@ -1978,16 +1978,16 @@ discard block |
||
1978 | 1978 | $navbar = ' |
1979 | 1979 | <span id="'.$idBar.'" class="buttons"> |
1980 | 1980 | <a class="icon-toolbar" href="lp_controller.php?action=stats&'.api_get_cidreq(true).'&lp_id='.$lp_id.'" onclick="window.parent.API.save_asset();return true;" target="content_name" title="stats" id="stats_link"> |
1981 | - <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span> |
|
1981 | + <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span> |
|
1982 | 1982 | </a> |
1983 | - <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous"> |
|
1984 | - <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span> |
|
1983 | + <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous"> |
|
1984 | + <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span> |
|
1985 | 1985 | </a> |
1986 | - <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next"> |
|
1987 | - <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span> |
|
1986 | + <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next"> |
|
1987 | + <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span> |
|
1988 | 1988 | </a> |
1989 | 1989 | <a class="icon-toolbar" id="view-embedded" href="lp_controller.php?action=mode&mode=embedded" target="_top" title="embedded mode"> |
1990 | - <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen') . '</span> |
|
1990 | + <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen').'</span> |
|
1991 | 1991 | </a> |
1992 | 1992 | </span>'; |
1993 | 1993 | |
@@ -1995,13 +1995,13 @@ discard block |
||
1995 | 1995 | $navbar = ' |
1996 | 1996 | <span id="'.$idBar.'" class="buttons text-right"> |
1997 | 1997 | <a class="icon-toolbar" href="lp_controller.php?action=stats&'.api_get_cidreq(true).'&lp_id='.$lp_id.'" onclick="window.parent.API.save_asset();return true;" target="content_name" title="stats" id="stats_link"> |
1998 | - <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span> |
|
1998 | + <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span> |
|
1999 | 1999 | </a> |
2000 | - <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous"> |
|
2001 | - <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span> |
|
2000 | + <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous"> |
|
2001 | + <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span> |
|
2002 | 2002 | </a> |
2003 | - <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next"> |
|
2004 | - <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span> |
|
2003 | + <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next"> |
|
2004 | + <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span> |
|
2005 | 2005 | </a> |
2006 | 2006 | </span>'; |
2007 | 2007 | } |
@@ -2022,11 +2022,11 @@ discard block |
||
2022 | 2022 | $index = $this->index; |
2023 | 2023 | $index++; |
2024 | 2024 | if ($this->debug > 2) { |
2025 | - error_log('New LP - Now looking at ordered_items[' . ($index) . '] - type is ' . $this->items[$this->ordered_items[$index]]->type, 0); |
|
2025 | + error_log('New LP - Now looking at ordered_items['.($index).'] - type is '.$this->items[$this->ordered_items[$index]]->type, 0); |
|
2026 | 2026 | } |
2027 | 2027 | while (!empty ($this->ordered_items[$index]) AND ($this->items[$this->ordered_items[$index]]->get_type() == 'dir') AND $index < $this->max_ordered_items) { |
2028 | 2028 | $index++; |
2029 | - if ($index == $this->max_ordered_items){ |
|
2029 | + if ($index == $this->max_ordered_items) { |
|
2030 | 2030 | if ($this->items[$this->ordered_items[$index]]->get_type() == 'dir') { |
2031 | 2031 | return $this->index; |
2032 | 2032 | } else { |
@@ -2038,7 +2038,7 @@ discard block |
||
2038 | 2038 | return $this->index; |
2039 | 2039 | } |
2040 | 2040 | if ($this->debug > 2) { |
2041 | - error_log('New LP - index is now ' . $index, 0); |
|
2041 | + error_log('New LP - index is now '.$index, 0); |
|
2042 | 2042 | } |
2043 | 2043 | return $index; |
2044 | 2044 | } |
@@ -2056,7 +2056,7 @@ discard block |
||
2056 | 2056 | if (!empty ($new_index)) { |
2057 | 2057 | if (isset ($this->ordered_items[$new_index])) { |
2058 | 2058 | if ($this->debug > 2) { |
2059 | - error_log('New LP - In learnpath::get_next_index() - Returning ' . $this->ordered_items[$new_index], 0); |
|
2059 | + error_log('New LP - In learnpath::get_next_index() - Returning '.$this->ordered_items[$new_index], 0); |
|
2060 | 2060 | } |
2061 | 2061 | return $this->ordered_items[$new_index]; |
2062 | 2062 | } |
@@ -2119,7 +2119,7 @@ discard block |
||
2119 | 2119 | break; // Exit the foreach loop. |
2120 | 2120 | } elseif ( |
2121 | 2121 | preg_match('/aicc\//i', $thisContent['filename']) || |
2122 | - in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array( 'crs','au','des','cst')) |
|
2122 | + in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array('crs', 'au', 'des', 'cst')) |
|
2123 | 2123 | ) { |
2124 | 2124 | $ext = strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)); |
2125 | 2125 | switch ($ext) { |
@@ -2161,7 +2161,7 @@ discard block |
||
2161 | 2161 | error_log('New LP - In learnpath::get_previous_index()', 0); |
2162 | 2162 | } |
2163 | 2163 | $index = $this->index; |
2164 | - if (isset ($this->ordered_items[$index -1])) { |
|
2164 | + if (isset ($this->ordered_items[$index - 1])) { |
|
2165 | 2165 | $index--; |
2166 | 2166 | while (isset($this->ordered_items[$index]) && ($this->items[$this->ordered_items[$index]]->get_type() == 'dir')) { |
2167 | 2167 | $index--; |
@@ -2171,7 +2171,7 @@ discard block |
||
2171 | 2171 | } |
2172 | 2172 | } else { |
2173 | 2173 | if ($this->debug > 2) { |
2174 | - error_log('New LP - get_previous_index() - there was no previous index available, reusing ' . $index, 0); |
|
2174 | + error_log('New LP - get_previous_index() - there was no previous index available, reusing '.$index, 0); |
|
2175 | 2175 | } |
2176 | 2176 | // There is no previous item. |
2177 | 2177 | } |
@@ -2214,8 +2214,8 @@ discard block |
||
2214 | 2214 | { |
2215 | 2215 | $course_id = api_get_course_int_id(); |
2216 | 2216 | $_course = api_get_course_info(); |
2217 | - $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
|
2218 | - $tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW); |
|
2217 | + $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
|
2218 | + $tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW); |
|
2219 | 2219 | |
2220 | 2220 | // Getting all the information about the item. |
2221 | 2221 | $sql = "SELECT * FROM $tbl_lp_item as lp |
@@ -2226,15 +2226,15 @@ discard block |
||
2226 | 2226 | lp.c_id = $course_id AND |
2227 | 2227 | lp_view.c_id = $course_id"; |
2228 | 2228 | $result = Database::query($sql); |
2229 | - $row = Database::fetch_assoc($result); |
|
2229 | + $row = Database::fetch_assoc($result); |
|
2230 | 2230 | $output = ''; |
2231 | 2231 | |
2232 | 2232 | if (!empty ($row['audio'])) { |
2233 | 2233 | $list = $_SESSION['oLP']->get_toc(); |
2234 | 2234 | $type_quiz = false; |
2235 | 2235 | |
2236 | - foreach($list as $toc) { |
|
2237 | - if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type']=='quiz') ) { |
|
2236 | + foreach ($list as $toc) { |
|
2237 | + if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type'] == 'quiz')) { |
|
2238 | 2238 | $type_quiz = true; |
2239 | 2239 | } |
2240 | 2240 | } |
@@ -2296,7 +2296,7 @@ discard block |
||
2296 | 2296 | $courseCode = null, |
2297 | 2297 | $sessionId = null |
2298 | 2298 | ) { |
2299 | - $lp_id = (int)$lp_id; |
|
2299 | + $lp_id = (int) $lp_id; |
|
2300 | 2300 | $courseInfo = api_get_course_info($courseCode); |
2301 | 2301 | $sessionId = intval($sessionId); |
2302 | 2302 | |
@@ -2460,10 +2460,10 @@ discard block |
||
2460 | 2460 | */ |
2461 | 2461 | public static function get_progress_bar($percentage = -1, $text_add = '') |
2462 | 2462 | { |
2463 | - $text = $percentage . $text_add; |
|
2463 | + $text = $percentage.$text_add; |
|
2464 | 2464 | $output = '<div class="progress"> |
2465 | - <div id="progress_bar_value" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="' .$percentage. '" aria-valuemin="0" aria-valuemax="100" style="width: '.$text.';"> |
|
2466 | - '. $text .' |
|
2465 | + <div id="progress_bar_value" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="' .$percentage.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$text.';"> |
|
2466 | + '. $text.' |
|
2467 | 2467 | </div> |
2468 | 2468 | </div>'; |
2469 | 2469 | |
@@ -2499,16 +2499,16 @@ discard block |
||
2499 | 2499 | } |
2500 | 2500 | $total_items = $this->getTotalItemsCountWithoutDirs(); |
2501 | 2501 | if ($this->debug > 2) { |
2502 | - error_log('New LP - Total items available in this learnpath: ' . $total_items, 0); |
|
2502 | + error_log('New LP - Total items available in this learnpath: '.$total_items, 0); |
|
2503 | 2503 | } |
2504 | 2504 | $completeItems = $this->get_complete_items_count(); |
2505 | 2505 | if ($this->debug > 2) { |
2506 | - error_log('New LP - Items completed so far: ' . $completeItems, 0); |
|
2506 | + error_log('New LP - Items completed so far: '.$completeItems, 0); |
|
2507 | 2507 | } |
2508 | 2508 | if ($add != 0) { |
2509 | 2509 | $completeItems += $add; |
2510 | 2510 | if ($this->debug > 2) { |
2511 | - error_log('New LP - Items completed so far (+modifier): ' . $completeItems, 0); |
|
2511 | + error_log('New LP - Items completed so far (+modifier): '.$completeItems, 0); |
|
2512 | 2512 | } |
2513 | 2513 | } |
2514 | 2514 | $text = ''; |
@@ -2526,7 +2526,7 @@ discard block |
||
2526 | 2526 | $text = '%'; |
2527 | 2527 | } elseif ($mode == 'abs') { |
2528 | 2528 | $percentage = $completeItems; |
2529 | - $text = '/' . $total_items; |
|
2529 | + $text = '/'.$total_items; |
|
2530 | 2530 | } |
2531 | 2531 | |
2532 | 2532 | return array( |
@@ -2722,7 +2722,7 @@ discard block |
||
2722 | 2722 | // and replace them, one by one, by the internal IDs (chamilo db) |
2723 | 2723 | // TODO: Modify the '*' replacement to replace the multiplier in front of it |
2724 | 2724 | // by a space as well. |
2725 | - $find = array ( |
|
2725 | + $find = array( |
|
2726 | 2726 | '&', |
2727 | 2727 | '|', |
2728 | 2728 | '~', |
@@ -2734,7 +2734,7 @@ discard block |
||
2734 | 2734 | '(', |
2735 | 2735 | ')' |
2736 | 2736 | ); |
2737 | - $replace = array ( |
|
2737 | + $replace = array( |
|
2738 | 2738 | ' ', |
2739 | 2739 | ' ', |
2740 | 2740 | ' ', |
@@ -2751,7 +2751,7 @@ discard block |
||
2751 | 2751 | foreach ($ids as $id) { |
2752 | 2752 | $id = trim($id); |
2753 | 2753 | if (isset ($this->refs_list[$id])) { |
2754 | - $prereq = preg_replace('/[^a-zA-Z_0-9](' . $id . ')[^a-zA-Z_0-9]/', 'ITEM_' . $this->refs_list[$id], $prereq); |
|
2754 | + $prereq = preg_replace('/[^a-zA-Z_0-9]('.$id.')[^a-zA-Z_0-9]/', 'ITEM_'.$this->refs_list[$id], $prereq); |
|
2755 | 2755 | } |
2756 | 2756 | } |
2757 | 2757 | |
@@ -2797,9 +2797,9 @@ discard block |
||
2797 | 2797 | if ($this->debug > 0) { |
2798 | 2798 | error_log('New LP - In learnpath::get_items_status_list()', 0); |
2799 | 2799 | } |
2800 | - $list = array (); |
|
2800 | + $list = array(); |
|
2801 | 2801 | foreach ($this->ordered_items as $item_id) { |
2802 | - $list[] = array ( |
|
2802 | + $list[] = array( |
|
2803 | 2803 | $item_id => $this->items[$item_id]->get_status() |
2804 | 2804 | ); |
2805 | 2805 | } |
@@ -2853,7 +2853,7 @@ discard block |
||
2853 | 2853 | $res = Database::query($sql); |
2854 | 2854 | $num = Database :: num_rows($res); |
2855 | 2855 | if ($num > 0) { |
2856 | - $list[] = array ( |
|
2856 | + $list[] = array( |
|
2857 | 2857 | 'order_id' => api_htmlentities(get_lang('Order'), ENT_QUOTES), |
2858 | 2858 | 'id' => api_htmlentities(get_lang('InteractionID'), ENT_QUOTES), |
2859 | 2859 | 'type' => api_htmlentities(get_lang('Type'), ENT_QUOTES), |
@@ -2864,7 +2864,7 @@ discard block |
||
2864 | 2864 | 'latency' => api_htmlentities(get_lang('LatencyTimeSpent'), ENT_QUOTES) |
2865 | 2865 | ); |
2866 | 2866 | while ($row = Database :: fetch_array($res)) { |
2867 | - $list[] = array ( |
|
2867 | + $list[] = array( |
|
2868 | 2868 | 'order_id' => ($row['order_id'] + 1), |
2869 | 2869 | 'id' => urldecode($row['interaction_id']), //urldecode because they often have %2F or stuff like that |
2870 | 2870 | 'type' => $row['interaction_type'], |
@@ -2932,7 +2932,7 @@ discard block |
||
2932 | 2932 | 'status' => api_htmlentities(get_lang('ObjectiveStatus'), ENT_QUOTES) |
2933 | 2933 | ); |
2934 | 2934 | while ($row = Database :: fetch_array($res)) { |
2935 | - $list[] = array ( |
|
2935 | + $list[] = array( |
|
2936 | 2936 | 'order_id' => ($row['order_id'] + 1), |
2937 | 2937 | 'objective_id' => urldecode($row['objective_id']), // urldecode() because they often have %2F or stuff like that. |
2938 | 2938 | 'score_raw' => $row['score_raw'], |
@@ -2959,7 +2959,7 @@ discard block |
||
2959 | 2959 | $toc = array(); |
2960 | 2960 | foreach ($this->ordered_items as $item_id) { |
2961 | 2961 | if ($this->debug > 2) { |
2962 | - error_log('learnpath::get_toc(): getting info for item ' . $item_id, 0); |
|
2962 | + error_log('learnpath::get_toc(): getting info for item '.$item_id, 0); |
|
2963 | 2963 | } |
2964 | 2964 | // TODO: Change this link generation and use new function instead. |
2965 | 2965 | $toc[] = array( |
@@ -2973,7 +2973,7 @@ discard block |
||
2973 | 2973 | ); |
2974 | 2974 | } |
2975 | 2975 | if ($this->debug > 2) { |
2976 | - error_log('New LP - In learnpath::get_toc() - TOC array: ' . print_r($toc, true), 0); |
|
2976 | + error_log('New LP - In learnpath::get_toc() - TOC array: '.print_r($toc, true), 0); |
|
2977 | 2977 | } |
2978 | 2978 | return $toc; |
2979 | 2979 | } |
@@ -2990,10 +2990,10 @@ discard block |
||
2990 | 2990 | } |
2991 | 2991 | $toc = $varname.' = new Array();'; |
2992 | 2992 | foreach ($this->ordered_items as $item_id) { |
2993 | - $toc.= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';"; |
|
2993 | + $toc .= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';"; |
|
2994 | 2994 | } |
2995 | 2995 | if ($this->debug > 2) { |
2996 | - error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: ' . print_r($toc, true), 0); |
|
2996 | + error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: '.print_r($toc, true), 0); |
|
2997 | 2997 | } |
2998 | 2998 | return $toc; |
2999 | 2999 | } |
@@ -3017,7 +3017,7 @@ discard block |
||
3017 | 3017 | } |
3018 | 3018 | } |
3019 | 3019 | if ($this->debug > 2) { |
3020 | - error_log('New LP - In learnpath::get_type() - Returning ' . ($res ? $res : 'false'), 0); |
|
3020 | + error_log('New LP - In learnpath::get_type() - Returning '.($res ? $res : 'false'), 0); |
|
3021 | 3021 | } |
3022 | 3022 | return $res; |
3023 | 3023 | } |
@@ -3033,7 +3033,7 @@ discard block |
||
3033 | 3033 | $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN); |
3034 | 3034 | $lp_id = intval($lp_id); |
3035 | 3035 | $sql = "SELECT lp_type FROM $tbl_lp |
3036 | - WHERE c_id = $course_id AND id = '" . $lp_id . "'"; |
|
3036 | + WHERE c_id = $course_id AND id = '".$lp_id."'"; |
|
3037 | 3037 | $res = Database::query($sql); |
3038 | 3038 | if ($res === false) { |
3039 | 3039 | return null; |
@@ -3130,7 +3130,7 @@ discard block |
||
3130 | 3130 | $dirTypes = self::getChapterTypes(); |
3131 | 3131 | |
3132 | 3132 | if (in_array($item['type'], $dirTypes)) { |
3133 | - $rowColor ='scorm_item_section '; |
|
3133 | + $rowColor = 'scorm_item_section '; |
|
3134 | 3134 | } |
3135 | 3135 | if ($item['id'] == $this->current) { |
3136 | 3136 | $rowColor = 'scorm_item_normal '.$rowColor.' scorm_highlight'; |
@@ -3138,7 +3138,7 @@ discard block |
||
3138 | 3138 | $rowColor = 'scorm_item_normal '.$rowColor.' '; |
3139 | 3139 | } |
3140 | 3140 | |
3141 | - $html .= '<div id="toc_' . $item['id'] . '" class="' . $rowColor . ' ' . $class_name[$item['status']] . '">'; |
|
3141 | + $html .= '<div id="toc_'.$item['id'].'" class="'.$rowColor.' '.$class_name[$item['status']].'">'; |
|
3142 | 3142 | |
3143 | 3143 | // Learning path title |
3144 | 3144 | $title = $item['title']; |
@@ -3168,7 +3168,7 @@ discard block |
||
3168 | 3168 | $html .= stripslashes($title); |
3169 | 3169 | } else { |
3170 | 3170 | $this->get_link('http', $item['id'], $toc_list); |
3171 | - $html .= '<a class="items-list" href="#" onclick="switch_item(' .$mycurrentitemid . ',' .$item['id'] . ');' .'return false;" >' . stripslashes($title) . '</a>'; |
|
3171 | + $html .= '<a class="items-list" href="#" onclick="switch_item('.$mycurrentitemid.','.$item['id'].');'.'return false;" >'.stripslashes($title).'</a>'; |
|
3172 | 3172 | } |
3173 | 3173 | $html .= "</div>"; |
3174 | 3174 | |
@@ -3202,12 +3202,12 @@ discard block |
||
3202 | 3202 | if ($this->get_lp_session_id() == api_get_session_id()) { |
3203 | 3203 | $html .= '<div id="actions_lp" class="actions_lp"><hr>'; |
3204 | 3204 | $html .= '<div class="btn-group">'; |
3205 | - $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq()."&gradebook=$gradebook&action=build&lp_id=" . $this->lp_id . "&isStudentView=false' target='_parent'>" . |
|
3206 | - Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . "</a>"; |
|
3207 | - $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq()."&action=add_item&type=step&lp_id=" . $this->lp_id . "&isStudentView=false' target='_parent'>" . |
|
3208 | - Display::returnFontAwesomeIcon('pencil') . get_lang('Edit') . "</a>"; |
|
3209 | - $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?'.api_get_cidreq()."&gradebook=$gradebook&action=edit&lp_id=" . $this->lp_id.'&isStudentView=false">' . |
|
3210 | - Display::returnFontAwesomeIcon('cog') . get_lang('Settings').'</a>'; |
|
3205 | + $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?".api_get_cidreq()."&gradebook=$gradebook&action=build&lp_id=".$this->lp_id."&isStudentView=false' target='_parent'>". |
|
3206 | + Display::returnFontAwesomeIcon('street-view').get_lang('Overview')."</a>"; |
|
3207 | + $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?".api_get_cidreq()."&action=add_item&type=step&lp_id=".$this->lp_id."&isStudentView=false' target='_parent'>". |
|
3208 | + Display::returnFontAwesomeIcon('pencil').get_lang('Edit')."</a>"; |
|
3209 | + $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?'.api_get_cidreq()."&gradebook=$gradebook&action=edit&lp_id=".$this->lp_id.'&isStudentView=false">'. |
|
3210 | + Display::returnFontAwesomeIcon('cog').get_lang('Settings').'</a>'; |
|
3211 | 3211 | $html .= '</div>'; |
3212 | 3212 | $html .= '</div>'; |
3213 | 3213 | } |
@@ -3259,11 +3259,11 @@ discard block |
||
3259 | 3259 | $course_id = $this->get_course_int_id(); |
3260 | 3260 | |
3261 | 3261 | if ($this->debug > 0) { |
3262 | - error_log('New LP - In learnpath::get_link(' . $type . ',' . $item_id . ')', 0); |
|
3262 | + error_log('New LP - In learnpath::get_link('.$type.','.$item_id.')', 0); |
|
3263 | 3263 | } |
3264 | 3264 | if (empty($item_id)) { |
3265 | 3265 | if ($this->debug > 2) { |
3266 | - error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: ' . $this->get_current_item_id(), 0); |
|
3266 | + error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: '.$this->get_current_item_id(), 0); |
|
3267 | 3267 | } |
3268 | 3268 | $item_id = $this->get_current_item_id(); |
3269 | 3269 | } |
@@ -3295,7 +3295,7 @@ discard block |
||
3295 | 3295 | ON (li.lp_id = l.id AND l.c_id = $course_id AND li.c_id = $course_id ) |
3296 | 3296 | WHERE li.id = $item_id "; |
3297 | 3297 | if ($this->debug > 2) { |
3298 | - error_log('New LP - In learnpath::get_link() - selecting item ' . $sql, 0); |
|
3298 | + error_log('New LP - In learnpath::get_link() - selecting item '.$sql, 0); |
|
3299 | 3299 | } |
3300 | 3300 | $res = Database::query($sql); |
3301 | 3301 | if (Database :: num_rows($res) > 0) { |
@@ -3309,9 +3309,9 @@ discard block |
||
3309 | 3309 | if (empty($lp_item_params) && strpos($lp_item_path, '?') !== false) { |
3310 | 3310 | list($lp_item_path, $lp_item_params) = explode('?', $lp_item_path); |
3311 | 3311 | } |
3312 | - $sys_course_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path(); |
|
3312 | + $sys_course_path = api_get_path(SYS_COURSE_PATH).api_get_course_path(); |
|
3313 | 3313 | if ($type == 'http') { |
3314 | - $course_path = api_get_path(WEB_COURSE_PATH) . api_get_course_path(); //web path |
|
3314 | + $course_path = api_get_path(WEB_COURSE_PATH).api_get_course_path(); //web path |
|
3315 | 3315 | } else { |
3316 | 3316 | $course_path = $sys_course_path; //system path |
3317 | 3317 | } |
@@ -3322,8 +3322,8 @@ discard block |
||
3322 | 3322 | } |
3323 | 3323 | |
3324 | 3324 | if ($this->debug > 2) { |
3325 | - error_log('New LP - In learnpath::get_link() - $lp_type ' . $lp_type, 0); |
|
3326 | - error_log('New LP - In learnpath::get_link() - $lp_item_type ' . $lp_item_type, 0); |
|
3325 | + error_log('New LP - In learnpath::get_link() - $lp_type '.$lp_type, 0); |
|
3326 | + error_log('New LP - In learnpath::get_link() - $lp_item_type '.$lp_item_type, 0); |
|
3327 | 3327 | } |
3328 | 3328 | |
3329 | 3329 | // Now go through the specific cases to get the end of the path |
@@ -3337,7 +3337,7 @@ discard block |
||
3337 | 3337 | $this->get_view_id() |
3338 | 3338 | ); |
3339 | 3339 | if ($this->debug > 0) { |
3340 | - error_log('rl_get_resource_link_for_learnpath - file: ' . $file, 0); |
|
3340 | + error_log('rl_get_resource_link_for_learnpath - file: '.$file, 0); |
|
3341 | 3341 | } |
3342 | 3342 | |
3343 | 3343 | switch ($lp_item_type) { |
@@ -3347,10 +3347,10 @@ discard block |
||
3347 | 3347 | case 'link': |
3348 | 3348 | if (Link::is_youtube_link($file)) { |
3349 | 3349 | $src = Link::get_youtube_video_id($file); |
3350 | - $file = api_get_path(WEB_CODE_PATH) . 'lp/embed.php?type=youtube&source='.$src; |
|
3350 | + $file = api_get_path(WEB_CODE_PATH).'lp/embed.php?type=youtube&source='.$src; |
|
3351 | 3351 | } elseif (Link::isVimeoLink($file)) { |
3352 | 3352 | $src = Link::getVimeoLinkId($file); |
3353 | - $file = api_get_path(WEB_CODE_PATH) . 'lp/embed.php?type=vimeo&source='.$src; |
|
3353 | + $file = api_get_path(WEB_CODE_PATH).'lp/embed.php?type=vimeo&source='.$src; |
|
3354 | 3354 | } else { |
3355 | 3355 | // If the current site is HTTPS and the link is |
3356 | 3356 | // HTTP, browsers will refuse opening the link |
@@ -3363,7 +3363,7 @@ discard block |
||
3363 | 3363 | //this is the special intervention case |
3364 | 3364 | $file = api_get_path( |
3365 | 3365 | WEB_CODE_PATH |
3366 | - ) . 'lp/embed.php?type=nonhttps&source='.urlencode($file); |
|
3366 | + ).'lp/embed.php?type=nonhttps&source='.urlencode($file); |
|
3367 | 3367 | } |
3368 | 3368 | } |
3369 | 3369 | } |
@@ -3409,7 +3409,7 @@ discard block |
||
3409 | 3409 | status='completed'"; |
3410 | 3410 | $result = Database::query($sql); |
3411 | 3411 | $row_count = Database:: fetch_row($result); |
3412 | - $count_item_view = (int)$row_count[0]; |
|
3412 | + $count_item_view = (int) $row_count[0]; |
|
3413 | 3413 | $not_multiple_attempt = 0; |
3414 | 3414 | if ($prevent_reinit === 1 && $count_item_view > 0) { |
3415 | 3415 | $not_multiple_attempt = 1; |
@@ -3428,7 +3428,7 @@ discard block |
||
3428 | 3428 | break; |
3429 | 3429 | case 2 : |
3430 | 3430 | if ($this->debug > 2) { |
3431 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0); |
|
3431 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0); |
|
3432 | 3432 | } |
3433 | 3433 | |
3434 | 3434 | if ($lp_item_type != 'dir') { |
@@ -3442,19 +3442,19 @@ discard block |
||
3442 | 3442 | //if ($this->prerequisites_match($item_id)) { |
3443 | 3443 | if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) { |
3444 | 3444 | if ($this->debug > 2) { |
3445 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0); |
|
3445 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0); |
|
3446 | 3446 | } |
3447 | 3447 | // Distant url, return as is. |
3448 | 3448 | $file = $lp_item_path; |
3449 | 3449 | } else { |
3450 | 3450 | if ($this->debug > 2) { |
3451 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0); |
|
3451 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0); |
|
3452 | 3452 | } |
3453 | 3453 | // Prevent getting untranslatable urls. |
3454 | 3454 | $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path); |
3455 | 3455 | $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path); |
3456 | 3456 | // Prepare the path. |
3457 | - $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path; |
|
3457 | + $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path; |
|
3458 | 3458 | // TODO: Fix this for urls with protocol header. |
3459 | 3459 | $file = str_replace('//', '/', $file); |
3460 | 3460 | $file = str_replace(':/', '://', $file); |
@@ -3462,11 +3462,11 @@ discard block |
||
3462 | 3462 | $lp_path = substr($lp_path, 0, -1); |
3463 | 3463 | } |
3464 | 3464 | |
3465 | - if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $lp_item_path))) { |
|
3465 | + if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$lp_item_path))) { |
|
3466 | 3466 | // if file not found. |
3467 | 3467 | $decoded = html_entity_decode($lp_item_path); |
3468 | 3468 | list ($decoded) = explode('?', $decoded); |
3469 | - if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $decoded))) { |
|
3469 | + if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$decoded))) { |
|
3470 | 3470 | |
3471 | 3471 | $file = self::rl_get_resource_link_for_learnpath( |
3472 | 3472 | $course_id, |
@@ -3486,14 +3486,14 @@ discard block |
||
3486 | 3486 | } |
3487 | 3487 | } |
3488 | 3488 | } else { |
3489 | - $file = $course_path . '/scorm/' . $lp_path . '/' . $decoded; |
|
3489 | + $file = $course_path.'/scorm/'.$lp_path.'/'.$decoded; |
|
3490 | 3490 | } |
3491 | 3491 | } |
3492 | 3492 | } |
3493 | 3493 | |
3494 | 3494 | // We want to use parameters if they were defined in the imsmanifest |
3495 | 3495 | if (strpos($file, 'blank.php') === false) { |
3496 | - $file .= (strstr($file, '?') === false ? '?' : '') . $lp_item_params; |
|
3496 | + $file .= (strstr($file, '?') === false ? '?' : '').$lp_item_params; |
|
3497 | 3497 | } |
3498 | 3498 | } else { |
3499 | 3499 | $file = 'lp_content.php?type=dir'; |
@@ -3501,12 +3501,12 @@ discard block |
||
3501 | 3501 | break; |
3502 | 3502 | case 3 : |
3503 | 3503 | if ($this->debug > 2) { |
3504 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0); |
|
3504 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0); |
|
3505 | 3505 | } |
3506 | 3506 | // Formatting AICC HACP append URL. |
3507 | - $aicc_append = '?aicc_sid=' . urlencode(session_id()) . '&aicc_url=' . urlencode(api_get_path(WEB_CODE_PATH) . 'lp/aicc_hacp.php') . '&'; |
|
3507 | + $aicc_append = '?aicc_sid='.urlencode(session_id()).'&aicc_url='.urlencode(api_get_path(WEB_CODE_PATH).'lp/aicc_hacp.php').'&'; |
|
3508 | 3508 | if (!empty($lp_item_params)) { |
3509 | - $aicc_append .= $lp_item_params . '&'; |
|
3509 | + $aicc_append .= $lp_item_params.'&'; |
|
3510 | 3510 | } |
3511 | 3511 | if ($lp_item_type != 'dir') { |
3512 | 3512 | // Quite complex here: |
@@ -3518,7 +3518,7 @@ discard block |
||
3518 | 3518 | |
3519 | 3519 | if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) { |
3520 | 3520 | if ($this->debug > 2) { |
3521 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0); |
|
3521 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0); |
|
3522 | 3522 | } |
3523 | 3523 | // Distant url, return as is. |
3524 | 3524 | $file = $lp_item_path; |
@@ -3531,19 +3531,19 @@ discard block |
||
3531 | 3531 | if (stripos($file, '<servername>') !== false) { |
3532 | 3532 | //$file = str_replace('<servername>',$course_path.'/scorm/'.$lp_path.'/',$lp_item_path); |
3533 | 3533 | $web_course_path = str_replace('https://', '', str_replace('http://', '', $course_path)); |
3534 | - $file = str_replace('<servername>', $web_course_path . '/scorm/' . $lp_path, $lp_item_path); |
|
3534 | + $file = str_replace('<servername>', $web_course_path.'/scorm/'.$lp_path, $lp_item_path); |
|
3535 | 3535 | } |
3536 | 3536 | // |
3537 | 3537 | $file .= $aicc_append; |
3538 | 3538 | } else { |
3539 | 3539 | if ($this->debug > 2) { |
3540 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0); |
|
3540 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0); |
|
3541 | 3541 | } |
3542 | 3542 | // Prevent getting untranslatable urls. |
3543 | 3543 | $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path); |
3544 | 3544 | $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path); |
3545 | 3545 | // Prepare the path - lp_path might be unusable because it includes the "aicc" subdir name. |
3546 | - $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path; |
|
3546 | + $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path; |
|
3547 | 3547 | // TODO: Fix this for urls with protocol header. |
3548 | 3548 | $file = str_replace('//', '/', $file); |
3549 | 3549 | $file = str_replace(':/', '://', $file); |
@@ -3562,7 +3562,7 @@ discard block |
||
3562 | 3562 | $file = !empty($file) ? str_replace('&', '&', $file) : ''; |
3563 | 3563 | } |
3564 | 3564 | if ($this->debug > 2) { |
3565 | - error_log('New LP - In learnpath::get_link() - returning "' . $file . '" from get_link', 0); |
|
3565 | + error_log('New LP - In learnpath::get_link() - returning "'.$file.'" from get_link', 0); |
|
3566 | 3566 | } |
3567 | 3567 | return $file; |
3568 | 3568 | } |
@@ -3580,7 +3580,7 @@ discard block |
||
3580 | 3580 | $search = ''; |
3581 | 3581 | // Use $attempt_num to enable multi-views management (disabled so far). |
3582 | 3582 | if ($attempt_num != 0 AND intval(strval($attempt_num)) == $attempt_num) { |
3583 | - $search = 'AND view_count = ' . $attempt_num; |
|
3583 | + $search = 'AND view_count = '.$attempt_num; |
|
3584 | 3584 | } |
3585 | 3585 | // When missing $attempt_num, search for a unique lp_view record for this lp and user. |
3586 | 3586 | $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW); |
@@ -3590,9 +3590,9 @@ discard block |
||
3590 | 3590 | |
3591 | 3591 | $sql = "SELECT id, view_count FROM $lp_view_table |
3592 | 3592 | WHERE |
3593 | - c_id = " . $course_id . " AND |
|
3594 | - lp_id = " . $this->get_id() . " AND |
|
3595 | - user_id = " . $this->get_user_id() . " AND |
|
3593 | + c_id = ".$course_id." AND |
|
3594 | + lp_id = " . $this->get_id()." AND |
|
3595 | + user_id = " . $this->get_user_id()." AND |
|
3596 | 3596 | session_id = $sessionId |
3597 | 3597 | $search |
3598 | 3598 | ORDER BY view_count DESC"; |
@@ -3603,7 +3603,7 @@ discard block |
||
3603 | 3603 | } else if (!api_is_invitee()) { |
3604 | 3604 | // There is no database record, create one. |
3605 | 3605 | $sql = "INSERT INTO $lp_view_table (c_id, lp_id,user_id, view_count, session_id) VALUES |
3606 | - ($course_id, " . $this->get_id() . "," . $this->get_user_id() . ", 1, $sessionId)"; |
|
3606 | + ($course_id, ".$this->get_id().",".$this->get_user_id().", 1, $sessionId)"; |
|
3607 | 3607 | Database::query($sql); |
3608 | 3608 | $id = Database :: insert_id(); |
3609 | 3609 | $this->lp_view_id = $id; |
@@ -3703,15 +3703,15 @@ discard block |
||
3703 | 3703 | { |
3704 | 3704 | $course_id = api_get_course_int_id(); |
3705 | 3705 | if ($this->debug > 0) { |
3706 | - error_log('New LP - In learnpath::move_item(' . $id . ',' . $direction . ')', 0); |
|
3706 | + error_log('New LP - In learnpath::move_item('.$id.','.$direction.')', 0); |
|
3707 | 3707 | } |
3708 | 3708 | if (empty($id) || empty($direction)) { |
3709 | 3709 | return false; |
3710 | 3710 | } |
3711 | 3711 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
3712 | 3712 | $sql_sel = "SELECT * |
3713 | - FROM " . $tbl_lp_item . " |
|
3714 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
3713 | + FROM " . $tbl_lp_item." |
|
3714 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
3715 | 3715 | $res_sel = Database::query($sql_sel); |
3716 | 3716 | // Check if elem exists. |
3717 | 3717 | if (Database :: num_rows($res_sel) < 1) { |
@@ -3736,7 +3736,7 @@ discard block |
||
3736 | 3736 | WHERE c_id = ".$course_id." AND id = $previous"; |
3737 | 3737 | |
3738 | 3738 | if ($this->debug > 2) { |
3739 | - error_log('Selecting previous: ' . $sql_sel2, 0); |
|
3739 | + error_log('Selecting previous: '.$sql_sel2, 0); |
|
3740 | 3740 | } |
3741 | 3741 | $res_sel2 = Database::query($sql_sel2); |
3742 | 3742 | if (Database :: num_rows($res_sel2) < 1) { |
@@ -3789,7 +3789,7 @@ discard block |
||
3789 | 3789 | } |
3790 | 3790 | Database::query($sql_upd2); |
3791 | 3791 | } |
3792 | - $display = $display -1; |
|
3792 | + $display = $display - 1; |
|
3793 | 3793 | } |
3794 | 3794 | break; |
3795 | 3795 | case 'down': |
@@ -3800,7 +3800,7 @@ discard block |
||
3800 | 3800 | } else { |
3801 | 3801 | $sql_sel2 = "SELECT * FROM $tbl_lp_item WHERE c_id = ".$course_id." AND id = $next"; |
3802 | 3802 | if ($this->debug > 2) { |
3803 | - error_log('Selecting next: ' . $sql_sel2, 0); |
|
3803 | + error_log('Selecting next: '.$sql_sel2, 0); |
|
3804 | 3804 | } |
3805 | 3805 | $res_sel2 = Database::query($sql_sel2); |
3806 | 3806 | if (Database :: num_rows($res_sel2) < 1) { |
@@ -3838,7 +3838,7 @@ discard block |
||
3838 | 3838 | WHERE c_id = ".$course_id." AND id = $next_next"; |
3839 | 3839 | Database::query($sql_upd2); |
3840 | 3840 | } |
3841 | - $display = $display +1; |
|
3841 | + $display = $display + 1; |
|
3842 | 3842 | } |
3843 | 3843 | break; |
3844 | 3844 | default : |
@@ -3861,8 +3861,8 @@ discard block |
||
3861 | 3861 | $res = Database::query($sql); |
3862 | 3862 | if ($res === false) |
3863 | 3863 | return false; |
3864 | - $lps = array (); |
|
3865 | - $lp_order = array (); |
|
3864 | + $lps = array(); |
|
3865 | + $lp_order = array(); |
|
3866 | 3866 | $num = Database :: num_rows($res); |
3867 | 3867 | // First check the order is correct, globally (might be wrong because |
3868 | 3868 | // of versions < 1.8.4) |
@@ -3872,7 +3872,7 @@ discard block |
||
3872 | 3872 | if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it. |
3873 | 3873 | $need_fix = true; |
3874 | 3874 | $sql_u = "UPDATE $lp_table SET display_order = $i |
3875 | - WHERE c_id = ".$course_id." AND id = " . $row['id']; |
|
3875 | + WHERE c_id = ".$course_id." AND id = ".$row['id']; |
|
3876 | 3876 | Database::query($sql_u); |
3877 | 3877 | } |
3878 | 3878 | $row['display_order'] = $i; |
@@ -3885,10 +3885,10 @@ discard block |
||
3885 | 3885 | $order = $lps[$lp_id]['display_order']; |
3886 | 3886 | if ($order > 1) { // If it's the first element, no need to move up. |
3887 | 3887 | $sql_u1 = "UPDATE $lp_table SET display_order = $order |
3888 | - WHERE c_id = ".$course_id." AND id = " . $lp_order[$order - 1]; |
|
3888 | + WHERE c_id = ".$course_id." AND id = ".$lp_order[$order - 1]; |
|
3889 | 3889 | Database::query($sql_u1); |
3890 | - $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order - 1) . " |
|
3891 | - WHERE c_id = ".$course_id." AND id = " . $lp_id; |
|
3890 | + $sql_u2 = "UPDATE $lp_table SET display_order = ".($order - 1)." |
|
3891 | + WHERE c_id = ".$course_id." AND id = ".$lp_id; |
|
3892 | 3892 | Database::query($sql_u2); |
3893 | 3893 | } |
3894 | 3894 | } |
@@ -3922,7 +3922,7 @@ discard block |
||
3922 | 3922 | if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it. |
3923 | 3923 | $need_fix = true; |
3924 | 3924 | $sql_u = "UPDATE $lp_table SET display_order = $i |
3925 | - WHERE c_id = ".$course_id." AND id = " . $row['id']; |
|
3925 | + WHERE c_id = ".$course_id." AND id = ".$row['id']; |
|
3926 | 3926 | Database::query($sql_u); |
3927 | 3927 | } |
3928 | 3928 | $row['display_order'] = $i; |
@@ -3935,10 +3935,10 @@ discard block |
||
3935 | 3935 | $order = $lps[$lp_id]['display_order']; |
3936 | 3936 | if ($order < $max) { // If it's the first element, no need to move up. |
3937 | 3937 | $sql_u1 = "UPDATE $lp_table SET display_order = $order |
3938 | - WHERE c_id = ".$course_id." AND id = " . $lp_order[$order + 1]; |
|
3938 | + WHERE c_id = ".$course_id." AND id = ".$lp_order[$order + 1]; |
|
3939 | 3939 | Database::query($sql_u1); |
3940 | - $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order + 1) . " |
|
3941 | - WHERE c_id = ".$course_id." AND id = " . $lp_id; |
|
3940 | + $sql_u2 = "UPDATE $lp_table SET display_order = ".($order + 1)." |
|
3941 | + WHERE c_id = ".$course_id." AND id = ".$lp_id; |
|
3942 | 3942 | Database::query($sql_u2); |
3943 | 3943 | } |
3944 | 3944 | } |
@@ -3958,15 +3958,15 @@ discard block |
||
3958 | 3958 | $this->autocomplete_parents($this->last); |
3959 | 3959 | $new_index = $this->get_next_index(); |
3960 | 3960 | if ($this->debug > 2) { |
3961 | - error_log('New LP - New index: ' . $new_index, 0); |
|
3961 | + error_log('New LP - New index: '.$new_index, 0); |
|
3962 | 3962 | } |
3963 | 3963 | $this->index = $new_index; |
3964 | 3964 | if ($this->debug > 2) { |
3965 | - error_log('New LP - Now having orderedlist[' . $new_index . '] = ' . $this->ordered_items[$new_index], 0); |
|
3965 | + error_log('New LP - Now having orderedlist['.$new_index.'] = '.$this->ordered_items[$new_index], 0); |
|
3966 | 3966 | } |
3967 | 3967 | $this->current = $this->ordered_items[$new_index]; |
3968 | 3968 | if ($this->debug > 2) { |
3969 | - error_log('New LP - new item id is ' . $this->current . '-' . $this->get_current_item_id(), 0); |
|
3969 | + error_log('New LP - new item id is '.$this->current.'-'.$this->get_current_item_id(), 0); |
|
3970 | 3970 | } |
3971 | 3971 | } |
3972 | 3972 | |
@@ -4030,7 +4030,7 @@ discard block |
||
4030 | 4030 | // Clean spaces. |
4031 | 4031 | $prereq_string = str_replace(' ', '', $prereq_string); |
4032 | 4032 | if ($debug > 0) { |
4033 | - error_log('Found prereq_string: ' . $prereq_string, 0); |
|
4033 | + error_log('Found prereq_string: '.$prereq_string, 0); |
|
4034 | 4034 | } |
4035 | 4035 | // Now send to the parse_prereq() function that will check this component's prerequisites. |
4036 | 4036 | $result = $currentItem->parse_prereq( |
@@ -4046,12 +4046,12 @@ discard block |
||
4046 | 4046 | } else { |
4047 | 4047 | $result = true; |
4048 | 4048 | if ($debug > 1) { |
4049 | - error_log('$this->items[' . $itemId . '] was not an object', 0); |
|
4049 | + error_log('$this->items['.$itemId.'] was not an object', 0); |
|
4050 | 4050 | } |
4051 | 4051 | } |
4052 | 4052 | |
4053 | 4053 | if ($debug > 1) { |
4054 | - error_log('End of prerequisites_match(). Error message is now ' . $this->error, 0); |
|
4054 | + error_log('End of prerequisites_match(). Error message is now '.$this->error, 0); |
|
4055 | 4055 | } |
4056 | 4056 | return $result; |
4057 | 4057 | } |
@@ -4117,11 +4117,11 @@ discard block |
||
4117 | 4117 | $row = Database :: fetch_array($result); |
4118 | 4118 | $name = domesticate($row['name']); |
4119 | 4119 | if ($set_visibility == 'i') { |
4120 | - $s = $name . " " . get_lang('LearnpathNotPublished'); |
|
4120 | + $s = $name." ".get_lang('LearnpathNotPublished'); |
|
4121 | 4121 | $v = 0; |
4122 | 4122 | } |
4123 | 4123 | if ($set_visibility == 'v') { |
4124 | - $s = $name . " " . get_lang('LearnpathPublished'); |
|
4124 | + $s = $name." ".get_lang('LearnpathPublished'); |
|
4125 | 4125 | $v = 1; |
4126 | 4126 | } |
4127 | 4127 | } else { |
@@ -4203,9 +4203,9 @@ discard block |
||
4203 | 4203 | $course_id = api_get_course_int_id(); |
4204 | 4204 | $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW); |
4205 | 4205 | $sql = "INSERT INTO $lp_view_table (c_id, lp_id, user_id, view_count, session_id) |
4206 | - VALUES ($course_id, " . $this->lp_id . "," . $this->get_user_id() . "," . ($this->attempt + 1) . ", $session_id)"; |
|
4206 | + VALUES ($course_id, ".$this->lp_id.",".$this->get_user_id().",".($this->attempt + 1).", $session_id)"; |
|
4207 | 4207 | if ($this->debug > 2) { |
4208 | - error_log('New LP - Inserting new lp_view for restart: ' . $sql, 0); |
|
4208 | + error_log('New LP - Inserting new lp_view for restart: '.$sql, 0); |
|
4209 | 4209 | } |
4210 | 4210 | Database::query($sql); |
4211 | 4211 | $view_id = Database::insert_id(); |
@@ -4241,10 +4241,10 @@ discard block |
||
4241 | 4241 | // TODO: Do a better check on the index pointing to the right item (it is supposed to be working |
4242 | 4242 | // on $ordered_items[] but not sure it's always safe to use with $items[]). |
4243 | 4243 | if ($this->debug > 2) { |
4244 | - error_log('New LP - save_current() saving item ' . $this->current, 0); |
|
4244 | + error_log('New LP - save_current() saving item '.$this->current, 0); |
|
4245 | 4245 | } |
4246 | 4246 | if ($this->debug > 2) { |
4247 | - error_log('' . print_r($this->items, true), 0); |
|
4247 | + error_log(''.print_r($this->items, true), 0); |
|
4248 | 4248 | } |
4249 | 4249 | if (isset($this->items[$this->current]) && |
4250 | 4250 | is_object($this->items[$this->current]) |
@@ -4268,7 +4268,7 @@ discard block |
||
4268 | 4268 | { |
4269 | 4269 | $debug = $this->debug; |
4270 | 4270 | if ($debug) { |
4271 | - error_log('In learnpath::save_item(' . $item_id . ',' . intval($from_outside). ')', 0); |
|
4271 | + error_log('In learnpath::save_item('.$item_id.','.intval($from_outside).')', 0); |
|
4272 | 4272 | } |
4273 | 4273 | // TODO: Do a better check on the index pointing to the right item (it is supposed to be working |
4274 | 4274 | // on $ordered_items[] but not sure it's always safe to use with $items[]). |
@@ -4291,7 +4291,7 @@ discard block |
||
4291 | 4291 | |
4292 | 4292 | if ($debug) { |
4293 | 4293 | error_log('update_queue before:'); |
4294 | - error_log(print_r($this->update_queue,1)); |
|
4294 | + error_log(print_r($this->update_queue, 1)); |
|
4295 | 4295 | } |
4296 | 4296 | $this->autocomplete_parents($item_id); |
4297 | 4297 | |
@@ -4299,9 +4299,9 @@ discard block |
||
4299 | 4299 | $this->update_queue[$item_id] = $status; |
4300 | 4300 | |
4301 | 4301 | if ($debug) { |
4302 | - error_log('get_status(): ' . $status); |
|
4302 | + error_log('get_status(): '.$status); |
|
4303 | 4303 | error_log('update_queue after:'); |
4304 | - error_log(print_r($this->update_queue,1)); |
|
4304 | + error_log(print_r($this->update_queue, 1)); |
|
4305 | 4305 | } |
4306 | 4306 | return $res; |
4307 | 4307 | } |
@@ -4322,17 +4322,17 @@ discard block |
||
4322 | 4322 | |
4323 | 4323 | if (isset($this->current) && !api_is_invitee()) { |
4324 | 4324 | if ($this->debug > 2) { |
4325 | - error_log('New LP - Saving current item (' . $this->current . ') for later review', 0); |
|
4325 | + error_log('New LP - Saving current item ('.$this->current.') for later review', 0); |
|
4326 | 4326 | } |
4327 | 4327 | $sql = "UPDATE $table SET |
4328 | - last_item = " . intval($this->get_current_item_id()). " |
|
4328 | + last_item = ".intval($this->get_current_item_id())." |
|
4329 | 4329 | WHERE |
4330 | 4330 | c_id = $course_id AND |
4331 | - lp_id = " . $this->get_id() . " AND |
|
4331 | + lp_id = ".$this->get_id()." AND |
|
4332 | 4332 | user_id = " . $this->get_user_id()." ".$session_condition; |
4333 | 4333 | |
4334 | 4334 | if ($this->debug > 2) { |
4335 | - error_log('New LP - Saving last item seen : ' . $sql, 0); |
|
4335 | + error_log('New LP - Saving last item seen : '.$sql, 0); |
|
4336 | 4336 | } |
4337 | 4337 | Database::query($sql); |
4338 | 4338 | } |
@@ -4346,7 +4346,7 @@ discard block |
||
4346 | 4346 | progress = $progress |
4347 | 4347 | WHERE |
4348 | 4348 | c_id = ".$course_id." AND |
4349 | - lp_id = " . $this->get_id() . " AND |
|
4349 | + lp_id = " . $this->get_id()." AND |
|
4350 | 4350 | user_id = " . $this->get_user_id()." ".$session_condition; |
4351 | 4351 | // Ignore errors as some tables might not have the progress field just yet. |
4352 | 4352 | Database::query($sql); |
@@ -4362,7 +4362,7 @@ discard block |
||
4362 | 4362 | public function set_current_item($item_id = null) |
4363 | 4363 | { |
4364 | 4364 | if ($this->debug > 0) { |
4365 | - error_log('New LP - In learnpath::set_current_item(' . $item_id . ')', 0); |
|
4365 | + error_log('New LP - In learnpath::set_current_item('.$item_id.')', 0); |
|
4366 | 4366 | } |
4367 | 4367 | if (empty ($item_id)) { |
4368 | 4368 | if ($this->debug > 2) { |
@@ -4371,7 +4371,7 @@ discard block |
||
4371 | 4371 | // Do nothing. |
4372 | 4372 | } else { |
4373 | 4373 | if ($this->debug > 2) { |
4374 | - error_log('New LP - New current item given is ' . $item_id . '...', 0); |
|
4374 | + error_log('New LP - New current item given is '.$item_id.'...', 0); |
|
4375 | 4375 | } |
4376 | 4376 | if (is_numeric($item_id)) { |
4377 | 4377 | $item_id = intval($item_id); |
@@ -4386,10 +4386,10 @@ discard block |
||
4386 | 4386 | } |
4387 | 4387 | } |
4388 | 4388 | if ($this->debug > 2) { |
4389 | - error_log('New LP - set_current_item(' . $item_id . ') done. Index is now : ' . $this->index, 0); |
|
4389 | + error_log('New LP - set_current_item('.$item_id.') done. Index is now : '.$this->index, 0); |
|
4390 | 4390 | } |
4391 | 4391 | } else { |
4392 | - error_log('New LP - set_current_item(' . $item_id . ') failed. Not a numeric value: ', 0); |
|
4392 | + error_log('New LP - set_current_item('.$item_id.') failed. Not a numeric value: ', 0); |
|
4393 | 4393 | } |
4394 | 4394 | } |
4395 | 4395 | } |
@@ -4415,7 +4415,7 @@ discard block |
||
4415 | 4415 | if ($lp != 0) { |
4416 | 4416 | $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN); |
4417 | 4417 | $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' |
4418 | - WHERE c_id = ".$course_id." AND id = " . $lp; |
|
4418 | + WHERE c_id = ".$course_id." AND id = ".$lp; |
|
4419 | 4419 | $res = Database::query($sql); |
4420 | 4420 | return $res; |
4421 | 4421 | } |
@@ -4440,7 +4440,7 @@ discard block |
||
4440 | 4440 | if ($lp != 0) { |
4441 | 4441 | $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN); |
4442 | 4442 | $sql = "UPDATE $tbl_lp SET js_lib = '$lib' |
4443 | - WHERE c_id = ".$course_id." AND id = " . $lp; |
|
4443 | + WHERE c_id = ".$course_id." AND id = ".$lp; |
|
4444 | 4444 | $res = Database::query($sql); |
4445 | 4445 | return $res; |
4446 | 4446 | } else { |
@@ -4465,10 +4465,10 @@ discard block |
||
4465 | 4465 | $course_id = api_get_course_int_id(); |
4466 | 4466 | $lp_id = $this->get_id(); |
4467 | 4467 | $sql = "UPDATE $lp_table SET |
4468 | - content_maker = '" . Database::escape_string($this->maker) . "' |
|
4468 | + content_maker = '".Database::escape_string($this->maker)."' |
|
4469 | 4469 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4470 | 4470 | if ($this->debug > 2) { |
4471 | - error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0); |
|
4471 | + error_log('New LP - lp updated with new content_maker : '.$this->maker, 0); |
|
4472 | 4472 | } |
4473 | 4473 | Database::query($sql); |
4474 | 4474 | return true; |
@@ -4492,10 +4492,10 @@ discard block |
||
4492 | 4492 | $lp_id = $this->get_id(); |
4493 | 4493 | $course_id = $this->course_info['real_id']; |
4494 | 4494 | $sql = "UPDATE $lp_table SET |
4495 | - name = '" . Database::escape_string($this->name). "' |
|
4495 | + name = '".Database::escape_string($this->name)."' |
|
4496 | 4496 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4497 | 4497 | if ($this->debug > 2) { |
4498 | - error_log('New LP - lp updated with new name : ' . $this->name, 0); |
|
4498 | + error_log('New LP - lp updated with new name : '.$this->name, 0); |
|
4499 | 4499 | } |
4500 | 4500 | $result = Database::query($sql); |
4501 | 4501 | // If the lp is visible on the homepage, change his name there. |
@@ -4503,7 +4503,7 @@ discard block |
||
4503 | 4503 | $session_id = api_get_session_id(); |
4504 | 4504 | $session_condition = api_get_session_condition($session_id); |
4505 | 4505 | $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST); |
4506 | - $link = 'lp/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id; |
|
4506 | + $link = 'lp/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id; |
|
4507 | 4507 | $sql = "UPDATE $tbl_tool SET name = '$this->name' |
4508 | 4508 | WHERE |
4509 | 4509 | c_id = $course_id AND |
@@ -4581,10 +4581,10 @@ discard block |
||
4581 | 4581 | |
4582 | 4582 | // Save it to search engine. |
4583 | 4583 | foreach ($missing_terms as $term) { |
4584 | - $doc->add_term($prefix . $term, 1); |
|
4584 | + $doc->add_term($prefix.$term, 1); |
|
4585 | 4585 | } |
4586 | 4586 | foreach ($deprecated_terms as $term) { |
4587 | - $doc->remove_term($prefix . $term); |
|
4587 | + $doc->remove_term($prefix.$term); |
|
4588 | 4588 | } |
4589 | 4589 | $di->getDb()->replace_document((int) $se_ref['search_did'], $doc); |
4590 | 4590 | $di->getDb()->flush(); |
@@ -4609,10 +4609,10 @@ discard block |
||
4609 | 4609 | $this->theme = $name; |
4610 | 4610 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4611 | 4611 | $lp_id = $this->get_id(); |
4612 | - $sql = "UPDATE $lp_table SET theme = '" . Database::escape_string($this->theme). "' |
|
4612 | + $sql = "UPDATE $lp_table SET theme = '".Database::escape_string($this->theme)."' |
|
4613 | 4613 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4614 | 4614 | if ($this->debug > 2) { |
4615 | - error_log('New LP - lp updated with new theme : ' . $this->theme, 0); |
|
4615 | + error_log('New LP - lp updated with new theme : '.$this->theme, 0); |
|
4616 | 4616 | } |
4617 | 4617 | Database::query($sql); |
4618 | 4618 | |
@@ -4635,10 +4635,10 @@ discard block |
||
4635 | 4635 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4636 | 4636 | $lp_id = $this->get_id(); |
4637 | 4637 | $sql = "UPDATE $lp_table SET |
4638 | - preview_image = '" . Database::escape_string($this->preview_image). "' |
|
4638 | + preview_image = '".Database::escape_string($this->preview_image)."' |
|
4639 | 4639 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4640 | 4640 | if ($this->debug > 2) { |
4641 | - error_log('New LP - lp updated with new preview image : ' . $this->preview_image, 0); |
|
4641 | + error_log('New LP - lp updated with new preview image : '.$this->preview_image, 0); |
|
4642 | 4642 | } |
4643 | 4643 | Database::query($sql); |
4644 | 4644 | return true; |
@@ -4658,10 +4658,10 @@ discard block |
||
4658 | 4658 | $this->author = $name; |
4659 | 4659 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4660 | 4660 | $lp_id = $this->get_id(); |
4661 | - $sql = "UPDATE $lp_table SET author = '" . Database::escape_string($name). "' |
|
4661 | + $sql = "UPDATE $lp_table SET author = '".Database::escape_string($name)."' |
|
4662 | 4662 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4663 | 4663 | if ($this->debug > 2) { |
4664 | - error_log('New LP - lp updated with new preview author : ' . $this->author, 0); |
|
4664 | + error_log('New LP - lp updated with new preview author : '.$this->author, 0); |
|
4665 | 4665 | } |
4666 | 4666 | Database::query($sql); |
4667 | 4667 | |
@@ -4684,10 +4684,10 @@ discard block |
||
4684 | 4684 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4685 | 4685 | $lp_id = $this->get_id(); |
4686 | 4686 | $sql = "UPDATE $lp_table SET |
4687 | - hide_toc_frame = '" . (int) $this->hide_toc_frame . "' |
|
4687 | + hide_toc_frame = '".(int) $this->hide_toc_frame."' |
|
4688 | 4688 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4689 | 4689 | if ($this->debug > 2) { |
4690 | - error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0); |
|
4690 | + error_log('New LP - lp updated with new preview hide_toc_frame : '.$this->author, 0); |
|
4691 | 4691 | } |
4692 | 4692 | Database::query($sql); |
4693 | 4693 | |
@@ -4714,7 +4714,7 @@ discard block |
||
4714 | 4714 | $sql = "UPDATE $lp_table SET prerequisite = '".$this->prerequisite."' |
4715 | 4715 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4716 | 4716 | if ($this->debug > 2) { |
4717 | - error_log('New LP - lp updated with new preview requisite : ' . $this->requisite, 0); |
|
4717 | + error_log('New LP - lp updated with new preview requisite : '.$this->requisite, 0); |
|
4718 | 4718 | } |
4719 | 4719 | Database::query($sql); |
4720 | 4720 | return true; |
@@ -4738,10 +4738,10 @@ discard block |
||
4738 | 4738 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4739 | 4739 | $lp_id = $this->get_id(); |
4740 | 4740 | $sql = "UPDATE $lp_table SET |
4741 | - content_local = '" . Database::escape_string($name) . "' |
|
4741 | + content_local = '".Database::escape_string($name)."' |
|
4742 | 4742 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4743 | 4743 | if ($this->debug > 2) { |
4744 | - error_log('New LP - lp updated with new proximity : ' . $this->proximity, 0); |
|
4744 | + error_log('New LP - lp updated with new proximity : '.$this->proximity, 0); |
|
4745 | 4745 | } |
4746 | 4746 | Database::query($sql); |
4747 | 4747 | return true; |
@@ -4775,11 +4775,11 @@ discard block |
||
4775 | 4775 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4776 | 4776 | $lp_id = $this->get_id(); |
4777 | 4777 | $sql = "UPDATE $lp_table SET |
4778 | - use_max_score = '" . $this->use_max_score . "' |
|
4778 | + use_max_score = '".$this->use_max_score."' |
|
4779 | 4779 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4780 | 4780 | |
4781 | 4781 | if ($this->debug > 2) { |
4782 | - error_log('New LP - lp updated with new use_max_score : ' . $this->use_max_score, 0); |
|
4782 | + error_log('New LP - lp updated with new use_max_score : '.$this->use_max_score, 0); |
|
4783 | 4783 | } |
4784 | 4784 | Database::query($sql); |
4785 | 4785 | |
@@ -4806,7 +4806,7 @@ discard block |
||
4806 | 4806 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4807 | 4807 | $lp_id = $this->get_id(); |
4808 | 4808 | if ($this->debug > 2) { |
4809 | - error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0); |
|
4809 | + error_log('New LP - lp updated with new expired_on : '.$this->expired_on, 0); |
|
4810 | 4810 | } |
4811 | 4811 | |
4812 | 4812 | $params = [ |
@@ -4836,10 +4836,10 @@ discard block |
||
4836 | 4836 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4837 | 4837 | $lp_id = $this->get_id(); |
4838 | 4838 | $sql = "UPDATE $lp_table SET |
4839 | - publicated_on = '" . Database::escape_string($this->publicated_on) . "' |
|
4839 | + publicated_on = '".Database::escape_string($this->publicated_on)."' |
|
4840 | 4840 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4841 | 4841 | if ($this->debug > 2) { |
4842 | - error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0); |
|
4842 | + error_log('New LP - lp updated with new publicated_on : '.$this->publicated_on, 0); |
|
4843 | 4843 | } |
4844 | 4844 | Database::query($sql); |
4845 | 4845 | |
@@ -4859,10 +4859,10 @@ discard block |
||
4859 | 4859 | $this->modified_on = api_get_utc_datetime(); |
4860 | 4860 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4861 | 4861 | $lp_id = $this->get_id(); |
4862 | - $sql = "UPDATE $lp_table SET modified_on = '" . $this->modified_on . "' |
|
4862 | + $sql = "UPDATE $lp_table SET modified_on = '".$this->modified_on."' |
|
4863 | 4863 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4864 | 4864 | if ($this->debug > 2) { |
4865 | - error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0); |
|
4865 | + error_log('New LP - lp updated with new expired_on : '.$this->modified_on, 0); |
|
4866 | 4866 | } |
4867 | 4867 | Database::query($sql); |
4868 | 4868 | |
@@ -4934,13 +4934,13 @@ discard block |
||
4934 | 4934 | |
4935 | 4935 | if ($this->last != 0 && $this->last != $this->current && is_object($this->items[$this->last])) { |
4936 | 4936 | if ($this->debug > 2) { |
4937 | - error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' is object', 0); |
|
4937 | + error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' is object', 0); |
|
4938 | 4938 | } |
4939 | 4939 | switch ($this->get_type()) { |
4940 | 4940 | case '3': |
4941 | 4941 | if ($this->items[$this->last]->get_type() != 'au') { |
4942 | 4942 | if ($this->debug > 2) { |
4943 | - error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 3 is <> au', 0); |
|
4943 | + error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 3 is <> au', 0); |
|
4944 | 4944 | } |
4945 | 4945 | $this->items[$this->last]->close(); |
4946 | 4946 | //$this->autocomplete_parents($this->last); |
@@ -4953,7 +4953,7 @@ discard block |
||
4953 | 4953 | case '2': |
4954 | 4954 | if ($this->items[$this->last]->get_type() != 'sco') { |
4955 | 4955 | if ($this->debug > 2) { |
4956 | - error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 2 is <> sco', 0); |
|
4956 | + error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 2 is <> sco', 0); |
|
4957 | 4957 | } |
4958 | 4958 | $this->items[$this->last]->close(); |
4959 | 4959 | //$this->autocomplete_parents($this->last); |
@@ -4967,7 +4967,7 @@ discard block |
||
4967 | 4967 | case '1': |
4968 | 4968 | default: |
4969 | 4969 | if ($this->debug > 2) { |
4970 | - error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 1 is asset', 0); |
|
4970 | + error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 1 is asset', 0); |
|
4971 | 4971 | } |
4972 | 4972 | $this->items[$this->last]->close(); |
4973 | 4973 | break; |
@@ -4993,7 +4993,7 @@ discard block |
||
4993 | 4993 | } |
4994 | 4994 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4995 | 4995 | $sql = "SELECT * FROM $lp_table |
4996 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
4996 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
4997 | 4997 | $res = Database::query($sql); |
4998 | 4998 | if (Database :: num_rows($res) > 0) { |
4999 | 4999 | $row = Database :: fetch_array($res); |
@@ -5014,14 +5014,14 @@ discard block |
||
5014 | 5014 | break; |
5015 | 5015 | } |
5016 | 5016 | $sql = "UPDATE $lp_table SET default_view_mod = '$view_mode' |
5017 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5017 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5018 | 5018 | Database::query($sql); |
5019 | 5019 | $this->mode = $view_mode; |
5020 | 5020 | |
5021 | 5021 | return $view_mode; |
5022 | 5022 | } else { |
5023 | 5023 | if ($this->debug > 2) { |
5024 | - error_log('New LP - Problem in update_default_view() - could not find LP ' . $this->get_id() . ' in DB', 0); |
|
5024 | + error_log('New LP - Problem in update_default_view() - could not find LP '.$this->get_id().' in DB', 0); |
|
5025 | 5025 | } |
5026 | 5026 | } |
5027 | 5027 | return -1; |
@@ -5039,7 +5039,7 @@ discard block |
||
5039 | 5039 | } |
5040 | 5040 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
5041 | 5041 | $sql = "SELECT * FROM $lp_table |
5042 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5042 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5043 | 5043 | $res = Database::query($sql); |
5044 | 5044 | if (Database :: num_rows($res) > 0) { |
5045 | 5045 | $row = Database :: fetch_array($res); |
@@ -5052,14 +5052,14 @@ discard block |
||
5052 | 5052 | $force_return = true; |
5053 | 5053 | } |
5054 | 5054 | $sql = "UPDATE $lp_table SET force_commit = $force |
5055 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5055 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5056 | 5056 | Database::query($sql); |
5057 | 5057 | $this->force_commit = $force_return; |
5058 | 5058 | |
5059 | 5059 | return $force_return; |
5060 | 5060 | } else { |
5061 | 5061 | if ($this->debug > 2) { |
5062 | - error_log('New LP - Problem in update_default_scorm_commit() - could not find LP ' . $this->get_id() . ' in DB', 0); |
|
5062 | + error_log('New LP - Problem in update_default_scorm_commit() - could not find LP '.$this->get_id().' in DB', 0); |
|
5063 | 5063 | } |
5064 | 5064 | } |
5065 | 5065 | return -1; |
@@ -5088,7 +5088,7 @@ discard block |
||
5088 | 5088 | if ($row['display_order'] != $i) { |
5089 | 5089 | // If we find a gap in the order, we need to fix it. |
5090 | 5090 | $sql = "UPDATE $lp_table SET display_order = $i |
5091 | - WHERE c_id = ".$course_id." AND id = " . $row['id']; |
|
5091 | + WHERE c_id = ".$course_id." AND id = ".$row['id']; |
|
5092 | 5092 | Database::query($sql); |
5093 | 5093 | } |
5094 | 5094 | $i++; |
@@ -5109,7 +5109,7 @@ discard block |
||
5109 | 5109 | } |
5110 | 5110 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
5111 | 5111 | $sql = "SELECT * FROM $lp_table |
5112 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5112 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5113 | 5113 | $res = Database::query($sql); |
5114 | 5114 | if (Database :: num_rows($res) > 0) { |
5115 | 5115 | $row = Database :: fetch_array($res); |
@@ -5120,13 +5120,13 @@ discard block |
||
5120 | 5120 | $force = 1; |
5121 | 5121 | } |
5122 | 5122 | $sql = "UPDATE $lp_table SET prevent_reinit = $force |
5123 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5123 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5124 | 5124 | Database::query($sql); |
5125 | 5125 | $this->prevent_reinit = $force; |
5126 | 5126 | return $force; |
5127 | 5127 | } else { |
5128 | 5128 | if ($this->debug > 2) { |
5129 | - error_log('New LP - Problem in update_reinit() - could not find LP ' . $this->get_id() . ' in DB', 0); |
|
5129 | + error_log('New LP - Problem in update_reinit() - could not find LP '.$this->get_id().' in DB', 0); |
|
5130 | 5130 | } |
5131 | 5131 | } |
5132 | 5132 | return -1; |
@@ -5142,11 +5142,11 @@ discard block |
||
5142 | 5142 | { |
5143 | 5143 | //Set default value for seriousgame_mode |
5144 | 5144 | if (!isset($this->seriousgame_mode)) { |
5145 | - $this->seriousgame_mode=0; |
|
5145 | + $this->seriousgame_mode = 0; |
|
5146 | 5146 | } |
5147 | 5147 | // Set default value for prevent_reinit |
5148 | 5148 | if (!isset($this->prevent_reinit)) { |
5149 | - $this->prevent_reinit =1; |
|
5149 | + $this->prevent_reinit = 1; |
|
5150 | 5150 | } |
5151 | 5151 | if ($this->seriousgame_mode == 1 && $this->prevent_reinit == 1) { |
5152 | 5152 | return 'seriousgame'; |
@@ -5194,7 +5194,7 @@ discard block |
||
5194 | 5194 | $sql = "UPDATE $lp_table SET |
5195 | 5195 | prevent_reinit = $prevent_reinit , |
5196 | 5196 | seriousgame_mode = $sg_mode |
5197 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5197 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5198 | 5198 | $res = Database::query($sql); |
5199 | 5199 | if ($res) { |
5200 | 5200 | return true; |
@@ -5246,7 +5246,7 @@ discard block |
||
5246 | 5246 | error_log('New LP - In learnpath::set_seriousgame_mode()', 0); |
5247 | 5247 | } |
5248 | 5248 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
5249 | - $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5249 | + $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5250 | 5250 | $res = Database::query($sql); |
5251 | 5251 | if (Database :: num_rows($res) > 0) { |
5252 | 5252 | $row = Database :: fetch_array($res); |
@@ -5257,13 +5257,13 @@ discard block |
||
5257 | 5257 | $force = 1; |
5258 | 5258 | } |
5259 | 5259 | $sql = "UPDATE $lp_table SET seriousgame_mode = $force |
5260 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5260 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5261 | 5261 | Database::query($sql); |
5262 | 5262 | $this->seriousgame_mode = $force; |
5263 | 5263 | return $force; |
5264 | 5264 | } else { |
5265 | 5265 | if ($this->debug > 2) { |
5266 | - error_log('New LP - Problem in set_seriousgame_mode() - could not find LP ' . $this->get_id() . ' in DB', 0); |
|
5266 | + error_log('New LP - Problem in set_seriousgame_mode() - could not find LP '.$this->get_id().' in DB', 0); |
|
5267 | 5267 | } |
5268 | 5268 | } |
5269 | 5269 | return -1; |
@@ -5281,7 +5281,7 @@ discard block |
||
5281 | 5281 | } |
5282 | 5282 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
5283 | 5283 | $sql = "SELECT * FROM $lp_table |
5284 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5284 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5285 | 5285 | $res = Database::query($sql); |
5286 | 5286 | if (Database :: num_rows($res) > 0) { |
5287 | 5287 | $row = Database :: fetch_array($res); |
@@ -5292,13 +5292,13 @@ discard block |
||
5292 | 5292 | $force = 1; |
5293 | 5293 | } |
5294 | 5294 | $sql = "UPDATE $lp_table SET debug = $force |
5295 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5295 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5296 | 5296 | Database::query($sql); |
5297 | 5297 | $this->scorm_debug = $force; |
5298 | 5298 | return $force; |
5299 | 5299 | } else { |
5300 | 5300 | if ($this->debug > 2) { |
5301 | - error_log('New LP - Problem in update_scorm_debug() - could not find LP ' . $this->get_id() . ' in DB', 0); |
|
5301 | + error_log('New LP - Problem in update_scorm_debug() - could not find LP '.$this->get_id().' in DB', 0); |
|
5302 | 5302 | } |
5303 | 5303 | } |
5304 | 5304 | return -1; |
@@ -5327,7 +5327,7 @@ discard block |
||
5327 | 5327 | * @param int $depth |
5328 | 5328 | * @param array $tmp |
5329 | 5329 | */ |
5330 | - public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array ()) |
|
5330 | + public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array()) |
|
5331 | 5331 | { |
5332 | 5332 | if ($this->debug > 1) { |
5333 | 5333 | error_log('New LP - In learnpath::create_tree_array())', 0); |
@@ -5413,7 +5413,7 @@ discard block |
||
5413 | 5413 | |
5414 | 5414 | // we need to start a form when we want to update all the mp3 files |
5415 | 5415 | if ($update_audio == 'true') { |
5416 | - $return .= '<form action="' . api_get_self() . '?'.api_get_cidreq().'&updateaudio=' . Security :: remove_XSS($_GET['updateaudio']) .'&action=' . Security :: remove_XSS($_GET['action']) . '&lp_id=' . $_SESSION['oLP']->lp_id . '" method="post" enctype="multipart/form-data" name="updatemp3" id="updatemp3">'; |
|
5416 | + $return .= '<form action="'.api_get_self().'?'.api_get_cidreq().'&updateaudio='.Security :: remove_XSS($_GET['updateaudio']).'&action='.Security :: remove_XSS($_GET['action']).'&lp_id='.$_SESSION['oLP']->lp_id.'" method="post" enctype="multipart/form-data" name="updatemp3" id="updatemp3">'; |
|
5417 | 5417 | } |
5418 | 5418 | $return .= '<div id="message"></div>'; |
5419 | 5419 | if (count($this->items) == 0) { |
@@ -5421,14 +5421,14 @@ discard block |
||
5421 | 5421 | } else { |
5422 | 5422 | $return_audio = '<table class="data_table">'; |
5423 | 5423 | $return_audio .= '<tr>'; |
5424 | - $return_audio .= '<th width="40%">' . get_lang('Title') . '</th>'; |
|
5425 | - $return_audio .= '<th>' . get_lang('Audio') . '</th>'; |
|
5424 | + $return_audio .= '<th width="40%">'.get_lang('Title').'</th>'; |
|
5425 | + $return_audio .= '<th>'.get_lang('Audio').'</th>'; |
|
5426 | 5426 | $return_audio .= '</tr>'; |
5427 | 5427 | |
5428 | 5428 | if ($update_audio != 'true') { |
5429 | 5429 | $return .= '<div class="col-md-12">'; |
5430 | 5430 | $return .= self::return_new_tree($update_audio); |
5431 | - $return .='</div>'; |
|
5431 | + $return .= '</div>'; |
|
5432 | 5432 | $return .= Display::div( |
5433 | 5433 | Display::url(get_lang('Save'), '#', array('id' => 'listSubmit', 'class' => 'btn btn-primary')), |
5434 | 5434 | array('style' => 'float:left; margin-top:15px;width:100%') |
@@ -5466,7 +5466,7 @@ discard block |
||
5466 | 5466 | public function return_new_tree($update_audio = 'false', $drop_element_here = false) |
5467 | 5467 | { |
5468 | 5468 | $return = ''; |
5469 | - $is_allowed_to_edit = api_is_allowed_to_edit(null,true); |
|
5469 | + $is_allowed_to_edit = api_is_allowed_to_edit(null, true); |
|
5470 | 5470 | |
5471 | 5471 | $course_id = api_get_course_int_id(); |
5472 | 5472 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
@@ -5514,7 +5514,7 @@ discard block |
||
5514 | 5514 | |
5515 | 5515 | // Link for the documents |
5516 | 5516 | if ($arrLP[$i]['item_type'] == 'document') { |
5517 | - $url = api_get_self() . '?'.api_get_cidreq().'&action=view_item&mode=preview_document&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id; |
|
5517 | + $url = api_get_self().'?'.api_get_cidreq().'&action=view_item&mode=preview_document&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id; |
|
5518 | 5518 | $title_cut = Display::url( |
5519 | 5519 | $title_cut, |
5520 | 5520 | $url, |
@@ -5535,15 +5535,15 @@ discard block |
||
5535 | 5535 | } else { |
5536 | 5536 | $oddClass = 'row_even'; |
5537 | 5537 | } |
5538 | - $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'] .'" class="' . $oddClass . '">'; |
|
5538 | + $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'].'" class="'.$oddClass.'">'; |
|
5539 | 5539 | |
5540 | 5540 | $icon_name = str_replace(' ', '', $arrLP[$i]['item_type']); |
5541 | 5541 | |
5542 | - if (file_exists('../img/lp_' . $icon_name . '.png')) { |
|
5543 | - $icon = Display::return_icon('lp_' . $icon_name . '.png'); |
|
5542 | + if (file_exists('../img/lp_'.$icon_name.'.png')) { |
|
5543 | + $icon = Display::return_icon('lp_'.$icon_name.'.png'); |
|
5544 | 5544 | } else { |
5545 | - if (file_exists('../img/lp_' . $icon_name . '.gif')) { |
|
5546 | - $icon = Display::return_icon('lp_' . $icon_name . '.gif'); |
|
5545 | + if (file_exists('../img/lp_'.$icon_name.'.gif')) { |
|
5546 | + $icon = Display::return_icon('lp_'.$icon_name.'.gif'); |
|
5547 | 5547 | } else { |
5548 | 5548 | if ($arrLP[$i]['item_type'] === TOOL_LP_FINAL_ITEM) { |
5549 | 5549 | $icon = Display::return_icon('certificate.png'); |
@@ -5554,7 +5554,7 @@ discard block |
||
5554 | 5554 | } |
5555 | 5555 | |
5556 | 5556 | // The audio column. |
5557 | - $return_audio .= '<td align="left" style="padding-left:10px;">'; |
|
5557 | + $return_audio .= '<td align="left" style="padding-left:10px;">'; |
|
5558 | 5558 | $audio = ''; |
5559 | 5559 | if (!$update_audio || $update_audio <> 'true') { |
5560 | 5560 | if (!empty($arrLP[$i]['audio'])) { |
@@ -5564,10 +5564,10 @@ discard block |
||
5564 | 5564 | } else { |
5565 | 5565 | $types = self::getChapterTypes(); |
5566 | 5566 | if (!in_array($arrLP[$i]['item_type'], $types)) { |
5567 | - $audio .= '<input type="file" name="mp3file' . $arrLP[$i]['id'] . '" id="mp3file" />'; |
|
5567 | + $audio .= '<input type="file" name="mp3file'.$arrLP[$i]['id'].'" id="mp3file" />'; |
|
5568 | 5568 | if (!empty ($arrLP[$i]['audio'])) { |
5569 | 5569 | $audio .= '<br />'.Security::remove_XSS($arrLP[$i]['audio']).'<br /> |
5570 | - <input type="checkbox" name="removemp3' . $arrLP[$i]['id'] . '" id="checkbox' . $arrLP[$i]['id'] . '" />' . get_lang('RemoveAudio'); |
|
5570 | + <input type="checkbox" name="removemp3' . $arrLP[$i]['id'].'" id="checkbox'.$arrLP[$i]['id'].'" />'.get_lang('RemoveAudio'); |
|
5571 | 5571 | } |
5572 | 5572 | } |
5573 | 5573 | } |
@@ -5595,7 +5595,7 @@ discard block |
||
5595 | 5595 | // No edit for this item types |
5596 | 5596 | if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset', 'final_item'))) { |
5597 | 5597 | if ($arrLP[$i]['item_type'] != 'dir') { |
5598 | - $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&view=build&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '&path_item=' . $arrLP[$i]['path'] . '" class="btn btn-default">'; |
|
5598 | + $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id.'&path_item='.$arrLP[$i]['path'].'" class="btn btn-default">'; |
|
5599 | 5599 | $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY); |
5600 | 5600 | $edit_icon .= '</a>'; |
5601 | 5601 | |
@@ -5606,7 +5606,7 @@ discard block |
||
5606 | 5606 | $this->lp_session_id |
5607 | 5607 | ) |
5608 | 5608 | ) { |
5609 | - $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ |
|
5609 | + $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ |
|
5610 | 5610 | 'action' => 'dissociate_forum', |
5611 | 5611 | 'id' => $arrLP[$i]['id'], |
5612 | 5612 | 'lp_id' => $this->lp_id |
@@ -5617,7 +5617,7 @@ discard block |
||
5617 | 5617 | ['class' => 'btn btn-default lp-btn-dissociate-forum'] |
5618 | 5618 | ); |
5619 | 5619 | } else { |
5620 | - $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ |
|
5620 | + $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ |
|
5621 | 5621 | 'action' => 'create_forum', |
5622 | 5622 | 'id' => $arrLP[$i]['id'], |
5623 | 5623 | 'lp_id' => $this->lp_id |
@@ -5630,17 +5630,17 @@ discard block |
||
5630 | 5630 | } |
5631 | 5631 | } |
5632 | 5632 | } else { |
5633 | - $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '&path_item=' . $arrLP[$i]['path'] . '" class="btn btn-default">'; |
|
5633 | + $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id.'&path_item='.$arrLP[$i]['path'].'" class="btn btn-default">'; |
|
5634 | 5634 | $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY); |
5635 | 5635 | $edit_icon .= '</a>'; |
5636 | 5636 | } |
5637 | 5637 | } |
5638 | 5638 | |
5639 | - $delete_icon .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete_item&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '" onclick="return confirmation(\'' . addslashes($title) . '\');" class="btn btn-default">'; |
|
5639 | + $delete_icon .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete_item&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id.'" onclick="return confirmation(\''.addslashes($title).'\');" class="btn btn-default">'; |
|
5640 | 5640 | $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY); |
5641 | 5641 | $delete_icon .= '</a>'; |
5642 | 5642 | |
5643 | - $url = api_get_self() . '?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id; |
|
5643 | + $url = api_get_self().'?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id; |
|
5644 | 5644 | |
5645 | 5645 | if ($arrLP[$i]['item_type'] == 'document') { |
5646 | 5646 | $urlPreviewLink = api_get_self().'?'.api_get_cidreq().'&action=view_item&mode=preview_document&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id; |
@@ -5677,8 +5677,8 @@ discard block |
||
5677 | 5677 | } |
5678 | 5678 | } |
5679 | 5679 | if ($update_audio != 'true') { |
5680 | - $row = $move_icon . ' ' . $icon . |
|
5681 | - Display::span($title_cut) . |
|
5680 | + $row = $move_icon.' '.$icon. |
|
5681 | + Display::span($title_cut). |
|
5682 | 5682 | Display::tag( |
5683 | 5683 | 'div', |
5684 | 5684 | "<div class=\"btn-group btn-group-xs\">$previewIcon $audio $edit_icon $forumIcon $prerequisities_icon $move_item_icon $audio_icon $delete_icon</div>", |
@@ -5699,8 +5699,8 @@ discard block |
||
5699 | 5699 | $parent_arrays = array(); |
5700 | 5700 | if ($arrLP[$i]['depth'] > 1) { |
5701 | 5701 | //Getting list of parents |
5702 | - for($j = 0; $j < $arrLP[$i]['depth']; $j++) { |
|
5703 | - foreach($arrLP as $item) { |
|
5702 | + for ($j = 0; $j < $arrLP[$i]['depth']; $j++) { |
|
5703 | + foreach ($arrLP as $item) { |
|
5704 | 5704 | if ($item['id'] == $parent_id) { |
5705 | 5705 | if ($item['parent_item_id'] == 0) { |
5706 | 5706 | $parent_id = $item['id']; |
@@ -5722,8 +5722,8 @@ discard block |
||
5722 | 5722 | $parent_arrays = array_reverse($parent_arrays); |
5723 | 5723 | $val = '$elements'; |
5724 | 5724 | $x = 0; |
5725 | - foreach($parent_arrays as $item) { |
|
5726 | - if ($x != count($parent_arrays) -1) { |
|
5725 | + foreach ($parent_arrays as $item) { |
|
5726 | + if ($x != count($parent_arrays) - 1) { |
|
5727 | 5727 | $val .= '["'.$item.'"]["children"]'; |
5728 | 5728 | } else { |
5729 | 5729 | $val .= '["'.$item.'"]["children"]'; |
@@ -5792,7 +5792,7 @@ discard block |
||
5792 | 5792 | if (isset($_REQUEST['id']) && $key == $_REQUEST['id']) { |
5793 | 5793 | $active = 'active'; |
5794 | 5794 | } |
5795 | - $return .= Display::tag( |
|
5795 | + $return .= Display::tag( |
|
5796 | 5796 | 'li', |
5797 | 5797 | Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, |
5798 | 5798 | array('id'=>$key, 'class'=>'record li_container') |
@@ -5830,7 +5830,7 @@ discard block |
||
5830 | 5830 | |
5831 | 5831 | $actionsLeft .= Display::url( |
5832 | 5832 | Display:: return_icon('preview_view.png', get_lang('Display'), '', ICON_SIZE_MEDIUM), |
5833 | - 'lp_controller.php?'.api_get_cidreq().'&' . http_build_query([ |
|
5833 | + 'lp_controller.php?'.api_get_cidreq().'&'.http_build_query([ |
|
5834 | 5834 | 'gradebook' => $gradebook, |
5835 | 5835 | 'action' => 'view', |
5836 | 5836 | 'lp_id' => $_SESSION['oLP']->lp_id, |
@@ -5839,7 +5839,7 @@ discard block |
||
5839 | 5839 | ); |
5840 | 5840 | $actionsLeft .= Display::url( |
5841 | 5841 | Display:: return_icon('upload_audio.png', get_lang('UpdateAllAudioFragments'), '', ICON_SIZE_MEDIUM), |
5842 | - 'lp_controller.php?' . api_get_cidreq() . '&' . http_build_query([ |
|
5842 | + 'lp_controller.php?'.api_get_cidreq().'&'.http_build_query([ |
|
5843 | 5843 | 'action' => 'admin_view', |
5844 | 5844 | 'lp_id' => $_SESSION['oLP']->lp_id, |
5845 | 5845 | 'updateaudio' => 'true' |
@@ -5848,8 +5848,8 @@ discard block |
||
5848 | 5848 | |
5849 | 5849 | if (!$isConfigPage) { |
5850 | 5850 | $actionsLeft .= Display::url( |
5851 | - Display :: return_icon('settings.png', get_lang('CourseSettings'),'',ICON_SIZE_MEDIUM), |
|
5852 | - 'lp_controller.php?' . api_get_cidreq() . '&' . http_build_query([ |
|
5851 | + Display :: return_icon('settings.png', get_lang('CourseSettings'), '', ICON_SIZE_MEDIUM), |
|
5852 | + 'lp_controller.php?'.api_get_cidreq().'&'.http_build_query([ |
|
5853 | 5853 | 'action' => 'edit', |
5854 | 5854 | 'lp_id' => $_SESSION['oLP']->lp_id |
5855 | 5855 | ]) |
@@ -5857,16 +5857,16 @@ discard block |
||
5857 | 5857 | } else { |
5858 | 5858 | $actionsLeft .= Display::url( |
5859 | 5859 | Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM), |
5860 | - 'lp_controller.php?' . http_build_query([ |
|
5860 | + 'lp_controller.php?'.http_build_query([ |
|
5861 | 5861 | 'action' => 'build', |
5862 | 5862 | 'lp_id' => $_SESSION['oLP']->lp_id |
5863 | - ]) . '&' . api_get_cidreq() |
|
5863 | + ]).'&'.api_get_cidreq() |
|
5864 | 5864 | ); |
5865 | 5865 | } |
5866 | 5866 | |
5867 | 5867 | if ($allowExpand) { |
5868 | 5868 | $actionsLeft .= Display::url( |
5869 | - Display::return_icon('expand.png', get_lang('Expand'), array('id' => 'expand'), ICON_SIZE_MEDIUM) . |
|
5869 | + Display::return_icon('expand.png', get_lang('Expand'), array('id' => 'expand'), ICON_SIZE_MEDIUM). |
|
5870 | 5870 | Display::return_icon('contract.png', get_lang('Collapse'), array('id' => 'contract', 'class' => 'hide'), ICON_SIZE_MEDIUM), |
5871 | 5871 | '#', |
5872 | 5872 | ['role' => 'button', 'id' => 'hide_bar_template'] |
@@ -5877,14 +5877,14 @@ discard block |
||
5877 | 5877 | $buttons = array( |
5878 | 5878 | array( |
5879 | 5879 | 'title' => get_lang('SetPrerequisiteForEachItem'), |
5880 | - 'href' => 'lp_controller.php?' . api_get_cidreq() . '&' . http_build_query([ |
|
5880 | + 'href' => 'lp_controller.php?'.api_get_cidreq().'&'.http_build_query([ |
|
5881 | 5881 | 'action' => 'set_previous_step_as_prerequisite', |
5882 | 5882 | 'lp_id' => $_SESSION['oLP']->lp_id |
5883 | 5883 | ]) |
5884 | 5884 | ), |
5885 | 5885 | array( |
5886 | 5886 | 'title' => get_lang('ClearAllPrerequisites'), |
5887 | - 'href' => 'lp_controller.php?' . api_get_cidreq() . '&' . http_build_query([ |
|
5887 | + 'href' => 'lp_controller.php?'.api_get_cidreq().'&'.http_build_query([ |
|
5888 | 5888 | 'action' => 'clear_prerequisites', |
5889 | 5889 | 'lp_id' => $_SESSION['oLP']->lp_id |
5890 | 5890 | ]) |
@@ -5914,7 +5914,7 @@ discard block |
||
5914 | 5914 | { |
5915 | 5915 | // Creating learning_path folder |
5916 | 5916 | $dir = '/learning_path'; |
5917 | - $filepath = api_get_path(SYS_COURSE_PATH).$course['path'] . '/document'; |
|
5917 | + $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'; |
|
5918 | 5918 | $creatorId = empty($creatorId) ? api_get_user_id() : $creatorId; |
5919 | 5919 | |
5920 | 5920 | $folder = false; |
@@ -5960,14 +5960,14 @@ discard block |
||
5960 | 5960 | $folder = self::generate_learning_path_folder($course, $creatorId); |
5961 | 5961 | |
5962 | 5962 | // Limits title size |
5963 | - $title = api_substr(api_replace_dangerous_char($lp_name), 0 , 80); |
|
5963 | + $title = api_substr(api_replace_dangerous_char($lp_name), 0, 80); |
|
5964 | 5964 | $dir = $dir.$title; |
5965 | 5965 | |
5966 | 5966 | // Creating LP folder |
5967 | 5967 | $documentId = null; |
5968 | 5968 | |
5969 | 5969 | if ($folder) { |
5970 | - $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'; |
|
5970 | + $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'; |
|
5971 | 5971 | if (!is_dir($filepath.'/'.$dir)) { |
5972 | 5972 | $folderData = create_unexisting_directory( |
5973 | 5973 | $course, |
@@ -5989,7 +5989,7 @@ discard block |
||
5989 | 5989 | } |
5990 | 5990 | $dir = $dir.'/'; |
5991 | 5991 | if ($folder) { |
5992 | - $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir; |
|
5992 | + $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir; |
|
5993 | 5993 | } |
5994 | 5994 | } |
5995 | 5995 | |
@@ -6057,11 +6057,11 @@ discard block |
||
6057 | 6057 | } |
6058 | 6058 | } |
6059 | 6059 | |
6060 | - $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document'.$dir; |
|
6060 | + $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir; |
|
6061 | 6061 | |
6062 | 6062 | if (!is_dir($filepath)) { |
6063 | 6063 | $dir = '/'; |
6064 | - $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document'.$dir; |
|
6064 | + $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir; |
|
6065 | 6065 | } |
6066 | 6066 | |
6067 | 6067 | // stripslashes() before calling api_replace_dangerous_char() because $_POST['title'] |
@@ -6080,11 +6080,11 @@ discard block |
||
6080 | 6080 | $tmp_filename = $filename; |
6081 | 6081 | |
6082 | 6082 | $i = 0; |
6083 | - while (file_exists($filepath . $tmp_filename . '.'.$extension)){ |
|
6084 | - $tmp_filename = $filename . '_' . ++ $i; |
|
6083 | + while (file_exists($filepath.$tmp_filename.'.'.$extension)) { |
|
6084 | + $tmp_filename = $filename.'_'.++ $i; |
|
6085 | 6085 | } |
6086 | 6086 | |
6087 | - $filename = $tmp_filename . '.'.$extension; |
|
6087 | + $filename = $tmp_filename.'.'.$extension; |
|
6088 | 6088 | if ($extension == 'html') { |
6089 | 6089 | $content = stripslashes($content); |
6090 | 6090 | $content = str_replace( |
@@ -6119,12 +6119,12 @@ discard block |
||
6119 | 6119 | ); |
6120 | 6120 | } |
6121 | 6121 | |
6122 | - if (!file_exists($filepath . $filename)) { |
|
6123 | - if ($fp = @ fopen($filepath . $filename, 'w')) { |
|
6122 | + if (!file_exists($filepath.$filename)) { |
|
6123 | + if ($fp = @ fopen($filepath.$filename, 'w')) { |
|
6124 | 6124 | fputs($fp, $content); |
6125 | 6125 | fclose($fp); |
6126 | 6126 | |
6127 | - $file_size = filesize($filepath . $filename); |
|
6127 | + $file_size = filesize($filepath.$filename); |
|
6128 | 6128 | $save_file_path = $dir.$filename; |
6129 | 6129 | |
6130 | 6130 | $document_id = add_document( |
@@ -6162,12 +6162,12 @@ discard block |
||
6162 | 6162 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6163 | 6163 | $ct = ''; |
6164 | 6164 | if ($new_comment) |
6165 | - $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
6165 | + $ct .= ", comment='".Database::escape_string($new_comment)."'"; |
|
6166 | 6166 | if ($new_title) |
6167 | - $ct .= ", title='" . Database::escape_string($new_title)."' "; |
|
6167 | + $ct .= ", title='".Database::escape_string($new_title)."' "; |
|
6168 | 6168 | |
6169 | - $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)." |
|
6170 | - WHERE c_id = ".$course_id." AND id = " . $document_id; |
|
6169 | + $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)." |
|
6170 | + WHERE c_id = ".$course_id." AND id = ".$document_id; |
|
6171 | 6171 | Database::query($sql); |
6172 | 6172 | } |
6173 | 6173 | } |
@@ -6195,41 +6195,41 @@ discard block |
||
6195 | 6195 | $dir = substr($dir, 1); |
6196 | 6196 | |
6197 | 6197 | if ($dir[0] != '/') |
6198 | - $dir = '/' . $dir; |
|
6198 | + $dir = '/'.$dir; |
|
6199 | 6199 | |
6200 | 6200 | if ($dir[strlen($dir) - 1] != '/') |
6201 | 6201 | $dir .= '/'; |
6202 | 6202 | |
6203 | - $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir; |
|
6203 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
|
6204 | 6204 | |
6205 | 6205 | if (!is_dir($filepath)) { |
6206 | - $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/'; |
|
6206 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
6207 | 6207 | } |
6208 | 6208 | |
6209 | 6209 | $table_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6210 | 6210 | if (isset($_POST['path']) && !empty($_POST['path'])) { |
6211 | 6211 | $document_id = intval($_POST['path']); |
6212 | - $sql = "SELECT path FROM " . $table_doc . " |
|
6213 | - WHERE c_id = $course_id AND id = " . $document_id; |
|
6212 | + $sql = "SELECT path FROM ".$table_doc." |
|
6213 | + WHERE c_id = $course_id AND id = ".$document_id; |
|
6214 | 6214 | $res = Database::query($sql); |
6215 | 6215 | $row = Database :: fetch_array($res); |
6216 | 6216 | $content = stripslashes($_POST['content_lp']); |
6217 | - $file = $filepath . $row['path']; |
|
6217 | + $file = $filepath.$row['path']; |
|
6218 | 6218 | |
6219 | 6219 | if ($fp = @ fopen($file, 'w')) { |
6220 | 6220 | $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].api_get_path(REL_COURSE_PATH), $content); |
6221 | 6221 | |
6222 | 6222 | // Change the path of mp3 to absolute. |
6223 | 6223 | // The first regexp deals with :// urls. |
6224 | - $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/', $content); |
|
6224 | + $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/', $content); |
|
6225 | 6225 | // The second regexp deals with audio/ urls. |
6226 | - $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/$2/', $content); |
|
6226 | + $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/', $content); |
|
6227 | 6227 | fputs($fp, $content); |
6228 | 6228 | fclose($fp); |
6229 | 6229 | |
6230 | - $sql = "UPDATE " . $table_doc ." SET |
|
6230 | + $sql = "UPDATE ".$table_doc." SET |
|
6231 | 6231 | title='".Database::escape_string($_POST['title'])."' |
6232 | - WHERE c_id = ".$course_id." AND id = " . $document_id; |
|
6232 | + WHERE c_id = ".$course_id." AND id = ".$document_id; |
|
6233 | 6233 | Database::query($sql); |
6234 | 6234 | } |
6235 | 6235 | } |
@@ -6247,10 +6247,10 @@ discard block |
||
6247 | 6247 | $return = ''; |
6248 | 6248 | if (is_numeric($item_id)) { |
6249 | 6249 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
6250 | - $sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp |
|
6251 | - WHERE c_id = ".$course_id." AND lp.id = " . intval($item_id); |
|
6250 | + $sql = "SELECT lp.* FROM ".$tbl_lp_item." as lp |
|
6251 | + WHERE c_id = ".$course_id." AND lp.id = ".intval($item_id); |
|
6252 | 6252 | $result = Database::query($sql); |
6253 | - while ($row = Database :: fetch_array($result,'ASSOC')) { |
|
6253 | + while ($row = Database :: fetch_array($result, 'ASSOC')) { |
|
6254 | 6254 | $_SESSION['parent_item_id'] = $row['item_type'] == 'dir' ? $item_id : 0; |
6255 | 6255 | |
6256 | 6256 | // Prevents wrong parent selection for document, see Bug#1251. |
@@ -6275,15 +6275,15 @@ discard block |
||
6275 | 6275 | $return .= $exercise->description.'<br />'; |
6276 | 6276 | $return .= Display::url( |
6277 | 6277 | get_lang('GoToExercise'), |
6278 | - api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?' . api_get_cidreq() . '&exerciseId=' . $exercise->id, |
|
6278 | + api_get_path(WEB_CODE_PATH).'exercise/overview.php?'.api_get_cidreq().'&exerciseId='.$exercise->id, |
|
6279 | 6279 | ['class' => 'btn btn-primary'] |
6280 | 6280 | ); |
6281 | 6281 | } |
6282 | 6282 | break; |
6283 | 6283 | case TOOL_DOCUMENT: |
6284 | 6284 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6285 | - $sql_doc = "SELECT path FROM " . $tbl_doc . " |
|
6286 | - WHERE c_id = ".$course_id." AND id = " . intval($row['path']); |
|
6285 | + $sql_doc = "SELECT path FROM ".$tbl_doc." |
|
6286 | + WHERE c_id = ".$course_id." AND id = ".intval($row['path']); |
|
6287 | 6287 | $result = Database::query($sql_doc); |
6288 | 6288 | $path_file = Database::result($result, 0, 0); |
6289 | 6289 | $path_parts = pathinfo($path_file); |
@@ -6329,7 +6329,7 @@ discard block |
||
6329 | 6329 | if (is_numeric($item_id)) { |
6330 | 6330 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
6331 | 6331 | $sql = "SELECT * FROM $tbl_lp_item |
6332 | - WHERE c_id = ".$course_id." AND id = " . intval($item_id); |
|
6332 | + WHERE c_id = ".$course_id." AND id = ".intval($item_id); |
|
6333 | 6333 | $res = Database::query($sql); |
6334 | 6334 | $row = Database::fetch_array($res); |
6335 | 6335 | switch ($row['item_type']) { |
@@ -6338,21 +6338,21 @@ discard block |
||
6338 | 6338 | case 'sco': |
6339 | 6339 | if (isset($_GET['view']) && $_GET['view'] == 'build') { |
6340 | 6340 | $return .= $this->display_manipulate($item_id, $row['item_type']); |
6341 | - $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row); |
|
6341 | + $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter').' :', 'edit', $item_id, $row); |
|
6342 | 6342 | } else { |
6343 | - $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row); |
|
6343 | + $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter').' :', $row); |
|
6344 | 6344 | } |
6345 | 6345 | break; |
6346 | 6346 | case TOOL_DOCUMENT: |
6347 | 6347 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6348 | 6348 | $sql = "SELECT lp.*, doc.path as dir |
6349 | - FROM " . $tbl_lp_item . " as lp |
|
6350 | - LEFT JOIN " . $tbl_doc . " as doc |
|
6349 | + FROM " . $tbl_lp_item." as lp |
|
6350 | + LEFT JOIN " . $tbl_doc." as doc |
|
6351 | 6351 | ON doc.id = lp.path |
6352 | 6352 | WHERE |
6353 | 6353 | lp.c_id = $course_id AND |
6354 | 6354 | doc.c_id = $course_id AND |
6355 | - lp.id = " . intval($item_id); |
|
6355 | + lp.id = ".intval($item_id); |
|
6356 | 6356 | $res_step = Database::query($sql); |
6357 | 6357 | $row_step = Database :: fetch_array($res_step, 'ASSOC'); |
6358 | 6358 | $return .= $this->display_manipulate($item_id, $row['item_type']); |
@@ -6362,8 +6362,8 @@ discard block |
||
6362 | 6362 | $link_id = (string) $row['path']; |
6363 | 6363 | if (ctype_digit($link_id)) { |
6364 | 6364 | $tbl_link = Database :: get_course_table(TABLE_LINK); |
6365 | - $sql_select = 'SELECT url FROM ' . $tbl_link . ' |
|
6366 | - WHERE c_id = '.$course_id.' AND id = ' . intval($link_id); |
|
6365 | + $sql_select = 'SELECT url FROM '.$tbl_link.' |
|
6366 | + WHERE c_id = '.$course_id.' AND id = '.intval($link_id); |
|
6367 | 6367 | $res_link = Database::query($sql_select); |
6368 | 6368 | $row_link = Database :: fetch_array($res_link); |
6369 | 6369 | if (is_array($row_link)) { |
@@ -6377,13 +6377,13 @@ discard block |
||
6377 | 6377 | $_SESSION['finalItem'] = true; |
6378 | 6378 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6379 | 6379 | $sql = "SELECT lp.*, doc.path as dir |
6380 | - FROM " . $tbl_lp_item . " as lp |
|
6381 | - LEFT JOIN " . $tbl_doc . " as doc |
|
6380 | + FROM " . $tbl_lp_item." as lp |
|
6381 | + LEFT JOIN " . $tbl_doc." as doc |
|
6382 | 6382 | ON doc.id = lp.path |
6383 | 6383 | WHERE |
6384 | 6384 | lp.c_id = $course_id AND |
6385 | 6385 | doc.c_id = $course_id AND |
6386 | - lp.id = " . intval($item_id); |
|
6386 | + lp.id = ".intval($item_id); |
|
6387 | 6387 | $res_step = Database::query($sql); |
6388 | 6388 | $row_step = Database :: fetch_array($res_step, 'ASSOC'); |
6389 | 6389 | $return .= $this->display_manipulate($item_id, $row['item_type']); |
@@ -6444,7 +6444,7 @@ discard block |
||
6444 | 6444 | |
6445 | 6445 | $headers = array( |
6446 | 6446 | Display::return_icon('folder_document.png', get_lang('Documents'), array(), ICON_SIZE_BIG), |
6447 | - Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG), |
|
6447 | + Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG), |
|
6448 | 6448 | Display::return_icon('links.png', get_lang('Links'), array(), ICON_SIZE_BIG), |
6449 | 6449 | Display::return_icon('works.png', get_lang('Works'), array(), ICON_SIZE_BIG), |
6450 | 6450 | Display::return_icon('forum.png', get_lang('Forums'), array(), ICON_SIZE_BIG), |
@@ -6494,16 +6494,16 @@ discard block |
||
6494 | 6494 | $course_id = api_get_course_int_id(); |
6495 | 6495 | $return = ''; |
6496 | 6496 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6497 | - $sql_doc = "SELECT * FROM " . $tbl_doc . " |
|
6498 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
6497 | + $sql_doc = "SELECT * FROM ".$tbl_doc." |
|
6498 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
6499 | 6499 | $res_doc = Database::query($sql_doc); |
6500 | 6500 | $row_doc = Database :: fetch_array($res_doc); |
6501 | 6501 | |
6502 | 6502 | // TODO: Add a path filter. |
6503 | 6503 | if ($iframe) { |
6504 | - $return .= '<iframe id="learnpath_preview_frame" frameborder="0" height="400" width="100%" scrolling="auto" src="' . api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document' . str_replace('%2F', '/', urlencode($row_doc['path'])) . '?' . api_get_cidreq() . '"></iframe>'; |
|
6504 | + $return .= '<iframe id="learnpath_preview_frame" frameborder="0" height="400" width="100%" scrolling="auto" src="'.api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.str_replace('%2F', '/', urlencode($row_doc['path'])).'?'.api_get_cidreq().'"></iframe>'; |
|
6505 | 6505 | } else { |
6506 | - $return .= file_get_contents(api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $row_doc['path']); |
|
6506 | + $return .= file_get_contents(api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row_doc['path']); |
|
6507 | 6507 | } |
6508 | 6508 | |
6509 | 6509 | return $return; |
@@ -6527,8 +6527,8 @@ discard block |
||
6527 | 6527 | $item_description = $extra_info['description']; |
6528 | 6528 | } elseif (is_numeric($extra_info)) { |
6529 | 6529 | $sql = "SELECT title, description |
6530 | - FROM " . $tbl_quiz . " |
|
6531 | - WHERE c_id = ".$course_id." AND id = " . $extra_info; |
|
6530 | + FROM " . $tbl_quiz." |
|
6531 | + WHERE c_id = ".$course_id." AND id = ".$extra_info; |
|
6532 | 6532 | |
6533 | 6533 | $result = Database::query($sql); |
6534 | 6534 | $row = Database::fetch_array($result); |
@@ -6538,21 +6538,21 @@ discard block |
||
6538 | 6538 | $item_title = ''; |
6539 | 6539 | $item_description = ''; |
6540 | 6540 | } |
6541 | - $item_title = Security::remove_XSS($item_title); |
|
6542 | - $item_description = Security::remove_XSS($item_description); |
|
6541 | + $item_title = Security::remove_XSS($item_title); |
|
6542 | + $item_description = Security::remove_XSS($item_description); |
|
6543 | 6543 | |
6544 | 6544 | if ($id != 0 && is_array($extra_info)) |
6545 | 6545 | $parent = $extra_info['parent_item_id']; |
6546 | 6546 | else |
6547 | 6547 | $parent = 0; |
6548 | 6548 | |
6549 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
6550 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
6549 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
6550 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
6551 | 6551 | |
6552 | 6552 | $result = Database::query($sql); |
6553 | - $arrLP = array (); |
|
6553 | + $arrLP = array(); |
|
6554 | 6554 | while ($row = Database :: fetch_array($result)) { |
6555 | - $arrLP[] = array ( |
|
6555 | + $arrLP[] = array( |
|
6556 | 6556 | 'id' => $row['id'], |
6557 | 6557 | 'item_type' => $row['item_type'], |
6558 | 6558 | 'title' => $row['title'], |
@@ -6574,7 +6574,7 @@ discard block |
||
6574 | 6574 | $arrLP = isset($this->arrMenu) ? $this->arrMenu : null; |
6575 | 6575 | unset ($this->arrMenu); |
6576 | 6576 | |
6577 | - $form = new FormValidator('quiz_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']); |
|
6577 | + $form = new FormValidator('quiz_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']); |
|
6578 | 6578 | $defaults = []; |
6579 | 6579 | |
6580 | 6580 | if ($action == 'add') { |
@@ -6586,7 +6586,7 @@ discard block |
||
6586 | 6586 | } |
6587 | 6587 | |
6588 | 6588 | if (isset ($_GET['edit']) && $_GET['edit'] == 'true') { |
6589 | - $legend .= Display :: return_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument')); |
|
6589 | + $legend .= Display :: return_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument')); |
|
6590 | 6590 | } |
6591 | 6591 | |
6592 | 6592 | $form->addHeader($legend); |
@@ -6605,7 +6605,7 @@ discard block |
||
6605 | 6605 | ); |
6606 | 6606 | $selectParent->addOption($this->name, 0); |
6607 | 6607 | |
6608 | - $arrHide = array ( |
|
6608 | + $arrHide = array( |
|
6609 | 6609 | $id |
6610 | 6610 | ); |
6611 | 6611 | for ($i = 0; $i < count($arrLP); $i++) { |
@@ -6618,7 +6618,7 @@ discard block |
||
6618 | 6618 | $selectParent->addOption( |
6619 | 6619 | $arrLP[$i]['title'], |
6620 | 6620 | $arrLP[$i]['id'], |
6621 | - ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px'] |
|
6621 | + ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px'] |
|
6622 | 6622 | ); |
6623 | 6623 | |
6624 | 6624 | if ($parent == $arrLP[$i]['id']) { |
@@ -6631,7 +6631,7 @@ discard block |
||
6631 | 6631 | if ($arrLP[$i]['item_type'] == 'dir') { |
6632 | 6632 | $selectParent->addOption( |
6633 | 6633 | $arrLP[$i]['title'], |
6634 | - $arrLP[$i]['id'], ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px'] |
|
6634 | + $arrLP[$i]['id'], ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px'] |
|
6635 | 6635 | ); |
6636 | 6636 | |
6637 | 6637 | if ($parent == $arrLP[$i]['id']) { |
@@ -6649,7 +6649,7 @@ discard block |
||
6649 | 6649 | |
6650 | 6650 | for ($i = 0; $i < count($arrLP); $i++) { |
6651 | 6651 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
6652 | - $selectPrevious->addOption(get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', $arrLP[$i]['id']); |
|
6652 | + $selectPrevious->addOption(get_lang('After').' "'.$arrLP[$i]['title'].'"', $arrLP[$i]['id']); |
|
6653 | 6653 | |
6654 | 6654 | if (is_array($extra_info)) { |
6655 | 6655 | if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
@@ -6671,7 +6671,7 @@ discard block |
||
6671 | 6671 | } |
6672 | 6672 | } |
6673 | 6673 | } |
6674 | - $arrHide = array (); |
|
6674 | + $arrHide = array(); |
|
6675 | 6675 | for ($i = 0; $i < count($arrLP); $i++) { |
6676 | 6676 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
6677 | 6677 | if (is_array($extra_info)) { |
@@ -6736,7 +6736,7 @@ discard block |
||
6736 | 6736 | |
6737 | 6737 | $form->setDefaults($defaults); |
6738 | 6738 | |
6739 | - return '<div class="sectioncomment">' . $form->returnForm() . '</div>'; |
|
6739 | + return '<div class="sectioncomment">'.$form->returnForm().'</div>'; |
|
6740 | 6740 | } |
6741 | 6741 | |
6742 | 6742 | /** |
@@ -6758,11 +6758,11 @@ discard block |
||
6758 | 6758 | } elseif (is_numeric($extra_info)) { |
6759 | 6759 | $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT); |
6760 | 6760 | |
6761 | - $sql = "SELECT * FROM " . $TBL_DOCUMENT . " |
|
6761 | + $sql = "SELECT * FROM ".$TBL_DOCUMENT." |
|
6762 | 6762 | WHERE |
6763 | 6763 | c_id = ".$course_id." AND |
6764 | - path LIKE '" . $uploadPath . "/%/%htm%' AND |
|
6765 | - id = " . (int) $extra_info . " |
|
6764 | + path LIKE '" . $uploadPath."/%/%htm%' AND |
|
6765 | + id = " . (int) $extra_info." |
|
6766 | 6766 | ORDER BY id ASC"; |
6767 | 6767 | |
6768 | 6768 | $res_hot = Database::query($sql); |
@@ -6786,11 +6786,11 @@ discard block |
||
6786 | 6786 | } |
6787 | 6787 | |
6788 | 6788 | $sql = "SELECT * FROM $tbl_lp_item |
6789 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
6789 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
6790 | 6790 | $result = Database::query($sql); |
6791 | - $arrLP = array (); |
|
6791 | + $arrLP = array(); |
|
6792 | 6792 | while ($row = Database :: fetch_array($result)) { |
6793 | - $arrLP[] = array ( |
|
6793 | + $arrLP[] = array( |
|
6794 | 6794 | 'id' => $row['id'], |
6795 | 6795 | 'item_type' => $row['item_type'], |
6796 | 6796 | 'title' => $row['title'], |
@@ -6827,10 +6827,10 @@ discard block |
||
6827 | 6827 | $return .= $legend; |
6828 | 6828 | $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">'; |
6829 | 6829 | $return .= '<tr>'; |
6830 | - $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . ' :</label></td>'; |
|
6830 | + $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').' :</label></td>'; |
|
6831 | 6831 | $return .= '<td class="input">'; |
6832 | 6832 | $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">'; |
6833 | - $return .= '<option class="top" value="0">' . $this->name . '</option>'; |
|
6833 | + $return .= '<option class="top" value="0">'.$this->name.'</option>'; |
|
6834 | 6834 | $arrHide = array( |
6835 | 6835 | $id |
6836 | 6836 | ); |
@@ -6839,13 +6839,13 @@ discard block |
||
6839 | 6839 | for ($i = 0; $i < count($arrLP); $i++) { |
6840 | 6840 | if ($action != 'add') { |
6841 | 6841 | if ($arrLP[$i]['item_type'] == 'dir' && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) { |
6842 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6842 | + $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>'; |
|
6843 | 6843 | } else { |
6844 | 6844 | $arrHide[] = $arrLP[$i]['id']; |
6845 | 6845 | } |
6846 | 6846 | } else { |
6847 | 6847 | if ($arrLP[$i]['item_type'] == 'dir') |
6848 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6848 | + $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>'; |
|
6849 | 6849 | } |
6850 | 6850 | } |
6851 | 6851 | reset($arrLP); |
@@ -6855,10 +6855,10 @@ discard block |
||
6855 | 6855 | $return .= '</td>'; |
6856 | 6856 | $return .= '</tr>'; |
6857 | 6857 | $return .= '<tr>'; |
6858 | - $return .= '<td class="label"><label for="previous">' . get_lang('Position') . ' :</label></td>'; |
|
6858 | + $return .= '<td class="label"><label for="previous">'.get_lang('Position').' :</label></td>'; |
|
6859 | 6859 | $return .= '<td class="input">'; |
6860 | 6860 | $return .= '<select id="previous" name="previous" size="1">'; |
6861 | - $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>'; |
|
6861 | + $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>'; |
|
6862 | 6862 | |
6863 | 6863 | for ($i = 0; $i < count($arrLP); $i++) { |
6864 | 6864 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
@@ -6868,7 +6868,7 @@ discard block |
||
6868 | 6868 | else |
6869 | 6869 | $selected = ''; |
6870 | 6870 | |
6871 | - $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
|
6871 | + $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>'; |
|
6872 | 6872 | } |
6873 | 6873 | } |
6874 | 6874 | |
@@ -6878,8 +6878,8 @@ discard block |
||
6878 | 6878 | |
6879 | 6879 | if ($action != 'move') { |
6880 | 6880 | $return .= '<tr>'; |
6881 | - $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . ' :</label></td>'; |
|
6882 | - $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>'; |
|
6881 | + $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').' :</label></td>'; |
|
6882 | + $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>'; |
|
6883 | 6883 | $return .= '</tr>'; |
6884 | 6884 | $id_prerequisite = 0; |
6885 | 6885 | if (is_array($arrLP) && count($arrLP) > 0) { |
@@ -6890,7 +6890,7 @@ discard block |
||
6890 | 6890 | } |
6891 | 6891 | } |
6892 | 6892 | |
6893 | - $arrHide = array (); |
|
6893 | + $arrHide = array(); |
|
6894 | 6894 | for ($i = 0; $i < count($arrLP); $i++) { |
6895 | 6895 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
6896 | 6896 | if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
@@ -6903,22 +6903,22 @@ discard block |
||
6903 | 6903 | } |
6904 | 6904 | |
6905 | 6905 | $return .= '<tr>'; |
6906 | - $return .= '<td> </td><td><button class="save" name="submit_button" action="edit" type="submit">' . get_lang('SaveHotpotatoes') . '</button></td>'; |
|
6906 | + $return .= '<td> </td><td><button class="save" name="submit_button" action="edit" type="submit">'.get_lang('SaveHotpotatoes').'</button></td>'; |
|
6907 | 6907 | $return .= '</tr>'; |
6908 | 6908 | $return .= '</table>'; |
6909 | 6909 | |
6910 | 6910 | if ($action == 'move') { |
6911 | - $return .= '<input name="title" type="hidden" value="' . $item_title . '" />'; |
|
6912 | - $return .= '<input name="description" type="hidden" value="' . $item_description . '" />'; |
|
6911 | + $return .= '<input name="title" type="hidden" value="'.$item_title.'" />'; |
|
6912 | + $return .= '<input name="description" type="hidden" value="'.$item_description.'" />'; |
|
6913 | 6913 | } |
6914 | 6914 | |
6915 | 6915 | if (is_numeric($extra_info)) { |
6916 | - $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />'; |
|
6916 | + $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />'; |
|
6917 | 6917 | } elseif (is_array($extra_info)) { |
6918 | - $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />'; |
|
6918 | + $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />'; |
|
6919 | 6919 | } |
6920 | - $return .= '<input name="type" type="hidden" value="' . TOOL_HOTPOTATOES . '" />'; |
|
6921 | - $return .= '<input name="post_time" type="hidden" value="' . time() . '" />'; |
|
6920 | + $return .= '<input name="type" type="hidden" value="'.TOOL_HOTPOTATOES.'" />'; |
|
6921 | + $return .= '<input name="post_time" type="hidden" value="'.time().'" />'; |
|
6922 | 6922 | $return .= '</form>'; |
6923 | 6923 | |
6924 | 6924 | return $return; |
@@ -6941,8 +6941,8 @@ discard block |
||
6941 | 6941 | $item_title = stripslashes($extra_info['title']); |
6942 | 6942 | } elseif (is_numeric($extra_info)) { |
6943 | 6943 | $sql = "SELECT forum_title as title, forum_comment as comment |
6944 | - FROM " . $tbl_forum . " |
|
6945 | - WHERE c_id = ".$course_id." AND forum_id = " . $extra_info; |
|
6944 | + FROM " . $tbl_forum." |
|
6945 | + WHERE c_id = ".$course_id." AND forum_id = ".$extra_info; |
|
6946 | 6946 | |
6947 | 6947 | $result = Database::query($sql); |
6948 | 6948 | $row = Database :: fetch_array($result); |
@@ -6960,7 +6960,7 @@ discard block |
||
6960 | 6960 | $parent = 0; |
6961 | 6961 | } |
6962 | 6962 | |
6963 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
6963 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
6964 | 6964 | WHERE |
6965 | 6965 | c_id = ".$course_id." AND |
6966 | 6966 | lp_id = " . $this->lp_id; |
@@ -6968,7 +6968,7 @@ discard block |
||
6968 | 6968 | $arrLP = array(); |
6969 | 6969 | |
6970 | 6970 | while ($row = Database :: fetch_array($result)) { |
6971 | - $arrLP[] = array ( |
|
6971 | + $arrLP[] = array( |
|
6972 | 6972 | 'id' => $row['id'], |
6973 | 6973 | 'item_type' => $row['item_type'], |
6974 | 6974 | 'title' => $row['title'], |
@@ -6997,7 +6997,7 @@ discard block |
||
6997 | 6997 | $legend = get_lang('EditCurrentForum'); |
6998 | 6998 | } |
6999 | 6999 | |
7000 | - $form = new FormValidator('forum_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']); |
|
7000 | + $form = new FormValidator('forum_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']); |
|
7001 | 7001 | $defaults = []; |
7002 | 7002 | |
7003 | 7003 | $form->addHeader($legend); |
@@ -7026,7 +7026,7 @@ discard block |
||
7026 | 7026 | $selectParent->addOption( |
7027 | 7027 | $arrLP[$i]['title'], |
7028 | 7028 | $arrLP[$i]['id'], |
7029 | - ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px'] |
|
7029 | + ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px'] |
|
7030 | 7030 | ); |
7031 | 7031 | |
7032 | 7032 | if ($parent == $arrLP[$i]['id']) { |
@@ -7040,7 +7040,7 @@ discard block |
||
7040 | 7040 | $selectParent->addOption( |
7041 | 7041 | $arrLP[$i]['title'], |
7042 | 7042 | $arrLP[$i]['id'], |
7043 | - ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px'] |
|
7043 | + ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px'] |
|
7044 | 7044 | ); |
7045 | 7045 | |
7046 | 7046 | if ($parent == $arrLP[$i]['id']) { |
@@ -7064,7 +7064,7 @@ discard block |
||
7064 | 7064 | |
7065 | 7065 | for ($i = 0; $i < count($arrLP); $i++) { |
7066 | 7066 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
7067 | - $selectPrevious->addOption(get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', $arrLP[$i]['id']); |
|
7067 | + $selectPrevious->addOption(get_lang('After').' "'.$arrLP[$i]['title'].'"', $arrLP[$i]['id']); |
|
7068 | 7068 | |
7069 | 7069 | if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
7070 | 7070 | $selectPrevious->setSelected($arrLP[$i]['id']); |
@@ -7116,7 +7116,7 @@ discard block |
||
7116 | 7116 | $form->addHidden('post_time', time()); |
7117 | 7117 | $form->setDefaults($defaults); |
7118 | 7118 | |
7119 | - return '<div class="sectioncomment">' . $form->returnForm() . '</div>'; |
|
7119 | + return '<div class="sectioncomment">'.$form->returnForm().'</div>'; |
|
7120 | 7120 | } |
7121 | 7121 | |
7122 | 7122 | /** |
@@ -7139,7 +7139,7 @@ discard block |
||
7139 | 7139 | $item_title = stripslashes($extra_info['title']); |
7140 | 7140 | } elseif (is_numeric($extra_info)) { |
7141 | 7141 | $sql = "SELECT thread_title as title FROM $tbl_forum |
7142 | - WHERE c_id = $course_id AND thread_id = " . $extra_info; |
|
7142 | + WHERE c_id = $course_id AND thread_id = ".$extra_info; |
|
7143 | 7143 | |
7144 | 7144 | $result = Database::query($sql); |
7145 | 7145 | $row = Database :: fetch_array($result); |
@@ -7157,15 +7157,15 @@ discard block |
||
7157 | 7157 | $parent = 0; |
7158 | 7158 | } |
7159 | 7159 | |
7160 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
7161 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
7160 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
7161 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
7162 | 7162 | |
7163 | 7163 | $result = Database::query($sql); |
7164 | 7164 | |
7165 | - $arrLP = array (); |
|
7165 | + $arrLP = array(); |
|
7166 | 7166 | |
7167 | 7167 | while ($row = Database :: fetch_array($result)) { |
7168 | - $arrLP[] = array ( |
|
7168 | + $arrLP[] = array( |
|
7169 | 7169 | 'id' => $row['id'], |
7170 | 7170 | 'item_type' => $row['item_type'], |
7171 | 7171 | 'title' => $row['title'], |
@@ -7186,7 +7186,7 @@ discard block |
||
7186 | 7186 | $arrLP = isset($this->arrMenu) ? $this->arrMenu : null; |
7187 | 7187 | unset ($this->arrMenu); |
7188 | 7188 | |
7189 | - $form = new FormValidator('thread_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']); |
|
7189 | + $form = new FormValidator('thread_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']); |
|
7190 | 7190 | $defaults = []; |
7191 | 7191 | |
7192 | 7192 | if ($action == 'add') { |
@@ -7206,7 +7206,7 @@ discard block |
||
7206 | 7206 | ); |
7207 | 7207 | $selectParent->addOption($this->name, 0); |
7208 | 7208 | |
7209 | - $arrHide = array ( |
|
7209 | + $arrHide = array( |
|
7210 | 7210 | $id |
7211 | 7211 | ); |
7212 | 7212 | |
@@ -7220,7 +7220,7 @@ discard block |
||
7220 | 7220 | $selectParent->addOption( |
7221 | 7221 | $arrLP[$i]['title'], |
7222 | 7222 | $arrLP[$i]['id'], |
7223 | - ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px'] |
|
7223 | + ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px'] |
|
7224 | 7224 | ); |
7225 | 7225 | |
7226 | 7226 | if ($parent == $arrLP[$i]['id']) { |
@@ -7234,7 +7234,7 @@ discard block |
||
7234 | 7234 | $selectParent->addOption( |
7235 | 7235 | $arrLP[$i]['title'], |
7236 | 7236 | $arrLP[$i]['id'], |
7237 | - ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px'] |
|
7237 | + ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px'] |
|
7238 | 7238 | ); |
7239 | 7239 | |
7240 | 7240 | if ($parent == $arrLP[$i]['id']) { |
@@ -7254,7 +7254,7 @@ discard block |
||
7254 | 7254 | for ($i = 0; $i < count($arrLP); $i++) { |
7255 | 7255 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
7256 | 7256 | $selectPrevious->addOption( |
7257 | - get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', |
|
7257 | + get_lang('After').' "'.$arrLP[$i]['title'].'"', |
|
7258 | 7258 | $arrLP[$i]['id'] |
7259 | 7259 | ); |
7260 | 7260 | |
@@ -7354,8 +7354,8 @@ discard block |
||
7354 | 7354 | if ($id != 0 && is_array($extra_info)) { |
7355 | 7355 | $item_title = $extra_info['title']; |
7356 | 7356 | $item_description = $extra_info['description']; |
7357 | - $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']); |
|
7358 | - $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']); |
|
7357 | + $item_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/scorm/'.$this->path.'/'.stripslashes($extra_info['path']); |
|
7358 | + $item_path_fck = '/scorm/'.$this->path.'/'.stripslashes($extra_info['path']); |
|
7359 | 7359 | } else { |
7360 | 7360 | $item_title = ''; |
7361 | 7361 | $item_description = ''; |
@@ -7369,17 +7369,17 @@ discard block |
||
7369 | 7369 | } |
7370 | 7370 | |
7371 | 7371 | $id = intval($id); |
7372 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
7372 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
7373 | 7373 | WHERE |
7374 | 7374 | c_id = ".$course_id." AND |
7375 | - lp_id = " . $this->lp_id . " AND |
|
7375 | + lp_id = " . $this->lp_id." AND |
|
7376 | 7376 | id != $id"; |
7377 | 7377 | |
7378 | 7378 | if ($item_type == 'dir') |
7379 | 7379 | $sql .= " AND parent_item_id = 0"; |
7380 | 7380 | |
7381 | 7381 | $result = Database::query($sql); |
7382 | - $arrLP = array (); |
|
7382 | + $arrLP = array(); |
|
7383 | 7383 | |
7384 | 7384 | while ($row = Database :: fetch_array($result)) { |
7385 | 7385 | $arrLP[] = array( |
@@ -7404,9 +7404,9 @@ discard block |
||
7404 | 7404 | unset($this->arrMenu); |
7405 | 7405 | |
7406 | 7406 | $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null; |
7407 | - $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id; |
|
7407 | + $url = api_get_self().'?'.api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id; |
|
7408 | 7408 | |
7409 | - $form = new FormValidator('form', 'POST', $url); |
|
7409 | + $form = new FormValidator('form', 'POST', $url); |
|
7410 | 7410 | |
7411 | 7411 | $defaults['title'] = api_html_entity_decode($item_title, ENT_QUOTES, $charset); |
7412 | 7412 | $defaults['description'] = $item_description; |
@@ -7449,7 +7449,7 @@ discard block |
||
7449 | 7449 | $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', array('id' => 'idParent', 'onchange' => "javascript: load_cbo(this.value);")); |
7450 | 7450 | |
7451 | 7451 | foreach ($arrHide as $key => $value) { |
7452 | - $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"'); |
|
7452 | + $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"'); |
|
7453 | 7453 | } |
7454 | 7454 | if (!empty($s_selected_parent)) { |
7455 | 7455 | $parent_select->setSelected($s_selected_parent); |
@@ -7471,16 +7471,16 @@ discard block |
||
7471 | 7471 | $s_selected_position = $arrLP[$i]['id']; |
7472 | 7472 | } |
7473 | 7473 | |
7474 | - $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"'; |
|
7474 | + $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"'; |
|
7475 | 7475 | } |
7476 | 7476 | } |
7477 | 7477 | |
7478 | 7478 | $position = $form->addElement('select', 'previous', get_lang('Position'), '', array('id' => 'previous')); |
7479 | 7479 | $padding = isset($value['padding']) ? $value['padding'] : 0; |
7480 | - $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:' . $padding . 'px;"'); |
|
7480 | + $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:'.$padding.'px;"'); |
|
7481 | 7481 | |
7482 | 7482 | foreach ($arrHide as $key => $value) { |
7483 | - $position->addOption($value['value'] . '"', $key, 'style="padding-left:' . $padding . 'px;"'); |
|
7483 | + $position->addOption($value['value'].'"', $key, 'style="padding-left:'.$padding.'px;"'); |
|
7484 | 7484 | } |
7485 | 7485 | |
7486 | 7486 | if (!empty ($s_selected_position)) { |
@@ -7507,7 +7507,7 @@ discard block |
||
7507 | 7507 | //$item_type == 'asset' || |
7508 | 7508 | if (($item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) { |
7509 | 7509 | if ($item_type == 'sco') { |
7510 | - $form->addElement('html', '<script>alert("' . get_lang('WarningWhenEditingScorm') . '")</script>'); |
|
7510 | + $form->addElement('html', '<script>alert("'.get_lang('WarningWhenEditingScorm').'")</script>'); |
|
7511 | 7511 | } |
7512 | 7512 | $renderer = $form->defaultRenderer(); |
7513 | 7513 | $renderer->setElementTemplate('<br /> {label}<br />{element}', 'content_lp'); |
@@ -7567,8 +7567,8 @@ discard block |
||
7567 | 7567 | // We don't display the document form if it's not an editable document (html or txt file). |
7568 | 7568 | if ($action == "add") { |
7569 | 7569 | if (is_numeric($extra_info)) { |
7570 | - $sql_doc = "SELECT path FROM " . $tbl_doc . " |
|
7571 | - WHERE c_id = ".$course_id." AND id = " . intval($extra_info); |
|
7570 | + $sql_doc = "SELECT path FROM ".$tbl_doc." |
|
7571 | + WHERE c_id = ".$course_id." AND id = ".intval($extra_info); |
|
7572 | 7572 | $result = Database::query($sql_doc); |
7573 | 7573 | $path_file = Database :: result($result, 0, 0); |
7574 | 7574 | $path_parts = pathinfo($path_file); |
@@ -7586,13 +7586,13 @@ discard block |
||
7586 | 7586 | $item_title = stripslashes($path_parts['filename']); |
7587 | 7587 | } |
7588 | 7588 | } elseif (is_numeric($extra_info)) { |
7589 | - $sql_doc = "SELECT path, title FROM " . $tbl_doc . " |
|
7589 | + $sql_doc = "SELECT path, title FROM ".$tbl_doc." |
|
7590 | 7590 | WHERE |
7591 | 7591 | c_id = ".$course_id." AND |
7592 | 7592 | id = " . intval($extra_info); |
7593 | 7593 | |
7594 | 7594 | $result = Database::query($sql_doc); |
7595 | - $row = Database::fetch_array($result); |
|
7595 | + $row = Database::fetch_array($result); |
|
7596 | 7596 | $item_title = $row['title']; |
7597 | 7597 | $item_title = str_replace('_', ' ', $item_title); |
7598 | 7598 | if (empty ($item_title)) { |
@@ -7615,7 +7615,7 @@ discard block |
||
7615 | 7615 | WHERE c_id = $course_id AND lp_id = ".$this->lp_id; |
7616 | 7616 | |
7617 | 7617 | $result = Database::query($sql); |
7618 | - $arrLP = array (); |
|
7618 | + $arrLP = array(); |
|
7619 | 7619 | while ($row = Database :: fetch_array($result)) { |
7620 | 7620 | $arrLP[] = array( |
7621 | 7621 | 'id' => $row['id'], |
@@ -7649,9 +7649,9 @@ discard block |
||
7649 | 7649 | $return .= '</legend>'; |
7650 | 7650 | |
7651 | 7651 | if (isset ($_GET['edit']) && $_GET['edit'] == 'true') { |
7652 | - $return .= Display :: return_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false); |
|
7652 | + $return .= Display :: return_message('<strong>'.get_lang('Warning').' !</strong><br />'.get_lang('WarningEditingDocument'), false); |
|
7653 | 7653 | } |
7654 | - $form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data")); |
|
7654 | + $form = new FormValidator('form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data")); |
|
7655 | 7655 | $defaults['title'] = Security :: remove_XSS($item_title); |
7656 | 7656 | if (empty($item_title)) { |
7657 | 7657 | $defaults['title'] = Security::remove_XSS($item_title); |
@@ -7707,15 +7707,15 @@ discard block |
||
7707 | 7707 | } |
7708 | 7708 | |
7709 | 7709 | $parent_select = $form->addSelect('parent', get_lang('Parent'), [], ['id' => 'idParent', 'onchange' => 'javascript: load_cbo(this.value);']); |
7710 | - $my_count=0; |
|
7710 | + $my_count = 0; |
|
7711 | 7711 | foreach ($arrHide as $key => $value) { |
7712 | - if ($my_count!=0) { |
|
7712 | + if ($my_count != 0) { |
|
7713 | 7713 | // The LP name is also the first section and is not in the same charset like the other sections. |
7714 | 7714 | $value['value'] = Security :: remove_XSS($value['value']); |
7715 | - $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"'); |
|
7715 | + $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"'); |
|
7716 | 7716 | } else { |
7717 | 7717 | $value['value'] = Security :: remove_XSS($value['value']); |
7718 | - $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"'); |
|
7718 | + $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"'); |
|
7719 | 7719 | } |
7720 | 7720 | $my_count++; |
7721 | 7721 | } |
@@ -7723,7 +7723,7 @@ discard block |
||
7723 | 7723 | if (!empty($id)) { |
7724 | 7724 | $parent_select->setSelected($parent); |
7725 | 7725 | } else { |
7726 | - $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0 ; |
|
7726 | + $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0; |
|
7727 | 7727 | $parent_select->setSelected($parent_item_id); |
7728 | 7728 | } |
7729 | 7729 | |
@@ -7740,7 +7740,7 @@ discard block |
||
7740 | 7740 | if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'] || $action == 'add') { |
7741 | 7741 | $s_selected_position = $arrLP[$i]['id']; |
7742 | 7742 | } |
7743 | - $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"'; |
|
7743 | + $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"'; |
|
7744 | 7744 | } |
7745 | 7745 | } |
7746 | 7746 | |
@@ -7748,8 +7748,8 @@ discard block |
||
7748 | 7748 | $position->addOption(get_lang('FirstPosition'), 0); |
7749 | 7749 | |
7750 | 7750 | foreach ($arrHide as $key => $value) { |
7751 | - $padding = isset($value['padding']) ? $value['padding']: 20; |
|
7752 | - $position->addOption($value['value'], $key, 'style="padding-left:' . $padding . 'px;"'); |
|
7751 | + $padding = isset($value['padding']) ? $value['padding'] : 20; |
|
7752 | + $position->addOption($value['value'], $key, 'style="padding-left:'.$padding.'px;"'); |
|
7753 | 7753 | } |
7754 | 7754 | |
7755 | 7755 | $position->setSelected($s_selected_position); |
@@ -7819,7 +7819,7 @@ discard block |
||
7819 | 7819 | $relative_path = array_slice($relative_path, 1, $cnt); |
7820 | 7820 | $relative_path = implode('/', $relative_path); |
7821 | 7821 | if (strlen($relative_path) > 0) { |
7822 | - $relative_path = $relative_path . '/'; |
|
7822 | + $relative_path = $relative_path.'/'; |
|
7823 | 7823 | } |
7824 | 7824 | } else { |
7825 | 7825 | $result = $this->generate_lp_folder($_course); |
@@ -7901,8 +7901,8 @@ discard block |
||
7901 | 7901 | $item_url = stripslashes($extra_info['url']); |
7902 | 7902 | } elseif (is_numeric($extra_info)) { |
7903 | 7903 | $extra_info = intval($extra_info); |
7904 | - $sql = "SELECT title, description, url FROM " . $tbl_link . " |
|
7905 | - WHERE c_id = ".$course_id." AND id = " . $extra_info; |
|
7904 | + $sql = "SELECT title, description, url FROM ".$tbl_link." |
|
7905 | + WHERE c_id = ".$course_id." AND id = ".$extra_info; |
|
7906 | 7906 | $result = Database::query($sql); |
7907 | 7907 | $row = Database :: fetch_array($result); |
7908 | 7908 | $item_title = $row['title']; |
@@ -7914,7 +7914,7 @@ discard block |
||
7914 | 7914 | $item_url = ''; |
7915 | 7915 | } |
7916 | 7916 | |
7917 | - $form = new FormValidator('edit_link', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']); |
|
7917 | + $form = new FormValidator('edit_link', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']); |
|
7918 | 7918 | $defaults = []; |
7919 | 7919 | |
7920 | 7920 | if ($id != 0 && is_array($extra_info)) { |
@@ -7923,8 +7923,8 @@ discard block |
||
7923 | 7923 | $parent = 0; |
7924 | 7924 | } |
7925 | 7925 | |
7926 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
7927 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
7926 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
7927 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
7928 | 7928 | $result = Database::query($sql); |
7929 | 7929 | $arrLP = array(); |
7930 | 7930 | |
@@ -7988,7 +7988,7 @@ discard block |
||
7988 | 7988 | $selectParent->addOption( |
7989 | 7989 | $arrLP[$i]['title'], |
7990 | 7990 | $arrLP[$i]['id'], |
7991 | - ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px;'] |
|
7991 | + ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px;'] |
|
7992 | 7992 | ); |
7993 | 7993 | |
7994 | 7994 | if ($parent == $arrLP[$i]['id']) { |
@@ -8002,7 +8002,7 @@ discard block |
||
8002 | 8002 | $selectParent->addOption( |
8003 | 8003 | $arrLP[$i]['title'], |
8004 | 8004 | $arrLP[$i]['id'], |
8005 | - ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px'] |
|
8005 | + ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px'] |
|
8006 | 8006 | ); |
8007 | 8007 | |
8008 | 8008 | if ($parent_item_id == $arrLP[$i]['id']) { |
@@ -8089,7 +8089,7 @@ discard block |
||
8089 | 8089 | |
8090 | 8090 | $form->setDefaults($defaults); |
8091 | 8091 | |
8092 | - return '<div class="sectioncomment">' . $form->returnForm() . '</div>'; |
|
8092 | + return '<div class="sectioncomment">'.$form->returnForm().'</div>'; |
|
8093 | 8093 | } |
8094 | 8094 | |
8095 | 8095 | /** |
@@ -8111,8 +8111,8 @@ discard block |
||
8111 | 8111 | } elseif (is_numeric($extra_info)) { |
8112 | 8112 | $extra_info = intval($extra_info); |
8113 | 8113 | $sql = "SELECT title, description |
8114 | - FROM " . $tbl_publication . " |
|
8115 | - WHERE c_id = ".$course_id." AND id = " . $extra_info; |
|
8114 | + FROM " . $tbl_publication." |
|
8115 | + WHERE c_id = ".$course_id." AND id = ".$extra_info; |
|
8116 | 8116 | |
8117 | 8117 | $result = Database::query($sql); |
8118 | 8118 | $row = Database :: fetch_array($result); |
@@ -8128,8 +8128,8 @@ discard block |
||
8128 | 8128 | $parent = 0; |
8129 | 8129 | } |
8130 | 8130 | |
8131 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
8132 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
8131 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
8132 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
8133 | 8133 | |
8134 | 8134 | $result = Database::query($sql); |
8135 | 8135 | $arrLP = array(); |
@@ -8194,7 +8194,7 @@ discard block |
||
8194 | 8194 | $parentSelect->addOption( |
8195 | 8195 | $arrLP[$i]['title'], |
8196 | 8196 | $arrLP[$i]['id'], |
8197 | - ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;'] |
|
8197 | + ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;'] |
|
8198 | 8198 | ); |
8199 | 8199 | |
8200 | 8200 | if ($parent == $arrLP[$i]['id']) { |
@@ -8208,7 +8208,7 @@ discard block |
||
8208 | 8208 | $parentSelect->addOption( |
8209 | 8209 | $arrLP[$i]['title'], |
8210 | 8210 | $arrLP[$i]['id'], |
8211 | - ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;'] |
|
8211 | + ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;'] |
|
8212 | 8212 | ); |
8213 | 8213 | |
8214 | 8214 | if ($parent == $arrLP[$i]['id']) { |
@@ -8232,7 +8232,7 @@ discard block |
||
8232 | 8232 | for ($i = 0; $i < count($arrLP); $i++) { |
8233 | 8233 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
8234 | 8234 | $previousSelect->addOption( |
8235 | - get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', |
|
8235 | + get_lang('After').' "'.$arrLP[$i]['title'].'"', |
|
8236 | 8236 | $arrLP[$i]['id'] |
8237 | 8237 | ); |
8238 | 8238 | |
@@ -8254,7 +8254,7 @@ discard block |
||
8254 | 8254 | } |
8255 | 8255 | } |
8256 | 8256 | } |
8257 | - $arrHide = array (); |
|
8257 | + $arrHide = array(); |
|
8258 | 8258 | for ($i = 0; $i < count($arrLP); $i++) { |
8259 | 8259 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
8260 | 8260 | if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
@@ -8334,8 +8334,8 @@ discard block |
||
8334 | 8334 | |
8335 | 8335 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
8336 | 8336 | $item_id = intval($item_id); |
8337 | - $sql = "SELECT * FROM " . $tbl_lp_item . " as lp |
|
8338 | - WHERE lp.c_id = ".$course_id." AND lp.id = " . $item_id; |
|
8337 | + $sql = "SELECT * FROM ".$tbl_lp_item." as lp |
|
8338 | + WHERE lp.c_id = ".$course_id." AND lp.id = ".$item_id; |
|
8339 | 8339 | $result = Database::query($sql); |
8340 | 8340 | $row = Database::fetch_assoc($result); |
8341 | 8341 | |
@@ -8349,16 +8349,16 @@ discard block |
||
8349 | 8349 | $audio_player .= '<script> |
8350 | 8350 | var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF"); |
8351 | 8351 | s1.addParam("allowscriptaccess","always"); |
8352 | - s1.addParam("flashvars","file=../..'.api_get_path(REL_COURSE_PATH).$_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=true"); |
|
8352 | + s1.addParam("flashvars","file=../..'.api_get_path(REL_COURSE_PATH).$_course['path'].'/document/audio/'.$row['audio'].'&autostart=true"); |
|
8353 | 8353 | s1.write("container"); |
8354 | 8354 | </script>'; |
8355 | 8355 | } |
8356 | 8356 | |
8357 | - $url = api_get_self().'?cidReq='.api_get_cidreq().'&view=build&id='.$item_id .'&lp_id='.$this->lp_id; |
|
8357 | + $url = api_get_self().'?cidReq='.api_get_cidreq().'&view=build&id='.$item_id.'&lp_id='.$this->lp_id; |
|
8358 | 8358 | |
8359 | 8359 | $return .= Display::url( |
8360 | 8360 | Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), |
8361 | - $url.'&action=edit_item&path_item=' . $row['path'] |
|
8361 | + $url.'&action=edit_item&path_item='.$row['path'] |
|
8362 | 8362 | ); |
8363 | 8363 | |
8364 | 8364 | $return .= Display::url( |
@@ -8378,7 +8378,7 @@ discard block |
||
8378 | 8378 | $url.'&action=delete_item' |
8379 | 8379 | ); |
8380 | 8380 | |
8381 | - if ($item_type == TOOL_HOTPOTATOES ) { |
|
8381 | + if ($item_type == TOOL_HOTPOTATOES) { |
|
8382 | 8382 | $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code); |
8383 | 8383 | $return .= get_lang('File').': '.$document_data['absolute_path_from_document']; |
8384 | 8384 | } |
@@ -8404,13 +8404,13 @@ discard block |
||
8404 | 8404 | public function get_js_dropdown_array() |
8405 | 8405 | { |
8406 | 8406 | $course_id = api_get_course_int_id(); |
8407 | - $return = 'var child_name = new Array();' . "\n"; |
|
8408 | - $return .= 'var child_value = new Array();' . "\n\n"; |
|
8409 | - $return .= 'child_name[0] = new Array();' . "\n"; |
|
8410 | - $return .= 'child_value[0] = new Array();' . "\n\n"; |
|
8407 | + $return = 'var child_name = new Array();'."\n"; |
|
8408 | + $return .= 'var child_value = new Array();'."\n\n"; |
|
8409 | + $return .= 'child_name[0] = new Array();'."\n"; |
|
8410 | + $return .= 'child_value[0] = new Array();'."\n\n"; |
|
8411 | 8411 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
8412 | - $sql_zero = "SELECT * FROM " . $tbl_lp_item . " |
|
8413 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id . " AND parent_item_id = 0 |
|
8412 | + $sql_zero = "SELECT * FROM ".$tbl_lp_item." |
|
8413 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id." AND parent_item_id = 0 |
|
8414 | 8414 | ORDER BY display_order ASC"; |
8415 | 8415 | $res_zero = Database::query($sql_zero); |
8416 | 8416 | $i = 0; |
@@ -8421,29 +8421,29 @@ discard block |
||
8421 | 8421 | $row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']); |
8422 | 8422 | } |
8423 | 8423 | $js_var = json_encode(get_lang('After').' '.$row_zero['title']); |
8424 | - $return .= 'child_name[0][' . $i . '] = '.$js_var.' ;' . "\n"; |
|
8425 | - $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n"; |
|
8424 | + $return .= 'child_name[0]['.$i.'] = '.$js_var.' ;'."\n"; |
|
8425 | + $return .= 'child_value[0]['.$i++.'] = "'.$row_zero['id'].'";'."\n"; |
|
8426 | 8426 | } |
8427 | 8427 | } |
8428 | 8428 | $return .= "\n"; |
8429 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
8430 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
8429 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
8430 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
8431 | 8431 | $res = Database::query($sql); |
8432 | 8432 | while ($row = Database :: fetch_array($res)) { |
8433 | - $sql_parent = "SELECT * FROM " . $tbl_lp_item . " |
|
8433 | + $sql_parent = "SELECT * FROM ".$tbl_lp_item." |
|
8434 | 8434 | WHERE |
8435 | 8435 | c_id = ".$course_id." AND |
8436 | - parent_item_id = " . $row['id'] . " |
|
8436 | + parent_item_id = " . $row['id']." |
|
8437 | 8437 | ORDER BY display_order ASC"; |
8438 | 8438 | $res_parent = Database::query($sql_parent); |
8439 | 8439 | $i = 0; |
8440 | - $return .= 'child_name[' . $row['id'] . '] = new Array();' . "\n"; |
|
8441 | - $return .= 'child_value[' . $row['id'] . '] = new Array();' . "\n\n"; |
|
8440 | + $return .= 'child_name['.$row['id'].'] = new Array();'."\n"; |
|
8441 | + $return .= 'child_value['.$row['id'].'] = new Array();'."\n\n"; |
|
8442 | 8442 | |
8443 | 8443 | while ($row_parent = Database :: fetch_array($res_parent)) { |
8444 | 8444 | $js_var = json_encode(get_lang('After').' '.$row_parent['title']); |
8445 | - $return .= 'child_name[' . $row['id'] . '][' . $i . '] = '.$js_var.' ;' . "\n"; |
|
8446 | - $return .= 'child_value[' . $row['id'] . '][' . $i++ . '] = "' . $row_parent['id'] . '";' . "\n"; |
|
8445 | + $return .= 'child_name['.$row['id'].']['.$i.'] = '.$js_var.' ;'."\n"; |
|
8446 | + $return .= 'child_value['.$row['id'].']['.$i++.'] = "'.$row_parent['id'].'";'."\n"; |
|
8447 | 8447 | } |
8448 | 8448 | $return .= "\n"; |
8449 | 8449 | } |
@@ -8464,8 +8464,8 @@ discard block |
||
8464 | 8464 | if (is_numeric($item_id)) { |
8465 | 8465 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
8466 | 8466 | |
8467 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
8468 | - WHERE c_id = ".$course_id." AND id = " . $item_id; |
|
8467 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
8468 | + WHERE c_id = ".$course_id." AND id = ".$item_id; |
|
8469 | 8469 | |
8470 | 8470 | $res = Database::query($sql); |
8471 | 8471 | $row = Database :: fetch_array($res); |
@@ -8519,7 +8519,7 @@ discard block |
||
8519 | 8519 | */ |
8520 | 8520 | public function display_item_small_form($item_type, $title = '', $data = array()) |
8521 | 8521 | { |
8522 | - $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id; |
|
8522 | + $url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id; |
|
8523 | 8523 | $form = new FormValidator('small_form', 'post', $url); |
8524 | 8524 | $form->addElement('header', $title); |
8525 | 8525 | $form->addElement('text', 'title', get_lang('Title')); |
@@ -8545,7 +8545,7 @@ discard block |
||
8545 | 8545 | $item_id = intval($item_id); |
8546 | 8546 | /* Current prerequisite */ |
8547 | 8547 | $sql = "SELECT * FROM $tbl_lp_item |
8548 | - WHERE c_id = $course_id AND id = " . $item_id; |
|
8548 | + WHERE c_id = $course_id AND id = ".$item_id; |
|
8549 | 8549 | $result = Database::query($sql); |
8550 | 8550 | $row = Database::fetch_array($result); |
8551 | 8551 | $prerequisiteId = $row['prerequisite']; |
@@ -8555,20 +8555,20 @@ discard block |
||
8555 | 8555 | $return .= '<form method="POST">'; |
8556 | 8556 | $return .= '<table class="data_table">'; |
8557 | 8557 | $return .= '<tr>'; |
8558 | - $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>'; |
|
8559 | - $return .= '<th width="70" >' . get_lang('Minimum') . '</th>'; |
|
8560 | - $return .= '<th width="70">' . get_lang('Maximum') . '</th>'; |
|
8558 | + $return .= '<th height="24">'.get_lang('LearnpathPrerequisites').'</th>'; |
|
8559 | + $return .= '<th width="70" >'.get_lang('Minimum').'</th>'; |
|
8560 | + $return .= '<th width="70">'.get_lang('Maximum').'</th>'; |
|
8561 | 8561 | $return .= '</tr>'; |
8562 | 8562 | |
8563 | 8563 | // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146 |
8564 | 8564 | $return .= '<tr >'; |
8565 | 8565 | $return .= '<td colspan="3" class="radio">'; |
8566 | 8566 | $return .= '<input checked="checked" id="idNone" name="prerequisites" style="margin-left:0px; margin-right:10px;" type="radio" />'; |
8567 | - $return .= '<label for="idNone">' . get_lang('None') . '</label>'; |
|
8567 | + $return .= '<label for="idNone">'.get_lang('None').'</label>'; |
|
8568 | 8568 | $return .= '</tr>'; |
8569 | 8569 | |
8570 | 8570 | $sql = "SELECT * FROM $tbl_lp_item |
8571 | - WHERE c_id = $course_id AND lp_id = " . $this->lp_id; |
|
8571 | + WHERE c_id = $course_id AND lp_id = ".$this->lp_id; |
|
8572 | 8572 | $result = Database::query($sql); |
8573 | 8573 | $arrLP = array(); |
8574 | 8574 | |
@@ -8611,25 +8611,25 @@ discard block |
||
8611 | 8611 | } |
8612 | 8612 | |
8613 | 8613 | $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score']; |
8614 | - $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']]: 0; |
|
8614 | + $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0; |
|
8615 | 8615 | |
8616 | 8616 | $return .= '<tr>'; |
8617 | - $return .= '<td class="radio"' . (($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . '>'; |
|
8618 | - $return .= '<label for="id' . $item['id'] . '">'; |
|
8619 | - $return .= '<input' . (in_array($prerequisiteId, array($item['id'], $item['ref'])) ? ' checked="checked" ' : '') . ($item['item_type'] == 'dir' ? ' disabled="disabled" ' : ' ') . 'id="id' . $item['id'] . '" name="prerequisites" style="margin-left:' . $item['depth'] * 10 . 'px; margin-right:10px;" type="radio" value="' . $item['id'] . '" />'; |
|
8617 | + $return .= '<td class="radio"'.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>'; |
|
8618 | + $return .= '<label for="id'.$item['id'].'">'; |
|
8619 | + $return .= '<input'.(in_array($prerequisiteId, array($item['id'], $item['ref'])) ? ' checked="checked" ' : '').($item['item_type'] == 'dir' ? ' disabled="disabled" ' : ' ').'id="id'.$item['id'].'" name="prerequisites" style="margin-left:'.$item['depth'] * 10.'px; margin-right:10px;" type="radio" value="'.$item['id'].'" />'; |
|
8620 | 8620 | $icon_name = str_replace(' ', '', $item['item_type']); |
8621 | 8621 | |
8622 | - if (file_exists('../img/lp_' . $icon_name . '.png')) { |
|
8623 | - $return .= Display::return_icon('lp_' . $icon_name . '.png'); |
|
8622 | + if (file_exists('../img/lp_'.$icon_name.'.png')) { |
|
8623 | + $return .= Display::return_icon('lp_'.$icon_name.'.png'); |
|
8624 | 8624 | } else { |
8625 | - if (file_exists('../img/lp_' . $icon_name . '.gif')) { |
|
8626 | - $return .= Display::return_icon('lp_' . $icon_name . '.gif'); |
|
8625 | + if (file_exists('../img/lp_'.$icon_name.'.gif')) { |
|
8626 | + $return .= Display::return_icon('lp_'.$icon_name.'.gif'); |
|
8627 | 8627 | } else { |
8628 | - $return .= Display::return_icon('folder_document.gif','',array('style'=>'margin-right:5px;')); |
|
8628 | + $return .= Display::return_icon('folder_document.gif', '', array('style'=>'margin-right:5px;')); |
|
8629 | 8629 | } |
8630 | 8630 | } |
8631 | 8631 | |
8632 | - $return .= $item['title'] . '</label>'; |
|
8632 | + $return .= $item['title'].'</label>'; |
|
8633 | 8633 | $return .= '</td>'; |
8634 | 8634 | |
8635 | 8635 | if ($item['item_type'] == TOOL_QUIZ) { |
@@ -8643,19 +8643,19 @@ discard block |
||
8643 | 8643 | $item['max_score'] = $tmp_obj_lp_item->max_score; |
8644 | 8644 | |
8645 | 8645 | $return .= '<td class="exercise">'; |
8646 | - $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue. '" />'; |
|
8646 | + $return .= '<input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" />'; |
|
8647 | 8647 | $return .= '</td>'; |
8648 | 8648 | $return .= '<td class="exercise">'; |
8649 | - $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMaxScoreValue . '" />'; |
|
8649 | + $return .= '<input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" />'; |
|
8650 | 8650 | $return .= '</td>'; |
8651 | 8651 | } |
8652 | 8652 | |
8653 | 8653 | if ($item['item_type'] == TOOL_HOTPOTATOES) { |
8654 | 8654 | $return .= '<td class="exercise">'; |
8655 | - $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue . '" /></center>'; |
|
8655 | + $return .= '<center><input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" /></center>'; |
|
8656 | 8656 | $return .= '</td>'; |
8657 | 8657 | $return .= '<td class="exercise"">'; |
8658 | - $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue . '" /></center>'; |
|
8658 | + $return .= '<center><input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" /></center>'; |
|
8659 | 8659 | $return .= '</td>'; |
8660 | 8660 | } |
8661 | 8661 | $return .= '</tr>'; |
@@ -8664,7 +8664,7 @@ discard block |
||
8664 | 8664 | $return .= '</tr>'; |
8665 | 8665 | $return .= '</table>'; |
8666 | 8666 | $return .= '<div style="padding-top:3px;">'; |
8667 | - $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>'; |
|
8667 | + $return .= '<button class="btn btn-primary" name="submit_button" type="submit">'.get_lang('ModifyPrerequisites').'</button>'; |
|
8668 | 8668 | $return .= '</form>'; |
8669 | 8669 | |
8670 | 8670 | return $return; |
@@ -8700,7 +8700,7 @@ discard block |
||
8700 | 8700 | if ($row['id'] == $lp_id) { |
8701 | 8701 | continue; |
8702 | 8702 | } |
8703 | - $return .= '<option value="'.$row['id'].'" '.(($row['id']==$prerequisiteId)?' selected ' : '').'>'.$row['name'].'</option>'; |
|
8703 | + $return .= '<option value="'.$row['id'].'" '.(($row['id'] == $prerequisiteId) ? ' selected ' : '').'>'.$row['name'].'</option>'; |
|
8704 | 8704 | } |
8705 | 8705 | } |
8706 | 8706 | $return .= '</select>'; |
@@ -8808,8 +8808,8 @@ discard block |
||
8808 | 8808 | WHERE c_id = $course_id AND $activeCondition $condition_session |
8809 | 8809 | ORDER BY title ASC"; |
8810 | 8810 | |
8811 | - $sql_hot = "SELECT * FROM $tbl_doc |
|
8812 | - WHERE c_id = $course_id AND path LIKE '" . $uploadPath . "/%/%htm%' $condition_session |
|
8811 | + $sql_hot = "SELECT * FROM $tbl_doc |
|
8812 | + WHERE c_id = $course_id AND path LIKE '".$uploadPath."/%/%htm%' $condition_session |
|
8813 | 8813 | ORDER BY id ASC"; |
8814 | 8814 | |
8815 | 8815 | $res_quiz = Database::query($sql_quiz); |
@@ -8819,8 +8819,8 @@ discard block |
||
8819 | 8819 | |
8820 | 8820 | $return .= '<li class="lp_resource_element">'; |
8821 | 8821 | $return .= Display::return_icon('new_exercice.png'); |
8822 | - $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercise/exercise_admin.php?'.api_get_cidreq().'&lp_id=' . $this->lp_id . '">' . |
|
8823 | - get_lang('NewExercise') . '</a>'; |
|
8822 | + $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/exercise_admin.php?'.api_get_cidreq().'&lp_id='.$this->lp_id.'">'. |
|
8823 | + get_lang('NewExercise').'</a>'; |
|
8824 | 8824 | $return .= '</li>'; |
8825 | 8825 | |
8826 | 8826 | // Display hotpotatoes |
@@ -8830,8 +8830,8 @@ discard block |
||
8830 | 8830 | $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY); |
8831 | 8831 | $return .= '</a> '; |
8832 | 8832 | $return .= Display::return_icon('hotpotatoes_s.png'); |
8833 | - $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq().'&action=add_item&type=' . TOOL_HOTPOTATOES . '&file=' . $row_hot['id'] . '&lp_id=' . $this->lp_id . '">'. |
|
8834 | - ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . '</a>'; |
|
8833 | + $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_HOTPOTATOES.'&file='.$row_hot['id'].'&lp_id='.$this->lp_id.'">'. |
|
8834 | + ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])).'</a>'; |
|
8835 | 8835 | $return .= '</li>'; |
8836 | 8836 | } |
8837 | 8837 | |
@@ -8841,7 +8841,7 @@ discard block |
||
8841 | 8841 | $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY); |
8842 | 8842 | $return .= '</a> '; |
8843 | 8843 | $return .= Display::return_icon('quizz_small.gif', '', array(), ICON_SIZE_TINY); |
8844 | - $return .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_QUIZ . '&file=' . $row_quiz['id'] . '&lp_id=' . $this->lp_id . '">' . |
|
8844 | + $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'. |
|
8845 | 8845 | Security :: remove_XSS(cut($row_quiz['title'], 80)). |
8846 | 8846 | '</a>'; |
8847 | 8847 | |
@@ -8922,7 +8922,7 @@ discard block |
||
8922 | 8922 | ['target' => '_blank'] |
8923 | 8923 | ); |
8924 | 8924 | |
8925 | - if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) { |
|
8925 | + if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) { |
|
8926 | 8926 | $linkNodes .= |
8927 | 8927 | '<li class="lp_resource_element" data_id="'.$key.'" data_type="'.TOOL_LINK.'" title="'.$title.'" > |
8928 | 8928 | <a class="moved" href="#">'. |
@@ -8960,8 +8960,8 @@ discard block |
||
8960 | 8960 | $return = '<ul class="lp_resource">'; |
8961 | 8961 | $return .= '<li class="lp_resource_element">'; |
8962 | 8962 | $return .= Display::return_icon('works_new.gif'); |
8963 | - $return .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&lp_id=' . $this->lp_id . '">' . |
|
8964 | - get_lang('AddAssignmentPage') . '</a>'; |
|
8963 | + $return .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&lp_id='.$this->lp_id.'">'. |
|
8964 | + get_lang('AddAssignmentPage').'</a>'; |
|
8965 | 8965 | $return .= '</li>'; |
8966 | 8966 | $sessionId = api_get_session_id(); |
8967 | 8967 | |
@@ -8983,7 +8983,7 @@ discard block |
||
8983 | 8983 | $return .= '</a> '; |
8984 | 8984 | |
8985 | 8985 | $return .= Display::return_icon('works.gif'); |
8986 | - $return .= ' <a class="moved" href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&file=' . $work['iid'] . '&lp_id=' . $this->lp_id . '">' . |
|
8986 | + $return .= ' <a class="moved" href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&file='.$work['iid'].'&lp_id='.$this->lp_id.'">'. |
|
8987 | 8987 | Security :: remove_XSS(cut(strip_tags($work['title']), 80)).' '.$link.' |
8988 | 8988 | </a>'; |
8989 | 8989 | |
@@ -9043,7 +9043,7 @@ discard block |
||
9043 | 9043 | $return .= Display::return_icon('new_forum.png'); |
9044 | 9044 | $return .= Display::url( |
9045 | 9045 | get_lang('CreateANewForum'), |
9046 | - api_get_path(WEB_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&' . http_build_query([ |
|
9046 | + api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&'.http_build_query([ |
|
9047 | 9047 | 'action' => 'add', |
9048 | 9048 | 'content' => 'forum', |
9049 | 9049 | 'lp_id' => $this->lp_id |
@@ -9077,15 +9077,15 @@ discard block |
||
9077 | 9077 | $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY); |
9078 | 9078 | $return .= ' </a>'; |
9079 | 9079 | $return .= Display::return_icon('lp_forum.png', '', array(), ICON_SIZE_TINY); |
9080 | - $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle"> |
|
9081 | - <img src="' . Display::returnIconPath('add.gif').'" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" /> |
|
9080 | + $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum('.$forum['forum_id'].')" style="vertical-align:middle"> |
|
9081 | + <img src="' . Display::returnIconPath('add.gif').'" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" /> |
|
9082 | 9082 | </a> |
9083 | - <a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_FORUM . '&forum_id=' . $forum['forum_id'] . '&lp_id=' . $this->lp_id . '" style="vertical-align:middle">' . |
|
9084 | - Security :: remove_XSS($forum['forum_title']) . '</a>'; |
|
9083 | + <a href="' . api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_FORUM.'&forum_id='.$forum['forum_id'].'&lp_id='.$this->lp_id.'" style="vertical-align:middle">'. |
|
9084 | + Security :: remove_XSS($forum['forum_title']).'</a>'; |
|
9085 | 9085 | |
9086 | 9086 | $return .= '</li>'; |
9087 | 9087 | |
9088 | - $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">'; |
|
9088 | + $return .= '<div style="display:none" id="forum_'.$forum['forum_id'].'_content">'; |
|
9089 | 9089 | $a_threads = get_threads($forum['forum_id']); |
9090 | 9090 | if (is_array($a_threads)) { |
9091 | 9091 | foreach ($a_threads as $thread) { |
@@ -9100,8 +9100,8 @@ discard block |
||
9100 | 9100 | $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY); |
9101 | 9101 | $return .= ' </a>'; |
9102 | 9102 | $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY); |
9103 | - $return .= '<a class="moved" href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type=' . TOOL_THREAD . '&thread_id=' . $thread['thread_id'] . '&lp_id=' . $this->lp_id . '">' . |
|
9104 | - Security :: remove_XSS($thread['thread_title']) . ' '.$link.'</a>'; |
|
9103 | + $return .= '<a class="moved" href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_THREAD.'&thread_id='.$thread['thread_id'].'&lp_id='.$this->lp_id.'">'. |
|
9104 | + Security :: remove_XSS($thread['thread_title']).' '.$link.'</a>'; |
|
9105 | 9105 | $return .= '</li>'; |
9106 | 9106 | } |
9107 | 9107 | } |
@@ -9172,7 +9172,7 @@ discard block |
||
9172 | 9172 | if (is_dir($current_course_path.'/scorm/'.$this->path) && is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')) { |
9173 | 9173 | // Remove the possible . at the end of the path. |
9174 | 9174 | $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path; |
9175 | - $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp); |
|
9175 | + $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir.'/scorm/'.$dest_path_to_lp); |
|
9176 | 9176 | mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true); |
9177 | 9177 | copyr( |
9178 | 9178 | $current_course_path.'/scorm/'.$this->path, |
@@ -9247,7 +9247,7 @@ discard block |
||
9247 | 9247 | if ($item->type === 'sco') { |
9248 | 9248 | $inc_docs = $item->get_resources_from_source( |
9249 | 9249 | null, |
9250 | - api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path() |
|
9250 | + api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path() |
|
9251 | 9251 | ); |
9252 | 9252 | } else { |
9253 | 9253 | $inc_docs = $item->get_resources_from_source(); |
@@ -9468,7 +9468,7 @@ discard block |
||
9468 | 9468 | $file_path = substr($file_path, strlen($current_dir)); // We get the relative path. |
9469 | 9469 | $zip_files[] = $my_sub_dir.'/'.$file_path; |
9470 | 9470 | $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); |
9471 | - $my_dep_file->setAttribute('href','document/'.$file_path); |
|
9471 | + $my_dep_file->setAttribute('href', 'document/'.$file_path); |
|
9472 | 9472 | $my_dep->setAttribute('xml:base', ''); |
9473 | 9473 | } |
9474 | 9474 | } |
@@ -9599,7 +9599,7 @@ discard block |
||
9599 | 9599 | //$my_item->appendChild($my_max_score); |
9600 | 9600 | // Give a child element <adlcp:prerequisites> to the <item> element. |
9601 | 9601 | $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string()); |
9602 | - $my_prereqs->setAttribute('type','aicc_script'); |
|
9602 | + $my_prereqs->setAttribute('type', 'aicc_script'); |
|
9603 | 9603 | $my_item->appendChild($my_prereqs); |
9604 | 9604 | // Give a child element <adlcp:masteryscore> to the <item> element. |
9605 | 9605 | $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score()); |
@@ -9664,7 +9664,7 @@ discard block |
||
9664 | 9664 | $my_resource->appendChild($my_file); |
9665 | 9665 | |
9666 | 9666 | // Get included docs. |
9667 | - $inc_docs = $item->get_resources_from_source(null,$tmp_file_path); |
|
9667 | + $inc_docs = $item->get_resources_from_source(null, $tmp_file_path); |
|
9668 | 9668 | // Dependency to other files - not yet supported. |
9669 | 9669 | $i = 1; |
9670 | 9670 | foreach ($inc_docs as $doc_info) { |
@@ -9723,7 +9723,7 @@ discard block |
||
9723 | 9723 | $my_dep_file->setAttribute('href', $file_path); |
9724 | 9724 | $my_dep->setAttribute('xml:base', ''); |
9725 | 9725 | |
9726 | - if (strstr($file_path,$main_path) !== false) { |
|
9726 | + if (strstr($file_path, $main_path) !== false) { |
|
9727 | 9727 | // The calculated real path is really inside the chamilo root path. |
9728 | 9728 | // Reduce file path to what's under the DocumentRoot. |
9729 | 9729 | $file_path = substr($file_path, strlen($root_path)); |
@@ -9741,7 +9741,7 @@ discard block |
||
9741 | 9741 | $file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0]; |
9742 | 9742 | $file_path = str_replace('//', '/', $file_path); |
9743 | 9743 | if (file_exists($file_path)) { |
9744 | - $file_path = substr($file_path,strlen($current_dir)); // We get the relative path. |
|
9744 | + $file_path = substr($file_path, strlen($current_dir)); // We get the relative path. |
|
9745 | 9745 | $zip_files[] = $my_sub_dir.'/'.$file_path; |
9746 | 9746 | $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); |
9747 | 9747 | $my_dep_file->setAttribute('href', 'document/'.$file_path); |
@@ -9964,7 +9964,7 @@ discard block |
||
9964 | 9964 | file_put_contents($archive_path.$temp_dir_short.'/document/non_exportable.html', $file_content); |
9965 | 9965 | |
9966 | 9966 | // Add the extra files that go along with a SCORM package. |
9967 | - $main_code_path = api_get_path(SYS_CODE_PATH) . 'lp/packaging/'; |
|
9967 | + $main_code_path = api_get_path(SYS_CODE_PATH).'lp/packaging/'; |
|
9968 | 9968 | |
9969 | 9969 | $fs = new Filesystem(); |
9970 | 9970 | $fs->mirror($main_code_path, $archive_path.$temp_dir_short); |
@@ -10019,7 +10019,7 @@ discard block |
||
10019 | 10019 | } |
10020 | 10020 | $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path']; |
10021 | 10021 | if (file_exists($file_path)) { |
10022 | - $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path); |
|
10022 | + $files_to_export[] = array('title'=>$item->get_title(), 'path'=>$file_path); |
|
10023 | 10023 | } |
10024 | 10024 | break; |
10025 | 10025 | case 'asset': //commes from a scorm package generated by chamilo |
@@ -10057,12 +10057,12 @@ discard block |
||
10057 | 10057 | |
10058 | 10058 | foreach ($path_bits as $bit) { |
10059 | 10059 | if (!empty ($bit)) { |
10060 | - $new_path = $path_built . $bit; |
|
10060 | + $new_path = $path_built.$bit; |
|
10061 | 10061 | if (is_dir($new_path)) { |
10062 | - $path_built = $new_path . '/'; |
|
10062 | + $path_built = $new_path.'/'; |
|
10063 | 10063 | } else { |
10064 | 10064 | mkdir($new_path, api_get_permissions_for_new_directories()); |
10065 | - $path_built = $new_path . '/'; |
|
10065 | + $path_built = $new_path.'/'; |
|
10066 | 10066 | } |
10067 | 10067 | } |
10068 | 10068 | } |
@@ -10103,9 +10103,9 @@ discard block |
||
10103 | 10103 | |
10104 | 10104 | if ($upload_ok) { |
10105 | 10105 | if ($has_attachment) { |
10106 | - $courseDir = api_get_course_path() . '/upload/learning_path/images'; |
|
10106 | + $courseDir = api_get_course_path().'/upload/learning_path/images'; |
|
10107 | 10107 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
10108 | - $updir = $sys_course_path . $courseDir; |
|
10108 | + $updir = $sys_course_path.$courseDir; |
|
10109 | 10109 | // Try to add an extension to the file if it hasn't one. |
10110 | 10110 | $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']); |
10111 | 10111 | |
@@ -10158,7 +10158,7 @@ discard block |
||
10158 | 10158 | //Setting my lp_id to autolaunch = 1 |
10159 | 10159 | $attributes['autolaunch'] = 1; |
10160 | 10160 | $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id)); |
10161 | - Database::update($lp_table, $attributes, $where ); |
|
10161 | + Database::update($lp_table, $attributes, $where); |
|
10162 | 10162 | } |
10163 | 10163 | } |
10164 | 10164 | |
@@ -10177,13 +10177,13 @@ discard block |
||
10177 | 10177 | |
10178 | 10178 | // Get the max order of the items |
10179 | 10179 | $sql = "SELECT max(display_order) AS display_order FROM $table_lp_item |
10180 | - WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "'"; |
|
10180 | + WHERE c_id = $course_id AND lp_id = '".$this->lp_id."'"; |
|
10181 | 10181 | $rs_max_order = Database::query($sql); |
10182 | 10182 | $row_max_order = Database::fetch_object($rs_max_order); |
10183 | 10183 | $max_order = $row_max_order->display_order; |
10184 | 10184 | // Get the previous item ID |
10185 | 10185 | $sql = "SELECT id as previous FROM $table_lp_item |
10186 | - WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "' AND display_order = '".$max_order."' "; |
|
10186 | + WHERE c_id = $course_id AND lp_id = '".$this->lp_id."' AND display_order = '".$max_order."' "; |
|
10187 | 10187 | $rs_max = Database::query($sql); |
10188 | 10188 | $row_max = Database::fetch_object($rs_max); |
10189 | 10189 | |
@@ -10233,9 +10233,9 @@ discard block |
||
10233 | 10233 | $documents_total_space = DocumentManager::documents_total_space(); |
10234 | 10234 | $course_max_space = DocumentManager::get_course_quota(); |
10235 | 10235 | $total_size = filesize($s) + $documents_total_space; |
10236 | - if (filesize($s)>$post_max || filesize($s)>$upl_max || $total_size>$course_max_space ){ |
|
10236 | + if (filesize($s) > $post_max || filesize($s) > $upl_max || $total_size > $course_max_space) { |
|
10237 | 10237 | return true; |
10238 | - } else{ |
|
10238 | + } else { |
|
10239 | 10239 | return false; |
10240 | 10240 | } |
10241 | 10241 | } |
@@ -10583,7 +10583,7 @@ discard block |
||
10583 | 10583 | if ($this->debug > 0) { |
10584 | 10584 | error_log('New LP - In learnpath::set_subscribe_users()', 0); |
10585 | 10585 | } |
10586 | - $this->subscribeUsers = intval($value);; |
|
10586 | + $this->subscribeUsers = intval($value); ; |
|
10587 | 10587 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
10588 | 10588 | $lp_id = $this->get_id(); |
10589 | 10589 | $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers." |
@@ -10926,7 +10926,7 @@ discard block |
||
10926 | 10926 | */ |
10927 | 10927 | public function createForum($forumCategoryId) |
10928 | 10928 | { |
10929 | - require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php'; |
|
10929 | + require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php'; |
|
10930 | 10930 | |
10931 | 10931 | $forumId = store_forum( |
10932 | 10932 | [ |
@@ -10974,7 +10974,7 @@ discard block |
||
10974 | 10974 | */ |
10975 | 10975 | private function getFinalItemTemplate() |
10976 | 10976 | { |
10977 | - return file_get_contents(api_get_path(SYS_CODE_PATH) . 'lp/final_item_template/template.html'); |
|
10977 | + return file_get_contents(api_get_path(SYS_CODE_PATH).'lp/final_item_template/template.html'); |
|
10978 | 10978 | } |
10979 | 10979 | |
10980 | 10980 | /** |
@@ -11020,11 +11020,11 @@ discard block |
||
11020 | 11020 | 'Height' => '500', |
11021 | 11021 | 'FullPage' => true, |
11022 | 11022 | 'CreateDocumentDir' => $relative_prefix, |
11023 | - 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/', |
|
11024 | - 'BaseHref' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/' . $relative_path |
|
11023 | + 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/', |
|
11024 | + 'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path |
|
11025 | 11025 | ]; |
11026 | 11026 | |
11027 | - $url = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ |
|
11027 | + $url = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ |
|
11028 | 11028 | 'type' => 'document', |
11029 | 11029 | 'lp_id' => $this->lp_id |
11030 | 11030 | ]); |
@@ -11192,8 +11192,8 @@ discard block |
||
11192 | 11192 | $sql = "SELECT * FROM $item_view_table |
11193 | 11193 | WHERE |
11194 | 11194 | c_id = $course_id AND |
11195 | - lp_item_id = " . $row_item['id'] . " AND |
|
11196 | - lp_view_id = " . $lpViewId . " |
|
11195 | + lp_item_id = ".$row_item['id']." AND |
|
11196 | + lp_view_id = " . $lpViewId." |
|
11197 | 11197 | ORDER BY view_count DESC"; |
11198 | 11198 | $learnpathItemViewResult = Database::query($sql); |
11199 | 11199 | $learnpathItemViewData = Database::fetch_array($learnpathItemViewResult, 'ASSOC'); |
@@ -11211,7 +11211,7 @@ discard block |
||
11211 | 11211 | |
11212 | 11212 | switch ($type) { |
11213 | 11213 | case 'dir': |
11214 | - $link .= $main_dir_path . 'lp/blank.php'; |
|
11214 | + $link .= $main_dir_path.'lp/blank.php'; |
|
11215 | 11215 | case TOOL_CALENDAR_EVENT: |
11216 | 11216 | $link .= $main_dir_path.'calendar/agenda.php?origin='.$origin.'&agenda_id='.$id; |
11217 | 11217 | break; |
@@ -11229,12 +11229,12 @@ discard block |
||
11229 | 11229 | if (!empty($id)) { |
11230 | 11230 | $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
11231 | 11231 | $sql = "SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"; |
11232 | - $result= Database::query($sql); |
|
11232 | + $result = Database::query($sql); |
|
11233 | 11233 | $myrow = Database::fetch_array($result); |
11234 | 11234 | if ($row_item['title'] != '') { |
11235 | 11235 | $myrow['title'] = $row_item['title']; |
11236 | 11236 | } |
11237 | - $link .= $main_dir_path . 'exercise/overview.php?cidReq='.$course_code.'&session_id='.$session_id.'&lp_init=1&origin='.$origin.'&learnpath_item_view_id='.$learnpathItemViewId.'&learnpath_id='.$learningPathId.'&learnpath_item_id='.$id_in_path.'&exerciseId='.$id; |
|
11237 | + $link .= $main_dir_path.'exercise/overview.php?cidReq='.$course_code.'&session_id='.$session_id.'&lp_init=1&origin='.$origin.'&learnpath_item_view_id='.$learnpathItemViewId.'&learnpath_id='.$learningPathId.'&learnpath_item_id='.$id_in_path.'&exerciseId='.$id; |
|
11238 | 11238 | } |
11239 | 11239 | break; |
11240 | 11240 | case 'hotpotatoes': //lowercase because of strtolower above |
@@ -11242,7 +11242,7 @@ discard block |
||
11242 | 11242 | $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE c_id = $course_id AND id=$id"); |
11243 | 11243 | $myrow = Database::fetch_array($result); |
11244 | 11244 | $path = $myrow['path']; |
11245 | - $link .= $main_dir_path . 'exercise/showinframes.php?file='.$path.'&origin='.$origin.'&cid='.$course_code.'&uid='.api_get_user_id().'' . |
|
11245 | + $link .= $main_dir_path.'exercise/showinframes.php?file='.$path.'&origin='.$origin.'&cid='.$course_code.'&uid='.api_get_user_id().''. |
|
11246 | 11246 | '&learnpath_id='.$learningPathId.'&learnpath_item_id='.$id_in_path.'&lp_view_id='.$lpViewId; |
11247 | 11247 | break; |
11248 | 11248 | case TOOL_FORUM: |
@@ -11254,7 +11254,7 @@ discard block |
||
11254 | 11254 | $sql = "SELECT * FROM $tbl_topics WHERE c_id = $course_id AND thread_id=$id"; |
11255 | 11255 | $result = Database::query($sql); |
11256 | 11256 | $myrow = Database::fetch_array($result); |
11257 | - $link .= $main_dir_path.'forum/viewthread.php?origin=learnpath&thread='.$id.'' . |
|
11257 | + $link .= $main_dir_path.'forum/viewthread.php?origin=learnpath&thread='.$id.''. |
|
11258 | 11258 | '&forum='.$myrow['forum_id'].'&lp=true'; |
11259 | 11259 | } |
11260 | 11260 | break; |
@@ -11262,8 +11262,8 @@ discard block |
||
11262 | 11262 | $tbl_post = Database::get_course_table(TABLE_FORUM_POST); |
11263 | 11263 | $result = Database::query("SELECT * FROM $tbl_post WHERE c_id = $course_id AND post_id=$id"); |
11264 | 11264 | $myrow = Database::fetch_array($result); |
11265 | - $link .= $main_dir_path.'forum/viewthread.php?post='.$id.'' . |
|
11266 | - '&thread='.$myrow['thread_id'].'&forum='.$myrow['forum_id'].'' . |
|
11265 | + $link .= $main_dir_path.'forum/viewthread.php?post='.$id.''. |
|
11266 | + '&thread='.$myrow['thread_id'].'&forum='.$myrow['forum_id'].''. |
|
11267 | 11267 | '&lp=true'; |
11268 | 11268 | break; |
11269 | 11269 | case TOOL_DOCUMENT: |
@@ -11281,9 +11281,9 @@ discard block |
||
11281 | 11281 | $showDirectUrl = !in_array($extension, $jplayer_supported_files); |
11282 | 11282 | |
11283 | 11283 | if ($showDirectUrl) { |
11284 | - $link = $main_course_path . 'document' . $document->getPath() . '?' . api_get_cidreq(); |
|
11284 | + $link = $main_course_path.'document'.$document->getPath().'?'.api_get_cidreq(); |
|
11285 | 11285 | } else { |
11286 | - $link = api_get_path(WEB_CODE_PATH) . 'document/showinframes.php?' . http_build_query([ |
|
11286 | + $link = api_get_path(WEB_CODE_PATH).'document/showinframes.php?'.http_build_query([ |
|
11287 | 11287 | 'cidReq' => $course_code, |
11288 | 11288 | 'id' => $id, |
11289 | 11289 | 'origin' => 'learnpathitem' |
@@ -11292,11 +11292,11 @@ discard block |
||
11292 | 11292 | |
11293 | 11293 | $openmethod = 2; |
11294 | 11294 | $officedoc = false; |
11295 | - Session::write('openmethod',$openmethod); |
|
11296 | - Session::write('officedoc',$officedoc); |
|
11295 | + Session::write('openmethod', $openmethod); |
|
11296 | + Session::write('officedoc', $officedoc); |
|
11297 | 11297 | break; |
11298 | 11298 | case TOOL_LP_FINAL_ITEM: |
11299 | - $link .= api_get_path(WEB_CODE_PATH) . 'lp/lp_final_item.php?'.api_get_cidreq().'&id='.$id.'&lp_id='.$learningPathId; |
|
11299 | + $link .= api_get_path(WEB_CODE_PATH).'lp/lp_final_item.php?'.api_get_cidreq().'&id='.$id.'&lp_id='.$learningPathId; |
|
11300 | 11300 | break; |
11301 | 11301 | case 'assignments': |
11302 | 11302 | $link .= $main_dir_path.'work/work.php?origin='.$origin; |
@@ -544,17 +544,17 @@ discard block |
||
544 | 544 | if (isset($_REQUEST['activate_start_date_check']) && |
545 | 545 | $_REQUEST['activate_start_date_check'] == 1 |
546 | 546 | ) { |
547 | - $publicated_on = $_REQUEST['publicated_on']; |
|
547 | + $publicated_on = $_REQUEST['publicated_on']; |
|
548 | 548 | } else { |
549 | - $publicated_on = null; |
|
549 | + $publicated_on = null; |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | if (isset($_REQUEST['activate_end_date_check']) && |
553 | 553 | $_REQUEST['activate_end_date_check'] == 1 |
554 | 554 | ) { |
555 | - $expired_on = $_REQUEST['expired_on']; |
|
555 | + $expired_on = $_REQUEST['expired_on']; |
|
556 | 556 | } else { |
557 | - $expired_on = null; |
|
557 | + $expired_on = null; |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | $new_lp_id = learnpath::add_lp( |
@@ -958,9 +958,9 @@ discard block |
||
958 | 958 | $_SESSION['oLP']->setAccumulateScormTime($accumulateScormTime); |
959 | 959 | |
960 | 960 | if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) { |
961 | - $publicated_on = $_REQUEST['publicated_on']; |
|
961 | + $publicated_on = $_REQUEST['publicated_on']; |
|
962 | 962 | } else { |
963 | - $publicated_on = null; |
|
963 | + $publicated_on = null; |
|
964 | 964 | } |
965 | 965 | |
966 | 966 | if (isset($_REQUEST['activate_end_date_check']) && $_REQUEST['activate_end_date_check'] == 1) { |
@@ -1178,7 +1178,7 @@ discard block |
||
1178 | 1178 | } elseif ($mode == 'embedded') { |
1179 | 1179 | $_SESSION['oLP']->mode = 'embedded'; |
1180 | 1180 | } elseif ($mode == 'embedframe') { |
1181 | - $_SESSION['oLP']->mode = 'embedframe'; |
|
1181 | + $_SESSION['oLP']->mode = 'embedframe'; |
|
1182 | 1182 | } elseif ($mode == 'impress') { |
1183 | 1183 | $_SESSION['oLP']->mode = 'impress'; |
1184 | 1184 | } |
@@ -1219,10 +1219,10 @@ discard block |
||
1219 | 1219 | require 'lp_list.php'; |
1220 | 1220 | break; |
1221 | 1221 | */ |
1222 | - case 'switch_attempt_mode': |
|
1223 | - if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; } |
|
1224 | - $_SESSION['refresh'] = 1; |
|
1225 | - $_SESSION['oLP']->switch_attempt_mode(); |
|
1222 | + case 'switch_attempt_mode': |
|
1223 | + if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; } |
|
1224 | + $_SESSION['refresh'] = 1; |
|
1225 | + $_SESSION['oLP']->switch_attempt_mode(); |
|
1226 | 1226 | require 'lp_list.php'; |
1227 | 1227 | break; |
1228 | 1228 | case 'switch_scorm_debug': |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | // Including the global initialization file. |
27 | 27 | require_once '../inc/global.inc.php'; |
28 | -$current_course_tool = TOOL_LEARNPATH; |
|
28 | +$current_course_tool = TOOL_LEARNPATH; |
|
29 | 29 | $_course = api_get_course_info(); |
30 | 30 | |
31 | 31 | $glossaryExtraTools = api_get_setting('show_glossary_in_extra_tools'); |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | ) { |
38 | 38 | $htmlHeadXtra[] = '<script> |
39 | 39 | <!-- |
40 | - var jQueryFrameReadyConfigPath = \'' . api_get_jquery_web_path() . '\'; |
|
40 | + var jQueryFrameReadyConfigPath = \'' . api_get_jquery_web_path().'\'; |
|
41 | 41 | --> |
42 | 42 | </script>'; |
43 | - $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>'; |
|
44 | - $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>'; |
|
43 | + $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>'; |
|
44 | + $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>'; |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | |
247 | 247 | $course_id = api_get_course_int_id(); |
248 | 248 | |
249 | -if ($debug>0) error_log('New LP - Passed data remains check', 0); |
|
249 | +if ($debug > 0) error_log('New LP - Passed data remains check', 0); |
|
250 | 250 | |
251 | 251 | if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) { |
252 | 252 | if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | if (Database::num_rows($res)) { |
271 | 271 | $row = Database::fetch_array($res); |
272 | 272 | $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); |
|
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); |
|
274 | 274 | switch ($type) { |
275 | 275 | case 1: |
276 | 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); |
@@ -697,8 +697,8 @@ discard block |
||
697 | 697 | $editPrerequisite = $_SESSION['oLP']->edit_item_prereq( |
698 | 698 | $_GET['id'], |
699 | 699 | $_POST['prerequisites'], |
700 | - $_POST['min_' . $_POST['prerequisites']], |
|
701 | - $_POST['max_' . $_POST['prerequisites']] |
|
700 | + $_POST['min_'.$_POST['prerequisites']], |
|
701 | + $_POST['max_'.$_POST['prerequisites']] |
|
702 | 702 | ); |
703 | 703 | |
704 | 704 | if ($editPrerequisite) { |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | $_SESSION['oLP']->setAccumulateScormTime($accumulateScormTime); |
959 | 959 | |
960 | 960 | if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) { |
961 | - $publicated_on = $_REQUEST['publicated_on']; |
|
961 | + $publicated_on = $_REQUEST['publicated_on']; |
|
962 | 962 | } else { |
963 | 963 | $publicated_on = null; |
964 | 964 | } |
@@ -1136,8 +1136,8 @@ discard block |
||
1136 | 1136 | error_log('New LP - No learnpath given for view', 0); |
1137 | 1137 | require 'lp_list.php'; |
1138 | 1138 | } else { |
1139 | - if ($debug > 0) {error_log('New LP - Trying to set current item to ' . $_REQUEST['item_id'], 0); } |
|
1140 | - if ( !empty($_REQUEST['item_id']) ) { |
|
1139 | + if ($debug > 0) {error_log('New LP - Trying to set current item to '.$_REQUEST['item_id'], 0); } |
|
1140 | + if (!empty($_REQUEST['item_id'])) { |
|
1141 | 1141 | $_SESSION['oLP']->set_current_item($_REQUEST['item_id']); |
1142 | 1142 | } |
1143 | 1143 | require 'lp_view.php'; |
@@ -1220,7 +1220,7 @@ discard block |
||
1220 | 1220 | break; |
1221 | 1221 | */ |
1222 | 1222 | case 'switch_attempt_mode': |
1223 | - if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; } |
|
1223 | + if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; } |
|
1224 | 1224 | $_SESSION['refresh'] = 1; |
1225 | 1225 | $_SESSION['oLP']->switch_attempt_mode(); |
1226 | 1226 | require 'lp_list.php'; |
@@ -1265,8 +1265,8 @@ discard block |
||
1265 | 1265 | error_log('New LP - No learnpath given for view', 0); |
1266 | 1266 | require 'lp_list.php'; |
1267 | 1267 | } else { |
1268 | - if ($debug > 0) {error_log('New LP - Trying to impress this LP item to ' . $_REQUEST['item_id'], 0); } |
|
1269 | - if (!empty($_REQUEST['item_id']) ) { |
|
1268 | + if ($debug > 0) {error_log('New LP - Trying to impress this LP item to '.$_REQUEST['item_id'], 0); } |
|
1269 | + if (!empty($_REQUEST['item_id'])) { |
|
1270 | 1270 | $_SESSION['oLP']->set_current_item($_REQUEST['item_id']); |
1271 | 1271 | } |
1272 | 1272 | require 'lp_impress.php'; |
@@ -1327,7 +1327,7 @@ discard block |
||
1327 | 1327 | $_SESSION['oLP']->lp_session_id |
1328 | 1328 | ); |
1329 | 1329 | |
1330 | - $forumCategoryId = !empty($forumCategory) ? $forumCategory['cat_id']: 0; |
|
1330 | + $forumCategoryId = !empty($forumCategory) ? $forumCategory['cat_id'] : 0; |
|
1331 | 1331 | |
1332 | 1332 | if (empty($forumCategoryId)) { |
1333 | 1333 | $forumCategoryId = store_forumcategory( |
@@ -1359,7 +1359,7 @@ discard block |
||
1359 | 1359 | } |
1360 | 1360 | } |
1361 | 1361 | |
1362 | - header('Location:' . api_get_self() . '?' . http_build_query([ |
|
1362 | + header('Location:'.api_get_self().'?'.http_build_query([ |
|
1363 | 1363 | 'action' => 'add_item', |
1364 | 1364 | 'type' => 'step', |
1365 | 1365 | 'lp_id' => $_SESSION['oLP']->lp_id |
@@ -1401,7 +1401,7 @@ discard block |
||
1401 | 1401 | } |
1402 | 1402 | } |
1403 | 1403 | |
1404 | - header('Location:' . api_get_self() . '?' . http_build_query([ |
|
1404 | + header('Location:'.api_get_self().'?'.http_build_query([ |
|
1405 | 1405 | 'action' => 'add_item', |
1406 | 1406 | 'type' => 'step', |
1407 | 1407 | 'lp_id' => $_SESSION['oLP']->lp_id |
@@ -1423,7 +1423,7 @@ discard block |
||
1423 | 1423 | |
1424 | 1424 | $_SESSION['oLP']->getFinalItemForm(); |
1425 | 1425 | |
1426 | - $redirectTo = api_get_self() . '?' . http_build_query([ |
|
1426 | + $redirectTo = api_get_self().'?'.http_build_query([ |
|
1427 | 1427 | 'action' => 'add_item', |
1428 | 1428 | 'type' => 'step', |
1429 | 1429 | 'lp_id' => intval($_SESSION['oLP']->lp_id) |
@@ -14,7 +14,9 @@ discard block |
||
14 | 14 | $use_anonymous = true; |
15 | 15 | |
16 | 16 | $debug = 0; |
17 | -if ($debug > 0) error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0); |
|
17 | +if ($debug > 0) { |
|
18 | + error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0); |
|
19 | +} |
|
18 | 20 | |
19 | 21 | // Language files that needs to be included. |
20 | 22 | if (isset($_GET['action'])) { |
@@ -210,10 +212,14 @@ discard block |
||
210 | 212 | // If refresh is set, we regenerate the oLP object from the database (kind of flush). |
211 | 213 | Session::erase('refresh'); |
212 | 214 | $myrefresh = 1; |
213 | - if ($debug > 0) error_log('New LP - Refresh asked', 0); |
|
214 | -} |
|
215 | + if ($debug > 0) { |
|
216 | + error_log('New LP - Refresh asked', 0); |
|
217 | + } |
|
218 | + } |
|
215 | 219 | |
216 | -if ($debug > 0) error_log('New LP - Passed refresh check', 0); |
|
220 | +if ($debug > 0) { |
|
221 | + error_log('New LP - Passed refresh check', 0); |
|
222 | +} |
|
217 | 223 | |
218 | 224 | if (!empty($_REQUEST['dialog_box'])) { |
219 | 225 | $dialog_box = stripslashes(urldecode($_REQUEST['dialog_box'])); |
@@ -223,17 +229,23 @@ discard block |
||
223 | 229 | $lp_found = false; |
224 | 230 | |
225 | 231 | if (isset($_SESSION['lpobject'])) { |
226 | - if ($debug > 0) error_log('New LP - SESSION[lpobject] is defined', 0); |
|
232 | + if ($debug > 0) { |
|
233 | + error_log('New LP - SESSION[lpobject] is defined', 0); |
|
234 | + } |
|
227 | 235 | $oLP = unserialize($_SESSION['lpobject']); |
228 | 236 | if (isset($oLP) && is_object($oLP)) { |
229 | - if ($debug > 0) error_log('New LP - oLP is object', 0); |
|
237 | + if ($debug > 0) { |
|
238 | + error_log('New LP - oLP is object', 0); |
|
239 | + } |
|
230 | 240 | if ($myrefresh == 1 || |
231 | 241 | empty($oLP->cc) || |
232 | 242 | $oLP->cc != api_get_course_id() || |
233 | 243 | $oLP->lp_view_session_id != $session_id || |
234 | 244 | $oLP->scorm_debug == '1' |
235 | 245 | ) { |
236 | - if ($debug > 0) error_log('New LP - Course has changed, discard lp object', 0); |
|
246 | + if ($debug > 0) { |
|
247 | + error_log('New LP - Course has changed, discard lp object', 0); |
|
248 | + } |
|
237 | 249 | if ($myrefresh == 1) { $myrefresh_id = $oLP->get_id(); } |
238 | 250 | $oLP = null; |
239 | 251 | Session::erase('oLP'); |
@@ -247,13 +259,19 @@ discard block |
||
247 | 259 | |
248 | 260 | $course_id = api_get_course_int_id(); |
249 | 261 | |
250 | -if ($debug>0) error_log('New LP - Passed data remains check', 0); |
|
262 | +if ($debug>0) { |
|
263 | + error_log('New LP - Passed data remains check', 0); |
|
264 | +} |
|
251 | 265 | |
252 | 266 | if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) { |
253 | - if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0); |
|
267 | + if ($debug > 0) { |
|
268 | + error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0); |
|
269 | + } |
|
254 | 270 | // Regenerate a new lp object? Not always as some pages don't need the object (like upload?) |
255 | 271 | if (!empty($_REQUEST['lp_id']) || !empty($myrefresh_id)) { |
256 | - if ($debug > 0) error_log('New LP - lp_id is defined', 0); |
|
272 | + if ($debug > 0) { |
|
273 | + error_log('New LP - lp_id is defined', 0); |
|
274 | + } |
|
257 | 275 | // Select the lp in the database and check which type it is (scorm/dokeos/aicc) to generate the |
258 | 276 | // right object. |
259 | 277 | if (!empty($_REQUEST['lp_id'])) { |
@@ -265,16 +283,22 @@ discard block |
||
265 | 283 | $lp_table = Database::get_course_table(TABLE_LP_MAIN); |
266 | 284 | if (is_numeric($lp_id)) { |
267 | 285 | $sel = "SELECT lp_type FROM $lp_table WHERE c_id = $course_id AND id = $lp_id"; |
268 | - if ($debug > 0) error_log('New LP - querying '.$sel, 0); |
|
286 | + if ($debug > 0) { |
|
287 | + error_log('New LP - querying '.$sel, 0); |
|
288 | + } |
|
269 | 289 | $res = Database::query($sel); |
270 | 290 | |
271 | 291 | if (Database::num_rows($res)) { |
272 | 292 | $row = Database::fetch_array($res); |
273 | 293 | $type = $row['lp_type']; |
274 | - 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); |
|
294 | + if ($debug > 0) { |
|
295 | + error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
296 | + } |
|
275 | 297 | switch ($type) { |
276 | 298 | case 1: |
277 | - 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); |
|
299 | + if ($debug > 0) { |
|
300 | + error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
301 | + } |
|
278 | 302 | |
279 | 303 | $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id()); |
280 | 304 | if ($oLP !== false) { |
@@ -284,7 +308,9 @@ discard block |
||
284 | 308 | } |
285 | 309 | break; |
286 | 310 | case 2: |
287 | - 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); |
|
311 | + if ($debug > 0) { |
|
312 | + error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
313 | + } |
|
288 | 314 | $oLP = new scorm(api_get_course_id(), $lp_id, api_get_user_id()); |
289 | 315 | if ($oLP !== false) { |
290 | 316 | $lp_found = true; |
@@ -293,7 +319,9 @@ discard block |
||
293 | 319 | } |
294 | 320 | break; |
295 | 321 | case 3: |
296 | - 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); |
|
322 | + if ($debug > 0) { |
|
323 | + error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
324 | + } |
|
297 | 325 | $oLP = new aicc(api_get_course_id(), $lp_id, api_get_user_id()); |
298 | 326 | if ($oLP !== false) { |
299 | 327 | $lp_found = true; |
@@ -302,7 +330,9 @@ discard block |
||
302 | 330 | } |
303 | 331 | break; |
304 | 332 | default: |
305 | - 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); |
|
333 | + if ($debug > 0) { |
|
334 | + error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
335 | + } |
|
306 | 336 | $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id()); |
307 | 337 | if ($oLP !== false) { |
308 | 338 | $lp_found = true; |
@@ -313,17 +343,23 @@ discard block |
||
313 | 343 | } |
314 | 344 | } |
315 | 345 | } else { |
316 | - if ($debug > 0) error_log('New LP - Request[lp_id] is not numeric', 0); |
|
346 | + if ($debug > 0) { |
|
347 | + error_log('New LP - Request[lp_id] is not numeric', 0); |
|
348 | + } |
|
317 | 349 | } |
318 | 350 | } else { |
319 | - if ($debug > 0) error_log('New LP - Request[lp_id] and refresh_id were empty', 0); |
|
351 | + if ($debug > 0) { |
|
352 | + error_log('New LP - Request[lp_id] and refresh_id were empty', 0); |
|
353 | + } |
|
320 | 354 | } |
321 | 355 | if ($lp_found) { |
322 | 356 | $_SESSION['oLP'] = $oLP; |
323 | 357 | } |
324 | 358 | } |
325 | 359 | |
326 | -if ($debug > 0) error_log('New LP - Passed oLP creation check', 0); |
|
360 | +if ($debug > 0) { |
|
361 | + error_log('New LP - Passed oLP creation check', 0); |
|
362 | +} |
|
327 | 363 | |
328 | 364 | $is_allowed_to_edit = api_is_allowed_to_edit(false, true, false, false); |
329 | 365 | |
@@ -360,7 +396,9 @@ discard block |
||
360 | 396 | } |
361 | 397 | |
362 | 398 | $redirectTo = ''; |
363 | -if ($debug > 0) error_log('New LP - action "'.$action.'" triggered'); |
|
399 | +if ($debug > 0) { |
|
400 | + error_log('New LP - action "'.$action.'" triggered'); |
|
401 | +} |
|
364 | 402 | |
365 | 403 | switch ($action) { |
366 | 404 | case 'add_item': |
@@ -369,7 +407,9 @@ discard block |
||
369 | 407 | } |
370 | 408 | if (!$lp_found) { |
371 | 409 | //check if the learnpath ID was defined, otherwise send back to list |
372 | - if ($debug > 0) error_log('New LP - No learnpath given for add item', 0); |
|
410 | + if ($debug > 0) { |
|
411 | + error_log('New LP - No learnpath given for add item', 0); |
|
412 | + } |
|
373 | 413 | require 'lp_list.php'; |
374 | 414 | } else { |
375 | 415 | $_SESSION['refresh'] = 1; |
@@ -459,7 +499,9 @@ discard block |
||
459 | 499 | } |
460 | 500 | if (!$lp_found) { |
461 | 501 | //check if the learnpath ID was defined, otherwise send back to list |
462 | - if ($debug > 0) error_log('New LP - No learnpath given for add audio', 0); |
|
502 | + if ($debug > 0) { |
|
503 | + error_log('New LP - No learnpath given for add audio', 0); |
|
504 | + } |
|
463 | 505 | require 'lp_list.php'; |
464 | 506 | } else { |
465 | 507 | $_SESSION['refresh'] = 1; |
@@ -607,8 +649,7 @@ discard block |
||
607 | 649 | if (!$is_allowed_to_edit) { |
608 | 650 | api_not_allowed(true); |
609 | 651 | } |
610 | - if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; } |
|
611 | - else { |
|
652 | + if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; } else { |
|
612 | 653 | $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']); |
613 | 654 | require 'lp_list.php'; |
614 | 655 | exit; |
@@ -689,8 +730,7 @@ discard block |
||
689 | 730 | if (!$is_allowed_to_edit) { |
690 | 731 | api_not_allowed(true); |
691 | 732 | } |
692 | - if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } |
|
693 | - else { |
|
733 | + if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } else { |
|
694 | 734 | if (isset($_POST['submit_button'])) { |
695 | 735 | //Updating the lp.modified_on |
696 | 736 | $_SESSION['oLP']->set_modified_on(); |
@@ -1119,16 +1159,24 @@ discard block |
||
1119 | 1159 | } |
1120 | 1160 | break; |
1121 | 1161 | case 'content': |
1122 | - if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0); |
|
1162 | + if ($debug > 0) { |
|
1163 | + error_log('New LP - Item id is '.intval($_GET['item_id']), 0); |
|
1164 | + } |
|
1123 | 1165 | if (!$lp_found) { |
1124 | 1166 | error_log('New LP - No learnpath given for content', 0); |
1125 | 1167 | require 'lp_list.php'; |
1126 | 1168 | } else { |
1127 | - if ($debug > 0) error_log('New LP - save_last()', 0); |
|
1169 | + if ($debug > 0) { |
|
1170 | + error_log('New LP - save_last()', 0); |
|
1171 | + } |
|
1128 | 1172 | $_SESSION['oLP']->save_last(); |
1129 | - if ($debug > 0) error_log('New LP - set_current_item()', 0); |
|
1173 | + if ($debug > 0) { |
|
1174 | + error_log('New LP - set_current_item()', 0); |
|
1175 | + } |
|
1130 | 1176 | $_SESSION['oLP']->set_current_item($_GET['item_id']); |
1131 | - if ($debug > 0) error_log('New LP - start_current_item()', 0); |
|
1177 | + if ($debug > 0) { |
|
1178 | + error_log('New LP - start_current_item()', 0); |
|
1179 | + } |
|
1132 | 1180 | $_SESSION['oLP']->start_current_item(); |
1133 | 1181 | require 'lp_content.php'; |
1134 | 1182 | } |
@@ -1244,8 +1292,7 @@ discard block |
||
1244 | 1292 | require 'lp_message.php'; |
1245 | 1293 | break; |
1246 | 1294 | case 'return_to_course_homepage': |
1247 | - if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } |
|
1248 | - else { |
|
1295 | + if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else { |
|
1249 | 1296 | $_SESSION['oLP']->save_current(); |
1250 | 1297 | $_SESSION['oLP']->save_last(); |
1251 | 1298 | $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id(); |
@@ -1438,8 +1485,10 @@ discard block |
||
1438 | 1485 | |
1439 | 1486 | if (!empty($_SESSION['oLP'])) { |
1440 | 1487 | $_SESSION['lpobject'] = serialize($_SESSION['oLP']); |
1441 | - if ($debug > 0) error_log('New LP - lpobject is serialized in session', 0); |
|
1442 | -} |
|
1488 | + if ($debug > 0) { |
|
1489 | + error_log('New LP - lpobject is serialized in session', 0); |
|
1490 | + } |
|
1491 | + } |
|
1443 | 1492 | |
1444 | 1493 | if (!empty($redirectTo)) { |
1445 | 1494 | header("Location: $redirectTo"); |