@@ -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']; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | // Percentage progress as saved in the db. |
59 | 59 | public $progress_db = '0'; |
60 | 60 | public $proximity; // Wether the content is distant or local or unknown. |
61 | - public $refs_list = array (); //list of items by ref => db_id. Used only for prerequisites match. |
|
61 | + public $refs_list = array(); //list of items by ref => db_id. Used only for prerequisites match. |
|
62 | 62 | // !!!This array (refs_list) is built differently depending on the nature of the LP. |
63 | 63 | // If SCORM, uses ref, if Chamilo, uses id to keep a unique value. |
64 | 64 | public $type; //type of learnpath. Could be 'dokeos', 'scorm', 'scorm2004', 'aicc', ... |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | if (!empty($row['expired_on'])) { |
163 | - $this->expired_on = $row['expired_on']; |
|
163 | + $this->expired_on = $row['expired_on']; |
|
164 | 164 | } |
165 | 165 | if ($this->type == 2) { |
166 | 166 | if ($row['force_commit'] == 1) { |
@@ -204,12 +204,12 @@ discard block |
||
204 | 204 | ORDER BY view_count DESC"; |
205 | 205 | $res = Database::query($sql); |
206 | 206 | if ($this->debug > 2) { |
207 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - querying lp_view: ' . $sql, 0); |
|
207 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - querying lp_view: '.$sql, 0); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | if (Database :: num_rows($res) > 0) { |
211 | 211 | if ($this->debug > 2) { |
212 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - Found previous view', 0); |
|
212 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - Found previous view', 0); |
|
213 | 213 | } |
214 | 214 | $row = Database :: fetch_array($res); |
215 | 215 | $this->attempt = $row['view_count']; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $this->lp_view_session_id = $row['session_id']; |
220 | 220 | } else if (!api_is_invitee()) { |
221 | 221 | if ($this->debug > 2) { |
222 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - NOT Found previous view', 0); |
|
222 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - NOT Found previous view', 0); |
|
223 | 223 | } |
224 | 224 | $this->attempt = 1; |
225 | 225 | $params = [ |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $this->lp_view_id = Database::insert_id(); |
235 | 235 | |
236 | 236 | if ($this->debug > 2) { |
237 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - inserting new lp_view: ' . $sql, 0); |
|
237 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - inserting new lp_view: '.$sql, 0); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | $sql = "UPDATE $lp_table SET id = iid WHERE iid = ".$this->lp_view_id; |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $res = Database::query($sql); |
250 | 250 | |
251 | 251 | if ($this->debug > 2) { |
252 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - query lp items: ' . $sql, 0); |
|
252 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - query lp items: '.$sql, 0); |
|
253 | 253 | error_log('-- Start while--', 0); |
254 | 254 | } |
255 | 255 | |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | $this->refs_list[$oItem->ref] = $my_item_id; |
270 | 270 | if ($this->debug > 2) { |
271 | 271 | error_log( |
272 | - 'New LP - learnpath::__construct() - ' . |
|
273 | - 'aicc object with id ' . $my_item_id . |
|
272 | + 'New LP - learnpath::__construct() - '. |
|
273 | + 'aicc object with id '.$my_item_id. |
|
274 | 274 | ' set in items[]', |
275 | 275 | 0 |
276 | 276 | ); |
@@ -289,19 +289,19 @@ discard block |
||
289 | 289 | |
290 | 290 | $this->refs_list[$oItem->ref] = $my_item_id; |
291 | 291 | if ($this->debug > 2) { |
292 | - error_log('New LP - object with id ' . $my_item_id . ' set in items[]', 0); |
|
292 | + error_log('New LP - object with id '.$my_item_id.' set in items[]', 0); |
|
293 | 293 | } |
294 | 294 | } |
295 | 295 | break; |
296 | 296 | case 1: |
297 | 297 | default: |
298 | 298 | if ($this->debug > 2) { |
299 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - calling learnpathItem', 0); |
|
299 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - calling learnpathItem', 0); |
|
300 | 300 | } |
301 | 301 | $oItem = new learnpathItem($row['id'], $user_id, $course_id, $row); |
302 | 302 | |
303 | 303 | if ($this->debug > 2) { |
304 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - end calling learnpathItem', 0); |
|
304 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - end calling learnpathItem', 0); |
|
305 | 305 | } |
306 | 306 | if (is_object($oItem)) { |
307 | 307 | $my_item_id = $oItem->get_id(); |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | $this->refs_list[$my_item_id] = $my_item_id; |
313 | 313 | if ($this->debug > 2) { |
314 | 314 | error_log( |
315 | - 'New LP - learnpath::__construct() ' . __LINE__ . |
|
316 | - ' - object with id ' . $my_item_id . ' set in items[]', |
|
315 | + 'New LP - learnpath::__construct() '.__LINE__. |
|
316 | + ' - object with id '.$my_item_id.' set in items[]', |
|
317 | 317 | 0 |
318 | 318 | ); |
319 | 319 | } |
@@ -332,13 +332,13 @@ discard block |
||
332 | 332 | $this->items[$row['id']]->set_lp_view($this->lp_view_id, $course_id); |
333 | 333 | if ($this->items[$row['id']]->get_type() == TOOL_HOTPOTATOES) { |
334 | 334 | $this->items[$row['id']]->current_start_time = 0; |
335 | - $this->items[$row['id']]->current_stop_time = 0; |
|
335 | + $this->items[$row['id']]->current_stop_time = 0; |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | } |
339 | 339 | |
340 | 340 | if ($this->debug > 2) { |
341 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' ----- end while ----', 0); |
|
341 | + error_log('New LP - learnpath::__construct() '.__LINE__.' ----- end while ----', 0); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | if (!empty($lp_item_id_list)) { |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | // TODO: Define the current item better. |
431 | 431 | $this->first(); |
432 | 432 | if ($this->debug > 2) { |
433 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - End of learnpath constructor for learnpath ' . $this->get_id(), 0); |
|
433 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - End of learnpath constructor for learnpath '.$this->get_id(), 0); |
|
434 | 434 | } |
435 | 435 | return true; |
436 | 436 | } |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | ) { |
508 | 508 | $course_id = $this->course_info['real_id']; |
509 | 509 | if ($this->debug > 0) { |
510 | - error_log('New LP - In learnpath::add_item(' . $parent . ',' . $previous . ',' . $type . ',' . $id . ',' . $title . ')', 0); |
|
510 | + error_log('New LP - In learnpath::add_item('.$parent.','.$previous.','.$type.','.$id.','.$title.')', 0); |
|
511 | 511 | } |
512 | 512 | if (empty($course_id)) { |
513 | 513 | // Sometimes Oogie doesn't catch the course info but sets $this->cc |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | FROM $tbl_lp_item |
530 | 530 | WHERE |
531 | 531 | c_id = $course_id AND |
532 | - lp_id = " . $this->get_id() . " AND |
|
532 | + lp_id = ".$this->get_id()." AND |
|
533 | 533 | parent_item_id = " . $parent; |
534 | 534 | |
535 | 535 | $res_count = Database::query($sql); |
@@ -539,11 +539,11 @@ discard block |
||
539 | 539 | if ($num > 0) { |
540 | 540 | if ($previous == 0) { |
541 | 541 | $sql = "SELECT id, next_item_id, display_order |
542 | - FROM " . $tbl_lp_item . " |
|
542 | + FROM " . $tbl_lp_item." |
|
543 | 543 | WHERE |
544 | 544 | c_id = $course_id AND |
545 | - lp_id = " . $this->get_id() . " AND |
|
546 | - parent_item_id = " . $parent . " AND |
|
545 | + lp_id = ".$this->get_id()." AND |
|
546 | + parent_item_id = " . $parent." AND |
|
547 | 547 | previous_item_id = 0 OR |
548 | 548 | previous_item_id=" . $parent; |
549 | 549 | $result = Database::query($sql); |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | FROM $tbl_lp_item |
558 | 558 | WHERE |
559 | 559 | c_id = $course_id AND |
560 | - lp_id = " . $this->get_id() . " AND |
|
560 | + lp_id = ".$this->get_id()." AND |
|
561 | 561 | id = " . $previous; |
562 | 562 | |
563 | 563 | $result = Database::query($sql); |
@@ -577,8 +577,8 @@ discard block |
||
577 | 577 | $typeCleaned = Database::escape_string($type); |
578 | 578 | if ($type == 'quiz') { |
579 | 579 | $sql = 'SELECT SUM(ponderation) |
580 | - FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION) . ' as quiz_question |
|
581 | - INNER JOIN ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION) . ' as quiz_rel_question |
|
580 | + FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION).' as quiz_question |
|
581 | + INNER JOIN ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question |
|
582 | 582 | ON |
583 | 583 | quiz_question.id = quiz_rel_question.question_id AND |
584 | 584 | quiz_question.c_id = quiz_rel_question.c_id |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | $new_item_id = Database::insert($tbl_lp_item, $params); |
625 | 625 | |
626 | 626 | if ($this->debug > 2) { |
627 | - error_log('New LP - Inserting dir/chapter: ' . $new_item_id, 0); |
|
627 | + error_log('New LP - Inserting dir/chapter: '.$new_item_id, 0); |
|
628 | 628 | } |
629 | 629 | |
630 | 630 | if ($new_item_id) { |
@@ -640,28 +640,28 @@ discard block |
||
640 | 640 | Database::query($sql); |
641 | 641 | |
642 | 642 | // Update all the items after the new item. |
643 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
643 | + $sql = "UPDATE ".$tbl_lp_item." |
|
644 | 644 | SET display_order = display_order + 1 |
645 | 645 | WHERE |
646 | 646 | c_id = $course_id AND |
647 | - lp_id = " . $this->get_id() . " AND |
|
648 | - id <> " . $new_item_id . " AND |
|
649 | - parent_item_id = " . $parent . " AND |
|
647 | + lp_id = ".$this->get_id()." AND |
|
648 | + id <> " . $new_item_id." AND |
|
649 | + parent_item_id = " . $parent." AND |
|
650 | 650 | display_order > " . $display_order; |
651 | 651 | Database::query($sql); |
652 | 652 | |
653 | 653 | // Update the item that should come after the new item. |
654 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
655 | - SET ref = " . $new_item_id . " |
|
656 | - WHERE c_id = $course_id AND id = " . $new_item_id; |
|
654 | + $sql = "UPDATE ".$tbl_lp_item." |
|
655 | + SET ref = " . $new_item_id." |
|
656 | + WHERE c_id = $course_id AND id = ".$new_item_id; |
|
657 | 657 | Database::query($sql); |
658 | 658 | |
659 | 659 | // Upload audio. |
660 | 660 | if (!empty($_FILES['mp3']['name'])) { |
661 | 661 | // Create the audio folder if it does not exist yet. |
662 | - $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/'; |
|
663 | - if (!is_dir($filepath . 'audio')) { |
|
664 | - mkdir($filepath . 'audio', api_get_permissions_for_new_directories()); |
|
662 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
663 | + if (!is_dir($filepath.'audio')) { |
|
664 | + mkdir($filepath.'audio', api_get_permissions_for_new_directories()); |
|
665 | 665 | $audio_id = add_document( |
666 | 666 | $_course, |
667 | 667 | '/audio', |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | $file_path = handle_uploaded_document( |
705 | 705 | $_course, |
706 | 706 | $_FILES['mp3'], |
707 | - api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document', |
|
707 | + api_get_path(SYS_COURSE_PATH).$_course['path'].'/document', |
|
708 | 708 | '/audio', |
709 | 709 | $userId, |
710 | 710 | '', |
@@ -720,8 +720,8 @@ discard block |
||
720 | 720 | |
721 | 721 | // Store the mp3 file in the lp_item table. |
722 | 722 | $sql = "UPDATE $tbl_lp_item SET |
723 | - audio = '" . Database::escape_string($file) . "' |
|
724 | - WHERE id = '" . intval($new_item_id) . "'"; |
|
723 | + audio = '".Database::escape_string($file)."' |
|
724 | + WHERE id = '" . intval($new_item_id)."'"; |
|
725 | 725 | Database::query($sql); |
726 | 726 | } |
727 | 727 | } |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | while (Database :: num_rows($res_name)) { |
799 | 799 | // There is already one such name, update the current one a bit. |
800 | 800 | $i++; |
801 | - $name = $name . ' - ' . $i; |
|
801 | + $name = $name.' - '.$i; |
|
802 | 802 | $check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '$name'"; |
803 | 803 | $res_name = Database::query($check_name); |
804 | 804 | } |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | // if $item points to an object and there is a parent. |
912 | 912 | if ($debug) { |
913 | 913 | error_log( |
914 | - 'Autocompleting parent of item ' . $item . ' "'.$currentItem->get_title().'" (item ' . $parent_id . ' "'.$parent->get_title().'") ', |
|
914 | + 'Autocompleting parent of item '.$item.' "'.$currentItem->get_title().'" (item '.$parent_id.' "'.$parent->get_title().'") ', |
|
915 | 915 | 0 |
916 | 916 | ); |
917 | 917 | } |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | if ($childItemId != $item) { |
940 | 940 | if ($debug) { |
941 | 941 | error_log( |
942 | - 'Looking at brother #'.$childItemId . ' "' . $childItem->get_title() . '", status is ' . $childItem->get_status(), |
|
942 | + 'Looking at brother #'.$childItemId.' "'.$childItem->get_title().'", status is '.$childItem->get_status(), |
|
943 | 943 | 0 |
944 | 944 | ); |
945 | 945 | } |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | } else { |
960 | 960 | if ($debug > 2) { |
961 | 961 | error_log( |
962 | - '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 | + '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, |
|
963 | 963 | 0 |
964 | 964 | ); |
965 | 965 | } |
@@ -1065,15 +1065,15 @@ discard block |
||
1065 | 1065 | // Delete lp item id. |
1066 | 1066 | foreach ($this->items as $id => $dummy) { |
1067 | 1067 | $sql = "DELETE FROM $lp_item_view |
1068 | - WHERE c_id = $course_id AND lp_item_id = '" . $id . "'"; |
|
1068 | + WHERE c_id = $course_id AND lp_item_id = '".$id."'"; |
|
1069 | 1069 | Database::query($sql); |
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | // Proposed by Christophe (nickname: clefevre) |
1073 | - $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
1073 | + $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
1074 | 1074 | Database::query($sql); |
1075 | 1075 | |
1076 | - $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
1076 | + $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
1077 | 1077 | Database::query($sql); |
1078 | 1078 | |
1079 | 1079 | self::toggle_publish($this->lp_id, 'i'); |
@@ -1081,33 +1081,33 @@ discard block |
||
1081 | 1081 | if ($this->type == 2 || $this->type == 3) { |
1082 | 1082 | // This is a scorm learning path, delete the files as well. |
1083 | 1083 | $sql = "SELECT path FROM $lp |
1084 | - WHERE c_id = ".$course_id." AND id = " . $this->lp_id; |
|
1084 | + WHERE c_id = ".$course_id." AND id = ".$this->lp_id; |
|
1085 | 1085 | $res = Database::query($sql); |
1086 | 1086 | if (Database :: num_rows($res) > 0) { |
1087 | 1087 | $row = Database :: fetch_array($res); |
1088 | 1088 | $path = $row['path']; |
1089 | 1089 | $sql = "SELECT id FROM $lp |
1090 | - WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id; |
|
1090 | + WHERE c_id = ".$course_id." AND path = '$path' AND id != ".$this->lp_id; |
|
1091 | 1091 | $res = Database::query($sql); |
1092 | 1092 | if (Database :: num_rows($res) > 0) { |
1093 | 1093 | // Another learning path uses this directory, so don't delete it. |
1094 | 1094 | if ($this->debug > 2) { |
1095 | - error_log('New LP - In learnpath::delete(), found other LP using path ' . $path . ', keeping directory', 0); |
|
1095 | + error_log('New LP - In learnpath::delete(), found other LP using path '.$path.', keeping directory', 0); |
|
1096 | 1096 | } |
1097 | 1097 | } else { |
1098 | 1098 | // No other LP uses that directory, delete it. |
1099 | - $course_rel_dir = api_get_course_path() . '/scorm/'; // scorm dir web path starting from /courses |
|
1100 | - $course_scorm_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir; // The absolute system path for this course. |
|
1101 | - if ($delete == 'remove' && is_dir($course_scorm_dir . $path) and !empty ($course_scorm_dir)) { |
|
1099 | + $course_rel_dir = api_get_course_path().'/scorm/'; // scorm dir web path starting from /courses |
|
1100 | + $course_scorm_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path for this course. |
|
1101 | + if ($delete == 'remove' && is_dir($course_scorm_dir.$path) and !empty ($course_scorm_dir)) { |
|
1102 | 1102 | if ($this->debug > 2) { |
1103 | - error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: ' . $course_scorm_dir . $path, 0); |
|
1103 | + error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: '.$course_scorm_dir.$path, 0); |
|
1104 | 1104 | } |
1105 | 1105 | // Proposed by Christophe (clefevre). |
1106 | 1106 | if (strcmp(substr($path, -2), "/.") == 0) { |
1107 | 1107 | $path = substr($path, 0, -1); // Remove "." at the end. |
1108 | 1108 | } |
1109 | 1109 | //exec('rm -rf ' . $course_scorm_dir . $path); // See Bug #5208, this is not OS-portable way. |
1110 | - rmdirr($course_scorm_dir . $path); |
|
1110 | + rmdirr($course_scorm_dir.$path); |
|
1111 | 1111 | } |
1112 | 1112 | } |
1113 | 1113 | } |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')"; |
1121 | 1121 | Database::query($sql); |
1122 | 1122 | |
1123 | - $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id; |
|
1123 | + $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = ".$this->lp_id; |
|
1124 | 1124 | Database::query($sql); |
1125 | 1125 | // Updates the display order of all lps. |
1126 | 1126 | $this->update_display_order(); |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | { |
1159 | 1159 | $course_id = $this->course_info['real_id']; |
1160 | 1160 | if ($this->debug > 0) { |
1161 | - error_log('New LP - In learnpath::delete_children_items(' . $id . ')', 0); |
|
1161 | + error_log('New LP - In learnpath::delete_children_items('.$id.')', 0); |
|
1162 | 1162 | } |
1163 | 1163 | $num = 0; |
1164 | 1164 | if (empty ($id) || $id != strval(intval($id))) { |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | $res = Database::query($sql); |
1170 | 1170 | while ($row = Database :: fetch_array($res)) { |
1171 | 1171 | $num += $this->delete_children_items($row['id']); |
1172 | - $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = " . $row['id']; |
|
1172 | + $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = ".$row['id']; |
|
1173 | 1173 | Database::query($sql_del); |
1174 | 1174 | $num++; |
1175 | 1175 | } |
@@ -1210,12 +1210,12 @@ discard block |
||
1210 | 1210 | // Delete children items. |
1211 | 1211 | $num = $this->delete_children_items($id); |
1212 | 1212 | if ($this->debug > 2) { |
1213 | - error_log('New LP - learnpath::delete_item() - deleted ' . $num . ' children of element ' . $id, 0); |
|
1213 | + error_log('New LP - learnpath::delete_item() - deleted '.$num.' children of element '.$id, 0); |
|
1214 | 1214 | } |
1215 | 1215 | // Now delete the item. |
1216 | 1216 | $sql_del = "DELETE FROM $lp_item WHERE c_id = $course_id AND id = $id"; |
1217 | 1217 | if ($this->debug > 2) { |
1218 | - error_log('New LP - Deleting item: ' . $sql_del, 0); |
|
1218 | + error_log('New LP - Deleting item: '.$sql_del, 0); |
|
1219 | 1219 | } |
1220 | 1220 | Database::query($sql_del); |
1221 | 1221 | // Now update surrounding items. |
@@ -1290,15 +1290,15 @@ discard block |
||
1290 | 1290 | } |
1291 | 1291 | |
1292 | 1292 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
1293 | - $sql_select = "SELECT * FROM " . $tbl_lp_item . " WHERE c_id = ".$course_id." AND id = " . $id; |
|
1293 | + $sql_select = "SELECT * FROM ".$tbl_lp_item." WHERE c_id = ".$course_id." AND id = ".$id; |
|
1294 | 1294 | $res_select = Database::query($sql_select); |
1295 | 1295 | $row_select = Database :: fetch_array($res_select); |
1296 | 1296 | $audio_update_sql = ''; |
1297 | 1297 | if (is_array($audio) && !empty ($audio['tmp_name']) && $audio['error'] === 0) { |
1298 | 1298 | // Create the audio folder if it does not exist yet. |
1299 | - $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/'; |
|
1300 | - if (!is_dir($filepath . 'audio')) { |
|
1301 | - mkdir($filepath . 'audio', api_get_permissions_for_new_directories()); |
|
1299 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
1300 | + if (!is_dir($filepath.'audio')) { |
|
1301 | + mkdir($filepath.'audio', api_get_permissions_for_new_directories()); |
|
1302 | 1302 | $audio_id = add_document( |
1303 | 1303 | $_course, |
1304 | 1304 | '/audio', |
@@ -1336,11 +1336,11 @@ discard block |
||
1336 | 1336 | $pi = pathinfo($audio['name']); |
1337 | 1337 | if ($pi['extension'] == 'mp3') { |
1338 | 1338 | $c_det = api_get_course_info($this->cc); |
1339 | - $bp = api_get_path(SYS_COURSE_PATH) . $c_det['path'] . '/document'; |
|
1339 | + $bp = api_get_path(SYS_COURSE_PATH).$c_det['path'].'/document'; |
|
1340 | 1340 | $path = handle_uploaded_document($c_det, $audio, $bp, '/audio', api_get_user_id(), 0, null, 0, 'rename', false, 0); |
1341 | 1341 | $path = substr($path, 7); |
1342 | 1342 | // Update reference in lp_item - audio path is the path from inside de document/audio/ dir. |
1343 | - $audio_update_sql = ", audio = '" . Database::escape_string($path) . "' "; |
|
1343 | + $audio_update_sql = ", audio = '".Database::escape_string($path)."' "; |
|
1344 | 1344 | } |
1345 | 1345 | } |
1346 | 1346 | |
@@ -1350,13 +1350,13 @@ discard block |
||
1350 | 1350 | // TODO: htmlspecialchars to be checked for encoding related problems. |
1351 | 1351 | if ($same_parent && $same_previous) { |
1352 | 1352 | // Only update title and description. |
1353 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1354 | - SET title = '" . Database::escape_string($title) . "', |
|
1355 | - prerequisite = '" . $prerequisites . "', |
|
1356 | - description = '" . Database::escape_string($description) . "' |
|
1357 | - " . $audio_update_sql . ", |
|
1358 | - max_time_allowed = '" . Database::escape_string($max_time_allowed) . "' |
|
1359 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
1353 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1354 | + SET title = '" . Database::escape_string($title)."', |
|
1355 | + prerequisite = '" . $prerequisites."', |
|
1356 | + description = '" . Database::escape_string($description)."' |
|
1357 | + " . $audio_update_sql.", |
|
1358 | + max_time_allowed = '" . Database::escape_string($max_time_allowed)."' |
|
1359 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
1360 | 1360 | Database::query($sql); |
1361 | 1361 | } else { |
1362 | 1362 | $old_parent = $row_select['parent_item_id']; |
@@ -1371,27 +1371,27 @@ discard block |
||
1371 | 1371 | |
1372 | 1372 | if ($old_previous != 0) { |
1373 | 1373 | // Next |
1374 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1375 | - SET next_item_id = " . $old_next . " |
|
1376 | - WHERE c_id = ".$course_id." AND id = " . $old_previous; |
|
1374 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1375 | + SET next_item_id = " . $old_next." |
|
1376 | + WHERE c_id = ".$course_id." AND id = ".$old_previous; |
|
1377 | 1377 | Database::query($sql); |
1378 | 1378 | } |
1379 | 1379 | |
1380 | 1380 | if ($old_next != 0) { |
1381 | 1381 | // Previous |
1382 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1383 | - SET previous_item_id = " . $old_previous . " |
|
1384 | - WHERE c_id = ".$course_id." AND id = " . $old_next; |
|
1382 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1383 | + SET previous_item_id = " . $old_previous." |
|
1384 | + WHERE c_id = ".$course_id." AND id = ".$old_next; |
|
1385 | 1385 | Database::query($sql); |
1386 | 1386 | } |
1387 | 1387 | |
1388 | 1388 | // display_order - 1 for every item with a display_order bigger then the display_order of the current item. |
1389 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1389 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1390 | 1390 | SET display_order = display_order - 1 |
1391 | 1391 | WHERE |
1392 | 1392 | c_id = ".$course_id." AND |
1393 | - display_order > " . $old_order . " AND |
|
1394 | - lp_id = " . $this->lp_id . " AND |
|
1393 | + display_order > " . $old_order." AND |
|
1394 | + lp_id = " . $this->lp_id." AND |
|
1395 | 1395 | parent_item_id = " . $old_parent; |
1396 | 1396 | Database::query($sql); |
1397 | 1397 | /* END -- virtually remove the current item id */ |
@@ -1401,11 +1401,11 @@ discard block |
||
1401 | 1401 | if ($previous == 0) { |
1402 | 1402 | // Select the data of the item that should come after the current item. |
1403 | 1403 | $sql = "SELECT id, display_order |
1404 | - FROM " . $tbl_lp_item . " |
|
1404 | + FROM " . $tbl_lp_item." |
|
1405 | 1405 | WHERE |
1406 | 1406 | c_id = ".$course_id." AND |
1407 | - lp_id = " . $this->lp_id . " AND |
|
1408 | - parent_item_id = " . $parent . " AND |
|
1407 | + lp_id = " . $this->lp_id." AND |
|
1408 | + parent_item_id = " . $parent." AND |
|
1409 | 1409 | previous_item_id = " . $previous; |
1410 | 1410 | $res_select_old = Database::query($sql); |
1411 | 1411 | $row_select_old = Database::fetch_array($res_select_old); |
@@ -1421,8 +1421,8 @@ discard block |
||
1421 | 1421 | } else { |
1422 | 1422 | // Select the data of the item that should come before the current item. |
1423 | 1423 | $sql = "SELECT next_item_id, display_order |
1424 | - FROM " . $tbl_lp_item . " |
|
1425 | - WHERE c_id = ".$course_id." AND id = " . $previous; |
|
1424 | + FROM " . $tbl_lp_item." |
|
1425 | + WHERE c_id = ".$course_id." AND id = ".$previous; |
|
1426 | 1426 | $res_select_old = Database::query($sql); |
1427 | 1427 | $row_select_old = Database :: fetch_array($res_select_old); |
1428 | 1428 | $new_next = $row_select_old['next_item_id']; |
@@ -1431,57 +1431,57 @@ discard block |
||
1431 | 1431 | |
1432 | 1432 | // TODO: htmlspecialchars to be checked for encoding related problems. |
1433 | 1433 | // Update the current item with the new data. |
1434 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1434 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1435 | 1435 | SET |
1436 | - title = '" . Database::escape_string($title) . "', |
|
1437 | - description = '" . Database::escape_string($description) . "', |
|
1438 | - parent_item_id = " . $parent . ", |
|
1439 | - previous_item_id = " . $previous . ", |
|
1440 | - next_item_id = " . $new_next . ", |
|
1441 | - display_order = " . $new_order . " |
|
1442 | - " . $audio_update_sql . " |
|
1443 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
1436 | + title = '" . Database::escape_string($title)."', |
|
1437 | + description = '" . Database::escape_string($description)."', |
|
1438 | + parent_item_id = " . $parent.", |
|
1439 | + previous_item_id = " . $previous.", |
|
1440 | + next_item_id = " . $new_next.", |
|
1441 | + display_order = " . $new_order." |
|
1442 | + " . $audio_update_sql." |
|
1443 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
1444 | 1444 | Database::query($sql); |
1445 | 1445 | |
1446 | 1446 | if ($previous != 0) { |
1447 | 1447 | // Update the previous item's next_item_id. |
1448 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1449 | - SET next_item_id = " . $id . " |
|
1450 | - WHERE c_id = ".$course_id." AND id = " . $previous; |
|
1448 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1449 | + SET next_item_id = " . $id." |
|
1450 | + WHERE c_id = ".$course_id." AND id = ".$previous; |
|
1451 | 1451 | Database::query($sql); |
1452 | 1452 | } |
1453 | 1453 | |
1454 | 1454 | if ($new_next != 0) { |
1455 | 1455 | // Update the next item's previous_item_id. |
1456 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1457 | - SET previous_item_id = " . $id . " |
|
1458 | - WHERE c_id = ".$course_id." AND id = " . $new_next; |
|
1456 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1457 | + SET previous_item_id = " . $id." |
|
1458 | + WHERE c_id = ".$course_id." AND id = ".$new_next; |
|
1459 | 1459 | Database::query($sql); |
1460 | 1460 | } |
1461 | 1461 | |
1462 | 1462 | if ($old_prerequisite != $prerequisites) { |
1463 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1464 | - SET prerequisite = '" . $prerequisites . "' |
|
1465 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
1463 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1464 | + SET prerequisite = '" . $prerequisites."' |
|
1465 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
1466 | 1466 | Database::query($sql); |
1467 | 1467 | } |
1468 | 1468 | |
1469 | 1469 | if ($old_max_time_allowed != $max_time_allowed) { |
1470 | 1470 | // update max time allowed |
1471 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1472 | - SET max_time_allowed = " . $max_time_allowed . " |
|
1473 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
1471 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1472 | + SET max_time_allowed = " . $max_time_allowed." |
|
1473 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
1474 | 1474 | Database::query($sql); |
1475 | 1475 | } |
1476 | 1476 | |
1477 | 1477 | // Update all the items with the same or a bigger display_order than the current item. |
1478 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
1478 | + $sql = "UPDATE ".$tbl_lp_item." |
|
1479 | 1479 | SET display_order = display_order + 1 |
1480 | 1480 | WHERE |
1481 | 1481 | c_id = ".$course_id." AND |
1482 | - lp_id = " . $this->get_id() . " AND |
|
1483 | - id <> " . $id . " AND |
|
1484 | - parent_item_id = " . $parent . " AND |
|
1482 | + lp_id = " . $this->get_id()." AND |
|
1483 | + id <> " . $id." AND |
|
1484 | + parent_item_id = " . $parent." AND |
|
1485 | 1485 | display_order >= " . $new_order; |
1486 | 1486 | |
1487 | 1487 | Database::query($sql); |
@@ -1507,7 +1507,7 @@ discard block |
||
1507 | 1507 | { |
1508 | 1508 | $course_id = api_get_course_int_id(); |
1509 | 1509 | if ($this->debug > 0) { |
1510 | - error_log('New LP - In learnpath::edit_item_prereq(' . $id . ',' . $prerequisite_id . ',' . $mastery_score . ',' . $max_score . ')', 0); |
|
1510 | + error_log('New LP - In learnpath::edit_item_prereq('.$id.','.$prerequisite_id.','.$mastery_score.','.$max_score.')', 0); |
|
1511 | 1511 | } |
1512 | 1512 | |
1513 | 1513 | if (empty($id) || ($id != strval(intval($id))) || empty ($prerequisite_id)) { |
@@ -1596,7 +1596,7 @@ discard block |
||
1596 | 1596 | |
1597 | 1597 | if (empty($id) || $id != strval(intval($id))) { |
1598 | 1598 | |
1599 | - return array (); |
|
1599 | + return array(); |
|
1600 | 1600 | } |
1601 | 1601 | |
1602 | 1602 | $lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
@@ -1636,7 +1636,7 @@ discard block |
||
1636 | 1636 | { |
1637 | 1637 | $course_id = api_get_course_int_id(); |
1638 | 1638 | if ($this->debug > 0) { |
1639 | - error_log('New LP - In learnpath::get_brother_items(' . $id . ')', 0); |
|
1639 | + error_log('New LP - In learnpath::get_brother_items('.$id.')', 0); |
|
1640 | 1640 | } |
1641 | 1641 | |
1642 | 1642 | if (empty ($id) || $id != strval(intval($id))) { |
@@ -1652,13 +1652,13 @@ discard block |
||
1652 | 1652 | $sql_bros = "SELECT * FROM $lp_item WHERE c_id = ".$course_id." AND parent_item_id = $parent |
1653 | 1653 | ORDER BY display_order"; |
1654 | 1654 | $res_bros = Database::query($sql_bros); |
1655 | - $list = array (); |
|
1655 | + $list = array(); |
|
1656 | 1656 | while ($row_bro = Database :: fetch_array($res_bros)) { |
1657 | 1657 | $list[] = $row_bro; |
1658 | 1658 | } |
1659 | 1659 | return $list; |
1660 | 1660 | } |
1661 | - return array (); |
|
1661 | + return array(); |
|
1662 | 1662 | } |
1663 | 1663 | |
1664 | 1664 | /** |
@@ -1731,7 +1731,7 @@ discard block |
||
1731 | 1731 | $current = $this->current; |
1732 | 1732 | } |
1733 | 1733 | if ($this->debug > 2) { |
1734 | - error_log('New LP - In learnpath::get_current_item_id() - Returning ' . $current, 0); |
|
1734 | + error_log('New LP - In learnpath::get_current_item_id() - Returning '.$current, 0); |
|
1735 | 1735 | } |
1736 | 1736 | return $current; |
1737 | 1737 | } |
@@ -1810,7 +1810,7 @@ discard block |
||
1810 | 1810 | //&& !$this->items[$this->last_item_seen]->is_done() |
1811 | 1811 | ) { |
1812 | 1812 | if ($this->debug > 2) { |
1813 | - 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 | + 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); |
|
1814 | 1814 | } |
1815 | 1815 | $index = -1; |
1816 | 1816 | foreach ($this->ordered_items as $myindex => $item_id) { |
@@ -1822,7 +1822,7 @@ discard block |
||
1822 | 1822 | if ($index == -1) { |
1823 | 1823 | // Index hasn't changed, so item not found - panic (this shouldn't happen). |
1824 | 1824 | if ($this->debug > 2) { |
1825 | - error_log('New LP - Last item (' . $this->last_item_seen . ') was found in items but not in ordered_items, panic!', 0); |
|
1825 | + error_log('New LP - Last item ('.$this->last_item_seen.') was found in items but not in ordered_items, panic!', 0); |
|
1826 | 1826 | } |
1827 | 1827 | return false; |
1828 | 1828 | } else { |
@@ -1837,7 +1837,7 @@ discard block |
||
1837 | 1837 | $index = 0; |
1838 | 1838 | // Loop through all ordered items and stop at the first item that is |
1839 | 1839 | // not a directory *and* that has not been completed yet. |
1840 | - while ( !empty($this->ordered_items[$index]) AND |
|
1840 | + while (!empty($this->ordered_items[$index]) AND |
|
1841 | 1841 | is_a($this->items[$this->ordered_items[$index]], 'learnpathItem') AND |
1842 | 1842 | ( |
1843 | 1843 | $this->items[$this->ordered_items[$index]]->get_type() == 'dir' OR |
@@ -1850,14 +1850,14 @@ discard block |
||
1850 | 1850 | $this->current = isset($this->ordered_items[$index]) ? $this->ordered_items[$index] : null; |
1851 | 1851 | $this->index = $index; |
1852 | 1852 | if ($this->debug > 2) { |
1853 | - error_log('$index ' . $index); |
|
1853 | + error_log('$index '.$index); |
|
1854 | 1854 | } |
1855 | 1855 | if ($this->debug > 2) { |
1856 | - error_log('New LP - In learnpath::first() - No last item seen. New last = ' . $this->last . '(' . $this->ordered_items[$index] . ')', 0); |
|
1856 | + error_log('New LP - In learnpath::first() - No last item seen. New last = '.$this->last.'('.$this->ordered_items[$index].')', 0); |
|
1857 | 1857 | } |
1858 | 1858 | } |
1859 | 1859 | if ($this->debug > 2) { |
1860 | - error_log('New LP - In learnpath::first() - First item is ' . $this->get_current_item_id()); |
|
1860 | + error_log('New LP - In learnpath::first() - First item is '.$this->get_current_item_id()); |
|
1861 | 1861 | } |
1862 | 1862 | } |
1863 | 1863 | |
@@ -1870,7 +1870,7 @@ discard block |
||
1870 | 1870 | public function get_js_info($item_id = 0) |
1871 | 1871 | { |
1872 | 1872 | if ($this->debug > 0) { |
1873 | - error_log('New LP - In learnpath::get_js_info(' . $item_id . ')', 0); |
|
1873 | + error_log('New LP - In learnpath::get_js_info('.$item_id.')', 0); |
|
1874 | 1874 | } |
1875 | 1875 | |
1876 | 1876 | $info = ''; |
@@ -1880,34 +1880,34 @@ discard block |
||
1880 | 1880 | //if item is defined, return values from DB |
1881 | 1881 | $oItem = $this->items[$item_id]; |
1882 | 1882 | $info .= '<script language="javascript">'; |
1883 | - $info .= "top.set_score(" . $oItem->get_score() . ");\n"; |
|
1884 | - $info .= "top.set_max(" . $oItem->get_max() . ");\n"; |
|
1885 | - $info .= "top.set_min(" . $oItem->get_min() . ");\n"; |
|
1886 | - $info .= "top.set_lesson_status('" . $oItem->get_status() . "');"; |
|
1887 | - $info .= "top.set_session_time('" . $oItem->get_scorm_time('js') . "');"; |
|
1888 | - $info .= "top.set_suspend_data('" . $oItem->get_suspend_data() . "');"; |
|
1889 | - $info .= "top.set_saved_lesson_status('" . $oItem->get_status() . "');"; |
|
1883 | + $info .= "top.set_score(".$oItem->get_score().");\n"; |
|
1884 | + $info .= "top.set_max(".$oItem->get_max().");\n"; |
|
1885 | + $info .= "top.set_min(".$oItem->get_min().");\n"; |
|
1886 | + $info .= "top.set_lesson_status('".$oItem->get_status()."');"; |
|
1887 | + $info .= "top.set_session_time('".$oItem->get_scorm_time('js')."');"; |
|
1888 | + $info .= "top.set_suspend_data('".$oItem->get_suspend_data()."');"; |
|
1889 | + $info .= "top.set_saved_lesson_status('".$oItem->get_status()."');"; |
|
1890 | 1890 | $info .= "top.set_flag_synchronized();"; |
1891 | 1891 | $info .= '</script>'; |
1892 | 1892 | if ($this->debug > 2) { |
1893 | - error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0); |
|
1893 | + error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0); |
|
1894 | 1894 | } |
1895 | 1895 | return $info; |
1896 | 1896 | |
1897 | 1897 | } else { |
1898 | 1898 | // If item_id is empty, just update to default SCORM data. |
1899 | 1899 | $info .= '<script language="javascript">'; |
1900 | - $info .= "top.set_score(" . learnpathItem :: get_score() . ");\n"; |
|
1901 | - $info .= "top.set_max(" . learnpathItem :: get_max() . ");\n"; |
|
1902 | - $info .= "top.set_min(" . learnpathItem :: get_min() . ");\n"; |
|
1903 | - $info .= "top.set_lesson_status('" . learnpathItem :: get_status() . "');"; |
|
1904 | - $info .= "top.set_session_time('" . learnpathItem :: getScormTimeFromParameter('js') . "');"; |
|
1905 | - $info .= "top.set_suspend_data('" . learnpathItem :: get_suspend_data() . "');"; |
|
1906 | - $info .= "top.set_saved_lesson_status('" . learnpathItem :: get_status() . "');"; |
|
1900 | + $info .= "top.set_score(".learnpathItem :: get_score().");\n"; |
|
1901 | + $info .= "top.set_max(".learnpathItem :: get_max().");\n"; |
|
1902 | + $info .= "top.set_min(".learnpathItem :: get_min().");\n"; |
|
1903 | + $info .= "top.set_lesson_status('".learnpathItem :: get_status()."');"; |
|
1904 | + $info .= "top.set_session_time('".learnpathItem :: getScormTimeFromParameter('js')."');"; |
|
1905 | + $info .= "top.set_suspend_data('".learnpathItem :: get_suspend_data()."');"; |
|
1906 | + $info .= "top.set_saved_lesson_status('".learnpathItem :: get_status()."');"; |
|
1907 | 1907 | $info .= "top.set_flag_synchronized();"; |
1908 | 1908 | $info .= '</script>'; |
1909 | 1909 | if ($this->debug > 2) { |
1910 | - error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0); |
|
1910 | + error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0); |
|
1911 | 1911 | } |
1912 | 1912 | return $info; |
1913 | 1913 | } |
@@ -1965,8 +1965,8 @@ discard block |
||
1965 | 1965 | if ($this->debug > 0) { |
1966 | 1966 | error_log('New LP - In learnpath::get_navigation_bar()', 0); |
1967 | 1967 | } |
1968 | - if(empty($idBar)){ |
|
1969 | - $idBar='control-top'; |
|
1968 | + if (empty($idBar)) { |
|
1969 | + $idBar = 'control-top'; |
|
1970 | 1970 | } |
1971 | 1971 | /* if(empty($display)){ |
1972 | 1972 | $display='display:block'; |
@@ -1979,16 +1979,16 @@ discard block |
||
1979 | 1979 | $navbar = ' |
1980 | 1980 | <span id="'.$idBar.'" class="buttons"> |
1981 | 1981 | <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"> |
1982 | - <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span> |
|
1982 | + <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span> |
|
1983 | 1983 | </a> |
1984 | - <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous"> |
|
1985 | - <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span> |
|
1984 | + <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous"> |
|
1985 | + <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span> |
|
1986 | 1986 | </a> |
1987 | - <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next"> |
|
1988 | - <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span> |
|
1987 | + <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next"> |
|
1988 | + <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span> |
|
1989 | 1989 | </a> |
1990 | 1990 | <a class="icon-toolbar" id="view-embedded" href="lp_controller.php?action=mode&mode=embedded" target="_top" title="embedded mode"> |
1991 | - <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen') . '</span> |
|
1991 | + <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen').'</span> |
|
1992 | 1992 | </a> |
1993 | 1993 | </span>'; |
1994 | 1994 | |
@@ -1996,13 +1996,13 @@ discard block |
||
1996 | 1996 | $navbar = ' |
1997 | 1997 | <span id="'.$idBar.'" class="buttons text-right"> |
1998 | 1998 | <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"> |
1999 | - <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span> |
|
1999 | + <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span> |
|
2000 | 2000 | </a> |
2001 | - <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous"> |
|
2002 | - <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span> |
|
2001 | + <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous"> |
|
2002 | + <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span> |
|
2003 | 2003 | </a> |
2004 | - <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next"> |
|
2005 | - <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span> |
|
2004 | + <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next"> |
|
2005 | + <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span> |
|
2006 | 2006 | </a> |
2007 | 2007 | </span>'; |
2008 | 2008 | } |
@@ -2023,11 +2023,11 @@ discard block |
||
2023 | 2023 | $index = $this->index; |
2024 | 2024 | $index++; |
2025 | 2025 | if ($this->debug > 2) { |
2026 | - error_log('New LP - Now looking at ordered_items[' . ($index) . '] - type is ' . $this->items[$this->ordered_items[$index]]->type, 0); |
|
2026 | + error_log('New LP - Now looking at ordered_items['.($index).'] - type is '.$this->items[$this->ordered_items[$index]]->type, 0); |
|
2027 | 2027 | } |
2028 | 2028 | while (!empty ($this->ordered_items[$index]) AND ($this->items[$this->ordered_items[$index]]->get_type() == 'dir') AND $index < $this->max_ordered_items) { |
2029 | 2029 | $index++; |
2030 | - if ($index == $this->max_ordered_items){ |
|
2030 | + if ($index == $this->max_ordered_items) { |
|
2031 | 2031 | if ($this->items[$this->ordered_items[$index]]->get_type() == 'dir') { |
2032 | 2032 | return $this->index; |
2033 | 2033 | } else { |
@@ -2039,7 +2039,7 @@ discard block |
||
2039 | 2039 | return $this->index; |
2040 | 2040 | } |
2041 | 2041 | if ($this->debug > 2) { |
2042 | - error_log('New LP - index is now ' . $index, 0); |
|
2042 | + error_log('New LP - index is now '.$index, 0); |
|
2043 | 2043 | } |
2044 | 2044 | return $index; |
2045 | 2045 | } |
@@ -2057,7 +2057,7 @@ discard block |
||
2057 | 2057 | if (!empty ($new_index)) { |
2058 | 2058 | if (isset ($this->ordered_items[$new_index])) { |
2059 | 2059 | if ($this->debug > 2) { |
2060 | - error_log('New LP - In learnpath::get_next_index() - Returning ' . $this->ordered_items[$new_index], 0); |
|
2060 | + error_log('New LP - In learnpath::get_next_index() - Returning '.$this->ordered_items[$new_index], 0); |
|
2061 | 2061 | } |
2062 | 2062 | return $this->ordered_items[$new_index]; |
2063 | 2063 | } |
@@ -2120,7 +2120,7 @@ discard block |
||
2120 | 2120 | break; // Exit the foreach loop. |
2121 | 2121 | } elseif ( |
2122 | 2122 | preg_match('/aicc\//i', $thisContent['filename']) || |
2123 | - in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array( 'crs','au','des','cst')) |
|
2123 | + in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array('crs', 'au', 'des', 'cst')) |
|
2124 | 2124 | ) { |
2125 | 2125 | $ext = strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)); |
2126 | 2126 | switch ($ext) { |
@@ -2162,7 +2162,7 @@ discard block |
||
2162 | 2162 | error_log('New LP - In learnpath::get_previous_index()', 0); |
2163 | 2163 | } |
2164 | 2164 | $index = $this->index; |
2165 | - if (isset ($this->ordered_items[$index -1])) { |
|
2165 | + if (isset ($this->ordered_items[$index - 1])) { |
|
2166 | 2166 | $index--; |
2167 | 2167 | while (isset($this->ordered_items[$index]) && ($this->items[$this->ordered_items[$index]]->get_type() == 'dir')) { |
2168 | 2168 | $index--; |
@@ -2172,7 +2172,7 @@ discard block |
||
2172 | 2172 | } |
2173 | 2173 | } else { |
2174 | 2174 | if ($this->debug > 2) { |
2175 | - error_log('New LP - get_previous_index() - there was no previous index available, reusing ' . $index, 0); |
|
2175 | + error_log('New LP - get_previous_index() - there was no previous index available, reusing '.$index, 0); |
|
2176 | 2176 | } |
2177 | 2177 | // There is no previous item. |
2178 | 2178 | } |
@@ -2215,8 +2215,8 @@ discard block |
||
2215 | 2215 | { |
2216 | 2216 | $course_id = api_get_course_int_id(); |
2217 | 2217 | $_course = api_get_course_info(); |
2218 | - $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
|
2219 | - $tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW); |
|
2218 | + $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
|
2219 | + $tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW); |
|
2220 | 2220 | |
2221 | 2221 | // Getting all the information about the item. |
2222 | 2222 | $sql = "SELECT * FROM $tbl_lp_item as lp |
@@ -2227,15 +2227,15 @@ discard block |
||
2227 | 2227 | lp.c_id = $course_id AND |
2228 | 2228 | lp_view.c_id = $course_id"; |
2229 | 2229 | $result = Database::query($sql); |
2230 | - $row = Database::fetch_assoc($result); |
|
2230 | + $row = Database::fetch_assoc($result); |
|
2231 | 2231 | $output = ''; |
2232 | 2232 | |
2233 | 2233 | if (!empty ($row['audio'])) { |
2234 | 2234 | $list = $_SESSION['oLP']->get_toc(); |
2235 | 2235 | $type_quiz = false; |
2236 | 2236 | |
2237 | - foreach($list as $toc) { |
|
2238 | - if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type']=='quiz') ) { |
|
2237 | + foreach ($list as $toc) { |
|
2238 | + if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type'] == 'quiz')) { |
|
2239 | 2239 | $type_quiz = true; |
2240 | 2240 | } |
2241 | 2241 | } |
@@ -2297,7 +2297,7 @@ discard block |
||
2297 | 2297 | $courseCode = null, |
2298 | 2298 | $sessionId = null |
2299 | 2299 | ) { |
2300 | - $lp_id = (int)$lp_id; |
|
2300 | + $lp_id = (int) $lp_id; |
|
2301 | 2301 | $courseInfo = api_get_course_info($courseCode); |
2302 | 2302 | $sessionId = intval($sessionId); |
2303 | 2303 | |
@@ -2461,10 +2461,10 @@ discard block |
||
2461 | 2461 | */ |
2462 | 2462 | public static function get_progress_bar($percentage = -1, $text_add = '') |
2463 | 2463 | { |
2464 | - $text = $percentage . $text_add; |
|
2464 | + $text = $percentage.$text_add; |
|
2465 | 2465 | $output = '<div class="progress"> |
2466 | - <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.';"> |
|
2467 | - '. $text .' |
|
2466 | + <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.';"> |
|
2467 | + '. $text.' |
|
2468 | 2468 | </div> |
2469 | 2469 | </div>'; |
2470 | 2470 | |
@@ -2500,16 +2500,16 @@ discard block |
||
2500 | 2500 | } |
2501 | 2501 | $total_items = $this->getTotalItemsCountWithoutDirs(); |
2502 | 2502 | if ($this->debug > 2) { |
2503 | - error_log('New LP - Total items available in this learnpath: ' . $total_items, 0); |
|
2503 | + error_log('New LP - Total items available in this learnpath: '.$total_items, 0); |
|
2504 | 2504 | } |
2505 | 2505 | $completeItems = $this->get_complete_items_count(); |
2506 | 2506 | if ($this->debug > 2) { |
2507 | - error_log('New LP - Items completed so far: ' . $completeItems, 0); |
|
2507 | + error_log('New LP - Items completed so far: '.$completeItems, 0); |
|
2508 | 2508 | } |
2509 | 2509 | if ($add != 0) { |
2510 | 2510 | $completeItems += $add; |
2511 | 2511 | if ($this->debug > 2) { |
2512 | - error_log('New LP - Items completed so far (+modifier): ' . $completeItems, 0); |
|
2512 | + error_log('New LP - Items completed so far (+modifier): '.$completeItems, 0); |
|
2513 | 2513 | } |
2514 | 2514 | } |
2515 | 2515 | $text = ''; |
@@ -2527,7 +2527,7 @@ discard block |
||
2527 | 2527 | $text = '%'; |
2528 | 2528 | } elseif ($mode == 'abs') { |
2529 | 2529 | $percentage = $completeItems; |
2530 | - $text = '/' . $total_items; |
|
2530 | + $text = '/'.$total_items; |
|
2531 | 2531 | } |
2532 | 2532 | |
2533 | 2533 | return array( |
@@ -2723,7 +2723,7 @@ discard block |
||
2723 | 2723 | // and replace them, one by one, by the internal IDs (chamilo db) |
2724 | 2724 | // TODO: Modify the '*' replacement to replace the multiplier in front of it |
2725 | 2725 | // by a space as well. |
2726 | - $find = array ( |
|
2726 | + $find = array( |
|
2727 | 2727 | '&', |
2728 | 2728 | '|', |
2729 | 2729 | '~', |
@@ -2735,7 +2735,7 @@ discard block |
||
2735 | 2735 | '(', |
2736 | 2736 | ')' |
2737 | 2737 | ); |
2738 | - $replace = array ( |
|
2738 | + $replace = array( |
|
2739 | 2739 | ' ', |
2740 | 2740 | ' ', |
2741 | 2741 | ' ', |
@@ -2752,7 +2752,7 @@ discard block |
||
2752 | 2752 | foreach ($ids as $id) { |
2753 | 2753 | $id = trim($id); |
2754 | 2754 | if (isset ($this->refs_list[$id])) { |
2755 | - $prereq = preg_replace('/[^a-zA-Z_0-9](' . $id . ')[^a-zA-Z_0-9]/', 'ITEM_' . $this->refs_list[$id], $prereq); |
|
2755 | + $prereq = preg_replace('/[^a-zA-Z_0-9]('.$id.')[^a-zA-Z_0-9]/', 'ITEM_'.$this->refs_list[$id], $prereq); |
|
2756 | 2756 | } |
2757 | 2757 | } |
2758 | 2758 | |
@@ -2798,9 +2798,9 @@ discard block |
||
2798 | 2798 | if ($this->debug > 0) { |
2799 | 2799 | error_log('New LP - In learnpath::get_items_status_list()', 0); |
2800 | 2800 | } |
2801 | - $list = array (); |
|
2801 | + $list = array(); |
|
2802 | 2802 | foreach ($this->ordered_items as $item_id) { |
2803 | - $list[] = array ( |
|
2803 | + $list[] = array( |
|
2804 | 2804 | $item_id => $this->items[$item_id]->get_status() |
2805 | 2805 | ); |
2806 | 2806 | } |
@@ -2854,7 +2854,7 @@ discard block |
||
2854 | 2854 | $res = Database::query($sql); |
2855 | 2855 | $num = Database :: num_rows($res); |
2856 | 2856 | if ($num > 0) { |
2857 | - $list[] = array ( |
|
2857 | + $list[] = array( |
|
2858 | 2858 | 'order_id' => api_htmlentities(get_lang('Order'), ENT_QUOTES), |
2859 | 2859 | 'id' => api_htmlentities(get_lang('InteractionID'), ENT_QUOTES), |
2860 | 2860 | 'type' => api_htmlentities(get_lang('Type'), ENT_QUOTES), |
@@ -2865,7 +2865,7 @@ discard block |
||
2865 | 2865 | 'latency' => api_htmlentities(get_lang('LatencyTimeSpent'), ENT_QUOTES) |
2866 | 2866 | ); |
2867 | 2867 | while ($row = Database :: fetch_array($res)) { |
2868 | - $list[] = array ( |
|
2868 | + $list[] = array( |
|
2869 | 2869 | 'order_id' => ($row['order_id'] + 1), |
2870 | 2870 | 'id' => urldecode($row['interaction_id']), //urldecode because they often have %2F or stuff like that |
2871 | 2871 | 'type' => $row['interaction_type'], |
@@ -2933,7 +2933,7 @@ discard block |
||
2933 | 2933 | 'status' => api_htmlentities(get_lang('ObjectiveStatus'), ENT_QUOTES) |
2934 | 2934 | ); |
2935 | 2935 | while ($row = Database :: fetch_array($res)) { |
2936 | - $list[] = array ( |
|
2936 | + $list[] = array( |
|
2937 | 2937 | 'order_id' => ($row['order_id'] + 1), |
2938 | 2938 | 'objective_id' => urldecode($row['objective_id']), // urldecode() because they often have %2F or stuff like that. |
2939 | 2939 | 'score_raw' => $row['score_raw'], |
@@ -2960,7 +2960,7 @@ discard block |
||
2960 | 2960 | $toc = array(); |
2961 | 2961 | foreach ($this->ordered_items as $item_id) { |
2962 | 2962 | if ($this->debug > 2) { |
2963 | - error_log('learnpath::get_toc(): getting info for item ' . $item_id, 0); |
|
2963 | + error_log('learnpath::get_toc(): getting info for item '.$item_id, 0); |
|
2964 | 2964 | } |
2965 | 2965 | // TODO: Change this link generation and use new function instead. |
2966 | 2966 | $toc[] = array( |
@@ -2974,7 +2974,7 @@ discard block |
||
2974 | 2974 | ); |
2975 | 2975 | } |
2976 | 2976 | if ($this->debug > 2) { |
2977 | - error_log('New LP - In learnpath::get_toc() - TOC array: ' . print_r($toc, true), 0); |
|
2977 | + error_log('New LP - In learnpath::get_toc() - TOC array: '.print_r($toc, true), 0); |
|
2978 | 2978 | } |
2979 | 2979 | return $toc; |
2980 | 2980 | } |
@@ -2991,10 +2991,10 @@ discard block |
||
2991 | 2991 | } |
2992 | 2992 | $toc = $varname.' = new Array();'; |
2993 | 2993 | foreach ($this->ordered_items as $item_id) { |
2994 | - $toc.= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';"; |
|
2994 | + $toc .= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';"; |
|
2995 | 2995 | } |
2996 | 2996 | if ($this->debug > 2) { |
2997 | - error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: ' . print_r($toc, true), 0); |
|
2997 | + error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: '.print_r($toc, true), 0); |
|
2998 | 2998 | } |
2999 | 2999 | return $toc; |
3000 | 3000 | } |
@@ -3018,7 +3018,7 @@ discard block |
||
3018 | 3018 | } |
3019 | 3019 | } |
3020 | 3020 | if ($this->debug > 2) { |
3021 | - error_log('New LP - In learnpath::get_type() - Returning ' . ($res ? $res : 'false'), 0); |
|
3021 | + error_log('New LP - In learnpath::get_type() - Returning '.($res ? $res : 'false'), 0); |
|
3022 | 3022 | } |
3023 | 3023 | return $res; |
3024 | 3024 | } |
@@ -3034,7 +3034,7 @@ discard block |
||
3034 | 3034 | $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN); |
3035 | 3035 | $lp_id = intval($lp_id); |
3036 | 3036 | $sql = "SELECT lp_type FROM $tbl_lp |
3037 | - WHERE c_id = $course_id AND id = '" . $lp_id . "'"; |
|
3037 | + WHERE c_id = $course_id AND id = '".$lp_id."'"; |
|
3038 | 3038 | $res = Database::query($sql); |
3039 | 3039 | if ($res === false) { |
3040 | 3040 | return null; |
@@ -3131,7 +3131,7 @@ discard block |
||
3131 | 3131 | $dirTypes = self::getChapterTypes(); |
3132 | 3132 | |
3133 | 3133 | if (in_array($item['type'], $dirTypes)) { |
3134 | - $rowColor ='scorm_item_section '; |
|
3134 | + $rowColor = 'scorm_item_section '; |
|
3135 | 3135 | } |
3136 | 3136 | if ($item['id'] == $this->current) { |
3137 | 3137 | $rowColor = 'scorm_item_normal '.$rowColor.' scorm_highlight'; |
@@ -3139,7 +3139,7 @@ discard block |
||
3139 | 3139 | $rowColor = 'scorm_item_normal '.$rowColor.' '; |
3140 | 3140 | } |
3141 | 3141 | |
3142 | - $html .= '<div id="toc_' . $item['id'] . '" class="' . $rowColor . ' ' . $class_name[$item['status']] . '">'; |
|
3142 | + $html .= '<div id="toc_'.$item['id'].'" class="'.$rowColor.' '.$class_name[$item['status']].'">'; |
|
3143 | 3143 | |
3144 | 3144 | // Learning path title |
3145 | 3145 | $title = $item['title']; |
@@ -3169,7 +3169,7 @@ discard block |
||
3169 | 3169 | $html .= stripslashes($title); |
3170 | 3170 | } else { |
3171 | 3171 | $this->get_link('http', $item['id'], $toc_list); |
3172 | - $html .= '<a class="items-list" href="#" onclick="switch_item(' .$mycurrentitemid . ',' .$item['id'] . ');' .'return false;" >' . stripslashes($title) . '</a>'; |
|
3172 | + $html .= '<a class="items-list" href="#" onclick="switch_item('.$mycurrentitemid.','.$item['id'].');'.'return false;" >'.stripslashes($title).'</a>'; |
|
3173 | 3173 | } |
3174 | 3174 | $html .= "</div>"; |
3175 | 3175 | |
@@ -3203,12 +3203,12 @@ discard block |
||
3203 | 3203 | if ($this->get_lp_session_id() == api_get_session_id()) { |
3204 | 3204 | $html .= '<div id="actions_lp" class="actions_lp"><hr>'; |
3205 | 3205 | $html .= '<div class="btn-group">'; |
3206 | - $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'>" . |
|
3207 | - Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . "</a>"; |
|
3208 | - $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'>" . |
|
3209 | - Display::returnFontAwesomeIcon('pencil') . get_lang('Edit') . "</a>"; |
|
3210 | - $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">' . |
|
3211 | - Display::returnFontAwesomeIcon('cog') . get_lang('Settings').'</a>'; |
|
3206 | + $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'>". |
|
3207 | + Display::returnFontAwesomeIcon('street-view').get_lang('Overview')."</a>"; |
|
3208 | + $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'>". |
|
3209 | + Display::returnFontAwesomeIcon('pencil').get_lang('Edit')."</a>"; |
|
3210 | + $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">'. |
|
3211 | + Display::returnFontAwesomeIcon('cog').get_lang('Settings').'</a>'; |
|
3212 | 3212 | $html .= '</div>'; |
3213 | 3213 | $html .= '</div>'; |
3214 | 3214 | } |
@@ -3260,11 +3260,11 @@ discard block |
||
3260 | 3260 | $course_id = $this->get_course_int_id(); |
3261 | 3261 | |
3262 | 3262 | if ($this->debug > 0) { |
3263 | - error_log('New LP - In learnpath::get_link(' . $type . ',' . $item_id . ')', 0); |
|
3263 | + error_log('New LP - In learnpath::get_link('.$type.','.$item_id.')', 0); |
|
3264 | 3264 | } |
3265 | 3265 | if (empty($item_id)) { |
3266 | 3266 | if ($this->debug > 2) { |
3267 | - 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 | + error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: '.$this->get_current_item_id(), 0); |
|
3268 | 3268 | } |
3269 | 3269 | $item_id = $this->get_current_item_id(); |
3270 | 3270 | } |
@@ -3296,7 +3296,7 @@ discard block |
||
3296 | 3296 | ON (li.lp_id = l.id AND l.c_id = $course_id AND li.c_id = $course_id ) |
3297 | 3297 | WHERE li.id = $item_id "; |
3298 | 3298 | if ($this->debug > 2) { |
3299 | - error_log('New LP - In learnpath::get_link() - selecting item ' . $sql, 0); |
|
3299 | + error_log('New LP - In learnpath::get_link() - selecting item '.$sql, 0); |
|
3300 | 3300 | } |
3301 | 3301 | $res = Database::query($sql); |
3302 | 3302 | if (Database :: num_rows($res) > 0) { |
@@ -3310,9 +3310,9 @@ discard block |
||
3310 | 3310 | if (empty($lp_item_params) && strpos($lp_item_path, '?') !== false) { |
3311 | 3311 | list($lp_item_path, $lp_item_params) = explode('?', $lp_item_path); |
3312 | 3312 | } |
3313 | - $sys_course_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path(); |
|
3313 | + $sys_course_path = api_get_path(SYS_COURSE_PATH).api_get_course_path(); |
|
3314 | 3314 | if ($type == 'http') { |
3315 | - $course_path = api_get_path(WEB_COURSE_PATH) . api_get_course_path(); //web path |
|
3315 | + $course_path = api_get_path(WEB_COURSE_PATH).api_get_course_path(); //web path |
|
3316 | 3316 | } else { |
3317 | 3317 | $course_path = $sys_course_path; //system path |
3318 | 3318 | } |
@@ -3323,8 +3323,8 @@ discard block |
||
3323 | 3323 | } |
3324 | 3324 | |
3325 | 3325 | if ($this->debug > 2) { |
3326 | - error_log('New LP - In learnpath::get_link() - $lp_type ' . $lp_type, 0); |
|
3327 | - error_log('New LP - In learnpath::get_link() - $lp_item_type ' . $lp_item_type, 0); |
|
3326 | + error_log('New LP - In learnpath::get_link() - $lp_type '.$lp_type, 0); |
|
3327 | + error_log('New LP - In learnpath::get_link() - $lp_item_type '.$lp_item_type, 0); |
|
3328 | 3328 | } |
3329 | 3329 | |
3330 | 3330 | // Now go through the specific cases to get the end of the path |
@@ -3338,7 +3338,7 @@ discard block |
||
3338 | 3338 | $this->get_view_id() |
3339 | 3339 | ); |
3340 | 3340 | if ($this->debug > 0) { |
3341 | - error_log('rl_get_resource_link_for_learnpath - file: ' . $file, 0); |
|
3341 | + error_log('rl_get_resource_link_for_learnpath - file: '.$file, 0); |
|
3342 | 3342 | } |
3343 | 3343 | |
3344 | 3344 | switch ($lp_item_type) { |
@@ -3348,10 +3348,10 @@ discard block |
||
3348 | 3348 | case 'link': |
3349 | 3349 | if (Link::is_youtube_link($file)) { |
3350 | 3350 | $src = Link::get_youtube_video_id($file); |
3351 | - $file = api_get_path(WEB_CODE_PATH) . 'lp/embed.php?type=youtube&source='.$src; |
|
3351 | + $file = api_get_path(WEB_CODE_PATH).'lp/embed.php?type=youtube&source='.$src; |
|
3352 | 3352 | } elseif (Link::isVimeoLink($file)) { |
3353 | 3353 | $src = Link::getVimeoLinkId($file); |
3354 | - $file = api_get_path(WEB_CODE_PATH) . 'lp/embed.php?type=vimeo&source='.$src; |
|
3354 | + $file = api_get_path(WEB_CODE_PATH).'lp/embed.php?type=vimeo&source='.$src; |
|
3355 | 3355 | } else { |
3356 | 3356 | // If the current site is HTTPS and the link is |
3357 | 3357 | // HTTP, browsers will refuse opening the link |
@@ -3364,7 +3364,7 @@ discard block |
||
3364 | 3364 | //this is the special intervention case |
3365 | 3365 | $file = api_get_path( |
3366 | 3366 | WEB_CODE_PATH |
3367 | - ) . 'lp/embed.php?type=nonhttps&source='.urlencode($file); |
|
3367 | + ).'lp/embed.php?type=nonhttps&source='.urlencode($file); |
|
3368 | 3368 | } |
3369 | 3369 | } |
3370 | 3370 | } |
@@ -3410,7 +3410,7 @@ discard block |
||
3410 | 3410 | status='completed'"; |
3411 | 3411 | $result = Database::query($sql); |
3412 | 3412 | $row_count = Database:: fetch_row($result); |
3413 | - $count_item_view = (int)$row_count[0]; |
|
3413 | + $count_item_view = (int) $row_count[0]; |
|
3414 | 3414 | $not_multiple_attempt = 0; |
3415 | 3415 | if ($prevent_reinit === 1 && $count_item_view > 0) { |
3416 | 3416 | $not_multiple_attempt = 1; |
@@ -3429,7 +3429,7 @@ discard block |
||
3429 | 3429 | break; |
3430 | 3430 | case 2 : |
3431 | 3431 | if ($this->debug > 2) { |
3432 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0); |
|
3432 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0); |
|
3433 | 3433 | } |
3434 | 3434 | |
3435 | 3435 | if ($lp_item_type != 'dir') { |
@@ -3443,19 +3443,19 @@ discard block |
||
3443 | 3443 | //if ($this->prerequisites_match($item_id)) { |
3444 | 3444 | if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) { |
3445 | 3445 | if ($this->debug > 2) { |
3446 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0); |
|
3446 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0); |
|
3447 | 3447 | } |
3448 | 3448 | // Distant url, return as is. |
3449 | 3449 | $file = $lp_item_path; |
3450 | 3450 | } else { |
3451 | 3451 | if ($this->debug > 2) { |
3452 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0); |
|
3452 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0); |
|
3453 | 3453 | } |
3454 | 3454 | // Prevent getting untranslatable urls. |
3455 | 3455 | $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path); |
3456 | 3456 | $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path); |
3457 | 3457 | // Prepare the path. |
3458 | - $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path; |
|
3458 | + $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path; |
|
3459 | 3459 | // TODO: Fix this for urls with protocol header. |
3460 | 3460 | $file = str_replace('//', '/', $file); |
3461 | 3461 | $file = str_replace(':/', '://', $file); |
@@ -3463,11 +3463,11 @@ discard block |
||
3463 | 3463 | $lp_path = substr($lp_path, 0, -1); |
3464 | 3464 | } |
3465 | 3465 | |
3466 | - if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $lp_item_path))) { |
|
3466 | + if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$lp_item_path))) { |
|
3467 | 3467 | // if file not found. |
3468 | 3468 | $decoded = html_entity_decode($lp_item_path); |
3469 | 3469 | list ($decoded) = explode('?', $decoded); |
3470 | - if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $decoded))) { |
|
3470 | + if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$decoded))) { |
|
3471 | 3471 | |
3472 | 3472 | $file = self::rl_get_resource_link_for_learnpath( |
3473 | 3473 | $course_id, |
@@ -3487,14 +3487,14 @@ discard block |
||
3487 | 3487 | } |
3488 | 3488 | } |
3489 | 3489 | } else { |
3490 | - $file = $course_path . '/scorm/' . $lp_path . '/' . $decoded; |
|
3490 | + $file = $course_path.'/scorm/'.$lp_path.'/'.$decoded; |
|
3491 | 3491 | } |
3492 | 3492 | } |
3493 | 3493 | } |
3494 | 3494 | |
3495 | 3495 | // We want to use parameters if they were defined in the imsmanifest |
3496 | 3496 | if (strpos($file, 'blank.php') === false) { |
3497 | - $file .= (strstr($file, '?') === false ? '?' : '') . $lp_item_params; |
|
3497 | + $file .= (strstr($file, '?') === false ? '?' : '').$lp_item_params; |
|
3498 | 3498 | } |
3499 | 3499 | } else { |
3500 | 3500 | $file = 'lp_content.php?type=dir'; |
@@ -3502,12 +3502,12 @@ discard block |
||
3502 | 3502 | break; |
3503 | 3503 | case 3 : |
3504 | 3504 | if ($this->debug > 2) { |
3505 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0); |
|
3505 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0); |
|
3506 | 3506 | } |
3507 | 3507 | // Formatting AICC HACP append URL. |
3508 | - $aicc_append = '?aicc_sid=' . urlencode(session_id()) . '&aicc_url=' . urlencode(api_get_path(WEB_CODE_PATH) . 'lp/aicc_hacp.php') . '&'; |
|
3508 | + $aicc_append = '?aicc_sid='.urlencode(session_id()).'&aicc_url='.urlencode(api_get_path(WEB_CODE_PATH).'lp/aicc_hacp.php').'&'; |
|
3509 | 3509 | if (!empty($lp_item_params)) { |
3510 | - $aicc_append .= $lp_item_params . '&'; |
|
3510 | + $aicc_append .= $lp_item_params.'&'; |
|
3511 | 3511 | } |
3512 | 3512 | if ($lp_item_type != 'dir') { |
3513 | 3513 | // Quite complex here: |
@@ -3519,7 +3519,7 @@ discard block |
||
3519 | 3519 | |
3520 | 3520 | if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) { |
3521 | 3521 | if ($this->debug > 2) { |
3522 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0); |
|
3522 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0); |
|
3523 | 3523 | } |
3524 | 3524 | // Distant url, return as is. |
3525 | 3525 | $file = $lp_item_path; |
@@ -3532,19 +3532,19 @@ discard block |
||
3532 | 3532 | if (stripos($file, '<servername>') !== false) { |
3533 | 3533 | //$file = str_replace('<servername>',$course_path.'/scorm/'.$lp_path.'/',$lp_item_path); |
3534 | 3534 | $web_course_path = str_replace('https://', '', str_replace('http://', '', $course_path)); |
3535 | - $file = str_replace('<servername>', $web_course_path . '/scorm/' . $lp_path, $lp_item_path); |
|
3535 | + $file = str_replace('<servername>', $web_course_path.'/scorm/'.$lp_path, $lp_item_path); |
|
3536 | 3536 | } |
3537 | 3537 | // |
3538 | 3538 | $file .= $aicc_append; |
3539 | 3539 | } else { |
3540 | 3540 | if ($this->debug > 2) { |
3541 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0); |
|
3541 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0); |
|
3542 | 3542 | } |
3543 | 3543 | // Prevent getting untranslatable urls. |
3544 | 3544 | $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path); |
3545 | 3545 | $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path); |
3546 | 3546 | // Prepare the path - lp_path might be unusable because it includes the "aicc" subdir name. |
3547 | - $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path; |
|
3547 | + $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path; |
|
3548 | 3548 | // TODO: Fix this for urls with protocol header. |
3549 | 3549 | $file = str_replace('//', '/', $file); |
3550 | 3550 | $file = str_replace(':/', '://', $file); |
@@ -3563,7 +3563,7 @@ discard block |
||
3563 | 3563 | $file = !empty($file) ? str_replace('&', '&', $file) : ''; |
3564 | 3564 | } |
3565 | 3565 | if ($this->debug > 2) { |
3566 | - error_log('New LP - In learnpath::get_link() - returning "' . $file . '" from get_link', 0); |
|
3566 | + error_log('New LP - In learnpath::get_link() - returning "'.$file.'" from get_link', 0); |
|
3567 | 3567 | } |
3568 | 3568 | return $file; |
3569 | 3569 | } |
@@ -3581,7 +3581,7 @@ discard block |
||
3581 | 3581 | $search = ''; |
3582 | 3582 | // Use $attempt_num to enable multi-views management (disabled so far). |
3583 | 3583 | if ($attempt_num != 0 AND intval(strval($attempt_num)) == $attempt_num) { |
3584 | - $search = 'AND view_count = ' . $attempt_num; |
|
3584 | + $search = 'AND view_count = '.$attempt_num; |
|
3585 | 3585 | } |
3586 | 3586 | // When missing $attempt_num, search for a unique lp_view record for this lp and user. |
3587 | 3587 | $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW); |
@@ -3591,9 +3591,9 @@ discard block |
||
3591 | 3591 | |
3592 | 3592 | $sql = "SELECT id, view_count FROM $lp_view_table |
3593 | 3593 | WHERE |
3594 | - c_id = " . $course_id . " AND |
|
3595 | - lp_id = " . $this->get_id() . " AND |
|
3596 | - user_id = " . $this->get_user_id() . " AND |
|
3594 | + c_id = ".$course_id." AND |
|
3595 | + lp_id = " . $this->get_id()." AND |
|
3596 | + user_id = " . $this->get_user_id()." AND |
|
3597 | 3597 | session_id = $sessionId |
3598 | 3598 | $search |
3599 | 3599 | ORDER BY view_count DESC"; |
@@ -3604,7 +3604,7 @@ discard block |
||
3604 | 3604 | } else if (!api_is_invitee()) { |
3605 | 3605 | // There is no database record, create one. |
3606 | 3606 | $sql = "INSERT INTO $lp_view_table (c_id, lp_id,user_id, view_count, session_id) VALUES |
3607 | - ($course_id, " . $this->get_id() . "," . $this->get_user_id() . ", 1, $sessionId)"; |
|
3607 | + ($course_id, ".$this->get_id().",".$this->get_user_id().", 1, $sessionId)"; |
|
3608 | 3608 | Database::query($sql); |
3609 | 3609 | $id = Database :: insert_id(); |
3610 | 3610 | $this->lp_view_id = $id; |
@@ -3704,15 +3704,15 @@ discard block |
||
3704 | 3704 | { |
3705 | 3705 | $course_id = api_get_course_int_id(); |
3706 | 3706 | if ($this->debug > 0) { |
3707 | - error_log('New LP - In learnpath::move_item(' . $id . ',' . $direction . ')', 0); |
|
3707 | + error_log('New LP - In learnpath::move_item('.$id.','.$direction.')', 0); |
|
3708 | 3708 | } |
3709 | 3709 | if (empty($id) || empty($direction)) { |
3710 | 3710 | return false; |
3711 | 3711 | } |
3712 | 3712 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
3713 | 3713 | $sql_sel = "SELECT * |
3714 | - FROM " . $tbl_lp_item . " |
|
3715 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
3714 | + FROM " . $tbl_lp_item." |
|
3715 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
3716 | 3716 | $res_sel = Database::query($sql_sel); |
3717 | 3717 | // Check if elem exists. |
3718 | 3718 | if (Database :: num_rows($res_sel) < 1) { |
@@ -3737,7 +3737,7 @@ discard block |
||
3737 | 3737 | WHERE c_id = ".$course_id." AND id = $previous"; |
3738 | 3738 | |
3739 | 3739 | if ($this->debug > 2) { |
3740 | - error_log('Selecting previous: ' . $sql_sel2, 0); |
|
3740 | + error_log('Selecting previous: '.$sql_sel2, 0); |
|
3741 | 3741 | } |
3742 | 3742 | $res_sel2 = Database::query($sql_sel2); |
3743 | 3743 | if (Database :: num_rows($res_sel2) < 1) { |
@@ -3790,7 +3790,7 @@ discard block |
||
3790 | 3790 | } |
3791 | 3791 | Database::query($sql_upd2); |
3792 | 3792 | } |
3793 | - $display = $display -1; |
|
3793 | + $display = $display - 1; |
|
3794 | 3794 | } |
3795 | 3795 | break; |
3796 | 3796 | case 'down': |
@@ -3801,7 +3801,7 @@ discard block |
||
3801 | 3801 | } else { |
3802 | 3802 | $sql_sel2 = "SELECT * FROM $tbl_lp_item WHERE c_id = ".$course_id." AND id = $next"; |
3803 | 3803 | if ($this->debug > 2) { |
3804 | - error_log('Selecting next: ' . $sql_sel2, 0); |
|
3804 | + error_log('Selecting next: '.$sql_sel2, 0); |
|
3805 | 3805 | } |
3806 | 3806 | $res_sel2 = Database::query($sql_sel2); |
3807 | 3807 | if (Database :: num_rows($res_sel2) < 1) { |
@@ -3839,7 +3839,7 @@ discard block |
||
3839 | 3839 | WHERE c_id = ".$course_id." AND id = $next_next"; |
3840 | 3840 | Database::query($sql_upd2); |
3841 | 3841 | } |
3842 | - $display = $display +1; |
|
3842 | + $display = $display + 1; |
|
3843 | 3843 | } |
3844 | 3844 | break; |
3845 | 3845 | default : |
@@ -3862,8 +3862,8 @@ discard block |
||
3862 | 3862 | $res = Database::query($sql); |
3863 | 3863 | if ($res === false) |
3864 | 3864 | return false; |
3865 | - $lps = array (); |
|
3866 | - $lp_order = array (); |
|
3865 | + $lps = array(); |
|
3866 | + $lp_order = array(); |
|
3867 | 3867 | $num = Database :: num_rows($res); |
3868 | 3868 | // First check the order is correct, globally (might be wrong because |
3869 | 3869 | // of versions < 1.8.4) |
@@ -3873,7 +3873,7 @@ discard block |
||
3873 | 3873 | if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it. |
3874 | 3874 | $need_fix = true; |
3875 | 3875 | $sql_u = "UPDATE $lp_table SET display_order = $i |
3876 | - WHERE c_id = ".$course_id." AND id = " . $row['id']; |
|
3876 | + WHERE c_id = ".$course_id." AND id = ".$row['id']; |
|
3877 | 3877 | Database::query($sql_u); |
3878 | 3878 | } |
3879 | 3879 | $row['display_order'] = $i; |
@@ -3886,10 +3886,10 @@ discard block |
||
3886 | 3886 | $order = $lps[$lp_id]['display_order']; |
3887 | 3887 | if ($order > 1) { // If it's the first element, no need to move up. |
3888 | 3888 | $sql_u1 = "UPDATE $lp_table SET display_order = $order |
3889 | - WHERE c_id = ".$course_id." AND id = " . $lp_order[$order - 1]; |
|
3889 | + WHERE c_id = ".$course_id." AND id = ".$lp_order[$order - 1]; |
|
3890 | 3890 | Database::query($sql_u1); |
3891 | - $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order - 1) . " |
|
3892 | - WHERE c_id = ".$course_id." AND id = " . $lp_id; |
|
3891 | + $sql_u2 = "UPDATE $lp_table SET display_order = ".($order - 1)." |
|
3892 | + WHERE c_id = ".$course_id." AND id = ".$lp_id; |
|
3893 | 3893 | Database::query($sql_u2); |
3894 | 3894 | } |
3895 | 3895 | } |
@@ -3923,7 +3923,7 @@ discard block |
||
3923 | 3923 | if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it. |
3924 | 3924 | $need_fix = true; |
3925 | 3925 | $sql_u = "UPDATE $lp_table SET display_order = $i |
3926 | - WHERE c_id = ".$course_id." AND id = " . $row['id']; |
|
3926 | + WHERE c_id = ".$course_id." AND id = ".$row['id']; |
|
3927 | 3927 | Database::query($sql_u); |
3928 | 3928 | } |
3929 | 3929 | $row['display_order'] = $i; |
@@ -3936,10 +3936,10 @@ discard block |
||
3936 | 3936 | $order = $lps[$lp_id]['display_order']; |
3937 | 3937 | if ($order < $max) { // If it's the first element, no need to move up. |
3938 | 3938 | $sql_u1 = "UPDATE $lp_table SET display_order = $order |
3939 | - WHERE c_id = ".$course_id." AND id = " . $lp_order[$order + 1]; |
|
3939 | + WHERE c_id = ".$course_id." AND id = ".$lp_order[$order + 1]; |
|
3940 | 3940 | Database::query($sql_u1); |
3941 | - $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order + 1) . " |
|
3942 | - WHERE c_id = ".$course_id." AND id = " . $lp_id; |
|
3941 | + $sql_u2 = "UPDATE $lp_table SET display_order = ".($order + 1)." |
|
3942 | + WHERE c_id = ".$course_id." AND id = ".$lp_id; |
|
3943 | 3943 | Database::query($sql_u2); |
3944 | 3944 | } |
3945 | 3945 | } |
@@ -3959,15 +3959,15 @@ discard block |
||
3959 | 3959 | $this->autocomplete_parents($this->last); |
3960 | 3960 | $new_index = $this->get_next_index(); |
3961 | 3961 | if ($this->debug > 2) { |
3962 | - error_log('New LP - New index: ' . $new_index, 0); |
|
3962 | + error_log('New LP - New index: '.$new_index, 0); |
|
3963 | 3963 | } |
3964 | 3964 | $this->index = $new_index; |
3965 | 3965 | if ($this->debug > 2) { |
3966 | - error_log('New LP - Now having orderedlist[' . $new_index . '] = ' . $this->ordered_items[$new_index], 0); |
|
3966 | + error_log('New LP - Now having orderedlist['.$new_index.'] = '.$this->ordered_items[$new_index], 0); |
|
3967 | 3967 | } |
3968 | 3968 | $this->current = $this->ordered_items[$new_index]; |
3969 | 3969 | if ($this->debug > 2) { |
3970 | - error_log('New LP - new item id is ' . $this->current . '-' . $this->get_current_item_id(), 0); |
|
3970 | + error_log('New LP - new item id is '.$this->current.'-'.$this->get_current_item_id(), 0); |
|
3971 | 3971 | } |
3972 | 3972 | } |
3973 | 3973 | |
@@ -4031,7 +4031,7 @@ discard block |
||
4031 | 4031 | // Clean spaces. |
4032 | 4032 | $prereq_string = str_replace(' ', '', $prereq_string); |
4033 | 4033 | if ($debug > 0) { |
4034 | - error_log('Found prereq_string: ' . $prereq_string, 0); |
|
4034 | + error_log('Found prereq_string: '.$prereq_string, 0); |
|
4035 | 4035 | } |
4036 | 4036 | // Now send to the parse_prereq() function that will check this component's prerequisites. |
4037 | 4037 | $result = $currentItem->parse_prereq( |
@@ -4047,12 +4047,12 @@ discard block |
||
4047 | 4047 | } else { |
4048 | 4048 | $result = true; |
4049 | 4049 | if ($debug > 1) { |
4050 | - error_log('$this->items[' . $itemId . '] was not an object', 0); |
|
4050 | + error_log('$this->items['.$itemId.'] was not an object', 0); |
|
4051 | 4051 | } |
4052 | 4052 | } |
4053 | 4053 | |
4054 | 4054 | if ($debug > 1) { |
4055 | - error_log('End of prerequisites_match(). Error message is now ' . $this->error, 0); |
|
4055 | + error_log('End of prerequisites_match(). Error message is now '.$this->error, 0); |
|
4056 | 4056 | } |
4057 | 4057 | return $result; |
4058 | 4058 | } |
@@ -4118,11 +4118,11 @@ discard block |
||
4118 | 4118 | $row = Database :: fetch_array($result); |
4119 | 4119 | $name = domesticate($row['name']); |
4120 | 4120 | if ($set_visibility == 'i') { |
4121 | - $s = $name . " " . get_lang('LearnpathNotPublished'); |
|
4121 | + $s = $name." ".get_lang('LearnpathNotPublished'); |
|
4122 | 4122 | $v = 0; |
4123 | 4123 | } |
4124 | 4124 | if ($set_visibility == 'v') { |
4125 | - $s = $name . " " . get_lang('LearnpathPublished'); |
|
4125 | + $s = $name." ".get_lang('LearnpathPublished'); |
|
4126 | 4126 | $v = 1; |
4127 | 4127 | } |
4128 | 4128 | } else { |
@@ -4204,9 +4204,9 @@ discard block |
||
4204 | 4204 | $course_id = api_get_course_int_id(); |
4205 | 4205 | $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW); |
4206 | 4206 | $sql = "INSERT INTO $lp_view_table (c_id, lp_id, user_id, view_count, session_id) |
4207 | - VALUES ($course_id, " . $this->lp_id . "," . $this->get_user_id() . "," . ($this->attempt + 1) . ", $session_id)"; |
|
4207 | + VALUES ($course_id, ".$this->lp_id.",".$this->get_user_id().",".($this->attempt + 1).", $session_id)"; |
|
4208 | 4208 | if ($this->debug > 2) { |
4209 | - error_log('New LP - Inserting new lp_view for restart: ' . $sql, 0); |
|
4209 | + error_log('New LP - Inserting new lp_view for restart: '.$sql, 0); |
|
4210 | 4210 | } |
4211 | 4211 | Database::query($sql); |
4212 | 4212 | $view_id = Database::insert_id(); |
@@ -4242,10 +4242,10 @@ discard block |
||
4242 | 4242 | // TODO: Do a better check on the index pointing to the right item (it is supposed to be working |
4243 | 4243 | // on $ordered_items[] but not sure it's always safe to use with $items[]). |
4244 | 4244 | if ($this->debug > 2) { |
4245 | - error_log('New LP - save_current() saving item ' . $this->current, 0); |
|
4245 | + error_log('New LP - save_current() saving item '.$this->current, 0); |
|
4246 | 4246 | } |
4247 | 4247 | if ($this->debug > 2) { |
4248 | - error_log('' . print_r($this->items, true), 0); |
|
4248 | + error_log(''.print_r($this->items, true), 0); |
|
4249 | 4249 | } |
4250 | 4250 | if (isset($this->items[$this->current]) && |
4251 | 4251 | is_object($this->items[$this->current]) |
@@ -4269,7 +4269,7 @@ discard block |
||
4269 | 4269 | { |
4270 | 4270 | $debug = $this->debug; |
4271 | 4271 | if ($debug) { |
4272 | - error_log('In learnpath::save_item(' . $item_id . ',' . intval($from_outside). ')', 0); |
|
4272 | + error_log('In learnpath::save_item('.$item_id.','.intval($from_outside).')', 0); |
|
4273 | 4273 | } |
4274 | 4274 | // TODO: Do a better check on the index pointing to the right item (it is supposed to be working |
4275 | 4275 | // on $ordered_items[] but not sure it's always safe to use with $items[]). |
@@ -4292,7 +4292,7 @@ discard block |
||
4292 | 4292 | |
4293 | 4293 | if ($debug) { |
4294 | 4294 | error_log('update_queue before:'); |
4295 | - error_log(print_r($this->update_queue,1)); |
|
4295 | + error_log(print_r($this->update_queue, 1)); |
|
4296 | 4296 | } |
4297 | 4297 | $this->autocomplete_parents($item_id); |
4298 | 4298 | |
@@ -4300,9 +4300,9 @@ discard block |
||
4300 | 4300 | $this->update_queue[$item_id] = $status; |
4301 | 4301 | |
4302 | 4302 | if ($debug) { |
4303 | - error_log('get_status(): ' . $status); |
|
4303 | + error_log('get_status(): '.$status); |
|
4304 | 4304 | error_log('update_queue after:'); |
4305 | - error_log(print_r($this->update_queue,1)); |
|
4305 | + error_log(print_r($this->update_queue, 1)); |
|
4306 | 4306 | } |
4307 | 4307 | return $res; |
4308 | 4308 | } |
@@ -4323,17 +4323,17 @@ discard block |
||
4323 | 4323 | |
4324 | 4324 | if (isset($this->current) && !api_is_invitee()) { |
4325 | 4325 | if ($this->debug > 2) { |
4326 | - error_log('New LP - Saving current item (' . $this->current . ') for later review', 0); |
|
4326 | + error_log('New LP - Saving current item ('.$this->current.') for later review', 0); |
|
4327 | 4327 | } |
4328 | 4328 | $sql = "UPDATE $table SET |
4329 | - last_item = " . intval($this->get_current_item_id()). " |
|
4329 | + last_item = ".intval($this->get_current_item_id())." |
|
4330 | 4330 | WHERE |
4331 | 4331 | c_id = $course_id AND |
4332 | - lp_id = " . $this->get_id() . " AND |
|
4332 | + lp_id = ".$this->get_id()." AND |
|
4333 | 4333 | user_id = " . $this->get_user_id()." ".$session_condition; |
4334 | 4334 | |
4335 | 4335 | if ($this->debug > 2) { |
4336 | - error_log('New LP - Saving last item seen : ' . $sql, 0); |
|
4336 | + error_log('New LP - Saving last item seen : '.$sql, 0); |
|
4337 | 4337 | } |
4338 | 4338 | Database::query($sql); |
4339 | 4339 | } |
@@ -4347,7 +4347,7 @@ discard block |
||
4347 | 4347 | progress = $progress |
4348 | 4348 | WHERE |
4349 | 4349 | c_id = ".$course_id." AND |
4350 | - lp_id = " . $this->get_id() . " AND |
|
4350 | + lp_id = " . $this->get_id()." AND |
|
4351 | 4351 | user_id = " . $this->get_user_id()." ".$session_condition; |
4352 | 4352 | // Ignore errors as some tables might not have the progress field just yet. |
4353 | 4353 | Database::query($sql); |
@@ -4363,7 +4363,7 @@ discard block |
||
4363 | 4363 | public function set_current_item($item_id = null) |
4364 | 4364 | { |
4365 | 4365 | if ($this->debug > 0) { |
4366 | - error_log('New LP - In learnpath::set_current_item(' . $item_id . ')', 0); |
|
4366 | + error_log('New LP - In learnpath::set_current_item('.$item_id.')', 0); |
|
4367 | 4367 | } |
4368 | 4368 | if (empty ($item_id)) { |
4369 | 4369 | if ($this->debug > 2) { |
@@ -4372,7 +4372,7 @@ discard block |
||
4372 | 4372 | // Do nothing. |
4373 | 4373 | } else { |
4374 | 4374 | if ($this->debug > 2) { |
4375 | - error_log('New LP - New current item given is ' . $item_id . '...', 0); |
|
4375 | + error_log('New LP - New current item given is '.$item_id.'...', 0); |
|
4376 | 4376 | } |
4377 | 4377 | if (is_numeric($item_id)) { |
4378 | 4378 | $item_id = intval($item_id); |
@@ -4387,10 +4387,10 @@ discard block |
||
4387 | 4387 | } |
4388 | 4388 | } |
4389 | 4389 | if ($this->debug > 2) { |
4390 | - error_log('New LP - set_current_item(' . $item_id . ') done. Index is now : ' . $this->index, 0); |
|
4390 | + error_log('New LP - set_current_item('.$item_id.') done. Index is now : '.$this->index, 0); |
|
4391 | 4391 | } |
4392 | 4392 | } else { |
4393 | - error_log('New LP - set_current_item(' . $item_id . ') failed. Not a numeric value: ', 0); |
|
4393 | + error_log('New LP - set_current_item('.$item_id.') failed. Not a numeric value: ', 0); |
|
4394 | 4394 | } |
4395 | 4395 | } |
4396 | 4396 | } |
@@ -4416,7 +4416,7 @@ discard block |
||
4416 | 4416 | if ($lp != 0) { |
4417 | 4417 | $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN); |
4418 | 4418 | $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' |
4419 | - WHERE c_id = ".$course_id." AND id = " . $lp; |
|
4419 | + WHERE c_id = ".$course_id." AND id = ".$lp; |
|
4420 | 4420 | $res = Database::query($sql); |
4421 | 4421 | return $res; |
4422 | 4422 | } |
@@ -4441,7 +4441,7 @@ discard block |
||
4441 | 4441 | if ($lp != 0) { |
4442 | 4442 | $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN); |
4443 | 4443 | $sql = "UPDATE $tbl_lp SET js_lib = '$lib' |
4444 | - WHERE c_id = ".$course_id." AND id = " . $lp; |
|
4444 | + WHERE c_id = ".$course_id." AND id = ".$lp; |
|
4445 | 4445 | $res = Database::query($sql); |
4446 | 4446 | return $res; |
4447 | 4447 | } else { |
@@ -4466,10 +4466,10 @@ discard block |
||
4466 | 4466 | $course_id = api_get_course_int_id(); |
4467 | 4467 | $lp_id = $this->get_id(); |
4468 | 4468 | $sql = "UPDATE $lp_table SET |
4469 | - content_maker = '" . Database::escape_string($this->maker) . "' |
|
4469 | + content_maker = '".Database::escape_string($this->maker)."' |
|
4470 | 4470 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4471 | 4471 | if ($this->debug > 2) { |
4472 | - error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0); |
|
4472 | + error_log('New LP - lp updated with new content_maker : '.$this->maker, 0); |
|
4473 | 4473 | } |
4474 | 4474 | Database::query($sql); |
4475 | 4475 | return true; |
@@ -4493,10 +4493,10 @@ discard block |
||
4493 | 4493 | $lp_id = $this->get_id(); |
4494 | 4494 | $course_id = $this->course_info['real_id']; |
4495 | 4495 | $sql = "UPDATE $lp_table SET |
4496 | - name = '" . Database::escape_string($this->name). "' |
|
4496 | + name = '".Database::escape_string($this->name)."' |
|
4497 | 4497 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4498 | 4498 | if ($this->debug > 2) { |
4499 | - error_log('New LP - lp updated with new name : ' . $this->name, 0); |
|
4499 | + error_log('New LP - lp updated with new name : '.$this->name, 0); |
|
4500 | 4500 | } |
4501 | 4501 | $result = Database::query($sql); |
4502 | 4502 | // If the lp is visible on the homepage, change his name there. |
@@ -4504,7 +4504,7 @@ discard block |
||
4504 | 4504 | $session_id = api_get_session_id(); |
4505 | 4505 | $session_condition = api_get_session_condition($session_id); |
4506 | 4506 | $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST); |
4507 | - $link = 'lp/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id; |
|
4507 | + $link = 'lp/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id; |
|
4508 | 4508 | $sql = "UPDATE $tbl_tool SET name = '$this->name' |
4509 | 4509 | WHERE |
4510 | 4510 | c_id = $course_id AND |
@@ -4582,10 +4582,10 @@ discard block |
||
4582 | 4582 | |
4583 | 4583 | // Save it to search engine. |
4584 | 4584 | foreach ($missing_terms as $term) { |
4585 | - $doc->add_term($prefix . $term, 1); |
|
4585 | + $doc->add_term($prefix.$term, 1); |
|
4586 | 4586 | } |
4587 | 4587 | foreach ($deprecated_terms as $term) { |
4588 | - $doc->remove_term($prefix . $term); |
|
4588 | + $doc->remove_term($prefix.$term); |
|
4589 | 4589 | } |
4590 | 4590 | $di->getDb()->replace_document((int) $se_ref['search_did'], $doc); |
4591 | 4591 | $di->getDb()->flush(); |
@@ -4610,10 +4610,10 @@ discard block |
||
4610 | 4610 | $this->theme = $name; |
4611 | 4611 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4612 | 4612 | $lp_id = $this->get_id(); |
4613 | - $sql = "UPDATE $lp_table SET theme = '" . Database::escape_string($this->theme). "' |
|
4613 | + $sql = "UPDATE $lp_table SET theme = '".Database::escape_string($this->theme)."' |
|
4614 | 4614 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4615 | 4615 | if ($this->debug > 2) { |
4616 | - error_log('New LP - lp updated with new theme : ' . $this->theme, 0); |
|
4616 | + error_log('New LP - lp updated with new theme : '.$this->theme, 0); |
|
4617 | 4617 | } |
4618 | 4618 | Database::query($sql); |
4619 | 4619 | |
@@ -4636,10 +4636,10 @@ discard block |
||
4636 | 4636 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4637 | 4637 | $lp_id = $this->get_id(); |
4638 | 4638 | $sql = "UPDATE $lp_table SET |
4639 | - preview_image = '" . Database::escape_string($this->preview_image). "' |
|
4639 | + preview_image = '".Database::escape_string($this->preview_image)."' |
|
4640 | 4640 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4641 | 4641 | if ($this->debug > 2) { |
4642 | - error_log('New LP - lp updated with new preview image : ' . $this->preview_image, 0); |
|
4642 | + error_log('New LP - lp updated with new preview image : '.$this->preview_image, 0); |
|
4643 | 4643 | } |
4644 | 4644 | Database::query($sql); |
4645 | 4645 | return true; |
@@ -4659,10 +4659,10 @@ discard block |
||
4659 | 4659 | $this->author = $name; |
4660 | 4660 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4661 | 4661 | $lp_id = $this->get_id(); |
4662 | - $sql = "UPDATE $lp_table SET author = '" . Database::escape_string($name). "' |
|
4662 | + $sql = "UPDATE $lp_table SET author = '".Database::escape_string($name)."' |
|
4663 | 4663 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4664 | 4664 | if ($this->debug > 2) { |
4665 | - error_log('New LP - lp updated with new preview author : ' . $this->author, 0); |
|
4665 | + error_log('New LP - lp updated with new preview author : '.$this->author, 0); |
|
4666 | 4666 | } |
4667 | 4667 | Database::query($sql); |
4668 | 4668 | |
@@ -4685,10 +4685,10 @@ discard block |
||
4685 | 4685 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4686 | 4686 | $lp_id = $this->get_id(); |
4687 | 4687 | $sql = "UPDATE $lp_table SET |
4688 | - hide_toc_frame = '" . (int) $this->hide_toc_frame . "' |
|
4688 | + hide_toc_frame = '".(int) $this->hide_toc_frame."' |
|
4689 | 4689 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4690 | 4690 | if ($this->debug > 2) { |
4691 | - error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0); |
|
4691 | + error_log('New LP - lp updated with new preview hide_toc_frame : '.$this->author, 0); |
|
4692 | 4692 | } |
4693 | 4693 | Database::query($sql); |
4694 | 4694 | |
@@ -4715,7 +4715,7 @@ discard block |
||
4715 | 4715 | $sql = "UPDATE $lp_table SET prerequisite = '".$this->prerequisite."' |
4716 | 4716 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4717 | 4717 | if ($this->debug > 2) { |
4718 | - error_log('New LP - lp updated with new preview requisite : ' . $this->requisite, 0); |
|
4718 | + error_log('New LP - lp updated with new preview requisite : '.$this->requisite, 0); |
|
4719 | 4719 | } |
4720 | 4720 | Database::query($sql); |
4721 | 4721 | return true; |
@@ -4739,10 +4739,10 @@ discard block |
||
4739 | 4739 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4740 | 4740 | $lp_id = $this->get_id(); |
4741 | 4741 | $sql = "UPDATE $lp_table SET |
4742 | - content_local = '" . Database::escape_string($name) . "' |
|
4742 | + content_local = '".Database::escape_string($name)."' |
|
4743 | 4743 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4744 | 4744 | if ($this->debug > 2) { |
4745 | - error_log('New LP - lp updated with new proximity : ' . $this->proximity, 0); |
|
4745 | + error_log('New LP - lp updated with new proximity : '.$this->proximity, 0); |
|
4746 | 4746 | } |
4747 | 4747 | Database::query($sql); |
4748 | 4748 | return true; |
@@ -4776,11 +4776,11 @@ discard block |
||
4776 | 4776 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4777 | 4777 | $lp_id = $this->get_id(); |
4778 | 4778 | $sql = "UPDATE $lp_table SET |
4779 | - use_max_score = '" . $this->use_max_score . "' |
|
4779 | + use_max_score = '".$this->use_max_score."' |
|
4780 | 4780 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4781 | 4781 | |
4782 | 4782 | if ($this->debug > 2) { |
4783 | - error_log('New LP - lp updated with new use_max_score : ' . $this->use_max_score, 0); |
|
4783 | + error_log('New LP - lp updated with new use_max_score : '.$this->use_max_score, 0); |
|
4784 | 4784 | } |
4785 | 4785 | Database::query($sql); |
4786 | 4786 | |
@@ -4807,7 +4807,7 @@ discard block |
||
4807 | 4807 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4808 | 4808 | $lp_id = $this->get_id(); |
4809 | 4809 | if ($this->debug > 2) { |
4810 | - error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0); |
|
4810 | + error_log('New LP - lp updated with new expired_on : '.$this->expired_on, 0); |
|
4811 | 4811 | } |
4812 | 4812 | |
4813 | 4813 | $params = [ |
@@ -4837,10 +4837,10 @@ discard block |
||
4837 | 4837 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4838 | 4838 | $lp_id = $this->get_id(); |
4839 | 4839 | $sql = "UPDATE $lp_table SET |
4840 | - publicated_on = '" . Database::escape_string($this->publicated_on) . "' |
|
4840 | + publicated_on = '".Database::escape_string($this->publicated_on)."' |
|
4841 | 4841 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4842 | 4842 | if ($this->debug > 2) { |
4843 | - error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0); |
|
4843 | + error_log('New LP - lp updated with new publicated_on : '.$this->publicated_on, 0); |
|
4844 | 4844 | } |
4845 | 4845 | Database::query($sql); |
4846 | 4846 | |
@@ -4860,10 +4860,10 @@ discard block |
||
4860 | 4860 | $this->modified_on = api_get_utc_datetime(); |
4861 | 4861 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4862 | 4862 | $lp_id = $this->get_id(); |
4863 | - $sql = "UPDATE $lp_table SET modified_on = '" . $this->modified_on . "' |
|
4863 | + $sql = "UPDATE $lp_table SET modified_on = '".$this->modified_on."' |
|
4864 | 4864 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
4865 | 4865 | if ($this->debug > 2) { |
4866 | - error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0); |
|
4866 | + error_log('New LP - lp updated with new expired_on : '.$this->modified_on, 0); |
|
4867 | 4867 | } |
4868 | 4868 | Database::query($sql); |
4869 | 4869 | |
@@ -4935,13 +4935,13 @@ discard block |
||
4935 | 4935 | |
4936 | 4936 | if ($this->last != 0 && $this->last != $this->current && is_object($this->items[$this->last])) { |
4937 | 4937 | if ($this->debug > 2) { |
4938 | - error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' is object', 0); |
|
4938 | + error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' is object', 0); |
|
4939 | 4939 | } |
4940 | 4940 | switch ($this->get_type()) { |
4941 | 4941 | case '3': |
4942 | 4942 | if ($this->items[$this->last]->get_type() != 'au') { |
4943 | 4943 | if ($this->debug > 2) { |
4944 | - error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 3 is <> au', 0); |
|
4944 | + error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 3 is <> au', 0); |
|
4945 | 4945 | } |
4946 | 4946 | $this->items[$this->last]->close(); |
4947 | 4947 | //$this->autocomplete_parents($this->last); |
@@ -4954,7 +4954,7 @@ discard block |
||
4954 | 4954 | case '2': |
4955 | 4955 | if ($this->items[$this->last]->get_type() != 'sco') { |
4956 | 4956 | if ($this->debug > 2) { |
4957 | - error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 2 is <> sco', 0); |
|
4957 | + error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 2 is <> sco', 0); |
|
4958 | 4958 | } |
4959 | 4959 | $this->items[$this->last]->close(); |
4960 | 4960 | //$this->autocomplete_parents($this->last); |
@@ -4968,7 +4968,7 @@ discard block |
||
4968 | 4968 | case '1': |
4969 | 4969 | default: |
4970 | 4970 | if ($this->debug > 2) { |
4971 | - error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 1 is asset', 0); |
|
4971 | + error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 1 is asset', 0); |
|
4972 | 4972 | } |
4973 | 4973 | $this->items[$this->last]->close(); |
4974 | 4974 | break; |
@@ -4994,7 +4994,7 @@ discard block |
||
4994 | 4994 | } |
4995 | 4995 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4996 | 4996 | $sql = "SELECT * FROM $lp_table |
4997 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
4997 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
4998 | 4998 | $res = Database::query($sql); |
4999 | 4999 | if (Database :: num_rows($res) > 0) { |
5000 | 5000 | $row = Database :: fetch_array($res); |
@@ -5015,14 +5015,14 @@ discard block |
||
5015 | 5015 | break; |
5016 | 5016 | } |
5017 | 5017 | $sql = "UPDATE $lp_table SET default_view_mod = '$view_mode' |
5018 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5018 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5019 | 5019 | Database::query($sql); |
5020 | 5020 | $this->mode = $view_mode; |
5021 | 5021 | |
5022 | 5022 | return $view_mode; |
5023 | 5023 | } else { |
5024 | 5024 | if ($this->debug > 2) { |
5025 | - error_log('New LP - Problem in update_default_view() - could not find LP ' . $this->get_id() . ' in DB', 0); |
|
5025 | + error_log('New LP - Problem in update_default_view() - could not find LP '.$this->get_id().' in DB', 0); |
|
5026 | 5026 | } |
5027 | 5027 | } |
5028 | 5028 | return -1; |
@@ -5040,7 +5040,7 @@ discard block |
||
5040 | 5040 | } |
5041 | 5041 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
5042 | 5042 | $sql = "SELECT * FROM $lp_table |
5043 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5043 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5044 | 5044 | $res = Database::query($sql); |
5045 | 5045 | if (Database :: num_rows($res) > 0) { |
5046 | 5046 | $row = Database :: fetch_array($res); |
@@ -5053,14 +5053,14 @@ discard block |
||
5053 | 5053 | $force_return = true; |
5054 | 5054 | } |
5055 | 5055 | $sql = "UPDATE $lp_table SET force_commit = $force |
5056 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5056 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5057 | 5057 | Database::query($sql); |
5058 | 5058 | $this->force_commit = $force_return; |
5059 | 5059 | |
5060 | 5060 | return $force_return; |
5061 | 5061 | } else { |
5062 | 5062 | if ($this->debug > 2) { |
5063 | - error_log('New LP - Problem in update_default_scorm_commit() - could not find LP ' . $this->get_id() . ' in DB', 0); |
|
5063 | + error_log('New LP - Problem in update_default_scorm_commit() - could not find LP '.$this->get_id().' in DB', 0); |
|
5064 | 5064 | } |
5065 | 5065 | } |
5066 | 5066 | return -1; |
@@ -5089,7 +5089,7 @@ discard block |
||
5089 | 5089 | if ($row['display_order'] != $i) { |
5090 | 5090 | // If we find a gap in the order, we need to fix it. |
5091 | 5091 | $sql = "UPDATE $lp_table SET display_order = $i |
5092 | - WHERE c_id = ".$course_id." AND id = " . $row['id']; |
|
5092 | + WHERE c_id = ".$course_id." AND id = ".$row['id']; |
|
5093 | 5093 | Database::query($sql); |
5094 | 5094 | } |
5095 | 5095 | $i++; |
@@ -5110,7 +5110,7 @@ discard block |
||
5110 | 5110 | } |
5111 | 5111 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
5112 | 5112 | $sql = "SELECT * FROM $lp_table |
5113 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5113 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5114 | 5114 | $res = Database::query($sql); |
5115 | 5115 | if (Database :: num_rows($res) > 0) { |
5116 | 5116 | $row = Database :: fetch_array($res); |
@@ -5121,13 +5121,13 @@ discard block |
||
5121 | 5121 | $force = 1; |
5122 | 5122 | } |
5123 | 5123 | $sql = "UPDATE $lp_table SET prevent_reinit = $force |
5124 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5124 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5125 | 5125 | Database::query($sql); |
5126 | 5126 | $this->prevent_reinit = $force; |
5127 | 5127 | return $force; |
5128 | 5128 | } else { |
5129 | 5129 | if ($this->debug > 2) { |
5130 | - error_log('New LP - Problem in update_reinit() - could not find LP ' . $this->get_id() . ' in DB', 0); |
|
5130 | + error_log('New LP - Problem in update_reinit() - could not find LP '.$this->get_id().' in DB', 0); |
|
5131 | 5131 | } |
5132 | 5132 | } |
5133 | 5133 | return -1; |
@@ -5143,11 +5143,11 @@ discard block |
||
5143 | 5143 | { |
5144 | 5144 | //Set default value for seriousgame_mode |
5145 | 5145 | if (!isset($this->seriousgame_mode)) { |
5146 | - $this->seriousgame_mode=0; |
|
5146 | + $this->seriousgame_mode = 0; |
|
5147 | 5147 | } |
5148 | 5148 | // Set default value for prevent_reinit |
5149 | 5149 | if (!isset($this->prevent_reinit)) { |
5150 | - $this->prevent_reinit =1; |
|
5150 | + $this->prevent_reinit = 1; |
|
5151 | 5151 | } |
5152 | 5152 | if ($this->seriousgame_mode == 1 && $this->prevent_reinit == 1) { |
5153 | 5153 | return 'seriousgame'; |
@@ -5195,7 +5195,7 @@ discard block |
||
5195 | 5195 | $sql = "UPDATE $lp_table SET |
5196 | 5196 | prevent_reinit = $prevent_reinit , |
5197 | 5197 | seriousgame_mode = $sg_mode |
5198 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5198 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5199 | 5199 | $res = Database::query($sql); |
5200 | 5200 | if ($res) { |
5201 | 5201 | return true; |
@@ -5247,7 +5247,7 @@ discard block |
||
5247 | 5247 | error_log('New LP - In learnpath::set_seriousgame_mode()', 0); |
5248 | 5248 | } |
5249 | 5249 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
5250 | - $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5250 | + $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5251 | 5251 | $res = Database::query($sql); |
5252 | 5252 | if (Database :: num_rows($res) > 0) { |
5253 | 5253 | $row = Database :: fetch_array($res); |
@@ -5258,13 +5258,13 @@ discard block |
||
5258 | 5258 | $force = 1; |
5259 | 5259 | } |
5260 | 5260 | $sql = "UPDATE $lp_table SET seriousgame_mode = $force |
5261 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5261 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5262 | 5262 | Database::query($sql); |
5263 | 5263 | $this->seriousgame_mode = $force; |
5264 | 5264 | return $force; |
5265 | 5265 | } else { |
5266 | 5266 | if ($this->debug > 2) { |
5267 | - error_log('New LP - Problem in set_seriousgame_mode() - could not find LP ' . $this->get_id() . ' in DB', 0); |
|
5267 | + error_log('New LP - Problem in set_seriousgame_mode() - could not find LP '.$this->get_id().' in DB', 0); |
|
5268 | 5268 | } |
5269 | 5269 | } |
5270 | 5270 | return -1; |
@@ -5282,7 +5282,7 @@ discard block |
||
5282 | 5282 | } |
5283 | 5283 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
5284 | 5284 | $sql = "SELECT * FROM $lp_table |
5285 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5285 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5286 | 5286 | $res = Database::query($sql); |
5287 | 5287 | if (Database :: num_rows($res) > 0) { |
5288 | 5288 | $row = Database :: fetch_array($res); |
@@ -5293,13 +5293,13 @@ discard block |
||
5293 | 5293 | $force = 1; |
5294 | 5294 | } |
5295 | 5295 | $sql = "UPDATE $lp_table SET debug = $force |
5296 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
5296 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
5297 | 5297 | Database::query($sql); |
5298 | 5298 | $this->scorm_debug = $force; |
5299 | 5299 | return $force; |
5300 | 5300 | } else { |
5301 | 5301 | if ($this->debug > 2) { |
5302 | - error_log('New LP - Problem in update_scorm_debug() - could not find LP ' . $this->get_id() . ' in DB', 0); |
|
5302 | + error_log('New LP - Problem in update_scorm_debug() - could not find LP '.$this->get_id().' in DB', 0); |
|
5303 | 5303 | } |
5304 | 5304 | } |
5305 | 5305 | return -1; |
@@ -5328,7 +5328,7 @@ discard block |
||
5328 | 5328 | * @param int $depth |
5329 | 5329 | * @param array $tmp |
5330 | 5330 | */ |
5331 | - public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array ()) |
|
5331 | + public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array()) |
|
5332 | 5332 | { |
5333 | 5333 | if ($this->debug > 1) { |
5334 | 5334 | error_log('New LP - In learnpath::create_tree_array())', 0); |
@@ -5414,7 +5414,7 @@ discard block |
||
5414 | 5414 | |
5415 | 5415 | // we need to start a form when we want to update all the mp3 files |
5416 | 5416 | if ($update_audio == 'true') { |
5417 | - $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 | + $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">'; |
|
5418 | 5418 | } |
5419 | 5419 | $return .= '<div id="message"></div>'; |
5420 | 5420 | if (count($this->items) == 0) { |
@@ -5422,14 +5422,14 @@ discard block |
||
5422 | 5422 | } else { |
5423 | 5423 | $return_audio = '<table class="data_table">'; |
5424 | 5424 | $return_audio .= '<tr>'; |
5425 | - $return_audio .= '<th width="40%">' . get_lang('Title') . '</th>'; |
|
5426 | - $return_audio .= '<th>' . get_lang('Audio') . '</th>'; |
|
5425 | + $return_audio .= '<th width="40%">'.get_lang('Title').'</th>'; |
|
5426 | + $return_audio .= '<th>'.get_lang('Audio').'</th>'; |
|
5427 | 5427 | $return_audio .= '</tr>'; |
5428 | 5428 | |
5429 | 5429 | if ($update_audio != 'true') { |
5430 | 5430 | $return .= '<div class="col-md-12">'; |
5431 | 5431 | $return .= self::return_new_tree($update_audio); |
5432 | - $return .='</div>'; |
|
5432 | + $return .= '</div>'; |
|
5433 | 5433 | $return .= Display::div( |
5434 | 5434 | Display::url(get_lang('Save'), '#', array('id' => 'listSubmit', 'class' => 'btn btn-primary')), |
5435 | 5435 | array('style' => 'float:left; margin-top:15px;width:100%') |
@@ -5467,7 +5467,7 @@ discard block |
||
5467 | 5467 | public function return_new_tree($update_audio = 'false', $drop_element_here = false) |
5468 | 5468 | { |
5469 | 5469 | $return = ''; |
5470 | - $is_allowed_to_edit = api_is_allowed_to_edit(null,true); |
|
5470 | + $is_allowed_to_edit = api_is_allowed_to_edit(null, true); |
|
5471 | 5471 | |
5472 | 5472 | $course_id = api_get_course_int_id(); |
5473 | 5473 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
@@ -5515,7 +5515,7 @@ discard block |
||
5515 | 5515 | |
5516 | 5516 | // Link for the documents |
5517 | 5517 | if ($arrLP[$i]['item_type'] == 'document') { |
5518 | - $url = api_get_self() . '?'.api_get_cidreq().'&action=view_item&mode=preview_document&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id; |
|
5518 | + $url = api_get_self().'?'.api_get_cidreq().'&action=view_item&mode=preview_document&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id; |
|
5519 | 5519 | $title_cut = Display::url( |
5520 | 5520 | $title_cut, |
5521 | 5521 | $url, |
@@ -5536,15 +5536,15 @@ discard block |
||
5536 | 5536 | } else { |
5537 | 5537 | $oddClass = 'row_even'; |
5538 | 5538 | } |
5539 | - $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'] .'" class="' . $oddClass . '">'; |
|
5539 | + $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'].'" class="'.$oddClass.'">'; |
|
5540 | 5540 | |
5541 | 5541 | $icon_name = str_replace(' ', '', $arrLP[$i]['item_type']); |
5542 | 5542 | |
5543 | - if (file_exists('../img/lp_' . $icon_name . '.png')) { |
|
5544 | - $icon = Display::return_icon('lp_' . $icon_name . '.png'); |
|
5543 | + if (file_exists('../img/lp_'.$icon_name.'.png')) { |
|
5544 | + $icon = Display::return_icon('lp_'.$icon_name.'.png'); |
|
5545 | 5545 | } else { |
5546 | - if (file_exists('../img/lp_' . $icon_name . '.gif')) { |
|
5547 | - $icon = Display::return_icon('lp_' . $icon_name . '.gif'); |
|
5546 | + if (file_exists('../img/lp_'.$icon_name.'.gif')) { |
|
5547 | + $icon = Display::return_icon('lp_'.$icon_name.'.gif'); |
|
5548 | 5548 | } else { |
5549 | 5549 | if ($arrLP[$i]['item_type'] === TOOL_LP_FINAL_ITEM) { |
5550 | 5550 | $icon = Display::return_icon('certificate.png'); |
@@ -5555,7 +5555,7 @@ discard block |
||
5555 | 5555 | } |
5556 | 5556 | |
5557 | 5557 | // The audio column. |
5558 | - $return_audio .= '<td align="left" style="padding-left:10px;">'; |
|
5558 | + $return_audio .= '<td align="left" style="padding-left:10px;">'; |
|
5559 | 5559 | $audio = ''; |
5560 | 5560 | if (!$update_audio || $update_audio <> 'true') { |
5561 | 5561 | if (!empty($arrLP[$i]['audio'])) { |
@@ -5565,10 +5565,10 @@ discard block |
||
5565 | 5565 | } else { |
5566 | 5566 | $types = self::getChapterTypes(); |
5567 | 5567 | if (!in_array($arrLP[$i]['item_type'], $types)) { |
5568 | - $audio .= '<input type="file" name="mp3file' . $arrLP[$i]['id'] . '" id="mp3file" />'; |
|
5568 | + $audio .= '<input type="file" name="mp3file'.$arrLP[$i]['id'].'" id="mp3file" />'; |
|
5569 | 5569 | if (!empty ($arrLP[$i]['audio'])) { |
5570 | 5570 | $audio .= '<br />'.Security::remove_XSS($arrLP[$i]['audio']).'<br /> |
5571 | - <input type="checkbox" name="removemp3' . $arrLP[$i]['id'] . '" id="checkbox' . $arrLP[$i]['id'] . '" />' . get_lang('RemoveAudio'); |
|
5571 | + <input type="checkbox" name="removemp3' . $arrLP[$i]['id'].'" id="checkbox'.$arrLP[$i]['id'].'" />'.get_lang('RemoveAudio'); |
|
5572 | 5572 | } |
5573 | 5573 | } |
5574 | 5574 | } |
@@ -5596,7 +5596,7 @@ discard block |
||
5596 | 5596 | // No edit for this item types |
5597 | 5597 | if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset', 'final_item'))) { |
5598 | 5598 | if ($arrLP[$i]['item_type'] != 'dir') { |
5599 | - $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 | + $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">'; |
|
5600 | 5600 | $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY); |
5601 | 5601 | $edit_icon .= '</a>'; |
5602 | 5602 | |
@@ -5607,7 +5607,7 @@ discard block |
||
5607 | 5607 | $this->lp_session_id |
5608 | 5608 | ) |
5609 | 5609 | ) { |
5610 | - $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ |
|
5610 | + $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ |
|
5611 | 5611 | 'action' => 'dissociate_forum', |
5612 | 5612 | 'id' => $arrLP[$i]['id'], |
5613 | 5613 | 'lp_id' => $this->lp_id |
@@ -5618,7 +5618,7 @@ discard block |
||
5618 | 5618 | ['class' => 'btn btn-default lp-btn-dissociate-forum'] |
5619 | 5619 | ); |
5620 | 5620 | } else { |
5621 | - $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ |
|
5621 | + $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ |
|
5622 | 5622 | 'action' => 'create_forum', |
5623 | 5623 | 'id' => $arrLP[$i]['id'], |
5624 | 5624 | 'lp_id' => $this->lp_id |
@@ -5631,17 +5631,17 @@ discard block |
||
5631 | 5631 | } |
5632 | 5632 | } |
5633 | 5633 | } else { |
5634 | - $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 | + $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">'; |
|
5635 | 5635 | $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY); |
5636 | 5636 | $edit_icon .= '</a>'; |
5637 | 5637 | } |
5638 | 5638 | } |
5639 | 5639 | |
5640 | - $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 | + $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">'; |
|
5641 | 5641 | $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY); |
5642 | 5642 | $delete_icon .= '</a>'; |
5643 | 5643 | |
5644 | - $url = api_get_self() . '?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id; |
|
5644 | + $url = api_get_self().'?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id; |
|
5645 | 5645 | |
5646 | 5646 | if ($arrLP[$i]['item_type'] == 'document') { |
5647 | 5647 | $urlPreviewLink = api_get_self().'?'.api_get_cidreq().'&action=view_item&mode=preview_document&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id; |
@@ -5678,8 +5678,8 @@ discard block |
||
5678 | 5678 | } |
5679 | 5679 | } |
5680 | 5680 | if ($update_audio != 'true') { |
5681 | - $row = $move_icon . ' ' . $icon . |
|
5682 | - Display::span($title_cut) . |
|
5681 | + $row = $move_icon.' '.$icon. |
|
5682 | + Display::span($title_cut). |
|
5683 | 5683 | Display::tag( |
5684 | 5684 | 'div', |
5685 | 5685 | "<div class=\"btn-group btn-group-xs\">$previewIcon $audio $edit_icon $forumIcon $prerequisities_icon $move_item_icon $audio_icon $delete_icon</div>", |
@@ -5700,8 +5700,8 @@ discard block |
||
5700 | 5700 | $parent_arrays = array(); |
5701 | 5701 | if ($arrLP[$i]['depth'] > 1) { |
5702 | 5702 | //Getting list of parents |
5703 | - for($j = 0; $j < $arrLP[$i]['depth']; $j++) { |
|
5704 | - foreach($arrLP as $item) { |
|
5703 | + for ($j = 0; $j < $arrLP[$i]['depth']; $j++) { |
|
5704 | + foreach ($arrLP as $item) { |
|
5705 | 5705 | if ($item['id'] == $parent_id) { |
5706 | 5706 | if ($item['parent_item_id'] == 0) { |
5707 | 5707 | $parent_id = $item['id']; |
@@ -5723,8 +5723,8 @@ discard block |
||
5723 | 5723 | $parent_arrays = array_reverse($parent_arrays); |
5724 | 5724 | $val = '$elements'; |
5725 | 5725 | $x = 0; |
5726 | - foreach($parent_arrays as $item) { |
|
5727 | - if ($x != count($parent_arrays) -1) { |
|
5726 | + foreach ($parent_arrays as $item) { |
|
5727 | + if ($x != count($parent_arrays) - 1) { |
|
5728 | 5728 | $val .= '["'.$item.'"]["children"]'; |
5729 | 5729 | } else { |
5730 | 5730 | $val .= '["'.$item.'"]["children"]'; |
@@ -5793,7 +5793,7 @@ discard block |
||
5793 | 5793 | if (isset($_REQUEST['id']) && $key == $_REQUEST['id']) { |
5794 | 5794 | $active = 'active'; |
5795 | 5795 | } |
5796 | - $return .= Display::tag( |
|
5796 | + $return .= Display::tag( |
|
5797 | 5797 | 'li', |
5798 | 5798 | Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, |
5799 | 5799 | array('id'=>$key, 'class'=>'record li_container') |
@@ -5831,7 +5831,7 @@ discard block |
||
5831 | 5831 | |
5832 | 5832 | $actionsLeft .= Display::url( |
5833 | 5833 | Display:: return_icon('preview_view.png', get_lang('Display'), '', ICON_SIZE_MEDIUM), |
5834 | - 'lp_controller.php?'.api_get_cidreq().'&' . http_build_query([ |
|
5834 | + 'lp_controller.php?'.api_get_cidreq().'&'.http_build_query([ |
|
5835 | 5835 | 'gradebook' => $gradebook, |
5836 | 5836 | 'action' => 'view', |
5837 | 5837 | 'lp_id' => $_SESSION['oLP']->lp_id, |
@@ -5840,7 +5840,7 @@ discard block |
||
5840 | 5840 | ); |
5841 | 5841 | $actionsLeft .= Display::url( |
5842 | 5842 | Display:: return_icon('upload_audio.png', get_lang('UpdateAllAudioFragments'), '', ICON_SIZE_MEDIUM), |
5843 | - 'lp_controller.php?' . api_get_cidreq() . '&' . http_build_query([ |
|
5843 | + 'lp_controller.php?'.api_get_cidreq().'&'.http_build_query([ |
|
5844 | 5844 | 'action' => 'admin_view', |
5845 | 5845 | 'lp_id' => $_SESSION['oLP']->lp_id, |
5846 | 5846 | 'updateaudio' => 'true' |
@@ -5849,8 +5849,8 @@ discard block |
||
5849 | 5849 | |
5850 | 5850 | if (!$isConfigPage) { |
5851 | 5851 | $actionsLeft .= Display::url( |
5852 | - Display :: return_icon('settings.png', get_lang('CourseSettings'),'',ICON_SIZE_MEDIUM), |
|
5853 | - 'lp_controller.php?' . api_get_cidreq() . '&' . http_build_query([ |
|
5852 | + Display :: return_icon('settings.png', get_lang('CourseSettings'), '', ICON_SIZE_MEDIUM), |
|
5853 | + 'lp_controller.php?'.api_get_cidreq().'&'.http_build_query([ |
|
5854 | 5854 | 'action' => 'edit', |
5855 | 5855 | 'lp_id' => $_SESSION['oLP']->lp_id |
5856 | 5856 | ]) |
@@ -5858,16 +5858,16 @@ discard block |
||
5858 | 5858 | } else { |
5859 | 5859 | $actionsLeft .= Display::url( |
5860 | 5860 | Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM), |
5861 | - 'lp_controller.php?' . http_build_query([ |
|
5861 | + 'lp_controller.php?'.http_build_query([ |
|
5862 | 5862 | 'action' => 'build', |
5863 | 5863 | 'lp_id' => $_SESSION['oLP']->lp_id |
5864 | - ]) . '&' . api_get_cidreq() |
|
5864 | + ]).'&'.api_get_cidreq() |
|
5865 | 5865 | ); |
5866 | 5866 | } |
5867 | 5867 | |
5868 | 5868 | if ($allowExpand) { |
5869 | 5869 | $actionsLeft .= Display::url( |
5870 | - Display::return_icon('expand.png', get_lang('Expand'), array('id' => 'expand'), ICON_SIZE_MEDIUM) . |
|
5870 | + Display::return_icon('expand.png', get_lang('Expand'), array('id' => 'expand'), ICON_SIZE_MEDIUM). |
|
5871 | 5871 | Display::return_icon('contract.png', get_lang('Collapse'), array('id' => 'contract', 'class' => 'hide'), ICON_SIZE_MEDIUM), |
5872 | 5872 | '#', |
5873 | 5873 | ['role' => 'button', 'id' => 'hide_bar_template'] |
@@ -5878,14 +5878,14 @@ discard block |
||
5878 | 5878 | $buttons = array( |
5879 | 5879 | array( |
5880 | 5880 | 'title' => get_lang('SetPrerequisiteForEachItem'), |
5881 | - 'href' => 'lp_controller.php?' . api_get_cidreq() . '&' . http_build_query([ |
|
5881 | + 'href' => 'lp_controller.php?'.api_get_cidreq().'&'.http_build_query([ |
|
5882 | 5882 | 'action' => 'set_previous_step_as_prerequisite', |
5883 | 5883 | 'lp_id' => $_SESSION['oLP']->lp_id |
5884 | 5884 | ]) |
5885 | 5885 | ), |
5886 | 5886 | array( |
5887 | 5887 | 'title' => get_lang('ClearAllPrerequisites'), |
5888 | - 'href' => 'lp_controller.php?' . api_get_cidreq() . '&' . http_build_query([ |
|
5888 | + 'href' => 'lp_controller.php?'.api_get_cidreq().'&'.http_build_query([ |
|
5889 | 5889 | 'action' => 'clear_prerequisites', |
5890 | 5890 | 'lp_id' => $_SESSION['oLP']->lp_id |
5891 | 5891 | ]) |
@@ -5915,7 +5915,7 @@ discard block |
||
5915 | 5915 | { |
5916 | 5916 | // Creating learning_path folder |
5917 | 5917 | $dir = '/learning_path'; |
5918 | - $filepath = api_get_path(SYS_COURSE_PATH).$course['path'] . '/document'; |
|
5918 | + $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'; |
|
5919 | 5919 | $creatorId = empty($creatorId) ? api_get_user_id() : $creatorId; |
5920 | 5920 | |
5921 | 5921 | $folder = false; |
@@ -5961,14 +5961,14 @@ discard block |
||
5961 | 5961 | $folder = self::generate_learning_path_folder($course, $creatorId); |
5962 | 5962 | |
5963 | 5963 | // Limits title size |
5964 | - $title = api_substr(api_replace_dangerous_char($lp_name), 0 , 80); |
|
5964 | + $title = api_substr(api_replace_dangerous_char($lp_name), 0, 80); |
|
5965 | 5965 | $dir = $dir.$title; |
5966 | 5966 | |
5967 | 5967 | // Creating LP folder |
5968 | 5968 | $documentId = null; |
5969 | 5969 | |
5970 | 5970 | if ($folder) { |
5971 | - $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'; |
|
5971 | + $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'; |
|
5972 | 5972 | if (!is_dir($filepath.'/'.$dir)) { |
5973 | 5973 | $folderData = create_unexisting_directory( |
5974 | 5974 | $course, |
@@ -5990,7 +5990,7 @@ discard block |
||
5990 | 5990 | } |
5991 | 5991 | $dir = $dir.'/'; |
5992 | 5992 | if ($folder) { |
5993 | - $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir; |
|
5993 | + $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir; |
|
5994 | 5994 | } |
5995 | 5995 | } |
5996 | 5996 | |
@@ -6058,11 +6058,11 @@ discard block |
||
6058 | 6058 | } |
6059 | 6059 | } |
6060 | 6060 | |
6061 | - $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document'.$dir; |
|
6061 | + $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir; |
|
6062 | 6062 | |
6063 | 6063 | if (!is_dir($filepath)) { |
6064 | 6064 | $dir = '/'; |
6065 | - $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document'.$dir; |
|
6065 | + $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir; |
|
6066 | 6066 | } |
6067 | 6067 | |
6068 | 6068 | // stripslashes() before calling api_replace_dangerous_char() because $_POST['title'] |
@@ -6081,11 +6081,11 @@ discard block |
||
6081 | 6081 | $tmp_filename = $filename; |
6082 | 6082 | |
6083 | 6083 | $i = 0; |
6084 | - while (file_exists($filepath . $tmp_filename . '.'.$extension)){ |
|
6085 | - $tmp_filename = $filename . '_' . ++ $i; |
|
6084 | + while (file_exists($filepath.$tmp_filename.'.'.$extension)) { |
|
6085 | + $tmp_filename = $filename.'_'.++ $i; |
|
6086 | 6086 | } |
6087 | 6087 | |
6088 | - $filename = $tmp_filename . '.'.$extension; |
|
6088 | + $filename = $tmp_filename.'.'.$extension; |
|
6089 | 6089 | if ($extension == 'html') { |
6090 | 6090 | $content = stripslashes($content); |
6091 | 6091 | $content = str_replace( |
@@ -6120,12 +6120,12 @@ discard block |
||
6120 | 6120 | ); |
6121 | 6121 | } |
6122 | 6122 | |
6123 | - if (!file_exists($filepath . $filename)) { |
|
6124 | - if ($fp = @ fopen($filepath . $filename, 'w')) { |
|
6123 | + if (!file_exists($filepath.$filename)) { |
|
6124 | + if ($fp = @ fopen($filepath.$filename, 'w')) { |
|
6125 | 6125 | fputs($fp, $content); |
6126 | 6126 | fclose($fp); |
6127 | 6127 | |
6128 | - $file_size = filesize($filepath . $filename); |
|
6128 | + $file_size = filesize($filepath.$filename); |
|
6129 | 6129 | $save_file_path = $dir.$filename; |
6130 | 6130 | |
6131 | 6131 | $document_id = add_document( |
@@ -6163,12 +6163,12 @@ discard block |
||
6163 | 6163 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6164 | 6164 | $ct = ''; |
6165 | 6165 | if ($new_comment) |
6166 | - $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
6166 | + $ct .= ", comment='".Database::escape_string($new_comment)."'"; |
|
6167 | 6167 | if ($new_title) |
6168 | - $ct .= ", title='" . Database::escape_string($new_title)."' "; |
|
6168 | + $ct .= ", title='".Database::escape_string($new_title)."' "; |
|
6169 | 6169 | |
6170 | - $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)." |
|
6171 | - WHERE c_id = ".$course_id." AND id = " . $document_id; |
|
6170 | + $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)." |
|
6171 | + WHERE c_id = ".$course_id." AND id = ".$document_id; |
|
6172 | 6172 | Database::query($sql); |
6173 | 6173 | } |
6174 | 6174 | } |
@@ -6196,41 +6196,41 @@ discard block |
||
6196 | 6196 | $dir = substr($dir, 1); |
6197 | 6197 | |
6198 | 6198 | if ($dir[0] != '/') |
6199 | - $dir = '/' . $dir; |
|
6199 | + $dir = '/'.$dir; |
|
6200 | 6200 | |
6201 | 6201 | if ($dir[strlen($dir) - 1] != '/') |
6202 | 6202 | $dir .= '/'; |
6203 | 6203 | |
6204 | - $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir; |
|
6204 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
|
6205 | 6205 | |
6206 | 6206 | if (!is_dir($filepath)) { |
6207 | - $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/'; |
|
6207 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
6208 | 6208 | } |
6209 | 6209 | |
6210 | 6210 | $table_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6211 | 6211 | if (isset($_POST['path']) && !empty($_POST['path'])) { |
6212 | 6212 | $document_id = intval($_POST['path']); |
6213 | - $sql = "SELECT path FROM " . $table_doc . " |
|
6214 | - WHERE c_id = $course_id AND id = " . $document_id; |
|
6213 | + $sql = "SELECT path FROM ".$table_doc." |
|
6214 | + WHERE c_id = $course_id AND id = ".$document_id; |
|
6215 | 6215 | $res = Database::query($sql); |
6216 | 6216 | $row = Database :: fetch_array($res); |
6217 | 6217 | $content = stripslashes($_POST['content_lp']); |
6218 | - $file = $filepath . $row['path']; |
|
6218 | + $file = $filepath.$row['path']; |
|
6219 | 6219 | |
6220 | 6220 | if ($fp = @ fopen($file, 'w')) { |
6221 | 6221 | $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].api_get_path(REL_COURSE_PATH), $content); |
6222 | 6222 | |
6223 | 6223 | // Change the path of mp3 to absolute. |
6224 | 6224 | // The first regexp deals with :// urls. |
6225 | - $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/', $content); |
|
6225 | + $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/', $content); |
|
6226 | 6226 | // The second regexp deals with audio/ urls. |
6227 | - $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/$2/', $content); |
|
6227 | + $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/', $content); |
|
6228 | 6228 | fputs($fp, $content); |
6229 | 6229 | fclose($fp); |
6230 | 6230 | |
6231 | - $sql = "UPDATE " . $table_doc ." SET |
|
6231 | + $sql = "UPDATE ".$table_doc." SET |
|
6232 | 6232 | title='".Database::escape_string($_POST['title'])."' |
6233 | - WHERE c_id = ".$course_id." AND id = " . $document_id; |
|
6233 | + WHERE c_id = ".$course_id." AND id = ".$document_id; |
|
6234 | 6234 | Database::query($sql); |
6235 | 6235 | } |
6236 | 6236 | } |
@@ -6248,10 +6248,10 @@ discard block |
||
6248 | 6248 | $return = ''; |
6249 | 6249 | if (is_numeric($item_id)) { |
6250 | 6250 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
6251 | - $sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp |
|
6252 | - WHERE c_id = ".$course_id." AND lp.id = " . intval($item_id); |
|
6251 | + $sql = "SELECT lp.* FROM ".$tbl_lp_item." as lp |
|
6252 | + WHERE c_id = ".$course_id." AND lp.id = ".intval($item_id); |
|
6253 | 6253 | $result = Database::query($sql); |
6254 | - while ($row = Database :: fetch_array($result,'ASSOC')) { |
|
6254 | + while ($row = Database :: fetch_array($result, 'ASSOC')) { |
|
6255 | 6255 | $_SESSION['parent_item_id'] = $row['item_type'] == 'dir' ? $item_id : 0; |
6256 | 6256 | |
6257 | 6257 | // Prevents wrong parent selection for document, see Bug#1251. |
@@ -6276,15 +6276,15 @@ discard block |
||
6276 | 6276 | $return .= $exercise->description.'<br />'; |
6277 | 6277 | $return .= Display::url( |
6278 | 6278 | get_lang('GoToExercise'), |
6279 | - api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?' . api_get_cidreq() . '&exerciseId=' . $exercise->id, |
|
6279 | + api_get_path(WEB_CODE_PATH).'exercise/overview.php?'.api_get_cidreq().'&exerciseId='.$exercise->id, |
|
6280 | 6280 | ['class' => 'btn btn-primary'] |
6281 | 6281 | ); |
6282 | 6282 | } |
6283 | 6283 | break; |
6284 | 6284 | case TOOL_DOCUMENT: |
6285 | 6285 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6286 | - $sql_doc = "SELECT path FROM " . $tbl_doc . " |
|
6287 | - WHERE c_id = ".$course_id." AND id = " . intval($row['path']); |
|
6286 | + $sql_doc = "SELECT path FROM ".$tbl_doc." |
|
6287 | + WHERE c_id = ".$course_id." AND id = ".intval($row['path']); |
|
6288 | 6288 | $result = Database::query($sql_doc); |
6289 | 6289 | $path_file = Database::result($result, 0, 0); |
6290 | 6290 | $path_parts = pathinfo($path_file); |
@@ -6330,7 +6330,7 @@ discard block |
||
6330 | 6330 | if (is_numeric($item_id)) { |
6331 | 6331 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
6332 | 6332 | $sql = "SELECT * FROM $tbl_lp_item |
6333 | - WHERE c_id = ".$course_id." AND id = " . intval($item_id); |
|
6333 | + WHERE c_id = ".$course_id." AND id = ".intval($item_id); |
|
6334 | 6334 | $res = Database::query($sql); |
6335 | 6335 | $row = Database::fetch_array($res); |
6336 | 6336 | switch ($row['item_type']) { |
@@ -6339,21 +6339,21 @@ discard block |
||
6339 | 6339 | case 'sco': |
6340 | 6340 | if (isset($_GET['view']) && $_GET['view'] == 'build') { |
6341 | 6341 | $return .= $this->display_manipulate($item_id, $row['item_type']); |
6342 | - $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row); |
|
6342 | + $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter').' :', 'edit', $item_id, $row); |
|
6343 | 6343 | } else { |
6344 | - $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row); |
|
6344 | + $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter').' :', $row); |
|
6345 | 6345 | } |
6346 | 6346 | break; |
6347 | 6347 | case TOOL_DOCUMENT: |
6348 | 6348 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6349 | 6349 | $sql = "SELECT lp.*, doc.path as dir |
6350 | - FROM " . $tbl_lp_item . " as lp |
|
6351 | - LEFT JOIN " . $tbl_doc . " as doc |
|
6350 | + FROM " . $tbl_lp_item." as lp |
|
6351 | + LEFT JOIN " . $tbl_doc." as doc |
|
6352 | 6352 | ON doc.id = lp.path |
6353 | 6353 | WHERE |
6354 | 6354 | lp.c_id = $course_id AND |
6355 | 6355 | doc.c_id = $course_id AND |
6356 | - lp.id = " . intval($item_id); |
|
6356 | + lp.id = ".intval($item_id); |
|
6357 | 6357 | $res_step = Database::query($sql); |
6358 | 6358 | $row_step = Database :: fetch_array($res_step, 'ASSOC'); |
6359 | 6359 | $return .= $this->display_manipulate($item_id, $row['item_type']); |
@@ -6363,8 +6363,8 @@ discard block |
||
6363 | 6363 | $link_id = (string) $row['path']; |
6364 | 6364 | if (ctype_digit($link_id)) { |
6365 | 6365 | $tbl_link = Database :: get_course_table(TABLE_LINK); |
6366 | - $sql_select = 'SELECT url FROM ' . $tbl_link . ' |
|
6367 | - WHERE c_id = '.$course_id.' AND id = ' . intval($link_id); |
|
6366 | + $sql_select = 'SELECT url FROM '.$tbl_link.' |
|
6367 | + WHERE c_id = '.$course_id.' AND id = '.intval($link_id); |
|
6368 | 6368 | $res_link = Database::query($sql_select); |
6369 | 6369 | $row_link = Database :: fetch_array($res_link); |
6370 | 6370 | if (is_array($row_link)) { |
@@ -6378,13 +6378,13 @@ discard block |
||
6378 | 6378 | $_SESSION['finalItem'] = true; |
6379 | 6379 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6380 | 6380 | $sql = "SELECT lp.*, doc.path as dir |
6381 | - FROM " . $tbl_lp_item . " as lp |
|
6382 | - LEFT JOIN " . $tbl_doc . " as doc |
|
6381 | + FROM " . $tbl_lp_item." as lp |
|
6382 | + LEFT JOIN " . $tbl_doc." as doc |
|
6383 | 6383 | ON doc.id = lp.path |
6384 | 6384 | WHERE |
6385 | 6385 | lp.c_id = $course_id AND |
6386 | 6386 | doc.c_id = $course_id AND |
6387 | - lp.id = " . intval($item_id); |
|
6387 | + lp.id = ".intval($item_id); |
|
6388 | 6388 | $res_step = Database::query($sql); |
6389 | 6389 | $row_step = Database :: fetch_array($res_step, 'ASSOC'); |
6390 | 6390 | $return .= $this->display_manipulate($item_id, $row['item_type']); |
@@ -6445,7 +6445,7 @@ discard block |
||
6445 | 6445 | |
6446 | 6446 | $headers = array( |
6447 | 6447 | Display::return_icon('folder_document.png', get_lang('Documents'), array(), ICON_SIZE_BIG), |
6448 | - Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG), |
|
6448 | + Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG), |
|
6449 | 6449 | Display::return_icon('links.png', get_lang('Links'), array(), ICON_SIZE_BIG), |
6450 | 6450 | Display::return_icon('works.png', get_lang('Works'), array(), ICON_SIZE_BIG), |
6451 | 6451 | Display::return_icon('forum.png', get_lang('Forums'), array(), ICON_SIZE_BIG), |
@@ -6495,16 +6495,16 @@ discard block |
||
6495 | 6495 | $course_id = api_get_course_int_id(); |
6496 | 6496 | $return = ''; |
6497 | 6497 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6498 | - $sql_doc = "SELECT * FROM " . $tbl_doc . " |
|
6499 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
6498 | + $sql_doc = "SELECT * FROM ".$tbl_doc." |
|
6499 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
6500 | 6500 | $res_doc = Database::query($sql_doc); |
6501 | 6501 | $row_doc = Database :: fetch_array($res_doc); |
6502 | 6502 | |
6503 | 6503 | // TODO: Add a path filter. |
6504 | 6504 | if ($iframe) { |
6505 | - $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 | + $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>'; |
|
6506 | 6506 | } else { |
6507 | - $return .= file_get_contents(api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $row_doc['path']); |
|
6507 | + $return .= file_get_contents(api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row_doc['path']); |
|
6508 | 6508 | } |
6509 | 6509 | |
6510 | 6510 | return $return; |
@@ -6528,8 +6528,8 @@ discard block |
||
6528 | 6528 | $item_description = $extra_info['description']; |
6529 | 6529 | } elseif (is_numeric($extra_info)) { |
6530 | 6530 | $sql = "SELECT title, description |
6531 | - FROM " . $tbl_quiz . " |
|
6532 | - WHERE c_id = ".$course_id." AND id = " . $extra_info; |
|
6531 | + FROM " . $tbl_quiz." |
|
6532 | + WHERE c_id = ".$course_id." AND id = ".$extra_info; |
|
6533 | 6533 | |
6534 | 6534 | $result = Database::query($sql); |
6535 | 6535 | $row = Database::fetch_array($result); |
@@ -6539,21 +6539,21 @@ discard block |
||
6539 | 6539 | $item_title = ''; |
6540 | 6540 | $item_description = ''; |
6541 | 6541 | } |
6542 | - $item_title = Security::remove_XSS($item_title); |
|
6543 | - $item_description = Security::remove_XSS($item_description); |
|
6542 | + $item_title = Security::remove_XSS($item_title); |
|
6543 | + $item_description = Security::remove_XSS($item_description); |
|
6544 | 6544 | |
6545 | 6545 | if ($id != 0 && is_array($extra_info)) |
6546 | 6546 | $parent = $extra_info['parent_item_id']; |
6547 | 6547 | else |
6548 | 6548 | $parent = 0; |
6549 | 6549 | |
6550 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
6551 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
6550 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
6551 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
6552 | 6552 | |
6553 | 6553 | $result = Database::query($sql); |
6554 | - $arrLP = array (); |
|
6554 | + $arrLP = array(); |
|
6555 | 6555 | while ($row = Database :: fetch_array($result)) { |
6556 | - $arrLP[] = array ( |
|
6556 | + $arrLP[] = array( |
|
6557 | 6557 | 'id' => $row['id'], |
6558 | 6558 | 'item_type' => $row['item_type'], |
6559 | 6559 | 'title' => $row['title'], |
@@ -6575,7 +6575,7 @@ discard block |
||
6575 | 6575 | $arrLP = isset($this->arrMenu) ? $this->arrMenu : null; |
6576 | 6576 | unset ($this->arrMenu); |
6577 | 6577 | |
6578 | - $form = new FormValidator('quiz_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']); |
|
6578 | + $form = new FormValidator('quiz_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']); |
|
6579 | 6579 | $defaults = []; |
6580 | 6580 | |
6581 | 6581 | if ($action == 'add') { |
@@ -6587,7 +6587,7 @@ discard block |
||
6587 | 6587 | } |
6588 | 6588 | |
6589 | 6589 | if (isset ($_GET['edit']) && $_GET['edit'] == 'true') { |
6590 | - $legend .= Display :: return_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument')); |
|
6590 | + $legend .= Display :: return_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument')); |
|
6591 | 6591 | } |
6592 | 6592 | |
6593 | 6593 | $form->addHeader($legend); |
@@ -6606,7 +6606,7 @@ discard block |
||
6606 | 6606 | ); |
6607 | 6607 | $selectParent->addOption($this->name, 0); |
6608 | 6608 | |
6609 | - $arrHide = array ( |
|
6609 | + $arrHide = array( |
|
6610 | 6610 | $id |
6611 | 6611 | ); |
6612 | 6612 | for ($i = 0; $i < count($arrLP); $i++) { |
@@ -6619,7 +6619,7 @@ discard block |
||
6619 | 6619 | $selectParent->addOption( |
6620 | 6620 | $arrLP[$i]['title'], |
6621 | 6621 | $arrLP[$i]['id'], |
6622 | - ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px'] |
|
6622 | + ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px'] |
|
6623 | 6623 | ); |
6624 | 6624 | |
6625 | 6625 | if ($parent == $arrLP[$i]['id']) { |
@@ -6632,7 +6632,7 @@ discard block |
||
6632 | 6632 | if ($arrLP[$i]['item_type'] == 'dir') { |
6633 | 6633 | $selectParent->addOption( |
6634 | 6634 | $arrLP[$i]['title'], |
6635 | - $arrLP[$i]['id'], ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px'] |
|
6635 | + $arrLP[$i]['id'], ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px'] |
|
6636 | 6636 | ); |
6637 | 6637 | |
6638 | 6638 | if ($parent == $arrLP[$i]['id']) { |
@@ -6650,7 +6650,7 @@ discard block |
||
6650 | 6650 | |
6651 | 6651 | for ($i = 0; $i < count($arrLP); $i++) { |
6652 | 6652 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
6653 | - $selectPrevious->addOption(get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', $arrLP[$i]['id']); |
|
6653 | + $selectPrevious->addOption(get_lang('After').' "'.$arrLP[$i]['title'].'"', $arrLP[$i]['id']); |
|
6654 | 6654 | |
6655 | 6655 | if (is_array($extra_info)) { |
6656 | 6656 | if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
@@ -6672,7 +6672,7 @@ discard block |
||
6672 | 6672 | } |
6673 | 6673 | } |
6674 | 6674 | } |
6675 | - $arrHide = array (); |
|
6675 | + $arrHide = array(); |
|
6676 | 6676 | for ($i = 0; $i < count($arrLP); $i++) { |
6677 | 6677 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
6678 | 6678 | if (is_array($extra_info)) { |
@@ -6737,7 +6737,7 @@ discard block |
||
6737 | 6737 | |
6738 | 6738 | $form->setDefaults($defaults); |
6739 | 6739 | |
6740 | - return '<div class="sectioncomment">' . $form->returnForm() . '</div>'; |
|
6740 | + return '<div class="sectioncomment">'.$form->returnForm().'</div>'; |
|
6741 | 6741 | } |
6742 | 6742 | |
6743 | 6743 | /** |
@@ -6759,11 +6759,11 @@ discard block |
||
6759 | 6759 | } elseif (is_numeric($extra_info)) { |
6760 | 6760 | $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT); |
6761 | 6761 | |
6762 | - $sql = "SELECT * FROM " . $TBL_DOCUMENT . " |
|
6762 | + $sql = "SELECT * FROM ".$TBL_DOCUMENT." |
|
6763 | 6763 | WHERE |
6764 | 6764 | c_id = ".$course_id." AND |
6765 | - path LIKE '" . $uploadPath . "/%/%htm%' AND |
|
6766 | - id = " . (int) $extra_info . " |
|
6765 | + path LIKE '" . $uploadPath."/%/%htm%' AND |
|
6766 | + id = " . (int) $extra_info." |
|
6767 | 6767 | ORDER BY id ASC"; |
6768 | 6768 | |
6769 | 6769 | $res_hot = Database::query($sql); |
@@ -6787,11 +6787,11 @@ discard block |
||
6787 | 6787 | } |
6788 | 6788 | |
6789 | 6789 | $sql = "SELECT * FROM $tbl_lp_item |
6790 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
6790 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
6791 | 6791 | $result = Database::query($sql); |
6792 | - $arrLP = array (); |
|
6792 | + $arrLP = array(); |
|
6793 | 6793 | while ($row = Database :: fetch_array($result)) { |
6794 | - $arrLP[] = array ( |
|
6794 | + $arrLP[] = array( |
|
6795 | 6795 | 'id' => $row['id'], |
6796 | 6796 | 'item_type' => $row['item_type'], |
6797 | 6797 | 'title' => $row['title'], |
@@ -6828,10 +6828,10 @@ discard block |
||
6828 | 6828 | $return .= $legend; |
6829 | 6829 | $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">'; |
6830 | 6830 | $return .= '<tr>'; |
6831 | - $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . ' :</label></td>'; |
|
6831 | + $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').' :</label></td>'; |
|
6832 | 6832 | $return .= '<td class="input">'; |
6833 | 6833 | $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">'; |
6834 | - $return .= '<option class="top" value="0">' . $this->name . '</option>'; |
|
6834 | + $return .= '<option class="top" value="0">'.$this->name.'</option>'; |
|
6835 | 6835 | $arrHide = array( |
6836 | 6836 | $id |
6837 | 6837 | ); |
@@ -6840,13 +6840,13 @@ discard block |
||
6840 | 6840 | for ($i = 0; $i < count($arrLP); $i++) { |
6841 | 6841 | if ($action != 'add') { |
6842 | 6842 | if ($arrLP[$i]['item_type'] == 'dir' && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) { |
6843 | - $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 | + $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>'; |
|
6844 | 6844 | } else { |
6845 | 6845 | $arrHide[] = $arrLP[$i]['id']; |
6846 | 6846 | } |
6847 | 6847 | } else { |
6848 | 6848 | if ($arrLP[$i]['item_type'] == 'dir') |
6849 | - $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 | + $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>'; |
|
6850 | 6850 | } |
6851 | 6851 | } |
6852 | 6852 | reset($arrLP); |
@@ -6856,10 +6856,10 @@ discard block |
||
6856 | 6856 | $return .= '</td>'; |
6857 | 6857 | $return .= '</tr>'; |
6858 | 6858 | $return .= '<tr>'; |
6859 | - $return .= '<td class="label"><label for="previous">' . get_lang('Position') . ' :</label></td>'; |
|
6859 | + $return .= '<td class="label"><label for="previous">'.get_lang('Position').' :</label></td>'; |
|
6860 | 6860 | $return .= '<td class="input">'; |
6861 | 6861 | $return .= '<select id="previous" name="previous" size="1">'; |
6862 | - $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>'; |
|
6862 | + $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>'; |
|
6863 | 6863 | |
6864 | 6864 | for ($i = 0; $i < count($arrLP); $i++) { |
6865 | 6865 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
@@ -6869,7 +6869,7 @@ discard block |
||
6869 | 6869 | else |
6870 | 6870 | $selected = ''; |
6871 | 6871 | |
6872 | - $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
|
6872 | + $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>'; |
|
6873 | 6873 | } |
6874 | 6874 | } |
6875 | 6875 | |
@@ -6879,8 +6879,8 @@ discard block |
||
6879 | 6879 | |
6880 | 6880 | if ($action != 'move') { |
6881 | 6881 | $return .= '<tr>'; |
6882 | - $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . ' :</label></td>'; |
|
6883 | - $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>'; |
|
6882 | + $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').' :</label></td>'; |
|
6883 | + $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>'; |
|
6884 | 6884 | $return .= '</tr>'; |
6885 | 6885 | $id_prerequisite = 0; |
6886 | 6886 | if (is_array($arrLP) && count($arrLP) > 0) { |
@@ -6891,7 +6891,7 @@ discard block |
||
6891 | 6891 | } |
6892 | 6892 | } |
6893 | 6893 | |
6894 | - $arrHide = array (); |
|
6894 | + $arrHide = array(); |
|
6895 | 6895 | for ($i = 0; $i < count($arrLP); $i++) { |
6896 | 6896 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
6897 | 6897 | if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
@@ -6904,22 +6904,22 @@ discard block |
||
6904 | 6904 | } |
6905 | 6905 | |
6906 | 6906 | $return .= '<tr>'; |
6907 | - $return .= '<td> </td><td><button class="save" name="submit_button" action="edit" type="submit">' . get_lang('SaveHotpotatoes') . '</button></td>'; |
|
6907 | + $return .= '<td> </td><td><button class="save" name="submit_button" action="edit" type="submit">'.get_lang('SaveHotpotatoes').'</button></td>'; |
|
6908 | 6908 | $return .= '</tr>'; |
6909 | 6909 | $return .= '</table>'; |
6910 | 6910 | |
6911 | 6911 | if ($action == 'move') { |
6912 | - $return .= '<input name="title" type="hidden" value="' . $item_title . '" />'; |
|
6913 | - $return .= '<input name="description" type="hidden" value="' . $item_description . '" />'; |
|
6912 | + $return .= '<input name="title" type="hidden" value="'.$item_title.'" />'; |
|
6913 | + $return .= '<input name="description" type="hidden" value="'.$item_description.'" />'; |
|
6914 | 6914 | } |
6915 | 6915 | |
6916 | 6916 | if (is_numeric($extra_info)) { |
6917 | - $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />'; |
|
6917 | + $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />'; |
|
6918 | 6918 | } elseif (is_array($extra_info)) { |
6919 | - $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />'; |
|
6919 | + $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />'; |
|
6920 | 6920 | } |
6921 | - $return .= '<input name="type" type="hidden" value="' . TOOL_HOTPOTATOES . '" />'; |
|
6922 | - $return .= '<input name="post_time" type="hidden" value="' . time() . '" />'; |
|
6921 | + $return .= '<input name="type" type="hidden" value="'.TOOL_HOTPOTATOES.'" />'; |
|
6922 | + $return .= '<input name="post_time" type="hidden" value="'.time().'" />'; |
|
6923 | 6923 | $return .= '</form>'; |
6924 | 6924 | |
6925 | 6925 | return $return; |
@@ -6942,8 +6942,8 @@ discard block |
||
6942 | 6942 | $item_title = stripslashes($extra_info['title']); |
6943 | 6943 | } elseif (is_numeric($extra_info)) { |
6944 | 6944 | $sql = "SELECT forum_title as title, forum_comment as comment |
6945 | - FROM " . $tbl_forum . " |
|
6946 | - WHERE c_id = ".$course_id." AND forum_id = " . $extra_info; |
|
6945 | + FROM " . $tbl_forum." |
|
6946 | + WHERE c_id = ".$course_id." AND forum_id = ".$extra_info; |
|
6947 | 6947 | |
6948 | 6948 | $result = Database::query($sql); |
6949 | 6949 | $row = Database :: fetch_array($result); |
@@ -6961,7 +6961,7 @@ discard block |
||
6961 | 6961 | $parent = 0; |
6962 | 6962 | } |
6963 | 6963 | |
6964 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
6964 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
6965 | 6965 | WHERE |
6966 | 6966 | c_id = ".$course_id." AND |
6967 | 6967 | lp_id = " . $this->lp_id; |
@@ -6969,7 +6969,7 @@ discard block |
||
6969 | 6969 | $arrLP = array(); |
6970 | 6970 | |
6971 | 6971 | while ($row = Database :: fetch_array($result)) { |
6972 | - $arrLP[] = array ( |
|
6972 | + $arrLP[] = array( |
|
6973 | 6973 | 'id' => $row['id'], |
6974 | 6974 | 'item_type' => $row['item_type'], |
6975 | 6975 | 'title' => $row['title'], |
@@ -6998,7 +6998,7 @@ discard block |
||
6998 | 6998 | $legend = get_lang('EditCurrentForum'); |
6999 | 6999 | } |
7000 | 7000 | |
7001 | - $form = new FormValidator('forum_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']); |
|
7001 | + $form = new FormValidator('forum_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']); |
|
7002 | 7002 | $defaults = []; |
7003 | 7003 | |
7004 | 7004 | $form->addHeader($legend); |
@@ -7027,7 +7027,7 @@ discard block |
||
7027 | 7027 | $selectParent->addOption( |
7028 | 7028 | $arrLP[$i]['title'], |
7029 | 7029 | $arrLP[$i]['id'], |
7030 | - ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px'] |
|
7030 | + ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px'] |
|
7031 | 7031 | ); |
7032 | 7032 | |
7033 | 7033 | if ($parent == $arrLP[$i]['id']) { |
@@ -7041,7 +7041,7 @@ discard block |
||
7041 | 7041 | $selectParent->addOption( |
7042 | 7042 | $arrLP[$i]['title'], |
7043 | 7043 | $arrLP[$i]['id'], |
7044 | - ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px'] |
|
7044 | + ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px'] |
|
7045 | 7045 | ); |
7046 | 7046 | |
7047 | 7047 | if ($parent == $arrLP[$i]['id']) { |
@@ -7065,7 +7065,7 @@ discard block |
||
7065 | 7065 | |
7066 | 7066 | for ($i = 0; $i < count($arrLP); $i++) { |
7067 | 7067 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
7068 | - $selectPrevious->addOption(get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', $arrLP[$i]['id']); |
|
7068 | + $selectPrevious->addOption(get_lang('After').' "'.$arrLP[$i]['title'].'"', $arrLP[$i]['id']); |
|
7069 | 7069 | |
7070 | 7070 | if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
7071 | 7071 | $selectPrevious->setSelected($arrLP[$i]['id']); |
@@ -7117,7 +7117,7 @@ discard block |
||
7117 | 7117 | $form->addHidden('post_time', time()); |
7118 | 7118 | $form->setDefaults($defaults); |
7119 | 7119 | |
7120 | - return '<div class="sectioncomment">' . $form->returnForm() . '</div>'; |
|
7120 | + return '<div class="sectioncomment">'.$form->returnForm().'</div>'; |
|
7121 | 7121 | } |
7122 | 7122 | |
7123 | 7123 | /** |
@@ -7140,7 +7140,7 @@ discard block |
||
7140 | 7140 | $item_title = stripslashes($extra_info['title']); |
7141 | 7141 | } elseif (is_numeric($extra_info)) { |
7142 | 7142 | $sql = "SELECT thread_title as title FROM $tbl_forum |
7143 | - WHERE c_id = $course_id AND thread_id = " . $extra_info; |
|
7143 | + WHERE c_id = $course_id AND thread_id = ".$extra_info; |
|
7144 | 7144 | |
7145 | 7145 | $result = Database::query($sql); |
7146 | 7146 | $row = Database :: fetch_array($result); |
@@ -7158,15 +7158,15 @@ discard block |
||
7158 | 7158 | $parent = 0; |
7159 | 7159 | } |
7160 | 7160 | |
7161 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
7162 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
7161 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
7162 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
7163 | 7163 | |
7164 | 7164 | $result = Database::query($sql); |
7165 | 7165 | |
7166 | - $arrLP = array (); |
|
7166 | + $arrLP = array(); |
|
7167 | 7167 | |
7168 | 7168 | while ($row = Database :: fetch_array($result)) { |
7169 | - $arrLP[] = array ( |
|
7169 | + $arrLP[] = array( |
|
7170 | 7170 | 'id' => $row['id'], |
7171 | 7171 | 'item_type' => $row['item_type'], |
7172 | 7172 | 'title' => $row['title'], |
@@ -7187,7 +7187,7 @@ discard block |
||
7187 | 7187 | $arrLP = isset($this->arrMenu) ? $this->arrMenu : null; |
7188 | 7188 | unset ($this->arrMenu); |
7189 | 7189 | |
7190 | - $form = new FormValidator('thread_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']); |
|
7190 | + $form = new FormValidator('thread_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']); |
|
7191 | 7191 | $defaults = []; |
7192 | 7192 | |
7193 | 7193 | if ($action == 'add') { |
@@ -7207,7 +7207,7 @@ discard block |
||
7207 | 7207 | ); |
7208 | 7208 | $selectParent->addOption($this->name, 0); |
7209 | 7209 | |
7210 | - $arrHide = array ( |
|
7210 | + $arrHide = array( |
|
7211 | 7211 | $id |
7212 | 7212 | ); |
7213 | 7213 | |
@@ -7221,7 +7221,7 @@ discard block |
||
7221 | 7221 | $selectParent->addOption( |
7222 | 7222 | $arrLP[$i]['title'], |
7223 | 7223 | $arrLP[$i]['id'], |
7224 | - ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px'] |
|
7224 | + ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px'] |
|
7225 | 7225 | ); |
7226 | 7226 | |
7227 | 7227 | if ($parent == $arrLP[$i]['id']) { |
@@ -7235,7 +7235,7 @@ discard block |
||
7235 | 7235 | $selectParent->addOption( |
7236 | 7236 | $arrLP[$i]['title'], |
7237 | 7237 | $arrLP[$i]['id'], |
7238 | - ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px'] |
|
7238 | + ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px'] |
|
7239 | 7239 | ); |
7240 | 7240 | |
7241 | 7241 | if ($parent == $arrLP[$i]['id']) { |
@@ -7255,7 +7255,7 @@ discard block |
||
7255 | 7255 | for ($i = 0; $i < count($arrLP); $i++) { |
7256 | 7256 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
7257 | 7257 | $selectPrevious->addOption( |
7258 | - get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', |
|
7258 | + get_lang('After').' "'.$arrLP[$i]['title'].'"', |
|
7259 | 7259 | $arrLP[$i]['id'] |
7260 | 7260 | ); |
7261 | 7261 | |
@@ -7355,8 +7355,8 @@ discard block |
||
7355 | 7355 | if ($id != 0 && is_array($extra_info)) { |
7356 | 7356 | $item_title = $extra_info['title']; |
7357 | 7357 | $item_description = $extra_info['description']; |
7358 | - $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']); |
|
7359 | - $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']); |
|
7358 | + $item_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/scorm/'.$this->path.'/'.stripslashes($extra_info['path']); |
|
7359 | + $item_path_fck = '/scorm/'.$this->path.'/'.stripslashes($extra_info['path']); |
|
7360 | 7360 | } else { |
7361 | 7361 | $item_title = ''; |
7362 | 7362 | $item_description = ''; |
@@ -7370,17 +7370,17 @@ discard block |
||
7370 | 7370 | } |
7371 | 7371 | |
7372 | 7372 | $id = intval($id); |
7373 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
7373 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
7374 | 7374 | WHERE |
7375 | 7375 | c_id = ".$course_id." AND |
7376 | - lp_id = " . $this->lp_id . " AND |
|
7376 | + lp_id = " . $this->lp_id." AND |
|
7377 | 7377 | id != $id"; |
7378 | 7378 | |
7379 | 7379 | if ($item_type == 'dir') |
7380 | 7380 | $sql .= " AND parent_item_id = 0"; |
7381 | 7381 | |
7382 | 7382 | $result = Database::query($sql); |
7383 | - $arrLP = array (); |
|
7383 | + $arrLP = array(); |
|
7384 | 7384 | |
7385 | 7385 | while ($row = Database :: fetch_array($result)) { |
7386 | 7386 | $arrLP[] = array( |
@@ -7405,9 +7405,9 @@ discard block |
||
7405 | 7405 | unset($this->arrMenu); |
7406 | 7406 | |
7407 | 7407 | $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null; |
7408 | - $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id; |
|
7408 | + $url = api_get_self().'?'.api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id; |
|
7409 | 7409 | |
7410 | - $form = new FormValidator('form', 'POST', $url); |
|
7410 | + $form = new FormValidator('form', 'POST', $url); |
|
7411 | 7411 | |
7412 | 7412 | $defaults['title'] = api_html_entity_decode($item_title, ENT_QUOTES, $charset); |
7413 | 7413 | $defaults['description'] = $item_description; |
@@ -7450,7 +7450,7 @@ discard block |
||
7450 | 7450 | $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', array('id' => 'idParent', 'onchange' => "javascript: load_cbo(this.value);")); |
7451 | 7451 | |
7452 | 7452 | foreach ($arrHide as $key => $value) { |
7453 | - $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"'); |
|
7453 | + $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"'); |
|
7454 | 7454 | } |
7455 | 7455 | if (!empty($s_selected_parent)) { |
7456 | 7456 | $parent_select->setSelected($s_selected_parent); |
@@ -7472,16 +7472,16 @@ discard block |
||
7472 | 7472 | $s_selected_position = $arrLP[$i]['id']; |
7473 | 7473 | } |
7474 | 7474 | |
7475 | - $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"'; |
|
7475 | + $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"'; |
|
7476 | 7476 | } |
7477 | 7477 | } |
7478 | 7478 | |
7479 | 7479 | $position = $form->addElement('select', 'previous', get_lang('Position'), '', array('id' => 'previous')); |
7480 | 7480 | $padding = isset($value['padding']) ? $value['padding'] : 0; |
7481 | - $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:' . $padding . 'px;"'); |
|
7481 | + $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:'.$padding.'px;"'); |
|
7482 | 7482 | |
7483 | 7483 | foreach ($arrHide as $key => $value) { |
7484 | - $position->addOption($value['value'] . '"', $key, 'style="padding-left:' . $padding . 'px;"'); |
|
7484 | + $position->addOption($value['value'].'"', $key, 'style="padding-left:'.$padding.'px;"'); |
|
7485 | 7485 | } |
7486 | 7486 | |
7487 | 7487 | if (!empty ($s_selected_position)) { |
@@ -7508,7 +7508,7 @@ discard block |
||
7508 | 7508 | //$item_type == 'asset' || |
7509 | 7509 | if (($item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) { |
7510 | 7510 | if ($item_type == 'sco') { |
7511 | - $form->addElement('html', '<script>alert("' . get_lang('WarningWhenEditingScorm') . '")</script>'); |
|
7511 | + $form->addElement('html', '<script>alert("'.get_lang('WarningWhenEditingScorm').'")</script>'); |
|
7512 | 7512 | } |
7513 | 7513 | $renderer = $form->defaultRenderer(); |
7514 | 7514 | $renderer->setElementTemplate('<br /> {label}<br />{element}', 'content_lp'); |
@@ -7568,8 +7568,8 @@ discard block |
||
7568 | 7568 | // We don't display the document form if it's not an editable document (html or txt file). |
7569 | 7569 | if ($action == "add") { |
7570 | 7570 | if (is_numeric($extra_info)) { |
7571 | - $sql_doc = "SELECT path FROM " . $tbl_doc . " |
|
7572 | - WHERE c_id = ".$course_id." AND id = " . intval($extra_info); |
|
7571 | + $sql_doc = "SELECT path FROM ".$tbl_doc." |
|
7572 | + WHERE c_id = ".$course_id." AND id = ".intval($extra_info); |
|
7573 | 7573 | $result = Database::query($sql_doc); |
7574 | 7574 | $path_file = Database :: result($result, 0, 0); |
7575 | 7575 | $path_parts = pathinfo($path_file); |
@@ -7587,13 +7587,13 @@ discard block |
||
7587 | 7587 | $item_title = stripslashes($path_parts['filename']); |
7588 | 7588 | } |
7589 | 7589 | } elseif (is_numeric($extra_info)) { |
7590 | - $sql_doc = "SELECT path, title FROM " . $tbl_doc . " |
|
7590 | + $sql_doc = "SELECT path, title FROM ".$tbl_doc." |
|
7591 | 7591 | WHERE |
7592 | 7592 | c_id = ".$course_id." AND |
7593 | 7593 | id = " . intval($extra_info); |
7594 | 7594 | |
7595 | 7595 | $result = Database::query($sql_doc); |
7596 | - $row = Database::fetch_array($result); |
|
7596 | + $row = Database::fetch_array($result); |
|
7597 | 7597 | $item_title = $row['title']; |
7598 | 7598 | $item_title = str_replace('_', ' ', $item_title); |
7599 | 7599 | if (empty ($item_title)) { |
@@ -7616,7 +7616,7 @@ discard block |
||
7616 | 7616 | WHERE c_id = $course_id AND lp_id = ".$this->lp_id; |
7617 | 7617 | |
7618 | 7618 | $result = Database::query($sql); |
7619 | - $arrLP = array (); |
|
7619 | + $arrLP = array(); |
|
7620 | 7620 | while ($row = Database :: fetch_array($result)) { |
7621 | 7621 | $arrLP[] = array( |
7622 | 7622 | 'id' => $row['id'], |
@@ -7650,9 +7650,9 @@ discard block |
||
7650 | 7650 | $return .= '</legend>'; |
7651 | 7651 | |
7652 | 7652 | if (isset ($_GET['edit']) && $_GET['edit'] == 'true') { |
7653 | - $return .= Display :: return_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false); |
|
7653 | + $return .= Display :: return_message('<strong>'.get_lang('Warning').' !</strong><br />'.get_lang('WarningEditingDocument'), false); |
|
7654 | 7654 | } |
7655 | - $form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data")); |
|
7655 | + $form = new FormValidator('form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data")); |
|
7656 | 7656 | $defaults['title'] = Security :: remove_XSS($item_title); |
7657 | 7657 | if (empty($item_title)) { |
7658 | 7658 | $defaults['title'] = Security::remove_XSS($item_title); |
@@ -7709,15 +7709,15 @@ discard block |
||
7709 | 7709 | } |
7710 | 7710 | |
7711 | 7711 | $parent_select = $form->addSelect('parent', get_lang('Parent'), [], ['id' => 'idParent', 'onchange' => 'javascript: load_cbo(this.value);']); |
7712 | - $my_count=0; |
|
7712 | + $my_count = 0; |
|
7713 | 7713 | foreach ($arrHide as $key => $value) { |
7714 | - if ($my_count!=0) { |
|
7714 | + if ($my_count != 0) { |
|
7715 | 7715 | // The LP name is also the first section and is not in the same charset like the other sections. |
7716 | 7716 | $value['value'] = Security :: remove_XSS($value['value']); |
7717 | - $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"'); |
|
7717 | + $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"'); |
|
7718 | 7718 | } else { |
7719 | 7719 | $value['value'] = Security :: remove_XSS($value['value']); |
7720 | - $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"'); |
|
7720 | + $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"'); |
|
7721 | 7721 | } |
7722 | 7722 | $my_count++; |
7723 | 7723 | } |
@@ -7725,7 +7725,7 @@ discard block |
||
7725 | 7725 | if (!empty($id)) { |
7726 | 7726 | $parent_select->setSelected($parent); |
7727 | 7727 | } else { |
7728 | - $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0 ; |
|
7728 | + $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0; |
|
7729 | 7729 | $parent_select->setSelected($parent_item_id); |
7730 | 7730 | } |
7731 | 7731 | |
@@ -7742,7 +7742,7 @@ discard block |
||
7742 | 7742 | if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'] || $action == 'add') { |
7743 | 7743 | $s_selected_position = $arrLP[$i]['id']; |
7744 | 7744 | } |
7745 | - $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"'; |
|
7745 | + $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"'; |
|
7746 | 7746 | } |
7747 | 7747 | } |
7748 | 7748 | |
@@ -7750,8 +7750,8 @@ discard block |
||
7750 | 7750 | $position->addOption(get_lang('FirstPosition'), 0); |
7751 | 7751 | |
7752 | 7752 | foreach ($arrHide as $key => $value) { |
7753 | - $padding = isset($value['padding']) ? $value['padding']: 20; |
|
7754 | - $position->addOption($value['value'], $key, 'style="padding-left:' . $padding . 'px;"'); |
|
7753 | + $padding = isset($value['padding']) ? $value['padding'] : 20; |
|
7754 | + $position->addOption($value['value'], $key, 'style="padding-left:'.$padding.'px;"'); |
|
7755 | 7755 | } |
7756 | 7756 | |
7757 | 7757 | $position->setSelected($s_selected_position); |
@@ -7821,7 +7821,7 @@ discard block |
||
7821 | 7821 | $relative_path = array_slice($relative_path, 1, $cnt); |
7822 | 7822 | $relative_path = implode('/', $relative_path); |
7823 | 7823 | if (strlen($relative_path) > 0) { |
7824 | - $relative_path = $relative_path . '/'; |
|
7824 | + $relative_path = $relative_path.'/'; |
|
7825 | 7825 | } |
7826 | 7826 | } else { |
7827 | 7827 | $result = $this->generate_lp_folder($_course); |
@@ -7903,8 +7903,8 @@ discard block |
||
7903 | 7903 | $item_url = stripslashes($extra_info['url']); |
7904 | 7904 | } elseif (is_numeric($extra_info)) { |
7905 | 7905 | $extra_info = intval($extra_info); |
7906 | - $sql = "SELECT title, description, url FROM " . $tbl_link . " |
|
7907 | - WHERE c_id = ".$course_id." AND id = " . $extra_info; |
|
7906 | + $sql = "SELECT title, description, url FROM ".$tbl_link." |
|
7907 | + WHERE c_id = ".$course_id." AND id = ".$extra_info; |
|
7908 | 7908 | $result = Database::query($sql); |
7909 | 7909 | $row = Database :: fetch_array($result); |
7910 | 7910 | $item_title = $row['title']; |
@@ -7916,7 +7916,7 @@ discard block |
||
7916 | 7916 | $item_url = ''; |
7917 | 7917 | } |
7918 | 7918 | |
7919 | - $form = new FormValidator('edit_link', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']); |
|
7919 | + $form = new FormValidator('edit_link', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']); |
|
7920 | 7920 | $defaults = []; |
7921 | 7921 | |
7922 | 7922 | if ($id != 0 && is_array($extra_info)) { |
@@ -7925,8 +7925,8 @@ discard block |
||
7925 | 7925 | $parent = 0; |
7926 | 7926 | } |
7927 | 7927 | |
7928 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
7929 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
7928 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
7929 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
7930 | 7930 | $result = Database::query($sql); |
7931 | 7931 | $arrLP = array(); |
7932 | 7932 | |
@@ -7990,7 +7990,7 @@ discard block |
||
7990 | 7990 | $selectParent->addOption( |
7991 | 7991 | $arrLP[$i]['title'], |
7992 | 7992 | $arrLP[$i]['id'], |
7993 | - ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px;'] |
|
7993 | + ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px;'] |
|
7994 | 7994 | ); |
7995 | 7995 | |
7996 | 7996 | if ($parent == $arrLP[$i]['id']) { |
@@ -8004,7 +8004,7 @@ discard block |
||
8004 | 8004 | $selectParent->addOption( |
8005 | 8005 | $arrLP[$i]['title'], |
8006 | 8006 | $arrLP[$i]['id'], |
8007 | - ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px'] |
|
8007 | + ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px'] |
|
8008 | 8008 | ); |
8009 | 8009 | |
8010 | 8010 | if ($parent_item_id == $arrLP[$i]['id']) { |
@@ -8091,7 +8091,7 @@ discard block |
||
8091 | 8091 | |
8092 | 8092 | $form->setDefaults($defaults); |
8093 | 8093 | |
8094 | - return '<div class="sectioncomment">' . $form->returnForm() . '</div>'; |
|
8094 | + return '<div class="sectioncomment">'.$form->returnForm().'</div>'; |
|
8095 | 8095 | } |
8096 | 8096 | |
8097 | 8097 | /** |
@@ -8113,8 +8113,8 @@ discard block |
||
8113 | 8113 | } elseif (is_numeric($extra_info)) { |
8114 | 8114 | $extra_info = intval($extra_info); |
8115 | 8115 | $sql = "SELECT title, description |
8116 | - FROM " . $tbl_publication . " |
|
8117 | - WHERE c_id = ".$course_id." AND id = " . $extra_info; |
|
8116 | + FROM " . $tbl_publication." |
|
8117 | + WHERE c_id = ".$course_id." AND id = ".$extra_info; |
|
8118 | 8118 | |
8119 | 8119 | $result = Database::query($sql); |
8120 | 8120 | $row = Database :: fetch_array($result); |
@@ -8130,8 +8130,8 @@ discard block |
||
8130 | 8130 | $parent = 0; |
8131 | 8131 | } |
8132 | 8132 | |
8133 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
8134 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
8133 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
8134 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
8135 | 8135 | |
8136 | 8136 | $result = Database::query($sql); |
8137 | 8137 | $arrLP = array(); |
@@ -8196,7 +8196,7 @@ discard block |
||
8196 | 8196 | $parentSelect->addOption( |
8197 | 8197 | $arrLP[$i]['title'], |
8198 | 8198 | $arrLP[$i]['id'], |
8199 | - ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;'] |
|
8199 | + ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;'] |
|
8200 | 8200 | ); |
8201 | 8201 | |
8202 | 8202 | if ($parent == $arrLP[$i]['id']) { |
@@ -8210,7 +8210,7 @@ discard block |
||
8210 | 8210 | $parentSelect->addOption( |
8211 | 8211 | $arrLP[$i]['title'], |
8212 | 8212 | $arrLP[$i]['id'], |
8213 | - ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;'] |
|
8213 | + ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;'] |
|
8214 | 8214 | ); |
8215 | 8215 | |
8216 | 8216 | if ($parent == $arrLP[$i]['id']) { |
@@ -8234,7 +8234,7 @@ discard block |
||
8234 | 8234 | for ($i = 0; $i < count($arrLP); $i++) { |
8235 | 8235 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
8236 | 8236 | $previousSelect->addOption( |
8237 | - get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', |
|
8237 | + get_lang('After').' "'.$arrLP[$i]['title'].'"', |
|
8238 | 8238 | $arrLP[$i]['id'] |
8239 | 8239 | ); |
8240 | 8240 | |
@@ -8256,7 +8256,7 @@ discard block |
||
8256 | 8256 | } |
8257 | 8257 | } |
8258 | 8258 | } |
8259 | - $arrHide = array (); |
|
8259 | + $arrHide = array(); |
|
8260 | 8260 | for ($i = 0; $i < count($arrLP); $i++) { |
8261 | 8261 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
8262 | 8262 | if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
@@ -8336,8 +8336,8 @@ discard block |
||
8336 | 8336 | |
8337 | 8337 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
8338 | 8338 | $item_id = intval($item_id); |
8339 | - $sql = "SELECT * FROM " . $tbl_lp_item . " as lp |
|
8340 | - WHERE lp.c_id = ".$course_id." AND lp.id = " . $item_id; |
|
8339 | + $sql = "SELECT * FROM ".$tbl_lp_item." as lp |
|
8340 | + WHERE lp.c_id = ".$course_id." AND lp.id = ".$item_id; |
|
8341 | 8341 | $result = Database::query($sql); |
8342 | 8342 | $row = Database::fetch_assoc($result); |
8343 | 8343 | |
@@ -8351,16 +8351,16 @@ discard block |
||
8351 | 8351 | $audio_player .= '<script> |
8352 | 8352 | var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF"); |
8353 | 8353 | s1.addParam("allowscriptaccess","always"); |
8354 | - s1.addParam("flashvars","file=../..'.api_get_path(REL_COURSE_PATH).$_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=true"); |
|
8354 | + s1.addParam("flashvars","file=../..'.api_get_path(REL_COURSE_PATH).$_course['path'].'/document/audio/'.$row['audio'].'&autostart=true"); |
|
8355 | 8355 | s1.write("container"); |
8356 | 8356 | </script>'; |
8357 | 8357 | } |
8358 | 8358 | |
8359 | - $url = api_get_self().'?cidReq='.api_get_cidreq().'&view=build&id='.$item_id .'&lp_id='.$this->lp_id; |
|
8359 | + $url = api_get_self().'?cidReq='.api_get_cidreq().'&view=build&id='.$item_id.'&lp_id='.$this->lp_id; |
|
8360 | 8360 | |
8361 | 8361 | $return .= Display::url( |
8362 | 8362 | Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), |
8363 | - $url.'&action=edit_item&path_item=' . $row['path'] |
|
8363 | + $url.'&action=edit_item&path_item='.$row['path'] |
|
8364 | 8364 | ); |
8365 | 8365 | |
8366 | 8366 | $return .= Display::url( |
@@ -8380,7 +8380,7 @@ discard block |
||
8380 | 8380 | $url.'&action=delete_item' |
8381 | 8381 | ); |
8382 | 8382 | |
8383 | - if ($item_type == TOOL_HOTPOTATOES ) { |
|
8383 | + if ($item_type == TOOL_HOTPOTATOES) { |
|
8384 | 8384 | $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code); |
8385 | 8385 | $return .= get_lang('File').': '.$document_data['absolute_path_from_document']; |
8386 | 8386 | } |
@@ -8406,13 +8406,13 @@ discard block |
||
8406 | 8406 | public function get_js_dropdown_array() |
8407 | 8407 | { |
8408 | 8408 | $course_id = api_get_course_int_id(); |
8409 | - $return = 'var child_name = new Array();' . "\n"; |
|
8410 | - $return .= 'var child_value = new Array();' . "\n\n"; |
|
8411 | - $return .= 'child_name[0] = new Array();' . "\n"; |
|
8412 | - $return .= 'child_value[0] = new Array();' . "\n\n"; |
|
8409 | + $return = 'var child_name = new Array();'."\n"; |
|
8410 | + $return .= 'var child_value = new Array();'."\n\n"; |
|
8411 | + $return .= 'child_name[0] = new Array();'."\n"; |
|
8412 | + $return .= 'child_value[0] = new Array();'."\n\n"; |
|
8413 | 8413 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
8414 | - $sql_zero = "SELECT * FROM " . $tbl_lp_item . " |
|
8415 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id . " AND parent_item_id = 0 |
|
8414 | + $sql_zero = "SELECT * FROM ".$tbl_lp_item." |
|
8415 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id." AND parent_item_id = 0 |
|
8416 | 8416 | ORDER BY display_order ASC"; |
8417 | 8417 | $res_zero = Database::query($sql_zero); |
8418 | 8418 | $i = 0; |
@@ -8423,29 +8423,29 @@ discard block |
||
8423 | 8423 | $row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']); |
8424 | 8424 | } |
8425 | 8425 | $js_var = json_encode(get_lang('After').' '.$row_zero['title']); |
8426 | - $return .= 'child_name[0][' . $i . '] = '.$js_var.' ;' . "\n"; |
|
8427 | - $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n"; |
|
8426 | + $return .= 'child_name[0]['.$i.'] = '.$js_var.' ;'."\n"; |
|
8427 | + $return .= 'child_value[0]['.$i++.'] = "'.$row_zero['id'].'";'."\n"; |
|
8428 | 8428 | } |
8429 | 8429 | } |
8430 | 8430 | $return .= "\n"; |
8431 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
8432 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
8431 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
8432 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
8433 | 8433 | $res = Database::query($sql); |
8434 | 8434 | while ($row = Database :: fetch_array($res)) { |
8435 | - $sql_parent = "SELECT * FROM " . $tbl_lp_item . " |
|
8435 | + $sql_parent = "SELECT * FROM ".$tbl_lp_item." |
|
8436 | 8436 | WHERE |
8437 | 8437 | c_id = ".$course_id." AND |
8438 | - parent_item_id = " . $row['id'] . " |
|
8438 | + parent_item_id = " . $row['id']." |
|
8439 | 8439 | ORDER BY display_order ASC"; |
8440 | 8440 | $res_parent = Database::query($sql_parent); |
8441 | 8441 | $i = 0; |
8442 | - $return .= 'child_name[' . $row['id'] . '] = new Array();' . "\n"; |
|
8443 | - $return .= 'child_value[' . $row['id'] . '] = new Array();' . "\n\n"; |
|
8442 | + $return .= 'child_name['.$row['id'].'] = new Array();'."\n"; |
|
8443 | + $return .= 'child_value['.$row['id'].'] = new Array();'."\n\n"; |
|
8444 | 8444 | |
8445 | 8445 | while ($row_parent = Database :: fetch_array($res_parent)) { |
8446 | 8446 | $js_var = json_encode(get_lang('After').' '.$row_parent['title']); |
8447 | - $return .= 'child_name[' . $row['id'] . '][' . $i . '] = '.$js_var.' ;' . "\n"; |
|
8448 | - $return .= 'child_value[' . $row['id'] . '][' . $i++ . '] = "' . $row_parent['id'] . '";' . "\n"; |
|
8447 | + $return .= 'child_name['.$row['id'].']['.$i.'] = '.$js_var.' ;'."\n"; |
|
8448 | + $return .= 'child_value['.$row['id'].']['.$i++.'] = "'.$row_parent['id'].'";'."\n"; |
|
8449 | 8449 | } |
8450 | 8450 | $return .= "\n"; |
8451 | 8451 | } |
@@ -8466,8 +8466,8 @@ discard block |
||
8466 | 8466 | if (is_numeric($item_id)) { |
8467 | 8467 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
8468 | 8468 | |
8469 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
8470 | - WHERE c_id = ".$course_id." AND id = " . $item_id; |
|
8469 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
8470 | + WHERE c_id = ".$course_id." AND id = ".$item_id; |
|
8471 | 8471 | |
8472 | 8472 | $res = Database::query($sql); |
8473 | 8473 | $row = Database :: fetch_array($res); |
@@ -8521,7 +8521,7 @@ discard block |
||
8521 | 8521 | */ |
8522 | 8522 | public function display_item_small_form($item_type, $title = '', $data = array()) |
8523 | 8523 | { |
8524 | - $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id; |
|
8524 | + $url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id; |
|
8525 | 8525 | $form = new FormValidator('small_form', 'post', $url); |
8526 | 8526 | $form->addElement('header', $title); |
8527 | 8527 | $form->addElement('text', 'title', get_lang('Title')); |
@@ -8547,7 +8547,7 @@ discard block |
||
8547 | 8547 | $item_id = intval($item_id); |
8548 | 8548 | /* Current prerequisite */ |
8549 | 8549 | $sql = "SELECT * FROM $tbl_lp_item |
8550 | - WHERE c_id = $course_id AND id = " . $item_id; |
|
8550 | + WHERE c_id = $course_id AND id = ".$item_id; |
|
8551 | 8551 | $result = Database::query($sql); |
8552 | 8552 | $row = Database::fetch_array($result); |
8553 | 8553 | $prerequisiteId = $row['prerequisite']; |
@@ -8557,20 +8557,20 @@ discard block |
||
8557 | 8557 | $return .= '<form method="POST">'; |
8558 | 8558 | $return .= '<table class="data_table">'; |
8559 | 8559 | $return .= '<tr>'; |
8560 | - $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>'; |
|
8561 | - $return .= '<th width="70" >' . get_lang('Minimum') . '</th>'; |
|
8562 | - $return .= '<th width="70">' . get_lang('Maximum') . '</th>'; |
|
8560 | + $return .= '<th height="24">'.get_lang('LearnpathPrerequisites').'</th>'; |
|
8561 | + $return .= '<th width="70" >'.get_lang('Minimum').'</th>'; |
|
8562 | + $return .= '<th width="70">'.get_lang('Maximum').'</th>'; |
|
8563 | 8563 | $return .= '</tr>'; |
8564 | 8564 | |
8565 | 8565 | // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146 |
8566 | 8566 | $return .= '<tr >'; |
8567 | 8567 | $return .= '<td colspan="3" class="radio">'; |
8568 | 8568 | $return .= '<input checked="checked" id="idNone" name="prerequisites" style="margin-left:0px; margin-right:10px;" type="radio" />'; |
8569 | - $return .= '<label for="idNone">' . get_lang('None') . '</label>'; |
|
8569 | + $return .= '<label for="idNone">'.get_lang('None').'</label>'; |
|
8570 | 8570 | $return .= '</tr>'; |
8571 | 8571 | |
8572 | 8572 | $sql = "SELECT * FROM $tbl_lp_item |
8573 | - WHERE c_id = $course_id AND lp_id = " . $this->lp_id; |
|
8573 | + WHERE c_id = $course_id AND lp_id = ".$this->lp_id; |
|
8574 | 8574 | $result = Database::query($sql); |
8575 | 8575 | $arrLP = array(); |
8576 | 8576 | |
@@ -8613,25 +8613,25 @@ discard block |
||
8613 | 8613 | } |
8614 | 8614 | |
8615 | 8615 | $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score']; |
8616 | - $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']]: 0; |
|
8616 | + $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0; |
|
8617 | 8617 | |
8618 | 8618 | $return .= '<tr>'; |
8619 | - $return .= '<td class="radio"' . (($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . '>'; |
|
8620 | - $return .= '<label for="id' . $item['id'] . '">'; |
|
8621 | - $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'] . '" />'; |
|
8619 | + $return .= '<td class="radio"'.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>'; |
|
8620 | + $return .= '<label for="id'.$item['id'].'">'; |
|
8621 | + $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'].'" />'; |
|
8622 | 8622 | $icon_name = str_replace(' ', '', $item['item_type']); |
8623 | 8623 | |
8624 | - if (file_exists('../img/lp_' . $icon_name . '.png')) { |
|
8625 | - $return .= Display::return_icon('lp_' . $icon_name . '.png'); |
|
8624 | + if (file_exists('../img/lp_'.$icon_name.'.png')) { |
|
8625 | + $return .= Display::return_icon('lp_'.$icon_name.'.png'); |
|
8626 | 8626 | } else { |
8627 | - if (file_exists('../img/lp_' . $icon_name . '.gif')) { |
|
8628 | - $return .= Display::return_icon('lp_' . $icon_name . '.gif'); |
|
8627 | + if (file_exists('../img/lp_'.$icon_name.'.gif')) { |
|
8628 | + $return .= Display::return_icon('lp_'.$icon_name.'.gif'); |
|
8629 | 8629 | } else { |
8630 | - $return .= Display::return_icon('folder_document.gif','',array('style'=>'margin-right:5px;')); |
|
8630 | + $return .= Display::return_icon('folder_document.gif', '', array('style'=>'margin-right:5px;')); |
|
8631 | 8631 | } |
8632 | 8632 | } |
8633 | 8633 | |
8634 | - $return .= $item['title'] . '</label>'; |
|
8634 | + $return .= $item['title'].'</label>'; |
|
8635 | 8635 | $return .= '</td>'; |
8636 | 8636 | |
8637 | 8637 | if ($item['item_type'] == TOOL_QUIZ) { |
@@ -8645,19 +8645,19 @@ discard block |
||
8645 | 8645 | $item['max_score'] = $tmp_obj_lp_item->max_score; |
8646 | 8646 | |
8647 | 8647 | $return .= '<td class="exercise">'; |
8648 | - $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue. '" />'; |
|
8648 | + $return .= '<input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" />'; |
|
8649 | 8649 | $return .= '</td>'; |
8650 | 8650 | $return .= '<td class="exercise">'; |
8651 | - $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMaxScoreValue . '" />'; |
|
8651 | + $return .= '<input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" />'; |
|
8652 | 8652 | $return .= '</td>'; |
8653 | 8653 | } |
8654 | 8654 | |
8655 | 8655 | if ($item['item_type'] == TOOL_HOTPOTATOES) { |
8656 | 8656 | $return .= '<td class="exercise">'; |
8657 | - $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue . '" /></center>'; |
|
8657 | + $return .= '<center><input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" /></center>'; |
|
8658 | 8658 | $return .= '</td>'; |
8659 | 8659 | $return .= '<td class="exercise"">'; |
8660 | - $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue . '" /></center>'; |
|
8660 | + $return .= '<center><input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" /></center>'; |
|
8661 | 8661 | $return .= '</td>'; |
8662 | 8662 | } |
8663 | 8663 | $return .= '</tr>'; |
@@ -8666,7 +8666,7 @@ discard block |
||
8666 | 8666 | $return .= '</tr>'; |
8667 | 8667 | $return .= '</table>'; |
8668 | 8668 | $return .= '<div style="padding-top:3px;">'; |
8669 | - $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>'; |
|
8669 | + $return .= '<button class="btn btn-primary" name="submit_button" type="submit">'.get_lang('ModifyPrerequisites').'</button>'; |
|
8670 | 8670 | $return .= '</form>'; |
8671 | 8671 | |
8672 | 8672 | return $return; |
@@ -8702,7 +8702,7 @@ discard block |
||
8702 | 8702 | if ($row['id'] == $lp_id) { |
8703 | 8703 | continue; |
8704 | 8704 | } |
8705 | - $return .= '<option value="'.$row['id'].'" '.(($row['id']==$prerequisiteId)?' selected ' : '').'>'.$row['name'].'</option>'; |
|
8705 | + $return .= '<option value="'.$row['id'].'" '.(($row['id'] == $prerequisiteId) ? ' selected ' : '').'>'.$row['name'].'</option>'; |
|
8706 | 8706 | } |
8707 | 8707 | } |
8708 | 8708 | $return .= '</select>'; |
@@ -8810,8 +8810,8 @@ discard block |
||
8810 | 8810 | WHERE c_id = $course_id AND $activeCondition $condition_session |
8811 | 8811 | ORDER BY title ASC"; |
8812 | 8812 | |
8813 | - $sql_hot = "SELECT * FROM $tbl_doc |
|
8814 | - WHERE c_id = $course_id AND path LIKE '" . $uploadPath . "/%/%htm%' $condition_session |
|
8813 | + $sql_hot = "SELECT * FROM $tbl_doc |
|
8814 | + WHERE c_id = $course_id AND path LIKE '".$uploadPath."/%/%htm%' $condition_session |
|
8815 | 8815 | ORDER BY id ASC"; |
8816 | 8816 | |
8817 | 8817 | $res_quiz = Database::query($sql_quiz); |
@@ -8821,8 +8821,8 @@ discard block |
||
8821 | 8821 | |
8822 | 8822 | $return .= '<li class="lp_resource_element">'; |
8823 | 8823 | $return .= Display::return_icon('new_exercice.png'); |
8824 | - $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercise/exercise_admin.php?'.api_get_cidreq().'&lp_id=' . $this->lp_id . '">' . |
|
8825 | - get_lang('NewExercise') . '</a>'; |
|
8824 | + $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/exercise_admin.php?'.api_get_cidreq().'&lp_id='.$this->lp_id.'">'. |
|
8825 | + get_lang('NewExercise').'</a>'; |
|
8826 | 8826 | $return .= '</li>'; |
8827 | 8827 | |
8828 | 8828 | // Display hotpotatoes |
@@ -8832,8 +8832,8 @@ discard block |
||
8832 | 8832 | $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY); |
8833 | 8833 | $return .= '</a> '; |
8834 | 8834 | $return .= Display::return_icon('hotpotatoes_s.png'); |
8835 | - $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq().'&action=add_item&type=' . TOOL_HOTPOTATOES . '&file=' . $row_hot['id'] . '&lp_id=' . $this->lp_id . '">'. |
|
8836 | - ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . '</a>'; |
|
8835 | + $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_HOTPOTATOES.'&file='.$row_hot['id'].'&lp_id='.$this->lp_id.'">'. |
|
8836 | + ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])).'</a>'; |
|
8837 | 8837 | $return .= '</li>'; |
8838 | 8838 | } |
8839 | 8839 | |
@@ -8843,7 +8843,7 @@ discard block |
||
8843 | 8843 | $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY); |
8844 | 8844 | $return .= '</a> '; |
8845 | 8845 | $return .= Display::return_icon('quizz_small.gif', '', array(), ICON_SIZE_TINY); |
8846 | - $return .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_QUIZ . '&file=' . $row_quiz['id'] . '&lp_id=' . $this->lp_id . '">' . |
|
8846 | + $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'. |
|
8847 | 8847 | Security :: remove_XSS(cut($row_quiz['title'], 80)). |
8848 | 8848 | '</a>'; |
8849 | 8849 | |
@@ -8924,7 +8924,7 @@ discard block |
||
8924 | 8924 | ['target' => '_blank'] |
8925 | 8925 | ); |
8926 | 8926 | |
8927 | - if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) { |
|
8927 | + if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) { |
|
8928 | 8928 | $linkNodes .= |
8929 | 8929 | '<li class="lp_resource_element" data_id="'.$key.'" data_type="'.TOOL_LINK.'" title="'.$title.'" > |
8930 | 8930 | <a class="moved" href="#">'. |
@@ -8962,8 +8962,8 @@ discard block |
||
8962 | 8962 | $return = '<ul class="lp_resource">'; |
8963 | 8963 | $return .= '<li class="lp_resource_element">'; |
8964 | 8964 | $return .= Display::return_icon('works_new.gif'); |
8965 | - $return .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&lp_id=' . $this->lp_id . '">' . |
|
8966 | - get_lang('AddAssignmentPage') . '</a>'; |
|
8965 | + $return .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&lp_id='.$this->lp_id.'">'. |
|
8966 | + get_lang('AddAssignmentPage').'</a>'; |
|
8967 | 8967 | $return .= '</li>'; |
8968 | 8968 | $sessionId = api_get_session_id(); |
8969 | 8969 | |
@@ -8985,7 +8985,7 @@ discard block |
||
8985 | 8985 | $return .= '</a> '; |
8986 | 8986 | |
8987 | 8987 | $return .= Display::return_icon('works.gif'); |
8988 | - $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 . '">' . |
|
8988 | + $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.'">'. |
|
8989 | 8989 | Security :: remove_XSS(cut(strip_tags($work['title']), 80)).' '.$link.' |
8990 | 8990 | </a>'; |
8991 | 8991 | |
@@ -9045,7 +9045,7 @@ discard block |
||
9045 | 9045 | $return .= Display::return_icon('new_forum.png'); |
9046 | 9046 | $return .= Display::url( |
9047 | 9047 | get_lang('CreateANewForum'), |
9048 | - api_get_path(WEB_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&' . http_build_query([ |
|
9048 | + api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&'.http_build_query([ |
|
9049 | 9049 | 'action' => 'add', |
9050 | 9050 | 'content' => 'forum', |
9051 | 9051 | 'lp_id' => $this->lp_id |
@@ -9079,15 +9079,15 @@ discard block |
||
9079 | 9079 | $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY); |
9080 | 9080 | $return .= ' </a>'; |
9081 | 9081 | $return .= Display::return_icon('lp_forum.png', '', array(), ICON_SIZE_TINY); |
9082 | - $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle"> |
|
9083 | - <img src="' . Display::returnIconPath('add.gif').'" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" /> |
|
9082 | + $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum('.$forum['forum_id'].')" style="vertical-align:middle"> |
|
9083 | + <img src="' . Display::returnIconPath('add.gif').'" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" /> |
|
9084 | 9084 | </a> |
9085 | - <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">' . |
|
9086 | - Security :: remove_XSS($forum['forum_title']) . '</a>'; |
|
9085 | + <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">'. |
|
9086 | + Security :: remove_XSS($forum['forum_title']).'</a>'; |
|
9087 | 9087 | |
9088 | 9088 | $return .= '</li>'; |
9089 | 9089 | |
9090 | - $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">'; |
|
9090 | + $return .= '<div style="display:none" id="forum_'.$forum['forum_id'].'_content">'; |
|
9091 | 9091 | $a_threads = get_threads($forum['forum_id']); |
9092 | 9092 | if (is_array($a_threads)) { |
9093 | 9093 | foreach ($a_threads as $thread) { |
@@ -9102,8 +9102,8 @@ discard block |
||
9102 | 9102 | $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY); |
9103 | 9103 | $return .= ' </a>'; |
9104 | 9104 | $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY); |
9105 | - $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 . '">' . |
|
9106 | - Security :: remove_XSS($thread['thread_title']) . ' '.$link.'</a>'; |
|
9105 | + $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.'">'. |
|
9106 | + Security :: remove_XSS($thread['thread_title']).' '.$link.'</a>'; |
|
9107 | 9107 | $return .= '</li>'; |
9108 | 9108 | } |
9109 | 9109 | } |
@@ -9176,7 +9176,7 @@ discard block |
||
9176 | 9176 | ) { |
9177 | 9177 | // Remove the possible . at the end of the path. |
9178 | 9178 | $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path; |
9179 | - $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp); |
|
9179 | + $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir.'/scorm/'.$dest_path_to_lp); |
|
9180 | 9180 | mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true); |
9181 | 9181 | copyr( |
9182 | 9182 | $current_course_path.'/scorm/'.$this->path, |
@@ -9251,7 +9251,7 @@ discard block |
||
9251 | 9251 | if ($item->type === 'sco') { |
9252 | 9252 | $inc_docs = $item->get_resources_from_source( |
9253 | 9253 | null, |
9254 | - api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path() |
|
9254 | + api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path() |
|
9255 | 9255 | ); |
9256 | 9256 | } else { |
9257 | 9257 | $inc_docs = $item->get_resources_from_source(); |
@@ -9472,7 +9472,7 @@ discard block |
||
9472 | 9472 | $file_path = substr($file_path, strlen($current_dir)); // We get the relative path. |
9473 | 9473 | $zip_files[] = $my_sub_dir.'/'.$file_path; |
9474 | 9474 | $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); |
9475 | - $my_dep_file->setAttribute('href','document/'.$file_path); |
|
9475 | + $my_dep_file->setAttribute('href', 'document/'.$file_path); |
|
9476 | 9476 | $my_dep->setAttribute('xml:base', ''); |
9477 | 9477 | } |
9478 | 9478 | } |
@@ -9602,7 +9602,7 @@ discard block |
||
9602 | 9602 | //$my_item->appendChild($my_max_score); |
9603 | 9603 | // Give a child element <adlcp:prerequisites> to the <item> element. |
9604 | 9604 | $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string()); |
9605 | - $my_prereqs->setAttribute('type','aicc_script'); |
|
9605 | + $my_prereqs->setAttribute('type', 'aicc_script'); |
|
9606 | 9606 | $my_item->appendChild($my_prereqs); |
9607 | 9607 | // Give a child element <adlcp:masteryscore> to the <item> element. |
9608 | 9608 | $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score()); |
@@ -9667,7 +9667,7 @@ discard block |
||
9667 | 9667 | $my_resource->appendChild($my_file); |
9668 | 9668 | |
9669 | 9669 | // Get included docs. |
9670 | - $inc_docs = $item->get_resources_from_source(null,$tmp_file_path); |
|
9670 | + $inc_docs = $item->get_resources_from_source(null, $tmp_file_path); |
|
9671 | 9671 | // Dependency to other files - not yet supported. |
9672 | 9672 | $i = 1; |
9673 | 9673 | foreach ($inc_docs as $doc_info) { |
@@ -9726,7 +9726,7 @@ discard block |
||
9726 | 9726 | $my_dep_file->setAttribute('href', $file_path); |
9727 | 9727 | $my_dep->setAttribute('xml:base', ''); |
9728 | 9728 | |
9729 | - if (strstr($file_path,$main_path) !== false) { |
|
9729 | + if (strstr($file_path, $main_path) !== false) { |
|
9730 | 9730 | // The calculated real path is really inside the chamilo root path. |
9731 | 9731 | // Reduce file path to what's under the DocumentRoot. |
9732 | 9732 | $file_path = substr($file_path, strlen($root_path)); |
@@ -9744,7 +9744,7 @@ discard block |
||
9744 | 9744 | $file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0]; |
9745 | 9745 | $file_path = str_replace('//', '/', $file_path); |
9746 | 9746 | if (file_exists($file_path)) { |
9747 | - $file_path = substr($file_path,strlen($current_dir)); // We get the relative path. |
|
9747 | + $file_path = substr($file_path, strlen($current_dir)); // We get the relative path. |
|
9748 | 9748 | $zip_files[] = $my_sub_dir.'/'.$file_path; |
9749 | 9749 | $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); |
9750 | 9750 | $my_dep_file->setAttribute('href', 'document/'.$file_path); |
@@ -9995,7 +9995,7 @@ discard block |
||
9995 | 9995 | file_put_contents($archive_path.$temp_dir_short.'/document/non_exportable.html', $file_content); |
9996 | 9996 | |
9997 | 9997 | // Add the extra files that go along with a SCORM package. |
9998 | - $main_code_path = api_get_path(SYS_CODE_PATH) . 'lp/packaging/'; |
|
9998 | + $main_code_path = api_get_path(SYS_CODE_PATH).'lp/packaging/'; |
|
9999 | 9999 | |
10000 | 10000 | $fs = new Filesystem(); |
10001 | 10001 | $fs->mirror($main_code_path, $archive_path.$temp_dir_short); |
@@ -10050,7 +10050,7 @@ discard block |
||
10050 | 10050 | } |
10051 | 10051 | $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path']; |
10052 | 10052 | if (file_exists($file_path)) { |
10053 | - $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path); |
|
10053 | + $files_to_export[] = array('title'=>$item->get_title(), 'path'=>$file_path); |
|
10054 | 10054 | } |
10055 | 10055 | break; |
10056 | 10056 | case 'asset': //commes from a scorm package generated by chamilo |
@@ -10088,12 +10088,12 @@ discard block |
||
10088 | 10088 | |
10089 | 10089 | foreach ($path_bits as $bit) { |
10090 | 10090 | if (!empty ($bit)) { |
10091 | - $new_path = $path_built . $bit; |
|
10091 | + $new_path = $path_built.$bit; |
|
10092 | 10092 | if (is_dir($new_path)) { |
10093 | - $path_built = $new_path . '/'; |
|
10093 | + $path_built = $new_path.'/'; |
|
10094 | 10094 | } else { |
10095 | 10095 | mkdir($new_path, api_get_permissions_for_new_directories()); |
10096 | - $path_built = $new_path . '/'; |
|
10096 | + $path_built = $new_path.'/'; |
|
10097 | 10097 | } |
10098 | 10098 | } |
10099 | 10099 | } |
@@ -10134,9 +10134,9 @@ discard block |
||
10134 | 10134 | |
10135 | 10135 | if ($upload_ok) { |
10136 | 10136 | if ($has_attachment) { |
10137 | - $courseDir = api_get_course_path() . '/upload/learning_path/images'; |
|
10137 | + $courseDir = api_get_course_path().'/upload/learning_path/images'; |
|
10138 | 10138 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
10139 | - $updir = $sys_course_path . $courseDir; |
|
10139 | + $updir = $sys_course_path.$courseDir; |
|
10140 | 10140 | // Try to add an extension to the file if it hasn't one. |
10141 | 10141 | $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']); |
10142 | 10142 | |
@@ -10189,7 +10189,7 @@ discard block |
||
10189 | 10189 | //Setting my lp_id to autolaunch = 1 |
10190 | 10190 | $attributes['autolaunch'] = 1; |
10191 | 10191 | $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id)); |
10192 | - Database::update($lp_table, $attributes, $where ); |
|
10192 | + Database::update($lp_table, $attributes, $where); |
|
10193 | 10193 | } |
10194 | 10194 | } |
10195 | 10195 | |
@@ -10208,13 +10208,13 @@ discard block |
||
10208 | 10208 | |
10209 | 10209 | // Get the max order of the items |
10210 | 10210 | $sql = "SELECT max(display_order) AS display_order FROM $table_lp_item |
10211 | - WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "'"; |
|
10211 | + WHERE c_id = $course_id AND lp_id = '".$this->lp_id."'"; |
|
10212 | 10212 | $rs_max_order = Database::query($sql); |
10213 | 10213 | $row_max_order = Database::fetch_object($rs_max_order); |
10214 | 10214 | $max_order = $row_max_order->display_order; |
10215 | 10215 | // Get the previous item ID |
10216 | 10216 | $sql = "SELECT id as previous FROM $table_lp_item |
10217 | - WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "' AND display_order = '".$max_order."' "; |
|
10217 | + WHERE c_id = $course_id AND lp_id = '".$this->lp_id."' AND display_order = '".$max_order."' "; |
|
10218 | 10218 | $rs_max = Database::query($sql); |
10219 | 10219 | $row_max = Database::fetch_object($rs_max); |
10220 | 10220 | |
@@ -10264,9 +10264,9 @@ discard block |
||
10264 | 10264 | $documents_total_space = DocumentManager::documents_total_space(); |
10265 | 10265 | $course_max_space = DocumentManager::get_course_quota(); |
10266 | 10266 | $total_size = filesize($s) + $documents_total_space; |
10267 | - if (filesize($s)>$post_max || filesize($s)>$upl_max || $total_size>$course_max_space ){ |
|
10267 | + if (filesize($s) > $post_max || filesize($s) > $upl_max || $total_size > $course_max_space) { |
|
10268 | 10268 | return true; |
10269 | - } else{ |
|
10269 | + } else { |
|
10270 | 10270 | return false; |
10271 | 10271 | } |
10272 | 10272 | } |
@@ -10614,7 +10614,7 @@ discard block |
||
10614 | 10614 | if ($this->debug > 0) { |
10615 | 10615 | error_log('New LP - In learnpath::set_subscribe_users()', 0); |
10616 | 10616 | } |
10617 | - $this->subscribeUsers = intval($value);; |
|
10617 | + $this->subscribeUsers = intval($value); ; |
|
10618 | 10618 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
10619 | 10619 | $lp_id = $this->get_id(); |
10620 | 10620 | $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers." |
@@ -10957,7 +10957,7 @@ discard block |
||
10957 | 10957 | */ |
10958 | 10958 | public function createForum($forumCategoryId) |
10959 | 10959 | { |
10960 | - require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php'; |
|
10960 | + require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php'; |
|
10961 | 10961 | |
10962 | 10962 | $forumId = store_forum( |
10963 | 10963 | [ |
@@ -11005,7 +11005,7 @@ discard block |
||
11005 | 11005 | */ |
11006 | 11006 | private function getFinalItemTemplate() |
11007 | 11007 | { |
11008 | - return file_get_contents(api_get_path(SYS_CODE_PATH) . 'lp/final_item_template/template.html'); |
|
11008 | + return file_get_contents(api_get_path(SYS_CODE_PATH).'lp/final_item_template/template.html'); |
|
11009 | 11009 | } |
11010 | 11010 | |
11011 | 11011 | /** |
@@ -11051,11 +11051,11 @@ discard block |
||
11051 | 11051 | 'Height' => '500', |
11052 | 11052 | 'FullPage' => true, |
11053 | 11053 | 'CreateDocumentDir' => $relative_prefix, |
11054 | - 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/', |
|
11055 | - 'BaseHref' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/' . $relative_path |
|
11054 | + 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/', |
|
11055 | + 'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path |
|
11056 | 11056 | ]; |
11057 | 11057 | |
11058 | - $url = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ |
|
11058 | + $url = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ |
|
11059 | 11059 | 'type' => 'document', |
11060 | 11060 | 'lp_id' => $this->lp_id |
11061 | 11061 | ]); |
@@ -11223,8 +11223,8 @@ discard block |
||
11223 | 11223 | $sql = "SELECT * FROM $item_view_table |
11224 | 11224 | WHERE |
11225 | 11225 | c_id = $course_id AND |
11226 | - lp_item_id = " . $row_item['id'] . " AND |
|
11227 | - lp_view_id = " . $lpViewId . " |
|
11226 | + lp_item_id = ".$row_item['id']." AND |
|
11227 | + lp_view_id = " . $lpViewId." |
|
11228 | 11228 | ORDER BY view_count DESC"; |
11229 | 11229 | $learnpathItemViewResult = Database::query($sql); |
11230 | 11230 | $learnpathItemViewData = Database::fetch_array($learnpathItemViewResult, 'ASSOC'); |
@@ -11242,7 +11242,7 @@ discard block |
||
11242 | 11242 | |
11243 | 11243 | switch ($type) { |
11244 | 11244 | case 'dir': |
11245 | - $link .= $main_dir_path . 'lp/blank.php'; |
|
11245 | + $link .= $main_dir_path.'lp/blank.php'; |
|
11246 | 11246 | case TOOL_CALENDAR_EVENT: |
11247 | 11247 | $link .= $main_dir_path.'calendar/agenda.php?origin='.$origin.'&agenda_id='.$id; |
11248 | 11248 | break; |
@@ -11260,12 +11260,12 @@ discard block |
||
11260 | 11260 | if (!empty($id)) { |
11261 | 11261 | $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
11262 | 11262 | $sql = "SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"; |
11263 | - $result= Database::query($sql); |
|
11263 | + $result = Database::query($sql); |
|
11264 | 11264 | $myrow = Database::fetch_array($result); |
11265 | 11265 | if ($row_item['title'] != '') { |
11266 | 11266 | $myrow['title'] = $row_item['title']; |
11267 | 11267 | } |
11268 | - $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; |
|
11268 | + $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; |
|
11269 | 11269 | } |
11270 | 11270 | break; |
11271 | 11271 | case 'hotpotatoes': //lowercase because of strtolower above |
@@ -11273,7 +11273,7 @@ discard block |
||
11273 | 11273 | $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE c_id = $course_id AND id=$id"); |
11274 | 11274 | $myrow = Database::fetch_array($result); |
11275 | 11275 | $path = $myrow['path']; |
11276 | - $link .= $main_dir_path . 'exercise/showinframes.php?file='.$path.'&origin='.$origin.'&cid='.$course_code.'&uid='.api_get_user_id().'' . |
|
11276 | + $link .= $main_dir_path.'exercise/showinframes.php?file='.$path.'&origin='.$origin.'&cid='.$course_code.'&uid='.api_get_user_id().''. |
|
11277 | 11277 | '&learnpath_id='.$learningPathId.'&learnpath_item_id='.$id_in_path.'&lp_view_id='.$lpViewId; |
11278 | 11278 | break; |
11279 | 11279 | case TOOL_FORUM: |
@@ -11285,7 +11285,7 @@ discard block |
||
11285 | 11285 | $sql = "SELECT * FROM $tbl_topics WHERE c_id = $course_id AND thread_id=$id"; |
11286 | 11286 | $result = Database::query($sql); |
11287 | 11287 | $myrow = Database::fetch_array($result); |
11288 | - $link .= $main_dir_path.'forum/viewthread.php?origin=learnpath&thread='.$id.'' . |
|
11288 | + $link .= $main_dir_path.'forum/viewthread.php?origin=learnpath&thread='.$id.''. |
|
11289 | 11289 | '&forum='.$myrow['forum_id'].'&lp=true'; |
11290 | 11290 | } |
11291 | 11291 | break; |
@@ -11293,8 +11293,8 @@ discard block |
||
11293 | 11293 | $tbl_post = Database::get_course_table(TABLE_FORUM_POST); |
11294 | 11294 | $result = Database::query("SELECT * FROM $tbl_post WHERE c_id = $course_id AND post_id=$id"); |
11295 | 11295 | $myrow = Database::fetch_array($result); |
11296 | - $link .= $main_dir_path.'forum/viewthread.php?post='.$id.'' . |
|
11297 | - '&thread='.$myrow['thread_id'].'&forum='.$myrow['forum_id'].'' . |
|
11296 | + $link .= $main_dir_path.'forum/viewthread.php?post='.$id.''. |
|
11297 | + '&thread='.$myrow['thread_id'].'&forum='.$myrow['forum_id'].''. |
|
11298 | 11298 | '&lp=true'; |
11299 | 11299 | break; |
11300 | 11300 | case TOOL_DOCUMENT: |
@@ -11312,9 +11312,9 @@ discard block |
||
11312 | 11312 | $showDirectUrl = !in_array($extension, $jplayer_supported_files); |
11313 | 11313 | |
11314 | 11314 | if ($showDirectUrl) { |
11315 | - $link = $main_course_path . 'document' . $document->getPath() . '?' . api_get_cidreq(); |
|
11315 | + $link = $main_course_path.'document'.$document->getPath().'?'.api_get_cidreq(); |
|
11316 | 11316 | } else { |
11317 | - $link = api_get_path(WEB_CODE_PATH) . 'document/showinframes.php?' . http_build_query([ |
|
11317 | + $link = api_get_path(WEB_CODE_PATH).'document/showinframes.php?'.http_build_query([ |
|
11318 | 11318 | 'cidReq' => $course_code, |
11319 | 11319 | 'id' => $id, |
11320 | 11320 | 'origin' => 'learnpathitem' |
@@ -11323,11 +11323,11 @@ discard block |
||
11323 | 11323 | |
11324 | 11324 | $openmethod = 2; |
11325 | 11325 | $officedoc = false; |
11326 | - Session::write('openmethod',$openmethod); |
|
11327 | - Session::write('officedoc',$officedoc); |
|
11326 | + Session::write('openmethod', $openmethod); |
|
11327 | + Session::write('officedoc', $officedoc); |
|
11328 | 11328 | break; |
11329 | 11329 | case TOOL_LP_FINAL_ITEM: |
11330 | - $link .= api_get_path(WEB_CODE_PATH) . 'lp/lp_final_item.php?'.api_get_cidreq().'&id='.$id.'&lp_id='.$learningPathId; |
|
11330 | + $link .= api_get_path(WEB_CODE_PATH).'lp/lp_final_item.php?'.api_get_cidreq().'&id='.$id.'&lp_id='.$learningPathId; |
|
11331 | 11331 | break; |
11332 | 11332 | case 'assignments': |
11333 | 11333 | $link .= $main_dir_path.'work/work.php?origin='.$origin; |
@@ -11353,7 +11353,7 @@ discard block |
||
11353 | 11353 | break; |
11354 | 11354 | } |
11355 | 11355 | |
11356 | - $link .= $main_dir_path . 'work/work.php?' . api_get_cidreq() . '&' . http_build_query([ |
|
11356 | + $link .= $main_dir_path.'work/work.php?'.api_get_cidreq().'&'.http_build_query([ |
|
11357 | 11357 | 'id' => $row_item['path'], |
11358 | 11358 | 'origin' => 'learnpath' |
11359 | 11359 | ]); |
@@ -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"); |
@@ -178,8 +178,8 @@ |
||
178 | 178 | ); |
179 | 179 | $display_date = 'none'; |
180 | 180 | if (!empty($expired_on)) { |
181 | - $display_date = 'block'; |
|
182 | - $defaults['activate_end_date_check'] = 1; |
|
181 | + $display_date = 'block'; |
|
182 | + $defaults['activate_end_date_check'] = 1; |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | $form->addElement('html', '<div id="end_date_div" style="display:'.$display_date.';">'); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | } |
21 | 21 | |
22 | 22 | if (!empty($gradebook) && $gradebook == 'view') { |
23 | - $interbreadcrumb[] = array ( |
|
23 | + $interbreadcrumb[] = array( |
|
24 | 24 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
25 | 25 | 'name' => get_lang('ToolGradebook') |
26 | 26 | ); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | ); |
77 | 77 | if (api_get_setting('allow_course_theme') === 'true') { |
78 | 78 | $mycourselptheme = api_get_course_setting('allow_learning_path_theme'); |
79 | - if (!empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1) { |
|
79 | + if (!empty($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) { |
|
80 | 80 | //LP theme picker |
81 | 81 | $theme_select = $form->addElement('SelectTheme', 'lp_theme', get_lang('Theme')); |
82 | 82 | $form->applyFilter('lp_theme', 'trim'); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $label = ($_SESSION['oLP']->get_preview_image() != '' ? get_lang('UpdateImage') : get_lang('AddImage')); |
106 | 106 | $form->addElement('file', 'lp_preview_image', array($label, get_lang('ImageWillResizeMsg'))); |
107 | 107 | |
108 | -$form->addRule('lp_preview_image', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif')); |
|
108 | +$form->addRule('lp_preview_image', get_lang('OnlyImagesAllowed'), 'filetype', array('jpg', 'jpeg', 'png', 'gif')); |
|
109 | 109 | |
110 | 110 | // Search terms (only if search is activated). |
111 | 111 | if (api_get_setting('search_enabled') === 'true') { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $defaults['lp_author'] = Security::remove_XSS($_SESSION['oLP']->get_author()); |
135 | 135 | $defaults['hide_toc_frame'] = Security::remove_XSS($_SESSION['oLP']->get_hide_toc_frame()); |
136 | 136 | $defaults['category_id'] = intval($_SESSION['oLP']->getCategoryId()); |
137 | -$defaults['accumulate_scorm_time'] = $_SESSION['oLP']->getAccumulateScormTime(); |
|
137 | +$defaults['accumulate_scorm_time'] = $_SESSION['oLP']->getAccumulateScormTime(); |
|
138 | 138 | |
139 | 139 | $expired_on = $_SESSION['oLP']->expired_on; |
140 | 140 | $publicated_on = $_SESSION['oLP']->publicated_on; |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | if ($enableLpExtraFields) { |
215 | 215 | $htmlHeadXtra[] = '<script> |
216 | 216 | $(function() { |
217 | - ' . $extra['jquery_ready_content'] . ' |
|
217 | + ' . $extra['jquery_ready_content'].' |
|
218 | 218 | }); |
219 | 219 | </script>'; |
220 | 220 | } |
221 | 221 | |
222 | 222 | |
223 | 223 | $defaults['publicated_on'] = !empty($publicated_on) && $publicated_on !== '0000-00-00 00:00:00' ? api_get_local_time($publicated_on) : null; |
224 | -$defaults['expired_on'] = (!empty($expired_on) )? api_get_local_time($expired_on): date('Y-m-d 12:00:00', time()+84600); |
|
224 | +$defaults['expired_on'] = (!empty($expired_on)) ? api_get_local_time($expired_on) : date('Y-m-d 12:00:00', time() + 84600); |
|
225 | 225 | $defaults['subscribe_users'] = $_SESSION['oLP']->getSubscribeUsers(); |
226 | 226 | $form->setDefaults($defaults); |
227 | 227 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | if (isset($_POST['submit'])) { |
33 | 33 | $id = aiken_import_file($_FILES['userFile']); |
34 | 34 | if (is_numeric($id) && !empty($id)) { |
35 | - header('Location: admin.php?' . api_get_cidreq() . '&exerciseId=' . $id); |
|
35 | + header('Location: admin.php?'.api_get_cidreq().'&exerciseId='.$id); |
|
36 | 36 | exit; |
37 | 37 | } |
38 | 38 | } |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | $tool_name = get_lang('Search'); |
20 | 20 | $interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNetwork')); |
21 | 21 | |
22 | -$query = isset($_GET['q']) ? Security::remove_XSS($_GET['q']): null; |
|
23 | -$query_search_type = isset($_GET['search_type']) && in_array($_GET['search_type'], array('0','1','2')) ? $_GET['search_type'] : null; |
|
22 | +$query = isset($_GET['q']) ? Security::remove_XSS($_GET['q']) : null; |
|
23 | +$query_search_type = isset($_GET['search_type']) && in_array($_GET['search_type'], array('0', '1', '2')) ? $_GET['search_type'] : null; |
|
24 | 24 | $extra_fields = UserManager::get_extra_filtrable_fields(); |
25 | 25 | $query_vars = array('q' => $query, 'search_type' => $query_search_type); |
26 | 26 | if (!empty($extra_fields)) { |
27 | 27 | foreach ($extra_fields as $extra_field) { |
28 | - $field_name = 'field_' . $extra_field['variable']; |
|
28 | + $field_name = 'field_'.$extra_field['variable']; |
|
29 | 29 | if (isset($_GET[$field_name]) && $_GET[$field_name] != '0') { |
30 | 30 | $query_vars[$field_name] = $_GET[$field_name]; |
31 | 31 | } |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | $usergroup = new UserGroup(); |
46 | 46 | |
47 | 47 | // I'm searching something |
48 | -if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) ) { |
|
48 | +if ($query != '' || ($query_vars['search_type'] == '1' && count($query_vars) > 2)) { |
|
49 | 49 | $itemPerPage = 8; |
50 | 50 | |
51 | - if ($_GET['search_type']=='0' || $_GET['search_type']=='1') { |
|
51 | + if ($_GET['search_type'] == '0' || $_GET['search_type'] == '1') { |
|
52 | 52 | $page = isset($_GET['users_page_nr']) ? intval($_GET['users_page_nr']) : 1; |
53 | 53 | $totalUsers = UserManager::get_all_user_tags($_GET['q'], 0, 0, $itemPerPage, true); |
54 | 54 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $users = UserManager::get_all_user_tags($_GET['q'], 0, $from, $itemPerPage); |
58 | 58 | } |
59 | 59 | |
60 | - if ($_GET['search_type']=='0' || $_GET['search_type']=='2') { |
|
60 | + if ($_GET['search_type'] == '0' || $_GET['search_type'] == '2') { |
|
61 | 61 | $pageGroup = isset($_GET['groups_page_nr']) ? intval($_GET['groups_page_nr']) : 1; |
62 | 62 | // Groups |
63 | 63 | $fromGroups = intval(($pageGroup - 1) * $itemPerPage); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | // Show send invitation icon if they are not friends yet |
85 | 85 | if ($relation_type != 3 && $relation_type != 4 && $user_info['user_id'] != api_get_user_id()) { |
86 | - $sendInvitation = '<a href="#" class="'.$buttonClass.' btn-to-send-invitation" data-send-to="' . $user_info['user_id'] . '"> |
|
86 | + $sendInvitation = '<a href="#" class="'.$buttonClass.' btn-to-send-invitation" data-send-to="'.$user_info['user_id'].'"> |
|
87 | 87 | <em class="fa fa-user"></em> '.get_lang('SendInvitation').'</a>'; |
88 | 88 | } |
89 | 89 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | </div> |
130 | 130 | <div class="user-info"> |
131 | 131 | <p>'.$user_info['complete_name'].'</p> |
132 | - <div class="items-user-status">' . $status_icon . $user_icon . '</div> |
|
132 | + <div class="items-user-status">' . $status_icon.$user_icon.'</div> |
|
133 | 133 | <div class="toolbar"> |
134 | 134 | '.$invitations.' |
135 | 135 | </div> |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $tags = null; |
187 | 187 | $group['picture'] = '<img class="img-responsive img-circle" src="'.$picture['file'].'" />'; |
188 | 188 | |
189 | - $members = Display::returnFontAwesomeIcon('user') . '( ' .$count_users_group . ' )'; |
|
189 | + $members = Display::returnFontAwesomeIcon('user').'( '.$count_users_group.' )'; |
|
190 | 190 | $item_1 = Display::tag('p', $url_open.$name.$url_close); |
191 | 191 | |
192 | 192 | $block_groups .= ' |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | </div> |
198 | 198 | <div class="user-info"> |
199 | 199 | '.$item_1.' |
200 | - <p>' . $members . '</p> |
|
201 | - <p>' . $group['description'] . '</p> |
|
202 | - <p>' . $tags . '</p> |
|
203 | - <p>' . $url_open.get_lang('SeeMore') . $url_close . '</p> |
|
200 | + <p>' . $members.'</p> |
|
201 | + <p>' . $group['description'].'</p> |
|
202 | + <p>' . $tags.'</p> |
|
203 | + <p>' . $url_open.get_lang('SeeMore').$url_close.'</p> |
|
204 | 204 | </div> |
205 | 205 | </div> |
206 | 206 | </div>'; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $tpl->assign('social_search', $block_search); |
241 | 241 | $tpl->assign('search_form', $searchForm); |
242 | 242 | |
243 | -$formModalTpl = new Template(); |
|
243 | +$formModalTpl = new Template(); |
|
244 | 244 | $formModalTpl->assign('invitation_form', MessageManager::generate_invitation_form('send_invitation')); |
245 | 245 | $formModals = $formModalTpl->fetch('default/social/form_modals.tpl'); |
246 | 246 |
@@ -17,56 +17,56 @@ discard block |
||
17 | 17 | $message = ''; |
18 | 18 | |
19 | 19 | if (isset($_POST['activeExtension'])) { |
20 | - switch ($_POST['extension_code']) { |
|
21 | - case 'ppt2lp': |
|
22 | - $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
20 | + switch ($_POST['extension_code']) { |
|
21 | + case 'ppt2lp': |
|
22 | + $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
23 | 23 | selected_value="true" |
24 | 24 | WHERE variable="service_ppt2lp" |
25 | 25 | AND subkey="active"'; |
26 | 26 | |
27 | - $rs = Database::query($sql); |
|
27 | + $rs = Database::query($sql); |
|
28 | 28 | |
29 | - if (Database::affected_rows($rs)>0){ |
|
30 | - $message = get_lang('ServiceActivated'); |
|
31 | - } |
|
29 | + if (Database::affected_rows($rs)>0){ |
|
30 | + $message = get_lang('ServiceActivated'); |
|
31 | + } |
|
32 | 32 | |
33 | - $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
33 | + $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
34 | 34 | selected_value="'.addslashes($_POST['host']).'" |
35 | 35 | WHERE variable="service_ppt2lp" |
36 | 36 | AND subkey="host"'; |
37 | - Database::query($sql); |
|
37 | + Database::query($sql); |
|
38 | 38 | |
39 | - $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
39 | + $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
40 | 40 | selected_value="'.addslashes($_POST['port']).'" |
41 | 41 | WHERE variable="service_ppt2lp" |
42 | 42 | AND subkey="port"'; |
43 | - Database::query($sql); |
|
43 | + Database::query($sql); |
|
44 | 44 | |
45 | - $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
45 | + $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
46 | 46 | selected_value="'.addslashes($_POST['ftp_password']).'" |
47 | 47 | WHERE variable="service_ppt2lp" |
48 | 48 | AND subkey="ftp_password"'; |
49 | - Database::query($sql); |
|
49 | + Database::query($sql); |
|
50 | 50 | |
51 | - $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
51 | + $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
52 | 52 | selected_value="'.addslashes($_POST['user']).'" |
53 | 53 | WHERE variable="service_ppt2lp" |
54 | 54 | AND subkey="user"'; |
55 | - Database::query($sql); |
|
55 | + Database::query($sql); |
|
56 | 56 | |
57 | - $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
57 | + $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
58 | 58 | selected_value="'.addslashes($_POST['path_to_lzx']).'" |
59 | 59 | WHERE variable="service_ppt2lp" |
60 | 60 | AND subkey="path_to_lzx"'; |
61 | - Database::query($sql); |
|
61 | + Database::query($sql); |
|
62 | 62 | |
63 | - $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
63 | + $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
64 | 64 | selected_value="'.addslashes($_POST['size']).'" |
65 | 65 | WHERE variable="service_ppt2lp" |
66 | 66 | AND subkey="size"'; |
67 | - Database::query($sql); |
|
68 | - break; |
|
69 | - } |
|
67 | + Database::query($sql); |
|
68 | + break; |
|
69 | + } |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | $listActiveServices = array(); |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | |
78 | 78 | $rs = Database::query($sql); |
79 | 79 | while($row = Database::fetch_array($rs)){ |
80 | - $listActiveServices[] = $row['variable']; |
|
80 | + $listActiveServices[] = $row['variable']; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | // javascript to handle accordion behaviour |
84 | 84 | $javascript_message = ''; |
85 | 85 | if(!empty($message)){ |
86 | - $javascript_message = ' |
|
86 | + $javascript_message = ' |
|
87 | 87 | document.getElementById("message").style.display = "block"; |
88 | 88 | var timer = setTimeout(hideMessage, 5000);'; |
89 | 89 | } |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | ?> |
136 | 136 | <div id="message" style="display: none"> |
137 | 137 | <?php |
138 | - if(!empty($message)) |
|
139 | - Display::display_normal_message($message) |
|
140 | - ?> |
|
138 | + if(!empty($message)) |
|
139 | + Display::display_normal_message($message) |
|
140 | + ?> |
|
141 | 141 | </div> |
142 | 142 | |
143 | 143 | <div id="content" align="center"> |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | </div> |
201 | 201 | </div> |
202 | 202 | <?php |
203 | - /* |
|
203 | + /* |
|
204 | 204 | <!-- EPHORUS --> |
205 | 205 | <div id="main_ephorus"> |
206 | 206 | <div id="extension_header_ephorus" class="accordion_header"> |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | $rs = Database::query($sql); |
28 | 28 | |
29 | - if (Database::affected_rows($rs)>0){ |
|
29 | + if (Database::affected_rows($rs) > 0) { |
|
30 | 30 | $message = get_lang('ServiceActivated'); |
31 | 31 | } |
32 | 32 | |
@@ -76,18 +76,18 @@ discard block |
||
76 | 76 | WHERE variable LIKE "service_%" AND subkey="active" and selected_value="true"'; |
77 | 77 | |
78 | 78 | $rs = Database::query($sql); |
79 | -while($row = Database::fetch_array($rs)){ |
|
79 | +while ($row = Database::fetch_array($rs)) { |
|
80 | 80 | $listActiveServices[] = $row['variable']; |
81 | 81 | } |
82 | 82 | |
83 | 83 | // javascript to handle accordion behaviour |
84 | 84 | $javascript_message = ''; |
85 | -if(!empty($message)){ |
|
85 | +if (!empty($message)) { |
|
86 | 86 | $javascript_message = ' |
87 | 87 | document.getElementById("message").style.display = "block"; |
88 | 88 | var timer = setTimeout(hideMessage, 5000);'; |
89 | 89 | } |
90 | -$htmlHeadXtra[]= '<script> |
|
90 | +$htmlHeadXtra[] = '<script> |
|
91 | 91 | var listeDiv; |
92 | 92 | var extensionsHeader = new Array(); |
93 | 93 | var extensionsContent = new Array(); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | ?> |
136 | 136 | <div id="message" style="display: none"> |
137 | 137 | <?php |
138 | - if(!empty($message)) |
|
138 | + if (!empty($message)) |
|
139 | 139 | Display::display_normal_message($message) |
140 | 140 | ?> |
141 | 141 | </div> |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | ?> |
136 | 136 | <div id="message" style="display: none"> |
137 | 137 | <?php |
138 | - if(!empty($message)) |
|
139 | - Display::display_normal_message($message) |
|
138 | + if(!empty($message)) { |
|
139 | + Display::display_normal_message($message) |
|
140 | 140 | ?> |
141 | 141 | </div> |
142 | 142 | |
@@ -150,7 +150,9 @@ discard block |
||
150 | 150 | </div> |
151 | 151 | <div class="row"> |
152 | 152 | <div class="col-md-5"> |
153 | - <?php Display::display_icon('screenshot_ppt2lp.jpg', get_lang('Ppt2lp'), array('class'=>'img-responsive')); ?> |
|
153 | + <?php Display::display_icon('screenshot_ppt2lp.jpg', get_lang('Ppt2lp'), array('class'=>'img-responsive')); |
|
154 | + } |
|
155 | + ?> |
|
154 | 156 | </div> |
155 | 157 | <div class="col-md-7"> |
156 | 158 | <form method="POST" class="form-horizontal" action="<?php echo api_get_self(); ?>"> |