@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | $params['session_id'] = api_get_session_id(); |
78 | 78 | $params['category_id'] = isset($params['category_id']) ? $params['category_id'] : 0; |
79 | 79 | |
80 | - $sql = "SELECT MAX(display_order) |
|
80 | + $sql = "SELECT MAX(display_order) |
|
81 | 81 | FROM ".$this->table." |
82 | 82 | WHERE |
83 | 83 | c_id = $courseId AND |
84 | - category_id = '" . intval($params['category_id'])."'"; |
|
84 | + category_id = '".intval($params['category_id'])."'"; |
|
85 | 85 | $result = Database:: query($sql); |
86 | 86 | list ($orderMax) = Database:: fetch_row($result); |
87 | 87 | $order = $orderMax + 1; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | |
186 | 186 | // We ensure URL to be absolute. |
187 | 187 | if (strpos($urllink, '://') === false) { |
188 | - $urllink = 'http://' . $urllink; |
|
188 | + $urllink = 'http://'.$urllink; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | // If the title is empty, we use the URL as title. |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | 'c_id' => $course_id, |
208 | 208 | 'url' => $urllink, |
209 | 209 | 'title' => $title, |
210 | - 'description' => $description , |
|
210 | + 'description' => $description, |
|
211 | 211 | 'category_id' => $selectcategory, |
212 | 212 | 'on_homepage' => $onhomepage, |
213 | 213 | 'target' => $target, |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | if ((api_get_setting('search_enabled') == 'true') && |
221 | 221 | $link_id && extension_loaded('xapian') |
222 | 222 | ) { |
223 | - require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'; |
|
224 | - require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'; |
|
225 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
223 | + require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
|
224 | + require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'; |
|
225 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
226 | 226 | |
227 | 227 | $course_int_id = $_course['real_id']; |
228 | 228 | $courseCode = $_course['code']; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | if (isset ($_REQUEST[$specific_field['code']])) { |
236 | 236 | $sterms = trim($_REQUEST[$specific_field['code']]); |
237 | 237 | if (!empty ($sterms)) { |
238 | - $all_specific_terms .= ' ' . $sterms; |
|
238 | + $all_specific_terms .= ' '.$sterms; |
|
239 | 239 | $sterms = explode(',', $sterms); |
240 | 240 | foreach ($sterms as $sterm) { |
241 | 241 | $ic_slide->addTerm( |
@@ -262,12 +262,12 @@ discard block |
||
262 | 262 | SE_COURSE_ID => $courseCode, |
263 | 263 | SE_TOOL_ID => TOOL_LINK, |
264 | 264 | SE_DATA => array( |
265 | - 'link_id' => (int)$link_id |
|
265 | + 'link_id' => (int) $link_id |
|
266 | 266 | ), |
267 | - SE_USER => (int)api_get_user_id(), |
|
267 | + SE_USER => (int) api_get_user_id(), |
|
268 | 268 | ); |
269 | 269 | $ic_slide->xapian_data = serialize($xapian_data); |
270 | - $description = $all_specific_terms . ' ' . $description; |
|
270 | + $description = $all_specific_terms.' '.$description; |
|
271 | 271 | $ic_slide->addValue('content', $description); |
272 | 272 | |
273 | 273 | // Add category name if set. |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $sql_cat = sprintf( |
280 | 280 | $sql_cat, |
281 | 281 | $table_link_category, |
282 | - (int)$selectcategory, |
|
282 | + (int) $selectcategory, |
|
283 | 283 | $course_int_id |
284 | 284 | ); |
285 | 285 | $result = Database:: query($sql_cat); |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | // This will make a restore function possible for the platform administrator. |
400 | 400 | |
401 | 401 | $sql = "UPDATE $tbl_link SET on_homepage='0' |
402 | - WHERE c_id = $course_id AND id='" . $id . "'"; |
|
402 | + WHERE c_id = $course_id AND id='".$id."'"; |
|
403 | 403 | Database:: query($sql); |
404 | 404 | |
405 | 405 | api_item_property_update( |
@@ -415,12 +415,12 @@ discard block |
||
415 | 415 | break; |
416 | 416 | case 'category': |
417 | 417 | // First we delete the category itself and afterwards all the links of this category. |
418 | - $sql = "DELETE FROM " . $tbl_categories . " |
|
419 | - WHERE c_id = $course_id AND id='" . $id . "'"; |
|
418 | + $sql = "DELETE FROM ".$tbl_categories." |
|
419 | + WHERE c_id = $course_id AND id='".$id."'"; |
|
420 | 420 | Database:: query($sql); |
421 | 421 | |
422 | - $sql = "DELETE FROM " . $tbl_link . " |
|
423 | - WHERE c_id = $course_id AND category_id='" . $id . "'"; |
|
422 | + $sql = "DELETE FROM ".$tbl_link." |
|
423 | + WHERE c_id = $course_id AND category_id='".$id."'"; |
|
424 | 424 | Database:: query($sql); |
425 | 425 | |
426 | 426 | api_item_property_update( |
@@ -459,16 +459,16 @@ discard block |
||
459 | 459 | $row = Database:: fetch_array($res); |
460 | 460 | require_once api_get_path( |
461 | 461 | LIBRARY_PATH |
462 | - ) . 'search/ChamiloIndexer.class.php'; |
|
462 | + ).'search/ChamiloIndexer.class.php'; |
|
463 | 463 | $di = new ChamiloIndexer(); |
464 | - $di->remove_document((int)$row['search_did']); |
|
464 | + $di->remove_document((int) $row['search_did']); |
|
465 | 465 | } |
466 | 466 | $sql = 'DELETE FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s LIMIT 1'; |
467 | 467 | $sql = sprintf($sql, $tbl_se_ref, $course_id, TOOL_LINK, $link_id); |
468 | 468 | Database:: query($sql); |
469 | 469 | |
470 | 470 | // Remove terms from db. |
471 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
471 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
472 | 472 | delete_all_values_for_item($course_id, TOOL_DOCUMENT, $link_id); |
473 | 473 | } |
474 | 474 | } |
@@ -484,8 +484,8 @@ discard block |
||
484 | 484 | { |
485 | 485 | $tbl_link = Database:: get_course_table(TABLE_LINK); |
486 | 486 | $course_id = api_get_course_int_id(); |
487 | - $sql = "SELECT * FROM " . $tbl_link . " |
|
488 | - WHERE c_id = $course_id AND id='" . intval($id) . "' "; |
|
487 | + $sql = "SELECT * FROM ".$tbl_link." |
|
488 | + WHERE c_id = $course_id AND id='".intval($id)."' "; |
|
489 | 489 | $result = Database::query($sql); |
490 | 490 | $data = array(); |
491 | 491 | if (Database::num_rows($result)) { |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | |
515 | 515 | // We ensure URL to be absolute. |
516 | 516 | if (strpos($values['url'], '://') === false) { |
517 | - $values['url'] = 'http://' . $_POST['url']; |
|
517 | + $values['url'] = 'http://'.$_POST['url']; |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | // If the title is empty, we use the URL as title. |
@@ -532,18 +532,18 @@ discard block |
||
532 | 532 | } |
533 | 533 | |
534 | 534 | // Finding the old category_id. |
535 | - $sql = "SELECT * FROM " . $tbl_link . " |
|
536 | - WHERE c_id = $course_id AND id='" . $id . "'"; |
|
535 | + $sql = "SELECT * FROM ".$tbl_link." |
|
536 | + WHERE c_id = $course_id AND id='".$id."'"; |
|
537 | 537 | $result = Database:: query($sql); |
538 | 538 | $row = Database:: fetch_array($result); |
539 | 539 | $category_id = $row['category_id']; |
540 | 540 | |
541 | 541 | if ($category_id != $values['category_id']) { |
542 | 542 | $sql = "SELECT MAX(display_order) |
543 | - FROM " . $tbl_link . " |
|
543 | + FROM " . $tbl_link." |
|
544 | 544 | WHERE |
545 | 545 | c_id = $course_id AND |
546 | - category_id='" . intval($values['category_id']) . "'"; |
|
546 | + category_id='".intval($values['category_id'])."'"; |
|
547 | 547 | $result = Database:: query($sql); |
548 | 548 | list ($max_display_order) = Database:: fetch_row($result); |
549 | 549 | $max_display_order++; |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | 'target' => $values['target'], |
561 | 561 | 'category_id' => $values['category_id'], |
562 | 562 | ]; |
563 | - Database::update($tbl_link, $params, ['c_id = ? AND id = ?' => [$course_id, $id] ]); |
|
563 | + Database::update($tbl_link, $params, ['c_id = ? AND id = ?' => [$course_id, $id]]); |
|
564 | 564 | |
565 | 565 | // Update search enchine and its values table if enabled. |
566 | 566 | if (api_get_setting('search_enabled') == 'true') { |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | $_REQUEST[$specific_field['code']] |
614 | 614 | ); |
615 | 615 | if (!empty ($sterms)) { |
616 | - $all_specific_terms .= ' ' . $sterms; |
|
616 | + $all_specific_terms .= ' '.$sterms; |
|
617 | 617 | $sterms = explode(',', $sterms); |
618 | 618 | foreach ($sterms as $sterm) { |
619 | 619 | $ic_slide->addTerm( |
@@ -640,13 +640,13 @@ discard block |
||
640 | 640 | SE_COURSE_ID => $course_id, |
641 | 641 | SE_TOOL_ID => TOOL_LINK, |
642 | 642 | SE_DATA => array( |
643 | - 'link_id' => (int)$id |
|
643 | + 'link_id' => (int) $id |
|
644 | 644 | ), |
645 | - SE_USER => (int)api_get_user_id(), |
|
645 | + SE_USER => (int) api_get_user_id(), |
|
646 | 646 | |
647 | 647 | ); |
648 | 648 | $ic_slide->xapian_data = serialize($xapian_data); |
649 | - $link_description = $all_specific_terms . ' ' . $link_description; |
|
649 | + $link_description = $all_specific_terms.' '.$link_description; |
|
650 | 650 | $ic_slide->addValue('content', $link_description); |
651 | 651 | |
652 | 652 | // Add category name if set. |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | $di = new ChamiloIndexer(); |
675 | 675 | isset ($_POST['language']) ? $lang = Database:: escape_string($_POST['language']) : $lang = 'english'; |
676 | 676 | $di->connectDb(null, null, $lang); |
677 | - $di->remove_document((int)$se_ref['search_did']); |
|
677 | + $di->remove_document((int) $se_ref['search_did']); |
|
678 | 678 | $di->addChunk($ic_slide); |
679 | 679 | |
680 | 680 | // Index and return search engine document id. |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | $sql = "SELECT *, linkcat.id |
792 | 792 | FROM $tblLinkCategory linkcat |
793 | 793 | WHERE |
794 | - linkcat.c_id = " . $courseId . " |
|
794 | + linkcat.c_id = ".$courseId." |
|
795 | 795 | $sessionCondition |
796 | 796 | ORDER BY linkcat.display_order DESC"; |
797 | 797 | |
@@ -803,10 +803,10 @@ discard block |
||
803 | 803 | INNER JOIN $tblItemProperty itemproperties |
804 | 804 | ON (linkcat.id = itemproperties.ref AND linkcat.c_id = itemproperties.c_id) |
805 | 805 | WHERE |
806 | - itemproperties.tool = '" . TOOL_LINK_CATEGORY . "' AND |
|
806 | + itemproperties.tool = '".TOOL_LINK_CATEGORY."' AND |
|
807 | 807 | (itemproperties.visibility = '0' OR itemproperties.visibility = '1') |
808 | 808 | $sessionCondition AND |
809 | - linkcat.c_id = " . $courseId . " |
|
809 | + linkcat.c_id = ".$courseId." |
|
810 | 810 | ORDER BY linkcat.display_order DESC"; |
811 | 811 | |
812 | 812 | $result = Database::query($sql); |
@@ -829,10 +829,10 @@ discard block |
||
829 | 829 | INNER JOIN $tblItemProperty itemproperties |
830 | 830 | ON (linkcat.id = itemproperties.ref AND linkcat.c_id = itemproperties.c_id) |
831 | 831 | WHERE |
832 | - itemproperties.tool = '" . TOOL_LINK_CATEGORY . "' AND |
|
832 | + itemproperties.tool = '".TOOL_LINK_CATEGORY."' AND |
|
833 | 833 | (itemproperties.visibility = '0' OR itemproperties.visibility = '1') |
834 | 834 | $sessionCondition AND |
835 | - linkcat.c_id = " . $courseId . " |
|
835 | + linkcat.c_id = ".$courseId." |
|
836 | 836 | ORDER BY linkcat.display_order DESC |
837 | 837 | "; |
838 | 838 | $result = Database::query($sql); |
@@ -864,12 +864,12 @@ discard block |
||
864 | 864 | INNER JOIN $TABLE_ITEM_PROPERTY itemproperties |
865 | 865 | ON (link.id=itemproperties.ref AND link.c_id = itemproperties.c_id ) |
866 | 866 | WHERE |
867 | - itemproperties.tool='" . TOOL_LINK . "' AND |
|
868 | - link.category_id='" . $catid . "' AND |
|
867 | + itemproperties.tool='".TOOL_LINK."' AND |
|
868 | + link.category_id='" . $catid."' AND |
|
869 | 869 | (itemproperties.visibility='0' OR itemproperties.visibility='1') |
870 | 870 | $condition_session AND |
871 | - link.c_id = " . $course_id . " AND |
|
872 | - itemproperties.c_id = " . $course_id . " |
|
871 | + link.c_id = ".$course_id." AND |
|
872 | + itemproperties.c_id = " . $course_id." |
|
873 | 873 | ORDER BY link.display_order DESC"; |
874 | 874 | $result = Database:: query($sql); |
875 | 875 | $numberoflinks = Database:: num_rows($result); |
@@ -892,14 +892,14 @@ discard block |
||
892 | 892 | 'retweet', |
893 | 893 | 'default btn-sm', |
894 | 894 | array( |
895 | - 'onclick' => "check_url('" . $myrow['id'] . "', '" . addslashes($myrow['url']) . "');", |
|
895 | + 'onclick' => "check_url('".$myrow['id']."', '".addslashes($myrow['url'])."');", |
|
896 | 896 | 'title' => get_lang('CheckURL') |
897 | 897 | ) |
898 | 898 | ); |
899 | 899 | $link_validator .= Display::span( |
900 | 900 | '', |
901 | 901 | array( |
902 | - 'id' => 'url_id_' . $myrow['id'], |
|
902 | + 'id' => 'url_id_'.$myrow['id'], |
|
903 | 903 | 'class' => 'check-link' |
904 | 904 | ) |
905 | 905 | ); |
@@ -909,10 +909,10 @@ discard block |
||
909 | 909 | if (api_is_allowed_to_edit(null, true)) { |
910 | 910 | |
911 | 911 | if ($session_id == $myrow['session_id']) { |
912 | - $url = api_get_self() . '?' . api_get_cidreq() . |
|
913 | - '&action=editlink&category=' . (!empty ($category) ? $category : '') . |
|
914 | - '&id=' . $myrow['id'] . |
|
915 | - '&category_id=' . $myrow['id']; |
|
912 | + $url = api_get_self().'?'.api_get_cidreq(). |
|
913 | + '&action=editlink&category='.(!empty ($category) ? $category : ''). |
|
914 | + '&id='.$myrow['id']. |
|
915 | + '&category_id='.$myrow['id']; |
|
916 | 916 | $title = get_lang('Edit'); |
917 | 917 | $toolbar .= Display::toolbarButton( |
918 | 918 | '', |
@@ -940,10 +940,10 @@ discard block |
||
940 | 940 | }*/ |
941 | 941 | |
942 | 942 | if ($myrow['visibility'] == '1') { |
943 | - $url .= 'link.php?' . api_get_cidreq() . |
|
944 | - '&sec_token=' . $token . |
|
945 | - '&action=invisible&id=' . $myrow['id'] . |
|
946 | - '&scope=link&category_id=' . $myrow['category_id']; |
|
943 | + $url .= 'link.php?'.api_get_cidreq(). |
|
944 | + '&sec_token='.$token. |
|
945 | + '&action=invisible&id='.$myrow['id']. |
|
946 | + '&scope=link&category_id='.$myrow['category_id']; |
|
947 | 947 | $title = get_lang('MakeInvisible'); |
948 | 948 | $toolbar .= Display::toolbarButton( |
949 | 949 | '', |
@@ -957,7 +957,7 @@ discard block |
||
957 | 957 | |
958 | 958 | } |
959 | 959 | if ($myrow['visibility'] == '0') { |
960 | - $url .= 'link.php?' . api_get_cidreq() .'&sec_token=' . $token .'&action=visible&id=' . $myrow['id'] .'&scope=link&category_id=' . $myrow['category_id']; |
|
960 | + $url .= 'link.php?'.api_get_cidreq().'&sec_token='.$token.'&action=visible&id='.$myrow['id'].'&scope=link&category_id='.$myrow['category_id']; |
|
961 | 961 | $title = get_lang('MakeVisible'); |
962 | 962 | $toolbar .= Display::toolbarButton( |
963 | 963 | '', |
@@ -970,8 +970,8 @@ discard block |
||
970 | 970 | ); |
971 | 971 | } |
972 | 972 | |
973 | - $url .= api_get_self() . '?' . api_get_cidreq() .'&sec_token=' . $token .'&action=deletelink&id=' . $myrow['id'] .'&category_id=' . $myrow['category_id']; |
|
974 | - $event = "javascript: if(!confirm('" . get_lang('LinkDelconfirm') . "'))return false;"; |
|
973 | + $url .= api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=deletelink&id='.$myrow['id'].'&category_id='.$myrow['category_id']; |
|
974 | + $event = "javascript: if(!confirm('".get_lang('LinkDelconfirm')."'))return false;"; |
|
975 | 975 | $title = get_lang('Delete'); |
976 | 976 | |
977 | 977 | $toolbar .= Display::toolbarButton( |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | $content .= '<div class="pull-right"><div class="btn-group">'.$toolbar.'</div></div>'; |
1013 | 1013 | $content .= '<h4 class="list-group-item-heading">'; |
1014 | 1014 | $content .= $iconLink; |
1015 | - $url = 'link_goto.php?' . api_get_cidreq() .'&link_id=' . $myrow['id'] .'&link_url=' . urlencode($myrow['url']); |
|
1015 | + $url = 'link_goto.php?'.api_get_cidreq().'&link_id='.$myrow['id'].'&link_url='.urlencode($myrow['url']); |
|
1016 | 1016 | $content .= Display::tag( |
1017 | 1017 | 'a', |
1018 | 1018 | Security:: remove_XSS($myrow['title']), |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | $content .= $session_img; |
1026 | 1026 | $content .= '</h4>'; |
1027 | 1027 | |
1028 | - $content .= '<p class="list-group-item-text">' . $myrow['description'] . '</p>'; |
|
1028 | + $content .= '<p class="list-group-item-text">'.$myrow['description'].'</p>'; |
|
1029 | 1029 | $content .= '</div>'; |
1030 | 1030 | } else { |
1031 | 1031 | if (api_is_allowed_to_edit(null, true)) { |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | $content .= '<div class="pull-right"><div class="btn-group">'.$toolbar.'</div></div>'; |
1034 | 1034 | $content .= '<h4 class="list-group-item-heading">'; |
1035 | 1035 | $content .= $iconLink; |
1036 | - $url = 'link_goto.php?' . api_get_cidreq() .'&link_id=' . $myrow['id'] . "&link_url=" . urlencode($myrow['url']); |
|
1036 | + $url = 'link_goto.php?'.api_get_cidreq().'&link_id='.$myrow['id']."&link_url=".urlencode($myrow['url']); |
|
1037 | 1037 | $content .= Display::tag( |
1038 | 1038 | 'a', |
1039 | 1039 | Security:: remove_XSS($myrow['title']), |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | $content .= $link_validator; |
1047 | 1047 | $content .= $session_img; |
1048 | 1048 | $content .= '</h4>'; |
1049 | - $content .= '<p class="list-group-item-text">' . $myrow['description'] . '</p>'; |
|
1049 | + $content .= '<p class="list-group-item-text">'.$myrow['description'].'</p>'; |
|
1050 | 1050 | $content .= '</div>'; |
1051 | 1051 | } |
1052 | 1052 | } |
@@ -1068,58 +1068,58 @@ discard block |
||
1068 | 1068 | { |
1069 | 1069 | $categoryId = $category['id']; |
1070 | 1070 | $token = null; |
1071 | - $tools = '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&sec_token=' . $token . '&action=editcategory&id=' . $categoryId . '&category_id=' . $categoryId . '" title=' . get_lang('Modify') . '">' . |
|
1071 | + $tools = '<a href="'.api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=editcategory&id='.$categoryId.'&category_id='.$categoryId.'" title='.get_lang('Modify').'">'. |
|
1072 | 1072 | Display:: return_icon( |
1073 | 1073 | 'edit.png', |
1074 | 1074 | get_lang('Modify'), |
1075 | 1075 | array(), |
1076 | 1076 | ICON_SIZE_SMALL |
1077 | - ) . '</a>'; |
|
1077 | + ).'</a>'; |
|
1078 | 1078 | |
1079 | 1079 | // DISPLAY MOVE UP COMMAND only if it is not the top link. |
1080 | 1080 | if ($currentCategory != 0) { |
1081 | - $tools .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&sec_token=' . $token . '&action=up&up='.$categoryId.'&category_id='.$categoryId.'" title="'.get_lang('Up').'">'. |
|
1081 | + $tools .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=up&up='.$categoryId.'&category_id='.$categoryId.'" title="'.get_lang('Up').'">'. |
|
1082 | 1082 | Display:: return_icon( |
1083 | 1083 | 'up.png', |
1084 | 1084 | get_lang('Up'), |
1085 | 1085 | array(), |
1086 | 1086 | ICON_SIZE_SMALL |
1087 | - ) . '</a>'; |
|
1087 | + ).'</a>'; |
|
1088 | 1088 | } else { |
1089 | 1089 | $tools .= Display:: return_icon( |
1090 | 1090 | 'up_na.png', |
1091 | 1091 | get_lang('Up'), |
1092 | 1092 | array(), |
1093 | 1093 | ICON_SIZE_SMALL |
1094 | - ) . '</a>'; |
|
1094 | + ).'</a>'; |
|
1095 | 1095 | } |
1096 | 1096 | |
1097 | 1097 | // DISPLAY MOVE DOWN COMMAND only if it is not the bottom link. |
1098 | - if ($currentCategory < $countCategories-1) { |
|
1099 | - $tools .= '<a href="' . api_get_self() . '?' . api_get_cidreq() .'&sec_token=' . $token .'&action=down&down=' . $categoryId .'&category_id=' . $categoryId . '">'. |
|
1098 | + if ($currentCategory < $countCategories - 1) { |
|
1099 | + $tools .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=down&down='.$categoryId.'&category_id='.$categoryId.'">'. |
|
1100 | 1100 | Display:: return_icon( |
1101 | 1101 | 'down.png', |
1102 | 1102 | get_lang('Down'), |
1103 | 1103 | array(), |
1104 | 1104 | ICON_SIZE_SMALL |
1105 | - ) . '</a>'; |
|
1105 | + ).'</a>'; |
|
1106 | 1106 | } else { |
1107 | 1107 | $tools .= Display:: return_icon( |
1108 | 1108 | 'down_na.png', |
1109 | 1109 | get_lang('Down'), |
1110 | 1110 | array(), |
1111 | 1111 | ICON_SIZE_SMALL |
1112 | - ) . '</a>'; |
|
1112 | + ).'</a>'; |
|
1113 | 1113 | } |
1114 | 1114 | |
1115 | - $tools .= '<a href="' . api_get_self() . '?' . api_get_cidreq() .'&sec_token=' . $token .'&action=deletecategory&id='.$categoryId. "&category_id=$categoryId\" |
|
1116 | - onclick=\"javascript: if(!confirm('" . get_lang('CategoryDelconfirm') . "')) return false;\">". |
|
1115 | + $tools .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=deletecategory&id='.$categoryId."&category_id=$categoryId\" |
|
1116 | + onclick=\"javascript: if(!confirm('".get_lang('CategoryDelconfirm')."')) return false;\">". |
|
1117 | 1117 | Display:: return_icon( |
1118 | 1118 | 'delete.png', |
1119 | 1119 | get_lang('Delete'), |
1120 | 1120 | array(), |
1121 | 1121 | ICON_SIZE_SMALL |
1122 | - ) . '</a>'; |
|
1122 | + ).'</a>'; |
|
1123 | 1123 | |
1124 | 1124 | return $tools; |
1125 | 1125 | } |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | $movetable = $tbl_link; |
1167 | 1167 | // Getting the category of the link. |
1168 | 1168 | if (!empty ($thiscatlinkId)) { |
1169 | - $sql = "SELECT category_id FROM " . $movetable . " |
|
1169 | + $sql = "SELECT category_id FROM ".$movetable." |
|
1170 | 1170 | WHERE c_id = $courseId AND id='$thiscatlinkId'"; |
1171 | 1171 | $result = Database:: query($sql); |
1172 | 1172 | $catid = Database:: fetch_array($result); |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | ORDER BY display_order $sortDirection"; |
1187 | 1187 | } else { |
1188 | 1188 | $sql = "SELECT id, display_order FROM $movetable |
1189 | - WHERE c_id = $courseId AND category_id='" . $catid[0] . "' |
|
1189 | + WHERE c_id = $courseId AND category_id='".$catid[0]."' |
|
1190 | 1190 | ORDER BY display_order $sortDirection"; |
1191 | 1191 | } |
1192 | 1192 | $linkresult = Database:: query($sql); |
@@ -1200,12 +1200,12 @@ discard block |
||
1200 | 1200 | $nextlinkOrder = $sortrow['display_order']; |
1201 | 1201 | |
1202 | 1202 | Database:: query( |
1203 | - "UPDATE " . $movetable . " |
|
1203 | + "UPDATE ".$movetable." |
|
1204 | 1204 | SET display_order = '$nextlinkOrder' |
1205 | 1205 | WHERE c_id = $courseId AND id = '$thiscatlinkId'" |
1206 | 1206 | ); |
1207 | 1207 | Database:: query( |
1208 | - "UPDATE " . $movetable . " |
|
1208 | + "UPDATE ".$movetable." |
|
1209 | 1209 | SET display_order = '$thislinkOrder' |
1210 | 1210 | WHERE c_id = $courseId AND id = '$nextlinkId'" |
1211 | 1211 | ); |
@@ -1233,10 +1233,10 @@ discard block |
||
1233 | 1233 | $course_id = api_get_course_int_id(); |
1234 | 1234 | |
1235 | 1235 | $result = Database:: query( |
1236 | - "SELECT id FROM " . $tbl_categories . " |
|
1237 | - WHERE c_id = $course_id AND category_title='" . Database::escape_string( |
|
1236 | + "SELECT id FROM ".$tbl_categories." |
|
1237 | + WHERE c_id = $course_id AND category_title='".Database::escape_string( |
|
1238 | 1238 | $catname |
1239 | - ) . "'" |
|
1239 | + )."'" |
|
1240 | 1240 | ); |
1241 | 1241 | if (Database:: num_rows($result) >= 1 && ($row = Database:: fetch_array( |
1242 | 1242 | $result |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | } |
1247 | 1247 | |
1248 | 1248 | $result = Database:: query( |
1249 | - "SELECT MAX(display_order) FROM " . $tbl_categories . " WHERE c_id = $course_id " |
|
1249 | + "SELECT MAX(display_order) FROM ".$tbl_categories." WHERE c_id = $course_id " |
|
1250 | 1250 | ); |
1251 | 1251 | list ($max_order) = Database:: fetch_row($result); |
1252 | 1252 | |
@@ -1273,12 +1273,12 @@ discard block |
||
1273 | 1273 | $tbl_link = Database:: get_course_table(TABLE_LINK); |
1274 | 1274 | $course_id = api_get_course_int_id(); |
1275 | 1275 | |
1276 | - $urleq = "url='" . Database:: escape_string($url) . "'"; |
|
1277 | - $cateq = "category_id=" . intval($cat); |
|
1276 | + $urleq = "url='".Database:: escape_string($url)."'"; |
|
1277 | + $cateq = "category_id=".intval($cat); |
|
1278 | 1278 | |
1279 | 1279 | $result = Database:: query(" |
1280 | 1280 | SELECT id FROM $tbl_link |
1281 | - WHERE c_id = $course_id AND " . $urleq . ' AND ' . $cateq |
|
1281 | + WHERE c_id = $course_id AND ".$urleq.' AND '.$cateq |
|
1282 | 1282 | ); |
1283 | 1283 | |
1284 | 1284 | if (Database:: num_rows($result) >= 1 && ($row = Database:: fetch_array( |
@@ -1286,14 +1286,14 @@ discard block |
||
1286 | 1286 | )) |
1287 | 1287 | ) { |
1288 | 1288 | Database:: query( |
1289 | - "UPDATE $tbl_link set title='" . Database:: escape_string( |
|
1289 | + "UPDATE $tbl_link set title='".Database:: escape_string( |
|
1290 | 1290 | $title |
1291 | - ) . "', description='" . Database:: escape_string( |
|
1291 | + )."', description='".Database:: escape_string( |
|
1292 | 1292 | $description |
1293 | - ) . "' |
|
1294 | - WHERE c_id = $course_id AND id='" . Database:: escape_string( |
|
1293 | + )."' |
|
1294 | + WHERE c_id = $course_id AND id='".Database:: escape_string( |
|
1295 | 1295 | $row['id'] |
1296 | - ) . "'" |
|
1296 | + )."'" |
|
1297 | 1297 | ); |
1298 | 1298 | |
1299 | 1299 | $ipu = 'LinkUpdated'; |
@@ -1302,18 +1302,18 @@ discard block |
||
1302 | 1302 | // Add new link |
1303 | 1303 | $result = Database:: query( |
1304 | 1304 | "SELECT MAX(display_order) FROM $tbl_link |
1305 | - WHERE c_id = $course_id AND category_id='" . intval($cat) . "'" |
|
1305 | + WHERE c_id = $course_id AND category_id='".intval($cat)."'" |
|
1306 | 1306 | ); |
1307 | 1307 | list ($max_order) = Database:: fetch_row($result); |
1308 | 1308 | |
1309 | 1309 | Database:: query( |
1310 | 1310 | "INSERT INTO $tbl_link (c_id, url, title, description, category_id, display_order, on_homepage) |
1311 | - VALUES (" . api_get_course_int_id() . ", |
|
1312 | - '" . Database:: escape_string($url) . "', |
|
1313 | - '" . Database:: escape_string($title) . "', |
|
1314 | - '" . Database:: escape_string($description) . "', |
|
1315 | - '" . intval($cat) . "','" . (intval($max_order) + 1) . "', |
|
1316 | - '" . intval($on_homepage) . |
|
1311 | + VALUES (".api_get_course_int_id().", |
|
1312 | + '" . Database:: escape_string($url)."', |
|
1313 | + '" . Database:: escape_string($title)."', |
|
1314 | + '" . Database:: escape_string($description)."', |
|
1315 | + '" . intval($cat)."','".(intval($max_order) + 1)."', |
|
1316 | + '" . intval($on_homepage). |
|
1317 | 1317 | "')" |
1318 | 1318 | ); |
1319 | 1319 | |
@@ -1391,30 +1391,30 @@ discard block |
||
1391 | 1391 | ) |
1392 | 1392 | ) { // possibly in <...> |
1393 | 1393 | if (($kwlist = trim($regs[1])) != '') { |
1394 | - $kw = '<i kw="' . htmlspecialchars($kwlist) . '">'; |
|
1394 | + $kw = '<i kw="'.htmlspecialchars($kwlist).'">'; |
|
1395 | 1395 | } else { |
1396 | 1396 | $kw = ''; |
1397 | 1397 | } |
1398 | 1398 | // i.e. assume only one of the $hide_fields will be present |
1399 | 1399 | // and if found, hide the value as expando property of an <i> tag |
1400 | 1400 | } elseif (trim($value)) { |
1401 | - $d .= ', ' . $key . ':' . $value; |
|
1401 | + $d .= ', '.$key.':'.$value; |
|
1402 | 1402 | } |
1403 | 1403 | } |
1404 | 1404 | } |
1405 | 1405 | if (!empty($d)) { |
1406 | - $d = substr($d, 2) . ' - '; |
|
1406 | + $d = substr($d, 2).' - '; |
|
1407 | 1407 | } |
1408 | 1408 | |
1409 | 1409 | return Link::put_link( |
1410 | 1410 | $url, |
1411 | 1411 | $cat, |
1412 | 1412 | $title, |
1413 | - $kw . ereg_replace( |
|
1413 | + $kw.ereg_replace( |
|
1414 | 1414 | '\[((/?(b|big|i|small|sub|sup|u))|br/)\]', |
1415 | 1415 | '<\\1>', |
1416 | - htmlspecialchars($d . $linkdata['description']) |
|
1417 | - ) . ($kw ? '</i>' : ''), |
|
1416 | + htmlspecialchars($d.$linkdata['description']) |
|
1417 | + ).($kw ? '</i>' : ''), |
|
1418 | 1418 | $linkdata['on_homepage'] ? '1' : '0', |
1419 | 1419 | $linkdata['hidden'] ? '1' : '0' |
1420 | 1420 | ); |
@@ -1535,19 +1535,19 @@ discard block |
||
1535 | 1535 | echo '<div class="actions">'; |
1536 | 1536 | if (api_is_allowed_to_edit(null, true)) { |
1537 | 1537 | echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addlink&category_id='.$categoryId.'">'. |
1538 | - Display::return_icon('new_link.png', get_lang('LinkAdd'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
1538 | + Display::return_icon('new_link.png', get_lang('LinkAdd'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
1539 | 1539 | echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addcategory&category_id='.$categoryId.'">'. |
1540 | - Display::return_icon('new_folder.png', get_lang('CategoryAdd'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
1540 | + Display::return_icon('new_folder.png', get_lang('CategoryAdd'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
1541 | 1541 | } |
1542 | 1542 | |
1543 | 1543 | $categories = Link::getLinkCategories($course_id, $session_id); |
1544 | 1544 | $count = count($categories); |
1545 | 1545 | if (!empty($count)) { |
1546 | 1546 | echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=list&show=none">'; |
1547 | - echo Display::return_icon('forum_listview.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . ' </a>'; |
|
1547 | + echo Display::return_icon('forum_listview.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).' </a>'; |
|
1548 | 1548 | |
1549 | 1549 | echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=list&show=all">'; |
1550 | - echo Display::return_icon('forum_nestedview.png', get_lang('NestedView'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
1550 | + echo Display::return_icon('forum_nestedview.png', get_lang('NestedView'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
1551 | 1551 | } |
1552 | 1552 | echo '</div>'; |
1553 | 1553 | |
@@ -1579,12 +1579,12 @@ discard block |
||
1579 | 1579 | $strVisibility = ''; |
1580 | 1580 | $visibilityClass = null; |
1581 | 1581 | if ($myrow['visibility'] == '1') { |
1582 | - $strVisibility = '<a href="link.php?' . api_get_cidreq() . '&sec_token='.$token.'&action=invisible&id=' . $myrow['id'] . '&scope=' . TOOL_LINK_CATEGORY . '" title="' . get_lang('Hide') . '">' . |
|
1583 | - Display :: return_icon('visible.png', get_lang('Hide'), array (), ICON_SIZE_SMALL) . '</a>'; |
|
1582 | + $strVisibility = '<a href="link.php?'.api_get_cidreq().'&sec_token='.$token.'&action=invisible&id='.$myrow['id'].'&scope='.TOOL_LINK_CATEGORY.'" title="'.get_lang('Hide').'">'. |
|
1583 | + Display :: return_icon('visible.png', get_lang('Hide'), array(), ICON_SIZE_SMALL).'</a>'; |
|
1584 | 1584 | } elseif ($myrow['visibility'] == '0') { |
1585 | 1585 | $visibilityClass = 'invisible'; |
1586 | - $strVisibility = ' <a href="link.php?' . api_get_cidreq() . '&sec_token='.$token.'&action=visible&id=' . $myrow['id'] . '&scope=' . TOOL_LINK_CATEGORY . '" title="' . get_lang('Show') . '">' . |
|
1587 | - Display :: return_icon('invisible.png', get_lang('Show'), array (), ICON_SIZE_SMALL) . '</a>'; |
|
1586 | + $strVisibility = ' <a href="link.php?'.api_get_cidreq().'&sec_token='.$token.'&action=visible&id='.$myrow['id'].'&scope='.TOOL_LINK_CATEGORY.'" title="'.get_lang('Show').'">'. |
|
1587 | + Display :: return_icon('invisible.png', get_lang('Show'), array(), ICON_SIZE_SMALL).'</a>'; |
|
1588 | 1588 | } |
1589 | 1589 | |
1590 | 1590 | $header = ''; |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @assert () !== '' |
22 | 22 | * @assert ('abc','single') !== '' |
23 | 23 | */ |
24 | - function search_courses($needle,$type) |
|
24 | + function search_courses($needle, $type) |
|
25 | 25 | { |
26 | 26 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
27 | 27 | $xajax_response = new xajaxResponse(); |
28 | 28 | $return = ''; |
29 | - if(!empty($needle) && !empty($type)) { |
|
29 | + if (!empty($needle) && !empty($type)) { |
|
30 | 30 | // xajax send utf8 datas... datas in db can be non-utf8 datas |
31 | 31 | $charset = api_get_system_encoding(); |
32 | 32 | $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | $course_list = array(); |
39 | 39 | |
40 | 40 | $return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">'; |
41 | - while($course = Database :: fetch_array($rs)) { |
|
41 | + while ($course = Database :: fetch_array($rs)) { |
|
42 | 42 | $course_list[] = $course['id']; |
43 | - $return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>'; |
|
43 | + $return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'], ENT_QUOTES).'">'.$course['name'].'</option>'; |
|
44 | 44 | } |
45 | 45 | $return .= '</select>'; |
46 | - $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
46 | + $xajax_response -> addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return)); |
|
47 | 47 | } |
48 | 48 | $_SESSION['course_list'] = $course_list; |
49 | 49 | return $xajax_response; |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | $course_user_table = Database:: get_main_table(TABLE_MAIN_COURSE_USER); |
105 | 105 | $course_table = Database:: get_main_table(TABLE_MAIN_COURSE); |
106 | 106 | $user_table = Database:: get_main_table(TABLE_MAIN_USER); |
107 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
107 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
108 | 108 | $current_url_id = api_get_current_access_url_id(); |
109 | - $active_filter = $onlyActive?' AND active=1':''; |
|
110 | - $status_filter = isset($status)?' AND status = '.intval($status):''; |
|
109 | + $active_filter = $onlyActive ? ' AND active=1' : ''; |
|
110 | + $status_filter = isset($status) ? ' AND status = '.intval($status) : ''; |
|
111 | 111 | |
112 | 112 | if (api_is_multiple_url_enabled()) { |
113 | 113 | $sql = "SELECT COUNT(DISTINCT(u.user_id)) AS number |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | FROM $user_table |
132 | 132 | WHERE 1=1 $status_filter $active_filter"; |
133 | 133 | if (isset ($categoryCode)) { |
134 | - $status_filter = isset($status)?' AND status = '.intval($status):''; |
|
134 | + $status_filter = isset($status) ? ' AND status = '.intval($status) : ''; |
|
135 | 135 | $sql = "SELECT COUNT(DISTINCT(cu.user_id)) AS number |
136 | 136 | FROM $course_user_table cu, $course_table c |
137 | 137 | WHERE |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | public static function countSessions() |
157 | 157 | { |
158 | 158 | $session_table = Database :: get_main_table(TABLE_MAIN_SESSION); |
159 | - $access_url_rel_session_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
159 | + $access_url_rel_session_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
160 | 160 | if (api_is_multiple_url_enabled()) { |
161 | 161 | $current_url_id = api_get_current_access_url_id(); |
162 | 162 | $sql = "SELECT COUNT(id) AS number |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | public static function getNumberOfActivities() |
180 | 180 | { |
181 | 181 | // Database table definitions |
182 | - $track_e_default = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT); |
|
182 | + $track_e_default = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT); |
|
183 | 183 | $table_user = Database::get_main_table(TABLE_MAIN_USER); |
184 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
184 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
185 | 185 | $current_url_id = api_get_current_access_url_id(); |
186 | 186 | if (api_is_multiple_url_enabled()) { |
187 | 187 | $sql = "SELECT count(default_id) AS total_number_of_items |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $from = intval($from); |
226 | 226 | $numberOfItems = intval($numberOfItems); |
227 | 227 | |
228 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
228 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
229 | 229 | $direction = 'DESC'; |
230 | 230 | } |
231 | 231 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $sql .= " LIMIT $from,$numberOfItems "; |
277 | 277 | |
278 | 278 | $res = Database::query($sql); |
279 | - $activities = array (); |
|
279 | + $activities = array(); |
|
280 | 280 | while ($row = Database::fetch_row($res)) { |
281 | 281 | |
282 | 282 | if (strpos($row[1], '_object') === false && strpos($row[1], '_array') === false) { |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $sql = "SELECT code, name FROM $categoryTable |
344 | 344 | ORDER BY tree_pos"; |
345 | 345 | $res = Database::query($sql); |
346 | - $categories = array (); |
|
346 | + $categories = array(); |
|
347 | 347 | while ($category = Database::fetch_object($res)) { |
348 | 348 | $categories[$category->code] = $category->name; |
349 | 349 | } |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | $data_max = ($data_max < $value ? $value : $data_max); |
365 | 365 | } |
366 | 366 | reset($data); |
367 | - $result = array (); |
|
367 | + $result = array(); |
|
368 | 368 | $delta = $max / $data_max; |
369 | 369 | foreach ($data as $index => $value) { |
370 | 370 | $result[$index] = (int) round($value * $delta); |
@@ -398,9 +398,9 @@ discard block |
||
398 | 398 | } else { |
399 | 399 | $number_label = Statistics::makeSizeString($number); |
400 | 400 | } |
401 | - $percentage = ($total>0?number_format(100*$number/$total, 1, ',', '.'):'0'); |
|
401 | + $percentage = ($total > 0 ? number_format(100 * $number / $total, 1, ',', '.') : '0'); |
|
402 | 402 | |
403 | - echo '<tr class="row_'.($i%2 == 0 ? 'odd' : 'even').'"> |
|
403 | + echo '<tr class="row_'.($i % 2 == 0 ? 'odd' : 'even').'"> |
|
404 | 404 | <td width="150">'.$subtitle.'</td> |
405 | 405 | <td width="550">'.Display::bar_progress($percentage, false).'</td> |
406 | 406 | <td align="right">'.$number_label.'</td>'; |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | echo '<td align="right"> '.$percentage.'%</td>'; |
409 | 409 | } |
410 | 410 | echo '</tr>'; |
411 | - $i ++; |
|
411 | + $i++; |
|
412 | 412 | } |
413 | 413 | if ($showTotal) { |
414 | 414 | if (!$isFileSize) { |
@@ -428,17 +428,17 @@ discard block |
||
428 | 428 | public static function printLoginStats($type) |
429 | 429 | { |
430 | 430 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
431 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
431 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
432 | 432 | $current_url_id = api_get_current_access_url_id(); |
433 | 433 | |
434 | 434 | $table_url = null; |
435 | 435 | $where_url = null; |
436 | 436 | $now = api_get_utc_datetime(); |
437 | - $where_url_last = ' WHERE login_date > DATE_SUB("' . $now . '",INTERVAL 1 %s)'; |
|
437 | + $where_url_last = ' WHERE login_date > DATE_SUB("'.$now.'",INTERVAL 1 %s)'; |
|
438 | 438 | if (api_is_multiple_url_enabled()) { |
439 | 439 | $table_url = ", $access_url_rel_user_table"; |
440 | 440 | $where_url = " WHERE login_user_id=user_id AND access_url_id='".$current_url_id."'"; |
441 | - $where_url_last = ' AND login_date > DATE_SUB("' . $now . '",INTERVAL 1 %s)'; |
|
441 | + $where_url_last = ' AND login_date > DATE_SUB("'.$now.'",INTERVAL 1 %s)'; |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | $period = get_lang('PeriodMonth'); |
@@ -453,13 +453,13 @@ discard block |
||
453 | 453 | case 'hour': |
454 | 454 | $period = get_lang('PeriodHour'); |
455 | 455 | $sql = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY stat_date "; |
456 | - $sql_last_x = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'DAY')." GROUP BY stat_date ORDER BY stat_date "; |
|
456 | + $sql_last_x = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last, 'DAY')." GROUP BY stat_date ORDER BY stat_date "; |
|
457 | 457 | break; |
458 | 458 | case 'day': |
459 | 459 | $periodCollection = api_get_week_days_long(); |
460 | 460 | $period = get_lang('PeriodDay'); |
461 | 461 | $sql = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) "; |
462 | - $sql_last_x = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'WEEK')." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) "; |
|
462 | + $sql_last_x = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last, 'WEEK')." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) "; |
|
463 | 463 | break; |
464 | 464 | } |
465 | 465 | if ($sql_last_x) { |
@@ -501,14 +501,14 @@ discard block |
||
501 | 501 | { |
502 | 502 | $totalLogin = array(); |
503 | 503 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
504 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
504 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
505 | 505 | $current_url_id = api_get_current_access_url_id(); |
506 | 506 | if (api_is_multiple_url_enabled()) { |
507 | 507 | $table_url = ", $access_url_rel_user_table"; |
508 | 508 | $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'"; |
509 | 509 | } else { |
510 | 510 | $table_url = ''; |
511 | - $where_url=''; |
|
511 | + $where_url = ''; |
|
512 | 512 | } |
513 | 513 | $now = api_get_utc_datetime(); |
514 | 514 | $field = 'login_user_id'; |
@@ -540,14 +540,14 @@ discard block |
||
540 | 540 | { |
541 | 541 | $totalLogin = []; |
542 | 542 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
543 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
543 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
544 | 544 | $current_url_id = api_get_current_access_url_id(); |
545 | 545 | if (api_is_multiple_url_enabled()) { |
546 | 546 | $table_url = ", $access_url_rel_user_table"; |
547 | 547 | $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'"; |
548 | 548 | } else { |
549 | 549 | $table_url = ''; |
550 | - $where_url=''; |
|
550 | + $where_url = ''; |
|
551 | 551 | } |
552 | 552 | $now = api_get_utc_datetime(); |
553 | 553 | $field = 'login_user_id'; |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | $sql = "SELECT count($field) AS number, date(login_date) as login_date FROM $table $table_url WHERE DATE_ADD(login_date, INTERVAL 15 DAY) >= '$now' $where_url GROUP BY date(login_date)"; |
558 | 558 | |
559 | 559 | $res = Database::query($sql); |
560 | - while($row = Database::fetch_array($res,'ASSOC')){ |
|
560 | + while ($row = Database::fetch_array($res, 'ASSOC')) { |
|
561 | 561 | $totalLogin[$row['login_date']] = $row['number']; |
562 | 562 | } |
563 | 563 | |
@@ -652,13 +652,13 @@ discard block |
||
652 | 652 | public static function printUserPicturesStats() |
653 | 653 | { |
654 | 654 | $user_table = Database :: get_main_table(TABLE_MAIN_USER); |
655 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
655 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
656 | 656 | $current_url_id = api_get_current_access_url_id(); |
657 | 657 | $url_condition = null; |
658 | 658 | $url_condition2 = null; |
659 | 659 | $table = null; |
660 | 660 | if (api_is_multiple_url_enabled()) { |
661 | - $url_condition = ", $access_url_rel_user_table as url WHERE url.user_id=u.user_id AND access_url_id='".$current_url_id."'"; |
|
661 | + $url_condition = ", $access_url_rel_user_table as url WHERE url.user_id=u.user_id AND access_url_id='".$current_url_id."'"; |
|
662 | 662 | $url_condition2 = " AND url.user_id=u.user_id AND access_url_id='".$current_url_id."'"; |
663 | 663 | $table = ", $access_url_rel_user_table as url "; |
664 | 664 | } |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | 'width=200px', |
691 | 691 | false |
692 | 692 | ); |
693 | - $renderer =& $form->defaultRenderer(); |
|
693 | + $renderer = & $form->defaultRenderer(); |
|
694 | 694 | $renderer->setCustomElementTemplate('<span>{element}</span> '); |
695 | 695 | $form->addElement('hidden', 'report', 'activities'); |
696 | 696 | $form->addElement('hidden', 'activities_direction', 'DESC'); |
@@ -740,10 +740,10 @@ discard block |
||
740 | 740 | $columns[1] = 'access_date'; |
741 | 741 | $sql_order[SORT_ASC] = 'ASC'; |
742 | 742 | $sql_order[SORT_DESC] = 'DESC'; |
743 | - $per_page = isset($_GET['per_page'])?intval($_GET['per_page']) : 10; |
|
744 | - $page_nr = isset($_GET['page_nr'])?intval($_GET['page_nr']) : 1; |
|
745 | - $column = isset($_GET['column'])?intval($_GET['column']) : 0; |
|
746 | - $date_diff = isset($_GET['date_diff'])?intval($_GET['date_diff']) : 60; |
|
743 | + $per_page = isset($_GET['per_page']) ? intval($_GET['per_page']) : 10; |
|
744 | + $page_nr = isset($_GET['page_nr']) ? intval($_GET['page_nr']) : 1; |
|
745 | + $column = isset($_GET['column']) ? intval($_GET['column']) : 0; |
|
746 | + $date_diff = isset($_GET['date_diff']) ? intval($_GET['date_diff']) : 60; |
|
747 | 747 | |
748 | 748 | $direction = isset($_GET['direction']) ? $_GET['direction'] : SORT_ASC; |
749 | 749 | |
@@ -772,25 +772,25 @@ discard block |
||
772 | 772 | access_url_id='".$current_url_id."' |
773 | 773 | GROUP BY c_id |
774 | 774 | HAVING c_id <> '' |
775 | - AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ". $date_diff; |
|
775 | + AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ".$date_diff; |
|
776 | 776 | } else { |
777 | 777 | $sql = "SELECT * FROM $table |
778 | 778 | GROUP BY c_id |
779 | 779 | HAVING c_id <> '' |
780 | - AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ". $date_diff; |
|
780 | + AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ".$date_diff; |
|
781 | 781 | } |
782 | 782 | $sql .= ' ORDER BY '.$columns[$column].' '.$sql_order[$direction]; |
783 | - $from = ($page_nr -1) * $per_page; |
|
783 | + $from = ($page_nr - 1) * $per_page; |
|
784 | 784 | $sql .= ' LIMIT '.$from.','.$per_page; |
785 | 785 | |
786 | 786 | echo '<p>'.get_lang('LastAccess').' >= '.$date_diff.' '.get_lang('Days').'</p>'; |
787 | 787 | $res = Database::query($sql); |
788 | 788 | if (Database::num_rows($res) > 0) { |
789 | - $courses = array (); |
|
789 | + $courses = array(); |
|
790 | 790 | while ($obj = Database::fetch_object($res)) { |
791 | 791 | $courseInfo = api_get_course_info_by_id($obj->c_id); |
792 | - $course = array (); |
|
793 | - $course[]= '<a href="'.api_get_path(WEB_COURSE_PATH).$courseInfo['code'].'">'.$courseInfo['code'].' <a>'; |
|
792 | + $course = array(); |
|
793 | + $course[] = '<a href="'.api_get_path(WEB_COURSE_PATH).$courseInfo['code'].'">'.$courseInfo['code'].' <a>'; |
|
794 | 794 | // Allow sort by date hiding the numerical date |
795 | 795 | $course[] = '<span style="display:none;">'.$obj->access_date.'</span>'.api_convert_and_format_date($obj->access_date); |
796 | 796 | $courses[] = $course; |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | { |
864 | 864 | $user_friend_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
865 | 865 | $user_table = Database::get_main_table(TABLE_MAIN_USER); |
866 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
866 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
867 | 867 | $current_url_id = api_get_current_access_url_id(); |
868 | 868 | |
869 | 869 | if (api_is_multiple_url_enabled()) { |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | { |
896 | 896 | $totalLogin = array(); |
897 | 897 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
898 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
898 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
899 | 899 | $current_url_id = api_get_current_access_url_id(); |
900 | 900 | $total = self::countUsers(); |
901 | 901 | if (api_is_multiple_url_enabled()) { |
@@ -903,14 +903,14 @@ discard block |
||
903 | 903 | $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'"; |
904 | 904 | } else { |
905 | 905 | $table_url = ''; |
906 | - $where_url=''; |
|
906 | + $where_url = ''; |
|
907 | 907 | } |
908 | 908 | $now = api_get_utc_datetime(); |
909 | - $sql[get_lang('ThisDay')] = |
|
909 | + $sql[get_lang('ThisDay')] = |
|
910 | 910 | "SELECT count(distinct(login_user_id)) AS number ". |
911 | 911 | " FROM $table $table_url ". |
912 | 912 | " WHERE DATE_ADD(login_date, INTERVAL 1 DAY) >= '$now' $where_url"; |
913 | - $sql[get_lang('Last7days')] = |
|
913 | + $sql[get_lang('Last7days')] = |
|
914 | 914 | "SELECT count(distinct(login_user_id)) AS number ". |
915 | 915 | " FROM $table $table_url ". |
916 | 916 | " WHERE DATE_ADD(login_date, INTERVAL 7 DAY) >= '$now' $where_url"; |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | "SELECT count(distinct(login_user_id)) AS number ". |
923 | 923 | " FROM $table $table_url ". |
924 | 924 | " WHERE DATE_ADD(login_date, INTERVAL 6 MONTH) >= '$now' $where_url"; |
925 | - $sql[get_lang('NeverConnected')] = |
|
925 | + $sql[get_lang('NeverConnected')] = |
|
926 | 926 | "SELECT count(distinct(login_user_id)) AS number ". |
927 | 927 | " FROM $table $table_url WHERE 1=1 $where_url"; |
928 | 928 | foreach ($sql as $index => $query) { |
@@ -34,8 +34,8 @@ |
||
34 | 34 | $idUserLocal = api_get_user_id(); |
35 | 35 | $userLocal = api_get_user_info($idUserLocal, true); |
36 | 36 | $htmlHeadXtra[] = '<script type="text/javascript" src="' |
37 | - . api_get_path(WEB_PATH) . 'web/assets/SimpleWebRTC/latest.js' |
|
38 | - . '"></script>' . "\n"; |
|
37 | + . api_get_path(WEB_PATH).'web/assets/SimpleWebRTC/latest.js' |
|
38 | + . '"></script>'."\n"; |
|
39 | 39 | |
40 | 40 | $template = new Template(); |
41 | 41 | $template->assign('room_name', $chatVideo->getRoomName()); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $from = intval($from); |
75 | 75 | $number_of_items = intval($number_of_items); |
76 | 76 | |
77 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
77 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
78 | 78 | $direction = 'ASC'; |
79 | 79 | } |
80 | 80 | |
@@ -97,24 +97,24 @@ discard block |
||
97 | 97 | $thematic[1] = '<a href="index.php?'.api_get_cidreq().'&action=thematic_details&thematic_id='.$thematic[0].'">'. |
98 | 98 | Security::remove_XSS($thematic[1], STUDENT).$session_star.'</a>'; |
99 | 99 | if (api_is_allowed_to_edit(null, true)) { |
100 | - $actions = ''; |
|
100 | + $actions = ''; |
|
101 | 101 | |
102 | 102 | if (api_get_session_id()) { |
103 | 103 | if (api_get_session_id() == $thematic[3]) { |
104 | 104 | $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic[0].'">'. |
105 | - Display::return_icon('lesson_plan.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).'</a> '; |
|
105 | + Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).'</a> '; |
|
106 | 106 | $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic[0].'">'. |
107 | - Display::return_icon('lesson_plan_calendar.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).'</a> '; |
|
107 | + Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).'</a> '; |
|
108 | 108 | |
109 | 109 | $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$thematic[0].'">'. |
110 | - Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'; |
|
110 | + Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'; |
|
111 | 111 | $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$thematic[0].'">'. |
112 | - Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
|
112 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
113 | 113 | } else { |
114 | - $actions .= Display::return_icon('lesson_plan_na.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).' '; |
|
115 | - $actions .= Display::return_icon('lesson_plan_calendar_na.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).' '; |
|
116 | - $actions .= Display::return_icon('edit_na.png',get_lang('Edit'),'',ICON_SIZE_SMALL); |
|
117 | - $actions .= Display::return_icon('delete_na.png',get_lang('Delete'),'',ICON_SIZE_SMALL).' '; |
|
114 | + $actions .= Display::return_icon('lesson_plan_na.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).' '; |
|
115 | + $actions .= Display::return_icon('lesson_plan_calendar_na.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).' '; |
|
116 | + $actions .= Display::return_icon('edit_na.png', get_lang('Edit'), '', ICON_SIZE_SMALL); |
|
117 | + $actions .= Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL).' '; |
|
118 | 118 | $actions .= Display::url( |
119 | 119 | Display::return_icon('cd.gif', get_lang('Copy')), |
120 | 120 | 'index.php?'.api_get_cidreq().'&action=thematic_copy&thematic_id='.$thematic[0] |
@@ -122,26 +122,26 @@ discard block |
||
122 | 122 | } |
123 | 123 | } else { |
124 | 124 | $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic[0].'">'. |
125 | - Display::return_icon('lesson_plan.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).'</a> '; |
|
125 | + Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).'</a> '; |
|
126 | 126 | $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic[0].'">'. |
127 | - Display::return_icon('lesson_plan_calendar.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).'</a> '; |
|
127 | + Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).'</a> '; |
|
128 | 128 | |
129 | 129 | if ($thematic[2] > 1) { |
130 | 130 | $actions .= '<a href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$thematic[0].'">'. |
131 | - Display::return_icon('up.png', get_lang('Up'),'',ICON_SIZE_SMALL).'</a>'; |
|
131 | + Display::return_icon('up.png', get_lang('Up'), '', ICON_SIZE_SMALL).'</a>'; |
|
132 | 132 | } else { |
133 | - $actions .= Display::return_icon('up_na.png',' ','',ICON_SIZE_SMALL); |
|
133 | + $actions .= Display::return_icon('up_na.png', ' ', '', ICON_SIZE_SMALL); |
|
134 | 134 | } |
135 | 135 | if ($thematic[2] < self::get_max_thematic_item()) { |
136 | 136 | $actions .= '<a href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$thematic[0].'">'. |
137 | - Display::return_icon('down.png',get_lang('Down'),'',ICON_SIZE_SMALL).'</a>'; |
|
137 | + Display::return_icon('down.png', get_lang('Down'), '', ICON_SIZE_SMALL).'</a>'; |
|
138 | 138 | } else { |
139 | - $actions .= Display::return_icon('down_na.png',' ','',ICON_SIZE_SMALL); |
|
139 | + $actions .= Display::return_icon('down_na.png', ' ', '', ICON_SIZE_SMALL); |
|
140 | 140 | } |
141 | 141 | $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$thematic[0].'">'. |
142 | - Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'; |
|
142 | + Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'; |
|
143 | 143 | $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$thematic[0].'">'. |
144 | - Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
|
144 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
145 | 145 | } |
146 | 146 | $thematics[] = array($thematic[0], $thematic[1], $actions); |
147 | 147 | } |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | $res = Database::query($sql); |
279 | 279 | if (Database::num_rows($res) > 0) { |
280 | 280 | if (!empty($thematic_id)) { |
281 | - $data = Database::fetch_array($res,'ASSOC'); |
|
281 | + $data = Database::fetch_array($res, 'ASSOC'); |
|
282 | 282 | } else { |
283 | - while ($row = Database::fetch_array($res,'ASSOC')) { |
|
283 | + while ($row = Database::fetch_array($res, 'ASSOC')) { |
|
284 | 284 | $data[$row['id']] = $row; |
285 | 285 | } |
286 | 286 | } |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | |
376 | 376 | if (is_array($thematic_id)) { |
377 | 377 | foreach ($thematic_id as $id) { |
378 | - $id = intval($id); |
|
378 | + $id = intval($id); |
|
379 | 379 | $sql = "UPDATE $tbl_thematic SET active = 0 |
380 | 380 | WHERE c_id = $course_id AND id = $id"; |
381 | 381 | $result = Database::query($sql); |
@@ -391,8 +391,8 @@ discard block |
||
391 | 391 | ); |
392 | 392 | } |
393 | 393 | } |
394 | - } else { |
|
395 | - $thematic_id = intval($thematic_id); |
|
394 | + } else { |
|
395 | + $thematic_id = intval($thematic_id); |
|
396 | 396 | $sql = "UPDATE $tbl_thematic SET active = 0 |
397 | 397 | WHERE c_id = $course_id AND id = $thematic_id"; |
398 | 398 | $result = Database::query($sql); |
@@ -428,8 +428,8 @@ discard block |
||
428 | 428 | $new_thematic_id = $thematic_copy->thematic_save(); |
429 | 429 | if (!empty($new_thematic_id)) { |
430 | 430 | $thematic_advanced = self::get_thematic_advance_by_thematic_id($thematic_id); |
431 | - if(!empty($thematic_advanced)) { |
|
432 | - foreach($thematic_advanced as $item) { |
|
431 | + if (!empty($thematic_advanced)) { |
|
432 | + foreach ($thematic_advanced as $item) { |
|
433 | 433 | $thematic = new Thematic(); |
434 | 434 | $thematic->set_thematic_advance_attributes( |
435 | 435 | 0, |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | $column = intval($column); |
493 | 493 | $from = intval($from); |
494 | 494 | $number_of_items = intval($number_of_items); |
495 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
495 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
496 | 496 | $direction = 'ASC'; |
497 | 497 | } |
498 | 498 | $data = array(); |
@@ -525,8 +525,8 @@ discard block |
||
525 | 525 | $thematic_advance[1] = api_get_local_time($thematic_advance[1]); |
526 | 526 | $thematic_advance[1] = api_format_date($thematic_advance[1], DATE_TIME_FORMAT_LONG); |
527 | 527 | $actions = ''; |
528 | - $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',22).'</a>'; |
|
529 | - $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('delete.png',get_lang('Delete'),'',22).'</a></center>'; |
|
528 | + $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('edit.png', get_lang('Edit'), '', 22).'</a>'; |
|
529 | + $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('delete.png', get_lang('Delete'), '', 22).'</a></center>'; |
|
530 | 530 | $data[] = array($i, $thematic_advance[1], $thematic_advance[2], $thematic_advance[3], $actions); |
531 | 531 | $i++; |
532 | 532 | } |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | |
591 | 591 | $session_star = ''; |
592 | 592 | if (api_is_allowed_to_edit(null, true)) { |
593 | - if ($thematic_advance['session_id'] !=0) { |
|
593 | + if ($thematic_advance['session_id'] != 0) { |
|
594 | 594 | $session_star = api_get_session_image(api_get_session_id(), $uinfo['status']); |
595 | 595 | } |
596 | 596 | } |
@@ -616,13 +616,13 @@ discard block |
||
616 | 616 | |
617 | 617 | foreach ($data as $thematic_id => $thematic_plan_data) { |
618 | 618 | $new_thematic_plan_data = array(); |
619 | - foreach($thematic_plan_data as $thematic_item) { |
|
619 | + foreach ($thematic_plan_data as $thematic_item) { |
|
620 | 620 | $thematic_simple_list[] = $thematic_item['description_type']; |
621 | 621 | $new_thematic_plan_data[$thematic_item['description_type']] = $thematic_item; |
622 | 622 | } |
623 | 623 | |
624 | 624 | if (!empty($thematic_simple_list)) { |
625 | - foreach($thematic_simple_list as $item) { |
|
625 | + foreach ($thematic_simple_list as $item) { |
|
626 | 626 | $default_thematic_plan_title[$item] = $new_thematic_plan_data[$item]['title']; |
627 | 627 | } |
628 | 628 | } |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | } |
639 | 639 | if (!empty($data[$thematic_id][$id]['title']) && !empty($data[$thematic_id][$id]['description'])) { |
640 | 640 | if (api_is_allowed_to_edit(null, true)) { |
641 | - if ($data[$thematic_id][$id]['session_id'] !=0) { |
|
641 | + if ($data[$thematic_id][$id]['session_id'] != 0) { |
|
642 | 642 | $session_star = api_get_session_image(api_get_session_id(), $uinfo['status']); |
643 | 643 | } |
644 | 644 | } |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | if ($no_data) { |
652 | 652 | $return .= '<div><em>'.get_lang('StillDoNotHaveAThematicPlan').'</em></div>'; |
653 | 653 | } |
654 | - $return .= '</div>'; |
|
654 | + $return .= '</div>'; |
|
655 | 655 | $final_return[$thematic_id] = $return; |
656 | 656 | } |
657 | 657 | return $final_return; |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | api_get_session_id() |
692 | 692 | ); |
693 | 693 | foreach ($list as $value) { |
694 | - $elements[$value['ref']]= $value; |
|
694 | + $elements[$value['ref']] = $value; |
|
695 | 695 | } |
696 | 696 | } |
697 | 697 | |
@@ -865,18 +865,18 @@ discard block |
||
865 | 865 | api_get_session_id() |
866 | 866 | ); |
867 | 867 | |
868 | - $thematic_plan_complete_list = array(); |
|
868 | + $thematic_plan_complete_list = array(); |
|
869 | 869 | $thematic_plan_id_list = array(); |
870 | 870 | |
871 | 871 | if (!empty($items_from_course)) { |
872 | - foreach($items_from_course as $item) { |
|
872 | + foreach ($items_from_course as $item) { |
|
873 | 873 | $thematic_plan_id_list[] = $item['ref']; |
874 | 874 | $thematic_plan_complete_list[$item['ref']] = $item; |
875 | 875 | } |
876 | 876 | } |
877 | 877 | |
878 | 878 | if (!empty($items_from_session)) { |
879 | - foreach($items_from_session as $item) { |
|
879 | + foreach ($items_from_session as $item) { |
|
880 | 880 | $thematic_plan_id_list[] = $item['ref']; |
881 | 881 | $thematic_plan_complete_list[$item['ref']] = $item; |
882 | 882 | } |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | if (!isset($thematic_id) && !isset($description_type)) { |
899 | 899 | // group all data group by thematic id |
900 | 900 | $tmp = array(); |
901 | - while ($row = Database::fetch_array($rs,'ASSOC')) { |
|
901 | + while ($row = Database::fetch_array($rs, 'ASSOC')) { |
|
902 | 902 | $tmp[] = $row['thematic_id']; |
903 | 903 | if (in_array($row['thematic_id'], $tmp)) { |
904 | 904 | $row['session_id'] = $thematic_plan_complete_list[$row['id']]; |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | } |
907 | 907 | } |
908 | 908 | } else { |
909 | - while ($row = Database::fetch_array($rs,'ASSOC')) { |
|
909 | + while ($row = Database::fetch_array($rs, 'ASSOC')) { |
|
910 | 910 | $row['session_id'] = $thematic_plan_complete_list[$row['id']]; |
911 | 911 | $data[] = $row; |
912 | 912 | } |
@@ -941,8 +941,8 @@ discard block |
||
941 | 941 | ); |
942 | 942 | |
943 | 943 | $elements_to_show = array(); |
944 | - foreach($list as $value) { |
|
945 | - $elements_to_show[]= $value['ref']; |
|
944 | + foreach ($list as $value) { |
|
945 | + $elements_to_show[] = $value['ref']; |
|
946 | 946 | } |
947 | 947 | $condition = ''; |
948 | 948 | if (!empty($elements_to_show)) { |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | c_id = $course_id AND |
955 | 955 | thematic_id = $thematic_id AND |
956 | 956 | description_type = '$description_type'"; |
957 | - $rs = Database::query($sql); |
|
957 | + $rs = Database::query($sql); |
|
958 | 958 | |
959 | 959 | $affected_rows = 0; |
960 | 960 | if (Database::num_rows($rs) > 0) { |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | $diff = array_diff($all, $a_thematic_advance_ids); |
1191 | 1191 | if (!empty($diff)) { |
1192 | 1192 | $upd = "UPDATE $tbl_thematic_advance SET done_advance = 0 |
1193 | - WHERE c_id = $course_id AND id IN(".implode(',',$diff).") "; |
|
1193 | + WHERE c_id = $course_id AND id IN(".implode(',', $diff).") "; |
|
1194 | 1194 | Database::query($upd); |
1195 | 1195 | } |
1196 | 1196 | |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | $course_code = api_get_course_id(); |
1305 | 1305 | } |
1306 | 1306 | if (api_get_session_id()) { |
1307 | - $thematic_data = $this->get_thematic_list(null, $course_code ); |
|
1307 | + $thematic_data = $this->get_thematic_list(null, $course_code); |
|
1308 | 1308 | } else { |
1309 | 1309 | $thematic_data = $this->get_thematic_list(null, $course_code, 0); |
1310 | 1310 | } |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | } |
1357 | 1357 | // calculate average by thematic |
1358 | 1358 | $count_total_advances = count($advances); |
1359 | - $average = round(($count_done_advances*100)/$count_total_advances); |
|
1359 | + $average = round(($count_done_advances * 100) / $count_total_advances); |
|
1360 | 1360 | } |
1361 | 1361 | |
1362 | 1362 | return $average; |
@@ -1447,12 +1447,12 @@ discard block |
||
1447 | 1447 | public function get_default_thematic_plan_title() |
1448 | 1448 | { |
1449 | 1449 | $default_thematic_plan_titles = array(); |
1450 | - $default_thematic_plan_titles[1]= get_lang('Objectives'); |
|
1451 | - $default_thematic_plan_titles[2]= get_lang('SkillToAcquire'); |
|
1452 | - $default_thematic_plan_titles[3]= get_lang('Methodology'); |
|
1453 | - $default_thematic_plan_titles[4]= get_lang('Infrastructure'); |
|
1454 | - $default_thematic_plan_titles[5]= get_lang('Assessment'); |
|
1455 | - $default_thematic_plan_titles[6]= get_lang('Others'); |
|
1450 | + $default_thematic_plan_titles[1] = get_lang('Objectives'); |
|
1451 | + $default_thematic_plan_titles[2] = get_lang('SkillToAcquire'); |
|
1452 | + $default_thematic_plan_titles[3] = get_lang('Methodology'); |
|
1453 | + $default_thematic_plan_titles[4] = get_lang('Infrastructure'); |
|
1454 | + $default_thematic_plan_titles[5] = get_lang('Assessment'); |
|
1455 | + $default_thematic_plan_titles[6] = get_lang('Others'); |
|
1456 | 1456 | |
1457 | 1457 | return $default_thematic_plan_titles; |
1458 | 1458 | } |
@@ -1464,12 +1464,12 @@ discard block |
||
1464 | 1464 | public function get_default_thematic_plan_icon() |
1465 | 1465 | { |
1466 | 1466 | $default_thematic_plan_icon = array(); |
1467 | - $default_thematic_plan_icon[1]= 'icons/32/objective.png'; |
|
1468 | - $default_thematic_plan_icon[2]= 'icons/32/skills.png'; |
|
1469 | - $default_thematic_plan_icon[3]= 'icons/32/strategy.png'; |
|
1470 | - $default_thematic_plan_icon[4]= 'icons/32/laptop.png'; |
|
1471 | - $default_thematic_plan_icon[5]= 'icons/32/assessment.png'; |
|
1472 | - $default_thematic_plan_icon[6]= 'icons/32/wizard.png'; |
|
1467 | + $default_thematic_plan_icon[1] = 'icons/32/objective.png'; |
|
1468 | + $default_thematic_plan_icon[2] = 'icons/32/skills.png'; |
|
1469 | + $default_thematic_plan_icon[3] = 'icons/32/strategy.png'; |
|
1470 | + $default_thematic_plan_icon[4] = 'icons/32/laptop.png'; |
|
1471 | + $default_thematic_plan_icon[5] = 'icons/32/assessment.png'; |
|
1472 | + $default_thematic_plan_icon[6] = 'icons/32/wizard.png'; |
|
1473 | 1473 | |
1474 | 1474 | return $default_thematic_plan_icon; |
1475 | 1475 | } |
@@ -1481,11 +1481,11 @@ discard block |
||
1481 | 1481 | public function get_default_question() |
1482 | 1482 | { |
1483 | 1483 | $question = array(); |
1484 | - $question[1]= get_lang('ObjectivesQuestions'); |
|
1485 | - $question[2]= get_lang('SkillToAcquireQuestions'); |
|
1486 | - $question[3]= get_lang('MethodologyQuestions'); |
|
1487 | - $question[4]= get_lang('InfrastructureQuestions'); |
|
1488 | - $question[5]= get_lang('AssessmentQuestions'); |
|
1484 | + $question[1] = get_lang('ObjectivesQuestions'); |
|
1485 | + $question[2] = get_lang('SkillToAcquireQuestions'); |
|
1486 | + $question[3] = get_lang('MethodologyQuestions'); |
|
1487 | + $question[4] = get_lang('InfrastructureQuestions'); |
|
1488 | + $question[5] = get_lang('AssessmentQuestions'); |
|
1489 | 1489 | |
1490 | 1490 | return $question; |
1491 | 1491 | } |
@@ -6,9 +6,9 @@ |
||
6 | 6 | */ |
7 | 7 | class Rights { |
8 | 8 | private static $rights_cache = array(); |
9 | - private static $rights = array ( |
|
9 | + private static $rights = array( |
|
10 | 10 | 'show_tabs:reports' => |
11 | - array ( |
|
11 | + array( |
|
12 | 12 | 'type' => 'const', |
13 | 13 | 'const' => 'true' ) |
14 | 14 | ); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | $new_data_order = array(); |
159 | 159 | if (!empty($docs_to_sort)) { |
160 | - foreach($docs_to_sort as $id => $document) { |
|
160 | + foreach ($docs_to_sort as $id => $document) { |
|
161 | 161 | if (isset($new_data[$id])) { |
162 | 162 | $new_data_order[] = $new_data[$id]; |
163 | 163 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | if (!empty($folder_to_sort)) { |
168 | - foreach($folder_to_sort as $id => $document) { |
|
168 | + foreach ($folder_to_sort as $id => $document) { |
|
169 | 169 | if (isset($new_data[$id])) { |
170 | 170 | $new_data_order[] = $new_data[$id]; |
171 | 171 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | //extra options |
426 | 426 | $plugin_settings = api_get_settings_params( |
427 | 427 | array( |
428 | - "subkey = ? AND category = ? AND type = ? " => array($plugin_name, 'Plugins','setting') |
|
428 | + "subkey = ? AND category = ? AND type = ? " => array($plugin_name, 'Plugins', 'setting') |
|
429 | 429 | ) |
430 | 430 | ); |
431 | 431 | $settings_filtered = array(); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | if (!empty($obj->course_settings)) { |
531 | 531 | if (is_file(api_get_path(SYS_CODE_PATH).'img/icons/'.ICON_SIZE_SMALL.'/'.$plugin_name.'.png')) { |
532 | 532 | $icon = Display::return_icon( |
533 | - $plugin_name . '.png', |
|
533 | + $plugin_name.'.png', |
|
534 | 534 | Security::remove_XSS($pluginTitle), |
535 | 535 | '', |
536 | 536 | ICON_SIZE_SMALL |
@@ -34,9 +34,9 @@ |
||
34 | 34 | public $search_did = 0; |
35 | 35 | public $audio = ""; |
36 | 36 | |
37 | - public function __construct($in_c_id=0, $in_id=0) |
|
37 | + public function __construct($in_c_id = 0, $in_id = 0) |
|
38 | 38 | { |
39 | - if ($in_c_id > 0 && $in_id >0) { |
|
39 | + if ($in_c_id > 0 && $in_id > 0) { |
|
40 | 40 | $item_view_table = Database::get_course_table(TABLE_LP_ITEM); |
41 | 41 | $sql = "SELECT * FROM $item_view_table |
42 | 42 | WHERE |