@@ -84,15 +84,18 @@ |
||
84 | 84 | //echo do something to logout |
85 | 85 | } |
86 | 86 | |
87 | -function validate_user($user, $pass) { |
|
87 | +function validate_user($user, $pass) |
|
88 | +{ |
|
88 | 89 | return true; |
89 | 90 | } |
90 | -function filter_xss($val) { |
|
91 | +function filter_xss($val) |
|
92 | +{ |
|
91 | 93 | //do some cleaning |
92 | 94 | return $val; |
93 | 95 | } |
94 | 96 | |
95 | -function chamilo_sso_protocol() { |
|
97 | +function chamilo_sso_protocol() |
|
98 | +{ |
|
96 | 99 | //get the sso_protocol from chamilo using webservices |
97 | 100 | return 'http://'; |
98 | 101 | } |
@@ -19,8 +19,7 @@ |
||
19 | 19 | |
20 | 20 | $ldap_login_success = ldap_login($login, $password); |
21 | 21 | |
22 | -if ($ldap_login_success) |
|
23 | -{ |
|
22 | +if ($ldap_login_success) { |
|
24 | 23 | //error_log('Found user '.$login.' on LDAP server',0); |
25 | 24 | /* |
26 | 25 | In here, we know that |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | require_once __DIR__.'/../inc/global.inc.php'; |
15 | 15 | require_once api_get_path(SYS_PATH).'main/auth/cas/authcas.php'; |
16 | 16 | $msg = null; |
17 | -if (isset($_GET['firstpage'])) { |
|
17 | +if (isset($_GET['firstpage'])) { |
|
18 | 18 | $firstpage = $_GET['firstpage']; |
19 | 19 | |
20 | 20 | // if course is public, go to course without auth |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ); |
42 | 42 | $form->addButtonNext(get_lang('LoginEnter'), 'submitAuth'); |
43 | 43 | // see same text in main_api.lib.php function api_not_allowed |
44 | - if (api_is_cas_activated()) { |
|
44 | + if (api_is_cas_activated()) { |
|
45 | 45 | $msg .= Display::return_message(sprintf(get_lang('YouHaveAnInstitutionalAccount'), api_get_setting("Institution")), '', false); |
46 | 46 | $msg .= Display::div("<br/><a href='".get_cas_direct_URL(api_get_course_id())."'>".getCASLogoHTML()." ".sprintf(get_lang('LoginWithYourAccount'), api_get_setting("Institution"))."</a><br/><br/>", array('align'=>'center')); |
47 | 47 | $msg .= Display::return_message(get_lang('YouDontHaveAnInstitutionAccount')); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $msg .= '<div class="well_login">'; |
53 | 53 | $msg .= $form->return_form(); |
54 | 54 | $msg .= '</div>'; |
55 | - if (api_is_cas_activated()) { |
|
55 | + if (api_is_cas_activated()) { |
|
56 | 56 | $msg .= "</div>"; |
57 | 57 | } |
58 | 58 | $msg .= '<hr/><p style="text-align:center"><a href="'.api_get_path(WEB_PATH).'">'.get_lang('ReturnToCourseHomepage').'</a></p>'; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $tpl->assign('content', '<h4>'.get_lang('LoginToGoToThisCourse').'</h4>'.$msg); |
61 | 61 | $tpl->display_one_col_template(); |
62 | 62 | |
63 | -} else { |
|
63 | +} else { |
|
64 | 64 | api_delete_firstpage_parameter(); |
65 | 65 | header('Location: '.api_get_path(WEB_PATH).'index.php'); |
66 | 66 | exit; |
@@ -45,8 +45,9 @@ discard block |
||
45 | 45 | } |
46 | 46 | break; |
47 | 47 | case "stackgetall": |
48 | - if (storage_can_set($_REQUEST['svuser'])) |
|
49 | - print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
48 | + if (storage_can_set($_REQUEST['svuser'])) { |
|
49 | + print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
50 | + } |
|
50 | 51 | break; |
51 | 52 | case "getposition": |
52 | 53 | print storage_get_position($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc']); |
@@ -63,7 +64,8 @@ discard block |
||
63 | 64 | // Do nothing |
64 | 65 | } |
65 | 66 | |
66 | -function storage_can_set($sv_user) { |
|
67 | +function storage_can_set($sv_user) |
|
68 | +{ |
|
67 | 69 | // platform admin can change any user's stored values, other users can only change their own values |
68 | 70 | $allowed = ((api_is_platform_admin()) || ($sv_user == api_get_user_id())); |
69 | 71 | if (!$allowed) { |
@@ -72,7 +74,8 @@ discard block |
||
72 | 74 | return $allowed; |
73 | 75 | } |
74 | 76 | |
75 | -function storage_get($sv_user, $sv_course, $sv_sco, $sv_key) { |
|
77 | +function storage_get($sv_user, $sv_course, $sv_sco, $sv_key) |
|
78 | +{ |
|
76 | 79 | $sql = "select sv_value |
77 | 80 | from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." |
78 | 81 | where user_id= '$sv_user' |
@@ -87,13 +90,13 @@ discard block |
||
87 | 90 | } else { |
88 | 91 | return $row['sv_value']; |
89 | 92 | } |
90 | - } |
|
91 | - else { |
|
93 | + } else { |
|
92 | 94 | return null; |
93 | 95 | } |
94 | 96 | } |
95 | 97 | |
96 | -function storage_get_leaders($sv_user, $sv_course, $sv_sco, $sv_key, $sv_asc, $sv_length) { |
|
98 | +function storage_get_leaders($sv_user, $sv_course, $sv_sco, $sv_key, $sv_asc, $sv_length) |
|
99 | +{ |
|
97 | 100 | |
98 | 101 | // get leaders |
99 | 102 | $sql_leaders = "select u.user_id, firstname, lastname, email, username, sv_value as value |
@@ -127,7 +130,8 @@ discard block |
||
127 | 130 | return json_encode($result); |
128 | 131 | } |
129 | 132 | |
130 | -function storage_get_position($sv_user, $sv_course, $sv_sco, $sv_key, $sv_asc, $sv_length) { |
|
133 | +function storage_get_position($sv_user, $sv_course, $sv_sco, $sv_key, $sv_asc, $sv_length) |
|
134 | +{ |
|
131 | 135 | $sql = "select count(list.user_id) as position |
132 | 136 | from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." search, |
133 | 137 | ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." list |
@@ -144,13 +148,13 @@ discard block |
||
144 | 148 | if (Database::num_rows($res) > 0) { |
145 | 149 | $row = Database::fetch_assoc($res); |
146 | 150 | return $row['position']; |
147 | - } |
|
148 | - else { |
|
151 | + } else { |
|
149 | 152 | return null; |
150 | 153 | } |
151 | 154 | } |
152 | 155 | |
153 | -function storage_set($sv_user, $sv_course, $sv_sco, $sv_key, $sv_value) { |
|
156 | +function storage_set($sv_user, $sv_course, $sv_sco, $sv_key, $sv_value) |
|
157 | +{ |
|
154 | 158 | $sv_value = Database::escape_string($sv_value); |
155 | 159 | $sql = "replace into ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." |
156 | 160 | (user_id, sco_id, course_id, sv_key, sv_value) |
@@ -160,7 +164,8 @@ discard block |
||
160 | 164 | return Database::affected_rows($res); |
161 | 165 | } |
162 | 166 | |
163 | -function storage_getall($sv_user, $sv_course, $sv_sco) { |
|
167 | +function storage_getall($sv_user, $sv_course, $sv_sco) |
|
168 | +{ |
|
164 | 169 | $sql = "select sv_key, sv_value |
165 | 170 | from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." |
166 | 171 | where user_id= '$sv_user' |
@@ -177,7 +182,8 @@ discard block |
||
177 | 182 | return json_encode($data); |
178 | 183 | } |
179 | 184 | |
180 | -function storage_stack_push($sv_user, $sv_course, $sv_sco, $sv_key, $sv_value) { |
|
185 | +function storage_stack_push($sv_user, $sv_course, $sv_sco, $sv_key, $sv_value) |
|
186 | +{ |
|
181 | 187 | $sv_value = Database::escape_string($sv_value); |
182 | 188 | Database::query("start transaction"); |
183 | 189 | $sqlorder = "select ifnull((select max(stack_order) |
@@ -198,14 +204,14 @@ discard block |
||
198 | 204 | if ($resorder && $resinsert) { |
199 | 205 | Database::query("commit"); |
200 | 206 | return 1; |
201 | - } |
|
202 | - else { |
|
207 | + } else { |
|
203 | 208 | Database::query("rollback"); |
204 | 209 | return 0; |
205 | 210 | } |
206 | 211 | } |
207 | 212 | |
208 | -function storage_stack_pop($sv_user, $sv_course, $sv_sco, $sv_key) { |
|
213 | +function storage_stack_pop($sv_user, $sv_course, $sv_sco, $sv_key) |
|
214 | +{ |
|
209 | 215 | Database::query("start transaction"); |
210 | 216 | $sqlselect = "select sv_value, stack_order |
211 | 217 | from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)." |
@@ -239,7 +245,8 @@ discard block |
||
239 | 245 | } |
240 | 246 | } |
241 | 247 | |
242 | -function storage_stack_length($sv_user, $sv_course, $sv_sco, $sv_key) { |
|
248 | +function storage_stack_length($sv_user, $sv_course, $sv_sco, $sv_key) |
|
249 | +{ |
|
243 | 250 | $sql = "select count(*) as length |
244 | 251 | from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)." |
245 | 252 | where user_id= '$sv_user' |
@@ -251,7 +258,8 @@ discard block |
||
251 | 258 | return $row['length']; |
252 | 259 | } |
253 | 260 | |
254 | -function storage_stack_clear($sv_user, $sv_course, $sv_sco, $sv_key) { |
|
261 | +function storage_stack_clear($sv_user, $sv_course, $sv_sco, $sv_key) |
|
262 | +{ |
|
255 | 263 | $sql = "delete |
256 | 264 | from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)." |
257 | 265 | where user_id= '$sv_user' |
@@ -262,7 +270,8 @@ discard block |
||
262 | 270 | return Database::num_rows($res); |
263 | 271 | } |
264 | 272 | |
265 | -function storage_stack_getall($sv_user, $sv_course, $sv_sco, $sv_key) { |
|
273 | +function storage_stack_getall($sv_user, $sv_course, $sv_sco, $sv_key) |
|
274 | +{ |
|
266 | 275 | $sql = "select stack_order as stack_order, sv_value as value |
267 | 276 | from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)." |
268 | 277 | where user_id= '$sv_user' |
@@ -280,7 +289,8 @@ discard block |
||
280 | 289 | return json_encode($results); |
281 | 290 | } |
282 | 291 | |
283 | -function storage_get_all_users() { |
|
292 | +function storage_get_all_users() |
|
293 | +{ |
|
284 | 294 | $sql = "select user_id, username, firstname, lastname |
285 | 295 | from ".Database::get_main_table(TABLE_MAIN_USER)." |
286 | 296 | order by user_id asc"; |
@@ -752,7 +752,8 @@ discard block |
||
752 | 752 | public function get_lesson_mode() |
753 | 753 | { |
754 | 754 | $mode = 'normal'; |
755 | - if ($this->get_prevent_reinit() != 0) { // If prevent_reinit == 0 |
|
755 | + if ($this->get_prevent_reinit() != 0) { |
|
756 | +// If prevent_reinit == 0 |
|
756 | 757 | $my_status = $this->get_status(); |
757 | 758 | if ($my_status != $this->possible_status[0] |
758 | 759 | && $my_status != $this->possible_status[1]) { |
@@ -2044,11 +2045,13 @@ discard block |
||
2044 | 2045 | $restart = 1; |
2045 | 2046 | $mystatus = $this->get_status(true); |
2046 | 2047 | if ($this->get_prevent_reinit() > 0 |
2047 | - ) { // If prevent_reinit == 1 (or more) |
|
2048 | + ) { |
|
2049 | +// If prevent_reinit == 1 (or more) |
|
2048 | 2050 | // If status is not attempted or incomplete, authorize retaking (of the same) anyway. Otherwise: |
2049 | 2051 | if ($mystatus != $this->possible_status[0] && $mystatus != $this->possible_status[1]) { |
2050 | 2052 | $restart = -1; |
2051 | - } else { //status incompleted or not attempted |
|
2053 | + } else { |
|
2054 | +//status incompleted or not attempted |
|
2052 | 2055 | $restart = 0; |
2053 | 2056 | } |
2054 | 2057 | } else { |
@@ -2989,7 +2992,8 @@ discard block |
||
2989 | 2992 | // Do nothing, just let the local attributes be used. |
2990 | 2993 | } |
2991 | 2994 | } |
2992 | - } else { // If not SCO, such messages should not be expected. |
|
2995 | + } else { |
|
2996 | +// If not SCO, such messages should not be expected. |
|
2993 | 2997 | $type = strtolower($this->type); |
2994 | 2998 | switch ($type) { |
2995 | 2999 | case 'asset': |
@@ -3429,8 +3433,7 @@ discard block |
||
3429 | 3433 | } |
3430 | 3434 | if ($scorm_time == '0' |
3431 | 3435 | and ($this->type != 'sco') |
3432 | - and $this->current_start_time != 0) |
|
3433 | - { |
|
3436 | + and $this->current_start_time != 0) { |
|
3434 | 3437 | $my_time = time() - $this->current_start_time; |
3435 | 3438 | if ($my_time > 0) { |
3436 | 3439 | $this->update_time($my_time); |
@@ -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 | |
@@ -607,15 +643,15 @@ discard block |
||
607 | 643 | } |
608 | 644 | break; |
609 | 645 | case 'auto_launch': |
610 | - if (api_get_course_setting('enable_lp_auto_launch') == 1) { //Redirect to a specific LP |
|
646 | + if (api_get_course_setting('enable_lp_auto_launch') == 1) { |
|
647 | +//Redirect to a specific LP |
|
611 | 648 | if (!$is_allowed_to_edit) { |
612 | 649 | api_not_allowed(true); |
613 | 650 | } |
614 | 651 | if (!$lp_found) { |
615 | 652 | error_log('New LP - No learnpath given for set_autolaunch', 0); |
616 | 653 | require 'lp_list.php'; |
617 | - } |
|
618 | - else { |
|
654 | + } else { |
|
619 | 655 | $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']); |
620 | 656 | require 'lp_list.php'; |
621 | 657 | exit; |
@@ -1128,16 +1164,24 @@ discard block |
||
1128 | 1164 | } |
1129 | 1165 | break; |
1130 | 1166 | case 'content': |
1131 | - if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0); |
|
1167 | + if ($debug > 0) { |
|
1168 | + error_log('New LP - Item id is '.intval($_GET['item_id']), 0); |
|
1169 | + } |
|
1132 | 1170 | if (!$lp_found) { |
1133 | 1171 | error_log('New LP - No learnpath given for content', 0); |
1134 | 1172 | require 'lp_list.php'; |
1135 | 1173 | } else { |
1136 | - if ($debug > 0) error_log('New LP - save_last()', 0); |
|
1174 | + if ($debug > 0) { |
|
1175 | + error_log('New LP - save_last()', 0); |
|
1176 | + } |
|
1137 | 1177 | $_SESSION['oLP']->save_last(); |
1138 | - if ($debug > 0) error_log('New LP - set_current_item()', 0); |
|
1178 | + if ($debug > 0) { |
|
1179 | + error_log('New LP - set_current_item()', 0); |
|
1180 | + } |
|
1139 | 1181 | $_SESSION['oLP']->set_current_item($_GET['item_id']); |
1140 | - if ($debug > 0) error_log('New LP - start_current_item()', 0); |
|
1182 | + if ($debug > 0) { |
|
1183 | + error_log('New LP - start_current_item()', 0); |
|
1184 | + } |
|
1141 | 1185 | $_SESSION['oLP']->start_current_item(); |
1142 | 1186 | require 'lp_content.php'; |
1143 | 1187 | } |
@@ -1253,8 +1297,7 @@ discard block |
||
1253 | 1297 | require 'lp_message.php'; |
1254 | 1298 | break; |
1255 | 1299 | case 'return_to_course_homepage': |
1256 | - if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } |
|
1257 | - else { |
|
1300 | + if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else { |
|
1258 | 1301 | $_SESSION['oLP']->save_current(); |
1259 | 1302 | $_SESSION['oLP']->save_last(); |
1260 | 1303 | $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id(); |
@@ -1442,8 +1485,10 @@ discard block |
||
1442 | 1485 | |
1443 | 1486 | if (!empty($_SESSION['oLP'])) { |
1444 | 1487 | $_SESSION['lpobject'] = serialize($_SESSION['oLP']); |
1445 | - if ($debug > 0) error_log('New LP - lpobject is serialized in session', 0); |
|
1446 | -} |
|
1488 | + if ($debug > 0) { |
|
1489 | + error_log('New LP - lpobject is serialized in session', 0); |
|
1490 | + } |
|
1491 | + } |
|
1447 | 1492 | |
1448 | 1493 | if (!empty($redirectTo)) { |
1449 | 1494 | header("Location: $redirectTo"); |
@@ -141,7 +141,8 @@ |
||
141 | 141 | echo '</div>'; |
142 | 142 | |
143 | 143 | |
144 | -function show_block($link, $title, $subtitle, $icon) { |
|
144 | +function show_block($link, $title, $subtitle, $icon) |
|
145 | +{ |
|
145 | 146 | $html = '<li class="col-md-4">'; |
146 | 147 | $html .= '<div class="thumbnail">'; |
147 | 148 | $html .= '<a href="'.$link.'" title="'.$title.'">'; |
@@ -29,8 +29,8 @@ |
||
29 | 29 | } |
30 | 30 | $mylp = learnpath::getLpFromSession(api_get_course_id(), $lp_id, $user_id); |
31 | 31 | $mylpi =& $mylp->items[$item_id]; |
32 | - if (is_array($objectives) && count($objectives)>0){ |
|
33 | - foreach ($objectives as $index=>$objective){ |
|
32 | + if (is_array($objectives) && count($objectives)>0) { |
|
33 | + foreach ($objectives as $index=>$objective) { |
|
34 | 34 | $mylpi->add_objective($index,$objectives[$index]); |
35 | 35 | } |
36 | 36 | $mylpi->write_objectives_to_db(); |
@@ -55,7 +55,8 @@ discard block |
||
55 | 55 | $lmsFinish = 0, |
56 | 56 | $userNavigatesAway = 0, |
57 | 57 | $statusSignalReceived = 0 |
58 | -) { |
|
58 | +) |
|
59 | +{ |
|
59 | 60 | //global $debug; |
60 | 61 | $debug = 0; |
61 | 62 | $return = null; |
@@ -477,7 +478,8 @@ discard block |
||
477 | 478 | if (is_array($_REQUEST['interact'])) { |
478 | 479 | foreach ($_REQUEST['interact'] as $idx => $interac) { |
479 | 480 | $interactions[$idx] = preg_split('/,/', substr($interac, 1, -1)); |
480 | - if (!isset($interactions[$idx][7])) { // Make sure there are 7 elements. |
|
481 | + if (!isset($interactions[$idx][7])) { |
|
482 | +// Make sure there are 7 elements. |
|
481 | 483 | $interactions[$idx][7] = ''; |
482 | 484 | } |
483 | 485 | } |