$c->videoCatTitle = $_POST["catTitle"]; if ($c->tntUpdateVideoCat() >= 0) { $location = add_query_arg(array('m' => 1)); } else { if ($t->tntUpdateVideoType() == false) { $location = add_query_arg(array('m' => 0)); } } Header("Location: {$location}"); } /** * Process: Delete Video Category (Click Yes) */ if (isset($_POST['tntDelVideoCat_Yes'])) { $location = admin_url() . "/admin.php?page=tnt_video_cat_manager_page"; $c = new TNT_VideoCat(); $c->videoCatID = $_POST["catID"]; $args = array('catID' => $c->videoCatID); $videos = TNT_Video::tntGetVideos($args); if ($videos != null) { wp_die("This cat is having videos"); } else { //Delete video cat $c->tntDeleteVideoCat(); } Header("Location: {$location}"); } /** * Process: Delete Video Category (Click No) */ if (isset($_POST['tntDelVideoCat_No'])) {
/** * 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 "delete video cat" page */ function tnt_video_cat_del() { ?> <div class="wrap"> <?php screen_icon('edit'); ?> <h2>Delete Video Category</h2> <?php $c = new TNT_VideoCat(); $catID = isset($_GET['catID']) ? $_GET['catID'] : 0; if ($catID != 0) { $c->tntGetCat($catID); } else { wp_die("catID not found"); } ?> <form method="POST" action=""> <input type="hidden" name="catID" value="<?php echo $c->videoCatID; ?> " /> <div style="padding-bottom: 10px;"> <p>Do you want to delete the video type "<?php echo $c->videoCatTitle; ?> " ? </p> <input type="submit" name="tntDelVideoCat_Yes" class="button-secondary" value="Yes" /> <input type="submit" name="tntDelVideoCat_No" class="button-secondary" value="No" /> </div> </form> </div> <?php }