Exemplo n.º 1
0
 /**
  * Get step model
  *
  * @param string $step
  * @return \Core\View\Model\WizardStep
  */
 protected function getStep($step)
 {
     $store = $this->getStore();
     $formSrv = $this->getServiceLocator()->get('Form');
     if ($step == $this->startStep) {
         $form = $formSrv->get('Grid\\Paragraph\\CreateWizard\\Start');
         $model = new StartStep(array('textDomain' => 'paragraph'));
     } else {
         $store['type'] = $step;
         $form = new Form();
         $create = $formSrv->get('Grid\\Paragraph\\Meta\\Create');
         $model = new WizardStep(array('textDomain' => 'paragraph'), array('finish' => true, 'next' => 'finish'));
         if ($create->has($step)) {
             foreach ($create->get($step) as $element) {
                 $form->add($element);
             }
         } else {
             $edit = $formSrv->get('Grid\\Paragraph\\Meta\\Edit');
             if ($edit->has($step)) {
                 foreach ($edit->get($step) as $element) {
                     $form->add($element);
                 }
             } else {
                 $model->setOption('skip', true);
             }
         }
     }
     return $model->setStepForm($form);
 }
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $form = new Form();
     $form->add(new \MiniModule\Form\Element\Login(), array('priority' => 1));
     $form->add(new Submit('submit'));
     return $form;
 }
Exemplo n.º 3
0
 public function getForm($hasCaptcha, $url = '', $captchaPath = '')
 {
     if (!$this->form) {
         $form = new Form();
         $txtUser = new Element\Text('username');
         $txtUser->setLabel('User Name')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'User name');
         $password = new Element\Password('password');
         $password->setLabel('Password')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'Password');
         $remember = new Element\Checkbox('remember');
         $remember->setLabel('Save authentication?')->setAttribute('class', 'form-control');
         if ($hasCaptcha) {
             $captchaImage = new Image();
             $captchaImage->setFont('./data/font/CAMBRIA.TTC')->setWidth(200)->setHeight(60)->setDotNoiseLevel(40)->setLineNoiseLevel(4)->setExpiration(90);
             $captchaImage->setImgUrl($url);
             $captchaImage->setImgDir($captchaPath);
             $captcha = new Element\Captcha('isHuman');
             $captcha->setCaptcha($captchaImage)->setAttributes(array('class' => 'form-control'));
             $form->add($captcha);
         }
         $form->setAttribute('class', 'form-horizontal');
         $form->add($txtUser);
         $form->add($password);
         $form->add($remember);
         $this->form = $form;
     }
     return $this->form;
 }
Exemplo n.º 4
0
 public function __construct(AuthenticationService $authService)
 {
     parent::__construct('login');
     $this->filter = new InputFilter();
     $email = new Element\Email('email');
     $email->setAttribute('required', true);
     $email->setAttribute('placeholder', 'Email Address');
     $this->add($email);
     $emailFilter = new Input('email');
     $emailFilter->setRequired(true);
     $this->filter->add($emailFilter);
     $password = new Element\Password('password');
     $password->setAttribute('required', true);
     $password->setAttribute('placeholder', 'Password');
     $this->add($password);
     $passwordFilter = new Input('password');
     $passwordFilter->setRequired(true);
     $passwordFilter->getValidatorChain()->attach(new AuthValidator\Authentication(array('message' => 'Invalid email address or password', 'service' => $authService, 'adapter' => $authService->getAdapter(), 'identity' => 'email', 'credential' => 'password')));
     $this->filter->add($passwordFilter);
     $buttons = new Form('buttons');
     $buttons->setOption('twb-layout', 'inline');
     $buttons->setAttribute('class', 'form-group');
     $submit = new Element\Submit('submit');
     $submit->setAttribute('class', 'btn-primary pull-right');
     $submit->setOption('glyphicon', 'log-in');
     $submit->setLabel('Log In');
     $buttons->add($submit);
     $forgot = new Element\Submit('forgot');
     $forgot->setAttribute('formnovalidate', true);
     $forgot->setAttribute('class', 'btn-warning pull-right');
     $forgot->setOption('glyphicon', 'question-sign');
     $forgot->setLabel('Forgot Password');
     $buttons->add($forgot);
     $this->add($buttons);
 }
