/** * * @param type $groupID * @return Slit::model() */ public function querySlits() { $criteria = new CDbCriteria(); // TODO prepare fore start_date -> end_date support //$now = new CDbExpression("NOW()"); $criteria->order = $this->order; /** * check if SliderWidget groupId is set * OR NULL because slits without group_id * will be shown in all sliders */ if ($this->groupId !== NULL && !empty($this->groupId)) { $criteria->addCondition('group_id = \'' . $this->groupId . '\' OR group_id IS NULL'); } // check if slit is an active slit (published) $criteria->addCondition('status = \'' . self::SLIT_ACTIVE . '\''); // check if slit is for current language $criteria->addCondition('language = \'' . Yii::app()->getLanguage() . '\''); // findAll slits with this $creteria return Slit::model()->findAll($criteria); }
public function loadModel($id) { $model = Slit::model()->findByPk($id); if ($model === NULL) { throw new CHttpException(404, Yii::t('SlitSliderModule.crud', 'The requested page does not exist.')); } return $model; }