public function init() { $code = new Text('code'); $code->setAttribute('id', 'code'); $code->setAttribute('required', 'required')->setAttribute('class', 'form-control')->setAttribute('readonly', 'readonly')->setAttribute('placeholder', $this->translator->translate('template.form.code.placeholder'))->setLabel($this->translator->translate('template.form.code.label')); $this->add($code); $name = new Text('name'); $name->setAttribute('id', 'name'); $name->setAttribute('required', 'required')->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('template.form.name.placeholder'))->setLabel($this->translator->translate('template.form.name.label')); $this->add($name); $titleEt = new Text('titleEt'); $titleEt->setAttribute('id', 'titleEt'); $titleEt->setAttribute('required', 'required')->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('template.form.titleEt.placeholder'))->setLabel($this->translator->translate('template.form.titleEt.label')); $this->add($titleEt); $titleEn = new Text('titleEn'); $titleEn->setAttribute('id', 'titleEn'); $titleEn->setAttribute('required', 'required')->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('template.form.titleEn.placeholder'))->setLabel($this->translator->translate('template.form.titleEn.label')); $this->add($titleEn); $contentEt = new Textarea('contentEt'); $contentEt->setAttribute('id', 'contentEt'); $contentEt->setAttribute('required', 'required')->setAttribute('class', 'editor')->setAttribute('placeholder', $this->translator->translate('template.form.contentEt.placeholder'))->setLabel($this->translator->translate('template.form.contentEt.label')); $contentEt->setAttribute('cols', 15); $contentEt->setAttribute('rows', 4); $this->add($contentEt); $contentEn = new Textarea('contentEn'); $contentEn->setAttribute('id', 'contentEn'); $contentEn->setAttribute('required', 'required')->setAttribute('class', 'editor')->setAttribute('placeholder', $this->translator->translate('template.form.contentEn.placeholder'))->setLabel($this->translator->translate('template.form.contentEn.label')); $contentEn->setAttribute('cols', 15); $contentEn->setAttribute('rows', 4); $this->add($contentEn); return $this; }
public function init() { $username = new Element\Text('username'); $username->setAttribute('class', 'form-control'); $username->setAttribute('placeholder', 'Username'); $username->setAttribute('required', true); $this->add($username); $password = new Element\Text('password'); $password->setAttribute('class', 'form-control'); $password->setAttribute('placeholder', 'Password'); $password->setAttribute('required', true); $this->add($password); $confirmPassword = new Element\Text('confirm_password'); $confirmPassword->setAttribute('class', 'form-control'); $confirmPassword->setAttribute('placeholder', 'Confirm Password'); $confirmPassword->setAttribute('required', true); $this->add($confirmPassword); $email = new Element\Email('email'); $email->setAttribute('class', 'form-control'); $email->setAttribute('placeholder', 'Email'); $email->setAttribute('required', true); $this->add($email); $firstName = new Element\Text('first_name'); $firstName->setAttribute('class', 'form-control'); $firstName->setAttribute('placeholder', 'First Name'); $firstName->setAttribute('required', true); $this->add($firstName); $lastName = new Element\Text('last_name'); $lastName->setAttribute('class', 'form-control'); $lastName->setAttribute('placeholder', 'Last Name'); $lastName->setAttribute('required', true); $this->add($lastName); }
public function addElements() { //-- Profile name -- $login = new Element\Text('profile_name'); $login->setAttribute('placeholder', 'profile_name'); $login->setAttribute('required', 'true'); $login->setAttribute('class', 'form-control'); $login->setAttribute('id', 'profile-name'); $login->setLabel('Profile name'); $login->setLabelAttributes(array('class' => 'control-label', 'for' => 'profile-name')); //-- Password -- $password = new Element\Password('password'); $password->setAttribute('placeholder', '*****'); $password->setAttribute('required', 'true'); $password->setAttribute('class', 'form-control'); $password->setAttribute('id', 'password'); $password->setLabel('Password'); $password->setLabelAttributes(array('class' => 'control-label', 'for' => 'password')); //-- Submit -- $submit = new Element\Submit('submit'); $submit->setAttribute('class', 'btn btn-success'); $submit->setValue('Send'); // Binding elements $this->add($login); $this->add($password); $this->add($submit); }
public function init() { parent::__construct('forgotPassword'); $email = new Text('email'); $email->setAttribute('id', 'email'); $email->setAttribute('required', 'required')->setAttribute('placeholder', $this->translator->translate('forgotPassword.email.placeholder')); $this->add($email); $submit = new Submit('submit'); $submit->setAttribute('class', 'button'); $submit->setValue($this->translator->translate('forgotPassword.submit.value')); $this->add($submit); return $this; }
public function init() { $username = new Element\Text('username'); $username->setAttribute('class', 'form-control'); $username->setAttribute('placeholder', 'Username'); //$username->setAttribute('required', true); $this->add($username); $password = new Element\Password('password'); $password->setAttribute('class', 'form-control'); $password->setAttribute('placeholder', 'Password'); //$password->setAttribute('required', true); $this->add($password); }
public function __construct() { parent::__construct('search'); $this->setAttribute('class', 'pull-left'); $this->setAttribute('method', 'GET'); $q = new Element\Text('q'); $q->setAttribute('placeholder', 'Search...'); $q->setAttribute('required', true); $this->add($q); $submit = new Element\Submit('submit'); $submit->setAttribute('class', 'btn-primary pull-right'); $submit->setOption('glyphicon', 'search'); $submit->setLabel('Search'); $this->add($submit); }
/** * Load textstring editor * * @return Element\Text */ public function load() { $parameters = $this->getConfig(); $property = $this->getProperty(); $textstring = new Element\Text($this->getName()); $textstring->setAttribute('class', 'form-control'); $textstring->setLabel($property->getName()); $textstring->setAttribute('id', $this->getName()); $textstring->setValue($this->getValue()); $textstring->setAttribute('required', $property->isRequired()); if (!empty($parameters['length'])) { $textstring->setAttribute('maxlength', $parameters['length']); } return $textstring; }
public function init() { $name = new Text('name'); $name->setAttribute('id', 'name'); $name->setAttribute('required', 'required')->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.name.placeholder'))->setLabel($this->translator->translate('company.form.name.label')); $this->add($name); $regNo = new Text('regNo'); $regNo->setAttribute('id', 'regNo'); $regNo->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.regNo.placeholder'))->setLabel($this->translator->translate('company.form.regNo.label')); $this->add($regNo); $kmkrNo = new Text('kmkrNo'); $kmkrNo->setAttribute('id', 'kmkrNo'); $kmkrNo->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.kmkrNo.placeholder'))->setLabel($this->translator->translate('company.form.kmkrNo.label')); $this->add($kmkrNo); $address = new Text('address'); $address->setAttribute('id', 'address'); $address->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.address.placeholder'))->setLabel($this->translator->translate('company.form.address.label')); $this->add($address); $zip = new Text('zip'); $zip->setAttribute('id', 'zip'); $zip->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.zip.placeholder'))->setLabel($this->translator->translate('company.form.zip.label')); $this->add($zip); $country = new Text('country'); $country->setAttribute('id', 'country'); $country->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.country.placeholder'))->setLabel($this->translator->translate('company.form.country.label')); $this->add($country); $city = new Text('city'); $city->setAttribute('id', 'city'); $city->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.city.placeholder'))->setLabel($this->translator->translate('company.form.city.label')); $this->add($city); $url = new Text('url'); $url->setAttribute('id', 'url'); $url->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.url.placeholder'))->setLabel($this->translator->translate('company.form.url.label')); $this->add($url); $phone = new Text('phone'); $phone->setAttribute('id', 'phone'); $phone->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.phone.placeholder'))->setLabel($this->translator->translate('company.form.phone.label')); $this->add($phone); $email = new Text('email'); $email->setAttribute('id', 'email'); $email->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.email.placeholder'))->setLabel($this->translator->translate('company.form.email.label')); $this->add($email); $mob = new Text('mob'); $mob->setAttribute('id', 'mob'); $mob->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.mob.placeholder'))->setLabel($this->translator->translate('company.form.mob.label')); $this->add($mob); return $this; }
private function addStep($index) { $stepIdElement = new Hidden('StepId' . $index); $stepIdElement->setValue($index); $this->add($stepIdElement); $quantityElement = new Text('StepQuantityValue' . $index); $quantityElement->setLabel('Menge'); $quantityElement->setAttribute('id', 'StepQuantityValue' . $index); $this->add($quantityElement); $units = $this->selectAllFrom('Units', 'Name'); $unitElement = new Select('StepUnit' . $index); $unitElement->setValueOptions($units); // need to set default value. otherwise null is saved. $unitElement->setValue(0); $unitElement->setAttribute('id', 'StepUnit' . $index); $this->add($unitElement); $ingredients = $this->selectAllFrom('Ingredients', 'Name'); $ingredientElement = new Select('StepIngredient' . $index); $ingredientElement->setValueOptions($ingredients); //just set any default value. inserting ingredients has to be workes out anyway $ingredientElement->setValue(0); $ingredientElement->setAttribute('id', 'StepIngredient' . $index); $this->add($ingredientElement); $textElement = new Textarea('StepText' . $index); $textElement->setAttribute('id', 'StepText' . $index); $this->add($textElement); }
/** * Add title element */ public function addTitleElement($name = 'title') { $element = new Text($name); $element->setLabel('Überschrift'); $element->setAttribute('class', 'span5'); $this->add($element); }
/** * Add name element */ public function addToElement($to = 'to') { $element = new Text($to); $element->setLabel('bis'); $element->setAttribute('class', 'datepicker form-control'); $this->add($element); }
/** * Add lastname element */ public function addLastnameElement($name = 'lastname') { $element = new Text($name); $element->setLabel('Nachname'); $element->setAttribute('class', 'form-control input-small'); $this->add($element); }
/** * @outputBuffering disabled */ public function testCanRenderFieldsets() { $this->expectOutputRegex('/<form(.*)<fieldset(.*)<\\/fieldset>(.*)<fieldset(.*)<\\/fieldset>(.*)<\\/form>/'); $form = new NetsensiaForm(); $form->addHidden('test1', 'testvalue'); $hidden = new Element\Hidden('asdasd'); $hidden->setValue('123'); $form->add($hidden); $element1 = new Text('testelement1'); $element1->setLabel('Test Element'); $element1->setAttribute('icon', 'pencil'); $element2 = new Text('testelement2'); $element2->setLabel('Test Element 2'); $element2->setAttribute('icon', 'pencil'); $fieldset1 = new Fieldset('testfieldset1'); $fieldset1->add($element1); $fieldset2 = new Fieldset('testfieldset2'); $fieldset2->add($element2); $form->add($fieldset1); $form->add($fieldset2); $helpers = new HelperPluginManager(); $helpers->setService('formElement', new FormElement()); $view = new PhpRenderer(); $view->setHelperPluginManager($helpers); $viewHelper = new BootstrapForm(); $viewHelper->setView($view); $viewHelper($form, 'testform', '/'); }
public function init() { $code = new Text('code'); $code->setAttribute('id', 'code'); $code->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('vatUom.form.code.placeholder'))->setLabel($this->translator->translate('vatUom.form.code.label')); $this->add($code); $value = new Text('value'); $value->setAttribute('id', 'value'); $value->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('vatUom.form.value.placeholder'))->setLabel($this->translator->translate('vatUom.form.value.label')); $this->add($value); $comment = new Text('comment'); $comment->setAttribute('id', 'comment'); $comment->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('vatUom.form.comment.placeholder'))->setLabel($this->translator->translate('vatUom.form.comment.label')); $this->add($comment); return $this; }
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'))); }
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); }
public function addElements() { $search = new Element\Text('search'); $search->setLabel('search'); $search->setAttribute('id', 'search'); $this->add($search); }
/** * Init Module form * * @return void */ public function init() { $showEmail = new Element\Checkbox('show_email'); $showEmail->setLabel('Show email'); $showEmail->setAttribute('required', 'required')->setAttribute('id', 'show-email'); $username = new Element\Text('username'); $username->setLabel('Username'); $username->setAttribute('required', 'required')->setAttribute('id', 'username'); $email = new Element\Text('email'); $email->setLabel('Email'); $email->setAttribute('required', 'required')->setAttribute('id', 'email'); $message = new Element\Textarea('message'); $message->setLabel('Message'); $message->setAttribute('required', 'required')->setAttribute('id', 'message'); $captchaImage = new CaptchaImage(array('font' => GC_PUBLIC_PATH . '/backend/fonts/arial.ttf', 'width' => 250, 'height' => 50, 'dotNoiseLevel' => 40, 'lineNoiseLevel' => 3)); $captchaImage->setImgDir(GC_PUBLIC_PATH . '/frontend/tmp'); $captchaImage->setImgUrl('/frontend/tmp'); $captcha = new Element\Captcha('captcha'); $captcha->setLabel('Please verify you are human')->setCaptcha($captchaImage)->setAttribute('required', 'required')->setAttribute('id', 'captcha'); $this->add($showEmail); $this->add($username); $this->add($email); $this->add($message); $this->add($captcha); $inputFilterFactory = new InputFilterFactory(); $inputFilter = $inputFilterFactory->createInputFilter(array('show_email' => array('name' => 'show_email', 'required' => false), 'username' => array('name' => 'username', 'required' => true), 'email' => array('name' => 'email', 'required' => true, 'validators' => array(array('name' => 'email_address'))), 'message' => array('name' => 'message', 'required' => true), 'captcha' => $captcha->getInputSpecification())); $this->setInputFilter($inputFilter); }
public function __construct() { parent::__construct('UserLogin'); $username = new TextElement('username'); $username->setAttribute('placeholder', 'Username'); $password = new PasswordElement('password'); $password->setAttribute('placeholder', 'Password'); $submit = new SubmitElement('submit', array('label' => 'Login')); $this->add($username)->add($password)->add($submit); }
public function init() { parent::init(); $delayPercent = new Text('delayPercent'); $delayPercent->setAttribute('id', 'delayPercent'); $delayPercent->setAttribute('title', $this->translator->translate('web.form.customer.delayPercent.title')); $delayPercent->setAttribute('class', 'form-control'); $delayPercent->setAttribute('placeholder', $this->translator->translate('web.form.customer.delayPercent.placeholder')); $delayPercent->setLabel($this->translator->translate('web.form.customer.delayPercent.label')); $this->add($delayPercent); $deadlineDays = new Text('deadlineDays'); $deadlineDays->setAttribute('id', 'deadlineDays'); $deadlineDays->setAttribute('title', $this->translator->translate('web.form.customer.deadlineDays.title')); $deadlineDays->setAttribute('class', 'form-control'); $deadlineDays->setAttribute('placeholder', $this->translator->translate('web.form.customer.deadlineDays.placeholder')); $deadlineDays->setLabel($this->translator->translate('web.form.customer.deadlineDays.label')); $this->add($deadlineDays); return $this; }
public function __construct() { parent::__construct(); $this->setAttribute('method', 'post'); $this->setAttribute('class', 'panel-body'); $username = new Text('username'); $username->setLabel('username'); $username->setAttribute('class', 'form-control'); $username->setAttribute('data-urr', '/isusernameinuse'); $this->add($username); $mail = new Email('email'); $mail->setLabel('email'); $mail->setAttribute('class', 'form-control'); $this->add($mail); $password = new Password('password'); $password->setLabel('password'); $password->setAttribute('class', 'form-control'); $this->add($password); $password2 = new Password('password2'); $password2->setLabel('repeat.password'); $password2->setAttribute('class', 'form-control'); $this->add($password2); $captcha = new Captcha('registerCaptcha'); $imageAdapter = new Image(['font' => __DIR__ . '/../../fonts/arial.ttf']); $imageAdapter->setHeight(100); $imageAdapter->setWidth(400); $imageAdapter->setFontSize(48); $imageAdapter->setDotNoiseLevel(400); $imageAdapter->setLineNoiseLevel(40); $captcha->setCaptcha($imageAdapter); $captcha->setLabel('enter.text.from.the.picture'); $captcha->setAttribute('class', 'form-control'); $this->add($captcha); $agb = new Checkbox('gtcAccept'); $agb->setLabel('accept.terms.of.gtc'); $agb->setAttribute('class', 'form-control'); $agb->setLabelAttributes(['class' => 'checkboxLabel']); $this->add($agb); $submit = new Submit('register'); $submit->setValue('register'); $submit->setAttribute('class', 'btn btn-primary'); $this->add($submit); }
public function setId() { $username = new Element\Text('username'); $username->setLabel('User name'); $username->setAttribute('id', 'username'); $this->add($username); $password = new Element\Password('Password'); $password->setLabel('Password'); $password->setAttribute('id', 'password'); $this->add($password); }
public function addElements() { $file = new Element\File('file'); $file->setLabel("Import ")->setAttributes(array('id' => 'file', 'multiple' => false)); $name = new Element\Text('name'); $name->setLabel('Fichier'); $name->setAttribute('placeholder', 'Titre'); $name->setAttribute('class', 'input-medium'); $ref = new Element\Text('reference'); $ref->setLabel("Référence "); $ref->setAttribute('placeholder', 'Ref. (facultatif)'); $ref->setAttribute('class', 'input-medium'); $url = new Element\Text('url'); $url->setLabel('Url '); $url->setAttribute('placeholder', 'Url'); $url->setAttribute('class', 'input-large'); $this->add($url); $this->add($ref); $this->add($name); $this->add($file); }
public function form(PhpRenderer $view, SiteRepresentation $site, SitePageBlockRepresentation $block = null) { $text = new Text("o:block[__blockIndex__][o:data][query]"); if ($block) { $text->setAttribute('value', $this->getData($block->data(), 'query')); } $html = '<div class="field"><div class="field-meta">'; $html .= '<label>' . $view->translate('Query') . '</label>'; $html .= '<div class="field-description">' . $view->translate('Display resources using this search query') . '</div>'; $html .= '</div>'; $html .= '<div class="inputs">' . $view->formRow($text) . '</div></div>'; return $html; }
public function addElements() { //-- Profile name -- $keyA = new Element\Text('activation_key'); $keyA->setAttribute('placeholder', md5('Example')); //$keyA->setAttribute('required', 'true'); $keyA->setAttribute('class', 'form-control'); $keyA->setAttribute('id', 'activation-key'); $keyA->setLabel('Activation key'); $keyA->setLabelAttributes(array('class' => 'control-label', 'for' => 'activation-key')); //-- Submit -- $submit = new Element\Submit('submit'); $submit->setAttribute('class', 'btn btn-success'); $submit->setValue('Send'); //-- Submit -- $submit_email = new Element\Submit('submit_email'); $submit_email->setAttribute('class', 'btn btn-info'); $submit_email->setValue('Send Email'); // Binding elements $this->add($keyA); $this->add($submit); $this->add($submit_email); }
public function __construct(array $roles) { parent::__construct(); $this->setAttribute('method', 'post'); $this->setAttribute('class', 'panel-body'); $username = new Text('username'); $username->setLabel('username'); $username->setAttribute('class', 'form-control'); $username->setAttribute('data-urr', '/isusernameinuse'); $this->add($username); $mail = new Email('email'); $mail->setLabel('email'); $mail->setAttribute('class', 'form-control'); $this->add($mail); $role = new Select('role'); $role->setLabel('role'); $role->setAttribute('class', 'form-control'); $role->setValueOptions($roles); $this->add($role); $submit = new Submit('save'); $submit->setValue('save'); $submit->setAttribute('class', 'btn btn-primary'); $this->add($submit); }
public function init() { $title = new Element\Text('title'); $title->setLabel('Title'); $title->setAttribute('class', 'form-control'); $this->add($title); $artist = new Element\Text('artist'); $artist->setLabel('Artist'); $artist->setAttribute('class', 'form-control'); $this->add($artist); $submit = new Element\Submit('submit'); $submit->setAttribute('class', 'btn btn-info'); $submit->setValue('Create'); $this->add($submit); }
public function __construct($name = null) { parent::__construct('create-cliente'); //nome $nome = new Text(); $nome->setName("name"); $nome->setAttribute('placeholder', 'Nome'); $nome->setAttribute('class', 'form-control'); $this->add($nome); //cognome $cognome = new Text(); $cognome->setName("cognome"); $cognome->setAttribute('placeholder', 'Cognome'); $cognome->setAttribute('class', 'form-control'); $this->add($cognome); //email $email = new Text(); $email->setName("email"); $email->setAttribute('placeholder', 'email'); $email->setAttribute('class', 'form-control'); $this->add($email); // numero di telefono $num = new Text(); $num->setName("num"); $num->setAttribute('placeholder', 'Numero di telefono'); $num->setAttribute('class', 'form-control'); $this->add($num); //bottone $btn = new Submit(); $btn->setName("submit"); $btn->setAttribute('value', 'go'); $btn->setAttribute('id', 'submitbutton'); $btn->setAttribute('class', 'btn btn-primary'); $this->add($btn); $this->setInputFilter($this->createInputFilter()); }
public function __construct($name = null) { // we want to ignore the name passed parent::__construct('user'); $this->setAttribute('method', 'post'); $this->setLabel('Información general'); //////////// INICIALIZACION ELEMENTOS ///////////////////////// $password = new Element\Password('PASSWORD'); $password->setLabel('Password: '******'size' => '30', 'class' => 'required c_password')); $repeat_password = new Element\Password('REPEAT_PASSWORD'); $repeat_password->setLabel('Repetir password: '******'size' => '30', 'class' => 'required')); $selectTipo = new Element\Text('TIPO'); $selectTipo->setLabel('Tipo de usuario: '); $selectTipo->setAttribute('class', 'selectTipo'); /*$selectTipo->setValueOptions(array( 'ADMIN' => 'Administrador', 'DUENO_LOCAL' => 'Dueño Local', 'SPONSOR_LOCAL' => 'Sponsor Local', ));*/ $this->add(array('name' => 'UID', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'NOMBRE', 'attributes' => array('class' => 'required', 'type' => 'text'), 'options' => array('label' => 'Nombre: '))); $this->add(array('name' => 'APELLIDO', 'attributes' => array('class' => 'required', 'type' => 'text'), 'options' => array('label' => 'Apellido: '))); $this->add(array('name' => 'USER_NAME', 'attributes' => array('class' => 'required', 'type' => 'text'), 'options' => array('label' => 'Nickname: '))); $this->add(array('name' => 'EMAIL', 'attributes' => array('class' => 'required', 'type' => 'Zend\\Form\\Element\\Email'), 'options' => array('label' => 'Email: '))); /*$this->add(array( 'name' => 'PASSWORD', 'attributes' => array( 'type' => 'text', ), 'options' => array( 'label' => 'Password', ), ));*/ $this->add($password); $this->add($repeat_password); $this->add($selectTipo); /*$this->add(array( 'name' => 'TIPO', 'attributes' => array( 'type' => 'select', ), 'options' => array( 'label' => 'Tipo de usuario', ), ));*/ $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Go', 'id' => 'submitbutton', 'class' => 'btn btn-primary'))); }
public function inAction() { //check for the existence of any users, and if none, it means it is a new installation, then redirect to user registration $entityManager = $this->getServiceLocator()->get('entity-manager'); $countAdministrators = $entityManager->getRepository(get_class(new User()))->countAdminUsers(); if (!$countAdministrators) { $this->flashMessenger()->addInfoMessage('Here you can create the first user for the system'); return $this->redir()->toRoute('admin/default', ['controller' => 'log', 'action' => 'initial']); } $uname = new Element\Text('uname'); $uname->setLabel('User name'); $uname->setAttribute('required', 'required'); $password = new Element\Password('password'); $password->setLabel('Password'); $password->setAttribute('required', 'required'); $form = new Form('login'); $form->add($uname)->add($password); $unameInput = new Input('uname'); $unameInput->getFilterChain()->attachByName('StringTrim'); $passwordInput = new Input('password'); $inputFilter = new InputFilter(); $inputFilter->add($unameInput)->add($passwordInput); $form->setInputFilter($inputFilter); $request = $this->getRequest(); if ($request->isPost()) { $form->setData($request->getPost()); if ($form->isValid()) { $uname = $form->get('uname')->getValue(); $password = $form->get('password')->getValue(); $auth = $this->getServiceLocator()->get('auth'); $authAdapter = $auth->getAdapter(); $authAdapter->setIdentity($uname); $authAdapter->setCredential($password); $result = $auth->authenticate(); $user = $result->getIdentity(); if ($result->isValid()) { $this->flashMessenger()->addSuccessMessage(sprintf($this->translator->translate("Welcome %s. You have been logged in successfully"), $user->getUname())); return $this->redir()->toRoute('admin/default', array('controller' => 'index')); } else { $this->flashMessenger()->addErrorMessage($this->translator->translate('Wrong details')); $this->redir()->toRoute('admin/default', array('controller' => 'log', 'action' => 'in')); } } } return array('form' => $form); }