manage-comics.php
74 lines
| 2.0 KiB
| text/x-php
|
XmlPhpLexer
| r1 | <?php | |||
| /* This page displays a list of comics, 15 per page. */ | ||||
| require_once('include/admin.inc.php'); | ||||
| auth_redirect(); // Require logged in user to access this page. | ||||
| adminhead('Manage Comics'); | ||||
| adminmenu(); | ||||
| ?> | ||||
| <h2>Edit Comic</h2> | ||||
| <?php | ||||
| $page = 1; | ||||
| if( isset($_GET['page'] )) $page = (int) $_GET['page']; | ||||
| $perpage = 15; | ||||
| r30 | $start = ($page - 1) * $perpage; | |||
| r1 | ||||
| r30 | $total = ceil( $dbConnection->fetchColumn('SELECT COUNT(id) FROM strip') / $perpage ); | |||
| $strips = $dbConnection->fetchAll('SELECT id, UNIX_TIMESTAMP(published) AS published, type, media, title, book, page FROM strip ORDER BY id DESC LIMIT ?, ?', array($start, $perpage), array(PDO::PARAM_INT, PDO::PARAM_INT)); | ||||
| $types_db = $dbConnection->fetchAll('SELECT id, description FROM strip_t'); | ||||
| r1 | ||||
| $type = array(); | ||||
| foreach( $types_db as $k ) $type[$k->id]=$k->description; | ||||
| pagination( $page, $total ); | ||||
| ?> | ||||
| <table class="widefat"> | ||||
| <thead> | ||||
| <tr> | ||||
| <th scope="col" style="text-align: center;">Strip #</th> | ||||
| <th scope="col">Title</th> | ||||
| <th scope="col">Published On</th> | ||||
| <th scope="col">Type</th> | ||||
| <th scope="col">Book Page #</th> | ||||
| <th scope="col"></th> | ||||
| <th scope="col"></th> | ||||
| <th scope="col"></th> | ||||
| </tr> | ||||
| </thead> | ||||
| <tbody id="the-list"> | ||||
| <?php | ||||
| $alternate=false; | ||||
| foreach( $strips as $s ) { | ||||
| $alternate=!$alternate; | ||||
| ?> | ||||
| <tr id="comic-<?php echo $s->id; ?>" <?php if($alternate) echo 'class="alternate"'; ?>> | ||||
| <th scope="row" style="text-align: center;"><?php echo $s->id; ?></th> | ||||
| <td><?php echo $s->title; ?></td> | ||||
| <td><?php echo htmlentities( date( 'Y-m-d H:i:s', $s->published)); ?></td> | ||||
| <td><?php echo $type[$s->type]; ?></td> | ||||
| <td><?php echo $s->book; ?> - <?php echo $s->page; ?></td> | ||||
| <td style="text-align: center;"><a href="<?php echo SITE_HOST . SITE_PATH; ?>/strip/<?php echo $s->id; ?>">View</a></td> | ||||
| <td style="text-align: center;"><a href="edit-comic.php?strip_id=<?php echo $s->id; ?>">Edit</a></td> | ||||
| <td style="text-align: center;"><a class="delete" href="delete-comic.php?strip_id=<?php echo $s->id; ?>">Delete</a></td> | ||||
| </tr> | ||||
| <?php | ||||
| } | ||||
| ?> | ||||
| </tbody> | ||||
| </table> | ||||
| <?php | ||||
| adminfooter(); | ||||
| ?> | ||||
