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


PHP Area::getTops方法代码示例

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


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

示例1: actionIndex

 public function actionIndex()
 {
     $this->poiType = zmf::filterInput($_GET['type']);
     $this->poiOrder = zmf::filterInput($_GET['order']);
     $areaid = zmf::filterInput($_GET['areaid']);
     if (!$this->poiOrder || !in_array($this->poiOrder, array('1', '2'))) {
         $this->poiOrder = '1';
     }
     $where = $order = '';
     if ($areaid) {
         $extra = Area::getAreaInfo($areaid);
         $areaIds = $extra['areaIds'];
         $areaInfo = $extra['areaInfo'];
         if ($areaIds) {
             $where .= " areaid IN({$areaIds}) AND ";
         }
     }
     $_typename = Position::exClassify($this->poiType);
     if ($this->poiType && $_typename && !is_array($_typename)) {
         $where .= " classify='{$this->poiType}' AND ";
     } else {
         $this->poiType = '';
         $_typename = '的景点、酒店、餐厅及购物';
     }
     if ($this->poiOrder == '1') {
         $order = ' ORDER BY score DESC';
     } elseif ($this->poiOrder == '2') {
         $order = ' ORDER BY scorer DESC';
     }
     //获取景点列表
     $sql = "SELECT id,title_cn,title_en,title_local,address_cn,address_en,address_local,score,scorer,attach,lat,`long`,faceimg,classify FROM {{position}} WHERE {$where} forWedding=1 AND status=" . Posts::STATUS_PASSED . $order;
     Posts::getAll(array('sql' => $sql), $pages, $posts);
     //获取所有受推荐地区
     $areas = Area::getTops(0);
     //面包屑
     $breads[] = CHtml::link('目的地', array('position/index'));
     if ($areaInfo) {
         $breads[] = $areaInfo['title'];
     }
     //页面SEO
     $this->pageTitle = '目的地 - ' . zmf::config('sitename');
     $this->render('index', array('posts' => $posts, 'pages' => $pages, 'areas' => $areas, 'breads' => $breads, 'areaId' => $areaid));
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:43,代码来源:PositionController.php

示例2: actionShow

 /**
  * 按地区显示的主页
  */
 public function actionShow()
 {
     $areaid = zmf::filterInput($_GET['areaid']);
     $where = $order = $areaInfo = '';
     if ($areaid) {
         $extra = Area::getAreaInfo($areaid);
         $areaIds = $extra['areaIds'];
         $areaInfo = $extra['areaInfo'];
         if ($areaIds) {
             $where .= " areaid IN({$areaIds}) AND ";
         }
     }
     //获取热门游记
     $_postsql = "SELECT * FROM {{posts}} WHERE {$where} classify='" . Posts::CLASSIFY_TRAVEL_LOG . "' AND status=" . Posts::STATUS_PASSED . " ORDER BY cTime DESC LIMIT 8";
     $posts = Yii::app()->db->createCommand($_postsql)->queryAll();
     if (!empty($posts)) {
         foreach ($posts as $k => $p) {
             $posts[$k]['coltitle'] = '';
             if ($p['colid']) {
                 $coltitle = Column::getOne($p['colid'], 'title');
                 if ($coltitle) {
                     $posts[$k]['coltitle'] = $coltitle;
                 }
             }
         }
     }
     //获取图片
     //        $_attsql = "SELECT * FROM {{attachments}} WHERE areaid IN(" . $this->areaIds . ") AND classify='poi' AND status=" . Posts::STATUS_PASSED . " ORDER BY  cTime DESC LIMIT 8";
     //        $attaches = Yii::app()->db->createCommand($_attsql)->queryAll();
     //获取点评
     //        $_postsql = "SELECT * FROM {{poi_post}} WHERE areaid IN(" . $this->areaIds . ") AND status=" . Posts::STATUS_PASSED . " ORDER BY cTime DESC LIMIT 5";
     //        $poiposts = Yii::app()->db->createCommand($_postsql)->queryAll();
     //        foreach ($poiposts as $k => $poipost) {
     //            $_info = Posts::getSimpleInfo(array('keyid' => $poipost['logid'], 'origin' => 'position'), 'title');
     //            $poiposts[$k]['poiTitle'] = $_info;
     //        }
     //将问题和回答混合到动态里
     //        $_qasql = "SELECT * FROM ((SELECT 'question' AS type,id,uid,'logid',title,content,cTime,answers,comments,favorite AS favor,'nouse' FROM {{question}} WHERE areaid IN(" . $this->areaIds . ") AND status=" . Posts::STATUS_PASSED . " ORDER BY cTime DESC LIMIT 5) UNION (SELECT 'answer' AS type,id,uid,logid,'title',content,cTime,'answers',comments,favor,nouse FROM {{answer}} WHERE areaid IN(" . $this->areaIds . ") AND status=" . Posts::STATUS_PASSED . " ORDER BY cTime DESC LIMIT 5)) as t ORDER BY t.cTime DESC";
     //        $questions = Yii::app()->db->createCommand($_qasql)->queryAll();
     //        foreach ($questions as $k => $v) {
     //            if ($v['type'] == 'answer') {
     //                $_info = Posts::getSimpleInfo(array('keyid' => $v['logid'], 'origin' => 'question'), 'title');
     //                $questions[$k]['qtitle'] = $_info;
     //            }
     //        }
     //热门坐标
     $_poisql = "SELECT id,title_cn,title_en,title_local,address_cn,address_en,address_local,score,scorer,attach,lat,`long`,faceimg,classify FROM {{position}} WHERE {$where} status=" . Posts::STATUS_PASSED . " ORDER BY scorer DESC LIMIT 5";
     $positions = Yii::app()->db->createCommand($_poisql)->queryAll();
     //获取小提示
     //        $_poi_tips_sql = "SELECT 'PoiTips' AS type,id,uid,content,'score','cost',favor,comments,cTime,platform FROM {{poi_tips}} WHERE logid={$this->theAreaId} AND classify=" . Position::AREA . " AND status=" . Posts::STATUS_PASSED . " ORDER BY favor LIMIT 10";
     //        $poitips = Yii::app()->db->createCommand($_poi_tips_sql)->queryAll();
     //        //获取所有受推荐地区
     $areas = Area::getTops(0);
     //面包屑
     $breads[] = CHtml::link('目的地', array('position/index'));
     //页面SEO
     //        $this->pageTitle = $this->areaInfo['title'] . '攻略,' . $this->areaInfo['title'] . '游记,' . $this->areaInfo['title'] . '行程推荐,' . $this->areaInfo['title'] . '问答 - ' . zmf::config('sitename');
     //        $this->keywords = zmf::time('', 'Y年') . $this->areaInfo['title'] . '游记,' . $this->areaInfo['title'] . '行程推荐,' . $this->areaInfo['title'] . '问答,' . $this->areaInfo['title'] . '景点';
     //        $this->pageDescription = '【' . $this->areaInfo['title'] . '】' . $this->areaInfo['title'] . '游记,' . $this->areaInfo['title'] . '照片,' . $this->areaInfo['title'] . '热门景点、酒店、餐厅、购物以及与' . $this->areaInfo['title'] . '有关的问与答';
     $data = array('areaInfo' => $areaInfo, 'areaid' => $areaid, 'posts' => $posts, 'areas' => $areas, 'breads' => $breads, 'attaches' => $attaches, 'poiposts' => $poiposts, 'questions' => $questions, 'positions' => $positions, 'poitips' => $poitips, 'weather' => $weather);
     $this->render('show', $data);
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:65,代码来源:IndexController.php

示例3: actionCreate

 public function actionCreate()
 {
     $model = new WeddingGroup();
     if (isset($_POST['WeddingGroup'])) {
         $model->attributes = $_POST['WeddingGroup'];
         if ($model->save()) {
             //谁创建谁默认属于本团队成员
             $glinkAttr = array('groupid' => $model->id, 'uid' => $this->uid, 'isAdmin' => 1);
             $glModel = new GroupLink();
             $glModel->attributes = $glinkAttr;
             $glModel->save();
             //相关标签
             $tags = $_POST['tagnames'];
             $tags = !empty($tags) ? array_unique(array_filter($tags)) : array();
             $tagids = array();
             if (!empty($tags)) {
                 foreach ($tags as $str) {
                     $_tmp = explode('-', $str);
                     if ($_tmp[1] > 0) {
                         //添加对应关系
                         if (Tags::addRelation($_tmp[1], $model->id, 'wgroup')) {
                             $tagids[] = $_tmp[1];
                         }
                     } else {
                         //查找是否有对应话题
                         $_tagid = Tags::findAndAdd($_tmp[0], 'wgroup', $model->id);
                         if ($_tagid) {
                             $tagids[] = $_tagid;
                         }
                     }
                 }
                 $tagids = !empty($tagids) ? array_unique(array_filter($tagids)) : array();
             }
             $tagStr = join(',', $tagids);
             WeddingGroup::model()->updateByPk($model->id, array('tagids' => $tagStr));
             $this->redirect(array('group/view', 'id' => $model->id));
         }
     }
     //未认证用户不能创建团队
     if (!$this->userInfo['creditStatus']) {
         $this->message(0, '请完善资料并提交个人认证', Yii::app()->createurl('users/config', array('type' => 'info')));
     } else {
         //todo,创建的团队数量限制
     }
     //获取所有受推荐地区
     $topAreas = Area::getTops(0);
     $areas = CHtml::listData($topAreas, 'id', 'title');
     $suggestTags = Tags::getTops('posts');
     $data = array('model' => $model, 'areas' => $areas, 'suggestTags' => $suggestTags);
     $this->render('create', $data);
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:51,代码来源:GroupController.php

示例4: actionCreate


//.........这里部分代码省略.........
         $model->classify = Posts::CLASSIFY_WEDDING;
         //文章分类
     }
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'posts-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     if (isset($_POST['Posts'])) {
         //判断是否应被禁止
         //todo,应排除编辑
         //            $forbidInfo = Posts::isForbidden($_POST['Posts']['content'], 'post');
         //            if ($forbidInfo['status'] != Posts::STATUS_PASSED) {
         //                //todo,增加用户非法操作次数
         //                $_POST['Posts']['status'] = Posts::STATUS_STAYCHECK;
         //            }
         //处理文本
         $filter = Posts::handleContent($_POST['Posts']['content']);
         $_POST['Posts']['content'] = $filter['content'];
         foreach ($_POST['Posts'] as $k => $val) {
             $_POST['Posts'][$k] = zmf::filterInput($val, 't');
         }
         if (Yii::app()->session['checkHasBadword'] == 'yes') {
             $_POST['Posts']['status'] = Posts::STATUS_STAYCHECK;
         }
         if (!$model->isNewRecord) {
             $_POST['Posts']['updateTime'] = zmf::now();
             $isNew = false;
         } else {
             $isNew = true;
         }
         unset(Yii::app()->session['checkHasBadword']);
         if (!empty($filter['attachids'])) {
             $attkeys = array_filter(array_unique($filter['attachids']));
             if (!empty($attkeys)) {
                 $_POST['Posts']['faceimg'] = $attkeys[0];
                 //默认将文章中的第一张图作为封面图
             }
         } else {
             $_POST['Posts']['faceimg'] = '';
             //否则将封面图置为空(有可能编辑后没有图片了)
         }
         //相关标签
         $tags = $_POST['tagnames'];
         $tags = !empty($tags) ? array_unique(array_filter($tags)) : array();
         $model->attributes = $_POST['Posts'];
         if ($model->save()) {
             //将上传的图片置为通过
             Attachments::model()->updateAll(array('status' => Posts::STATUS_DELED), 'logid=:logid AND classify=:classify', array(':logid' => $model->id, ':classify' => 'posts'));
             if (!empty($attkeys)) {
                 $attstr = join(',', $attkeys);
                 if ($attstr != '') {
                     Attachments::model()->updateAll(array('status' => Posts::STATUS_PASSED, 'logid' => $model->id), 'id IN(' . $attstr . ')');
                 }
             }
             //相关标签
             $tagids = array();
             if (!empty($tags)) {
                 foreach ($tags as $str) {
                     $_tmp = explode('-', $str);
                     if ($_tmp[1] > 0) {
                         //添加对应关系
                         if (Tags::addRelation($_tmp[1], $model->id, 'posts')) {
                             $tagids[] = $_tmp[1];
                         }
                     } else {
                         //查找是否有对应话题
                         $_tagid = Tags::findAndAdd($_tmp[0], 'posts', $model->id);
                         if ($_tagid) {
                             $tagids[] = $_tagid;
                         }
                     }
                 }
                 $tagids = !empty($tagids) ? array_unique(array_filter($tagids)) : array();
                 $tagStr = join(',', $tagids);
                 if ($tagStr != '') {
                     Posts::model()->updateByPk($model->id, array('tagids' => $tagStr));
                 }
             }
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     //未认证用户不能创建团队
     if (!$this->userInfo['creditStatus']) {
         $this->message(0, '请完善资料并提交个人认证', Yii::app()->createurl('users/config', array('type' => 'info')));
     }
     //文章分类
     $cols = Column::allCols(1, 0, 1, Posts::CLASSIFY_WEDDING);
     if (!$model->isNewRecord) {
         $model->content = zmf::text(array('action' => 'edit'), $model->content, false, 600);
     }
     //获取所有受推荐地区
     $topAreas = Area::getTops(0);
     $areas = CHtml::listData($topAreas, 'id', 'title');
     //推荐的标签
     $suggestTags = Tags::getTops('posts');
     //我所加入的团队
     $groups = WeddingGroup::getUserGroup($this->uid);
     $this->pageTitle = '新增作品 - ' . zmf::config('sitename');
     $this->render('create', array('model' => $model, 'cols' => $cols, 'action' => $action, 'areas' => $areas, 'suggestTags' => $suggestTags, 'groups' => $groups));
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:101,代码来源:PostsController.php


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