Inheritance: extends Eloquent
Exemple #1
0
 /**
  * @covers Ad::tableName
  * @todo   Implement CreateAd().
  */
 public function testCreateAd()
 {
     $this->object->name = 'test Ad1';
     $this->object->description = 'test Ad1 description';
     $this->object->html = '<p>This is a test Ad</p>';
     $this->assertTrue($this->object->save() === TRUE);
 }
Exemple #2
0
 protected function addAds(Ad $ad)
 {
     if (!$this instanceof AdStorage) {
         die("Нельзя использовать этот метод в конструкторе классов.");
     }
     $this->ads[$ad->getId()] = $ad;
 }
 protected function createFakerAd()
 {
     $faker = Faker::create();
     $adtype = array("Informal Jam", "Formal Jam/Practice/Rehearsal", "Payed Gig", "Offering Lessons", "Wanting Lessons");
     $level = array("Beginner", "Intermediate", "Semi-Pro", "Professional");
     $original = array("Originals", "Covers", "Both");
     $venuetype = array("House", "Venue", "Recording Studio", "Event");
     $usertype = array("Band", "Musician");
     $genre = array("Acoustic Blues", "Electric Blues", "Bluegrass", "Classical", "Pop Country", "Traditional Country", "House", "Deep House", "Dubstep", "Trap", "Techno", "Downtempo", "Ambient", "Drums & Bass", "Video Game", "Americana", "Acoustic Folk", "Cajun Folk", "Celtic Folk", "Singer/Songwriter Folk", "Combo Jazz", "Dixieland Jazz", "Ensemble Jazz", "Fusion Jazz", "Latin Jazz", "Standards", "Acid Jazz", "Latin", "New Age", "Ambient", "Christian", "Classic Rock", "Dance", "Hard Rock", "Heavy Metal", "Indie Rock", "Latin Rock", "New Wave", "Pop", "Psychedelic", "Punk Rock", "Rock & Roll", "Rockabilly", "Singer/Songwriter", "Ska", "Soft Rock", "Southern Rock", "Top 40", "Hip Hop/Rap", "Classic Soul", "Neo-Soul", "Gospel", "Contemporary R&B", "Reggae", "Soundtrack", "World Music");
     $instrument = array("Full Band, Acoustic Guitar", "Classical Guitar", "Electric Guitar", "Steel Guitar", "Electric Bass", "Double Bass", "Ukelele", "Piano", "Keyboard", "Organ", "Accordion", "Drums", "Lead Rock/Pop Vocals", "Lead Jazz Vocals", "Bass Singer", "Baritone Singer", "Tenor Singer", "Alto Singer", "Mezzo-Soprano Singer", "Soprano Singer", "Cello", "Viola", "Violin", "Fiddle", "Banjo", "Harp", "Mandolin", "Trumpet", "Trombone", "Tuba", "French Horn", "Alto Sax", "Tenor Sax", "Flute", "Oboe", "Clarinet", "Harmonica", "Piccolo", "Bassoon");
     $equipment = array("P/A System", "Guitar Amp", "Bass Amp", "Drum Set", "Keyboard");
     for ($i = 1; $i <= 200; $i++) {
         $ad = new Ad();
         $ad->ad_type = $faker->randomElement($adtype);
         $ad->ad_need = implode(", ", $faker->randomElements($instrument, $count = rand(1, 3)));
         $ad->ad_title = $faker->state . " " . $faker->lastName;
         $ad->level = $faker->randomElement($level);
         $ad->comp = rand(0, 200);
         $ad->genre = implode(", ", $faker->randomElements($genre, $count = rand(1, 3)));
         $ad->date = $faker->dateTimeBetween($startDate = 'now', $endDate = '3 months');
         $ad->start_time = $faker->time($format = 'H:i:s', $min = 'now');
         $ad->description = $faker->realText;
         $ad->equipment = implode(", ", $faker->randomElements($equipment, $count = rand(0, 5)));
         $ad->venue_type = $faker->randomElement($venuetype);
         $ad->venue = "Tycoon Flats";
         $ad->address = "2926 N. St. Marys Street";
         $ad->city = "San Antonio";
         $ad->state = "TX";
         $ad->zip_code = "78212";
         $ad->user_id = User::all()->random(1)->id;
         $ad->ad_img = $faker->imageUrl($width = 640, $height = 480, $category = 'nightlife');
         $ad->save();
     }
 }
Exemple #4
0
 public function run()
 {
     $model = new Ad();
     if (isset($_POST['Ad'])) {
         $model->attributes = $_POST['Ad'];
         //图片
         $model->attach_file = isset($_POST['attach_file']) ? $_POST['attach_file'] : '';
         if ($model->save()) {
             $this->controller->message('success', Yii::t('admin', 'Add Success'), $this->controller->createUrl('index'));
         }
     }
     $this->controller->render('create', array('model' => $model));
 }
 /**
  * Parser hook handler for {{#articletype}}
  *
  * @param Parser $parser : Parser instance available to render
  *  wikitext into html, or parser methods.
  *
  * @return string: HTML to insert in the page.
  */
 public static function renderGallery($input, array $args, Parser $parser, PPFrame $frame)
 {
     $parser->getOutput()->addModules('ext.promoter.gallery');
     $pageName = $parser->getTitle()->getText();
     try {
         $renderedAds = array();
         $adChooser = new AdChooser($pageName, !$parser->getUser()->isLoggedIn());
         $ads = $adChooser->getAds();
         foreach ($ads as $ad) {
             $renderedAds[] = Ad::fromName($ad['name'])->renderHtml();
         }
     } catch (AdCampaignExistenceException $e) {
         wfDebugLog('Promoter', $e->getMessage());
         //@todo i18n
         return '<span class="error">No campaign for this page</span>';
     } catch (MWException $e) {
         wfDebugLog('Promoter', $e->getMessage());
         return '<span class="error text-danger">An error occurred [' . $e->getMessage() . ']</span>';
     }
     $html = '<div class="promotion-gallery hidden hidden-print">' . '<h5 class="sr-only">זוהי גלריה המקדמת ערכים שונים באתר.</h5>' . '<div class="gallery-controls">' . '<span class="sr-only">בכל רגע מוצגות 3 ידיעות בגלריה. ניתן להציג ידיעה נוספת או לחזור לאחור באמצעות הכפתורים הבאים, או באמצעות מקשי החיצים כאשר הפוקוס הוא על הגלריה</span>' . '<a href="#" class="owl-prev"><span class="fa fa-chevron-right fa-lg" title="הקודם"></span><span class="sr-only">הצגת הידיעה הקודמת</span></a>' . '<a href="#" class="owl-next"><span class="fa fa-chevron-left fa-lg" title="הבא"></span><span class="sr-only">הצגת הידיעה הבאה</span></a>' . '</div>';
     if ($args['title']) {
         $html .= '<div class="header">' . $args['title'] . '</div>';
     }
     $html .= '<div class="owl-carousel clearfix" tabindex="0">' . implode('', $renderedAds) . '</div>' . '</div>';
     return $html;
 }
Exemple #6
0
 /**
  * @before _secure
  */
 public function campaign($id)
 {
     $ad = \Ad::first(['_id' => $id, 'org_id' => $this->org->_id]);
     if (!$ad) {
         $this->_404();
     }
     $this->seo(["title" => $ad->title]);
     $view = $this->getActionView();
     if (RM::post("action")) {
         // action value already checked in _postback func
         $this->_postback('add', ['ad' => $ad]);
     }
     if (RM::type() === 'DELETE') {
         $this->_postback('delete');
     }
     $start = RM::get("start", date('Y-m-d', strtotime("-7 day")));
     $end = RM::get("end", date('Y-m-d'));
     $limit = RM::get("limit", 10);
     $page = RM::get("page", 1);
     $query = ['adid' => Db::convertType($id), 'created' => Db::dateQuery($start, $end)];
     $clicks = \Click::all($query, [], 'created', 'desc', $limit, $page);
     $count = \Click::count($query);
     $cf = Utils::getConfig("cf", "cloudflare");
     $view->set("domain", $cf->api->domain)->set("clicks", $clicks)->set("count", $count)->set('advertiser', $this->user);
     $comms = Commission::all(["ad_id = ?" => $id], ['model', 'coverage', 'revenue', 'description']);
     $models = ArrayMethods::arrayKeys($comms, 'model');
     $advertiser = User::first(["id = ?" => $ad->user_id], ['name']);
     $categories = \Category::all(["org_id = ?" => $this->org->_id], ['name', '_id']);
     $this->_postback('show', ['ad' => $ad]);
     $view->set("ad", $ad)->set("comms", $comms)->set("categories", $categories)->set("advertiser", $advertiser)->set('models', $models)->set("start", $start)->set("end", $end);
 }
 public function testInstantArticleAlmostEmpty()
 {
     $article = InstantArticle::create()->withCanonicalUrl('')->withHeader(Header::create())->addChild(Paragraph::create()->appendText('Some text to be within a paragraph for testing.'))->addChild(Paragraph::create())->addChild(Paragraph::create()->appendText(" \n \t "))->addChild(Image::create())->addChild(Image::create()->withURL(''))->addChild(SlideShow::create()->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home.jpg'))->addImage(Image::create()))->addChild(Ad::create())->addChild(Paragraph::create()->appendText('Other text to be within a second paragraph for testing.'))->addChild(Analytics::create())->withFooter(Footer::create());
     $expected = '<!doctype html>' . '<html>' . '<head>' . '<link rel="canonical" href=""/>' . '<meta charset="utf-8"/>' . '<meta property="op:generator" content="facebook-instant-articles-sdk-php"/>' . '<meta property="op:generator:version" content="' . InstantArticle::CURRENT_VERSION . '"/>' . '<meta property="op:markup_version" content="v1.0"/>' . '</head>' . '<body>' . '<article>' . '<p>Some text to be within a paragraph for testing.</p>' . '<figure class="op-slideshow">' . '<figure>' . '<img src="https://jpeg.org/images/jpegls-home.jpg"/>' . '</figure>' . '</figure>' . '<p>Other text to be within a second paragraph for testing.</p>' . '</article>' . '</body>' . '</html>';
     $result = $article->render();
     $this->assertEquals($expected, $result);
 }
Exemple #8
0
 public function run()
 {
     $ids = Yii::app()->request->getParam('id');
     $command = Yii::app()->request->getParam('command');
     empty($ids) && $this->controller->message('error', Yii::t('admin', 'No Select'));
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', $ids);
     switch ($command) {
         case 'delete':
             //删除
             Ad::model()->deleteAll($criteria);
             break;
         case 'show':
             //显示
             Ad::model()->updateAll(['status' => Ad::STATUS_SHOW], $criteria);
             break;
         case 'hide':
             //隐藏
             Ad::model()->updateAll(['status' => Ad::STATUS_HIDE], $criteria);
             break;
         default:
             $this->controller->message('error', Yii::t('admin', 'Error Operation'));
     }
     $this->controller->message('success', Yii::t('admin', 'Batch Operate Success'));
 }
Exemple #9
0
function pageController()
{
    session_start();
    if (!isset($_SESSION['Loggedinuser'])) {
        $loginstatus = "Members, Log In!";
    } else {
        $loginstatus = $_SESSION['Loggedinuser'] . " is logged in!";
    }
    // Upon arrival at this page, this will load all the ads from the database.
    $adsArray = Ad::all();
    // Upon choosing a category, $clickcategories is set in $_GET. This variable is used to query the database.
    $clickedcategories = Input::has('clickcategory') ? '%' . Input::get('clickcategory') . '%' : '%';
    $adsArray = Ad::findCategories($clickedcategories);
    arsort($adsArray);
    // This portion of code gets all the ads' categories in one array.
    // The categories, which are strings (sometimes with multiple categories in it),
    // are then put into the array by themselves. The array is imploded into a string and then exploded into an
    // array again. This allows us to split the strings with multiple categories in them.
    // The php array_unique removes duplicate category values and sort orders them by first letter.
    $arrayCategories = Ad::showJustCategories();
    $justCategories = [];
    foreach ($arrayCategories as $key => $value) {
        array_push($justCategories, $value['categories']);
    }
    $justCategoriesString = implode(', ', $justCategories);
    $justCategoriesArray = explode(', ', $justCategoriesString);
    $justCategoriesArrayUnique = array_unique($justCategoriesArray);
    sort($justCategoriesArrayUnique);
    // This randomly selects an ad to show in the spotlight spatula box.
    $spotlight = $adsArray[array_rand($adsArray, 1)];
    return array('adsArray' => $adsArray, 'loginstatus' => $loginstatus, 'clickedcategories' => $clickedcategories, 'spotlight' => $spotlight, 'justCategoriesArrayUnique' => $justCategoriesArrayUnique);
}
Exemple #10
0
function pageController()
{
    $userArray = Auth::user();
    // returns array of ads by user's id
    $data = ['ads' => Ad::findAds($userArray['user_id'])];
    return $data;
}
Exemple #11
0
 public static function handleGetQuery(array $sanitized_get_array)
 {
     // The result of the request
     $ajax_result = array('status' => '', 'message' => '', 'data' => '');
     $id = (int) $sanitized_get_array['id'];
     $mode = $sanitized_get_array['mode'];
     if ($mode == 'show') {
         $ad_fields = Ad::find_by_id($id)->getFieldsForTemplate();
         unset($ad_fields['db_fields']);
         $ajax_result['status'] = 'success';
         $ajax_result['data'] = $ad_fields;
     } elseif ($mode == 'delete') {
         $ad_title = Ad::find_by_id($id)->getTitle();
         $sanitized_ad_title = htmlentities($ad_title);
         Ad::delete($id);
         $ajax_result['status'] = 'success';
         if (Ad::count_all()) {
             $ajax_result['message'] = 'Ad "' . $sanitized_ad_title . '" has been deleted successfully';
         } else {
             $ajax_result['message'] = 'There is no more ads in database';
         }
     } else {
         $ajax_result['status'] = 'error';
         $ajax_result['message'] = 'Undefined mode';
     }
     return $ajax_result;
 }
Exemple #12
0
 public function run()
 {
     //SEO
     $this->controller->_seoTitle = $this->controller->_setting['seo_title'];
     $this->controller->_seoKeywords = $this->controller->_setting['seo_keywords'];
     $this->controller->_seoDescription = $this->controller->_setting['seo_description'];
     //头部banner
     $index_top_banner = Ad::model()->getAdOne(4);
     //中部banner
     $index_mid_banner = Ad::model()->getAdOne(3);
     //底部banner
     $index_bottom_banner = Ad::model()->getAdOne(5);
     //最新资讯
     $news_new = Post::model()->getList(array('limit' => 20));
     //热门资讯
     $news_hot = Post::model()->getList(array('order' => 't.view_count DESC, t.id DESC', 'limit' => 20));
     //最新图集
     $image_new = Image::model()->getList(array('limit' => 10));
     //热门图集
     $image_hot = Image::model()->getList(array('limit' => 10, 'order' => 'view_count DESC, t.id DESC'));
     //最新软件
     $soft_new = Soft::model()->getList(array('limit' => 20));
     //热门软件
     $soft_hot = Soft::model()->getList(array('limit' => 10, 'order' => 'down_count DESC, t.id DESC'));
     //最新视频
     $video_new = Video::model()->findAll("status=:status AND catalog_id = 13 ORDER BY id DESC Limit 20", array(':status' => 'Y'));
     //热门视频
     $video_hot = Video::model()->findAll("status=:status AND catalog_id = 13 ORDER BY view_count DESC, video_score DESC, id DESC Limit 20", array(':status' => 'Y'));
     //友情链接
     $link_logos = Link::model()->findAll("logo !='' AND status='Y'", array('order' => 'sortorder ASC, id DESC'));
     $link_texts = Link::model()->findAll("logo ='' AND status='Y'", array('order' => 'sortorder ASC, id DESC'));
     $this->controller->render('index', array('index_top_banner' => $index_top_banner, 'index_mid_banner' => $index_mid_banner, 'index_bottom_banner' => $index_bottom_banner, 'link_logos' => $link_logos, 'link_texts' => $link_texts, 'news_new' => $news_new, 'news_hot' => $news_hot, 'image_new' => $image_new, 'image_hot' => $image_hot, 'soft_new' => $soft_new, 'soft_hot' => $soft_hot, 'video_new' => $video_new, 'video_hot' => $video_hot));
 }
 public function testHeaderWithSingleDefaultAd()
 {
     $header = Header::create()->addAd(Ad::create()->withSource('http://foo.com')->withWidth(350)->withHeight(50)->enableDefaultForReuse());
     // It should not set op-ad-default
     $expected = '<header>' . '<figure class="op-ad">' . '<iframe src="http://foo.com" width="350" height="50"></iframe>' . '</figure>' . '</header>';
     $rendered = $header->render();
     $this->assertEquals($expected, $rendered);
 }
 function getAds()
 {
     $conn =& $this->getConnection();
     $result = mysql_query('SELECT * FROM ' . $this->config['table']['prefix'] . 'zones', $conn);
     $returner = array();
     $this->plugin->import('Ad');
     while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
         $ad = new Ad($this);
         $ad->setName($row['zonename']);
         $ad->setAdId($row['zoneid']);
         $returner[] =& $ad;
         unset($ad);
     }
     mysql_free_result($result);
     mysql_close($conn);
     return $returner;
 }
Exemple #15
0
 public function inUse()
 {
     $count = Ad::count(['org_id' => $this->org_id, 'category' => ['$elemMatch' => ['$eq' => Utils::mongoObjectId($this->_id)]]]);
     if ($count === 0) {
         return false;
     } else {
         return true;
     }
 }
Exemple #16
0
 public static function vDeleteDuplicateUrlAds()
 {
     $aAllUrlRows = DirectDB::aSelect('ads_htmls', array(), 'url', 'GROUP BY url');
     $aAllUrls = Utilitu::aExtractFieldFromArray($aAllUrlRows, 'url');
     foreach ($aAllUrls as $sUrl) {
         $aUrlAdIDs = Ad::aGetAdIDsByUrl($sUrl);
         $iPopped = array_pop($aUrlAdIDs);
         DirectDB::bDelete('ads', array('id' => $aUrlAdIDs));
     }
 }
Exemple #17
0
 public function run()
 {
     $model = new Ad();
     //条件
     $criteria = new CDbCriteria();
     $title = trim(Yii::app()->request->getParam('title'));
     $position_id = intval(Yii::app()->request->getParam('position_id'));
     $title && $criteria->addColumnCondition(array('title' => $title));
     $position_id && $criteria->addColumnCondition(array('position_id', $position_id));
     $criteria->order = 't.id ASC';
     $count = $model->count($criteria);
     //分页
     $pages = new CPagination($count);
     $pages->pageSize = 10;
     $pages->applyLimit($criteria);
     //查询
     $result = $model->findAll($criteria);
     $this->controller->render('index', array('model' => $model, 'datalist' => $result, 'pagebar' => $pages));
 }
