Пример #1
0
    /**
     * Lists all Schools models.
     * @return mixed
     */
    public function actionIndex()
    {
        $searchModel = new SchoolsSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
		
		if(Yii::$app->request->post('hasEditable'))
		{
			$schoolId = Yii::$app->request->post('editableKey');
			$school = Schools::findOne($schoolId);

			$out = Json::encode(['output'=>'','message'=>'']);
			$post = [];
			$posted = current($_POST['Schools']);
			$post['Schools'] = $posted;
			
			if($school->load($post))
			{
				$school->save();
			}
			echo $out;
			return;
		}

		
        return $this->render('index', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }
 /**
  * Lists all Schools models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new SchoolsSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }