当前位置: 首页>>代码示例>>PHP>>正文


PHP Ad::model方法代码示例

本文整理汇总了PHP中Ad::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Ad::model方法的具体用法?PHP Ad::model怎么用?PHP Ad::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ad的用法示例。


在下文中一共展示了Ad::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 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'));
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:28,代码来源:BatchAction.php

示例2: run

 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));
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:33,代码来源:IndexAction.php

示例3: saveAdToRt

 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()));
 }
开发者ID:nsdvw,项目名称:classifieds,代码行数:11,代码来源:SphinxService.php

示例4: loadModel

 /**
  * 判断数据是否存在
  * 
  * 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;
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:17,代码来源:AdController.php

示例5: actionIndex

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $criteria = new CDbCriteria();
     $criteria->addInCondition('level', array(1, 2));
     $criteria->order = 'root, lft';
     $categories = Category::model()->findAll($criteria);
     $form = new SearchForm();
     $criteria = new CDbCriteria(array('condition' => 'status="published"', 'order' => 'added DESC', 'with' => array('photos'), 'limit' => 20));
     $models = Ad::model()->withEavAttributes()->findAll($criteria);
     $dp = new CActiveDataProvider('Ad', array('data' => $models, 'pagination' => false));
     $regionList = Region::model()->getRegionList();
     $this->render('index', array('categories' => $categories, 'form' => $form, 'dataProvider' => $dp, 'regionList' => $regionList));
 }
开发者ID:nsdvw,项目名称:classifieds,代码行数:17,代码来源:SiteController.php

示例6: actionIndex

 /**
  * 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')));
 }
开发者ID:github-zjh,项目名称:task,代码行数:20,代码来源:SiteController.php

示例7: actionIndex

 /**
  * 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')));
 }
开发者ID:jzxyouok,项目名称:yiifcms,代码行数:51,代码来源:SiteController.php

示例8: actionIndex

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $ads = Ad::model()->findAll();
     $posts = Post::model()->findAll(new CDbCriteria(array('limit' => 5, 'order' => 'id desc')));
     $hotCategories = Category::model()->hot()->level(2)->limit(3)->findAll();
     $hotItems = array();
     foreach ($hotCategories as $hotCategory) {
         $hotItems[$hotCategory->name] = Item::getItemsByCategory($hotCategory, 4);
     }
     $newCategories = Category::model()->new()->level(2)->limit(3)->findAll();
     $newItems = array();
     foreach ($newCategories as $key => $newCategory) {
         if ($key == 0) {
             $newItems[$newCategory->name] = Item::getItemsByCategory($newCategory, 7);
         } else {
             $newItems[$newCategory->name] = Item::getItemsByCategory($newCategory, 8);
         }
     }
     Yii::app()->params['ads'] = $ads;
     //        $newItems[0] = array_slice($newItems[0], 7);
     $this->render('index', array('ads' => $ads, 'posts' => $posts, 'hotCategories' => $hotCategories, 'hotItems' => $hotItems, 'newCategories' => $newCategories, 'newItems' => $newItems));
 }
开发者ID:lhfcainiao,项目名称:basic,代码行数:26,代码来源:DefaultController.php

示例9:

<div class="main-container col1-layout">
    <div class="main container show-bg">
        <div class="preface grid-full in-col1">
            <div class="the-slideshow-wrapper nested-container clearer">
                <div class="the-slideshow gen-slider-arrows2 gen-slider-pager1 gen-slider-pager1-pos-bottom-right grid12-9  ">

                    <!--<div class="viewport" style="overflow: hidden; position: relative; height: 390px;">-->
                        <ul class="slides">
                            <?php 
$ad_list = Ad::model()->findAll();
foreach ($ad_list as $k => $a) {
    ?>
                            <li>
                                <a title="Click to see all features" href="<?php 
    echo $a->url;
    ?>
">
                                    <?php 
    echo CHtml::image(F::baseUrl() . '/../../upload/ad/' . $a->pic);
    ?>
                                    <div class="caption dark3">
                                        <h2 class="heading permanent"><?php 
    echo $a->title;
    ?>
</h2>
                                        <p><?php 
    echo $a->content;
    ?>
</p>
                                    </div>
                                </a>
开发者ID:yinhe,项目名称:yincart,代码行数:31,代码来源:index.php

示例10: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Ad::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:zwq,项目名称:unpei,代码行数:13,代码来源:AdController.php

示例11: run

 public function run()
 {
     $cri = new CDbCriteria(array('order' => 'sort_order asc'));
     $ads = Ad::model()->findAll($cri);
     $this->render('ad', array('ads' => $ads));
 }
开发者ID:jackycgq,项目名称:advanced,代码行数:6,代码来源:WAd.php

示例12: actionBatch

 /**
  * 批量操作
  *
  */
 public function actionBatch()
 {
     if ($this->method() == 'GET') {
         $command = trim($_GET['command']);
         $ids = intval($_GET['id']);
     } else {
         if ($this->method() == 'POST') {
             $command = trim($_POST['command']);
             $ids = $_POST['id'];
         } else {
             $this->message('errorBack', Yii::t('admin', 'Only POST Or GET'));
         }
     }
     empty($ids) && $this->message('error', Yii::t('admin', 'No Select'));
     switch ($command) {
         case 'adDelete':
             foreach ((array) $ids as $id) {
                 $adModel = Ad::model()->findByPk($id);
                 if ($adModel) {
                     Uploader::deleteFile($adModel->attach_file);
                     $adModel->delete();
                 }
             }
             break;
         case 'adVerify':
             foreach ((array) $ids as $id) {
                 $adModel = Ad::model()->findByPk($id);
                 if ($adModel) {
                     $adModel->status = 'Y';
                     $adModel->save();
                 }
             }
             break;
         case 'adUnVerify':
             foreach ((array) $ids as $id) {
                 $adModel = Ad::model()->findByPk($id);
                 if ($adModel) {
                     $adModel->status = 'N';
                     $adModel->save();
                 }
             }
             break;
         default:
             throw new CHttpException(404, Yii::t('admin', 'Error Operation'));
             break;
     }
     $this->message('success', Yii::t('admin', 'Batch Operate Success'), $this->createUrl('index'));
 }
开发者ID:redtreelchao,项目名称:wander-moon,代码行数:52,代码来源:AdController.php

示例13: getad

 public static function getad($id)
 {
     $ad = Ad::model()->find('id=:id', array('id' => $id));
     return $ad;
 }
开发者ID:s-nice,项目名称:snece,代码行数:5,代码来源:Common.php

示例14: getAds

 public function getAds()
 {
     $cri = new CDbCriteria(array('condition' => 'theme LIKE "%default%"', 'order' => 'sort_order asc'));
     $ads = Ad::model()->findAll($cri);
     return $ads;
 }
开发者ID:zwq,项目名称:unpei,代码行数:6,代码来源:WAd.php

示例15: getAds

 /**
  * @author: Biner
  * @date: 2010-12-14上午02:23:42
  * @description: 获得广告
  */
 public function getAds($limit = 8, $location_id)
 {
     if ($limit == 0) {
         $rows = array();
     } else {
         $rows = Ad::model()->getAdList($limit, 0, $location_id);
     }
     return $rows;
 }
开发者ID:vangogogo,项目名称:justsns,代码行数:14,代码来源:m_common.php


注:本文中的Ad::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。