Пример #1
0
 public function renderEdit()
 {
     $platformId = $this->getInt('id');
     $form = new Form('editPlatform', '');
     $form->bindMapper(new Platform($platformId));
     return new PlatformForm("Edit Platform", $form);
 }
Пример #2
0
 public function renderEdit()
 {
     $userId = $this->getInt('id');
     $form = new Form('editUser', '');
     $form->bindMapper(new User($userId));
     return new UserForm("Edit User", $form);
 }
Пример #3
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));
 }
Пример #4
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');
     }
 }