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; }
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; }
/** * Outputs message depending on flag * * @return string */ public function __invoke(Form $form, $url, $class = 'form-horizontal') { $form->setAttribute('action', $url); $form->setAttribute('class', $class); $form->prepare(); $output = $this->getView()->form()->openTag($form); $submitElements = array(); foreach ($form as $element) { if ($element instanceof Submit) { $submitElements[] = $element; } elseif ($element instanceof Csrf || $element instanceof Hidden) { $output .= $this->getView()->formElement($element); } else { $element->setLabelAttributes(array('class' => 'control-label')); $output .= '<div class="control-group">'; $output .= $this->getView()->formLabel($element); $output .= '<div class="controls">'; $output .= $this->getView()->formElement($element); $output .= $this->getView()->formElementErrors($element); $output .= '</div>'; $output .= '</div>'; } } $output .= '<div class="form-actions">'; foreach ($submitElements as $element) { $output .= $this->getView()->formElement($element) . ' '; } $output .= '</div>'; $output .= $this->getView()->form()->closeTag(); return $output; }
public function __invoke(Form $form, $action) { $form->setAttribute('method', 'post'); $form->setAttribute('action', $action); $form->prepare(); $view = $this->getView(); $html = ''; $html .= $view->form()->openTag($form); $html .= '<table class="default-table">'; $formElements = $form->getElements(); foreach ($formElements as $formElement) { if ($formElement instanceof Checkbox) { $html .= $view->formRowCheckbox($form, $formElement); } else { if ($formElement instanceof Submit) { $html .= $view->formRowSubmit($form, $formElement); } else { $html .= $view->formRowDefault($form, $formElement); } } } $html .= '</table>'; $html .= $view->form()->closeTag(); return $html; }
public function getForm(array $currencies, array $companies, array $contacts, array $statusList) { if (!$this->form) { $hidId = new Element\Hidden(); $hidId->setName('proposalId'); $txtCompanyId = new Element\Select(); $txtCompanyId->setLabel('Company Name')->setName("companyId")->setAttribute('class', 'form-control')->setEmptyOption("--Choose Company--")->setValueOptions($companies); $txtContactId = new Element\Select(); $txtContactId->setLabel('Contact Name')->setName('contactId')->setAttribute('class', 'form-control')->setEmptyOption("--Choose Contact--")->setValueOptions($contacts); $txtCode = new Element\Text(); $txtCode->setLabel('Code')->setName('code')->setAttribute('class', 'form-control'); $txtName = new Element\Text(); $txtName->setLabel('Name')->setName('name')->setAttribute('class', 'form-control'); $txtAmount = new Element\Number(); $txtAmount->setName("amount")->setLabel('Amount')->setAttribute('class', 'form-control')->setAttributes(array('min' => '100', 'max' => '99999999999', 'step' => '100')); $selectCurrency = new Element\Select(); $selectCurrency->setName('currencyId')->setLabel('Currency')->setAttribute('class', 'form-control')->setValueOptions($currencies); $txtProposalDate = new Element\Date('proposalDate'); $txtProposalDate->setLabel('Date')->setAttributes(array('class' => 'form-control', 'allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD'))); $txtProposalFile = new Element\File(); $txtProposalFile->setName('proposalFile')->setLabel('Upload file'); $txtNodes = new Element\Textarea(); $txtNodes->setLabel('Notes')->setName('notes')->setAttribute('class', 'form-control'); $txtProposalBy = new Element\Text(); $txtProposalBy->setName('proposalBy')->setLabel('Proposal By')->setAttribute('class', 'form-control'); $txtGroupCode = new Element\Text(); $txtGroupCode->setLabel('Group Code')->setName('group_code')->setAttribute('class', 'form-control'); $txtStatus = new Element\Select(); $txtStatus->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($statusList); $form = new Form(); $form->setAttribute('class', 'form-horizontal'); $form->setAttribute('enctype', 'multipart/form-data'); $form->add($hidId); $form->add($txtCompanyId); $form->add($txtContactId); $form->add($txtCode); $form->add($txtName); $form->add($txtAmount); $form->add($selectCurrency); $form->add($txtProposalDate); $form->add($txtProposalFile); $form->add($txtNodes); $form->add($txtProposalBy); $form->add($txtGroupCode); $form->add($txtStatus); $this->form = $form; } return $this->form; }
public function getForm(array $defaultStatus) { if (!$this->form) { $currencyId = new Element\Hidden(); $currencyId->setName('currencyId'); $name = new Element\Text(); $name->setLabel('Name')->setName("name")->setAttribute('class', 'form-control'); $code = new Element\Text(); $code->setLabel('Code')->setName("code")->setAttribute('class', 'form-control'); $rate = new Element\Text(); $rate->setLabel('Rate')->setName("rate")->setAttributes(array('class' => 'form-control')); $status = new Element\Select(); $status->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($defaultStatus); $changedRate = new Element\Checkbox(); $changedRate->setName('changedRate')->setLabel('Auto renew?')->setAttribute('class', 'form-control'); $form = new Form(); $form->setAttribute('class', 'form-horizontal'); $form->add($currencyId); $form->add($code); $form->add($name); $form->add($rate); $form->add($status); $form->add($changedRate); $this->form = $form; } return $this->form; }
public function getForm(array $defaultStatus, array $currencyList) { if (!$this->form) { $positionId = new Element\Hidden(); $positionId->setName('positionId'); $name = new Element\Text(); $name->setLabel('Name')->setName("name")->setAttribute('class', 'form-control'); $minSalary = new Element\Text(); $minSalary->setLabel('MinSalary')->setName("min_Salary")->setAttribute('class', 'form-control'); $maxSalary = new Element\Text(); $maxSalary->setLabel('MaxSalary')->setName("max_Salary")->setAttribute('class', 'form-control'); $currency = new Element\Select(); $currency->setName('currencyId')->setLabel('Currency Type')->setAttribute('class', 'form-control')->setEmptyOption('-- Choose Currency --')->setValueOptions($currencyList); $status = new Element\Select(); $status->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($defaultStatus); $form = new Form(); $form->setAttribute('class', 'form-horizontal'); $form->add($positionId); $form->add($name); $form->add($currency); $form->add($minSalary); $form->add($maxSalary); $form->add($status); $this->form = $form; } return $this->form; }
/** * {@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; }
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); }
/** * @param Entity\Note $note * @param string $url * @param string $action * @param array $members * @return \Zend\Form\Form */ public function getNoteForm(Entity\Note $note, $url = '', $action = 'add', $members = null) { if (is_null($this->noteForm)) { $builder = new AnnotationBuilder($this->getEntityManager()); $this->noteForm = $builder->createForm($note); $this->noteForm->setAttribute('action', $url); $this->noteForm->setAttribute('id', 'noteForm'); $this->noteForm->setHydrator(new DoctrineObject($this->getEntityManager(), 'Secretary\\Entity\\Note')); $this->noteForm->bind($note); if ($action == 'edit' && $note->getPrivate() === false) { $this->noteForm->remove('private'); $group = $note->getGroup(); $membersString = $this->getMembersString(array_keys($members)); $this->noteForm->get('groupHidden')->setValue($group->getId()); $this->noteForm->get('members')->setValue($membersString); $this->noteForm->getInputFilter()->remove('__initializer__'); $this->noteForm->getInputFilter()->remove('__cloner__'); $this->noteForm->getInputFilter()->remove('__isInitialized__'); $this->noteForm->getInputFilter()->remove('lazyPropertiesDefaults'); } else { $this->noteForm->get('private')->setAttribute('required', false); $this->noteForm->getInputFilter()->get('private')->setRequired(false); } } return $this->noteForm; }
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; }
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; }
public function __invoke(Form $form) { $form->setAttribute('class', self::DEFAULT_FORM_CLASS); foreach ($form->getElements() as $element) { /* * controls how far the form indents into * the page using Twitter:Bootstrap CSS * */ $defLabelAttributes = array('class' => self::DEFAULT_LABEL_CLASS); $element->setLabelAttributes($defLabelAttributes); $element->setAttribute('class', self::DEFAULT_INPUT_CLASS); /* * set the id attribute of all inputs to be equal to their names * * makes life simple when trying to make the view * dynamic */ $element->setAttribute('id', $element->getName()); } /* * the submit button is a little different, it uses * a button class to proper rendering * */ $form->get('submit')->setAttribute('class', self::DEFAULT_SUBMIT_BUTTON_CLASS); return $form; }
public function getForm() { if (!$this->form) { $hidId = new Element\Hidden(); $hidId->setName('routeId'); $txtName = new Element\Text(); $txtName->setLabel('Route Name')->setName("name")->setAttribute('class', 'form-control'); $txtRoute = new Element\Text(); $txtRoute->setLabel('Route')->setName("route")->setAttribute('class', 'form-control'); $txtModule = new Element\Text(); $txtModule->setLabel("Module")->setName('module')->setAttribute('class', 'form-control'); $txtController = new Element\Text(); $txtController->setLabel("Controller")->setName('controller')->setAttribute('class', 'form-control'); $txtConstraints = new Element\Textarea(); $txtConstraints->setLabel("Constraints")->setName('constraints')->setAttribute('class', 'form-control'); $form = new Form(); $form->setAttribute('class', 'form-horizontal'); $form->add($hidId); $form->add($txtName); $form->add($txtRoute); $form->add($txtModule); $form->add($txtController); $form->add($txtConstraints); $this->form = $form; } return $this->form; }
/** * Prepares a new instance of \Zend\Form */ public function prepareForm() { $this->settingsForm = new Form($this->getView()->Translate('settings')); $this->settingsForm->setAttribute('method', 'get'); if (!in_array('columnsForm', $this->displaySettings)) { return; } $this->settingsForm->add(new ColumnSettingsFieldset($this->tableModel)); }
/** * @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; }
public function getForm() { if ($this->form) { return $this->form; } $form = new Form(); $form->setAttribute('class', 'form-horizontal'); $form->setAttribute('hr_department', 'form'); $form->add(array('name' => 'departmentId', 'type' => 'Hidden')); $form->add(array('name' => 'name', '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'))); $form->add(array('name' => 'group_code', 'type' => 'Text', 'options' => array('label' => 'Group Code'), 'attributes' => array('class' => 'form-control'))); $form->add(array('name' => 'parentId', 'type' => 'number', 'options' => array('label' => 'Parent Id'), 'attributes' => array('class' => 'form-control'))); $form->add(array('name' => 'priority', 'type' => 'number', 'options' => array('label' => 'Priority'), 'attributes' => array('class' => 'form-control', 'placeholder' => 'Choose priority'))); $form->add(array('name' => 'status', 'type' => 'text')); $this->form = $form; return $this->form; }
public function getForm() { if ($this->form) { return $this->form; } $form = new Form(); $form->setAttribute('class', 'form-horizontal'); $form->setAttribute('role', 'form'); $form->add(array('name' => 'roleId', 'type' => 'Hidden')); $form->add(array('name' => 'name', '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'))); $form->add(array('name' => 'icon', 'type' => 'text', 'attributes' => array('class' => 'form-control', 'placeholder' => 'Icon Class'))); $form->add(array('name' => 'parentId', 'type' => 'Hidden')); $form->add(array('name' => 'priority', 'type' => 'number', 'options' => array('label' => 'Priority'), 'attributes' => array('class' => 'form-control', 'placeholder' => 'Choose priority'))); $form->setInputFilter($this->getInputFilter()); $this->form = $form; return $this->form; }
protected function getPasswordForm() { $translator = $this->getServiceLocator()->get('translator'); $form = new Form('password'); $form->setAttribute('class', 'smart-form client')->add(array('name' => 'oldPassword', 'type' => 'password', 'attributes' => array('class' => 'form-control input-sm', 'placeholder' => 'Enter old password')))->add(array('name' => 'password', 'type' => 'password', 'attributes' => array('class' => 'form-control input-sm', 'placeholder' => 'Enter new password')))->add(array('name' => 'password_confirm', 'type' => 'password', 'attributes' => array('class' => 'form-control input-sm', 'placeholder' => 'Enter confirm password')))->add(array('name' => 'save', 'type' => 'submit', 'attributes' => array('value' => 'Save', 'class' => 'btn btn-sm btn-success'))); $filter = new InputFilter(); $filter->add(array('name' => 'password', 'required' => true))->add(array('name' => 'oldPassword', 'required' => true))->add(array('name' => 'password_confirm', 'required' => false, 'validators' => array(array('name' => 'Identical', 'options' => array('token' => 'password'))))); $form->setInputFilter($filter); return $form; }
public function getForm() { if (!$this->form) { $contactId = new Element\Hidden(); $contactId->setName('contactId'); $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'); $email = new Element\Email(); $email->setLabel('Email')->setName("email")->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'); $selectCompany = new Element\Select(); $selectCompany->setName('companyId')->setLabel('Company')->setAttribute('class', 'form-control')->setEmptyOption("---Choose Company---")->setValueOptions($this->companies); $notes = new Element\Textarea(); $notes->setLabel('Notes')->setName("notes")->setAttribute('class', 'form-control'); $tag = new Element\Text(); $tag->setLabel('Tag')->setName("tag")->setAttribute('class', 'form-control'); $status = new Element\Select(); $status->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions(array('A' => 'Active', 'D' => 'Inactive')); $form = new Form(); $form->setAttribute('class', 'form-horizontal'); $form->setAttribute('enctype', 'multipart/form-data'); $form->add($contactId); $form->add($name); $form->add($phone); $form->add($email); $form->add($address); $form->add($website); $form->add($selectCompany); $form->add($notes); $form->add($tag); $form->add($status); $this->form = $form; } return $this->form; }
public function __invoke($action = 'view') { $this->parentLocator = $this->getServiceLocator()->getServiceLocator(); $this->router = $this->parentLocator->get('Router'); $p = $this->routeMatch->getParams(); $c = $p['controller']; $n = $this->getModuleName($c); $v = $this->getView(); $r = $this->routeMatch->getMatchedRouteName(); $em = $this->getEntityManager(); $objRepository = $em->getRepository($this->getEntityClass($p['controller'])); $i = new InputFilter(); $i->add(array('name' => 'entitynav', 'required' => true, 'filters' => array(array('name' => 'Zend\\Filter\\StringTrim')))); $form = new Form('entitynav'); $form->setAttribute('method', 'POST'); $form->setAttribute('action', $v->url('navigation')); $form->add(array('name' => 'params[id]', 'type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'required' => false, 'allow_empty' => true, 'filters' => array(array('name' => 'Zend\\Filter\\StringTrim')), 'options' => array('label_attributes' => array('class' => 'sr-only'), 'empty_option' => 'Switch ' . $n . '(s)', 'object_manager' => $em, 'target_class' => $this->getEntityClass($c), 'is_method' => true, 'find_method' => array('name' => 'findAll')), 'attributes' => array('id' => strtolower($n) . 'id', 'onChange' => 'if (this.value) this.form.submit()', 'value' => isset($p['id']) ? $p['id'] : ""))); $form->add(array('name' => 'controller', 'type' => 'hidden', 'attributes' => array('value' => $p['controller']))); $form->add(array('name' => 'params[action]', 'type' => 'hidden', 'attributes' => array('value' => $this->hasAction($action) ? $action : $p['action']))); $form->add(array('name' => 'route', 'type' => 'hidden', 'attributes' => array('value' => $this->findRoute($action)))); $form->setInputFilter($i); echo $this->helperExists('losForm') ? $v->losForm($form, false) : $v->form($form); }
/** * @param ZendForm $form * @param boolean $groupActions * * @return Form */ public function __invoke(ZendForm $form, $groupActions = false) { $this->formActionElements = array(); $form->prepare(); $this->setElement(new HtmlElement('form')); $this->getElement()->setAttributes(array('action' => '', 'method' => 'GET')); if (!$form->hasAttribute('id')) { $form->setAttribute('id', $form->getName()); } $this->getElement()->addAttributes($form->getAttributes()); $this->renderElements($form->getIterator(), $groupActions); $this->renderFormActions(); return clone $this; }
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; }
public function getForm(array $usersData, array $positionsData, array $currencyData, array $defaultStatus) { if (!$this->form) { $hidId = new Element\Hidden(); $hidId->setName('staffId'); $selectUsers = new Element\Select(); $selectUsers->setName('userId')->setLabel('User')->setAttribute('class', 'form-control')->setEmptyOption("--Choose User --")->setValueOptions($usersData); $staffCode = new Element\Text(); $staffCode->setLabel('Code')->setName("staffCode")->setAttribute('class', 'form-control'); $staffName = new Element\Text(); $staffName->setLabel('Name')->setName("staffName")->setAttribute('class', 'form-control'); $selectPosition = new Element\Select(); $selectPosition->setName('positionId')->setLabel('Position')->setAttribute('class', 'form-control')->setEmptyOption("-- Choose Position --")->setValueOptions($positionsData); $selectDepartment = new Element\Hidden('departmentId'); $salary = new Element\Number(); $salary->setLabel('Salary')->setName("salary")->setAttributes(array('min' => '0', 'max' => '999999999999', 'step' => '1')); $leave = new Element\Number(); $leave->setLabel('Leave')->setName("annual_leave")->setAttributes(array('min' => '0.5', 'max' => '100', 'step' => '0.5')); $PermanentDate = new Element\Date('permanentDate'); $PermanentDate->setLabel('P-Date')->setAttributes(array('allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD'))); $birthDay = new Element\Date('birthday'); $birthDay->setLabel('Birthday')->setAttributes(array('allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD'))); $selectCurrency = new Element\Select(); $selectCurrency->setName('currencyId')->setAttribute('class', 'form-control')->setValueOptions($currencyData); $status = new Element\Select(); $status->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($defaultStatus); $bankCode = new Element\Text('bankCode'); $bankCode->setLabel('Bank Account')->setAttributes(array('class' => 'form-control', 'placeholder' => 'Aya Bank Account No')); $form = new Form(); $form->setAttribute('class', 'form-horizontal'); $form->add($hidId); $form->add($selectUsers); $form->add($staffCode); $form->add($staffName); $form->add($selectPosition); $form->add($selectDepartment); $form->add($salary); $form->add($leave); $form->add($PermanentDate); $form->add($status); $form->add($birthDay); $form->add($selectCurrency); $form->add($bankCode); $this->form = $form; } return $this->form; }
public function __construct($name = null) { //Đặt tên cho form parent::__construct('loginForm'); parent::setAttribute('action', 'login'); parent::setAttribute('method', 'post'); parent::setAttribute('class', 'form-signin'); //Thêm trường(input) id //type Hidden $this->add(array('name' => 'username', 'type' => 'text', 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'attributes' => array('class' => 'form-control', 'placeholder' => 'Username'))); //Thêm trường(input) title //type text //label Tiêu đề $this->add(array('name' => 'password', 'type' => 'password', 'attributes' => array('class' => 'form-control', 'placeholder' => 'Username'))); //Thêm nút submit $this->add(array('name' => 'submit', 'type' => 'submit', 'attributes' => array('value' => 'Đăng nhập', 'id' => 'submitLoginFormAdmin', 'class' => 'btn btn-lg btn-login btn-block'))); }
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); }
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); }
public function getForm() { if (!$this->form) { $hidId = new Element\Hidden(); $hidId->setName('constantId'); $txtName = new Element\Text(); $txtName->setLabel('Constant Name')->setName("name")->setAttribute('class', 'form-control'); $txtValue = new Element\Textarea(); $txtValue->setLabel('Value')->setName("value")->setAttribute('class', 'form-control'); $txtGroupCode = new Element\Text(); $txtGroupCode->setLabel('Group Code')->setName("group_code")->setAttribute('class', 'form-control'); $form = new Form(); $form->setAttribute('class', 'form-horizontal'); $form->add($hidId); $form->add($txtName); $form->add($txtValue); $form->add($txtGroupCode); $this->form = $form; } return $this->form; }
public function formAction() { // Build a name element. $name = new Element('name'); $name->setLabel('Your name'); $name->setAttributes(array('type' => 'text')); // Build a submit button element. $send = new Element('send'); $send->setLabel('Send'); $send->setAttributes(array('type' => 'submit', 'value' => 'Send')); // Build a checkbox element. $check = new Checkbox('check'); $check->setLabel('Checkbox example'); // Build a multi-checkbox element. $multicheck = new MultiCheckbox('multicheck'); $multicheck->setLabel('Multi checkbox example'); $multicheck->setOptions(array('value_options' => array('One' => 'one', 'Two' => 'two'))); // Assemble the form. $form = new Form('contact'); $form->add($name); $form->add($check); $form->add($multicheck); $form->add($send); // Get the request if any. $request = $this->getRequest(); $data = $request->getPost(); $form->setData($data); // Validate the form if ($form->isValid()) { $validatedData = $form->getData(); $success = 'Form submit was successful'; } else { $success = 'Form submit failed'; $messages = $form->getMessages(); } // Set the method attribute for the form $form->setAttribute('method', 'post'); return new ViewModel(array('form' => $form, 'success' => $success, 'messages' => $messages, 'data' => $data)); }
public function getForm(array $currencies) { if (!$this->form) { $hidId = new Element\Hidden(); $hidId->setName('receiveVoucherId'); $txtVoucherNo = new Element\Text(); $txtVoucherNo->setLabel('Number')->setName("voucherNo")->setAttribute('class', 'form-control text-center')->setAttribute('readonly', 'readonly'); $txtVoucherDate = new Element\Date('voucherDate'); $txtVoucherDate->setLabel('Date')->setAttributes(array('class' => 'form-control', 'allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD'))); $txtAccountType = new Element\Hidden('accountType'); $txtDescription = new Element\Textarea(); $txtDescription->setName("description")->setLabel('Description')->setAttribute('class', 'form-control'); $txtAmount = new Element\Number(); $txtAmount->setName("amount")->setLabel('Amount')->setAttribute('class', 'form-control')->setattributes(array('min' => '10', 'max' => '99999999999', 'step' => '1')); $cboCurrency = new Element\Select(); $cboCurrency->setName('currencyId')->setLabel('Currency Type')->setAttribute('class', 'form-control')->setEmptyOption('-- Choose --')->setValueOptions($currencies); $txtDepositBy = new Element\Hidden(); $txtDepositBy->setName("depositBy"); $txtReason = new Element\Textarea(); $txtReason->setName('reason'); $txtGroupCode = new Element\Text(); $txtGroupCode->setName('group_code')->setLabel('Group Code (optional)')->setAttribute('class', 'form-control'); $form = new Form(); $form->setAttribute('role', 'form'); $form->add($hidId); $form->add($txtVoucherNo); $form->add($txtVoucherDate); $form->add($txtAccountType); $form->add($txtDescription); $form->add($txtAmount); $form->add($cboCurrency); $form->add($txtDepositBy); $form->add($txtReason); $form->add($txtGroupCode); $this->form = $form; } return $this->form; }