예제 #1
0
 public function actionDeleteDoc($stu_doc_id)
 {
     $stu_docs = StuDocs::findOne($stu_doc_id);
     $path = Yii::getAlias('@webroot') . '/data/stu_docs/';
     if ($stu_docs !== NULL) {
         unlink($path . $stu_docs->stu_docs_path);
         $stu_docs->delete();
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     return $this->redirect(['view', 'id' => $stu_docs->stu_docs_stu_master_id, '#' => 'documents']);
 }
예제 #2
0
 /**
  * Finds the StuDocs model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return StuDocs the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = StuDocs::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }