Adding ordering options in the main/session/index.php see BT#3567

skala
Julio Montoya 14 years ago
parent 634c3a6ebd
commit 58758902aa
  1. 24
      main/inc/ajax/course_home.ajax.php
  2. 8
      main/session/index.php

@ -106,8 +106,7 @@ switch ($action) {
case 'session_courses_lp_default':
require_once '../global.inc.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php';
$page = intval($_REQUEST['page']); //page
$limit = intval($_REQUEST['rows']); // quantity of rows
@ -143,12 +142,13 @@ switch ($action) {
if ($course_id != $item['id']) {
continue;
}
}
}
$list = new LearnpathList(api_get_user_id(), $item['code'], $session_id);
$flat_list = $list->get_flat_list();
$lps[$item['code']] = $flat_list;
$course_url = api_get_path(WEB_COURSE_PATH).$item['directory'].'/?id_session='.$session_id;
$item['title'] = Display::url($item['title'], $course_url, array('target'=>SESSION_LINK_TARGET));
foreach($flat_list as $lp_id => $lp_item) {
$temp[$count]['id']= $lp_id;
$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';
@ -186,10 +186,15 @@ switch ($action) {
}
$temp[$count]['cell']=array($date, $item['title'], Display::url($icons.' '.$lp_item['lp_name'], $lp_url, array('target'=>SESSION_LINK_TARGET)));
$temp[$count]['course'] = strip_tags($item['title']);
$temp[$count]['lp'] = $lp_item['lp_name'];
$temp[$count]['date'] = $lp_item['publicated_on'];
$count++;
}
}
$temp = msort($temp, $sidx, $sord);
$i =0;
$response = new stdClass();
foreach($temp as $key=>$row) {
@ -351,7 +356,7 @@ switch ($action) {
$page = intval($_REQUEST['page']); //page
$limit = intval($_REQUEST['rows']); // quantity of rows
$sidx = intval($_REQUEST['sidx']); //index to filter
$sidx = $_REQUEST['sidx']; //index to filter
$sord = $_REQUEST['sord']; //asc or desc
if (!in_array($sord, array('asc','desc'))) {
$sord = 'desc';
@ -424,10 +429,17 @@ switch ($action) {
continue;
}
}
$temp[$count]['cell']=array($date, $item['title'], Display::url($icons.' '.$lp_item['lp_name'], $lp_url, array('target'=>SESSION_LINK_TARGET)));
$temp[$count]['cell'] = array($date, $item['title'], Display::url($icons.' '.$lp_item['lp_name'], $lp_url, array('target'=>SESSION_LINK_TARGET)));
$temp[$count]['course'] = strip_tags($item['title']);
$temp[$count]['lp'] = $lp_item['lp_name'];
$temp[$count]['date'] = $lp_item['publicated_on'];
$count++;
}
}
}
$temp = msort($temp, $sidx, $sord);
$response = new stdClass();
$i =0;
foreach($temp as $key=>$row) {

@ -265,9 +265,9 @@ $extra_params_courses['autowidth'] = 'false'; //use the width of the parent
$url = api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=session_courses_lp_default&session_id='.$session_id.'&course_id='.$course_id;
$columns = array(get_lang('PublicationDate'),get_lang('Course'), get_lang('LearningPaths'));
$column_model = array(array('name'=>'date', 'index'=>'date', 'width'=>'120', 'align'=>'left', 'sortable'=>'false'),
array('name'=>'course', 'index'=>'course', 'width'=>'300', 'align'=>'left', 'sortable'=>'false'),
array('name'=>'lp', 'index'=>'lp', 'width'=>'440', 'align'=>'left', 'sortable'=>'false'));
$column_model = array(array('name'=>'date', 'index'=>'date', 'width'=>'120', 'align'=>'left', 'sortable'=>'true'),
array('name'=>'course', 'index'=>'course', 'width'=>'300', 'align'=>'left', 'sortable'=>'true'),
array('name'=>'lp', 'index'=>'lp', 'width'=>'440', 'align'=>'left', 'sortable'=>'true'));
$extra_params = array();
//$extra_params['autowidth'] = 'true'; //use the width of the parent
//$extra_params['forceFit'] = 'true'; //use the width of the parent
@ -276,7 +276,7 @@ $extra_params = array();
//Per course grid settings
$url_by_course = api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=session_courses_lp_by_course&session_id='.$session_id.'&course_id='.$course_id;
$extra_params_course['grouping'] = 'true';
$extra_params_course['groupingView'] = array('groupCollapse' => true,
$extra_params_course['groupingView'] = array('groupCollapse' => false,
'groupField' => array('course'),
'groupColumnShow' => array('false'),
'groupText' => array('<b>'.get_lang('Course').' {0}</b>'));

Loading…
Cancel
Save