Exemplo n.º 5
0
 protected function getModel()
 {
     // Dependências
     $form = new Form();
     $inputFilter = new InputFilter();
     $formSearch = new Form();
     $inputFilterSearch = new InputFilter();
     $persistence = $this->getMock('Balance\\Model\\Persistence\\PersistenceInterface');
     // Parâmetro
     $form->add(new Text('id'));
     $inputFilter->add(new Input('id'));
     // Parâmetro
     $form->add(new Text('foo'));
     $inputFilter->add(new Input('foo'));
     // Pesquisa: Palavras Chave
     $formSearch->add(new Text('keywords'));
     $inputFilterSearch->add(new Input('keywords'));
     // Configurações
     $form->setInputFilter($inputFilter);
     $formSearch->setInputFilter($inputFilterSearch);
     // Inicialização
     $model = new Model($persistence);
     // Formulários
     $model->setForm($form)->setFormSearch($formSearch);
     // Apresentação
     return $model;
 }
Exemplo n.º 6
0
 public function addCSRFElement($name, $value)
 {
     $csrf = new \Zend\Form\Element\Hidden($name);
     $csrf->setValue($value);
     $this->form->add($csrf);
     return $this;
 }
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $form = new Form('create_cv');
     //$form->add($serviceLocator->get('ApplicationFieldset'));
     $form->add($serviceLocator->get('EducationCollection'));
     $form->add($serviceLocator->get('DefaultButtonsFieldset'), array('name' => 'buttons'));
     return $form;
 }
 /**
  * @inheritdoc
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $form = new Form();
     $form->add(new Element\Text('filter', ['label' => 'Resource']));
     $form->add(new Element\Button('submit', ['label' => 'filter']));
     $form->setAttribute('method', 'GET');
     $form->get('submit')->setAttribute('type', 'submit');
     return $form;
 }
Exemplo n.º 9
0
 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $form = new Form();
     $form->add(['name' => 'name', 'options' => ['label' => 'Name'], 'attributes' => ['type' => 'text']]);
     $form->add(['name' => 'description', 'options' => ['label' => 'Description'], 'attributes' => ['type' => 'textarea']]);
     $form->add(['name' => 'location', 'options' => ['label' => 'Location'], 'attributes' => ['type' => 'text']]);
     $form->setHydrator(new ClassMethods());
     $form->setInputFilter($this->getInputFilter());
     return $form;
 }
Exemplo n.º 10
0
 public function getForm(array $urlType)
 {
     if ($this->form) {
         return $this->form;
     }
     $form = new Form();
     $form->setAttribute('class', 'form-horizontal');
     $form->setAttribute('role', 'form');
     $form->add(array('name' => 'menuId', 'type' => 'Hidden'));
     $form->add(array('name' => 'title', 'type' => 'text', 'options' => array('label' => 'Title'), 'attributes' => array('class' => 'form-control')));
     $form->add(array('name' => 'description', 'type' => 'Textarea', 'options' => array('label' => 'Description'), 'attributes' => array('class' => 'form-control', 'placeholder' => 'description')));
     $form->add(array('name' => 'icon', 'type' => 'text', 'options' => array('label' => 'Icon'), 'attributes' => array('class' => 'form-control', 'placeholder' => 'Icon Class')));
     $form->add(array('name' => 'url', 'type' => 'text', 'options' => array('label' => 'Url'), 'attributes' => array('class' => 'form-control', 'placeholder' => 'Url')));
     $url_type = new Select('url_type');
     $url_type->setLabel('Type')->setAttribute('class', 'form-control')->setValueOptions($urlType)->setEmptyOption('-- Choose URL Type --');
     $form->add($url_type);
     $hasDivider = new Checkbox('hasDivider');
     $hasDivider->setLabel('Has divider?');
     $form->add($hasDivider);
     $form->add(array('name' => 'parentId', 'type' => 'hidden'));
     $form->add(array('name' => 'priority', 'type' => 'number', 'options' => array('label' => 'Priority'), 'attributes' => array('class' => 'form-control')));
     $form->setInputFilter($this->getInputFilter());
     $this->form = $form;
     return $this->form;
 }
Exemplo n.º 11
0
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     //        $config = $serviceLocator->get('config_authentification_form');
     //        $factory = new Factory();
     //        $form = $factory->createForm( $config );
     $form = new Form();
     $form->add(new \MiniModule\Form\Element\Login());
     $form->add(new \MiniModule\Form\Element\Password());
     $form->add(new Submit('submit'));
     return $form;
 }
Exemplo n.º 12
0
 public function getForm(array $default_status)
 {
     if (!$this->form) {
         $hidId = new Element\Hidden();
         $hidId->setName('userId');
         $txtName = new Element\Text();
         $txtName->setLabel('User Name')->setName("userName")->setAttribute('class', 'form-control');
         $password = new Element\Password();
         $password->setLabel('Password')->setName('password')->setAttribute('class', 'form-control');
         $confirmPassword = new Element\Password();
         $confirmPassword->setName('confirmPassword')->setLabel('Retype Password')->setAttribute('class', 'form-control');
         $selectRole = new Element\Hidden('userRole');
         $description = new Element\Textarea();
         $description->setName('description')->setLabel('Description')->setAttribute('class', 'form-control');
         $status = new Element\Select();
         $status->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($default_status);
         $image = new Element\File();
         $image->setName('image')->setLabel('Profile image');
         $form = new Form();
         $form->setAttribute('class', 'form-horizontal');
         $form->setAttribute('enctype', 'multipart/form-data');
         $form->add($hidId);
         $form->add($txtName);
         $form->add($password);
         $form->add($confirmPassword);
         $form->add($selectRole);
         $form->add($description);
         $form->add($status);
         $form->add($image);
         $this->form = $form;
     }
     return $this->form;
 }
 public function getLeaveForm(array $leaveList)
 {
     $leaveType = new Element\Select();
     $leaveType->setName('leaveType')->setLabel('Type')->setAttribute('class', 'form-control')->setValueOptions($leaveList);
     $date = new Element\Date();
     $date->setName('date')->setLabel('Date')->setAttributes(array('allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD')));
     $description = new Element\Textarea('description');
     $description->setLabel('Description')->setAttribute('class', 'form-control');
     $form = new Form();
     $form->setAttribute('class', 'form');
     $form->add($leaveType);
     $form->add($date);
     $form->add($description);
     return $form;
 }
Exemplo n.º 14
0
 public function testRender()
 {
     $form = new Form();
     $attributes = array('name' => 'login-form');
     $form->setAttributes($attributes);
     $form->add(new CityFieldset());
     $form->add(new Submit('send'));
     $markup = $this->helper->__invoke($form);
     $this->assertContains('<form', $markup);
     $this->assertContains('id="login-form"', $markup);
     $this->assertContains('<label><span>Name of the city</span>', $markup);
     $this->assertContains('<fieldset><legend>Country</legend>', $markup);
     $this->assertContains('<input type="submit" name="send"', $markup);
     $this->assertContains('</form>', $markup);
 }
 public function testCorrectInputDataMerging()
 {
     $this->disablePhpUploadCapabilities();
     $form = new Form();
     $form->add(['name' => 'collection', 'type' => 'collection', 'options' => ['target_element' => new TestAsset\TestFieldset('target'), 'count' => 2]]);
     copy(__DIR__ . '/TestAsset/nullfile', __DIR__ . '/TestAsset/nullfile_copy');
     $request = $this->request;
     $request->setMethod('POST');
     $request->setPost(new Parameters(['collection' => [0 => ['text' => 'testvalue1'], 1 => ['text' => '']]]));
     $request->setFiles(new Parameters(['collection' => [0 => ['file' => ['name' => 'test.jpg', 'type' => 'image/jpeg', 'size' => 20480, 'tmp_name' => __DIR__ . '/TestAsset/nullfile_copy', 'error' => UPLOAD_ERR_OK]]]]));
     $this->controller->dispatch($this->request, $this->response);
     $plugin = $this->plugin;
     $plugin($form, '/test/getPage', true);
     $this->assertFalse($form->isValid());
     $data = $form->getData();
     // @codingStandardsIgnoreStart
     $this->assertEquals(['collection' => [0 => ['text' => 'testvalue1', 'file' => ['name' => 'test.jpg', 'type' => 'image/jpeg', 'size' => 20480, 'tmp_name' => __DIR__ . DIRECTORY_SEPARATOR . 'TestAsset' . DIRECTORY_SEPARATOR . 'testfile.jpg', 'error' => 0]], 1 => ['text' => null, 'file' => null]]], $data);
     // @codingStandardsIgnoreEnd
     $this->assertFileExists($data['collection'][0]['file']['tmp_name']);
     unlink($data['collection'][0]['file']['tmp_name']);
     $messages = $form->getMessages();
     $this->assertTrue(isset($messages['collection'][1]['text'][NotEmpty::IS_EMPTY]));
     $requiredFound = false;
     foreach ($messages['collection'][1]['file'] as $message) {
         if (strpos($message, 'Value is required') === 0) {
             $requiredFound = true;
             break;
         }
     }
     $this->assertTrue($requiredFound, '"Required" message was not found in validation failure messages');
 }
Exemplo n.º 16
0
 /**
  * @param array|\Traversable|ElementInterface $elementOrFieldset
  * @param array $flags
  * @return void|\Zend\Form\Fieldset|\Zend\Form\FieldsetInterface|\Zend\Form\FormInterface
  */
 public function add($elementOrFieldset, array $flags = array())
 {
     if ($elementOrFieldset instanceof ElementInterface) {
         $elementOrFieldset->setForm($this);
     }
     parent::add($elementOrFieldset, $flags);
 }
