mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
wip special days
This commit is contained in:
parent
c2cce3990a
commit
89680907fd
@ -59,10 +59,10 @@ if (is_ajax() === true) {
|
||||
$id_group = get_parameter('id_group', 0);
|
||||
$same_day = get_parameter('same_day', '');
|
||||
|
||||
echo '<h4>'.__('Same as %s', ucfirst($same_day));
|
||||
echo ' » ';
|
||||
echo __('Templates not being fired');
|
||||
echo '</h4>';
|
||||
$output = '<h4>'.__('Same as %s', ucfirst($same_day));
|
||||
$output .= ' » ';
|
||||
$output .= __('Templates not being fired');
|
||||
$output .= '</h4>';
|
||||
|
||||
$columns = [
|
||||
'name',
|
||||
@ -90,10 +90,10 @@ if (is_ajax() === true) {
|
||||
__('Sun'),
|
||||
];
|
||||
try {
|
||||
ui_print_datatable(
|
||||
$output .= ui_print_datatable(
|
||||
[
|
||||
'id' => 'templates_alerts_special_days',
|
||||
'return' => false,
|
||||
'return' => true,
|
||||
'class' => 'info_table',
|
||||
'style' => 'width: 100%',
|
||||
'columns' => $columns,
|
||||
@ -132,9 +132,11 @@ if (is_ajax() === true) {
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
$output .= $e->getMessage();
|
||||
}
|
||||
|
||||
echo $output;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -158,7 +160,7 @@ if (is_ajax() === true) {
|
||||
$data = [];
|
||||
if (empty($templates) === false) {
|
||||
foreach ($templates as $template) {
|
||||
if ((bool) $template[$same_day] === true) {
|
||||
if ((bool) $template[$same_day] === false) {
|
||||
$data[] = [
|
||||
'name' => $template['name'],
|
||||
'id_group' => ui_print_group_icon(
|
||||
@ -814,6 +816,36 @@ for ($month = 1; $month <= 12; $month++) {
|
||||
$cal_table->data[$cal_line][$week] .= '</div>';
|
||||
$cal_table->data[$cal_line][$week] .= '<div>';
|
||||
if ($special_day['id_group'] || ($can_manage_group_all && $special_day['id_group'] == 0)) {
|
||||
$script_delete = '';
|
||||
$dateformat = date_create($special_day['date']);
|
||||
$options_zoom = htmlspecialchars(
|
||||
json_encode(
|
||||
[
|
||||
'date' => $special_day['date'],
|
||||
'id_group' => $special_day['id_group'],
|
||||
'same_day' => $special_day['same_day'],
|
||||
'btn_ok_text' => __('Create'),
|
||||
'btn_cancel_text' => __('Cancel'),
|
||||
'title' => date_format($dateformat, 'd M Y'),
|
||||
'url' => ui_get_full_url('ajax.php', false, false, false),
|
||||
'page' => 'godmode/alerts/alert_special_days',
|
||||
'loading' => __('Loading, this operation might take several minutes...'),
|
||||
]
|
||||
),
|
||||
ENT_QUOTES,
|
||||
'UTF-8'
|
||||
);
|
||||
|
||||
$onclick_zoom = 'load_templates_alerts_special_days('.$options_zoom.')';
|
||||
$cal_table->data[$cal_line][$week] .= '<a href="#" onclick="'.$onclick_zoom.'"';
|
||||
$cal_table->data[$cal_line][$week] .= 'title="';
|
||||
$cal_table->data[$cal_line][$week] .= __('Show templates');
|
||||
$cal_table->data[$cal_line][$week] .= '">';
|
||||
$cal_table->data[$cal_line][$week] .= html_print_image(
|
||||
'images/zoom.png',
|
||||
true,
|
||||
['class' => 'invert_filter']
|
||||
).'</a>';
|
||||
$cal_table->data[$cal_line][$week] .= '<a href="'.$url_alert.'&id='.$special_day['id'].'" title=';
|
||||
$cal_table->data[$cal_line][$week] .= __('Edit');
|
||||
$cal_table->data[$cal_line][$week] .= '>'.html_print_image(
|
||||
|
@ -172,19 +172,26 @@ if (empty($id) === false) {
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
echo '<div id="modal-alert-templates" class="invisible"></div>';
|
||||
|
||||
ui_require_javascript_file('pandora_alerts');
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
$("#submit-create").click (function (e) {
|
||||
e.preventDefault();
|
||||
var date = new Date($("#text-date").val());
|
||||
var dateformat = date.toLocaleString(
|
||||
'default',
|
||||
{day: 'numeric', month: 'short', year: 'numeric'}
|
||||
);
|
||||
|
||||
load_templates_alerts_special_days({
|
||||
date: $("#text-date").val(),
|
||||
id_group: $("#id_group").val(),
|
||||
same_day: $("#same_day").val(),
|
||||
btn_ok_text: '<?php echo __('Create'); ?>',
|
||||
btn_cancel_text: '<?php echo __('Cancel'); ?>',
|
||||
title: $("#text-date").val(),
|
||||
title: dateformat,
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
page: "godmode/alerts/alert_special_days",
|
||||
loading: '<?php echo __('Loading, this operation might take several minutes...'); ?>',
|
||||
|
@ -3591,19 +3591,87 @@ function ui_print_datatable(array $parameters)
|
||||
// Order.
|
||||
$err_msg = '<div id="error-'.$table_id.'"></div>';
|
||||
$output = $err_msg.$filter.$extra.$table.$js;
|
||||
if (is_ajax() === false) {
|
||||
ui_require_css_file('datatables.min', 'include/styles/js/');
|
||||
ui_require_css_file('tables');
|
||||
if (is_metaconsole()) {
|
||||
ui_require_css_file('tables_meta', ENTERPRISE_DIR.'/include/styles/');
|
||||
}
|
||||
|
||||
ui_require_css_file('datatables.min', 'include/styles/js/');
|
||||
ui_require_css_file('tables');
|
||||
if (is_metaconsole()) {
|
||||
ui_require_css_file('tables_meta', ENTERPRISE_DIR.'/include/styles/');
|
||||
ui_require_javascript_file('datatables.min');
|
||||
ui_require_javascript_file('buttons.dataTables.min');
|
||||
ui_require_javascript_file('dataTables.buttons.min');
|
||||
ui_require_javascript_file('buttons.html5.min');
|
||||
ui_require_javascript_file('buttons.print.min');
|
||||
} else {
|
||||
// Load tables.css.
|
||||
$output .= '<link rel="stylesheet" href="';
|
||||
$output .= ui_get_full_url(
|
||||
'include/styles/tables.css',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$output .= '"/>';
|
||||
if (is_metaconsole() === true) {
|
||||
// Load tables_meta.css.
|
||||
$output .= '<link rel="stylesheet" href="';
|
||||
$output .= ui_get_full_url(
|
||||
ENTERPRISE_DIR.'/include/styles/tables_meta.css',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$output .= '"/>';
|
||||
}
|
||||
|
||||
// Load datatables.js.
|
||||
$output .= '<script src="';
|
||||
$output .= ui_get_full_url(
|
||||
'include/javascript/datatables.min.js',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$output .= '" type="text/javascript"></script>';
|
||||
// Load buttons.dataTables.min.js.
|
||||
$output .= '<script src="';
|
||||
$output .= ui_get_full_url(
|
||||
'include/javascript/buttons.dataTables.min.js',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$output .= '" type="text/javascript"></script>';
|
||||
// Load dataTables.buttons.min.js.
|
||||
$output .= '<script src="';
|
||||
$output .= ui_get_full_url(
|
||||
'include/javascript/dataTables.buttons.min.js',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$output .= '" type="text/javascript"></script>';
|
||||
// Load buttons.html5.min.js.
|
||||
$output .= '<script src="';
|
||||
$output .= ui_get_full_url(
|
||||
'include/javascript/buttons.html5.min.js',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$output .= '" type="text/javascript"></script>';
|
||||
// Load buttons.print.min.js.
|
||||
$output .= '<script src="';
|
||||
$output .= ui_get_full_url(
|
||||
'include/javascript/buttons.print.min.js',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$output .= '" type="text/javascript"></script>';
|
||||
}
|
||||
|
||||
ui_require_javascript_file('datatables.min');
|
||||
ui_require_javascript_file('buttons.dataTables.min');
|
||||
ui_require_javascript_file('dataTables.buttons.min');
|
||||
ui_require_javascript_file('buttons.html5.min');
|
||||
ui_require_javascript_file('buttons.print.min');
|
||||
|
||||
if (isset($parameters['return']) && $parameters['return'] == true) {
|
||||
// Compat.
|
||||
$parameters['print'] = false;
|
||||
|
@ -75,10 +75,9 @@ function load_templates_alerts_special_days(settings) {
|
||||
},
|
||||
datatype: "html",
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
$("#" + id)
|
||||
.empty()
|
||||
.append(data);
|
||||
.html(data);
|
||||
},
|
||||
error: function(e) {
|
||||
showMsg(e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user