PATH:
home
/
letacommog
/
letaweb
/
admin
/
models
/
subsite_models
<?php class BNews_Comments extends BActiveRecord { public static function model($className = __CLASS__) { return parent::model($className); } public function tableName() { return '{{news_comments}}'; } public function rules() { return array( //array('type', 'numerical', 'integerOnly'=>true), array('content', 'length', 'max' => 1000), array('content', 'required'), array('id, news_id, user_id, name, email date_added, url, content, status,parent_id,approved,date_approved', 'safe'), ); } public function relations() { // NOTE: you may need to adjust the relation name and the related // class name for the relations automatically generated below. return array( 'news' => array(self::BELONGS_TO, 'BNews', array('news_id'=>'inline_id')), 'parent' => array(self::BELONGS_TO, 'BNews_Comments', array('parent_id'=>'inline_id')), // 'news_news_category' => array(self::HAS_MANY, 'BNews_News_Category',array('category_id'=>'inline_id')), // 'comment_count' => array(self::STAT, 'BComments', 'news_id'), // 'comment' => array(self::HAS_MANY, 'BComments', 'news_id'), // 'categories' => array(self::HAS_MANY, 'BNewsCategory', 'category_id','through' => 'news_news_category'), // 'tags' => array(self::HAS_MANY, 'BNewsCategory', 'category_id','through' => 'news_news_category'), ); } public function beforeDelete() { BNews_Comment::model()->deleteAll('parent_id=:parent_id', array(':parent_id' => $this->id)); return true; } public $filter_news_id; public $filter_name; public $filter_email; public function getPagedList($pageSize = 10, $start = 0,$order='') { $criteria = new CDbCriteria(); $alias = $this->getTableAlias(false, false); $criteria->compare($alias.'.news_id', $this->filter_news_id); $criteria->compare($alias.'.name', $this->filter_name); $criteria->with = array('news'); $criteria->compare($alias.'.email', $this->filter_email); if(strrpos($order, "news.") === false) $criteria->order = $alias.'.'.$order; else $criteria->order = $order; //echo $start; //$criteria->offset = $start; // $criteria->together = true; return new ActiveDataProvider('BNews_Comments', array( 'criteria' => $criteria, 'pagination' => array( 'pageSize' => $pageSize, 'start'=>$start, 'class' => 'Pagination', ), )); } }
[+]
..
[-] BTag.php
[edit]
[-] BActiveRecord.php
[edit]
[-] BModule.php
[edit]
[-] BPages.php
[edit]
[-] BComments.php
[edit]
[-] BNews_News_Category.php
[edit]
[-] BNewsModule.php
[edit]
[-] BAuthAssignment.php
[edit]
[-] BNewsCategory.php
[edit]
[-] BConfigurations.php
[edit]
[-] BPages_Elements.php
[edit]
[-] BNews_Comments.php
[edit]
[-] BNews_Categories.php
[edit]
[-] BUsers.php
[edit]
[-] BUserIdentity.php
[edit]
[-] BNews.php
[edit]
[-] BWebUser.php
[edit]
[+]
forms
[-] BColors.php
[edit]
[-] BSkins.php
[edit]
[-] BNews_Tag.php
[edit]
[-] BContributor_Invites.php
[edit]
[-] BContributor.php
[edit]