|
|
@ -15,10 +15,9 @@ require_once __DIR__.'/../inc/global.inc.php'; |
|
|
|
$this_section = SECTION_PLATFORM_ADMIN; |
|
|
|
$this_section = SECTION_PLATFORM_ADMIN; |
|
|
|
$_SESSION['this_section'] = $this_section; |
|
|
|
$_SESSION['this_section'] = $this_section; |
|
|
|
|
|
|
|
|
|
|
|
$action = isset($_GET['action']) ? $_GET['action'] : null; |
|
|
|
$action = $_GET['action'] ?? null; |
|
|
|
$action_todo = false; |
|
|
|
$action_todo = false; |
|
|
|
|
|
|
|
|
|
|
|
// Access restrictions |
|
|
|
|
|
|
|
api_protect_admin_script(true); |
|
|
|
api_protect_admin_script(true); |
|
|
|
|
|
|
|
|
|
|
|
$allowCareers = api_get_configuration_value('allow_careers_in_global_announcements'); |
|
|
|
$allowCareers = api_get_configuration_value('allow_careers_in_global_announcements'); |
|
|
@ -41,13 +40,13 @@ if (!empty($action)) { |
|
|
|
"url" => "system_announcements.php", |
|
|
|
"url" => "system_announcements.php", |
|
|
|
"name" => get_lang('Portal news'), |
|
|
|
"name" => get_lang('Portal news'), |
|
|
|
]; |
|
|
|
]; |
|
|
|
if ('add' == $action) { |
|
|
|
if ('add' === $action) { |
|
|
|
$interbreadcrumb[] = [ |
|
|
|
$interbreadcrumb[] = [ |
|
|
|
"url" => '#', |
|
|
|
"url" => '#', |
|
|
|
"name" => get_lang('Add an announcement'), |
|
|
|
"name" => get_lang('Add an announcement'), |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
if ('edit' == $action) { |
|
|
|
if ('edit' === $action) { |
|
|
|
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Edit')]; |
|
|
|
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Edit')]; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -82,10 +81,10 @@ function showCareer() { |
|
|
|
} |
|
|
|
} |
|
|
|
</script>'; |
|
|
|
</script>'; |
|
|
|
|
|
|
|
|
|
|
|
// Displaying the header. |
|
|
|
|
|
|
|
Display::display_header($tool_name); |
|
|
|
Display::display_header($tool_name); |
|
|
|
if ('add' !== $action && 'edit' !== $action) { |
|
|
|
if ('add' !== $action && 'edit' !== $action) { |
|
|
|
$actions = '<a href="?action=add">'.Display::return_icon('add.png', get_lang('Add an announcement'), [], 32).'</a>'; |
|
|
|
$actions = '<a href="?action=add">'. |
|
|
|
|
|
|
|
Display::return_icon('add.png', get_lang('Add an announcement'), [], 32).'</a>'; |
|
|
|
echo Display::toolbarAction('toolbar', [$actions]); |
|
|
|
echo Display::toolbarAction('toolbar', [$actions]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -166,10 +165,10 @@ switch ($action) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($action_todo) { |
|
|
|
if ($action_todo) { |
|
|
|
if (isset($_REQUEST['action']) && 'add' == $_REQUEST['action']) { |
|
|
|
if ('add' === $action) { |
|
|
|
$form_title = get_lang('Add news'); |
|
|
|
$form_title = get_lang('Add news'); |
|
|
|
$url = api_get_self(); |
|
|
|
$url = api_get_self(); |
|
|
|
} elseif (isset($_REQUEST['action']) && 'edit' == $_REQUEST['action']) { |
|
|
|
} elseif ('edit' === $action) { |
|
|
|
$form_title = get_lang('Edit News'); |
|
|
|
$form_title = get_lang('Edit News'); |
|
|
|
$url = api_get_self().'?id='.intval($_GET['id']); |
|
|
|
$url = api_get_self().'?id='.intval($_GET['id']); |
|
|
|
} |
|
|
|
} |
|
|
@ -199,7 +198,7 @@ if ($action_todo) { |
|
|
|
); |
|
|
|
); |
|
|
|
$form->addDateRangePicker( |
|
|
|
$form->addDateRangePicker( |
|
|
|
'range', |
|
|
|
'range', |
|
|
|
get_lang('StartTimeWindow'), |
|
|
|
get_lang('Start'), |
|
|
|
true, |
|
|
|
true, |
|
|
|
['id' => 'range'] |
|
|
|
['id' => 'range'] |
|
|
|
); |
|
|
|
); |
|
|
@ -213,7 +212,11 @@ if ($action_todo) { |
|
|
|
'career_id', |
|
|
|
'career_id', |
|
|
|
get_lang('Career'), |
|
|
|
get_lang('Career'), |
|
|
|
$list, |
|
|
|
$list, |
|
|
|
['onchange' => 'javascript: showCareer();', 'placeholder' => get_lang('SelectAnOption'), 'id' => 'career_id'] |
|
|
|
[ |
|
|
|
|
|
|
|
'onchange' => 'javascript: showCareer();', |
|
|
|
|
|
|
|
'placeholder' => get_lang('SelectAnOption'), |
|
|
|
|
|
|
|
'id' => 'career_id', |
|
|
|
|
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$display = 'none;'; |
|
|
|
$display = 'none;'; |
|
|
@ -273,12 +276,6 @@ if ($action_todo) { |
|
|
|
error_log($e); |
|
|
|
error_log($e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$form->addDateRangePicker( |
|
|
|
|
|
|
|
'range', |
|
|
|
|
|
|
|
get_lang('Start'), |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
['id' => 'range'] |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$group = []; |
|
|
|
$group = []; |
|
|
|
foreach ($visibleList as $key => $name) { |
|
|
|
foreach ($visibleList as $key => $name) { |
|
|
@ -309,12 +306,12 @@ if ($action_todo) { |
|
|
|
$values['group'] = isset($values['group']) ? $values['group'] : '0'; |
|
|
|
$values['group'] = isset($values['group']) ? $values['group'] : '0'; |
|
|
|
$form->addElement('checkbox', 'send_mail', null, get_lang('Send mail')); |
|
|
|
$form->addElement('checkbox', 'send_mail', null, get_lang('Send mail')); |
|
|
|
|
|
|
|
|
|
|
|
if (isset($_REQUEST['action']) && 'add' == $_REQUEST['action']) { |
|
|
|
if ('add' === $action) { |
|
|
|
$form->addElement('checkbox', 'add_to_calendar', null, get_lang('Add to calendar')); |
|
|
|
$form->addElement('checkbox', 'add_to_calendar', null, get_lang('Add to calendar')); |
|
|
|
$text = get_lang('Add news'); |
|
|
|
$text = get_lang('Add news'); |
|
|
|
$class = 'add'; |
|
|
|
$class = 'add'; |
|
|
|
$form->addElement('hidden', 'action', 'add'); |
|
|
|
$form->addElement('hidden', 'action', 'add'); |
|
|
|
} elseif (isset($_REQUEST['action']) && 'edit' == $_REQUEST['action']) { |
|
|
|
} elseif ('edit' === $action) { |
|
|
|
$text = get_lang('Edit News'); |
|
|
|
$text = get_lang('Edit News'); |
|
|
|
$class = 'save'; |
|
|
|
$class = 'save'; |
|
|
|
$form->addElement('hidden', 'action', 'edit'); |
|
|
|
$form->addElement('hidden', 'action', 'edit'); |
|
|
@ -459,7 +456,13 @@ if ($show_announcement_list) { |
|
|
|
$row[] = "<a href=\"?id=".$announcement->id."&person=".SystemAnnouncementManager::VISIBLE_GUEST."&action=".($announcement->visible_guest ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_guest ? 'eyes.png' : 'eyes-close.png'), get_lang('Show/Hide'))."</a>";*/ |
|
|
|
$row[] = "<a href=\"?id=".$announcement->id."&person=".SystemAnnouncementManager::VISIBLE_GUEST."&action=".($announcement->visible_guest ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_guest ? 'eyes.png' : 'eyes-close.png'), get_lang('Show/Hide'))."</a>";*/ |
|
|
|
|
|
|
|
|
|
|
|
$row[] = $announcement->lang; |
|
|
|
$row[] = $announcement->lang; |
|
|
|
$row[] = "<a href=\"?action=edit&id=".$announcement->id."\">".Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL)."</a> <a href=\"?action=delete&id=".$announcement->id."\" title=".addslashes(api_htmlentities(get_lang('Please confirm your choice')))." class='delete-swal' >".Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL)."</a>"; |
|
|
|
$row[] = "<a href=\"?action=edit&id=".$announcement->id."\">". |
|
|
|
|
|
|
|
Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL)."</a> |
|
|
|
|
|
|
|
<a |
|
|
|
|
|
|
|
href=\"?action=delete&id=".$announcement->id."\" |
|
|
|
|
|
|
|
title=".addslashes(api_htmlentities(get_lang('Please confirm your choice')))." class='delete-swal' >". |
|
|
|
|
|
|
|
Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL). |
|
|
|
|
|
|
|
"</a>"; |
|
|
|
$announcement_data[] = $row; |
|
|
|
$announcement_data[] = $row; |
|
|
|
} |
|
|
|
} |
|
|
|
$table = new SortableTableFromArray($announcement_data); |
|
|
|
$table = new SortableTableFromArray($announcement_data); |
|
|
@ -483,4 +486,4 @@ if ($show_announcement_list) { |
|
|
|
$table->display(); |
|
|
|
$table->display(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Display :: display_footer(); |
|
|
|
Display::display_footer(); |
|
|
|