manage.php 29.5 KB
Newer Older
jlopez's avatar
jlopez committed
1
2
3
4
5
6
<?php
/**
 * Created by PhpStorm.
 * User: jimmy
 * Date: 04/02/19
 * Time: 14:09
jlopez's avatar
jlopez committed
7
8
9
10
 */

session_start ();

jlopez's avatar
Fix #12    
jlopez committed
11
if(!isset($_SESSION['manage'])) {
jlopez's avatar
jlopez committed
12
    header("Location: ./login.php");
jlopez's avatar
jlopez committed
13
14
15
16
17
18
19
20
21
22
23
}

require_once "./dao/DBquery.php";
require_once "./model/Section.php";

$db = new DBquery();

$sections_parent = $db->getAllSectionParent();

$managers = $db->getManagers();

jlopez's avatar
jlopez committed
24
25
$grades = $db->getGrades();

jlopez's avatar
jlopez committed
26
27
28
29
30
31
32
33
$max_arrangement = 0;

foreach ($sections_parent as $section) {
    if($section->arrangement > $max_arrangement) {
        $max_arrangement = $section->arrangement;
    } 
}

jlopez's avatar
jlopez committed
34
35
36
37
38
39
40
41
$max_grade = 0;

foreach ($grades as $grade) {
    if($grade->level > $max_grade) {
        $max_grade = $grade->level;
    } 
}

jlopez's avatar
jlopez committed
42
require_once "./inc/php/buildHeader.php";
jlopez's avatar
jlopez committed
43

jlopez's avatar
jlopez committed
44
?>
jlopez's avatar
jlopez committed
45
46
47
48
49
50
51
52
53
54
55
56
57

<div class="container-fluid">

    <br/>

    <div class="row">



        <div class="col-12">

                <div class="card border border-dark">
                    <div class="card-header bg-dark text-light">
jlopez's avatar
Fix #12    
jlopez committed
58
                        Manage section :
jlopez's avatar
jlopez committed
59
60
61
62
63
64
                    </div>
                    <div class="card-body">
                        <table id="Table_Section" class="table table-striped table-bordered">
                            <thead>
                                <tr>
                                    <th>Active</th>
jlopez's avatar
jlopez committed
65
66
                                    <th>Table name</th>
                                    <th>Panel name</th>
jlopez's avatar
jlopez committed
67
68
69
70
71
                                    <th>Color</th>
                                    <th>Arrangement</th>
                                    <th>SubArrangement</th>
                                    <th>Parent</th>
                                    <th>Packages</th>
jlopez's avatar
jlopez committed
72
                                    <th>Save</th>
