コード例 #1
0
ファイル: DeptController.php プロジェクト: kintastish/docflow
 protected function loadModel($id)
 {
     if (($model = Department::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #2
0
 public function actionDel($id)
 {
     $result = array();
     $model = Department::findOne($id);
     if (Record::find()->where('department_id=' . $id . '')->exists()) {
         $model->enabled = 0;
         $model->update();
         $result['status'] = 1;
         $result['message'] = '该科室已关联数据,不能删除,已经禁用!';
     } else {
         $model->delete();
         $result['status'] = 1;
         $result['message'] = '删除成功';
     }
     return $this->renderJson($result);
 }
コード例 #3
0
ファイル: Contact.php プロジェクト: kintastish/docflow
 public function getIsChief()
 {
     return Department::findOne(['chief_id' => $this->id]) !== null;
 }
コード例 #4
0
 /**
  * Finds the Department model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @param integer $faculty_id
  * @return Department the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id, $faculty_id)
 {
     if (($model = Department::findOne(['id' => $id, 'faculty_id' => $faculty_id])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }