public function prepareElements($topicList, $categoryList, $captchaOptions) { // repurpose $topicList and $categoryList $topics = array('---' => 'Choose'); foreach ($topicList as $item) { $topics[$item->item] = $item->item; } $categories = array('---' => 'Choose'); foreach ($categoryList as $item) { $categories[$item->item] = $item->item; } $author = new Element\Hidden('author'); $category1 = new Element\Text('category'); $category1->setLabel('Category')->setAttribute('title', 'Enter a category: i.e. zf2 or use the dropdown list below')->setAttribute('size', 16)->setAttribute('maxlength', 16); $category2 = new Element\Select('selectCategory'); $category2->setValueOptions($categories); $topic1 = new Element\Text('topic'); $topic1->setLabel('Topic')->setAttribute('title', 'Enter a topic code: i.e. zf2f-2013-02-25 or use the dropdown list below')->setAttribute('size', 60)->setAttribute('maxlength', 254); $topic2 = new Element\Select('selectTopic'); $topic2->setValueOptions($topics); $title = new Element\Text('title'); $title->setLabel('Title')->setAttribute('title', 'Enter a suitable title for this posting')->setAttribute('size', 60)->setAttribute('maxlength', 254); $body = new Element\Textarea('body'); $body->setLabel('Body')->setAttribute('title', 'Enter the body for this posting')->setAttribute('rows', 4)->setAttribute('cols', 60); $captcha = new Element\Captcha('captcha'); $captchaAdapter = new Captcha\Image(); $captchaAdapter->setWordlen(4)->setOptions($captchaOptions); $captcha->setCaptcha($captchaAdapter)->setLabel('Help us to prevent SPAM!')->setAttribute('class', 'captchaStyle')->setAttribute('title', 'Help to prevent SPAM'); $submit = new Element\Submit('submit'); $submit->setAttribute('value', 'Post')->setAttribute('title', 'Click here when done'); $this->add($author)->add($topic1)->add($topic2)->add($category1)->add($category2)->add($title)->add($body)->add($captcha)->add($submit); }
/** * Add role element */ public function addRoleElement($options = array(), $name = 'role') { $element = new Select($name); $element->setLabel('Benutzergruppe'); $element->setValueOptions($options); $this->add($element); }
public function __construct() { parent::__construct('add'); $hydrator = new AggregateHydrator(); $hydrator->add(new PostHydrator()); $hydrator->add(new CategoryHydrator()); $this->setHydrator($hydrator); $title = new Element\Text('title'); $title->setLabel('Title'); $title->setAttribute('class', 'form-control'); $slug = new Element\Text('slug'); $slug->setLabel('Slug'); $slug->setAttribute('class', 'form-control'); $content = new Element\Textarea('content'); $content->setLabel('Content'); $content->setAttribute('class', 'form-control'); $category = new Element\Select('category_id'); $category->setLabel('Category'); $category->setAttribute('class', 'form-control'); $category->setValueOptions(array(1 => 'WIN', 2 => 'BUILD', 3 => 'SEND', 4 => 'GENERAL')); $submit = new Element\Submit('submit'); $submit->setValue('Add News'); $submit->setAttribute('class', 'btn btn-primary'); $this->add($title); $this->add($slug); $this->add($content); $this->add($category); $this->add($submit); }
/** * * @param null|string $name */ public function __construct($serviceLocator) { parent::__construct('transactionFilter'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'GET'); $filter = $this->getInputFilter(); $id = new Text('id'); $id->setAttributes(['placeholder' => 'ID']); $this->add($id); $filter->add(array('name' => 'id', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits')))); $companyId = $this->addElementCompany('companyId', null, ['required' => false]); $transaction = new \Accounting\Model\Transaction(); $status = new Select('status'); $status->setValueOptions(['' => '- Trạng thái -'] + $transaction->getStatuses()); $this->add($status); $filter->add(array('name' => 'status', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits')))); $type = new Select('type'); $type->setValueOptions(['' => '- Loại phiếu -'] + $transaction->getTypes()); $this->add($type); $filter->add(array('name' => 'type', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits')))); $applyDateRange = new Text('applyDateRange'); $applyDateRange->setAttributes(array('placeholder' => 'Ngày hạch toán', 'class' => 'date-range-picker')); $this->add($applyDateRange); $filter->add(array('name' => 'applyDateRange', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $createdByName = new Text('createdByName'); $createdByName->setAttributes(array('placeholder' => 'Người tạo')); $this->add($createdByName); $filter->add(array('name' => 'createdByName', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $createdById = new Hidden('createdById'); $this->add($createdById); $filter->add(array('name' => 'createdById', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits')))); $this->add(array('name' => 'submit', 'options' => array(), 'attributes' => array('type' => 'submit', 'value' => 'Lọc', 'id' => 'btnFilterCompanyContact', 'class' => 'btn btn-primary'))); }
public function __construct($serviceLocator, $options = null) { parent::__construct('fTransaction'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $basicGroup = new DisplayGroup('basicGroup'); $this->add($basicGroup); $companyId = $this->addElementCompany('companyId', $basicGroup, ['required' => true]); $applyDate = new Text('applyDate'); $applyDate->setLabel('Ngày hạch toán:'); $applyDate->setAttribute('class', 'datepicker'); $this->add($applyDate); $basicGroup->addElement($applyDate); $applyDate->setValue(DateBase::toDisplayDate(DateBase::getCurrentDate())); $filter->add(array('name' => 'applyDate', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập ngày hạch toán')))))); $description = new Text('description'); $description->setLabel('Nội dung:'); $this->add($description); $basicGroup->addElement($description); $filter->add(array('name' => 'description', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập nội dung phiếu thu')))))); $accountId = new Select('accountId'); $accountId->setLabel('Quỹ thu:'); $accountId->setValueOptions(['' => '- Quỹ thu -']); $this->loadAccountingAccount($accountId, $companyId); $this->add($accountId); $basicGroup->addElement($accountId); $filter->add(array('name' => 'accountId', 'required' => true, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập quỹ thu'))), array('name' => 'InArray', 'break_chain_on_failure' => true, 'options' => array('haystack' => array_keys($accountId->getValueOptions()), 'messages' => array('notInArray' => 'Bạn chưa nhập quỹ thu')))))); $items = new Hidden('items'); $this->add($items); $filter->add(array('name' => 'items', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập chi tiết các khoản thu')))))); $this->add(array('name' => 'afterSubmit', 'type' => 'radio', 'attributes' => array('value' => '/accounting/transaction/addreqrecieve'), 'options' => array('layout' => 'fluid', 'clearBefore' => true, 'label' => 'Sau khi lưu dữ liệu:', 'value_options' => array('/accounting/transaction/addreqrecieve' => 'Tiếp tục nhập', '/accounting/transaction/index' => 'Hiện danh sách vừa nhập')))); $this->add(array('name' => 'btnSubmit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'button', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
/** * returns a input element for the inline filter * * @param $elementName * @return string|\Zend\Form\ElementInterface */ public function showFilter($elementName) { $select = new Select($elementName); $select->setEmptyOption(''); $select->setValueOptions(array('0' => $this->view->translate('no'), '1' => $this->view->translate('yes'))); return $select; }
public function __construct(EntityManager $em, $name = null, $options = array()) { $this->em = $em; parent::__construct('BankDetailsForm'); $this->setAttribute('method', 'post'); $this->setAttribute('class', 'form-horizontal'); $city = new Element\Select('cityId'); $city->setLabel('city'); $city->setValueOptions($this->getOptionCity()); $city->setAttribute("class", "dropDnInput"); $city->setAttribute("id", "cityId"); $city->setDisableInArrayValidator(true); $this->add($city); $bankName = new Element\Select('bankName'); $bankName->setLabel('Bank Name'); $bankName->setValueOptions($this->getOptionBankNames()); $bankName->setAttribute("class", "dropDnInput"); $this->add($bankName); $this->add(array('name' => 'branchName', 'attributes' => array('type' => 'text', 'placeholder' => 'Branch Name', 'class' => 'commonDropDnInput'))); $this->add(array('name' => 'ifscCode', 'attributes' => array('type' => 'text', 'placeholder' => 'IFSC code', 'class' => 'commonDropDnInput'))); $this->add(array('name' => 'save', 'attributes' => array('type' => 'submit', 'value' => 'Submit', 'class' => "btn-blue"))); // $this->add(array( // 'name' => 'cancel', // 'attributes' => array( // 'type' => 'cancel', // 'value' => 'Cancel', // 'class' => 'btn btn-primary', // ), // 'options' => array( // 'label' => 'Cancel' // ), // )); }
function __construct() { parent::__construct('console_address'); $element_id = new Element\Hidden('id'); $element_id->setValue(''); $this->add($element_id); $this->add(array('name' => 'username', 'type' => 'Text')); $this->add(array('name' => 'domain', 'type' => 'Text')); $this->add(array('name' => 'nickname', 'type' => 'Text')); $element_sex = new Element\Select('sex'); $element_sex->setValueOptions(array(self::ADDRESS_SEX_BOY => '男性', self::ADDRESS_SEX_GIRL => '女性')); $this->add($element_sex); $this->add(array('name' => 'submit', 'type' => 'Submit')); /** * Setting up inputFilter */ $input_id = new Input('id'); $input_id->setRequired(false)->getValidatorChain()->attach(new \Zend\Validator\StringLength(array('max' => 50)))->attach(new \Zend\Validator\Digits()); $input_username = new Input('username'); $input_username->setRequired(true)->getValidatorChain()->attach(new \Zend\Validator\StringLength(array('max' => 18)))->attach(new \Zend\Validator\Digits()); $input_filter = new InputFilter(); $input_filter->add($input_id); $input_filter->add($input_username); $this->setInputFilter($input_filter); }
/** * @author KienNN * @param unknown $serviceLocator * @param string $options */ public function __construct($serviceLocator, $options = null) { parent::__construct(); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'GET'); $filter = $this->getInputFilter(); $filter = $this->getInputFilter(); $daterangepicker = new Text('daterangepicker'); $daterangepicker->setAttributes(['class' => 'date-range-picker']); $this->add($daterangepicker); $filter->add(array('name' => 'daterangepicker', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); if ($options && isset($options['displayMode']) && $options['displayMode']) { $displayMode = new Select('displayMode'); if (is_array($options['displayMode'])) { $displayMode->setValueOptions($options['displayMode']); } else { $displayMode->setValueOptions(array('day' => 'Theo ngày', 'month' => 'Theo tháng')); } $this->add($displayMode); $filter->add(array('name' => 'displayMode', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); } $companyId = $this->addElementCompany('companyId', null, ['required' => false]); $departmentId = new Select('departmentId'); $departmentId->setValueOptions(['' => '- Phòng ban -']); $this->add($departmentId); $this->loadDepartments($departmentId, $companyId); $filter->add(array('name' => 'departmentId', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); }
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; }
/** * Initially loaded to display the list page's template * @return ViewModel */ public function listAction() { $categoryTree = $this->getServiceLocator()->get('category-tree'); $selectCategoryElement = new Select('filter_category'); $selectCategoryElement->setAttribute('id', 'filter_category'); $selectCategoryElement->setEmptyOption($this->translator->translate('All categories')); $selectCategoryElement->setValueOptions($categoryTree->getSelectOptions()); return new ViewModel(['selectCategory' => $selectCategoryElement, 'locale' => $this->translator->getLocale()]); }
/** * Return a thumbnail type select element. * * @param PhpRenderer $view * @param SiteRepresentation $site * @param SiteBlockAttachmentRepresentation|null $block * @return string */ public function thumbnailTypeSelect(PhpRenderer $view, SiteRepresentation $site, SitePageBlockRepresentation $block = null) { $types = $this->getServiceLocator()->get('Omeka\\File\\Manager')->getThumbnailTypes(); $type = null; if ($block) { $type = $this->getData($block->data(), 'thumbnail_type'); } $select = new Select('o:block[__blockIndex__][o:data][thumbnail_type]'); $select->setValueOptions(array_combine($types, $types))->setValue($type); return '<label class="thumbnail-option">Thumbnail Type ' . $view->formSelect($select) . '</label>'; }
public function __construct(EntityManager $em, $name = null, $options = array()) { $this->em = $em; parent::__construct('CityForm'); $this->setAttribute('method', 'post'); $this->setAttribute('enctype', 'multipart/form-data'); $this->setAttribute('class', 'form-horizontal'); $this->add(array('name' => 'ctname', 'attributes' => array('type' => 'text', 'placeholder' => 'City name', 'class' => 'commonDropDnInput'))); $stid = new Element\Select('stid'); $stid->setLabel('State name'); $stid->setAttributes(array('id' => 'stid')); $stid->setValueOptions($this->getOptionState()); $stid->setAttribute("class", "dropDnInput"); $this->add($stid); $ctcatid = new Element\Select('ctcatid'); $ctcatid->setLabel('City category'); $ctcatid->setValueOptions($this->getOptionCityCat()); $ctcatid->setAttribute("class", "dropDnInput"); $this->add($ctcatid); $ctdescription = new Element\Textarea('ctdescription'); $ctdescription->setLabel('City Description'); $ctdescription->setAttribute("class", "selectAreaInput"); $ctdescription->setAttribute("rows", "4"); $ctdescription->setAttribute("cols", "50"); $this->add($ctdescription); $ctspecialInstructions = new Element\Textarea('ctspecialInstructions'); $ctspecialInstructions->setLabel('City Special Instruction Description'); $ctspecialInstructions->setAttribute("class", "selectAreaInput"); $ctspecialInstructions->setAttribute("rows", "4"); $ctspecialInstructions->setAttribute("cols", "33"); $this->add($ctspecialInstructions); $ctbestSeasonToVisit = new Element\Textarea('ctbestSeasonToVisit'); $ctbestSeasonToVisit->setLabel('City Best Season to visit'); $ctbestSeasonToVisit->setAttribute("class", "selectAreaInput"); $ctbestSeasonToVisit->setAttribute("rows", "4"); $ctbestSeasonToVisit->setAttribute("cols", "43"); $this->add($ctbestSeasonToVisit); $this->add(array('name' => 'ctlatitude', 'attributes' => array('type' => 'text', 'placeholder' => 'City Lattitude', 'class' => 'commonDropDnInput'))); $this->add(array('name' => 'ctlongitude', 'attributes' => array('type' => 'text', 'placeholder' => 'City Longitude', 'class' => 'commonDropDnInput'))); $this->add(array('name' => 'cityPhoto', 'attributes' => array('type' => 'file'), 'options' => array('label' => 'File Upload'))); $this->add(array('name' => 'save', 'attributes' => array('type' => 'submit', 'value' => 'Submit', 'class' => "btn-blue"))); // $this->add(array( // 'name' => 'cancel', // 'attributes' => array( // 'type' => 'cancel', // 'value' => 'Cancel', // 'class' => 'btn btn-primary', // ), // 'options' => array( // 'label' => 'Cancel' // ), // )); }
/** * @dataProvider selectOptionsDataProvider */ public function testInArrayValidationOfOptions($valueTests, $options) { $element = new SelectElement('my-select'); $element->setValueOptions($options); $inputSpec = $element->getInputSpecification(); $this->assertArrayHasKey('validators', $inputSpec); $inArrayValidator = $inputSpec['validators'][0]; $this->assertInstanceOf('Zend\\Validator\\InArray', $inArrayValidator); foreach ($valueTests as $valueToTest) { $this->assertTrue($inArrayValidator->isValid($valueToTest)); } }
public function addElements() { $this->setAttribute('method', 'post'); $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden'))); $element = new Element\Text('name'); $element->setAttributes(array('class' => 'name', 'size' => '30', 'class' => 'form-control', 'placeholder' => 'name')); $this->add($element); $element = new Element\Select('parent_id'); $element->setAttributes(array('class' => 'form-control ', 'placeholder' => 'parent')); $element->setValueOptions(array(0 => 'Main')); $this->add($element); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Send', 'id' => 'submitbutton', 'class' => 'form-control btn btn-primary'))); }
protected function addSelect($name, $label, array $values) { $select = new Element\Select($name); $select->setLabel($label); $select->setLabelAttributes(array('class' => "col-sm-{$this->labelWidth}")); $select->setOption('column-size', "sm-{$this->controlWidth}"); $select->setValueOptions($values); if ($this->compact) { $select->setAttribute('class', 'input-sm'); } $this->add($select); return $this; }
/** * @param null|string $username */ public function __construct($serviceLocator) { parent::__construct('userManageFilter'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'GET'); $filter = $this->getInputFilter(); $companyId = $this->addElementCompany('companyId', null, ['required' => false]); $departmentId = new Select('departmentId'); $departmentId->setValueOptions(['' => '- Phòng ban -']); $this->add($departmentId); $this->loadDepartments($departmentId, $companyId); $filter->add(array('name' => 'departmentId', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $id = new Text('id'); $id->setAttributes(['maxlength' => 255, 'placeholder' => 'ID']); $this->add($id); $filter->add(array('name' => 'id', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $username = new Text('username'); $username->setAttributes(['maxlength' => 255, 'placeholder' => 'Họ tên']); $this->add($username); $filter->add(array('name' => 'username', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $email = new Text('email'); $email->setAttributes(['maxlength' => 255, 'placeholder' => 'Email']); $this->add($email); $filter->add(array('name' => 'email', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); //phân quyền riêng $hasPrivateRole = new Select('hasPrivateRole'); $hasPrivateRole->setValueOptions(array('' => '- Phân quyền riêng -', '1' => 'Có ', '-1' => 'Không ')); $this->add($hasPrivateRole); $filter->add(array('name' => 'hasPrivateRole', 'required' => false)); $user = new \User\Model\User(); $roleValues = array('' => '- Quyền hạn -') + $user->getRoleDisplays(); unset($roleValues[$user::ROLE_SUPERADMIN]); $role = new Select('role'); $role->setValueOptions($roleValues); $this->add($role); $filter->add(array('name' => 'role', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits')))); $roleCompany = new Select('roleCompany'); $roleCompany->setValueOptions(['' => '- Nhóm quyền -']); $this->add($roleCompany); $this->loadRole($roleCompany, $companyId); $filter->add(array('name' => 'roleCompany', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $active = new Select('active'); $active->setValueOptions(array('' => '- Kích hoạt', '1' => 'Đã kích hoạt', '-1' => 'Chưa kích hoạt')); $this->add($active); $filter->add(array('name' => 'active', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $locked = new Select('locked'); $locked->setValueOptions(array('' => '- Khóa -', '1' => 'Đã khóa', '-1' => 'Chưa khóa')); $this->add($locked); $filter->add(array('name' => 'locked', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $this->add(array('name' => 'submit', 'options' => array(), 'attributes' => array('type' => 'submit', 'value' => 'Lọc', 'id' => 'btnFilterCrmContact', 'class' => 'btn btn-primary'))); }
public function createService(ServiceLocatorInterface $serviceLocator) { $services = $serviceLocator->getServiceLocator(); $config = $services->get('Config'); $translator = $services->get('translator'); $publicRoles = isset($config['acl']['public_roles']) && is_array($config['acl']['public_roles']) && !empty($config['acl']['public_roles']) ? $config['acl']['public_roles'] : (in_array('user', $config['acl']['roles']) || array_key_exists('user', $config['acl']['roles']) ? array('user') : array('none')); $valueOptions = array(); foreach ($publicRoles as $role) { $valueOptions[$role] = $translator->translate($role); } $select = new Select('role'); $select->setValueOptions($valueOptions); return $select; }
/** * @param null|string $name */ public function __construct($serviceLocator) { parent::__construct($serviceLocator); $filter = $this->getInputFilter(); $username = new Text('username'); $username->setAttributes(['placeholder' => 'Tên nhân viên']); $filter->add(array('name' => 'username', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $this->add($username); $role = new Select('role'); $role->setValueOptions(['' => '- Nhóm -', User::ROLE_MENTOR => 'Mentor', User::ROLE_CALLCENTER => 'Callcenter']); $filter->add(array('name' => 'role', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $this->add($role); $this->add(array('name' => 'submit', 'options' => array(), 'attributes' => array('type' => 'submit', 'value' => 'Lọc', 'id' => 'btnFilterCrmContact', 'class' => 'btn btn-primary'))); }
/** * createService * * Create the dynamic select form drop-down element. * * @param ServiceLocatorInterface $formElementManager The form element manager. * * @return Select */ public function createService(ServiceLocatorInterface $formElementManager) { /** @var ServiceManager $serviceManager */ $serviceManager = $formElementManager->getServiceLocator(); /** @var UserStatusService $service */ $service = $serviceManager->get('EntityServiceManager')->get(UserStatusService::class); $options = []; foreach ($service->search() as $status) { $options[$status->getId()] = $status->getName(); } $element = new Select('status'); $element->setValueOptions($options); return $element; }
public function __construct(EntityManager $em, $name = null, $options = array()) { $this->em = $em; parent::__construct('StateForm'); $this->setAttribute('method', 'post'); $this->setAttribute('enctype', 'multipart/form-data'); $this->setAttribute('class', 'form-horizontal'); $country = new Element\Select('cntryId'); $country->setLabel('Country name'); $country->setValueOptions($this->getOptionCountry()); $country->setAttribute("class", "dropDnInput"); $this->add($country); $this->add(array('name' => 'stname', 'attributes' => array('type' => 'text', 'placeholder' => 'State name', 'class' => 'commonDropDnInput'))); $cntrydescription = new Element\Textarea('statedescription'); $cntrydescription->setLabel('State Description'); $cntrydescription->setAttribute("class", "selectAreaInput"); $cntrydescription->setAttribute("rows", "4"); $cntrydescription->setAttribute("cols", "50"); $this->add($cntrydescription); $cntryspecialInstructions = new Element\Textarea('statespecialInstructions'); $cntryspecialInstructions->setLabel('State Special Instruction Description'); $cntryspecialInstructions->setAttribute("class", "selectAreaInput"); $cntryspecialInstructions->setAttribute("rows", "4"); $cntryspecialInstructions->setAttribute("cols", "50"); $this->add($cntryspecialInstructions); $cntrybestSeasonToVisit = new Element\Textarea('statebestSeasonToVisit'); $cntrybestSeasonToVisit->setLabel('State Best Season to visit'); $cntrybestSeasonToVisit->setAttribute("class", "selectAreaInput"); $cntrybestSeasonToVisit->setAttribute("rows", "4"); $cntrybestSeasonToVisit->setAttribute("cols", "50"); $this->add($cntrybestSeasonToVisit); $this->add(array('name' => 'latitude', 'attributes' => array('type' => 'text', 'placeholder' => 'State Lattitude', 'class' => 'commonDropDnInput'))); $this->add(array('name' => 'longitude', 'attributes' => array('type' => 'text', 'placeholder' => 'State Longitude', 'class' => 'commonDropDnInput'))); $this->add(array('name' => 'statePhoto', 'attributes' => array('type' => 'file', 'allowEmpty' => False), 'options' => array('label' => 'File Upload'))); // // File Input $this->add(array('name' => 'save', 'attributes' => array('type' => 'submit', 'value' => 'Submit', 'class' => "btn-blue"))); // $this->add(array( // 'name' => 'cancel', // 'attributes' => array( // 'type' => 'cancel', // 'value' => 'Cancel', // 'class' => 'btn btn-primary', // ), // 'options' => array( // 'label' => 'Cancel' // ), // )); }
/** * @param Player[] $players */ public function __construct($players) { parent::__construct('PlayerToTournament'); $select = new Select('player'); $options = array(); foreach ($players as $player) { $options[$player->getId()] = $player->getName(); } $select->setValueOptions($options); $this->add($select); $submit = new Element('submit'); $submit->setValue('Hinzufügen'); $submit->setAttributes(array('type' => 'submit')); $this->add($submit); }
public function init() { $uom = new Select('uom'); $uom->setAttribute('id', 'uom'); $uom->setAttribute('title', $this->translator->translate('web.form.article.uom.title')); $uom->setAttribute('class', 'form-control'); $uom->setEmptyOption($this->translator->translate('web.form.article.uom.emptyOption')); $uom->setValueOptions($this->getUomValues()); $uom->setLabel($this->translator->translate('web.form.article.uom.label')); $this->add($uom); $name = new Text('name'); $name->setAttribute('id', 'name'); $name->setAttribute('title', $this->translator->translate('web.form.article.name.title')); $name->setAttribute('class', 'form-control'); $name->setAttribute('placeholder', $this->translator->translate('web.form.article.name.placeholder')); $name->setLabel($this->translator->translate('web.form.article.name.label')); $this->add($name); $code = new Text('code'); $code->setAttribute('id', 'code'); $code->setAttribute('title', $this->translator->translate('web.form.article.code.title')); $code->setAttribute('class', 'form-control'); $code->setAttribute('placeholder', $this->translator->translate('web.form.article.code.placeholder')); $code->setLabel($this->translator->translate('web.form.article.code.label')); $this->add($code); $salesPrice = new Text('salesPrice'); $salesPrice->setAttribute('id', 'salesPrice'); $salesPrice->setAttribute('class', 'form-control'); $salesPrice->setAttribute('title', $this->translator->translate('web.form.article.salesPrice.title')); $salesPrice->setAttribute('placeholder', $this->translator->translate('web.form.article.salesPrice.placeholder')); $salesPrice->setLabel($this->translator->translate('web.form.article.salesPrice.label')); $this->add($salesPrice); $qty = new Text('qty'); $qty->setAttribute('id', 'qty'); $qty->setAttribute('class', 'form-control'); $qty->setAttribute('title', $this->translator->translate('web.form.article.qty.title')); $qty->setAttribute('placeholder', $this->translator->translate('web.form.article.qty.placeholder')); $qty->setLabel($this->translator->translate('web.form.article.qty.label')); $this->add($qty); $description = new Text('description'); $description->setAttribute('id', 'description'); $description->setAttribute('title', $this->translator->translate('web.form.article.description.title')); $description->setAttribute('class', 'form-control'); $description->setAttribute('placeholder', $this->translator->translate('web.form.article.description.placeholder')); $description->setLabel($this->translator->translate('web.form.article.description.label')); $this->add($description); return $this; }
public function __construct(EntityManager $em, $name = null, $options = array()) { $this->em = $em; // we want to ignore the name passed parent::__construct('vehiclemodel'); $this->setAttribute('method', 'post'); $this->add(array('name' => 'vehicleModelId', 'attributes' => array('type' => 'hidden'))); $vehicleBrand = new Element\Select('vehicleBrandId'); $vehicleBrand->setAttributes(array('class' => 'dropDnInput')); $vehicleBrand->setEmptyOption("Select Brand"); $vehicleBrand->setValueOptions($this->getOptionsForSelectBrands()); $vehicleBrand->setDisableInArrayValidator(TRUE); $this->add($vehicleBrand); $this->add(array('name' => 'vehicleModelName', 'attributes' => array('type' => 'text', 'class' => 'commonDropDnInput', 'placeholder' => 'Vehicle Model Name'))); $this->add(array('name' => 'status', 'type' => 'Select', 'attributes' => array('class' => 'dropDnInput'), 'options' => array('empty_option' => 'Select Status', 'value_options' => array('0' => 'InActive', '1' => 'Active')))); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'vehiclModeladd', 'id' => 'submitbutton', 'class' => "btn-blue"))); }
public function __invoke() { $html = ""; $auth = $this->sm->get('ZfcRbac\\Service\\AuthorizationService'); $zfcuserauth = $this->sm->get('zfcuser_auth_service'); $objectmanager = $this->sm->get('Doctrine\\ORM\\EntityManager'); if ($zfcuserauth->hasIdentity()) { $criteria = array(); $criteria['organisation'] = $zfcuserauth->getIdentity()->getOrganisation()->getId(); if ($zfcuserauth->getIdentity()->getZone()) { $criteria['zone'] = $zfcuserauth->getIdentity()->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' => $zfcuserauth->getIdentity()->getZone()->getId(), 'current' => true)); if ($auth->isGranted('events.mod-opsup')) { $form = new Form('opsup'); $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')); $html .= $formView->openTag($form); $html .= '<div class="form-group">'; $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" style="margin-left: 0px">' . $currentopsup->getName() . '</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; }
function __construct($task_id, TaskService $taskService, DocumentService $documentService) { parent::__construct('console_queueitems'); $element_task_id = new Element\Hidden('task_id'); $this->add($element_task_id); $element_task_id->setValue($task_id); $element_task_title = new Element\Text('task_title'); $task = $taskService->getTask($task_id); $element_task_title->setValue($task->title); $this->add($element_task_title); $element_document = new Element\Select('document'); $document_titles = $documentService->getDocumentTitles(); $element_document->setValueOptions($document_titles); $this->add($element_document); $element_address_type = new Element\Select('address_type'); $element_address_type->setValueOptions(array(self::ADDRESS_TYPE_ALL => '所有邮件地址', self::ADDRESS_TYPE_NEW => '新的邮件地址')); $this->add($element_address_type); $this->add(array('name' => 'submit', 'type' => 'Submit')); }
public function __invoke($iponumber = null) { $html = ""; $auth = $this->sm->get('ZfcRbac\\Service\\AuthorizationService'); $zfcuserauth = $this->sm->get('zfcuser_auth_service'); $objectmanager = $this->sm->get('Doctrine\\ORM\\EntityManager'); if ($zfcuserauth->hasIdentity()) { $ipos = $objectmanager->getRepository('Application\\Entity\\IPO')->findBy(array('organisation' => $zfcuserauth->getIdentity()->getOrganisation()->getId()), array('name' => 'asc')); $currentipo = $objectmanager->getRepository('Application\\Entity\\IPO')->findOneBy(array('organisation' => $zfcuserauth->getIdentity()->getOrganisation()->getId(), 'current' => true)); if ($auth->isGranted('events.mod-ipo')) { $form = new Form('ipo'); $selectIPO = new Select('nameipo'); $ipoArray = array(); $ipoArray['-1'] = "Choisir IPO"; foreach ($ipos as $ipo) { $ipoArray[$ipo->getId()] = $ipo->getName(); } $selectIPO->setValueOptions($ipoArray); if ($currentipo) { $selectIPO->setAttribute('value', $currentipo->getId()); } $form->add($selectIPO); $formView = $this->view->form(); $form->setAttributes(array('class' => 'navbar-form navbar-left visible-xs-block visible-md-block visible-lg-block')); $html .= $formView->openTag($form); $html .= '<div class="form-group visible-xs-block visible-md-block visible-lg-block">'; $html .= '<label>' . '<span class="glyphicon glyphicon-warning-sign"></span><b> IPO ' . ($iponumber !== null ? $iponumber : '') . ' : </b>'; $html .= $this->view->formSelect($form->get('nameipo')->setAttribute('class', 'form-control')); $html .= '</div>'; $html .= $formView->closeTag(); } else { if ($currentipo) { $html .= '<p class="navbar-text navbar-left visible-xs-block visible-md-block visible-lg-block"><span class="glyphicon glyphicon-warning-sign"></span><b> IPO ' . ($iponumber !== null ? $iponumber : '') . ' : </b><span id="iponame">' . $currentipo->getName() . '</span></p>'; } else { $html .= '<p class="navbar-text navbar-left visible-xs-block visible-md-block visible-lg-block"><span class="glyphicon glyphicon-warning-sign"></span><b> IPO ' . ($iponumber !== null ? $iponumber : '') . ' : </b><em>Aucun IPO configuré</em></p>'; } } } else { $html .= '<p class="navbar-text navbar-left visible-xs-block visible-md-block visible-lg-block"><em>Connexion nécessaire</em></p>'; } return $html; }
public function __invoke() { $serviceManager = $this->getServiceLocator()->getServiceLocator()->get('UthandoServiceManager'); /* @var $menuItemMapper \UthandoNavigation\Service\MenuItem */ $menuItemMapper = $serviceManager->get('UthandoNavigationMenuItem'); $menuItems = $menuItemMapper->fetchAll(); /* @var $menuMapper \UthandoNavigation\Service\Menu */ $menuMapper = $serviceManager->get('UthandoNavigationMenu'); $menus = $menuMapper->fetchAll(); $select = new Element\Select('position'); $menuItemsOptions = []; $menuArray = []; foreach ($menus as $menu) { $menuArray[$menu->getMenuId()] = $menu->getMenu(); $menuItemsOptions[$menu->getMenuId()]['options'][$menu->getMenuId() . '-' . '0'] = 'At top of this menu'; $menuItemsOptions[$menu->getMenuId()]['empty_option'] = '---Please Select a page---'; $menuItemsOptions[$menu->getMenuId()]['label'] = $menu->getMenu(); } /* @var $page \UthandoNavigation\Model\MenuItem */ foreach ($menuItems as $menuItem) { $ident = $menuItem->getDepth() > 0 ? str_repeat('%space%%space%', $menuItem->getDepth()) . '%bull%%space%' : ''; $menuItemsOptions[$menuItem->getMenuId()]['options'][$menuItem->getMenuId() . '-' . $menuItem->getMenuItemId()] = $ident . $menuItem->getLabel(); } $select = new Element\Select('position'); $select->setLabel('Location In Menu:'); $select->setValueOptions($menuItemsOptions); $select->setEmptyOption('Please select a Position'); $select->setAttribute('class', 'form-control'); $element = $this->view->plugin('formElement'); $errors = $this->view->plugin('formElementErrors'); $html = $element($select); $html = str_replace('%space%', ' ', $html); $html = str_replace('%bull%', '•', $html); $html = '<div class="form-group"> <label class="col-sm-4 control-label" for="position">' . $select->getLabel() . '</label> <div class="col-sm-8">' . $html . ' <span class="help-block">' . $errors($select, ["class" => "unstyled"]) . ' </span> </div> </div>'; return $html; }
/** * Init Datatype form * * @return void */ public function init() { $this->setAttribute('class', 'relative form-horizontal'); $this->setAttribute('enctype', 'application/x-www-form-urlencoded'); $name = new Element\Text('name'); $name->setLabel('Name')->setLabelAttributes(array('class' => 'required control-label col-lg-2')); $name->setAttribute('class', 'form-control')->setAttribute('id', 'name'); $this->add($name); $model = new Element\Select('model'); $options = array(); foreach ($this->getServiceLocator()->get('DatatypesList') as $dir) { $options[$dir] = $dir; } $model->setOptions(array('label' => 'Model', 'label_attributes' => array('class' => 'required control-label col-lg-2'))); $model->setValueOptions($options)->setAttribute('class', 'form-control'); $this->add($model); $inputFilterFactory = new InputFilterFactory(); $inputFilter = $inputFilterFactory->createInputFilter(array('name' => array('required' => true, 'validators' => array(array('name' => 'not_empty'), array('name' => 'db\\no_record_exists', 'options' => array('table' => 'datatype', 'field' => 'name', 'adapter' => $this->getAdapter())))), 'model' => array('required' => true, 'validators' => array(array('name' => 'not_empty'))))); $this->setInputFilter($inputFilter); }
/** * @param int $gameCount * @param Player[] $players * @param int $maxGoals * @param PlayerRepository $playerRepository */ public function __construct($playerRepository, $gameCount, $maxGoals, $players) { parent::__construct($playerRepository, $gameCount, $maxGoals); $values = array('' => ''); foreach ($players as $player) { $values[$player->getId()] = $player->getName(); } $team1attack = new SelectElement('teamOneAttack'); $team1attack->setValueOptions($values); $this->add($team1attack); $team1defence = new SelectElement('teamOneDefence'); $team1defence->setValueOptions($values); $this->add($team1defence); $team2attack = new SelectElement('teamTwoAttack'); $team2attack->setValueOptions($values); $this->add($team2attack); $team2defence = new SelectElement('teamTwoDefence'); $team2defence->setValueOptions($values); $this->add($team2defence); }