public function actionLogin() { $form = $this->getLoginForm(); if ($form->isValid()) { if ($this->login($form->login, $form->password)) { Notif::success(sprintf(static::MSG_LOGIN_VALID, $form->login)); \Staq\Util::httpRedirectUri($this->getRedirectUri()); } else { Notif::error(static::MSG_LOGIN_KO); } } $view = $this->createView('login'); $view['form'] = $form; $view['redirect'] = $this->getRedirectUri(); return $view; }
protected function genericActionEdit($type, $model) { if (isset($_POST['model'])) { foreach ($_POST['model'] as $name => $value) { $model->set($name, $value); } $this->saveHandler($model); if ($model->save()) { Notif::success('Model saved.'); } else { Notif::error('Model not saved.'); } $this->redirectPreview($type, $model); } $view = $this->createView('edit', $type); $view['model'] = $model; return $view; }