From 1f468b90562f2f14188501c36d489c99141790ea Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 19 Sep 2012 17:01:46 +0200 Subject: [PATCH] Minor cosmetic fixes --- main/attendance/attendance_controller.php | 7 +++---- main/attendance/attendance_list.php | 4 ++-- main/attendance/index.php | 13 +++++-------- main/inc/lib/attendance.lib.php | 12 +++++++++--- main/inc/lib/tracking.lib.php | 4 ++-- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/main/attendance/attendance_controller.php b/main/attendance/attendance_controller.php index 63ed063313..7c399567e3 100644 --- a/main/attendance/attendance_controller.php +++ b/main/attendance/attendance_controller.php @@ -34,10 +34,9 @@ * @param boolean true for listing history (optional) * @param array message for showing by action['edit','add','delete'] (optional) */ - public function attendance_list($history=false,$messages=array()) { - - $attendance = new Attendance(); - $data = array(); + public function attendance_list($history=false,$messages=array()) { + $attendance = new Attendance(); + $data = array(); // render to the view $this->view->set_data($data); diff --git a/main/attendance/attendance_list.php b/main/attendance/attendance_list.php index 37b3e044cc..146a66c266 100644 --- a/main/attendance/attendance_list.php +++ b/main/attendance/attendance_list.php @@ -10,7 +10,7 @@ // protect a course script api_protect_course_script(true); -if (api_is_allowed_to_edit(null, true)) { +if (api_is_allowed_to_edit(null, true)) { $param_gradebook = ''; if (isset($_SESSION['gradebook'])) { $param_gradebook = '&gradebook='.Security::remove_XSS($_SESSION['gradebook']); @@ -19,7 +19,7 @@ if (api_is_allowed_to_edit(null, true)) { echo ''.Display::return_icon('new_attendance_list.png',get_lang('CreateANewAttendance'),'',ICON_SIZE_MEDIUM).''; echo ''; } - + $table = new SortableTable('attendance_list', array('Attendance', 'get_number_of_attendances'), array('Attendance', 'get_attendance_data'), $default_column); $table->set_additional_parameters($parameters); $table->set_header(0, '', false, array('style'=>'width:20px;')); diff --git a/main/attendance/index.php b/main/attendance/index.php index 92ce2a3da1..8fa6f53cd7 100644 --- a/main/attendance/index.php +++ b/main/attendance/index.php @@ -40,9 +40,9 @@ $actions = array( 'attendance_delete', 'attendance_delete_select', 'attendance_restore', - 'attendance_sheet_export_to_pdf', - + 'attendance_sheet_export_to_pdf' ); + $actions_calendar = array('calendar_list', 'calendar_add', 'calendar_edit', 'calendar_delete', 'calendar_all_delete'); $action = 'attendance_list'; @@ -114,7 +114,6 @@ $(function() { $(".row_odd td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#dcdcdc", "border-left":"1px #bbb solid", "border-right":"1px #bbb solid", "z-index":"1" }); $(".row_even td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#eee", "border-left":"1px #bbb solid", "border-right":"1px #bbb solid", "z-index":"1" }); - $(".checkboxes_col_"+calendar_id).mouseover(function() { //$(".checkbox_head_"+calendar_id).removeAttr("opacity"); //$("row_even td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"red", "border-left":"1px #EEEE00 solid", "border-right":"1px #EEEE00 solid" , "border-bottom":"1px #ccc solid" }); @@ -122,9 +121,8 @@ $(function() { }); $(".checkboxes_col_"+calendar_id).mouseout(function() { - // $("row_even td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#F9F9F9", "border-left":"1px #EEEE00 solid", "border-right":"1px #EEEE00 solid" , "border-bottom":"1px #ccc solid" }); - // $("row_odd td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#FFF", "border-left":"1px #EEEE00 solid", "border-right":"1px #EEEE00 solid" , "border-bottom":"1px #ccc solid" }); - + // $("row_even td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#F9F9F9", "border-left":"1px #EEEE00 solid", "border-right":"1px #EEEE00 solid" , "border-bottom":"1px #ccc solid" }); + // $("row_odd td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#FFF", "border-left":"1px #EEEE00 solid", "border-right":"1px #EEEE00 solid" , "border-bottom":"1px #ccc solid" }); }); $(".checkboxes_col_"+calendar_id+" input:checkbox").attr("disabled",false); @@ -148,7 +146,7 @@ $(function() { } else { $(".checkboxes_col_"+calendar_id+" input:checkbox").attr("checked",false); } - }); + }); $(".attendance-sheet-content .row_odd, .attendance-sheet-content .row_even").mouseover(function() { $(".row_odd").css({"background-color":"#F9F9F9"}); @@ -218,7 +216,6 @@ if ($action == 'calendar_add') { if (isset($_POST['action']) && $_POST['action'] == 'attendance_delete_select') { $attendance_controller->attendance_delete($_POST['id']); } - // distpacher actions to controller switch ($action) { case 'attendance_list': diff --git a/main/inc/lib/attendance.lib.php b/main/inc/lib/attendance.lib.php index a4770d52e2..b482e11f24 100644 --- a/main/inc/lib/attendance.lib.php +++ b/main/inc/lib/attendance.lib.php @@ -98,11 +98,17 @@ class Attendance $column = intval($column); $from = intval($from); $number_of_items = intval($number_of_items); - if (!in_array($direction, array('ASC','DESC'))) { + + if (!in_array($direction, array('ASC','DESC'))) { $direction = 'ASC'; } + $active_plus = 'att.active = 1'; - if (api_is_platform_admin()) { $active_plus = ' 1=1 ';} + + if (api_is_platform_admin()) { + $active_plus = ' 1=1 '; + } + $sql = "SELECT att.id AS col0, att.name AS col1, @@ -113,7 +119,7 @@ class Attendance att.session_id FROM $tbl_attendance att WHERE c_id = $course_id AND $active_plus $condition_session - ORDER BY col$column $direction LIMIT $from,$number_of_items "; + ORDER BY col$column $direction LIMIT $from,$number_of_items "; $res = Database::query($sql); $attendances = array (); diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php index c3f26b6379..73baae5322 100644 --- a/main/inc/lib/tracking.lib.php +++ b/main/inc/lib/tracking.lib.php @@ -2117,7 +2117,7 @@ class Tracking { * @param int user id * @return string html code */ - function show_user_progress($user_id, $session_id = 0, $extra_params = '', $show_courses = true) { + static function show_user_progress($user_id, $session_id = 0, $extra_params = '', $show_courses = true) { global $_configuration; $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE); $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); @@ -2557,7 +2557,7 @@ class Tracking { * @param int session id * @return string html code */ - function show_course_detail($user_id, $course_code, $session_id) { + static function show_course_detail($user_id, $course_code, $session_id) { $html = ''; if (isset($course_code)) {