Exemplo n.º 17
0
 /**
  * @param  ServiceLocatorInterface $serviceLocator
  * @return FormInterface
  */
 public function create()
 {
     $formElementManager = $this->serviceManager->get('FormElementManager');
     $form = new Form();
     $form->add($formElementManager->get('Wizard\\Form\\Element\\Button\\Previous'))->add($formElementManager->get('Wizard\\Form\\Element\\Button\\Next'))->add($formElementManager->get('Wizard\\Form\\Element\\Button\\Valid'))->add($formElementManager->get('Wizard\\Form\\Element\\Button\\Cancel'));
     return $form;
 }
Exemplo n.º 18
0
 /**
  * {@inheritDoc}
  */
 public function getForm()
 {
     $currentStep = $this->getCurrentStep();
     if (!$currentStep) {
         return;
     }
     if (null === $this->form) {
         $this->form = $this->formFactory->create();
         $this->form->setAttribute('action', sprintf('?%s=%s', $this->getOptions()->getTokenParamName(), $this->getUniqueId()));
         if (!$this->getSteps()->getPrevious($currentStep)) {
             $this->form->remove('previous');
         }
         if (!$this->getSteps()->getNext($currentStep)) {
             $this->form->remove('next');
         } else {
             $this->form->remove('valid');
         }
     }
     $stepForm = $currentStep->getForm();
     if ($stepForm instanceof Form) {
         if ($this->form->has(self::STEP_FORM_NAME)) {
             $this->form->remove(self::STEP_FORM_NAME);
         }
         $stepForm->setName(self::STEP_FORM_NAME);
         $stepForm->populateValues($currentStep->getData());
         $this->form->add($stepForm);
     }
     return $this->form;
 }
