<?php $month = isset($_GET['month']) ? $_GET['month'] : date('m'); ?> <div id="calendar_events"> <form methot="GET"> <input type="hidden" name="page" value="<?php echo get_current_key(); ?> " /> <select name="month" onchange="this.form.submit()"> <?php foreach (get_calendar_months() as $key => $item) { echo '<option value="' . $key . '"' . ($key == $month ? ' selected' : '') . '>' . $item . '</option>'; } ?> </select> </form> <?php show_calendar_events(array('month' => $month, 'links' => false)); ?> </div>
?> "><span class="glyphicon glyphicon-time"></span> Добавить событие</a> <?php if (check_rule('admin_settings')) { ?> <a class="btn btn-info" target="_blank" href="<?php echo $json_link; ?> "><span class="glyphicon glyphicon-cog"></span> Получить в формате JSON</a> <?php } ?> <form methot="GET" class="pull-right"> <input type="hidden" name="page" value="<?php echo get_current_key(); ?> " /> <select name="month" class="form-control" onchange="this.form.submit()"> <?php foreach (get_calendar_months() as $key => $item) { echo '<option value="' . $key . '"' . ($key == $month ? ' selected' : '') . '>' . $item . '</option>'; } ?> </select> </form> </div></div> <?php show_calendar_events(array('links' => true)); ?> </div>
})); add_action(array('code' => 'ajax_calendar_event_range_get', 'category' => 'admin', 'rule' => 'calendar_event_admin', 'function' => function ($params = null) { $params = (array) $params; $copy = $params; if ($params[0]) { $params[0] = date('Y-m-d H:i', strtotime($copy[0]) - 36000); } else { $params[0] = date('Y-m-d H:i', strtotime($copy[1]) - 36000); } if ($params[1]) { $params[1] = date('Y-m-d H:i', strtotime($copy[1]) + 36000); } else { $params[1] = date('Y-m-d H:i', strtotime($copy[0]) + 36000); } $ID = $params[2] ? $params[2] : ''; show_calendar_events(array('limit' => 15, 'start' => $params[0], 'end' => $params[1], 'type' => 'range', 'exclude_ID' => $ID)); })); function get_calendar_months() { return array('1' => 'Январь', '2' => 'Февраль', '3' => 'Март', '4' => 'Апрель', '5' => 'Май', '6' => 'Июнь', '7' => 'Июль', '8' => 'Август', '9' => 'Сентябрь', '10' => 'Октябрь', '11' => 'Ноябрь', '12' => 'Декабрь'); } function show_calendar_events($params = array()) { global $DETDB; $custom = array('links' => false, 'type' => 'month', 'month' => isset($_GET['month']) && is_numeric($_GET['month']) ? $_GET['month'] : date('m'), 'year' => isset($_GET['year']) && is_numeric($_GET['year']) ? $_GET['year'] : date('Y'), 'start' => '', 'end' => '', 'show' => 'table', 'exclude_ID' => null, 'limit' => 100); $query = null; if (is_merged($params)) { $custom = set_merge($custom, $params); if ($custom['start']) { $custom['start'] = date('Y-m-d H:i', strtotime($custom['start'])); }
$event = get_glob_content(); $try = get_option('calendar_events_range'); ?> <?php if ($try) { ?> <div id="show_graphic"> <h3>Ближайшие мероприятия в диапазоне 10 часов <a class="btn-hide btn btn-warning btn-xs pull-right">скрыть</a></h3> <div class="table_show"> <?php if ($event) { $start_date = date('Y-m-d H:i', strtotime($event['date_start']) - 36000); $end_date = $event['date_end'] && $event['date_end'] > 0 ? date('Y-m-d H:i', strtotime($event['date_end']) + 36000) : date('Y-m-d H:i', strtotime($event['date_start']) + 36000); show_calendar_events(array('limit' => 15, 'exclude_ID' => isset($event['ID']) ? $event['ID'] : '', 'start' => $start_date, 'end' => $end_date, 'type' => 'range')); } ?> </div> </div> <br /> <?php } ?> <div id="add_event"> <form method="POST" action="index.php?page=<?php echo get_current_key() . (isset($event['ID']) ? '&event_id=' . $event['ID'] : ''); ?> "> <fieldset>