/var/www/onesolution.com.hk/onesupport/others/holiday_index.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
    
require_once(__DIR__ '/../checkuser.php');
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

    <?php require(__DIR__ '/../inc/_head_meta.php'); ?>

    <?php require(__DIR__ '/../inc/_head_css.php'); ?>

    <style type="text/css">
        body {
            padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
            padding-bottom: 40px;
        }
    </style>

    <?php require(__DIR__ '/../inc/_head_script.php'); ?>

    <script type="text/javascript">
        $(function () {
            $('#search_btn').click(function (event) {
                event.preventDefault();
                $('#search_form').toggle();
            });
            $('.date-picker').datetimepicker({ pickTime: false });
            $('.time-picker').datetimepicker({ pickDate: false, pickSeconds: false });
            $('.select2').select2();
            $('#search_form').validate();
        });
    </script>
</head>
<body>

<?php require(__DIR__ '/../inc/_navbar.php'); ?>

<div class="container">

    <?php if (isset($_GET["message"]) && !empty($_GET["message"])): ?>
        <div class="alert alert-info">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            <h5 class="alert-heading">Note:</h5>

            <p><?= $_GET["message"?></p>
        </div>
    <?php endif; ?>

    <h2>Public Holiday</h2>

    <a href="http://www.gov.hk/tc/about/abouthk/holiday/" target="_blank"> Hong Kong Public Holiday Reference </a>
    <br><br>

    <div style="padding-bottom: 50px;">

        <a href="holiday_add.php?addholiday=1" class="btn btn-primary pull-right">New Holiday</a>

        <?php

            $sql 
"SELECT * FROM sup_public_holiday WHERE year = '" date("Y") . "' order by holiday_date ASC";
            
$parameters = array(0);
            if (!(
$sth $dbh->prepare($sql))) {
                throw new 
Exception("sql prepare statement failure: $sql");
            }
            
$sth->setFetchMode(PDO::FETCH_ASSOC);
            if (!
$sth->execute($parameters)) {
                throw new 
Exception("sql execute statement failure: $sql");
            }
            
$holiday $sth->fetchAll();


        
?>
        <form action="holiday_modify.php" id="holiday_<?= $date["id"?>" name="holiday_<?= $date["id"?>" method="post" enctype="multipart/form-data">

            <table class="table table-striped">

                <thead>
                <tr>
                    <th style="width: 400px;">Date</th>
                    <th>Remarks</th>
                </tr>
                </thead>

                <tbody>
                <?php
                    
foreach ($holiday as $date){

                
?>
                <tr>
                <td>
                    <input type="hidden" name="holiday_id[]" value="<?= $date["id"?>"/>

                        <div class="controls" style="padding: 0;margin: 0;">
                            <div class="input-append date-picker">
                                <input type="text" id="holiday_date" name="holiday_date[<?= $date["id"?>]" value="<?= h(Util::value_to_date_string($date["holiday_date"])) ?>" class="dateISO" data-format="yyyy-MM-dd" placeholder="Date"/>

                                    <span class="add-on">
                                        <i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
                                    </span>

                            </div>
                        </div>

                    </td>
                    <td>
                        <textarea name="remarks[<?= $date["id"?>]" class="span9"><?= $date["remarks"?></textarea>
                                <span class="btn" onclick="var r=confirm('Are you sure to delete this holiday date (<?= $date["holiday_date"?>)?');
                                    if (r==true)
                                    {
                                    top.location.href='holiday_modify.php?delete_holiday=1&holiday_id=<?= $date["id"?>';

                                    }
                                    ; "><i class="icon-remove"></i></span>
                    </td>
        </form>
        </tr>
    <?php

        
}
    
?>

        <tr>
            <td colspan="2" style="text-align: center;">
                <button type="submit" class="btn btn-primary">Save</button>
            </td>
        </tr>
        </tbody>
        </table>

    </div>
</body>
</html>