$t->videoTypeTitle = $_POST["typeTitle"]; if ($t->tntUpdateVideoType() >= 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 Type (Click Yes) */ if (isset($_POST['tntDelVideoType_Yes'])) { $location = admin_url() . "/admin.php?page=tnt_video_type_manager_page"; $t = new TNT_VideoType(); $t->videoTypeID = $_POST["typeID"]; //Update status of videos have typeID deleted into 0 (unpubslished) $args = array('typeID' => $t->videoTypeID); $videos = TNT_Video::tntGetVideos($args); if ($videos != null) { wp_die("This type is having videos"); } else { //Delete video type $t->tntDeleteVideoType(); } Header("Location: {$location}"); } /** * Process: Delete Video Type (Click No) */
/** * Display List of Video Type * @param int ID of type selected * @return string the selecbox contains list types */ public static function tntDisplayListType($typeID = 0) { $listType = TNT_VideoType::tntGetTypes(); $view = ""; $view .= '<select name="vLinkType">'; foreach ($listType as $type) { if ($typeID == $type->video_type_id) { $view .= '<option value="' . $type->video_type_id . '" selected>' . $type->video_type_title . '</option>'; } else { $view .= '<option value="' . $type->video_type_id . '">' . $type->video_type_title . '</option>'; } } $view .= '</select>'; return $view; }
/** * Function to display the "delete video type" page */ function tnt_video_type_del() { ?> <div class="wrap"> <?php screen_icon('edit'); ?> <h2>Delete Video Type</h2> <?php $t = new TNT_VideoType(); $typeID = isset($_GET['typeID']) ? $_GET['typeID'] : 0; if ($typeID != 0) { $t->tntGetType($typeID); } else { wp_die("typeID not found"); } ?> <form method="POST" action=""> <input type="hidden" name="typeID" value="<?php echo $t->videoTypeID; ?> " /> <div style="padding-bottom: 10px;"> <p>Do you want to delete the video type "<?php echo $t->videoTypeTitle; ?> [<?php echo $t->videoTypeWidth; ?> x<?php echo $t->videoTypeHeight; ?> ]" ? </p> <input type="submit" name="tntDelVideoType_Yes" class="button-secondary" value="Yes" /> <input type="submit" name="tntDelVideoType_No" class="button-secondary" value="No" /> </div> </form> </div> <?php }