Exemplo n.º 19
0
 public function add($elementOrFieldset, array $flags = array())
 {
     parent::add($elementOrFieldset, $flags);
     if ($elementOrFieldset instanceof FormParentInterface) {
         $elementOrFieldset->setParent($this);
     }
     return $this;
 }
Exemplo n.º 20
0
 public function add($elementOrFieldset, array $flags = array())
 {
     parent::add($elementOrFieldset, $flags);
     $zf = $elementOrFieldset;
     unset($zf['type']);
     $this->getInputFilter()->add($zf);
     return;
 }
Exemplo n.º 21
0
 public function addDownloadButton($id, $url, Form $form)
 {
     if ($url) {
         $downloadUrl = '/documents/download/' . $id;
         $removeUrl = '/documents/delete-attachment/' . $id;
         $form->add(['name' => 'download', 'type' => 'Zend\\Form\\Element\\Button', 'attributes' => ['value' => $downloadUrl, 'id' => 'download-attachment', 'class' => 'btn btn-info btn-large pull-left self-submitter state hidden-file-input'], 'options' => ['label' => 'Download Attachment', 'download-icon' => 'icon-download-alt icon-white', 'remove-icon' => 'icon-remove icon-white', 'remove-url' => $removeUrl]], ['name' => 'download', 'priority' => 9]);
     }
 }