jlopez's avatar
jlopez committed
73
74
75
76
77
78
79
80
81
                                </tr>
                            </thead>
                            <tbody id="TableSection">
                      

                                    <?php

                                        foreach ($sections_parent as $section) {

jlopez's avatar
jlopez committed
82
                                            echo '<form action="./action/action_section.php" method="post"><tr>';
jlopez's avatar
jlopez committed
83
84
                                            
                                            if($section->active) {
jlopez's avatar
jlopez committed
85
                                                echo '<td>' . '<input type="checkbox" name="active" value="'.$section->ID.'" checked>' . '</td>';
jlopez's avatar
jlopez committed
86
                                            } else {
jlopez's avatar
jlopez committed
87
                                                echo '<td>' . '<input type="checkbox" name="active" value="'.$section->ID.'">' . '</td>';
jlopez's avatar
jlopez committed
88
89
                                            }
                                            
jlopez's avatar
jlopez committed
90
91
92
93
94
                                            echo '<td><input type="text" class="form-control" style="display: none;" placeholder="action" name="action" value="update">
                                            <input type="text" style="display: none;" name="sectionid" value="'.$section->ID.'"><input class="form-control" type="text" name="name" value="' . $section->name . '" readonly ></td>';
                                            echo '<td><input class="form-control" type="text" name="visual" value="' . $section->visual . '"></td>';
                                            echo '<td>' . '<input class="jscolor form-control" name="color" value="'.$section->color.'">' . '</td>';
                                            echo '<td>' . '<input id="number" name="arrangement" class="form-control" type="number" value="'.$section->arrangement.'">' . '</td>';
jlopez's avatar
jlopez committed
95
96
97
                                            echo '<td>' . "" . '</td>';
                                            echo '<td>' . $section->parent . '</td>';
                                            echo '<td>' . $db->getNumberPackage($section->name). '</td>';
jlopez's avatar
jlopez committed
98
99
                                            echo '<td>' . '<button  type="submit" class="btn btn-info btn-sm">save</button>' . '</td>';
                                            echo '</tr></form>';
jlopez's avatar
jlopez committed
100
101

                                            foreach ($db->getAllSectionWhithParent($section->name) as $subsection) {
jlopez's avatar
jlopez committed
102
                                                echo '<form action="./action/action_section.php" method="post"><tr>';
jlopez's avatar
jlopez committed
103
104
                                            
                                                if($subsection->active) {
jlopez's avatar
jlopez committed
105
                                                    echo '<td>' . '<input type="checkbox" name="active" value="'.$subsection->ID.'" checked>' . '</td>';
jlopez's avatar
jlopez committed
106
                                                } else {
jlopez's avatar
jlopez committed
107
                                                    echo '<td>' . '<input class="btn" type="checkbox" name="active" value="'.$subsection->ID.'">' . '</td>';
jlopez's avatar
jlopez committed
108
109
                                                }
                                                
jlopez's avatar
jlopez committed
110
111
112
113
                                                echo '<td><input type="text" class="form-control" style="display: none;" placeholder="action" name="action" value="update">
                                                <input type="text" style="display: none;" name="sectionid" value="'.$subsection->ID.'"><input class="form-control" type="text" name="name" value="' . $subsection->name . '" readonly ></td>';
                                                echo '<td><input class="form-control" type="text" name="visual" value="' . $subsection->visual . '"></td>';
                                                echo '<td>' . '<input class="jscolor form-control" name="color" value="'.$subsection->color.'">' . '</td>';
jlopez's avatar
jlopez committed
114
                                                echo '<td>' . "" . '</td>';
jlopez's avatar
jlopez committed
115
                                                echo '<td>' . '<input id="number" name="arrangement" class="form-control" type="number" value="'.$subsection->arrangement.'">' . '</td>';
jlopez's avatar
jlopez committed
116
117
                                                echo '<td>' . $subsection->parent . '</td>';
                                                echo '<td>' . $db->getNumberPackage($subsection->name). '</td>';
jlopez's avatar
jlopez committed
118
                                                echo '<td>' . '<button  type="submit" class="btn btn-info btn-sm">save</button>' . '</td>';       
jlopez's avatar
jlopez committed
119
                                                echo '</tr></form>'; 
jlopez's avatar
jlopez committed
120
121
122
123
124
125
126
127
128
                                            }
                                        }

                                    ?>

                                                                        
                            </tbody>
                        </table>

jlopez's avatar
jlopez committed
129
    
jlopez's avatar
jlopez committed
130
131
132
133
134
135
136


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

jlopez's avatar
jlopez committed
137
138
                        <form action="./action/action_section.php" method="post">
                        <input type="text" class="form-control" style="display: none;" placeholder="action" name="action" value="create">
jlopez's avatar
jlopez committed
139
140
                        <div class="row">
                            <div class="col-2">
jlopez's avatar
jlopez committed
141
142
143
144
145
146
                                <label for="nameSection">Table name :</label>
                                <input type="text" class="form-control" id="nameSection" name="name" >
                            </div>
                            <div class="col-2">
                                <label for="visualSection">Panel ame :</label>
                                <input type="text" class="form-control" id="visualSection" name="visual" >
jlopez's avatar
jlopez committed
147
148
149
                            </div>
                            <div class="col-2">
                                <label for="colorSection">Color :</label>
jlopez's avatar
jlopez committed
150
                                <input class="jscolor form-control" name="color" value="#FFFFFF">
jlopez's avatar
jlopez committed
151
152
153
                            </div>
                            <div class="col-2">
                                <label for="arrangementSection">Arrangement :</label>
jlopez's avatar
jlopez committed
154
                                <input id="arrangementSection" name="arrangement" class="form-control" type="number" value="<?php echo $max_arrangement + 1; ?>">
jlopez's avatar
jlopez committed
155
156
157
158
159
160
161
162
163
                            </div>
                            <div class="col-12">
                                <br/>
                            <button type="submit" class="btn btn-success">Create</button>
                            </div>
                        </div>


                    </form>
jlopez's avatar
jlopez committed
164
165
166
167
168

                    <br/>

                        <p> If you want create a section you must first create table in database. </p>

