/** * Remove record from table */ public function actionRemoveHelper() { if (Yii::app()->request->isAjaxRequest) { if (!Yii::app()->user->hasState('calUserId')) { Yii::app()->end(); } //$user_id = $_POST['ui']; $user_id = Yii::app()->user->getState('calUserId'); $title = $_POST['title']; $criteria = new CDbCriteria(); $criteria->condition = 'user_id=:user_id'; $criteria->params = array(':user_id' => $user_id); $criteria->addSearchCondition('title', $title); $eventsHelper = EventsHelper::model()->find($criteria); $eventsHelper->delete(); Yii::app()->end(); } }
protected function renderContent() { $criteria = new CDbCriteria(array('condition' => 'user_id=' . $this->userId)); $events = EventsHelper::model()->findAll($criteria); $this->render('eventHelper', array('eventsList' => $events, 'dialogMode' => $this->dialogMode)); }