wip special days alerts

This commit is contained in:
Daniel Barbero Martin 2021-11-04 13:07:17 +01:00
parent c3f4addb0e
commit cd163a96ef
2 changed files with 46 additions and 6 deletions

View File

@ -164,12 +164,32 @@ class CalendarManager
).'</a>', ).'</a>',
]; ];
if ($tab !== 'list') { $id_calendar = get_parameter('id_calendar', 0);
$id_calendar = get_parameter('id_calendar', 0); $id = get_parameter('id', 0);
$op = get_parameter('op', '');
$action = get_parameter('action', '');
if (($id_calendar !== 0 || $id !== 0)) {
$id = ($id_calendar === 0) ? $id : $id_calendar;
$buttons['list_edit'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url(
$this->url.'&tab=list&op=edit&id='.$id
).'&pure='.(int) $config['pure'].'">'.html_print_image(
'images/pencil.png',
true,
[
'title' => __('Edit calendar'),
'class' => 'invert_filter',
]
).'</a>',
];
$buttons['special_days'] = [ $buttons['special_days'] = [
'active' => false, 'active' => false,
'text' => '<a href="'.ui_get_full_url( 'text' => '<a href="'.ui_get_full_url(
$this->url.'&tab=special_days&id_calendar='.$id_calendar $this->url.'&tab=special_days&id_calendar='.$id
).'&pure='.(int) $config['pure'].'">'.html_print_image( ).'&pure='.(int) $config['pure'].'">'.html_print_image(
'images/templates.png', 'images/templates.png',
true, true,
@ -181,6 +201,10 @@ class CalendarManager
]; ];
} }
if ($op === 'edit' && $action === '') {
$tab = 'list_edit';
}
$buttons[$tab]['active'] = true; $buttons[$tab]['active'] = true;
return $buttons; return $buttons;
@ -596,7 +620,7 @@ class CalendarManager
if ((bool) $manage === true) { if ((bool) $manage === true) {
$name = '<b><a href="'; $name = '<b><a href="';
$name .= ui_get_full_url( $name .= ui_get_full_url(
$this->url.'&op=edit&id='.$tmp->id $this->url.'&op=special_days&tab=special_days&id_calendar='.$tmp->id
); );
$name .= '">'; $name .= '">';
$name .= $tmp->name; $name .= $tmp->name;
@ -914,7 +938,18 @@ class CalendarManager
$day_code = get_parameter('day_code', ''); $day_code = get_parameter('day_code', '');
$id_calendar = get_parameter('id_calendar', 0); $id_calendar = get_parameter('id_calendar', 0);
$output = '<h4>'.__('Same as %s', $day_code); $weekdays = [
1 => 'monday',
2 => 'tuesday',
3 => 'wednesday',
4 => 'thursday',
5 => 'friday',
6 => 'saturday',
7 => 'sunday',
8 => 'holidays',
];
$output = '<h4>'.__('Same as %s', $weekdays[$day_code]);
$output .= ' &raquo; '; $output .= ' &raquo; ';
$output .= __('Templates not being fired'); $output .= __('Templates not being fired');
$output .= '</h4>'; $output .= '</h4>';

View File

@ -49,6 +49,10 @@ if (empty($message) === false) {
// Datatables list. // Datatables list.
try { try {
$columns = [ $columns = [
[
'text' => 'id',
'class' => 'invisible',
],
'name', 'name',
'id_group', 'id_group',
'description', 'description',
@ -59,6 +63,7 @@ try {
]; ];
$column_names = [ $column_names = [
__('ID'),
__('Name'), __('Name'),
__('Group'), __('Group'),
__('Description'), __('Description'),
@ -78,7 +83,7 @@ try {
'ajax_data' => ['method' => 'drawListCalendar'], 'ajax_data' => ['method' => 'drawListCalendar'],
'no_sortable_columns' => [-1], 'no_sortable_columns' => [-1],
'order' => [ 'order' => [
'field' => 'name', 'field' => 'id',
'direction' => 'asc', 'direction' => 'asc',
], ],
'search_button_class' => 'sub filter float-right', 'search_button_class' => 'sub filter float-right',