|
@@ -116,7 +116,9 @@ if ($_REQUEST['_search'] == 'true') {
|
|
|
|
|
|
// get index row - i.e. user click to sort $sord = $_GET['sord'];
|
|
|
// get the direction
|
|
|
-if (!$sidx) $sidx = 1;
|
|
|
+if (!$sidx) {
|
|
|
+ $sidx = 1;
|
|
|
+}
|
|
|
|
|
|
//2. Selecting the count FIRST
|
|
|
//@todo rework this
|
|
@@ -246,7 +248,7 @@ if ($page > $total_pages) {
|
|
|
}
|
|
|
|
|
|
$start = $limit * $page - $limit;
|
|
|
-if ($start < 0 ) {
|
|
|
+if ($start < 0) {
|
|
|
$start = 0;
|
|
|
}
|
|
|
|
|
@@ -337,29 +339,24 @@ switch ($action) {
|
|
|
break;
|
|
|
case 'get_work_user_list':
|
|
|
if (isset($_GET['type']) && $_GET['type'] == 'simple') {
|
|
|
- //$columns = array('type', 'firstname', 'lastname', 'username', 'title', 'qualification', 'sent_date', 'qualificator_id', 'actions');
|
|
|
$columns = array('type', 'firstname', 'lastname', 'title', 'qualification', 'sent_date', 'qualificator_id', 'actions');
|
|
|
} else {
|
|
|
- //$columns = array('type', 'firstname', 'lastname', 'username', 'title', 'sent_date', 'actions');
|
|
|
$columns = array('type', 'firstname', 'lastname', 'title', 'sent_date', 'actions');
|
|
|
}
|
|
|
$where_condition .= " AND u.user_id = ".api_get_user_id();
|
|
|
$result = get_work_user_list($start, $limit, $sidx, $sord, $work_id, $where_condition);
|
|
|
break;
|
|
|
case 'get_exercise_results':
|
|
|
- $course = api_get_course_info();
|
|
|
+ $course = api_get_course_info();
|
|
|
//used inside get_exam_results_data()
|
|
|
$documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
|
|
|
if ($is_allowedToEdit) {
|
|
|
$columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_duration', 'start_date', 'exe_date', 'score', 'status', 'lp', 'actions');
|
|
|
- } else {
|
|
|
- //$columns = array('exe_duration', 'start_date', 'exe_date', 'score', 'status', 'actions');
|
|
|
}
|
|
|
$result = get_exam_results_data($start, $limit, $sidx, $sord, $exercise_id, $where_condition);
|
|
|
break;
|
|
|
case 'get_hotpotatoes_exercise_results':
|
|
|
$course = api_get_course_info();
|
|
|
- //used inside get_exam_results_data()
|
|
|
$documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
|
|
|
$columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions');
|
|
|
$result = get_exam_results_hotpotatoes_data($start, $limit, $sidx, $sord, $hotpot_path, $where_condition); //get_exam_results_data($start, $limit, $sidx, $sord, $exercise_id, $where_condition);
|
|
@@ -370,7 +367,6 @@ switch ($action) {
|
|
|
break;
|
|
|
case 'get_timelines':
|
|
|
$columns = array('headline', 'actions');
|
|
|
- //$columns = array('headline', 'type', 'start_date', 'end_date', 'text', 'media', 'media_credit', 'media_caption', 'title_slide', 'parent_id');
|
|
|
|
|
|
if(!in_array($sidx, $columns)) {
|
|
|
$sidx = 'headline';
|
|
@@ -407,8 +403,6 @@ switch ($action) {
|
|
|
//Fixes bug when gradebook doesn't have names
|
|
|
if (empty($item['name'])) {
|
|
|
$item['name'] = $item['course_code'];
|
|
|
- } else {
|
|
|
- //$item['name'] = $item['name'].' ['.$item['course_code'].']';
|
|
|
}
|
|
|
|
|
|
$item['name'] = Display::url($item['name'], api_get_path(WEB_CODE_PATH).'gradebook/index.php?id_session=0&cidReq='.$item['course_code']);
|
|
@@ -451,7 +445,7 @@ switch ($action) {
|
|
|
break;
|
|
|
case 'get_careers':
|
|
|
$columns = array('name', 'description', 'actions');
|
|
|
- if(!in_array($sidx, $columns)) {
|
|
|
+ if (!in_array($sidx, $columns)) {
|
|
|
$sidx = 'name';
|
|
|
}
|
|
|
$result = Database::select('*', $obj->table, array('order'=>"$sidx $sord", 'LIMIT'=> "$start , $limit"));
|
|
@@ -469,7 +463,13 @@ switch ($action) {
|
|
|
if(!in_array($sidx, $columns)) {
|
|
|
$sidx = 'name';
|
|
|
}
|
|
|
- $result = Database::select('p.id,p.name, p.description, c.name as career, p.status', "$obj->table p LEFT JOIN ".Database::get_main_table(TABLE_CAREER)." c ON c.id = p.career_id ", array('order' =>"$sidx $sord", 'LIMIT'=> "$start , $limit"));
|
|
|
+
|
|
|
+ $result = Database::select(
|
|
|
+ 'p.id,p.name, p.description, c.name as career, p.status',
|
|
|
+ "$obj->table p LEFT JOIN ".Database::get_main_table(TABLE_CAREER)." c ON c.id = p.career_id ",
|
|
|
+ array('order' => "$sidx $sord", 'LIMIT'=> "$start , $limit")
|
|
|
+ );
|
|
|
+
|
|
|
$new_result = array();
|
|
|
foreach($result as $item) {
|
|
|
if (!$item['status']) {
|
|
@@ -515,17 +515,6 @@ switch ($action) {
|
|
|
$obj = new ExtraFieldOption($type);
|
|
|
$columns = array('option_display_text', 'option_value', 'option_order');
|
|
|
$result = Database::select('*', $obj->table, array('where' => array("field_id = ? " => $field_id),'order'=>"$sidx $sord", 'LIMIT'=> "$start , $limit"));
|
|
|
- /*$new_result = array();
|
|
|
- if (!empty($result)) {
|
|
|
- foreach ($result as $item) {
|
|
|
- $item['field_type'] = $obj->get_field_type_by_id($item['field_type']);
|
|
|
- $item['field_changeable'] = $item['field_changeable'] ? Display::return_icon('right.gif') : Display::return_icon('wrong.gif');
|
|
|
- $item['field_visible'] = $item['field_visible'] ? Display::return_icon('right.gif') : Display::return_icon('wrong.gif');
|
|
|
- $item['field_filter'] = $item['field_filter'] ? Display::return_icon('right.gif') : Display::return_icon('wrong.gif');
|
|
|
- $new_result[] = $item;
|
|
|
- }
|
|
|
- $result = $new_result;
|
|
|
- }*/
|
|
|
break;
|
|
|
case 'get_usergroups_teacher':
|
|
|
$columns = array('name', 'users', 'actions');
|
|
@@ -562,7 +551,7 @@ switch ($action) {
|
|
|
$sidx = 'name';
|
|
|
}
|
|
|
//Multidimensional sort
|
|
|
- msort($result, $sidx);
|
|
|
+ $result = msort($result, $sidx, $sord);
|
|
|
break;
|
|
|
default:
|
|
|
exit;
|