Esempio n. 1
0
 public function feedback()
 {
     // auth
     Auth::isAdminAuthorized($this->signedUser, null, true, '/profile/sign-in');
     // prep
     $save = Converter::string('save', 'post');
     // check
     $feedback = new \Rebond\Core\Feedback\Model();
     $feedback->setStatus(\Rebond\Core\StatusType::INACTIVE);
     $feedback->setUserId($this->signedUser->getId());
     $feedback->setTitle($this->signedUser->getUsername() . '-' . date('ymd-His'));
     $form = new \Rebond\Core\Feedback\Form($feedback);
     // action
     if (isset($save)) {
         if ($form->setFromPost()->validate()->isValid()) {
             $feedback->save();
             Session::adminSuccess('feedbackSent', '/profile/feedback');
         } else {
             Session::set('adminError', $form->getValidation()->getMessage());
         }
     }
     // view
     $this->setTpl();
     $tplMain = new Template(Template::MODULE, ['core', 'feedback']);
     $tplMain->set('item', $form);
     // layout
     $this->tplLayout->set('column1', $tplMain->render('editor'));
     // master
     $this->tplMaster->set('layout', $this->tplLayout->render('layout-1-col'));
     $this->tplMaster->set('jsLauncher', 'profile');
     return $this->tplMaster->render('tpl-default');
 }