/var/www/onesupportdemo.onesolution.hk/task/category_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
<?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>Task Category</h2>

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

        <a href="category_add.php?addcategory=1" class="btn btn-primary pull-right">New Category</a>

        <?php
            $sql 
"SELECT * FROM sup_task_category WHERE deleted = 0 order by sort ASC";
            if (!(
$sth $dbh->prepare($sql))) {
                throw new 
Exception("sql prepare statement failure: $sql");
            }
            
$sth->setFetchMode(PDO::FETCH_ASSOC);
            if (!
$sth->execute()) {
                throw new 
Exception("sql execute statement failure: $sql");
            }
            
$task_categorise $sth->fetchAll();
        
?>
        <form action="category_modify.php" id="category_<?= $task_category["task_category_id"?>" name="category_<?= $date["id"?>" method="post" enctype="multipart/form-data">

            <table class="table table-striped">

                <thead>
                <tr>
                    <th style="width: 20px;">Sort</th>
                    <th style="width: 400px;">Category Name</th>
                </tr>
                </thead>

                <tbody>
                <?php
                    
foreach ($task_categorise as $task_category) {
                        
?>
                        <tr>
                            <td>
                                <input type="text" name="sort[<?= $task_category["task_category_id"?>]" value="<?= $task_category["sort"?>" style="width: 20px;"/>
                            </td>

                            <td>
                                <input type="hidden" name="category_id[]" value="<?= $task_category["task_category_id"?>"/>
                                <input type="text" name="category_name[<?= $task_category["task_category_id"?>]" class="span6" value="<?= $task_category["category_name"]; ?>"/>
                                <br>
                                <span class="btn" onclick="var r=confirm('Are you sure to delete this task category?');
                                    if (r==true)
                                    {
                                    top.location.href='category_modify.php?delete_category=1&category_id=<?= $task_category["task_category_id"?>';

                                    }
                                    ; "><i class="icon-remove"></i></span>

                            </td>

                        </tr>
                    <?php

                    
}
                
?>

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

                </tbody>
            </table>
        </form>
    </div>
</body>
</html>