Esempio n. 1
0
 /**
  * Lists all Grade models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new SchoolSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     if (Yii::$app->request->post('hasEditable')) {
         $gradeId = Yii::$app->request->post('editableKey');
         $grade = Grade::findOne($gradeId);
         $out = Json::encode(['output' => '', 'message' => '']);
         $post = [];
         $posted = current($_POST['Grade']);
         $post['Grade'] = $posted;
         if ($grade->load($post)) {
             if ($grade->grade_approval_status == 'Approved') {
                 $grade->grade_approved_by = Yii::$app->user->identity->username;
             } else {
                 $grade->grade_approved_by = null;
             }
             $subject = Subject::findOne($grade->subject_subject_id);
             // $subjectTakenStatus = ArrayHelper::map(Subject::find()
             // ->where(['subject_id'=>$grade->subject_subject_id])
             // ->all(),'subject_id','subject_taken_status');
             $subject->subject_taken_status = $grade->takenStatus;
             $subject->save();
             $grade->save();
         }
         echo $out;
         return;
     }
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
Esempio n. 2
0
 /**
  * Lists all School models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new SchoolSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     if (Yii::$app->request->post('hasEditable')) {
         $schoolId = Yii::$app->request->post('editableKey');
         $school = School::findOne($schoolId);
         $out = Json::encode(['output' => '', 'message' => '']);
         $post = [];
         $posted = current($_POST['School']);
         $post['School'] = $posted;
         if ($school->load($post)) {
             $school->save();
         }
         echo $out;
         return;
     }
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
 /**
  * Lists all School models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new SchoolSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }