/** * Display List of Video Category * @param int ID of category selected * @return string the selecbox contains list category */ public static function tntDisplayListCat($catID = 0) { $listCat = TNT_VideoCat::tntGetCats(); $view = ""; $view .= '<select name="vCat">'; foreach ($listCat as $cat) { if ($catID == $cat->video_cat_id) { $view .= '<option value="' . $cat->video_cat_id . '" selected>' . $cat->video_cat_title . '</option>'; } else { $view .= '<option value="' . $cat->video_cat_id . '">' . $cat->video_cat_title . '</option>'; } } $view .= '</select>'; return $view; }
/** * Function to display the "video category manage" page */ function tnt_video_cat_manager() { ?> <div class="wrap"> <?php screen_icon('upload'); ?> <h2>Video Category Manage</h2> <hr /> <table class="tntTable widefat"> <thead> <tr> <th>ID</th> <th>Title</th> <th>Amount of Videos</th> <th>Parent</th> <th>Shortcode</th> <th>Action</th> </tr> </thead> <tfoot> <tr> <th>ID</th> <th>Title</th> <th>Amount of Videos</th> <th>Parent</th> <th>Shortcode</th> <th>Action</th> </tr> </tfoot> <tbody> <?php $tntVideoCats = TNT_VideoCat::tntGetCats(); foreach ($tntVideoCats as $tntC) { ?> <tr> <td><?php echo $tntC->video_cat_id; ?> </td> <td><b><a href="<?php echo admin_url(); ?> admin.php?page=tnt_video_cat_edit_page&catID=<?php echo $tntC->video_cat_id; ?> "><?php echo $tntC->video_cat_title; ?> </a></b></td> <td> <?php $videos = TNT_Video::tntGetVideos(array('catID' => $tntC->video_cat_id)); $videosCount = count($videos); ?> <b><a href="<?php echo admin_url(); ?> admin.php?page=tnt_video_manage_page&vCat=<?php echo $tntC->video_cat_id; ?> "><?php echo $videosCount; ?> </a></b> </td> <td><?php echo $tntC->video_cat_parent_id; ?> </td> <td><?php echo '[tnt_video_list id=' . $tntC->video_cat_id . ']'; ?> </td> <td> <a href="<?php echo admin_url(); ?> admin.php?page=tnt_video_cat_edit_page&catID=<?php echo $tntC->video_cat_id; ?> " class="button-secondary">Edit</a> <a href="<?php echo admin_url(); ?> admin.php?page=tnt_video_cat_del_page&catID=<?php echo $tntC->video_cat_id; ?> " class="button-secondary">Delete</a> </td> </tr> <?php } ?> </tbody> </table> </div> <?php }