container.php 5.09 KB
Newer Older
jlopez's avatar
jlopez committed
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?php


session_start ();

require_once "./dao/DBquery.php";

$db = new DBquery();

$containers = $db->getContainers();

?>

<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css" crossorigin="anonymous">
    <link rel="stylesheet" href="./css/style.css">
    <script src="./js/jscolor.js"></script>
    <title>wicopa</title>

</head>
<body>

<nav class="navbar navbar-expand-md navbar-dark navbar-custom p-1">
    <a class="navbar-brand" href="#">WICOPA</a>
    <div class="collapse navbar-collapse justify-content-between" id="navbar">
        <div class="navbar-nav">

        <?php

            echo ' <a class="nav-item nav-link" href="./index.php"> Home </a>';

            echo ' <a class="nav-item nav-link active" href="./container.php"> Containers </a>';

            if(isset($_SESSION['username']) && !empty($_SESSION['username']))
            {

                

                if(isset($_SESSION['manage']) && !empty($_SESSION['manage']))
                {
                    echo ' <a class="nav-item nav-link" href="./manage.php"> Manage </a>';
                }
            }
            ?>


        </div>
        <div class="navbar-nav">
            <?php
            if(isset($_SESSION['username']) && !empty($_SESSION['username']))
            {
                echo '<a class="nav-item btn btn-primary " href="./action/action_logout.php"> Logout ('.$_SESSION['username'].') </a>';
            }
            else
            {
                echo '<a class="nav-item btn btn-primary" href="./login.php"> Login </a>';
            }
            ?>
        </div>

</nav>


<div class="container-fluid">

    <br/><br/>

    <div class="row">

        <div class="col-12">


                    <table id="Table_Container" class="table table-striped table-bordered">
                        <thead>
                            <tr>
                                <th>Name</th>
                                <th>Author</th>
                                <th>Type</th>
                                <th>Visibility</th>
                                <th>Description</th>
                                <th>Labels</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                        <tbody id="TableSection">
                        <?php

                            foreach ($containers as $container) {

                                $visibility = "private";

                                if($container->visibility) {
                                    $visibility = "public";
                                }

                                if(!$container->visibility) {
                                    if($container->author != $_SESSION['username']) {
                                        continue;
                                    }
                                }

                                echo '<tr>';
                                echo '<td>' . $container->name . '</td>';
                                echo '<td>' . $container->author . '</td>';
                                echo '<td>' . $container->type . '</td>';
                                echo '<td>' . $visibility . '</td>';
                                echo '<td>' . $container->description . '</td>';
                                echo '<td>' . "" . '</td>';
                                echo '<td>';


                                echo '<div class="btn-group" mr-3><a class="btn btn-success btn-sm" href="#" >show</a></div>';

                                echo '<div class="btn-group" mr-3><a class="btn btn-primary btn-sm" href="#" >dowload</a></div>';

                                if($container->author == $_SESSION['username'] || $_SESSION['manage'] ) {
                                    echo '<div class="btn-group mr-3"><a class="btn btn-danger btn-sm" href="#" >delete</a></div>';
                                    
                                }
                    
                                echo '</div></td>';
                                echo '</tr>';
                            }

                        ?>

                        </tbody>

                    </table>
                </div>

    </div>

    <br/><br/><br/><br/><br/><br/>

</div>

<!-- jQuery Version 1.11.1 -->
<script src="http://code.jquery.com/jquery-latest.min.js"
              type="text/javascript"></script>

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

<script >

</script>

</body>

</html>