Example #1
0
 public function renderEdit()
 {
     $categoryId = $this->getInt('id');
     $form = new Form('editCategory', '');
     $form->bindMapper(new Category($categoryId));
     return $this->createView(new CategoryForm("Edit Category", $form));
 }
Example #2
0
 public function renderEdit()
 {
     $platformId = $this->getInt('id');
     $form = new Form('editPlatform', '');
     $form->bindMapper(new Platform($platformId));
     return new PlatformForm("Edit Platform", $form);
 }
Example #3
0
 public function renderEdit()
 {
     $userId = $this->getInt('id');
     $form = new Form('editUser', '');
     $form->bindMapper(new User($userId));
     return new UserForm("Edit User", $form);
 }
Example #4
0
 public function render()
 {
     $form = new Form('login');
     $form->addTextElement('username');
     $form->addPasswordElement('password');
     $form->addSubmitElement('Login');
     $alert = '';
     if (Session::getFlash('msg')) {
         $alert = new HtmlElement('div', ['class' => 'alert alert-error'], Session::getFlash('msg'));
     }
     return new RenderGroup('<h1>Please Login</h1>', $alert, $form);
 }
Example #5
0
 public function bindMapper(RecordMapper $mapper)
 {
     if ($mapper instanceof Video) {
         parent::bindMapper($mapper);
         $this->getElement('title')->addAttribute('class', 'input-xxlarge');
         $this->getElement('SubTitle')->addAttribute('class', 'input-xxlarge');
         $this->getElement('slug')->addAttribute('class', 'input-xxlarge');
         $this->getElement('imageUrl')->addAttribute('class', 'input-xxlarge');
         $this->getElement('submit')->addAttribute('class', 'btn btn-success');
         $this->getElement('url')->setLabel('Video URL')->addAttribute('class', 'input-xxlarge');
         $options = Category::collection()->getKeyPair('id', 'title');
         $this->addSelectElement('categoryId', $options, $mapper->categoryId);
         $this->getElement('categoryId')->setLabel('Category');
     } else {
         throw new \Exception('Only Video Mapper can be bound to this form');
     }
 }
Example #6
0
 protected function _postBind()
 {
     $this->getElement("submit")->setType(FormElement::BUTTON)->addAttribute("class", "btn js-btn-loading")->addAttribute("data-loading-text", "Submitting");
     return parent::_postBind();
 }
Example #7
0
 public function __construct()
 {
     parent::__construct('contact');
 }