jlopez's avatar
jlopez committed
169
170
171
172
173
174
175
176
177
178
179
180
181
182
                    </div>
                </div>

        </div>

        </div>

        <br/>

    <div class="row">

        <div class="col-12">

            <div class="card border border-dark">
jlopez's avatar
jlopez committed
183
                <div class="card-header bg-dark text-light" id="distribution">
jlopez's avatar
Fix #12    
jlopez committed
184
                    Manage distribution :
jlopez's avatar
jlopez committed
185
186
187
188
189
190
191
192
193
                </div>
                <div class="card-body">
                    <table id="Table_Distrib" class="table table-striped table-bordered">
                                <thead>
                                    <tr>
                                        <th>Active</th>
                                        <th>Name</th>
                                        <th>Version</th>
                                        <th>Manager</th>
jlopez's avatar
jlopez committed
194
195
                                        <th>Packages</th>                            
                                        <th>Save</th>
jlopez's avatar
jlopez committed
196
197
198
199
200
201
                                        <th>Update</th>
                                    </tr>
                                </thead>
                                <tbody id="TableSection">
                                    <?php

jlopez's avatar
jlopez committed
202
                                        foreach ($db->getDistributions() as $dist) {
jlopez's avatar
jlopez committed
203
204
                                            echo '<form action="./action/action_distribution.php" method="post"><tr>';

jlopez's avatar
jlopez committed
205

jlopez's avatar
jlopez committed
206
207
208
                                            echo '<td>
                                            <input type="text" class="form-control" style="display: none;" placeholder="action" name="action" value="update">
                                            <input type="text" style="display: none;" name="distribid" value="'.$dist->ID.'">';
jlopez's avatar
jlopez committed
209
                                            if($dist->active == 1) {
jlopez's avatar
jlopez committed
210
                                                echo '<input type="checkbox" name="active" value="'.$dist->ID.'" checked>';
jlopez's avatar
jlopez committed
211
                                            } else {
jlopez's avatar
jlopez committed
212
                                                echo '<input type="checkbox" name="active" value="'.$dist->ID.'">';
jlopez's avatar
jlopez committed
213
214
                                            }

jlopez's avatar
jlopez committed
215
216
217
218
219
220
                                            echo '</td>';
                                   
                                            echo '<td > <input class="form-control" type="text" name="name" value="' . $dist->name . '" readonly ></td>';
                                            echo '<td > <input class="form-control" type="text" name="version" value="' . $dist->version . '" readonly ></td>';

                                            echo '<td><select name="manager" class="form-control">';
jlopez's avatar
jlopez committed
221
222
223
224
225
226
227
228
229
230
231
                                            foreach ($managers as $manager) {

                                                if($manager->value == $dist->manager) {
                                                    echo '<option value="'.$manager->value.'" selected="selected">'.$manager->name.'</option>';
                                                } else {
                                                    echo '<option value="'.$manager->value.'">'.$manager->name.'</option>';
                                                }
                                            }
                                            echo '</select></td>';

                                            echo '<td>' . $db->getNumberPackage($dist->getFullName()) . '</td>';
jlopez's avatar
jlopez committed
232
233
                                            echo '<td>' . '<button  type="submit" class="btn btn-info btn-sm">save</button>' . '</td>';
                                            echo '<td>' . '<a href="#" class="btn btn-warning btn-sm">update</button>' . '</td>';
jlopez's avatar
jlopez committed
234

jlopez's avatar
jlopez committed
235
                                            echo '</tr> </form>';
jlopez's avatar
jlopez committed
236
237
238
239
240
241
242
                                        }

                                    ?>

                                </tbody>
                        </table>

jlopez's avatar
jlopez committed
243
                    
jlopez's avatar
jlopez committed
244
245
246
247
248
                        <br/>
                        <br/>
                        <br/>
                        <br/>

jlopez's avatar
jlopez committed
249
250
251
                    <form action="./action/action_distribution.php" method="post">
                    <input type="text" class="form-control" style="display: none;" placeholder="action" name="action" value="create">
                        <div class="row" >
jlopez's avatar
jlopez committed
252
253
                            <div class="col-2">
                                <label for="nameManager">Name :</label>
jlopez's avatar
jlopez committed
254
                                <input type="text" class="form-control" id="nameManager" name="name" >
jlopez's avatar
jlopez committed
255
256
257
                            </div>
                            <div class="col-2">
                                <label for="versionManager">Version :</label>
jlopez's avatar
jlopez committed
258
                                <input type="text" class="form-control" id="versionManager" name="version" >
jlopez's avatar
jlopez committed
259
260
261
                            </div>
                            <div class="col-2">
                                <label for="managerManager">Manager :</label>
jlopez's avatar
jlopez committed
262
                                <select class="form-control" id="managerManager" name="manager">
jlopez's avatar
jlopez committed
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
                                <?php
                                foreach ($managers as $manager) {
                                    echo '<option value="'.$manager->value.'">'.$manager->name.'</option>';
                                }
                                ?>
                                </select>
                            </div>
                            <div class="col-12">
                                <br/>
                            <button type="submit" class="btn btn-success">Create</button>
                            </div>
                        </div>


                    </form>
jlopez's avatar
jlopez committed
278
279
280
281
282
283

                    <br/>

                    <p> If you want create a distribution you must first create table in database. </p>

                    
jlopez's avatar
jlopez committed
284
285
286
287
288
289
290
291
292
293
294
295
296
                </div>

            </div>
        </div>
    </div>

    <br/>

    <div class="row">

        <div class="col-12">

            <div class="card border border-dark">
jlopez's avatar
jlopez committed
297
                <div class="card-header bg-dark text-light" id="manager">
jlopez's avatar
Fix #12    
jlopez committed
298
                    Manage distribution packaging tools :
jlopez's avatar
jlopez committed
299
300
301
302
303
                </div>
                <div class="card-body">
                    <table id="Table_Distrib" class="table table-striped table-bordered">
                                <thead>
                                    <tr>
jlopez's avatar
jlopez committed
304
                                        
jlopez's avatar
jlopez committed
305
                                        <th>Name</th>
jlopez's avatar
jlopez committed
306
                                        <th>Value</th>  
jlopez's avatar
jlopez committed
307
                                        <th>Save</th>
jlopez's avatar
jlopez committed
308
                                        <th>Delete</th>            
jlopez's avatar
jlopez committed
309
310
311
312
313
314
315
                                    </tr>
                                </thead>
                                <tbody id="TableSection">
                                    <?php

                                    foreach ($managers as $manager) {

jlopez's avatar
jlopez committed
316
317
318
319
320
321
                                        echo '<form action="./action/action_manager.php" method="post"><tr>';
                                        echo '<td>' . '
                                        <input type="text" class="form-control" style="display: none;" placeholder="action" name="action" value="update">
                                        <input type="text" style="display: none;" name="managerid" value="'.$manager->ID.'"> 
                                        <input class="form-control" type="text" name="name" value="'.$manager->name.'">' . '</td>';
                                        echo '<td>' . '<input class="form-control" type="text" name="value" value="'.$manager->value.'">' . '</td>';
jlopez's avatar
jlopez committed
322
                                        echo '<td>' . '<button  type="submit" class="btn btn-info btn-sm" >save</button>' . '</td>';
jlopez's avatar
jlopez committed
323
324
                                        echo '<td>' . '<a class="btn btn-danger btn-sm" href="./action/action_manager.php?action=delete&managerid='.$manager->ID.'" >x</a>' . '</td>';
                                        echo '</tr></form>';
jlopez's avatar
jlopez committed
325
326
327
328
329
330
                                    }

                                    ?>
                                </tbody>
                        </table>

jlopez's avatar
jlopez committed
331
                        <!-- <button type="button" class="btn btn-primary" >Save change</button> -->
jlopez's avatar
jlopez committed
332
333
334
335
336
337

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

jlopez's avatar
jlopez committed
338
339
340
                    <form action="./action/action_manager.php" method="post">
                        <div  class="row">
                        <input type="text" class="form-control" style="display: none;" placeholder="action" name="action" value="create">
jlopez's avatar
jlopez committed
341
342
                            <div class="col-2">
                                <label for="nameManager">Name :</label>
jlopez's avatar
jlopez committed
343
                                <input type="text" class="form-control" id="nameManager" name="name" >
jlopez's avatar
jlopez committed
344
345
346
                            </div>
                            <div class="col-2">
                                <label for="valueManager">Value :</label>
jlopez's avatar
jlopez committed
347
                                <input type="text" class="form-control" id="valueManager" name="value" >
jlopez's avatar
jlopez committed
348
349
350
351
352
353
354
355
356
357
                            </div>
                            <div class="col-12">
                                <br/>
                            <button type="submit" class="btn btn-success">Create</button>
                            </div>
                        </div>


                    </form>

jlopez's avatar
jlopez committed
358
359


jlopez's avatar
jlopez committed
360
361
362
363
364
365
                </div>

            </div>
        </div>
    </div>

jlopez's avatar
jlopez committed
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466

    <br/>

    <div class="row">

        <div class="col-12">

            <div class="card border border-dark">
                <div class="card-header bg-dark text-light" id="grade">
                    Manage Grade :
                </div>
                <div class="card-body">
                    <table id="Table_Distrib" class="table table-striped table-bordered">
                                <thead>
                                    <tr>
                                        
                                        <th>Name</th>
                                        <th>Level</th>  
                                        <th>Save</th>
                                        <th>Delete</th>            
                                    </tr>
                                </thead>
                                <tbody id="TableSection">
                                    <?php

                                    foreach ($grades as $grade) {

                                        echo '<form action="./action/action_grade.php" method="post"><tr>';
                                        echo '<td>' . '
                                        <input type="text" class="form-control" style="display: none;" placeholder="action" name="action" value="update">
                                        <input type="text" style="display: none;" name="gradeid" value="'.$grade->ID.'"> 
                                        <input class="form-control" type="text" name="name" value="'.$grade->name.'">' . '</td>';
                                        echo '<td>' . '<input class="form-control" type="text" name="level" value="'.$grade->level.'">' . '</td>';
                                        echo '<td>' . '<button  type="submit" class="btn btn-info btn-sm" >save</button>' . '</td>';
                                        echo '<td>' . '<a class="btn btn-danger btn-sm" href="./action/action_grade.php?action=delete&gradeid='.$grade->ID.'" >x</a>' . '</td>';
                                        echo '</tr></form>';
                                    }

                                    ?>
                                </tbody>
                        </table>

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

                    <form action="./action/action_grade.php" method="post">
                        <div  class="row">
                        <input type="text" class="form-control" style="display: none;" placeholder="action" name="action" value="create">
                            <div class="col-2">
                                <label for="nameGrade">Name :</label>
                                <input type="text" class="form-control" id="nameGrade" name="name" >
                            </div>
                            <div class="col-2">
                                <label for="levelManager">Level :</label>
                                <input type="number" class="form-control" id="levelManager" name="level" value="<?php echo $max_grade + 1; ?>">
                            </div>
                            <div class="col-12">
                                <br/>
                            <button type="submit" class="btn btn-success">Create</button>
                            </div>
                        </div>


                    </form>



                </div>

            </div>

        </div>
    </div>

    <br/>

<div class="row">

    <div class="col-12">

        <div class="card border border-dark">
            <div class="card-header bg-dark text-light" id="label">
                Manage Label :
            </div>
            <div class="card-body">
                <table id="Table_Distrib" class="table table-striped table-bordered">
                            <thead>
                                <tr>
                                    
                                    <th>Name</th>
                                    <th>Color</th>  
                                    <th>Minimum grade</th>  
                                    <th>Save</th>
                                    <th>Delete</th>            
                                </tr>
                            </thead>
                            <tbody id="TableSection">
                                <?php

jlopez's avatar
jlopez committed
467
                                foreach ($db->getLabels() as $label) {
jlopez's avatar
jlopez committed
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563

                                    echo '<form action="./action/action_label.php" method="post"><tr>';
                                    echo '<td>' . '
                                    <input type="text" class="form-control" style="display: none;" placeholder="action" name="action" value="update">
                                    <input type="text" style="display: none;" name="labelid" value="'.$label->ID.'"> 
                                    <input class="form-control" type="text" name="name" value="'.$label->name.'">' . '</td>';
                                    echo '<td>' . '<input class="jscolor form-control" name="color" value="'.$label->color.'">' . '</td>';
                                    echo '<td><select name="gradeId" class="form-control">';
                                    foreach ($grades as $grade) {

                                        if($grade->ID == $label->gradeId) {
                                            echo '<option value="'.$grade->ID.'" selected="selected">'.$grade->name.'</option>';
                                        } else {
                                            echo '<option value="'.$grade->ID.'">'.$grade->name.'</option>';
                                        }
                                    }
                                    echo '</select></td>';
                                    echo '<td>' . '<button  type="submit" class="btn btn-info btn-sm" >save</button>' . '</td>';
                                    echo '<td>' . '<a class="btn btn-danger btn-sm" href="./action/action_label.php?action=delete&labelid='.$label->ID.'" >x</a>' . '</td>';
                                    echo '</tr></form>';
                                }

                                ?>
                            </tbody>
                    </table>

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

                <form action="./action/action_label.php" method="post">
                    <div  class="row">
                    <input type="text" class="form-control" style="display: none;" placeholder="action" name="action" value="create">
                        <div class="col-2">
                            <label for="nameLabel">Name :</label>
                            <input type="text" class="form-control" id="nameLabel" name="name" >
                        </div>
                        <div class="col-2">
                                <label for="colorLabel">Color :</label>
                                <input class="jscolor form-control" name="color" value="#FFFFFF">
                        </div>
                        <div class="col-2">
                            <label >Grade :</label>
                            <select name="gradeId" class="form-control">
                        <?php

                            foreach ($grades as $grade) {
                                echo '<option value="'.$grade->ID.'">'.$grade->name.'</option>';                              
                            }

                        ?>
                            </select>
                        </div>
                        <div class="col-12">
                            <br/>
                        <button type="submit" class="btn btn-success">Create</button>
                        </div>
                    </div>


                </form>



            </div>

        </div>

    </div>
</div>

<br/>

<div class="row">

    <div class="col-12">

        <div class="card border border-dark">
            <div class="card-header bg-dark text-light" id="user">
                Manage Graded Users :
            </div>
            <div class="card-body">
                <table id="Table_Distrib" class="table table-striped table-bordered">
                            <thead>
                                <tr>
                                    
                                    <th>Name</th>
                                    <th>Grade</th>           
                                </tr>
                            </thead>
                            <tbody id="TableSection">
                                <?php

                                

jlopez's avatar
jlopez committed
564
                                foreach ($db->getUsers() as $user) {
jlopez's avatar
jlopez committed
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632

                                    echo '<form action="./action/action_user.php" method="post"><tr>';
                                    echo '<td>' . '
                                    <input type="text" class="form-control" style="display: none;" placeholder="action" name="action" value="update">
                                    <input type="text" style="display: none;" name="userid" value="'.$user->ID.'"> 
                                    <input class="form-control" type="text" name="login" value="'.$user->login.'">' . '</td>';
                                    echo '<td><select name="gradeId" class="form-control">';
                                    foreach ($grades as $grade) {

                                        if($grade->ID == $user->gradeId) {
                                            echo '<option value="'.$grade->ID.'" selected="selected">'.$grade->name.'</option>';
                                        } else {
                                            echo '<option value="'.$grade->ID.'">'.$grade->name.'</option>';
                                        }
                                    }
                                    echo '</select></td>';
                                    echo '<td>' . '<button  type="submit" class="btn btn-info btn-sm" >save</button>' . '</td>';
                                    echo '<td>' . '<a class="btn btn-danger btn-sm" href="./action/action_user.php?action=delete&userid='.$user->ID.'" >x</a>' . '</td>';
                                    echo '</tr></form>';
                                }

                                ?>
                            </tbody>
                    </table>

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

                <form action="./action/action_user.php" method="post">
                    <div  class="row">
                    <input type="text" class="form-control" style="display: none;" placeholder="action" name="action" value="create">
                        <div class="col-2">
                            <label for="loginUser">Login :</label>
                            <input type="text" class="form-control" id="loginUser" name="login" >
                        </div>
                        <div class="col-2">
                            <label >Grade :</label>
                            <select name="gradeId" class="form-control">
                        <?php

                            foreach ($grades as $grade) {
                                echo '<option value="'.$grade->ID.'">'.$grade->name.'</option>';                              
                            }

                        ?>
                            </select>
                        </div>
                        <div class="col-12">
                            <br/>
                        <button type="submit" class="btn btn-success">Create</button>
                        </div>
                    </div>


                </form>



            </div>

        </div>

    </div>
</div>


jlopez's avatar
jlopez committed
633
634
635
636
    <br/><br/><br/><br/><br/><br/>

</div>

remy's avatar
remy committed
637
<script src="https://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
jlopez's avatar
jlopez committed
638
639
640
641
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

</body>

remy's avatar
remy committed
642
</html>