<?php $p = getProject(); $p->usecache = false; $p->Header('Pipeline'); wnl("<h1>The Pipeline</h1>"); $sql = "SELECT COUNT(nid) FROM news"; $total = GetDB()->Query($sql)->Result(); $limit = 10; $pager = Pager('offset', $limit, $total); $res = GetDB()->Query( "SELECT * FROM news " . "ORDER BY date DESC " . "LIMIT %d, $limit", $pager->from - 1 ); $select = issetor($_GET['nid'], 0); $item = null; ?> <div id="pipelist"> <table> <caption> Displaying item <span><?php echo $pager->from ?></span> to <span><?php echo $pager->to ?></span> of <span><?php echo $pager->total ?></span> </caption> <thead> <tr> <th scope="col" style="width: 80px">Date</th> <th scope="col">Title</th> <th scope="col" style="width: 60px">In/Out</th> <th scope="col" style="width: 120px">Author</th> </tr> </thead> <tbody> <?php $i = 0; while ($row = $res->Fetch()): $date = new Date($row->date); $class = ++$i & 1 ? 'odd' : 'even'; $qs = 'nid=' . $row->nid; $qs .= isset($_GET['offset']) ? '&offset=' . $_GET['offset'] : ''; if (!$select && $i == 1) { $item = $row; $class .= ' selected'; } elseif ($select && $row->nid == $select) { $item = $row; $class .= ' selected'; } ?> <tr class="<?php echo $class ?>"> <td><?php echo $date->Format('%Y-%m-%d') ?></td> <td> <a href="<?php printf('%s?%s', GetURI(), $qs) ?>"> <?php echo $row->title ?> </a> </td> <td><?php echo ucfirst($row->type) ?></td> <td><?php echo $row->author ?></td> </tr> <?php endwhile ?> </tbody> <tfoot> <tr> <td colspan="4"> <?php if ($pager->offset > 0): ?> <a href="<?php printf('%s?offset=%d', GetURI(), $pager->prev) ?>" class="prev">«</a> <?php else: ?> <span class="prev">«</span> <?php endif ?> <span class="delimiter">|</span> <?php if ($pager->next > 0): ?> <a href="<?php printf('%s?offset=%d', GetURI(), $pager->next) ?>" class="next">»</a> <?php else: ?> <span class="next">»</span> <?php endif ?> </td> </tr> </tfoot> </table> </div> <?php if ($item): ?> <br/> <div id="news-display"> <h2 class="title"> <?php echo stripslashes($item->title) ?> <small><?php $date = new Date($item->date); echo $date ?> by <?php echo $item->author ?></small> </h2> <div id="news-article"> <?php echo $p->Textify(stripslashes($item->text)) ?> </div> </div> <?php endif ?> <?php $p->Footer(); ?>