Exemple #18
0
 public static function saveAdToRt($adID)
 {
     $ad = Ad::model()->findByPk($adID);
     $connection = new CDbConnection(Yii::app()->params['sphinx']['dsn'], Yii::app()->params['sphinx']['user'], Yii::app()->params['sphinx']['pass']);
     $connection->active = true;
     $sphinxIndexes = Yii::app()->params['sphinx']['indexes'];
     $rt = $sphinxIndexes['rt'][0];
     $sql = "INSERT INTO {$rt} (id, title, description, added)\n                VALUES (:id, :title, :description, :added)";
     $command = $connection->createCommand($sql);
     $command->execute(array(':id' => $ad->id, ':title' => $ad->title, ':description' => $ad->description, ':added' => time()));
 }
Exemple #19
0
 /**
  * 判断数据是否存在
  * 
  * return \$this->model
  */
 public function loadModel()
 {
     if ($this->model === null) {
         if (isset($_GET['id'])) {
             $this->model = Ad::model()->findbyPk($_GET['id']);
         }
         if ($this->model === null) {
             throw new CHttpException(404, Yii::t('common', 'The requested page does not exist.'));
         }
     }
     return $this->model;
 }
Exemple #20
0
 /**
  * @before _secure
  * @after setDate
  */
 public function campaign($id = null)
 {
     $this->seo(["title" => "Campaign Insights"]);
     $view = $this->getActionView();
     $org = $this->org;
     $ad = Ad::first(['_id' => $id, 'org_id' => $org->_id]);
     if (!$ad) {
         $this->_404();
     }
     $data = Shared\Services\Campaign::performance($id, ['start' => $this->start, 'end' => $this->end, 'pid' => $this->user_id, 'meta' => true]);
     $view->set('stats', $data['stats'])->set('total', $data['total']);
 }
