コード例 #1
0
 /**
  * Lists all Subject models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new ScholarSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     if (Yii::$app->request->post('hasEditable')) {
         $subjectId = Yii::$app->request->post('editableKey');
         $subject = Subject::findOne($subjectId);
         $out = Json::encode(['output' => '', 'message' => '']);
         $post = [];
         $posted = current($_POST['Subject']);
         $post['Subject'] = $posted;
         if ($subject->load($post)) {
             if ($subject->subject_approval_status == 'Approved') {
                 $subject->subject_approved_by = Yii::$app->user->identity->username;
             } else {
                 $subject->subject_approved_by = null;
             }
             // $grade = Subject::findOne($subject->subject_id);
             // $grade->takenStatus = $subject->subject_taken_status;
             // $grade->save();
             $subject->save();
         }
         echo $out;
         return;
     }
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
コード例 #2
0
 /**
  * Lists all Deduction models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new ScholarSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     if (Yii::$app->request->post('hasEditable')) {
         $deductionId = Yii::$app->request->post('editableKey');
         $deduction = Deduction::findOne($deductionId);
         $out = Json::encode(['output' => '', 'message' => '']);
         $post = [];
         $posted = current($_POST['Deduction']);
         $post['Deduction'] = $posted;
         if ($deduction->load($post)) {
             $deduction->save();
         }
         echo $out;
         return;
     }
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
コード例 #3
0
 /**
  * Lists all Scholar models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new ScholarSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }