/** * Displays a single Todo model. * @param integer $id * @return mixed */ public function actionView($id) { $model = $this->findModel($id); if (Yii::$app->user->can('viewProject', ['project' => $model->functionality->project])) { return $this->render('view', ['model' => $model, 'dataProvider' => new ActiveDataProvider(['query' => File::find()->where(['todo_id' => $id])])]); } throw new NotFoundHttpException('The requested page does not exist.'); }
public function deleteFiles($event) { $this->_data(); $files = \common\models\File::find()->where(['nid' => $this->id, 'model' => $this->model])->all(); foreach ($files as $file) { if (is_file($_SERVER['DOCUMENT_ROOT'] . '/' . $file->path . '/' . $file->filename)) { unlink($_SERVER['DOCUMENT_ROOT'] . '/' . $file->path . '/' . $file->filename); } } \common\models\File::deleteAll('nid = :nid AND model = :model', [':nid' => $this->id, ':model' => $this->model]); }
protected function createQuery($idParent) { return File::find()->join('INNER JOIN', 'student_result_file', 'student_result_file.id_file = file.id')->where(['student_result_file.id_student_result' => $idParent]); }
/** * Lists all File models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => File::find()->with('creator', 'todo', 'project', 'updater')]); return $this->render('index', ['dataProvider' => $dataProvider]); }
protected function createQuery($idParent) { return File::find()->join('INNER JOIN', 'discipline_file', 'discipline_file.id_file = file.id')->where(['discipline_file.id_discipline_name' => $idParent]); }
protected function createQuery($idParent) { return File::find()->join('INNER JOIN', 'program_file', 'program_file.id_file = file.id')->where(['program_file.id_program' => $idParent]); }