From ca8508a2d9ca63526966023dcf7dd7df6b88cfe2 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 24 Jan 2011 12:58:32 +0100 Subject: [PATCH] Adding links and courses in the careers dashboard see BT#1619 --- main/admin/career_dashboard.php | 81 ++++++++++++++++++++------------- main/inc/lib/display.lib.php | 3 ++ 2 files changed, 52 insertions(+), 32 deletions(-) diff --git a/main/admin/career_dashboard.php b/main/admin/career_dashboard.php index 5e7aeafdc8..e0bf8b137b 100644 --- a/main/admin/career_dashboard.php +++ b/main/admin/career_dashboard.php @@ -1,4 +1,6 @@ '; $htmlHeadXtra[] = ''; //jQuery $htmlHeadXtra[] = ''; -//Grid js +//Grid js $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; @@ -33,9 +33,8 @@ Display :: display_header($nameTools); // action links echo '
'; -echo ''.Display::return_icon('filenew.gif',get_lang('Add')).get_lang('Careers').''; -echo ''.Display::return_icon('filenew.gif',get_lang('Add')).get_lang('Promotions').''; - + echo ''.Display::return_icon('filenew.gif',get_lang('Add')).get_lang('Careers').''; + echo ''.Display::return_icon('filenew.gif',get_lang('Add')).get_lang('Promotions').''; echo '
'; @@ -58,8 +57,9 @@ if (!empty($careers)) { $sessions = SessionManager::get_all_sessions_by_promotion($promotion_item['id']); $session_list = array(); - foreach($sessions as $session_item) { - $session_list[] = $session_item; + foreach($sessions as $session_item) { + $course_list = SessionManager::get_course_list_by_session_id($session_item['id']); + $session_list[] = array('data'=>$session_item,'courses'=>$course_list); } $promotion_array[$promotion_item['id']] =array('name'=>$promotion_item['name'], 'sessions'=>$session_list); } @@ -72,31 +72,48 @@ echo ''; foreach($career_array as $career_id => $data) { $career = $data['name']; - $promotions = $data['promotions']; - echo ''; - foreach($promotions as $promotion) { - $promotion_name = $promotion['name']; - $sessions = $promotion['sessions']; - echo ''; - $count = count($sessions); - $rowspan = ''; - if (!empty($count )) { + $promotions = $data['promotions']; + $career = Display::url($career,'careers.php?action=edit&id='.$career_id); + echo ''; + foreach($promotions as $promotion_id => $promotion) { + $promotion_name = $promotion['name']; + $promotion_url = Display::url($promotion_name,'promotions.php?action=edit&id='.$promotion_id); + $sessions = $promotion['sessions']; + echo ''; + $count = count($sessions); + $rowspan = ''; + if (!empty($count)) { $count++; - $rowspan = 'rowspan="'.$count.'"'; - } - echo ''; - echo ''; - - - foreach($sessions as $session) { - echo ''; - echo Display::tag('td',$session['name']); - echo ''; - } - } - + $rowspan = 'rowspan="'.$count.'"'; + } + echo ''; + echo ''; + + if (!empty($sessions)) + foreach($sessions as $session) { + $course_list = $session['courses']; + + $url = Display::url($session['data']['name'], 'resume_session.php?id_session='.$session['data']['id']); + echo ''; + //Session name + echo Display::tag('td',$url); + echo ''; + echo ''; + } + } } echo '
'.$career.'
'.$career.'
'; - echo $promotion_name; - echo '
'; + echo $promotion_url; + echo '
'; + //Courses + echo ''; + foreach($course_list as $course) { + echo ''; + + $url = Display::url($course['title'], api_get_path(WEB_COURSE_PATH).$course['directory'].'/?id_session='.$session['data']['id']); + echo Display::tag('td',$url); + echo ''; + } + echo '
'; + echo '
'; Display::display_footer(); \ No newline at end of file diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 2af4406b7f..56e300b6f4 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -703,6 +703,9 @@ class Display { return $return_value; } + /** + * Creates a URL anchor + */ public static function url($name, $url, $extra_attributes = array()) { if (!empty($url)) { $extra_attributes['href']= $url;