@@ -29,8 +29,9 @@ discard block |
||
29 | 29 | public function get_not_created_links() |
30 | 30 | { |
31 | 31 | return false; |
32 | - if (empty($this->course_code)) |
|
33 | - die('Error in get_not_created_links() : course code not set'); |
|
32 | + if (empty($this->course_code)) { |
|
33 | + die('Error in get_not_created_links() : course code not set'); |
|
34 | + } |
|
34 | 35 | |
35 | 36 | $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
36 | 37 | |
@@ -57,8 +58,9 @@ discard block |
||
57 | 58 | */ |
58 | 59 | public function get_all_links() |
59 | 60 | { |
60 | - if (empty($this->course_code)) |
|
61 | - die('Error in get_not_created_links() : course code not set'); |
|
61 | + if (empty($this->course_code)) { |
|
62 | + die('Error in get_not_created_links() : course code not set'); |
|
63 | + } |
|
62 | 64 | |
63 | 65 | $session_id = api_get_session_id(); |
64 | 66 | if (empty($session_id)) { |
@@ -111,8 +113,9 @@ discard block |
||
111 | 113 | lp_id = ".$this->get_ref_id()." AND |
112 | 114 | session_id = $session_id "; |
113 | 115 | |
114 | - if (isset($stud_id)) |
|
115 | - $sql .= ' AND user_id = '.intval($stud_id); |
|
116 | + if (isset($stud_id)) { |
|
117 | + $sql .= ' AND user_id = '.intval($stud_id); |
|
118 | + } |
|
116 | 119 | |
117 | 120 | // order by id, that way the student's first attempt is accessed first |
118 | 121 | $sql .= ' ORDER BY view_count DESC'; |
@@ -122,8 +125,9 @@ discard block |
||
122 | 125 | if (isset($stud_id)) { |
123 | 126 | if ($data = Database::fetch_assoc($scores)) { |
124 | 127 | return array ($data['progress'], 100); |
125 | - } else |
|
126 | - return null; |
|
128 | + } else { |
|
129 | + return null; |
|
130 | + } |
|
127 | 131 | } else { |
128 | 132 | // all students -> get average |
129 | 133 | $students = array(); // user list, needed to make sure we only |
@@ -231,36 +231,51 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | if (isset($user_id)) { |
234 | - if ($paramcount != 0) $sql .= ' AND'; |
|
235 | - else $sql .= ' WHERE'; |
|
234 | + if ($paramcount != 0) { |
|
235 | + $sql .= ' AND'; |
|
236 | + } else { |
|
237 | + $sql .= ' WHERE'; |
|
238 | + } |
|
236 | 239 | $sql .= ' user_id = '.intval($user_id); |
237 | 240 | $paramcount ++; |
238 | 241 | } |
239 | 242 | |
240 | 243 | if (isset($course_code) && $course_code <> '-1') { |
241 | - if ($paramcount != 0) $sql .= ' AND'; |
|
242 | - else $sql .= ' WHERE'; |
|
244 | + if ($paramcount != 0) { |
|
245 | + $sql .= ' AND'; |
|
246 | + } else { |
|
247 | + $sql .= ' WHERE'; |
|
248 | + } |
|
243 | 249 | $sql .= " course_code = '".Database::escape_string($course_code)."'"; |
244 | 250 | $paramcount ++; |
245 | 251 | } |
246 | 252 | |
247 | 253 | if (isset($category_id)) { |
248 | - if ($paramcount != 0) $sql .= ' AND'; |
|
249 | - else $sql .= ' WHERE'; |
|
254 | + if ($paramcount != 0) { |
|
255 | + $sql .= ' AND'; |
|
256 | + } else { |
|
257 | + $sql .= ' WHERE'; |
|
258 | + } |
|
250 | 259 | $sql .= ' category_id = '.intval($category_id); |
251 | 260 | $paramcount ++; |
252 | 261 | } |
253 | 262 | |
254 | 263 | if (isset($visible)) { |
255 | - if ($paramcount != 0) $sql .= ' AND'; |
|
256 | - else $sql .= ' WHERE'; |
|
264 | + if ($paramcount != 0) { |
|
265 | + $sql .= ' AND'; |
|
266 | + } else { |
|
267 | + $sql .= ' WHERE'; |
|
268 | + } |
|
257 | 269 | $sql .= ' visible = '.intval($visible); |
258 | 270 | $paramcount ++; |
259 | 271 | } |
260 | 272 | |
261 | 273 | if (isset($locked)) { |
262 | - if ($paramcount != 0) $sql .= ' AND'; |
|
263 | - else $sql .= ' WHERE'; |
|
274 | + if ($paramcount != 0) { |
|
275 | + $sql .= ' AND'; |
|
276 | + } else { |
|
277 | + $sql .= ' WHERE'; |
|
278 | + } |
|
264 | 279 | $sql .= ' locked = '.intval($locked); |
265 | 280 | } |
266 | 281 | |
@@ -398,7 +413,7 @@ discard block |
||
398 | 413 | .', description = '; |
399 | 414 | if (isset($this->description)) { |
400 | 415 | $sql .= "'".Database::escape_string($this->get_description())."'"; |
401 | - }else { |
|
416 | + } else { |
|
402 | 417 | $sql .= 'null'; |
403 | 418 | } |
404 | 419 | $sql .= ', user_id = '.intval($this->get_user_id()) |
@@ -469,7 +484,7 @@ discard block |
||
469 | 484 | $sql .= ' AND user_id = '.api_get_user_id(); |
470 | 485 | } |
471 | 486 | |
472 | - }else { |
|
487 | + } else { |
|
473 | 488 | $sql .= ' AND user_id = '.api_get_user_id(); |
474 | 489 | } |
475 | 490 |
@@ -173,7 +173,10 @@ |
||
173 | 173 | echo '<div id="advancedSearch" style="display: none">'. get_lang('SearchSessions'); ?> : |
174 | 174 | <input name="SearchSession" onchange = "xajax_search_usergroup_sessions(this.value,'searchbox')" onkeyup="this.onchange()"> |
175 | 175 | </div> |
176 | -<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
176 | +<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) { |
|
177 | + echo '&add=true' ; |
|
178 | +} |
|
179 | +?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
177 | 180 | <?php |
178 | 181 | echo '<legend>'.$data['name'].': '.$tool_name.'</legend>'; |
179 | 182 | echo Display::input('hidden','id',$id); |
@@ -96,13 +96,14 @@ |
||
96 | 96 | |
97 | 97 | $is_certificate_mode = DocumentManager::is_certificate_mode($dir); |
98 | 98 | |
99 | -if (!$is_certificate_mode) |
|
99 | +if (!$is_certificate_mode) { |
|
100 | 100 | $interbreadcrumb[] = array( |
101 | 101 | "url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), |
102 | 102 | "name" => get_lang('Documents'), |
103 | 103 | ); |
104 | -else |
|
104 | +} else { |
|
105 | 105 | $interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); |
106 | +} |
|
106 | 107 | |
107 | 108 | // Interbreadcrumb for the current directory root path |
108 | 109 | if (empty($document_data['parents'])) { |
@@ -491,13 +491,19 @@ |
||
491 | 491 | $id = intval($id); |
492 | 492 | $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_FILE) ." |
493 | 493 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
494 | - if (!Database::query($sql)) return false; |
|
494 | + if (!Database::query($sql)) { |
|
495 | + return false; |
|
496 | + } |
|
495 | 497 | $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." |
496 | 498 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
497 | - if (!Database::query($sql)) return false; |
|
499 | + if (!Database::query($sql)) { |
|
500 | + return false; |
|
501 | + } |
|
498 | 502 | $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_POST)." |
499 | 503 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
500 | - if (!Database::query($sql)) return false; |
|
504 | + if (!Database::query($sql)) { |
|
505 | + return false; |
|
506 | + } |
|
501 | 507 | return true; |
502 | 508 | } |
503 | 509 |
@@ -483,7 +483,10 @@ discard block |
||
483 | 483 | <div class="actions"> |
484 | 484 | <?php echo $link_add_type_unique ?> | <?php echo $link_add_type_multiple ?> | <?php echo $link_add_group; ?> |
485 | 485 | </div> |
486 | - <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
486 | + <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if(!empty($_GET['add'])) { |
|
487 | + echo '&add=true' ; |
|
488 | +} |
|
489 | +?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
487 | 490 | <?php echo '<legend>'.$tool_name.' (' . $session->getName() . ') </legend>'; ?> |
488 | 491 | <?php |
489 | 492 | if ($add_type === 'multiple') { |
@@ -544,7 +547,10 @@ discard block |
||
544 | 547 | <?php |
545 | 548 | foreach ($nosessionUsersList as $uid => $enreg) { |
546 | 549 | ?> |
547 | - <option value="<?php echo $uid; ?>" <?php if(in_array($uid,$UserList)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; ?></option> |
|
550 | + <option value="<?php echo $uid; ?>" <?php if(in_array($uid,$UserList)) { |
|
551 | + echo 'selected="selected"'; |
|
552 | +} |
|
553 | +?>><?php echo api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; ?></option> |
|
548 | 554 | <?php |
549 | 555 | } |
550 | 556 | ?> |
@@ -1203,10 +1203,11 @@ |
||
1203 | 1203 | $result_last_attempt = Database::query($sql); |
1204 | 1204 | if (Database :: num_rows($result_last_attempt) > 0) { |
1205 | 1205 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
1206 | - if ($count_attempts > 0) |
|
1207 | - echo '<a href="../exercise/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'"> |
|
1206 | + if ($count_attempts > 0) { |
|
1207 | + echo '<a href="../exercise/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'"> |
|
1208 | 1208 | '.Display::return_icon('quiz.png').' |
1209 | 1209 | </a>'; |
1210 | + } |
|
1210 | 1211 | } |
1211 | 1212 | echo '</td>'; |
1212 | 1213 |
@@ -1893,7 +1893,7 @@ discard block |
||
1893 | 1893 | $email_body = get_lang('DearUser').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).',<br /><br />'; |
1894 | 1894 | if($session_id==0){ |
1895 | 1895 | $email_body .= $emailtext.' <strong>'.$_course['name'].' - '.$group_name.'</strong><br /><br /><br />'; |
1896 | - }else{ |
|
1896 | + } else{ |
|
1897 | 1897 | $email_body .= $emailtext.' <strong>'.$_course['name'].' ('.api_get_session_name(api_get_session_id()).') - '.$group_name.'</strong><br /><br /><br />'; |
1898 | 1898 | } |
1899 | 1899 | $email_body .= $email_user_author.' ('.$email_date_changes.')<br /><br /><br />'; |
@@ -2283,8 +2283,7 @@ discard block |
||
2283 | 2283 | s1.reflink = s2.reflink AND |
2284 | 2284 | ".$groupfilter.$condition_session.")"; |
2285 | 2285 | // warning don't use group by reflink because don't return the last version |
2286 | - } |
|
2287 | - else { |
|
2286 | + } else { |
|
2288 | 2287 | $sql = " SELECT * FROM ".$tbl_wiki." s1 |
2289 | 2288 | WHERE |
2290 | 2289 | s1.c_id = $course_id AND |
@@ -3726,8 +3725,7 @@ discard block |
||
3726 | 3725 | '.api_htmlentities($obj->title).'</a>'; |
3727 | 3726 | if ($userinfo !== false) { |
3728 | 3727 | $row[] = UserManager::getUserProfileLink($userinfo); |
3729 | - } |
|
3730 | - else { |
|
3728 | + } else { |
|
3731 | 3729 | $row[] = get_lang('Anonymous').' ('.api_htmlentities($obj->user_ip).')'; |
3732 | 3730 | } |
3733 | 3731 | $row[] = api_get_local_time($obj->dtime, null, date_default_timezone_get()); |
@@ -3962,8 +3960,7 @@ discard block |
||
3962 | 3960 | api_htmlentities($obj->title).'</a>'; |
3963 | 3961 | if ($userinfo !== false) { |
3964 | 3962 | $row[] = UserManager::getUserProfileLink($userinfo); |
3965 | - } |
|
3966 | - else { |
|
3963 | + } else { |
|
3967 | 3964 | $row[] = get_lang('Anonymous').' ('.$obj->user_ip.')'; |
3968 | 3965 | } |
3969 | 3966 | $row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds; |
@@ -123,8 +123,9 @@ discard block |
||
123 | 123 | $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id()); |
124 | 124 | $my_session_list = array(); |
125 | 125 | foreach($new_session_list as $item) { |
126 | - if (!empty($item['id_session'])) |
|
127 | - $my_session_list[] = $item['id_session']; |
|
126 | + if (!empty($item['id_session'])) { |
|
127 | + $my_session_list[] = $item['id_session']; |
|
128 | + } |
|
128 | 129 | } |
129 | 130 | if (!in_array($session_id, $my_session_list)) { |
130 | 131 | break; |
@@ -255,8 +256,9 @@ discard block |
||
255 | 256 | $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id()); |
256 | 257 | $my_session_list = array(); |
257 | 258 | foreach($new_session_list as $item) { |
258 | - if (!empty($item['id_session'])) |
|
259 | - $my_session_list[] = $item['id_session']; |
|
259 | + if (!empty($item['id_session'])) { |
|
260 | + $my_session_list[] = $item['id_session']; |
|
261 | + } |
|
260 | 262 | } |
261 | 263 | if (!in_array($session_id, $my_session_list)) { |
262 | 264 | break; |
@@ -399,8 +401,9 @@ discard block |
||
399 | 401 | $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id()); |
400 | 402 | $my_session_list = array(); |
401 | 403 | foreach($new_session_list as $item) { |
402 | - if (!empty($item['id_session'])) |
|
403 | - $my_session_list[] = $item['id_session']; |
|
404 | + if (!empty($item['id_session'])) { |
|
405 | + $my_session_list[] = $item['id_session']; |
|
406 | + } |
|
404 | 407 | } |
405 | 408 | if (!in_array($session_id, $my_session_list)) { |
406 | 409 | break; |