echo sort_class('name', $field, $order); ?> pull-right"></span></th> <th onclick="javascript:sort('social_id');">Origem<span class="<?php echo sort_class('social_id', $field, $order); ?> pull-right"></span></th> <th onclick="javascript:sort('votes');">Votos<span class="<?php echo sort_class('votes', $field, $order); ?> pull-right"></span></th> <th onclick="javascript:sort('create_date');">Data de criação<span class="<?php echo sort_class('create_date', $field, $order); ?> pull-right"></span></th> <th>Opções</th> </tr> </thead> <tbody> <?php if ($results != null) { foreach ($results as $item) { ?> <tr id="item-<?php echo $item['id']; ?> "> <td><img width="150" src="<?php
function jakoblist_manage() { global $wpdb; //Important! DBQueries don't work without this! /* Scan the URL for sort/order parameters and keep them. */ $searchterm = $_GET['search']; switch ($_GET['orderby']) { case 'title': $orderby = "title"; break; case 'author': $orderby = "author"; break; case 'publisher': $orderby = "publisher"; break; case 'info': $orderby = "info"; break; case 'price': $orderby = "price"; break; default: $orderby = "title"; } switch ($_GET['order']) { case 'desc': $order = "DESC"; break; default: $order = ""; } if ($_GET['search'] == '') { /* Alles außer Suche */ $books = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "jakoblist` order by `" . $orderby . "`" . $order . ""); } else { /* Suche */ $books = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "jakoblist` WHERE `title` LIKE '%" . $searchterm . "%' OR `author` LIKE '%" . $searchterm . "%' OR `publisher` LIKE '%" . $searchterm . "%' OR `info` LIKE '%" . $searchterm . "%' order by `" . $orderby . "` " . $order . ""); } ?> <div class="wrap"> <h2>Bücherliste verwalten <a href="admin.php?page=jakoblist_edit" class="button add-new-h2" >Neues Buch</a><?php if ($_GET['search']) { echo '<span class=\'subtitle\'> Suchergebnisse für "' . $_GET['search'] . '"</span>'; } ?> </h2> <table style="margin-bottom:0.2em;"> <tr> <td class="tablenav"> <span class="displaying-num"><?php echo count($books); ?> <?php echo 'Bücher'; ?> </span> </td> <td> <form action="admin.php?" method="get"> </td> <td width="100%"> </td> <td> <input type="text" value="<?php echo $_GET["search"]; ?> " name="search" /> </td> <td> <input type="hidden" name="page" value="jakoblist"> <input type="hidden" name="orderby" value="<?php echo $orderby; ?> "> <input type="hidden" name="order" value="<?php echo $order; ?> "> <input type="submit" value=" <?php echo _("suchen"); ?> " class="button-secondary" /> </td> </form> </tr> </table> <table id="mytable" class="widefat" width="50%"> <thead> <tr> <th width="20%" class="manage-column column-date <?php sort_class('title', $orderby, $order); ?> "><a href="<?php echo sort_link('title', $orderby, $order, $searchterm); ?> ">Titel<?php if ($orderby == 'title') { echo '<span class=sorting-indicator> </span>'; } ?> </a></th> <th width="20%" class="manage-column column-date <?php sort_class('author', $orderby, $order); ?> "><a href="<?php echo sort_link('author', $orderby, $order, $searchterm); ?> ">Autor<?php if ($orderby == 'author') { echo '<span class="sorting-indicator"></span>'; } ?> </a></th> <th width="20%" class="manage-column column-date <?php sort_class('publisher', $orderby, $order); ?> "><a href="<?php echo sort_link('publisher', $orderby, $order, $searchterm); ?> ">Verlag<?php if ($orderby == 'publisher') { echo '<span class="sorting-indicator"></span>'; } ?> </a></th> <th class="manage-column column-date <?php sort_class('info', $orderby, $order); ?> "><a href="<?php echo sort_link('info', $orderby, $order, $searchterm); ?> ">Information<?php if ($orderby == 'info') { echo '<span class="sorting-indicator"></span>'; } ?> </th> <th colspan="3" width="10"></th> </tr> </thead> <tbody> <?php /*<tr> <form action="admin.php?page=jakoblist&func=jakoblist_add" method="post"> <td><input name="title" type="text" size="30%" maxlength="200"><br /><em>Max. 200 Zeichen</em></td> <td><input name="author" type="text" size="30%" maxlength="200"><br /><em>Max. 200 Zeichen</em></td> <td><input name="publisher" type="text" size="30%" maxlength="200"><br /><em>Max. 200 Zeichen</em></td> <td><input name="info" type="text" size="50%" maxlength="200"><br /><em>Max. 200 Zeichen</em></td> <td><input name="price" type="text" size="10" maxlength="10"><br /><em>Max. 200 Zeichen</em></td> <td align="left" colspan="2"><input type="submit" name="add" value=" ✚ " class="button-primary" onclick=''></td> </form> </tr> */ ?> <?php global $wpdb; //Important! DBQueries don't work without this! /*if($_GET['search'] == '' ) { $books = $wpdb->get_results( "SELECT * FROM `".$wpdb->prefix."jakoblist` order by `".$orderby."`".$order."" ); } else { $books = $wpdb->get_results( "SELECT * FROM `".$wpdb->prefix."jakoblist` WHERE `title` LIKE '%".$searchterm."%' OR `author` LIKE '%".$searchterm."%' OR `publisher` LIKE '%".$searchterm."%' OR `info` LIKE '%".$searchterm."%' order by `".$orderby."` ".$order."" ); }*/ if (count($books) > 0) { /* keine Suchergebnisse */ foreach ($books as $book) { $thecurrency = ' €'; //temporary, check back soon $status = !$book->active ? '<br /><span class="post-state">Entwurf</span>' : ''; $class = 'alternate' != $class ? 'alternate' : ''; $editlink = get_bloginfo('wpurl') . '/wp-admin/admin.php?page=jakoblist_edit&id=' . $book->id; echo '<form action="" method="post"><tr class="' . $class . '">'; echo '<td><strong><a class="row-title" href="' . $editlink . '">' . strclean($book->title) . '</a>' . $status . '</strong></td>'; echo '<td>' . strclean($book->author) . '</td>'; echo '<td>' . strclean($book->publisher) . '</td>'; echo '<td>' . strclean($book->info) . '</td>'; echo '<td align="right">' . strclean($book->price) . $thecurrency . '</td>'; /*echo '<td align="left"><input type="button" name="edit" value=" ✎ " class="button-secondary" onclick=location.href="'; echo $editlink.'"'; echo '></td>';*/ echo '<td align="center"><input type="button" name="-" value=" - " class="button-secondary" onclick="if(confirm(\'Sind Sie sicher?\')) {location.href=\''; echo bloginfo('wpurl') . '/wp-admin/admin.php?page=jakoblist&func=jakoblist_remove&id=' . $book->id . '\'} else {return false;}"'; echo '></td>'; echo '</tr></form>'; } } ?> </tbody> </table> </div> <?php }