Exemplo n.º 22
0
 public function __invoke($id)
 {
     $html = "";
     $auth = $this->sm->get('ZfcRbac\\Service\\AuthorizationService');
     $zfcuserauth = $this->sm->get('zfcuser_auth_service');
     $objectmanager = $this->sm->get('Doctrine\\ORM\\EntityManager');
     $type = $objectmanager->getRepository('Application\\Entity\\OpSupType')->find($id);
     if ($zfcuserauth->hasIdentity()) {
         $criteria = array();
         $criteria['organisation'] = $zfcuserauth->getIdentity()->getOrganisation()->getId();
         $criteria['type'] = $id;
         $query = $objectmanager->createQueryBuilder();
         $query->select('o')->from('Application\\Entity\\OperationalSupervisor', 'o')->where('o.type = ?1')->groupBy('o.zone')->setParameter(1, $id);
         if ($zfcuserauth->getIdentity()->getZone()) {
             $query->andWhere($query->expr()->eq('o.zone', '?2'))->setParameter(2, $zfcuserauth->getIdentity()->getZone()->getId());
         }
         $zones = $query->getQuery()->getResult();
         foreach ($zones as $result) {
             $criteria['zone'] = $result->getZone()->getId();
             $zoneid = $result->getZone()->getId();
             $opsups = $objectmanager->getRepository('Application\\Entity\\OperationalSupervisor')->findBy($criteria, array('name' => 'asc'));
             $currentopsup = $objectmanager->getRepository('Application\\Entity\\OperationalSupervisor')->findOneBy(array('organisation' => $zfcuserauth->getIdentity()->getOrganisation()->getId(), 'zone' => $result->getZone()->getId(), 'type' => $id, 'current' => true));
             if ($auth->isGranted('events.mod-opsup')) {
                 $form = new Form();
                 $selectOpSup = new Select('nameopsup');
                 $opsupArray = array();
                 $opsupArray['-1'] = "Choisir Op Sup";
                 foreach ($opsups as $opsup) {
                     $opsupArray[$opsup->getId()] = $opsup->getName();
                 }
                 $selectOpSup->setValueOptions($opsupArray);
                 if ($currentopsup) {
                     $selectOpSup->setAttribute('value', $currentopsup->getId());
                 }
                 $form->add($selectOpSup);
                 $formView = $this->view->form();
                 $form->setAttributes(array('class' => 'navbar-form navbar-left opsup-form type-' . $id . ' zone-' . $zoneid, 'data-typeid' => $id, 'data-zoneid' => $zoneid));
                 $html .= $formView->openTag($form);
                 $html .= '<div class="form-group">';
                 $html .= '<label for="nameopsup">';
                 $html .= ' <span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span> <b>' . $type->getName() . (count($zones) > 1 ? ' (' . $result->getZone()->getShortname() . ')' : '') . ' : </b>';
                 $html .= '<b class="caret"></b></label>';
                 $html .= $this->view->formSelect($form->get('nameopsup')->setAttribute('class', 'form-control'));
                 $html .= '</div>';
                 $html .= $formView->closeTag();
             } else {
                 if ($currentopsup) {
                     $html .= '<p class="navbar-text navbar-left opsup-name type-' . $id . ' zone-' . $zoneid . '" style="margin-left: 0px"' . ' data-typeid="' . $id . '" data-zoneid="' . $zoneid . '">' . '<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span> <b>' . $type->getName() . (count($zones) > 1 ? ' (' . $result->getZone()->getShortname() . ')' : '') . ' : </b>' . '<span class="opsupname">' . $currentopsup->getName() . '</span><b class="caret"></b></p>';
                 } else {
                     $html .= '<p class="navbar-text navbar-left" style="margin-left: 0px"><em>Aucun Op Sup configuré</em></p>';
                 }
             }
         }
     } else {
         $html .= '<p class="navbar-text navbar-left"><em>Connexion nécessaire</em></p>';
     }
     return $html;
 }
