diff --git a/main/admin/career_dashboard.php b/main/admin/career_dashboard.php index 9dfd3bbd1b..98a2201b97 100755 --- a/main/admin/career_dashboard.php +++ b/main/admin/career_dashboard.php @@ -8,7 +8,10 @@ $cidReset = true; require_once __DIR__.'/../inc/global.inc.php'; -api_protect_admin_script(); + +$allowCareer = api_get_configuration_value('allow_session_admin_read_careers'); + +api_protect_admin_script($allowCareer); $this_section = SECTION_PLATFORM_ADMIN; @@ -74,15 +77,18 @@ $actionLeft .= Display::url( ), 'careers.php' ); -$actionLeft .= Display::url( - Display::return_icon( - 'promotion.png', - get_lang('Promotions'), - null, - ICON_SIZE_MEDIUM - ), - 'promotions.php' -); + +if (api_is_platform_admin()) { + $actionLeft .= Display::url( + Display::return_icon( + 'promotion.png', + get_lang('Promotions'), + null, + ICON_SIZE_MEDIUM + ), + 'promotions.php' + ); +} $actions = Display::toolbarAction('toolbar-career', array($actionLeft)); $html .= $form->returnForm(); diff --git a/main/admin/career_diagram.php b/main/admin/career_diagram.php index 42ceda94b9..0e591d0d87 100644 --- a/main/admin/career_diagram.php +++ b/main/admin/career_diagram.php @@ -25,7 +25,8 @@ if (api_get_configuration_value('allow_career_diagram') == false) { $this_section = SECTION_PLATFORM_ADMIN; -api_protect_admin_script(); +$allowCareer = api_get_configuration_value('allow_session_admin_read_careers'); +api_protect_admin_script($allowCareer); $htmlHeadXtra[] = api_get_js('jsplumb2.js'); diff --git a/main/admin/careers.php b/main/admin/careers.php index 264de07fc7..00b8271bcb 100755 --- a/main/admin/careers.php +++ b/main/admin/careers.php @@ -12,9 +12,10 @@ require_once __DIR__.'/../inc/global.inc.php'; $this_section = SECTION_PLATFORM_ADMIN; -api_protect_admin_script(); +$allowCareer = api_get_configuration_value('allow_session_admin_read_careers'); +api_protect_admin_script($allowCareer); -//Add the JS needed to use the jqgrid +// Add the JS needed to use the jqgrid $htmlHeadXtra[] = api_get_jqgrid_js(); // setting breadcrumbs @@ -43,8 +44,7 @@ if ($action == 'add') { $tool_name = get_lang('Careers'); } -// The header. -Display::display_header($tool_name); + //jqgrid will use this URL to do the selects $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_careers'; @@ -87,38 +87,32 @@ if ($allow) { $diagramLink = ''.get_lang('Diagram').''; } -//With this function we can add actions to the jgrid (edit, delete, etc) -$action_links = 'function action_formatter(cellvalue, options, rowObject) { - return \''.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).''. - $diagramLink. - ' '.Display::return_icon('copy.png', get_lang('Copy'), '', ICON_SIZE_SMALL).''. - ' '.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).''. - '\'; -}'; -?> - -'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).''. + $diagramLink. + ' '.Display::return_icon('copy.png', get_lang('Copy'), '', ICON_SIZE_SMALL).''. + ' '.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).''. + '\'; + }'; +} else { + $actionLinks = "function action_formatter(cellvalue, options, rowObject) { + return '".$diagramLink."'; + }"; +} + + $career = new Career(); +$content = ''; + +$listUrl = api_get_self(); // Action handling: Add switch ($action) { case 'add': + api_protect_admin_script(); + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true) ) { @@ -126,30 +120,34 @@ switch ($action) { } Session::write('notebook_view', 'creation_date'); - $url = api_get_self().'?action='.Security::remove_XSS($_GET['action']); + $url = api_get_self().'?action='.Security::remove_XSS($_GET['action']); $form = $career->return_form($url, 'add'); // The validation or display if ($form->validate()) { if ($check) { $values = $form->exportValues(); - $res = $career->save($values); + $res = $career->save($values); if ($res) { - echo Display::return_message(get_lang('ItemAdded'), 'confirmation'); + Display::addFlash( + Display::return_message(get_lang('ItemAdded'), 'confirmation') + ); } } - $career->display(); + header('Location: '.$listUrl); + exit; } else { - echo '