Type::model PHP Method

model() public static method

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : Type
return Type the static model class
    public static function model($className = __CLASS__)
    {
        return parent::model($className);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     #if (Yii::app()->user->isGuest) {
     #    $this->render('index');
     #} else {
     #    if (Yii::app()->user->checkAccess('admin')) {
     #        $this->redirect(array('admin/index'));
     #    } else {
     #        $this->redirect(array('user/accountBalance', 'id'=>Yii::app()->user->_id));
     #    }
     #}
     $form = new SearchForm();
     // Use for Form
     $dataset = new Dataset();
     // Use for auto suggestion
     $datasetModel = $this->getDatasetByType(0);
     // Use for image slider content
     $publicIds = Yii::app()->db->createCommand()->select("id")->from("dataset")->where("upload_status = 'Published'")->queryAll();
     $datasettypes_hints = Type::model()->findAll(array('order' => 'name ASC'));
     $news = News::model()->findAll("start_date<=current_date AND end_date>=current_date");
     $criteria = new CDbCriteria();
     $criteria->limit = 10;
     $criteria->condition = "upload_status = 'Published'";
     #$criteria->order = "id DESC";
     $criteria->order = 'publication_date DESC';
     $latest_datasets = Dataset::model()->findAll($criteria);
     $criteria->condition = null;
     $criteria->order = 'publication_date DESC';
     $latest_messages = RssMessage::model()->findAll($criteria);
     $rss_arr = array_merge($latest_datasets, $latest_messages);
     $this->sortRssArray($rss_arr);
     $this->render('index', array('datasets' => $datasetModel, 'form' => $form, 'dataset' => $dataset, 'news' => $news, 'dataset_hint' => $datasettypes_hints, 'rss_arr' => $rss_arr, 'count' => count($publicIds), 'latest_datasets' => $latest_datasets));
 }
All Usage Examples Of Type::model