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


PHP Thread::model方法代码示例

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


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

示例1: actionView

 /**
  * This action displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id, $tab = 'Summary', $thread = null)
 {
     // Load crash report
     $model = $this->loadModel($id);
     // Check if user is authorized to perform the action
     $this->checkAuthorization($model);
     // Determine what tab to display
     $activeItem = 'Summary';
     if ($tab == 'Summary' || $tab == 'CustomProps' || $tab == 'Screenshots' || $tab == 'Videos' || $tab == 'Threads' || $tab == 'Modules' || $tab == 'Files') {
         $activeItem = $tab;
     }
     $threadModel = null;
     $stackTraceProvider = null;
     if ($thread != null) {
         $threadModel = Thread::model()->findByPk((int) $thread);
         if ($threadModel == null) {
             throw new CHttpException(403, 'Unexpected parameter.');
         }
         $criteria = new CDbCriteria();
         $criteria->compare('thread_id', (int) $thread);
         $criteria->order = 'id ASC';
         $stackTraceProvider = new CActiveDataProvider('StackFrame', array('criteria' => $criteria, 'pagination' => false));
     }
     $customProps = $model->searchCustomProps();
     $screenshots = $model->searchScreenshots();
     $videos = $model->searchVideos();
     $modules = $model->searchModules();
     $threads = $model->searchThreads();
     $this->render('view', array('model' => $model, 'activeItem' => $activeItem, 'thread' => (int) $thread, 'threadModel' => $threadModel, 'stackTrace' => $stackTraceProvider, 'customProps' => $customProps, 'screenshots' => $screenshots, 'videos' => $videos, 'modules' => $modules, 'threads' => $threads));
 }
开发者ID:xyzz,项目名称:CrashFix,代码行数:34,代码来源:CrashReportController.php

示例2: actionReadTopic

 public function actionReadTopic($id)
 {
     $thread = Thread::model()->getThreadInfoById($id);
     $this->forumBreadcrumb = array('Programs' => array('forum/index'), $thread['program_name'] => array('forum/programView', 'programId' => $thread['program_id']), $thread['semester_name'] => array('forum/viewTopics', 'programId' => $thread['program_id'], 'semesterId' => $thread['semester_id']), $thread['title'] < Yii::app()->params['forum_max_crumb_length'] ? $thread['title'] : substr($thread['title'], 0, Yii::app()->params['forum_max_crumb_length']) . '...');
     $this->areaLarge = $thread['program_name'];
     $this->areaSmall = $thread['semester_name'];
     $reply = new Reply();
     $complaint = new Complaint('postComplaint');
     if (isset($_POST['Reply'])) {
         $reply->attributes = $_POST['Reply'];
         $reply->post_item_id = $id;
         if ($reply->save()) {
             Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.reply.success'));
             $reply->unsetAttributes();
         } else {
             Yii::app()->user->setFlash('error', Yii::t('forum', 'forum.view.reply.error'));
         }
     }
     if (isset($_POST['Complaint'])) {
         $complaint->attributes = $_POST['Complaint'];
         if ($complaint->save()) {
             if ($complaint->post_item_id == $id) {
                 Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.complaint.success'));
             } else {
                 Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.complaint.success'));
             }
             $complaint->unsetAttributes();
         } else {
             Yii::app()->clientScript->registerScript('show_modal', "\$('#reportModal').modal('show');", CClientScript::POS_READY);
         }
     }
     $dataProvider = Thread::model()->getPostsDataInThread($id);
     Yii::log(CVarDumper::dumpAsString($dataProvider->getData()));
     $this->render('view', array('thread' => $thread, 'threadId' => $id, 'dataProvider' => $dataProvider, 'reply' => $reply, 'complaint' => $complaint));
 }
开发者ID:aakbar24,项目名称:CollegeCorner_Ver_2.0,代码行数:35,代码来源:PostController.php

示例3: actionIndex

 /**
  * This is basically the "homepage" for the forums
  * It'll show a list of root categories which forums in each
  */
 public function actionIndex()
 {
     if (!isset($_GET['id'])) {
         $forum = null;
         if (!Yii::app()->user->isForumAdmin()) {
             $criteria = array('order' => 'lastPost_time DESC', 'condition' => "is_hidden=0", 'distinct' => true, "group" => 't.id');
         } else {
             $criteria = array('order' => 'lastPost_time DESC', "group" => 't.id');
         }
         $data = new CActiveDataProvider('Thread', array('criteria' => $criteria, 'pagination' => array('pageSize' => Yii::app()->controller->module->threadsPerPage)));
         $menuItem = 0;
         $breadcrumbs = array('Форум');
     } else {
         $forum = Forum::model()->findByPk($_GET['id']);
         if (null == $forum) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
         if ($forum->isCat) {
             $this->redirect($this->createUrl("index"));
         }
         if (!Yii::app()->user->isForumAdmin()) {
             $hidden = " AND is_hidden=0";
         } else {
             $hidden = "";
         }
         $data = new CActiveDataProvider('Thread', array('criteria' => array('condition' => 'forum_id=' . $forum->id . $hidden), 'pagination' => array('pageSize' => Yii::app()->controller->module->threadsPerPage)));
         $menuItem = $forum->id;
         $breadcrumbs = $forum->getBreadcrumbs();
     }
     $this->render('index', array('forums' => Thread::model()->findAll(), "data" => $data, "menuItem" => $menuItem, "breadcrumbs" => $breadcrumbs, 'forum' => $forum));
 }
开发者ID:CrystReal,项目名称:Site_frontend,代码行数:35,代码来源:ForumController.php

示例4: actionIndex

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     // renders the view file 'protected/views/site/index.php'
     // using the default layout 'protected/views/layouts/main.php'
     $dataProvider = Thread::model()->lastNew();
     $this->render('index', array('dataProvider' => $dataProvider));
 }
开发者ID:andhikayuana,项目名称:forum,代码行数:11,代码来源:SiteController.php

示例5: testGetThreadFuncName

 public function testGetThreadFuncName()
 {
     // Find an existing thread
     $thread = Thread::model()->findByPk(1);
     $funcName = $thread->getThreadFuncName();
     $this->assertTrue($funcName == '_WinMainCRTStartup()');
 }
开发者ID:xyzz,项目名称:CrashFix,代码行数:7,代码来源:ThreadTest.php

示例6: countThread

 /**
  * @param kategori id
  * @return jumlah thread per kategori
  */
 public function countThread($id)
 {
     $cr = new CDbCriteria();
     $cr->with = 'kategori';
     $cr->condition = 'kategori_id=:id';
     $cr->params = array(':id' => $id);
     return Thread::model()->count($cr);
 }
开发者ID:andhikayuana,项目名称:forum,代码行数:12,代码来源:KategoriController.php

示例7: actionDeleteThread

 public function actionDeleteThread($id)
 {
     //$thread = new Thread;
     $thread = Thread::model()->findByPk($id);
     if ($thread->delete()) {
         Yii::app()->user->setFlash('success', "Thread {$thread->primaryKey} deleted");
     } else {
         Yii::app()->user->setFlash('error', "Problem removing thread");
     }
     $this->redirect(array('myTopics'));
 }
开发者ID:aakbar24,项目名称:CollegeCorner_Ver_2.0,代码行数:11,代码来源:ForumController.php

示例8: 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 Thread the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Thread::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:vsanth,项目名称:yii-customer-database,代码行数:15,代码来源:ThreadController.php

示例9: getLastPost

 /**
  * Return the last post in any of the threads in this forum (or null)
  */
 public function getLastPost()
 {
     // There's gotta be an easier, or at least more direct way to do this
     $id = Yii::app()->db->createCommand()->select('p.id')->from(Post::model()->tableName() . ' p')->join(Thread::model()->tableName() . ' t', 't.id=p.thread_id')->where('t.forum_id=:id', array(':id' => $this->id))->order('p.created DESC')->limit(1)->queryScalar();
     return Post::model()->findByPk($id);
 }
开发者ID:CrystReal,项目名称:Site_frontend,代码行数:9,代码来源:Forum.php

示例10: getJudul

 public function getJudul()
 {
     return CHtml::listData(Thread::model()->with('comments')->findAll(), 'id', 'judul');
 }
开发者ID:andhikayuana,项目名称:forum,代码行数:4,代码来源:Comment.php

示例11: actionRe

 public function actionRe()
 {
     $threads = Thread::model()->findAll();
     foreach ($threads as $item) {
         $item->author_id = $item->firstPost->author_id;
         $item->created = $item->firstPost->created;
         $item->lastPost_user_id = $item->lastPost->author_id;
         $item->lastPost_time = $item->lastPost->created;
         $item->post_count = $item->postCountInternal;
         $item->save();
     }
 }
开发者ID:CrystReal,项目名称:Site_frontend,代码行数:12,代码来源:ThreadController.php


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