Exemplo n.º 23
0
 public function __construct()
 {
     parent::__construct('password');
     $this->filter = new InputFilter();
     $oldPassword = new Element\Password('oldPassword');
     $oldPassword->setAttribute('required', true);
     $oldPassword->setAttribute('placeholder', 'Current Password');
     $this->add($oldPassword);
     $oldPasswordFilter = new Input('oldPassword');
     $oldPasswordFilter->setRequired(true);
     $this->filter->add($oldPasswordFilter);
     $newPassword = new Element\Password('newPassword');
     $newPassword->setAttribute('required', true);
     $newPassword->setAttribute('placeholder', 'New Password');
     $this->add($newPassword);
     $newPasswordFilter = new Input('newPassword');
     $newPasswordFilter->setRequired(true);
     $newPasswordFilter->getFilterChain()->attach(new Filter\StringTrim());
     $newPasswordFilter->getValidatorChain()->attach(new AppValidator\PasswordStrength());
     $this->filter->add($newPasswordFilter);
     $confirmPassword = new Element\Password('confirmPassword');
     $confirmPassword->setAttribute('required', true);
     $confirmPassword->setAttribute('placeholder', 'Confirm New Password');
     $this->add($confirmPassword);
     $confirmPasswordFilter = new Input('confirmPassword');
     $confirmPasswordFilter->setRequired(true);
     $confirmPasswordFilter->getFilterChain()->attach(new Filter\StringTrim());
     $confirmPasswordFilter->getValidatorChain()->attach(new Validator\Identical('newPassword'));
     $this->filter->add($confirmPasswordFilter);
     $buttons = new Form('buttons');
     $buttons->setOption('twb-layout', 'inline');
     $buttons->setAttribute('class', 'form-group');
     $submit = new Element\Submit('submit');
     $submit->setAttribute('class', 'btn-primary pull-right');
     $submit->setOption('glyphicon', 'lock');
     $submit->setLabel('Change Password');
     $buttons->add($submit);
     $cancel = new Element\Submit('cancel');
     $cancel->setAttribute('formnovalidate', true);
     $cancel->setAttribute('class', 'btn-warning pull-right');
     $cancel->setOption('glyphicon', 'ban-circle');
     $cancel->setLabel('Cancel');
     $buttons->add($cancel);
     $this->add($buttons);
 }
Exemplo n.º 24
0
 public function getForm(array $companyTypes, array $statusList)
 {
     if (!$this->form) {
         $companyId = new Element\Hidden();
         $companyId->setName('companyId');
         $name = new Element\Text();
         $name->setLabel('Name')->setName("name")->setAttribute('class', 'form-control');
         $phone = new Element\Text();
         $phone->setLabel('Phone')->setName("phone")->setAttribute('class', 'form-control');
         $address = new Element\Textarea();
         $address->setLabel('Address')->setName("address")->setAttribute('class', 'form-control');
         $website = new Element\Url();
         $website->setLabel('Website')->setName("website")->setAttribute('class', 'form-control');
         $type = new Element\Select();
         $type->setName("type")->setLabel('Type')->setAttribute('class', 'form-control')->setValueOptions($companyTypes);
         $status = new Element\Select();
         $status->setName("status")->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($statusList);
         $form = new Form();
         $form->setAttribute('class', 'form-horizontal');
         $form->add($companyId);
         $form->add($name);
         $form->add($phone);
         $form->add($address);
         $form->add($website);
         $form->add($type);
         $form->add($status);
         $this->form = $form;
     }
     return $this->form;
 }
