示例#1
0
        exit;
    } else {
        if (!empty($_GET['del']) && $id) {
            Admin::checkAccess(AdminAccess::ACCESS_DELETE);
            $ad->delById($id);
            header("Location: vclub_ad.php");
            exit;
        }
    }
}
if (!empty($_GET['edit']) && !empty($id)) {
    $current_ad = $ad->getById($id);
}
$ads = $ad->getAllWithStatForMonth();
if (!empty($_GET['id'])) {
    $denied_categories = $ad->getDeniedVclubCategoriesForAd((int) $_GET['id']);
} else {
    $denied_categories = array();
}
$video_category = new VideoCategory();
$video_categories = $video_category->getAll();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">

body {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
}
 public function toggle_video_ads_status()
 {
     if (!$this->isAjax || $this->method != 'POST' || empty($this->postData['adsid']) || !isset($this->postData['adsstatus'])) {
         $this->app->abort(404, $this->setlocalization('Page not found'));
     }
     if ($no_auth = $this->checkAuth()) {
         return $no_auth;
     }
     $data = array();
     $data['action'] = 'toggleVideoAdsStatus';
     $error = $this->setlocalization('Failed');
     $ad = new \VclubAdvertising();
     if ($ad->updateById((int) $this->postData['adsid'], array('status' => (int) $this->postData['adsstatus'], 'denied_categories' => $ad->getDeniedVclubCategoriesForAd((int) $this->postData['adsid'])))) {
         $error = '';
         $data['title'] = $this->postData['adsstatus'] ? $this->setLocalization('Unpublish') : $this->setlocalization('Publish');
         $data['status'] = '<span data-filter="status" >' . ($this->postData['adsstatus'] ? $this->setlocalization('Published') : $this->setlocalization('Not published')) . '</span>';
         $data['adsstatus'] = (int) (!$this->postData['adsstatus']);
     }
     $response = $this->generateAjaxResponse($data, $error);
     return new Response(json_encode($response), empty($error) ? 200 : 500);
 }