public function init() { $this->parts = ZakazParts::model()->findAllByAttributes(['proj_id' => $this->project->id]); $this->payments = ProjectPayments::model()->findByAttributes(['order_id' => $this->project->id]); $this->changes = ProjectChanges::model()->findAllByAttributes(['project_id' => $this->project->id]); $this->messages = ProjectMessages::model()->findAllByAttributes(['order' => $this->project->id], ['order' => 'id DESC']); }
/** * 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 ProjectChanges the loaded model * @throws CHttpException */ public function loadModel($id) { $model = ProjectChanges::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function init() { //echo 'project_id =' . (int)$this->project->id .' '. ((User::model()->isManager() || User::model()->isAdmin()) ? '' : (' AND (user_id = '.((Yii::app()->user->id)?Yii::app()->user->id:(-1)).' OR moderate=1)' )).'!!!'; $this->userObj = User::model(); $this->changes = new CArrayDataProvider(Yii::app()->db->createCommand()->select('CONCAT("/' . ProjectChanges::$file_path . '/",file) as `file`, file as `filename`, comment, id, moderate, date_create')->from(ProjectChanges::model()->tableName())->where('project_id =' . (int) $this->project->id . (User::model()->isManager() || User::model()->isAdmin() ? '' : ' AND (user_id = ' . (Yii::app()->user->id ? Yii::app()->user->id : -1) . ' OR moderate=1)'))->queryAll(), array('pagination' => false)); }