Exemple #21
0
 public function fill($getParam = 'search')
 {
     $attributes = Ad::getEavList();
     foreach ($_GET[$getParam] as $key => $value) {
         if (!in_array($key, $attributes)) {
             continue;
         }
         $this->eav[$key] = $value;
     }
     $this->region_id = Yii::app()->request->getQuery('region_id');
     $this->city_id = Yii::app()->request->getQuery('city_id');
     $this->word = Yii::app()->request->getQuery('word');
 }
Exemple #22
0
function pageController()
{
    session_start();
    if (!Auth::check()) {
        header('Location: /auth/login');
        exit;
    }
    $username = Auth::user();
    $user = User::findUserByUsername($username);
    $user_id = $user->attributes['id'];
    $ads_list = Ad::findByUserId($user_id);
    return array('username' => $username, 'ads_list' => $ads_list);
}
 public function __construct($promotionLine = null, $id = null, $url = null, $displayUrl = null, $finalUrls = null, $finalMobileUrls = null, $trackingUrlTemplate = null, $urlCustomParameters = null, $devicePreference = null, $AdType = null)
 {
     parent::__construct();
     $this->promotionLine = $promotionLine;
     $this->id = $id;
     $this->url = $url;
     $this->displayUrl = $displayUrl;
     $this->finalUrls = $finalUrls;
     $this->finalMobileUrls = $finalMobileUrls;
     $this->trackingUrlTemplate = $trackingUrlTemplate;
     $this->urlCustomParameters = $urlCustomParameters;
     $this->devicePreference = $devicePreference;
     $this->AdType = $AdType;
 }
