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


PHP Tags::getByIds方法代码示例

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


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

示例1: init

 function init()
 {
     parent::init();
     $this->layout = '/layouts/user';
     $this->currentModule = 'user';
     if ($this->isMobile == 'yes') {
         $this->message(0, '感谢你的支持!本页面暂还在拼命制作中...');
     }
     $this->uid = zmf::filterInput($_GET['id']);
     if (!$this->uid) {
         $this->uid = zmf::uid();
     }
     if (!$this->uid) {
         $this->redirect(array('site/login'));
     }
     if ($this->uid == zmf::uid()) {
         $this->mySelf = 'yes';
     }
     if ($this->mySelf != 'yes') {
         if (zmf::uid()) {
             $_favorinfo = Favorites::checkFavored($this->uid, 'user');
             if ($_favorinfo) {
                 $this->favored = true;
             }
         }
     }
     $this->userInfo = Users::getUserInfo($this->uid);
     if ($this->userInfo['tagids'] != '') {
         $this->userTags = Tags::getByIds($this->userInfo['tagids']);
     }
     $this->pageTitle = $this->userInfo['truename'] . ' - ' . zmf::config('sitename');
     $this->pageDescription = $this->userInfo['truename'] . '的【' . zmf::config('sitename') . '】的个人主页,包括TA的原创文章、精美图片及各类悉心收藏,快来看看吧!';
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:33,代码来源:UsersController.php

示例2: actionView

 public function actionView()
 {
     $id = zmf::val('id', 2);
     if (!$id) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $info = $this->loadModel($id);
     $pageSize = 30;
     $comments = Comments::getCommentsByPage($id, 'posts', 1, $pageSize);
     $tags = Tags::getByIds($info['tagids']);
     $relatePosts = Posts::getRelations($id, 5);
     if (!zmf::actionLimit('visit-Posts', $id, 5, 60)) {
         Posts::updateCount($id, 'Posts', 1, 'hits');
     }
     $size = '600';
     if ($this->isMobile) {
         $size = '640';
     }
     $info['content'] = zmf::text(array(), $info['content'], true, $size);
     $data = array('info' => $info, 'comments' => $comments, 'tags' => $tags, 'relatePosts' => $relatePosts, 'loadMore' => count($comments) == $pageSize ? 1 : 0);
     $this->favorited = Favorites::checkFavored($id, 'post');
     $this->pageTitle = $info['title'];
     $this->selectNav = 'posts';
     $this->render('view', $data);
 }
开发者ID:ph7pal,项目名称:momo,代码行数:25,代码来源:PostsController.php

示例3: actionIndex

 public function actionIndex()
 {
     $tagid = zmf::val('tagid', 2);
     $tagInfo = array();
     $default = true;
     if ($tagid) {
         $tagInfo = Tags::getByIds($tagid);
         if ($tagInfo) {
             $default = false;
             $tagInfo = $tagInfo[0];
             $sql = "SELECT p.id,p.uid,p.title,p.faceimg,p.content,p.tagids,p.comments,p.favorite FROM {{posts}} p,{{tag_relation}} tr WHERE tr.tagid='{$tagid}' AND tr.classify='posts' AND tr.logid=p.id AND p.`status`=" . Posts::STATUS_PASSED . " ORDER BY p.cTime DESC";
         }
     }
     if ($default) {
         $sql = 'SELECT id,uid,title,faceimg,content,tagids,comments,favorite FROM {{posts}} WHERE `status`=1 ORDER BY cTime DESC';
     }
     Posts::getAll(array('sql' => $sql), $pages, $posts);
     $size = '640';
     if ($this->isMobile) {
         $size = '240';
     }
     foreach ($posts as $k => $val) {
         if ($val['tagids'] != '') {
             $_tags = Tags::getByIds($val['tagids']);
             $posts[$k]['tagids'] = $_tags;
         }
         $posts[$k]['faceimg'] = Attachments::faceImg($val, $size);
     }
     $this->pageTitle = '文章 - ' . zmf::config('sitename');
     $this->selectNav = 'posts';
     $data = array('posts' => $posts, 'tagInfo' => $tagInfo, 'pages' => $pages);
     $this->render('/index/index', $data);
 }
开发者ID:ph7pal,项目名称:momo,代码行数:33,代码来源:IndexController.php

示例4: actionIndex

 /**
  * 婚庆列表
  */
 public function actionIndex()
 {
     $this->selectedType = zmf::filterInput($_GET['type']);
     if (!$this->selectedType || !in_array($this->selectedType, array('1', '2'))) {
         $this->selectedType = '1';
     }
     if ($this->selectedType == 1) {
         //用户
         $criteria = new CDbCriteria();
         $criteria->condition = 'classify=' . Users::USER_CLASSIFY_WEDDING;
         $criteria->select = 'id,truename,avatar,sex,tagids,content';
         //            $criteria->order = 'cTime DESC';
         $count = Users::model()->count($criteria);
         $pager = new CPagination($count);
         $pager->pageSize = 30;
         $pager->applyLimit($criteria);
         $posts = Users::model()->findAll($criteria);
         if (!empty($posts)) {
             foreach ($posts as $k => $val) {
                 $posts[$k]['avatarImg'] = Users::getAvatar($val['avatar']);
                 $posts[$k]['tagids'] = Tags::getByIds($val['tagids']);
             }
         }
     } elseif ($this->selectedType == 2) {
         //团队
         $criteria = new CDbCriteria();
         $criteria->order = 'cTime DESC';
         $count = WeddingGroup::model()->count($criteria);
         $pager = new CPagination($count);
         $pager->pageSize = 30;
         $pager->applyLimit($criteria);
         $posts = WeddingGroup::model()->findAll($criteria);
         if (!empty($posts)) {
             foreach ($posts as $k => $val) {
                 $posts[$k]['avatar'] = Users::getAvatar($val['avatar']);
             }
         }
     }
     //面包屑
     $breads[] = CHtml::link('婚庆', array('group/index'));
     $this->pageTitle = '婚礼人 - ' . zmf::config('sitename');
     $this->render('index', array('pages' => $pager, 'posts' => $posts, 'breads' => $breads));
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:46,代码来源:GroupController.php

示例5: actionCreate

 public function actionCreate($id = '')
 {
     $this->layout = 'common';
     $id = zmf::myint($id);
     if (!$this->uid) {
         $this->redirect(array('site/login'));
     }
     if ($id) {
         $model = $this->loadModel($id);
         $isNew = false;
     } else {
         $model = new Posts();
         $isNew = true;
     }
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'posts-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     if (isset($_POST['Posts'])) {
         //处理文本
         $filter = Posts::handleContent($_POST['Posts']['content']);
         $_POST['Posts']['content'] = $filter['content'];
         if (!empty($filter['attachids'])) {
             $attkeys = array_filter(array_unique($filter['attachids']));
             if (!empty($attkeys)) {
                 $_POST['Posts']['faceimg'] = $attkeys[0];
                 //默认将文章中的第一张图作为封面图
             }
         } else {
             $_POST['Posts']['faceimg'] = '';
             //否则将封面图置为空(有可能编辑后没有图片了)
         }
         if (!$_POST['Posts']['mapZoom']) {
             //没有缩放级别则认为用户只是点开看了一下
             $_POST['Posts']['lat'] = $_POST['Posts']['long'] = '';
         }
         $tagids = array_unique(array_filter($_POST['tags']));
         $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 . ')');
                 }
             }
             //处理标签
             $intoTags = array();
             if (!empty($tagids)) {
                 foreach ($tagids as $tagid) {
                     $_info = Tags::addRelation($tagid, $model->id, 'posts');
                     if ($_info) {
                         $intoTags[] = $tagid;
                     }
                 }
             }
             if (!$isNew || !empty($intoTags)) {
                 Posts::model()->updateByPk($model->id, array('tagids' => join(',', $intoTags)));
             }
             if ($model->status == Posts::STATUS_NOTPASSED) {
                 $this->redirect(array('posts/index'));
             } else {
                 $this->redirect(array('/posts/view', 'id' => $model->id));
             }
         }
     }
     $tags = Tags::getClassifyTags('posts');
     $postTags = array();
     if (!$isNew) {
         $postTags = Tags::getByIds($model->tagids);
     }
     $this->pageTitle = '与世界分享你的旅行见闻 - ' . zmf::config('sitename');
     $this->render('create', array('model' => $model, 'tags' => $tags, 'postTags' => $postTags));
 }
开发者ID:ph7pal,项目名称:momo,代码行数:75,代码来源:PostsController.php


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