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);
|
$id_group = get_parameter('id_group', 0);
|
||||||
$same_day = get_parameter('same_day', '');
|
$same_day = get_parameter('same_day', '');
|
||||||
|
|
||||||
echo '<h4>'.__('Same as %s', ucfirst($same_day));
|
$output = '<h4>'.__('Same as %s', ucfirst($same_day));
|
||||||
echo ' » ';
|
$output .= ' » ';
|
||||||
echo __('Templates not being fired');
|
$output .= __('Templates not being fired');
|
||||||
echo '</h4>';
|
$output .= '</h4>';
|
||||||
|
|
||||||
$columns = [
|
$columns = [
|
||||||
'name',
|
'name',
|
||||||
@ -90,10 +90,10 @@ if (is_ajax() === true) {
|
|||||||
__('Sun'),
|
__('Sun'),
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
ui_print_datatable(
|
$output .= ui_print_datatable(
|
||||||
[
|
[
|
||||||
'id' => 'templates_alerts_special_days',
|
'id' => 'templates_alerts_special_days',
|
||||||
'return' => false,
|
'return' => true,
|
||||||
'class' => 'info_table',
|
'class' => 'info_table',
|
||||||
'style' => 'width: 100%',
|
'style' => 'width: 100%',
|
||||||
'columns' => $columns,
|
'columns' => $columns,
|
||||||
@ -132,9 +132,11 @@ if (is_ajax() === true) {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
echo $e->getMessage();
|
$output .= $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo $output;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +160,7 @@ if (is_ajax() === true) {
|
|||||||
$data = [];
|
$data = [];
|
||||||
if (empty($templates) === false) {
|
if (empty($templates) === false) {
|
||||||
foreach ($templates as $template) {
|
foreach ($templates as $template) {
|
||||||
if ((bool) $template[$same_day] === true) {
|
if ((bool) $template[$same_day] === false) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'name' => $template['name'],
|
'name' => $template['name'],
|
||||||
'id_group' => ui_print_group_icon(
|
'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>';
|
||||||
$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)) {
|
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] .= '<a href="'.$url_alert.'&id='.$special_day['id'].'" title=';
|
||||||
$cal_table->data[$cal_line][$week] .= __('Edit');
|
$cal_table->data[$cal_line][$week] .= __('Edit');
|
||||||
$cal_table->data[$cal_line][$week] .= '>'.html_print_image(
|
$cal_table->data[$cal_line][$week] .= '>'.html_print_image(
|
||||||
|
@ -172,19 +172,26 @@ if (empty($id) === false) {
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
echo '<div id="modal-alert-templates" class="invisible"></div>';
|
echo '<div id="modal-alert-templates" class="invisible"></div>';
|
||||||
|
|
||||||
ui_require_javascript_file('pandora_alerts');
|
ui_require_javascript_file('pandora_alerts');
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
$("#submit-create").click (function (e) {
|
$("#submit-create").click (function (e) {
|
||||||
e.preventDefault();
|
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({
|
load_templates_alerts_special_days({
|
||||||
date: $("#text-date").val(),
|
date: $("#text-date").val(),
|
||||||
id_group: $("#id_group").val(),
|
id_group: $("#id_group").val(),
|
||||||
same_day: $("#same_day").val(),
|
same_day: $("#same_day").val(),
|
||||||
btn_ok_text: '<?php echo __('Create'); ?>',
|
btn_ok_text: '<?php echo __('Create'); ?>',
|
||||||
btn_cancel_text: '<?php echo __('Cancel'); ?>',
|
btn_cancel_text: '<?php echo __('Cancel'); ?>',
|
||||||
title: $("#text-date").val(),
|
title: dateformat,
|
||||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||||
page: "godmode/alerts/alert_special_days",
|
page: "godmode/alerts/alert_special_days",
|
||||||
loading: '<?php echo __('Loading, this operation might take several minutes...'); ?>',
|
loading: '<?php echo __('Loading, this operation might take several minutes...'); ?>',
|
||||||
|
@ -3591,19 +3591,87 @@ function ui_print_datatable(array $parameters)
|
|||||||
// Order.
|
// Order.
|
||||||
$err_msg = '<div id="error-'.$table_id.'"></div>';
|
$err_msg = '<div id="error-'.$table_id.'"></div>';
|
||||||
$output = $err_msg.$filter.$extra.$table.$js;
|
$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_javascript_file('datatables.min');
|
||||||
ui_require_css_file('tables');
|
ui_require_javascript_file('buttons.dataTables.min');
|
||||||
if (is_metaconsole()) {
|
ui_require_javascript_file('dataTables.buttons.min');
|
||||||
ui_require_css_file('tables_meta', ENTERPRISE_DIR.'/include/styles/');
|
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) {
|
if (isset($parameters['return']) && $parameters['return'] == true) {
|
||||||
// Compat.
|
// Compat.
|
||||||
$parameters['print'] = false;
|
$parameters['print'] = false;
|
||||||
|
@ -75,10 +75,9 @@ function load_templates_alerts_special_days(settings) {
|
|||||||
},
|
},
|
||||||
datatype: "html",
|
datatype: "html",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
console.log(data);
|
|
||||||
$("#" + id)
|
$("#" + id)
|
||||||
.empty()
|
.empty()
|
||||||
.append(data);
|
.html(data);
|
||||||
},
|
},
|
||||||
error: function(e) {
|
error: function(e) {
|
||||||
showMsg(e);
|
showMsg(e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user