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


PHP Article::model方法代码示例

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


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

示例1: loadNewArticle

 private function loadNewArticle($num = 3)
 {
     $uid = Ibos::app()->user->uid;
     $allDeptId = Ibos::app()->user->alldeptid . "";
     $allPosId = Ibos::app()->user->allposid . "";
     $deptCondition = "";
     $deptIdArr = explode(",", $allDeptId);
     if (0 < count($deptIdArr)) {
         foreach ($deptIdArr as $deptId) {
             $deptCondition .= "FIND_IN_SET('{$deptId}',deptid) OR ";
         }
         $deptCondition = substr($deptCondition, 0, -4);
     } else {
         $deptCondition = "FIND_IN_SET('',deptid)";
     }
     $condition = " ( ((deptid='alldept' OR {$deptCondition} OR FIND_IN_SET('{$allPosId}',positionid) OR FIND_IN_SET('{$uid}',uid)) OR (deptid='' AND positionid='' AND uid='') OR (author='{$uid}') OR (approver='{$uid}')) ) AND `status`='1'";
     $criteria = array("select" => "articleid,subject,content,addtime,type", "condition" => $condition, "order" => "`istop` DESC, `addtime` DESC", "offset" => 0, "limit" => $num);
     $articles = Article::model()->fetchAll($criteria);
     if (!empty($articles)) {
         foreach ($articles as &$article) {
             $read = ArticleReader::model()->fetchByAttributes(array("articleid" => $article["articleid"], "uid" => $uid));
             $readStatus = $read ? 1 : 0;
             if ($readStatus) {
                 $article["iconStyle"] = $this->iconReadStyle[$article["type"]];
             } else {
                 $article["iconStyle"] = $this->iconNormalStyle[$article["type"]];
             }
         }
     }
     return $articles;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:31,代码来源:ArticleApi.php

示例2: getNews

 public function getNews($id)
 {
     $gUid = Ibos::app()->user->uid;
     $article = Article::model()->fetchByPk($id);
     $attribute = ICArticle::getShowData($article);
     return $attribute;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:7,代码来源:MICArticle.php

示例3: actionView

 public function actionView()
 {
     $article_id = $_GET['article_id'];
     $article = Article::model()->findByPk($article_id);
     $this->data['article'] = $article;
     $this->render('view', $this->data);
 }
开发者ID:Toney,项目名称:xmcms,代码行数:7,代码来源:ImageController.php

示例4: loadModel

 public function loadModel($id)
 {
     if (($model = Article::model()->findByPk($id)) === null) {
         throw new CHttpException(404, 'Страница не найдена');
     }
     return $model;
 }
开发者ID:kuzmina-mariya,项目名称:unizaro-stone,代码行数:7,代码来源:ArticleBackendController.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->limit = 6;
     $news = Article::model()->published()->findAll($criteria);
     $this->render('index', array('news' => $news));
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:11,代码来源:IndexController.php

示例6: delete

 public function delete($catid)
 {
     $clear = false;
     $ids = $this->fetchAllSubId($catid);
     $idStr = implode(",", array_unique(explode(",", trim($ids, ","))));
     if (empty($idStr)) {
         $idStr = $catid;
     } else {
         $idStr .= "," . $catid;
     }
     $count = Article::model()->count("catid IN ({$idStr})");
     if ($count) {
         return -1;
     }
     if (!is_null($this->_related)) {
         $count = $this->_related->count("`{$this->index}` IN ({$idStr})");
         !$count && ($clear = true);
     } else {
         $clear = true;
     }
     if ($clear) {
         $status = $this->_category->deleteAll("FIND_IN_SET({$this->index},'{$idStr}')");
         $this->afterDelete();
         return $status;
     } else {
         return false;
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:28,代码来源:ICArticleCategory.php

示例7: actionFeel

 public function actionFeel()
 {
     $keywords = Yii::app()->request->getParam('keywords');
     $sql = "select * from {{article}} where title like'%{$keywords}%' order by create_time desc";
     $article = Article::model()->findAllBySql($sql);
     $data = array('article' => $article, 'id' => $keywords);
     $this->render('feel', $data);
 }
开发者ID:SallyU,项目名称:footprints,代码行数:8,代码来源:SearchController.php

示例8: loadModelByAlias

 public function loadModelByAlias($alias)
 {
     $model = Article::model()->find('alias=:alias', array(':alias' => $alias));
     if ($model === null) {
         throw new CHttpException(404, 'Запрашиваемая страница не существует.');
     }
     return $model;
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:8,代码来源:ArticlesController.php

示例9: 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 $id the ID of the model to be loaded
  * @return Article the loaded model
  * @throws CHttpException
  */
 public function loadModel($url)
 {
     $model = Article::model()->findByAttributes(array('url' => $url));
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:Aplay,项目名称:myhistorypark_site,代码行数:15,代码来源:ExpositionController.php

示例10: actionShow

 public function actionShow($alias)
 {
     $model = Article::model()->published()->findByAlias($alias);
     if (!$model) {
         throw new CHttpException(404, Yii::t('PublicationModule.publication', 'Article was not found!'));
     }
     $this->render('show', array('model' => $model));
 }
开发者ID:kuzmina-mariya,项目名称:unizaro-stone,代码行数:8,代码来源:ArticleController.php

示例11: actionNews

 public function actionNews()
 {
     $newsData = Article::model()->getBriefArticlesData(null, Article::POST_TYPE_NEWS);
     $newsData->pagination = new CPagination(self::listingsPerPage);
     $this->breadcrumbs = array('News');
     $this->tabMenus = array(array('label' => 'Articles', 'url' => array('/site/articles')), array('label' => 'News', 'active' => true), array('label' => 'Events', 'url' => array('/event/event/index')), array('label' => 'Workshops', 'url' => array('//site/workshops')));
     $this->render('news', array('newsData' => $newsData));
 }
开发者ID:aakbar24,项目名称:CollegeCorner_Ver_2.0,代码行数:8,代码来源:SiteController.php

示例12: actionIndex

 public function actionIndex($cid)
 {
     $article = Yii::app()->cache->get('cache');
     if ($article == false) {
         $article = Article::model()->findAllBySql('SELECT * FROM {{article}} WHERE cid = ' . $cid);
         Yii::app()->cache->set('cache', $article);
     }
     $this->render('index', array('article' => $article));
 }
开发者ID:xupp,项目名称:yii,代码行数:9,代码来源:CategoryController.php

示例13: actionView

 public function actionView($id)
 {
     //$this->layout='//layouts/inner';
     $criteria = new CDbCriteria();
     $criteria->order = 'sorter';
     $criteria->condition = 'active=1';
     $articles = Article::model()->findAll($criteria);
     $this->render('view', array('model' => $this->loadModel($id), 'articles' => $articles));
 }
开发者ID:barricade86,项目名称:raui,代码行数:9,代码来源:MainController.php

示例14: run

 public function run()
 {
     $criteria = new CDbCriteria();
     if ($this->limit > 0) {
         $criteria->limit = (int) $this->limit;
     }
     $models = Article::model()->sortByDate('DESC')->published()->findAll($criteria);
     $this->render($this->view, array('models' => $models));
 }
开发者ID:kuzmina-mariya,项目名称:unizaro-stone,代码行数:9,代码来源:LastArticlesWidget.php

示例15: actionIndex

 public function actionIndex()
 {
     $db = Account::model()->getDbConnection();
     $total = $db->createCommand("SELECT SUM(amount) FROM account")->queryScalar();
     $criteria = new CDbCriteria();
     $criteria->order = "id DESC";
     $criteria->limit = 5;
     $articles = Article::model()->findAll($criteria);
     $this->render('index', array('total' => $total, 'articles' => $articles));
 }
开发者ID:moohwaan,项目名称:yii-application-cookbook-2nd-edition-code,代码行数:10,代码来源:DashboardController.php


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