Exemplo n.º 25
0
 /**
  * Prepares a new instance of \Zend\Form
  *
  * @return Form
  */
 public function getSettingsForm()
 {
     $settingsForm = new Form($this->getView()->Translate('settings'));
     $settingsForm->setAttribute('method', 'get');
     if (!in_array('columnsForm', $this->displaySettings)) {
         return $settingsForm;
     }
     return $settingsForm->add(new DisplaySettingsFieldset($this->tableModel));
 }
 public function getForm()
 {
     if (!$this->form) {
         $currentPassword = new Element\Password();
         $currentPassword->setName('currentPassword')->setLabel('Old password')->setAttributes(array('class' => 'form-control'));
         $password = new Element\Password();
         $password->setName('password')->setLabel('New password')->setAttributes(array('class' => 'form-control'));
         $retypePassword = new Element\Password();
         $retypePassword->setName('retypePassword')->setLabel('Retype password')->setAttributes(array('class' => 'form-control'));
         $form = new Form();
         $form->setAttributes(array('class' => 'form-horizontal', 'role' => 'form'));
         $form->add($currentPassword);
         $form->add($password);
         $form->add($retypePassword);
         $this->form = $form;
     }
     return $this->form;
 }
 public function indexAction()
 {
     $form = new Form();
     // Элемент Date/Time
     $dateTime = new Element\DateTime('element-date-time');
     $dateTime->setLabel('Date/Time Element')->setAttributes(array('min' => '2000-01-01T00:00:00Z', 'max' => '2020-01-01T00:00:00Z', 'step' => '1'));
     $form->add($dateTime);
     // Элемент Date/Time Local
     $dateTime = new Element\DateTimeLocal('element-date-time-local');
     $dateTime->setLabel('Date/Time Local Element')->setAttributes(array('min' => '2000-01-01T00:00:00Z', 'max' => '2020-01-01T00:00:00Z', 'step' => '1'));
     $form->add($dateTime);
     // Элемент Time
     $time = new Element\Time('element-time');
     $time->setLabel('Time Element');
     $form->add($time);
     // Элемент Date
     $date = new Element\Date('element-date');
     $date->setLabel('Date Element')->setAttributes(array('min' => '2000-01-01', 'max' => '2020-01-01', 'step' => '1'));
     $form->add($date);
     // Элемент Week
     $week = new Element\Week('element-week');
     $week->setLabel('Week Element');
     $form->add($week);
     // Элемент Month
     $month = new Element\Month('element-month');
     $month->setLabel('Month Element');
     $form->add($month);
     // Элемент Email
     $email = new Element\Email('element-email');
     $email->setLabel('Email Element');
     $form->add($email);
     // Элемент URL
     $url = new Element\Url('element-url');
     $url->setLabel('URL Element');
     $form->add($url);
     // Элемент Number
     //        $number   = new Element\Number('element-number');
     //        $number->setLabel('Number Element');
     //        $form->add($number);
     // Элемент Range
     //        $range    = new Element\Range('element-range');
     //        $range->setLabel('Range Element');
     //        $form->add($range);
     // Элемент Color
     $color = new Element\Color('element-color');
     $color->setLabel('Color Element');
     $form->add($color);
     return array('form' => $form);
 }
Exemplo n.º 28
0
 public function __construct()
 {
     parent::__construct('confirm');
     $buttons = new Form('buttons');
     $buttons->setOption('twb-layout', 'inline');
     $buttons->setAttribute('class', 'form-group');
     $submit = new Element\Submit('confirm');
     $submit->setAttribute('class', 'btn-primary pull-right');
     $submit->setOption('glyphicon', 'lock');
     $submit->setLabel('Secure Checkout with PayPal');
     $buttons->add($submit);
     $back = new Element\Submit('back');
     $back->setAttribute('formnovalidate', true);
     $back->setAttribute('class', 'btn-warning pull-right');
     $back->setOption('glyphicon', 'chevron-left');
     $back->setLabel('Go Back');
     $buttons->add($back);
     $this->add($buttons);
 }
Exemplo n.º 29
0
 public function getForm(array $formulaList)
 {
     if (!$this->form) {
         $fromDate = new Element\Date('fromDate');
         $fromDate->setAttributes(array('allowPastDates' => true, 'style' => 'width:120px;', 'momentConfig' => array('format' => 'YYYY-MM-DD')));
         $fromDate->setValue(date('Y-m-26', strtotime('-1 month')));
         $toDate = new Element\Date('toDate');
         $toDate->setAttributes(array('allowPastDates' => true, 'style' => 'width:120px;margin-left:5px;', 'momentConfig' => array('format' => 'YYYY-MM-DD')));
         $toDate->setValue(date('Y-m-25', time('')));
         $formula = new Element\Select();
         $formula->setName('formula')->setAttribute('class', 'form-control')->setAttribute('style', 'width:200px')->setValueOptions($formulaList)->setEmptyOption('-- Choose Formula --');
         $form = new Form();
         $form->setAttributes(array('class' => 'form-inline', 'role' => 'form', 'id' => 'process-form'));
         $form->add($fromDate);
         $form->add($toDate);
         $form->add($formula);
         $this->form = $form;
     }
     return $this->form;
 }
Exemplo n.º 30
0
 public function testAddRemove()
 {
     $form = clone $this->form;
     $this->assertEquals($form, $this->form);
     $file = new Element\File('file_resource');
     $this->form->add($file);
     $this->assertTrue($this->form->has('file_resource'));
     $this->assertNotEquals($form, $this->form);
     $this->form->remove('file_resource');
     $this->assertEquals($form, $this->form);
 }