Exemple #24
0
function pageController()
{
    session_start();
    if (!Auth::check()) {
        header('Location: /auth/login');
        exit;
    }
    $username = Auth::user();
    $user = User::findUserByUsername($username);
    $adid = Input::get('id');
    $ad = Ad::find($adid);
    $item_name = $ad->attributes['item_name'];
    $price = $ad->attributes['price'];
    $description = $ad->attributes['description'];
    $image_path = $ad->attributes['image_path'];
    $contact = $ad->attributes['contact'];
    $errors = array();
    if (!empty($_POST)) {
        if (Input::notEmpty('item_name')) {
            $item_name = ValidateAd::getItemName();
        }
        if (Input::notEmpty('price')) {
            $price = ValidateAd::getPrice();
        }
        if (Input::notEmpty('description')) {
            $description = ValidateAd::getDescription();
        }
        if (Input::notEmpty('contact')) {
            $contact = ValidateAd::getContact();
        }
        $errors = ValidateAd::getErrors();
        if (empty($errors)) {
            $ad->attributes['item_name'] = $item_name;
            $ad->attributes['price'] = $price;
            $ad->attributes['description'] = $description;
            $ad->attributes['contact'] = $contact;
            $ad->attributes['image_path'] = $image_path;
            $ad->save();
        }
        if (!Input::notEmpty('delete-id')) {
            //if the form has been submitted
            Ad::delete($ad->attributes['id']);
            header("Location: /ads");
            die;
            //delete the specific ad - going to need to somehow tie in the ad id to the delete buttn for that specific id
        }
    }
    return array('ad' => $ad, 'username' => $username, 'item_name' => $item_name, 'price' => $price, 'description' => $description, 'image_path' => $image_path, 'contact' => $contact);
}
 /**
  * Generate the content of each table row (1 row = 1 ad)
  *
  * @param $row object: database row
  *
  * @return string HTML
  */
 function formatRow($row)
 {
     // Begin ad row
     $htmlOut = Xml::openElement('tr');
     if ($this->editable) {
         // Remove box
         $htmlOut .= Xml::tags('td', array('valign' => 'top'), Xml::check('removeAds[]', false, array('value' => $row->ad_name, 'onchange' => $this->onRemoveChange)));
     }
     // Preview
     $ad = Ad::fromName($row->ad_name);
     $htmlOut .= Xml::tags('td', array('valign' => 'top'), $ad->linkToPreview());
     // End ad row
     $htmlOut .= Xml::closeElement('tr');
     return $htmlOut;
 }
 public function __construct($image = null, $name = null, $adToCopyImageFrom = null, $id = null, $url = null, $displayUrl = null, $finalUrls = null, $finalMobileUrls = null, $trackingUrlTemplate = null, $urlCustomParameters = null, $devicePreference = null, $AdType = null)
 {
     parent::__construct();
     $this->image = $image;
     $this->name = $name;
     $this->adToCopyImageFrom = $adToCopyImageFrom;
     $this->id = $id;
     $this->url = $url;
     $this->displayUrl = $displayUrl;
     $this->finalUrls = $finalUrls;
     $this->finalMobileUrls = $finalMobileUrls;
     $this->trackingUrlTemplate = $trackingUrlTemplate;
     $this->urlCustomParameters = $urlCustomParameters;
     $this->devicePreference = $devicePreference;
     $this->AdType = $AdType;
 }
Exemple #27
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     //首页banner幻灯片
     $banner = Ad::model()->findAll('position_id=:pid', array(':pid' => 1));
     //SEO
     $this->_seoTitle = $this->_setting['seo_title'];
     $this->_seoKeywords = $this->_setting['seo_keywords'];
     $this->_seoDescription = $this->_setting['seo_description'];
     //加载css,js
     Yii::app()->clientScript->registerCssFile($this->_stylePath . "/css/index.css");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/jquery/jquery.js");
     //友情链接
     $link_logos = Link::model()->findAll("logo !='' AND status_is='Y'", array('order' => 'sortorder ASC, id DESC'));
     $link_texts = Link::model()->findAll("logo ='' or logo is null AND status_is='Y'", array('order' => 'sortorder ASC, id DESC'));
     $this->render('index', compact(array('link_logos', 'link_texts')));
 }
 public function __construct($markupLanguages = null, $mobileCarriers = null, $image = null, $id = null, $url = null, $displayUrl = null, $finalUrls = null, $finalMobileUrls = null, $trackingUrlTemplate = null, $urlCustomParameters = null, $devicePreference = null, $AdType = null)
 {
     parent::__construct();
     $this->markupLanguages = $markupLanguages;
     $this->mobileCarriers = $mobileCarriers;
     $this->image = $image;
     $this->id = $id;
     $this->url = $url;
     $this->displayUrl = $displayUrl;
     $this->finalUrls = $finalUrls;
     $this->finalMobileUrls = $finalMobileUrls;
     $this->trackingUrlTemplate = $trackingUrlTemplate;
     $this->urlCustomParameters = $urlCustomParameters;
     $this->devicePreference = $devicePreference;
     $this->AdType = $AdType;
 }
