Пример #1
0
        if ($holiday_type == 5) {
            if (isCorrectCalendar(0, $month5_list, $day5_list)) {
                $update = true;
                if ($action == "insert") {
                    insertHoliday(-1, $month5_list, $day5_list, -1, -1, $holiday_open);
                } else {
                    updateHoliday($id, -1, $month5_list, $day5_list, -1, -1, $holiday_open);
                }
            }
        }
        // ?年?月?日
        if ($holiday_type == 9) {
            if (isCorrectCalendar($year9_list, $month9_list, $day9_list)) {
                $update = true;
                if ($action == "insert") {
                    insertHoliday($year9_list, $month9_list, $day9_list, -1, -1, $holiday_open);
                } else {
                    updateHoliday($id, $year9_list, $month9_list, $day9_list, -1, -1, $holiday_open);
                }
            }
        }
    }
    if ($update) {
        $message = TEXT_UPDATE_SUCCESS;
    } else {
        $error = TEXT_ERROR_SETTING;
    }
} else {
    if ($action == "delete") {
        if ($id > 0) {
            delHoliday($id);
Пример #2
0
    if (insertAYearCalendar($data, $db)) {
        $rfc = "<script>alert('Calendar successfully created.')</script>";
    } else {
        header("location: " . ROOT . "error.html");
        exit;
    }
}
if (isset($_POST['date_save'])) {
    $data['cname'] = trim($_POST['calendarName']);
    $data['cdate'] = $_POST['date_pick'];
    $data['cdatename'] = $_POST['date_name'];
    $data['cyear'] = $_POST['year'];
    if ($data['cname'] == "") {
        $rfc = "<script>alert('Please insert name of the calendar template.')</script>";
    }
    if (insertHoliday($data, $db)) {
        $rfc = "<script>alert('Template successfully created.')</script>";
    } else {
        header("location: " . ROOT . "error.html");
        exit;
    }
}
if (isset($_GET['cdel'])) {
    $cid = $_GET['cdel'];
    if (deleteCalendarTemplate($cid, $db)) {
        $rfc = $rfc = "<script>alert('Template successfully removed.')</script>";
    } else {
        header("location: " . ROOT . "error.html");
        exit;
    }
}
 /**
  * This function is used for adding/editing a specific holiday
  *
  * @uses ManageCalendar template, edit_holiday sub template
  */
 public function action_editholiday()
 {
     global $txt, $context;
     //We need this, really..
     require_once SUBSDIR . '/Calendar.subs.php';
     loadTemplate('ManageCalendar');
     $context['is_new'] = !isset($_REQUEST['holiday']);
     $context['page_title'] = $context['is_new'] ? $txt['holidays_add'] : $txt['holidays_edit'];
     $context['sub_template'] = 'edit_holiday';
     // Cast this for safety...
     if (isset($_REQUEST['holiday'])) {
         $_REQUEST['holiday'] = (int) $_REQUEST['holiday'];
     }
     // Submitting?
     if (isset($_POST[$context['session_var']]) && (isset($_REQUEST['delete']) || $_REQUEST['title'] != '')) {
         checkSession();
         // Not too long good sir?
         $_REQUEST['title'] = Util::substr($_REQUEST['title'], 0, 60);
         $_REQUEST['holiday'] = isset($_REQUEST['holiday']) ? (int) $_REQUEST['holiday'] : 0;
         if (isset($_REQUEST['delete'])) {
             removeHolidays($_REQUEST['holiday']);
         } else {
             $date = strftime($_REQUEST['year'] <= 4 ? '0004-%m-%d' : '%Y-%m-%d', mktime(0, 0, 0, $_REQUEST['month'], $_REQUEST['day'], $_REQUEST['year']));
             if (isset($_REQUEST['edit'])) {
                 editHoliday($_REQUEST['holiday'], $date, $_REQUEST['title']);
             } else {
                 insertHoliday($date, $_REQUEST['title']);
             }
         }
         redirectexit('action=admin;area=managecalendar;sa=holidays');
     }
     // Default states...
     if ($context['is_new']) {
         $context['holiday'] = array('id' => 0, 'day' => date('d'), 'month' => date('m'), 'year' => '0000', 'title' => '');
     } else {
         $context['holiday'] = getHoliday($_REQUEST['holiday']);
     }
     // Last day for the drop down?
     $context['holiday']['last_day'] = (int) strftime('%d', mktime(0, 0, 0, $context['holiday']['month'] == 12 ? 1 : $context['holiday']['month'] + 1, 0, $context['holiday']['month'] == 12 ? $context['holiday']['year'] + 1 : $context['holiday']['year']));
 }
Пример #4
0
 function _install()
 {
     // 休日データテーブルの構築
     // 存在しない場合に自動で作成
     // 休日は以下の方法で設定する
     // | 年 | 月  |日 |曜日|  週   |営業|
     // |year|month|day|week|weekcnt|open|備考
     // |  -1|   -1| -1|  -1|     -1|   0|無効データ
     // |  -1|   -1| -1|   3|      2|   0|第3火曜日が休日
     // |  -1|   -1| -1|   0|     -1|   0|毎週日曜が休日
     // |  -1|   -1| 10|  -1|     -1|   0|毎月10日が休日
     // |  -1|    1|  1|  -1|     -1|   0|毎年1/1は休日
     // |2009|    5| 15|  -1|     -1|   0|2009/5/15が休日
     // |2009|    5| 31|  -1|     -1|   1|2009/5/31は営業日(特例)
     global $db;
     $sql = "create table if not exists " . TABLE_CALENDAR_HOLIDAYS . " " . "(id int(11) auto_increment," . "year    int," . "month   int," . "day     int," . "week    int," . "weekcnt int," . "open    int," . "primary key (id))";
     $db->execute($sql);
     // 日本の休日データ(簡易的なもの)
     //         year month day week weekcnt open
     insertHoliday(-1, 1, 1, -1, -1, 0);
     // 元日        (1月1日)
     insertHoliday(-1, 1, 2, -1, -1, 0);
     //             (1月2日)
     insertHoliday(-1, 1, 3, -1, -1, 0);
     //             (1月3日)
     insertHoliday(-1, 1, -1, 1, 2, 0);
     // 成人の日    (1月の第2月曜日)
     insertHoliday(-1, 2, 11, -1, -1, 0);
     // 建国記念日  (2月11日)
     insertHoliday(-1, 4, 29, -1, -1, 0);
     // 昭和の日    (4月29日)
     insertHoliday(-1, 5, 3, -1, -1, 0);
     // 憲法記念日  (5月3日)
     insertHoliday(-1, 5, 4, -1, -1, 0);
     // みどりの日  (5月4日)
     insertHoliday(-1, 5, 5, -1, -1, 0);
     // こどもの日  (5月5日)
     insertHoliday(-1, 7, -1, 1, 3, 0);
     // 海の日      (7月の第3月曜日)
     insertHoliday(-1, 9, -1, 1, 3, 0);
     // 敬老の日    (9月の第3月曜日)
     insertHoliday(-1, 10, -1, 1, 2, 0);
     // 体育の日    (10月の第2月曜日)
     insertHoliday(-1, 11, 3, -1, -1, 0);
     // 文化の日    (11月3日)
     insertHoliday(-1, 11, 23, -1, -1, 0);
     // 勤労感謝の日(11月23日)
     insertHoliday(-1, 12, 23, -1, -1, 0);
     // 天皇誕生日  (12月23日)
     insertHoliday(-1, 12, 29, -1, -1, 0);
     //             (12月29日)
     insertHoliday(-1, 12, 30, -1, -1, 0);
     //             (12月30日)
     insertHoliday(-1, 12, 31, -1, -1, 0);
     //             (12月31日)
     // 2009年用
     insertHoliday(2009, 3, 20, -1, -1, 0);
     // 春分の日  (2009年3月20日)
     insertHoliday(2009, 5, 6, -1, -1, 0);
     // 振替休日  (2009年5月6日)
     insertHoliday(2009, 9, 22, -1, -1, 0);
     // 国民の休日(2009年9月22日)
     insertHoliday(2009, 9, 23, -1, -1, 0);
     // 秋分の日  (2009年9月23日)
     // 2010年用
     insertHoliday(2010, 3, 21, -1, -1, 0);
     // 春分の日  (2010年3月21日)
     insertHoliday(2010, 3, 22, -1, -1, 0);
     // 振替休日  (2010年3月22日)
     insertHoliday(2010, 9, 23, -1, -1, 0);
     // 秋分の日  (2010年9月23日)
 }