|
|
|
|
@ -9,6 +9,7 @@ $cidReset = true; |
|
|
|
|
require_once __DIR__.'/../inc/global.inc.php'; |
|
|
|
|
|
|
|
|
|
$allowCareer = api_get_configuration_value('allow_session_admin_read_careers'); |
|
|
|
|
$useCareerHierarchy = api_get_configuration_value('career_hierarchy_enable'); |
|
|
|
|
|
|
|
|
|
api_protect_admin_script($allowCareer); |
|
|
|
|
|
|
|
|
|
@ -29,6 +30,10 @@ $interbreadcrumb[] = [ |
|
|
|
|
$tpl = new Template(get_lang('CareersAndPromotions')); |
|
|
|
|
|
|
|
|
|
$html = null; |
|
|
|
|
$showHierarchy = $_GET['showHierarchy'] ?? null; |
|
|
|
|
if ($useCareerHierarchy && is_null($showHierarchy)) { |
|
|
|
|
$showHierarchy = 1; |
|
|
|
|
} |
|
|
|
|
$form = new FormValidator('filter_form', 'GET', api_get_self()); |
|
|
|
|
|
|
|
|
|
$career = new Career(); |
|
|
|
|
@ -57,6 +62,9 @@ $form->addSelect( |
|
|
|
|
); |
|
|
|
|
$form->addButtonSearch(get_lang('Filter')); |
|
|
|
|
|
|
|
|
|
if ($useCareerHierarchy && $showHierarchy == 1) { |
|
|
|
|
$form->addHidden('showHierarchy', '0'); |
|
|
|
|
} |
|
|
|
|
// action links |
|
|
|
|
$actionLeft = Display::url( |
|
|
|
|
Display::return_icon( |
|
|
|
|
@ -76,7 +84,29 @@ $actionLeft .= Display::url( |
|
|
|
|
), |
|
|
|
|
'careers.php' |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if ($useCareerHierarchy) { |
|
|
|
|
if ($showHierarchy) { |
|
|
|
|
$actionLeft .= Display::url( |
|
|
|
|
Display::return_icon( |
|
|
|
|
'forum_listview.png', |
|
|
|
|
get_lang('HideCareersHierarchy'), |
|
|
|
|
null, |
|
|
|
|
ICON_SIZE_MEDIUM |
|
|
|
|
), |
|
|
|
|
'career_dashboard.php?showHierarchy=0' |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
$actionLeft .= Display::url( |
|
|
|
|
Display::return_icon( |
|
|
|
|
'forum_nestedview.png', |
|
|
|
|
get_lang('ShowCareersHierarchy'), |
|
|
|
|
null, |
|
|
|
|
ICON_SIZE_MEDIUM |
|
|
|
|
), |
|
|
|
|
'career_dashboard.php?showHierarchy=1' |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (api_is_platform_admin()) { |
|
|
|
|
$actionLeft .= Display::url( |
|
|
|
|
Display::return_icon( |
|
|
|
|
@ -114,11 +144,12 @@ if (!empty($careers)) { |
|
|
|
|
continue; //avoid status = 0 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$session_list = []; |
|
|
|
|
// Getting all sessions from this promotion |
|
|
|
|
if (!$useCareerHierarchy || 0 == $showHierarchy) { |
|
|
|
|
$sessions = SessionManager::get_all_sessions_by_promotion( |
|
|
|
|
$promotion_item['id'] |
|
|
|
|
); |
|
|
|
|
$session_list = []; |
|
|
|
|
foreach ($sessions as $session_item) { |
|
|
|
|
$course_list = SessionManager::get_course_list_by_session_id($session_item['id']); |
|
|
|
|
$session_list[] = [ |
|
|
|
|
@ -126,6 +157,7 @@ if (!empty($careers)) { |
|
|
|
|
'courses' => $course_list, |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$promotion_array[$promotion_item['id']] = [ |
|
|
|
|
'id' => $promotion_item['id'], |
|
|
|
|
'name' => $promotion_item['name'], |
|
|
|
|
@ -143,9 +175,16 @@ if (!empty($careers)) { |
|
|
|
|
$careers[$career_item['id']]['career'] = $careerList; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($useCareerHierarchy && 1 == $showHierarchy) { |
|
|
|
|
$careers = $career->orderCareersByHierarchy($careers); |
|
|
|
|
} |
|
|
|
|
$tpl->assign('actions', $actions); |
|
|
|
|
$tpl->assign('form_filter', $html); |
|
|
|
|
$tpl->assign('data', $careers); |
|
|
|
|
$layout = $tpl->get_template('admin/career_dashboard.tpl'); |
|
|
|
|
|
|
|
|
|
if ($useCareerHierarchy && 1 == $showHierarchy) { |
|
|
|
|
$layout = $tpl->get_template('admin/career_dashboard_hierarchy.tpl'); |
|
|
|
|
} else { |
|
|
|
|
$layout = $tpl->get_template('admin/career_dashboard.tpl'); |
|
|
|
|
} |
|
|
|
|
$tpl->display($layout); |
|
|
|
|
|