function pageController($dbc)
{
    if (isset($_GET['ad-id'])) {
        $oneAd = Ad::adWithAllFields($_GET['ad-id']);
    } else {
        header("Location: ads.index.php");
        die;
    }
    $ad = $oneAd->getAttributes();
    $ad['keywords'] = implode(', ', $ad['keywords']);
    $ad['price'] = '$' . number_format($ad['price'], 2, '.', ',');
    $ad['date_posted'] = new DateTime($ad['date_posted']);
    $ad['date_posted'] = $ad['date_posted']->format('F d, Y');
    // var_dump($ad);
    return array('ad' => $ad);
}
Exemple #30
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     //首页banner幻灯片
     $banner = Ad::model()->findAll('position_id=:pid', array(':pid' => 1));
     //SEO
     $this->_seoTitle = $this->_setting['seo_title'];
     $this->_seoKeywords = $this->_setting['seo_keywords'];
     $this->_seoDescription = $this->_setting['seo_description'];
     //加载css,js
     Yii::app()->clientScript->registerCssFile($this->_stylePath . "/css/index.css");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/jquery/jquery.js");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/jquery/jquery.easytabs.min.js");
     //头部banner
     $index_top_banner = Ad::model()->getAdOne(4);
     //中部banner
     $index_mid_banner = Ad::model()->getAdOne(3);
     //底部banner
     $index_bottom_banner = Ad::model()->getAdOne(5);
     //最新资讯
     Yii::app()->cache && ($news_new = Yii::app()->cache->get('news_new'));
     if ($news_new == false) {
         $news_new = Post::model()->getList(array('limit' => 20));
         Yii::app()->cache && Yii::app()->cache->set('news_new', $news_new);
     }
     //热门资讯
     Yii::app()->cache && ($news_hot = Yii::app()->cache->get('news_host'));
     if ($news_hot == false) {
         $news_hot = Post::model()->getList(array('order' => 't.view_count DESC, t.id DESC', 'limit' => 20));
         Yii::app()->cache && Yii::app()->cache->set('news_hot', $news_hot);
     }
     //最新图集
     $image_new = Image::model()->getList(array('limit' => 10));
     //热门图集
     $image_hot = Image::model()->getList(array('limit' => 10, 'order' => 'view_count DESC, t.id DESC'));
     //最新软件
     $soft_new = Soft::model()->getList(array('limit' => 20));
     //热门软件
     $soft_hot = Soft::model()->getList(array('limit' => 10, 'order' => 'down_count DESC, t.id DESC'));
     //最新视频
     //$video_new = Video::model()->findAll("status=:status AND catalog_id = 13 ORDER BY id DESC Limit 20", array(':status'=>'Y'));
     //热门视频
     //$video_hot = Video::model()->findAll("status=:status AND catalog_id = 13 ORDER BY view_count DESC, video_score DESC, id DESC Limit 20", array(':status'=>'Y'));
     //友情链接
     $link_logos = Link::model()->findAll("logo !='' AND status_is='Y'", array('order' => 'sortorder ASC, id DESC'));
     $link_texts = Link::model()->findAll("logo ='' or logo is null AND status_is='Y'", array('order' => 'sortorder ASC, id DESC'));
     $this->render('index', compact(array('index_top_banner', 'index_mid_banner', 'index_bottom_banner', 'link_logos', 'link_texts', 'news_new', 'news_hot', 'image_new', 'image_hot', 'soft_new', 'soft_hot', 'video_new', 'video_hot')));
 }