static function deleteFile($id) { $m = D1files::model(); $model = $m->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested record in d1files does not exist.'); } $model->deleted = 1; $model->save(); }
public function actionDownloadFile($id) { $m = D1files::model(); $model = $m->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested record in d1files does not exist.'); } Yii::import("vendor.dbrisinajumi.d1files.compnents.*"); $oUploadHandler = new UploadHandlerD1files(array('model_name' => 'CcmpCompany', 'model_id' => $id, 'download_via_php' => TRUE, 'file_name' => $model->file_name)); }
public function loadModel($id) { $m = D1files::model(); // apply scope, if available $scopes = $m->scopes(); if (isset($scopes[$this->scope])) { $m->{$this->scope}(); } $model = $m->findByPk($id); if ($model === null) { throw new CHttpException(404, Yii::t('D1filesModule.crud', 'The requested page does not exist.')); } return $model; }