@@ -63,12 +63,12 @@ discard block |
||
| 63 | 63 | echo json_encode($response_data); |
| 64 | 64 | } |
| 65 | 65 | break; |
| 66 | - case 'show_course_information' : |
|
| 67 | - require_once '../global.inc.php'; |
|
| 66 | + case 'show_course_information' : |
|
| 67 | + require_once '../global.inc.php'; |
|
| 68 | 68 | |
| 69 | - // Get the name of the database course. |
|
| 70 | - $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); |
|
| 71 | - $course_info = api_get_course_info($_GET['code']); |
|
| 69 | + // Get the name of the database course. |
|
| 70 | + $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); |
|
| 71 | + $course_info = api_get_course_info($_GET['code']); |
|
| 72 | 72 | |
| 73 | 73 | if ( |
| 74 | 74 | api_get_setting('course_catalog_hide_private') === 'true' && |
@@ -78,24 +78,24 @@ discard block |
||
| 78 | 78 | break; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $sql = "SELECT * FROM $tbl_course_description |
|
| 81 | + $sql = "SELECT * FROM $tbl_course_description |
|
| 82 | 82 | WHERE c_id = ".$course_info['real_id']." AND session_id = 0 |
| 83 | 83 | ORDER BY id"; |
| 84 | - $result = Database::query($sql); |
|
| 85 | - if (Database::num_rows($result) > 0 ) { |
|
| 86 | - while ($description = Database::fetch_object($result)) { |
|
| 87 | - $descriptions[$description->id] = $description; |
|
| 88 | - } |
|
| 84 | + $result = Database::query($sql); |
|
| 85 | + if (Database::num_rows($result) > 0 ) { |
|
| 86 | + while ($description = Database::fetch_object($result)) { |
|
| 87 | + $descriptions[$description->id] = $description; |
|
| 88 | + } |
|
| 89 | 89 | // Function that displays the details of the course description in html. |
| 90 | - echo CourseManager::get_details_course_description_html( |
|
| 90 | + echo CourseManager::get_details_course_description_html( |
|
| 91 | 91 | $descriptions, |
| 92 | 92 | api_get_system_encoding(), |
| 93 | 93 | false |
| 94 | 94 | ); |
| 95 | - } else { |
|
| 96 | - echo get_lang('NoDescription'); |
|
| 97 | - } |
|
| 98 | - break; |
|
| 95 | + } else { |
|
| 96 | + echo get_lang('NoDescription'); |
|
| 97 | + } |
|
| 98 | + break; |
|
| 99 | 99 | case 'session_courses_lp_default': |
| 100 | 100 | /** |
| 101 | 101 | * @todo this functions need to belong to a class or a special |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id'; |
| 111 | 111 | $sord = $_REQUEST['sord']; //asc or desc |
| 112 | 112 | if (!in_array($sord, array('asc','desc'))) { |
| 113 | - $sord = 'desc'; |
|
| 113 | + $sord = 'desc'; |
|
| 114 | 114 | } |
| 115 | 115 | $session_id = intval($_REQUEST['session_id']); |
| 116 | 116 | $course_id = intval($_REQUEST['course_id']); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $my_session_list[] = $item['id_session']; |
| 125 | 125 | } |
| 126 | 126 | if (!in_array($session_id, $my_session_list)) { |
| 127 | - break; |
|
| 127 | + break; |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | $date = '-'; |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - //Checking LP publicated and expired_on dates |
|
| 448 | + //Checking LP publicated and expired_on dates |
|
| 449 | 449 | if (!empty($lp_item['publicated_on']) && $lp_item['publicated_on'] != '0000-00-00 00:00:00') { |
| 450 | 450 | if ($now < api_strtotime($lp_item['publicated_on'], 'UTC')) { |
| 451 | 451 | continue; |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | |
| 500 | 500 | echo json_encode($response); |
| 501 | 501 | break; |
| 502 | - default: |
|
| 503 | - echo ''; |
|
| 502 | + default: |
|
| 503 | + echo ''; |
|
| 504 | 504 | } |
| 505 | 505 | exit; |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | null, |
| 31 | 31 | true |
| 32 | 32 | ); |
| 33 | - $na_image = str_replace('.png', '_na.png', $tool_image); |
|
| 33 | + $na_image = str_replace('.png', '_na.png', $tool_image); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | if (isset($tool_info['custom_icon']) && !empty($tool_info['custom_icon'])) { |
@@ -38,20 +38,20 @@ discard block |
||
| 38 | 38 | $na_image = CourseHome::getCustomWebIconPath().CourseHome::getDisableIcon($tool_info['custom_icon']); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $requested_image = ($tool_visibility == 0 ) ? $tool_image : $na_image; |
|
| 42 | - $requested_class = ($tool_visibility == 0 ) ? 'visible' : 'invisible'; |
|
| 43 | - $requested_message = ($tool_visibility == 0 ) ? 'is_active' : 'is_inactive'; |
|
| 44 | - $requested_view = ($tool_visibility == 0 ) ? 'visible.png' : 'invisible.png'; |
|
| 45 | - $requested_visible = ($tool_visibility == 0 ) ? 1 : 0; |
|
| 41 | + $requested_image = ($tool_visibility == 0) ? $tool_image : $na_image; |
|
| 42 | + $requested_class = ($tool_visibility == 0) ? 'visible' : 'invisible'; |
|
| 43 | + $requested_message = ($tool_visibility == 0) ? 'is_active' : 'is_inactive'; |
|
| 44 | + $requested_view = ($tool_visibility == 0) ? 'visible.png' : 'invisible.png'; |
|
| 45 | + $requested_visible = ($tool_visibility == 0) ? 1 : 0; |
|
| 46 | 46 | |
| 47 | - $requested_view = ($tool_visibility == 0 ) ? 'visible.png' : 'invisible.png'; |
|
| 48 | - $requested_visible = ($tool_visibility == 0 ) ? 1 : 0; |
|
| 47 | + $requested_view = ($tool_visibility == 0) ? 'visible.png' : 'invisible.png'; |
|
| 48 | + $requested_visible = ($tool_visibility == 0) ? 1 : 0; |
|
| 49 | 49 | |
| 50 | 50 | // HIDE AND REACTIVATE TOOL |
| 51 | 51 | if ($_GET["id"] == strval(intval($_GET["id"]))) { |
| 52 | 52 | $sql = "UPDATE $tool_table SET |
| 53 | 53 | visibility = $requested_visible |
| 54 | - WHERE c_id = $course_id AND id='" . intval($_GET['id']) . "'"; |
|
| 54 | + WHERE c_id = $course_id AND id='".intval($_GET['id'])."'"; |
|
| 55 | 55 | Database::query($sql); |
| 56 | 56 | } |
| 57 | 57 | $response_data = array( |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | WHERE c_id = ".$course_info['real_id']." AND session_id = 0 |
| 83 | 83 | ORDER BY id"; |
| 84 | 84 | $result = Database::query($sql); |
| 85 | - if (Database::num_rows($result) > 0 ) { |
|
| 85 | + if (Database::num_rows($result) > 0) { |
|
| 86 | 86 | while ($description = Database::fetch_object($result)) { |
| 87 | 87 | $descriptions[$description->id] = $description; |
| 88 | 88 | } |
@@ -104,12 +104,12 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | require_once '../global.inc.php'; |
| 106 | 106 | $now = time(); |
| 107 | - $page = intval($_REQUEST['page']); //page |
|
| 108 | - $limit = intval($_REQUEST['rows']); // quantity of rows |
|
| 107 | + $page = intval($_REQUEST['page']); //page |
|
| 108 | + $limit = intval($_REQUEST['rows']); // quantity of rows |
|
| 109 | 109 | //index to filter |
| 110 | 110 | $sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id'; |
| 111 | - $sord = $_REQUEST['sord']; //asc or desc |
|
| 112 | - if (!in_array($sord, array('asc','desc'))) { |
|
| 111 | + $sord = $_REQUEST['sord']; //asc or desc |
|
| 112 | + if (!in_array($sord, array('asc', 'desc'))) { |
|
| 113 | 113 | $sord = 'desc'; |
| 114 | 114 | } |
| 115 | 115 | $session_id = intval($_REQUEST['session_id']); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | if (!api_is_platform_admin()) { |
| 120 | 120 | $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id()); |
| 121 | 121 | $my_session_list = array(); |
| 122 | - foreach($new_session_list as $item) { |
|
| 122 | + foreach ($new_session_list as $item) { |
|
| 123 | 123 | if (!empty($item['id_session'])) |
| 124 | 124 | $my_session_list[] = $item['id_session']; |
| 125 | 125 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $start = $limit*$page - $limit; |
|
| 131 | + $start = $limit * $page - $limit; |
|
| 132 | 132 | $course_list = SessionManager::get_course_list_by_session_id($session_id); |
| 133 | 133 | $count = 0; |
| 134 | 134 | $temp = array(); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $item['title'] = Display::url($item['title'], $course_url, array('target' => SESSION_LINK_TARGET)); |
| 141 | 141 | |
| 142 | 142 | foreach ($flat_list as $lp_id => $lp_item) { |
| 143 | - $temp[$count]['id']= $lp_id; |
|
| 143 | + $temp[$count]['id'] = $lp_id; |
|
| 144 | 144 | |
| 145 | 145 | $lp = new learnpath($item['code'], $lp_id, api_get_user_id()); |
| 146 | 146 | if ($lp->progress_db == 100) { |
@@ -203,27 +203,27 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | $temp = msort($temp, $sidx, $sord); |
| 205 | 205 | |
| 206 | - $i =0; |
|
| 206 | + $i = 0; |
|
| 207 | 207 | $response = new stdClass(); |
| 208 | - foreach($temp as $key=>$row) { |
|
| 208 | + foreach ($temp as $key=>$row) { |
|
| 209 | 209 | $row = $row['cell']; |
| 210 | 210 | if (!empty($row)) { |
| 211 | - if ($key >= $start && $key < ($start + $limit)) { |
|
| 212 | - $response->rows[$i]['id']= $key; |
|
| 213 | - $response->rows[$i]['cell']=array($row[0], $row[1], $row[2]); |
|
| 211 | + if ($key >= $start && $key < ($start + $limit)) { |
|
| 212 | + $response->rows[$i]['id'] = $key; |
|
| 213 | + $response->rows[$i]['cell'] = array($row[0], $row[1], $row[2]); |
|
| 214 | 214 | $i++; |
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - if($count > 0 && $limit > 0) { |
|
| 220 | - $total_pages = ceil($count/$limit); |
|
| 219 | + if ($count > 0 && $limit > 0) { |
|
| 220 | + $total_pages = ceil($count / $limit); |
|
| 221 | 221 | } else { |
| 222 | 222 | $total_pages = 0; |
| 223 | 223 | } |
| 224 | - $response->total = $total_pages; |
|
| 224 | + $response->total = $total_pages; |
|
| 225 | 225 | if ($page > $total_pages) { |
| 226 | - $response->page= $total_pages; |
|
| 226 | + $response->page = $total_pages; |
|
| 227 | 227 | } else { |
| 228 | 228 | $response->page = $page; |
| 229 | 229 | } |
@@ -234,13 +234,13 @@ discard block |
||
| 234 | 234 | require_once '../global.inc.php'; |
| 235 | 235 | $now = time(); |
| 236 | 236 | |
| 237 | - $page = intval($_REQUEST['page']); //page |
|
| 238 | - $limit = intval($_REQUEST['rows']); // quantity of rows |
|
| 237 | + $page = intval($_REQUEST['page']); //page |
|
| 238 | + $limit = intval($_REQUEST['rows']); // quantity of rows |
|
| 239 | 239 | $sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'course'; |
| 240 | 240 | $sidx = str_replace(array('week desc,', ' '), '', $sidx); |
| 241 | 241 | |
| 242 | - $sord = $_REQUEST['sord']; //asc or desc |
|
| 243 | - if (!in_array($sord, array('asc','desc'))) { |
|
| 242 | + $sord = $_REQUEST['sord']; //asc or desc |
|
| 243 | + if (!in_array($sord, array('asc', 'desc'))) { |
|
| 244 | 244 | $sord = 'desc'; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | if (!api_is_platform_admin()) { |
| 252 | 252 | $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id()); |
| 253 | 253 | $my_session_list = array(); |
| 254 | - foreach($new_session_list as $item) { |
|
| 254 | + foreach ($new_session_list as $item) { |
|
| 255 | 255 | if (!empty($item['id_session'])) |
| 256 | 256 | $my_session_list[] = $item['id_session']; |
| 257 | 257 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - $start = $limit*$page - $limit; |
|
| 263 | + $start = $limit * $page - $limit; |
|
| 264 | 264 | $course_list = SessionManager::get_course_list_by_session_id($session_id); |
| 265 | 265 | |
| 266 | 266 | $count = 0; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - $list = new LearnpathList(api_get_user_id(),$item['code'], $session_id, 'publicated_on DESC'); |
|
| 275 | + $list = new LearnpathList(api_get_user_id(), $item['code'], $session_id, 'publicated_on DESC'); |
|
| 276 | 276 | $flat_list = $list->get_flat_list(); |
| 277 | 277 | $lps[$item['code']] = $flat_list; |
| 278 | 278 | $item['title'] = Display::url( |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | ); |
| 283 | 283 | |
| 284 | 284 | foreach ($flat_list as $lp_id => $lp_item) { |
| 285 | - $temp[$count]['id']= $lp_id; |
|
| 285 | + $temp[$count]['id'] = $lp_id; |
|
| 286 | 286 | $lp_url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view'; |
| 287 | 287 | |
| 288 | 288 | $last_date = Tracking::get_last_connection_date_on_the_course( |
@@ -345,20 +345,20 @@ discard block |
||
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | $response = new stdClass(); |
| 348 | - $i =0; |
|
| 349 | - foreach($temp as $key=>$row) { |
|
| 348 | + $i = 0; |
|
| 349 | + foreach ($temp as $key=>$row) { |
|
| 350 | 350 | $row = $row['cell']; |
| 351 | 351 | if (!empty($row)) { |
| 352 | - if ($key >= $start && $key < ($start + $limit)) { |
|
| 353 | - $response->rows[$i]['id']= $key; |
|
| 354 | - $response->rows[$i]['cell']=array($row[0], $row[1], $row[2],$row[3]); |
|
| 352 | + if ($key >= $start && $key < ($start + $limit)) { |
|
| 353 | + $response->rows[$i]['id'] = $key; |
|
| 354 | + $response->rows[$i]['cell'] = array($row[0], $row[1], $row[2], $row[3]); |
|
| 355 | 355 | $i++; |
| 356 | 356 | } |
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | if ($count > 0 && $limit > 0) { |
| 361 | - $total_pages = ceil($count/$limit); |
|
| 361 | + $total_pages = ceil($count / $limit); |
|
| 362 | 362 | } else { |
| 363 | 363 | $total_pages = 0; |
| 364 | 364 | } |
@@ -374,12 +374,12 @@ discard block |
||
| 374 | 374 | case 'session_courses_lp_by_course': |
| 375 | 375 | require_once '../global.inc.php'; |
| 376 | 376 | $now = time(); |
| 377 | - $page = intval($_REQUEST['page']); //page |
|
| 378 | - $limit = intval($_REQUEST['rows']); // quantity of rows |
|
| 377 | + $page = intval($_REQUEST['page']); //page |
|
| 378 | + $limit = intval($_REQUEST['rows']); // quantity of rows |
|
| 379 | 379 | $sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id'; |
| 380 | 380 | $sidx = str_replace(array('course asc,', ' '), '', $sidx); |
| 381 | 381 | |
| 382 | - $sord = $_REQUEST['sord']; //asc or desc |
|
| 382 | + $sord = $_REQUEST['sord']; //asc or desc |
|
| 383 | 383 | if (!in_array($sord, array('asc', 'desc'))) { |
| 384 | 384 | $sord = 'desc'; |
| 385 | 385 | } |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | if (!api_is_platform_admin()) { |
| 391 | 391 | $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id()); |
| 392 | 392 | $my_session_list = array(); |
| 393 | - foreach($new_session_list as $item) { |
|
| 393 | + foreach ($new_session_list as $item) { |
|
| 394 | 394 | if (!empty($item['id_session'])) |
| 395 | 395 | $my_session_list[] = $item['id_session']; |
| 396 | 396 | } |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | } |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - $start = $limit*$page - $limit; |
|
| 402 | + $start = $limit * $page - $limit; |
|
| 403 | 403 | $course_list = SessionManager::get_course_list_by_session_id($session_id); |
| 404 | 404 | $count = 0; |
| 405 | 405 | |
@@ -410,15 +410,15 @@ discard block |
||
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - $list = new LearnpathList(api_get_user_id(),$item['code'],$session_id); |
|
| 413 | + $list = new LearnpathList(api_get_user_id(), $item['code'], $session_id); |
|
| 414 | 414 | $flat_list = $list->get_flat_list(); |
| 415 | 415 | $lps[$item['code']] = $flat_list; |
| 416 | 416 | $item['title'] = Display::url( |
| 417 | 417 | $item['title'], |
| 418 | 418 | api_get_path(WEB_COURSE_PATH).$item['directory'].'/?id_session='.$session_id, array('target'=>SESSION_LINK_TARGET) |
| 419 | 419 | ); |
| 420 | - foreach($flat_list as $lp_id => $lp_item) { |
|
| 421 | - $temp[$count]['id']= $lp_id; |
|
| 420 | + foreach ($flat_list as $lp_id => $lp_item) { |
|
| 421 | + $temp[$count]['id'] = $lp_id; |
|
| 422 | 422 | $lp_url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view'; |
| 423 | 423 | $last_date = Tracking::get_last_connection_date_on_the_course( |
| 424 | 424 | api_get_user_id(), |
@@ -472,13 +472,13 @@ discard block |
||
| 472 | 472 | $temp = msort($temp, $sidx, $sord); |
| 473 | 473 | |
| 474 | 474 | $response = new stdClass(); |
| 475 | - $i =0; |
|
| 475 | + $i = 0; |
|
| 476 | 476 | foreach ($temp as $key=>$row) { |
| 477 | 477 | $row = $row['cell']; |
| 478 | 478 | if (!empty($row)) { |
| 479 | - if ($key >= $start && $key < ($start + $limit)) { |
|
| 480 | - $response->rows[$i]['id']= $key; |
|
| 481 | - $response->rows[$i]['cell']=array($row[0], $row[1], $row[2]); |
|
| 479 | + if ($key >= $start && $key < ($start + $limit)) { |
|
| 480 | + $response->rows[$i]['id'] = $key; |
|
| 481 | + $response->rows[$i]['cell'] = array($row[0], $row[1], $row[2]); |
|
| 482 | 482 | $i++; |
| 483 | 483 | } |
| 484 | 484 | } |