Minor - format code, fix lang vars

pull/3890/head
Julio Montoya 4 years ago
parent 4671c20c57
commit 854a9c46cd
  1. 43
      public/main/admin/system_announcements.php
  2. 20
      public/main/inc/lib/sessionmanager.lib.php

@ -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();

@ -7974,7 +7974,7 @@ class SessionManager
'session_visibility', 'session_visibility',
null, null,
[ [
SESSION_VISIBLE_READ_ONLY => get_lang('SessionRead only'), SESSION_VISIBLE_READ_ONLY => get_lang('Read only'),
SESSION_VISIBLE => get_lang('Accessible'), SESSION_VISIBLE => get_lang('Accessible'),
SESSION_INVISIBLE => api_ucfirst(get_lang('Not accessible')), SESSION_INVISIBLE => api_ucfirst(get_lang('Not accessible')),
] ]
@ -8016,13 +8016,13 @@ class SessionManager
// Dates // Dates
$form->addDateTimePicker( $form->addDateTimePicker(
'access_start_date', 'access_start_date',
[get_lang('Access start date'), get_lang('Access start dateComment')], [get_lang('Access start date'), get_lang('Date on which the session is made available to all')],
['id' => 'access_start_date'] ['id' => 'access_start_date']
); );
$form->addDateTimePicker( $form->addDateTimePicker(
'access_end_date', 'access_end_date',
[get_lang('Access end date'), get_lang('Access end dateComment')], [get_lang('Access end date'), get_lang('Date on which the session is closed')],
['id' => 'access_end_date'] ['id' => 'access_end_date']
); );
@ -8037,7 +8037,7 @@ class SessionManager
'display_start_date', 'display_start_date',
[ [
get_lang('Start date to display'), get_lang('Start date to display'),
get_lang('Start date to displayComment'), get_lang('Date that will be shown in the session information as the date on which the session starts'),
], ],
['id' => 'display_start_date'] ['id' => 'display_start_date']
); );
@ -8046,7 +8046,7 @@ class SessionManager
'display_end_date', 'display_end_date',
[ [
get_lang('End date to display'), get_lang('End date to display'),
get_lang('End date to displayComment'), get_lang('Date that will be shown in the session information as the date on which the session ends'),
], ],
['id' => 'display_end_date'] ['id' => 'display_end_date']
); );
@ -8062,7 +8062,7 @@ class SessionManager
'coach_access_start_date', 'coach_access_start_date',
[ [
get_lang('Access start date for coaches'), get_lang('Access start date for coaches'),
get_lang('Access start date for coachesComment'), get_lang('Date on which the session is made available to coaches, so they can prepare it before the students get connected'),
], ],
['id' => 'coach_access_start_date'] ['id' => 'coach_access_start_date']
); );
@ -8071,7 +8071,7 @@ class SessionManager
'coach_access_end_date', 'coach_access_end_date',
[ [
get_lang('Access end date for coaches'), get_lang('Access end date for coaches'),
get_lang('Access end date for coachesComment'), get_lang('Date on which the session is closed to coaches. The additional delay will allow them to export all relevant tracking information'),
], ],
['id' => 'coach_access_end_date'] ['id' => 'coach_access_end_date']
); );
@ -8088,9 +8088,9 @@ class SessionManager
$form->addCheckBox( $form->addCheckBox(
'send_subscription_notification', 'send_subscription_notification',
[ [
get_lang('Send mail notification to students to inform of subscription'), //get_lang('Send mail notification to students to inform of subscription'),
],
get_lang('Send an email when a user being subscribed to session'), get_lang('Send an email when a user being subscribed to session'),
]
); );
// Extra fields // Extra fields
@ -9579,7 +9579,7 @@ class SessionManager
{ {
if (api_get_session_id() && !api_is_allowed_to_session_edit()) { if (api_get_session_id() && !api_is_allowed_to_session_edit()) {
Display::addFlash( Display::addFlash(
Display::return_message(get_lang('SessionIsReadOnly'), 'warning') Display::return_message(get_lang('The session is read only'), 'warning')
); );
} }
} }

Loading…
Cancel
Save