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 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;
 }
 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;
 }
Beispiel #4
0
 public function __construct($name = null, array $departamentos = null)
 {
     parent::__construct('usuario');
     $this->departamentos = $departamentos;
     $this->setAttribute('method', 'post');
     $this->setInputFilter(new UsuarioFilter());
     $this->setAttribute('enctype', 'multipart/form-data');
     $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden')));
     $this->add(array('name' => 'matricula', 'options' => array('type' => 'text'), 'attributes' => array('id' => 'matricula', 'placeholder' => 'Número da matricula', 'class' => 'form-control input-lg')));
     $this->add(array('name' => 'admissao', 'options' => array('type' => 'text'), 'attributes' => array('id' => 'admissao', 'placeholder' => 'Data de Admissao', 'class' => 'form-control input-lg')));
     $this->add(array('name' => 'nome', 'options' => array('type' => 'text'), 'attributes' => array('id' => 'nome', 'placeholder' => 'Nome', 'class' => 'form-control input-lg')));
     $departamento = new Select();
     $departamento->setName('departamento')->setOptions(array('empty_option' => 'Departamento do usuario', 'value_options' => $this->departamentos))->setAttributes(array('class' => 'form-control input-lg'));
     $this->add($departamento);
     $this->add(array('name' => 'foto', 'attributes' => array('type' => 'file', 'id' => 'foto')));
     $this->add(array('name' => 'dataNascimento', 'options' => array('type' => 'text'), 'attributes' => array('id' => 'dataNascimento', 'placeholder' => 'Data de Nascimento', 'class' => 'form-control input-lg')));
     $this->add(array('name' => 'email', 'options' => array('type' => 'email'), 'attributes' => array('id' => 'email', 'placeholder' => 'E-mail', 'class' => 'form-control input-lg')));
     $this->add(array('name' => 'password', 'options' => array('type' => 'Password'), 'attributes' => array('id' => 'password', 'placeholder' => 'Senha', 'class' => 'form-control input-lg', 'type' => 'password')));
     $status = new Select();
     $status->setName('status')->setOptions(array('empty_option' => 'Tipo de Usuario', 'value_options' => array('0' => 'Administrador', '1' => 'Colaborador', '2' => 'Visitante')))->setAttributes(array('class' => 'form-control input-lg'));
     $this->add($status);
     /*$ativo = new \Zend\Form\Element\Checkbox("ativo");
       $ativo->setLabel("Desativar?: ");
       $ativo->setCheckedValue("0");
       $this->add($ativo);*/
     $this->add(array('type' => 'Zend\\Form\\Element\\Checkbox', 'name' => 'ativo', 'options' => array('label' => 'Desativar?:', 'use_hidden_element' => true, 'checked_value' => 0, 'unchecked_value' => 1)));
     $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn btn-primary')));
 }
 public function getForm(array $staff)
 {
     if (!$this->form) {
         $attendanceId = new Element\Hidden();
         $attendanceId->setName('attendanceId');
         $staffId = new Element\Select();
         $staffId->setName('staffId')->setLabel('Staff')->setAttribute('class', 'form-control')->setEmptyOption('-- Choose --')->setValueOptions($staff);
         $type = new Element\Select();
         $type->setName('type')->setLabel('Type')->setAttribute('class', 'form-control')->setValueOptions(array('I' => 'In', 'O' => 'Out'));
         $date = new Element\Date();
         $date->setName('attendanceDate')->setLabel('Date')->setAttributes(array('class' => 'form-control', 'allowPastDates' => true, 'momentConfig' => array('format' => 'YYYY-MM-DD')));
         $workingHours = array();
         for ($i = 8; $i < 20; $i++) {
             $workingHours[$i] = sprintf('%02d', $i);
         }
         $hour = new Element\Select();
         $hour->setName('hour')->setAttribute('class', 'form-control')->setValueOptions($workingHours);
         $workingMinutes = array();
         for ($i = 0; $i < 12; $i++) {
             $workingMinutes[$i] = sprintf('%02d', $i * 5);
         }
         $minute = new Element\Select();
         $minute->setName('minute')->setAttribute('class', 'form-control')->setValueOptions($workingMinutes);
         $form = new Form();
         $form->setAttributes(array('role' => 'form', 'class' => 'form-horizontal'));
         $form->add($attendanceId);
         $form->add($staffId);
         $form->add($type);
         $form->add($date);
         $form->add($hour);
         $form->add($minute);
         $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;
 }
    /**
     * Prepare the form element (mostly used for rendering purposes)
     *
     * @param  FormInterface $form
     * @return mixed
     */
    public function prepareElement(FormInterface $form)
    {
        parent::prepareElement($form);

        $name = $this->getName();
        $this->dayElement->setName($name . '[day]');
    }
Beispiel #8
0
 /**
  * Prepare the form element (mostly used for rendering purposes)
  *
  * @param  FormInterface $form
  * @return mixed
  */
 public function prepareElement(FormInterface $form)
 {
     parent::prepareElement($form);
     $name = $this->getName();
     $this->hourElement->setName($name . '[hour]');
     $this->minuteElement->setName($name . '[minute]');
     $this->secondElement->setName($name . '[second]');
 }
 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 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;
 }
Beispiel #11
0
 public function __construct($name = null, array $categorias)
 {
     parent::__construct('livro');
     $this->categorias = $categorias;
     $this->setAttribute('method', 'post');
     //		$this->setInputFilter(new LivroFilter());
     $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden')));
     $this->add(array('name' => 'nome', 'options' => array('type' => 'text', 'label' => 'Nome:'), 'attributes' => array('id' => 'nome', 'placeholder' => 'Entre com a categoria')));
     $categoria = new Select();
     $categoria->setName('categoria')->setLabel('Categoria')->setOptions(array('value_options' => $this->categorias));
     $this->add($categoria);
     $this->add(array('name' => 'autor', 'options' => array('type' => 'text', 'label' => 'Autor'), 'attributes' => array('id' => 'autor', 'placeholder' => 'Informe o nome do autor')));
     $this->add(array('name' => 'isbn', 'options' => array('type' => 'text', 'label' => 'ISBN'), 'attributes' => array('id' => 'isbn', 'placeholder' => 'Entre com o código ISBN')));
     $this->add(array('name' => 'valor', 'options' => array('type' => 'text', 'label' => 'Valor'), 'attributes' => array('id' => 'valor', 'placeholder' => 'Entre com o valor')));
     $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn-success')));
 }
 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 addElements()
 {
     $this->setAttributes(array('method' => 'post', 'class' => 'form-horizontal', 'action' => '/admin/users/save'));
     $usrId = new Element\Hidden('usr_id');
     $name = new Element\Text('name');
     $name->setName('name')->setAttribute('placeholder', 'Nome do usuário')->setLabel('Nome do usuário')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
     $username = new Element\Text('username');
     $username->setName('username')->setAttributes(array('id' => 'username', 'placeholder' => 'Usuário'))->setLabel('Usuário')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
     $password = new Element\Password('password');
     $password->setName('password')->setAttributes(array('id' => 'password', 'placeholder' => 'Senha'))->setLabel('Senha')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
     $role = new Element\Select('role');
     $role->setName('role')->setLabel('Perfil de usuário')->setLabelAttributes(array('class' => 'col-sm-2 control-label'))->setValueOptions(array('' => 'Escolha um perfil', 'admin' => 'Administrador', 'redator' => 'Redator'));
     $valid = new Element\Checkbox('valid');
     $valid->setName('valid')->setLabel('Ativar usuário')->setLabelAttributes(array('class' => 'lbl'));
     $submit = new Element\Submit('submit');
     $submit->setAttribute('value', 'Salvar')->setAttribute('class', 'btn btn-primary');
     $this->add($usrId)->add($name)->add($username)->add($password)->add($role)->add($valid)->add($submit);
 }
 public function addElements()
 {
     $id = new Element\Hidden('id');
     $postsId = new Element\Select('postsId');
     $description = new Element\Text('description');
     $name = new Element\Text('name');
     $email = new Element\Email('email');
     $webpage = new Element\Text('webpage');
     $commentDate = new Element\Hidden('commentDate');
     $submit = new Element\Submit('submit');
     $description->setName('description')->setAttribute('placeholder', 'Digite o seu comentário')->setLabel('Comentário')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
     $postsId->setName('postsId')->setLabel('Post')->setLabelAttributes(array('class' => 'col-sm-2 control-label'))->setEmptyOption('Escolha um post');
     $name->setName('name')->setAttribute('placeholder', 'Nome')->setLabel('Nome')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
     $email->setName('email')->setAttribute('placeholder', 'E-mail')->setLabel('E-mail')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
     $webpage->setName('webpage')->setAttribute('placeholder', 'Web page')->setLabel('Web page')->setLabelAttributes(array('class' => 'col-sm-2 control-label'));
     $submit->setAttribute('value', 'Salvar')->setAttribute('class', 'btn btn-info');
     $this->add($id)->add($postsId)->add($description)->add($name)->add($email)->add($commentDate)->add($webpage)->add($submit);
 }
 public function getForm(array $formulaList)
 {
     if (!$this->form) {
         $fromDate = new Element\Date('fromDate');
         $fromDate->setAttributes(array('allowPastDates' => true, 'style' => 'width:120px;', 'momentConfig' => array('format' => 'YYYY-MM-DD')));
         $fromDate->setValue(date('Y-m-26', strtotime('-1 month')));
         $toDate = new Element\Date('toDate');
         $toDate->setAttributes(array('allowPastDates' => true, 'style' => 'width:120px;margin-left:5px;', 'momentConfig' => array('format' => 'YYYY-MM-DD')));
         $toDate->setValue(date('Y-m-25', time('')));
         $formula = new Element\Select();
         $formula->setName('formula')->setAttribute('class', 'form-control')->setAttribute('style', 'width:200px')->setValueOptions($formulaList)->setEmptyOption('-- Choose Formula --');
         $form = new Form();
         $form->setAttributes(array('class' => 'form-inline', 'role' => 'form', 'id' => 'process-form'));
         $form->add($fromDate);
         $form->add($toDate);
         $form->add($formula);
         $this->form = $form;
     }
     return $this->form;
 }
 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 getForm(array $holidayType)
 {
     if (!$this->form) {
         $hidId = new Hidden();
         $hidId->setName('calendarId');
         $cboType = new Select();
         $cboType->setName('type')->setLabel('Type')->setAttribute('class', 'form-control')->setEmptyOption('-- Choose Types --')->setValueOptions($holidayType);
         $maxYear = date('Y', time()) + 10;
         $datePicker = new DateSelect('date');
         $datePicker->setValue(new \DateTime('now'))->setShouldRenderDelimiters(false)->setMinYear(2011)->setMaxYear($maxYear)->setLabel('Date')->setDayAttributes(array('class' => 'date-control', 'id' => 'dayCombo'))->setMonthAttributes(array('class' => 'date-control', 'id' => 'monthCombo'))->setYearAttributes(array('class' => 'date-control', 'id' => 'yearCombo'));
         $txtTitle = new Text();
         $txtTitle->setName('title')->setLabel('Title')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'Title');
         $form = new Form();
         $form->setAttributes(array('class' => 'form-horizontal', 'role' => 'form'));
         $form->add($hidId);
         $form->add($cboType);
         $form->add($datePicker);
         $form->add($txtTitle);
         $this->form = $form;
     }
     return $this->form;
 }
 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;
 }
 public function getForm(array $staffList, array $statusList, array $leaveList, $formType = 'W')
 {
     if (!$this->form) {
         $leaveId = new Element\Hidden('leaveId');
         $staff = new Element\Select();
         $staff->setName('staffId')->setEmptyOption('-- Choose Staff --')->setLabel('Staff')->setAttribute('class', 'form-control')->setValueOptions($staffList);
         $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');
         $status = new Element\Select();
         $status->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($statusList);
         if ($formType == 'R' || $formType == 'V') {
             $staff->setAttribute('disabled', 'disabled');
             $leaveType->setAttribute('disabled', 'disabled');
             $description->setAttribute('readonly', 'readonly');
         }
         if ($formType == 'V') {
             $status->setAttribute('disabled', 'disabled');
             $date = new Element\Text();
             $date->setName('date')->setLabel('Date')->setattributes(array('class' => 'form-control', 'disabled' => 'disabled'));
         }
         $form = new Form();
         $form->setAttribute('class', 'form-horizontal');
         $form->add($leaveId);
         $form->add($staff);
         $form->add($leaveType);
         $form->add($date);
         $form->add($description);
         $form->add($status);
         $this->form = $form;
     }
     return $this->form;
 }
Beispiel #20
0
 /**
  * Render the select element.
  *
  * @param string $name
  * @return string
  */
 public function render($name)
 {
     $select = new Select();
     $select->setName($name)->setValueOptions($this->valueOptions)->setAttributes($this->attributes)->setEmptyOption($this->emptyOption)->setValue($this->value);
     return $this->getView()->formSelect($select);
 }
Beispiel #21
0
 public function render($formPV, $id)
 {
     $form = new Form();
     $form->setAttribute('id', $id);
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $factory = new InputFactory();
     foreach ($formPV as $element) {
         if (isset($element->line_text)) {
             $attributes = $element->line_text[0];
             $name = isset($attributes->name) ? $attributes->name : '';
             $type = isset($attributes->type) ? $attributes->type : '';
             $position = isset($attributes->order) ? $attributes->order : '';
             $placeholder = isset($attributes->data->placeholder) ? $attributes->data->placeholder : '';
             $label = isset($attributes->data->label) ? $attributes->data->label : '';
             //$required    = ($attributes->data->required == 'true') ? true : false ;
             $required = false;
             $class = isset($attributes->data->class) ? $attributes->data->class : '';
             $id = isset($attributes->data->id) ? $attributes->data->id : '';
             $lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : '';
             $lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : '';
             $element = new Element\Text($name);
             $element->setName($label);
             $element->setLabel($label);
             $element->setAttributes(array('placeholder' => $placeholder, 'required' => $required, 'class' => $class, 'id' => $id));
             $form->add($element);
             $options = array();
             $options['encoding'] = 'UTF-8';
             if ($lengthMin && $lengthMin > 0) {
                 $options['min'] = $lengthMin;
             }
             if ($lengthMax && $lengthMax > $lengthMin) {
                 $options['max'] = $lengthMax;
                 $element->setAttribute('maxlength', $lengthMax);
                 $options['messages'] = array(\Zend\Validator\StringLength::TOO_LONG => sprintf($this->getServiceManager()->get('translator')->translate('This field contains more than %s characters', 'playgroundgame'), $lengthMax));
             }
             $inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => $options)))));
         }
         if (isset($element->line_email)) {
             $attributes = $element->line_email[0];
             $name = isset($attributes->name) ? $attributes->name : '';
             $type = isset($attributes->type) ? $attributes->type : '';
             $position = isset($attributes->order) ? $attributes->order : '';
             $placeholder = isset($attributes->data->placeholder) ? $attributes->data->placeholder : '';
             $label = isset($attributes->data->label) ? $attributes->data->label : '';
             //$required    = ($attributes->data->required == 'true') ? true : false ;
             $required = false;
             $class = isset($attributes->data->class) ? $attributes->data->class : '';
             $id = isset($attributes->data->id) ? $attributes->data->id : '';
             $lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : '';
             $lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : '';
             $element = new Element\Email($name);
             $element->setLabel($label);
             $element->setName($label);
             $element->setAttributes(array('placeholder' => $placeholder, 'required' => $required, 'class' => $class, 'id' => $id));
             $form->add($element);
             $options = array();
             $options['encoding'] = 'UTF-8';
             if ($lengthMin && $lengthMin > 0) {
                 $options['min'] = $lengthMin;
             }
             if ($lengthMax && $lengthMax > $lengthMin) {
                 $options['max'] = $lengthMax;
                 $element->setAttribute('maxlength', $lengthMax);
                 $options['messages'] = array(\Zend\Validator\StringLength::TOO_LONG => sprintf($this->getServiceManager()->get('translator')->translate('This field contains more than %s characters', 'playgroundgame'), $lengthMax));
             }
             $inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => $options)))));
         }
         if (isset($element->line_checkbox)) {
             $attributes = $element->line_checkbox[0];
             $name = isset($attributes->name) ? $attributes->name : '';
             $type = isset($attributes->type) ? $attributes->type : '';
             $position = isset($attributes->order) ? $attributes->order : '';
             $label = isset($attributes->data->label) ? $attributes->data->label : '';
             //                 $required    = ($attributes->data->required == 'yes') ? true : false;
             $required = false;
             $class = isset($attributes->data->class) ? $attributes->data->class : '';
             $id = isset($attributes->data->id) ? $attributes->data->id : '';
             $lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : '';
             $lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : '';
             $innerData = isset($attributes->data->innerData) ? $attributes->data->innerData : array();
             $element = new Element\MultiCheckbox($name);
             $element->setLabel($label);
             $element->setName($label);
             $element->setAttributes(array('name' => $name, 'required' => $required, 'allowEmpty' => !$required, 'class' => $class, 'id' => $id));
             $values = array();
             foreach ($innerData as $value) {
                 $values[] = $value->label;
             }
             $element->setValueOptions($values);
             $form->add($element);
             $options = array();
             $options['encoding'] = 'UTF-8';
             $inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'allowEmpty' => !$required)));
         }
         if (isset($element->line_paragraph)) {
             $attributes = $element->line_paragraph[0];
             $name = isset($attributes->name) ? $attributes->name : '';
             $type = isset($attributes->type) ? $attributes->type : '';
             $position = isset($attributes->order) ? $attributes->order : '';
             $placeholder = isset($attributes->data->placeholder) ? $attributes->data->placeholder : '';
             $label = isset($attributes->data->label) ? $attributes->data->label : '';
             $required = $attributes->data->required == 'true' ? true : false;
             $class = isset($attributes->data->class) ? $attributes->data->class : '';
             $id = isset($attributes->data->id) ? $attributes->data->id : '';
             $lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : '';
             $lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : '';
             $element = new Element\Textarea($name);
             $element->setName($label);
             $element->setLabel($label);
             $element->setAttributes(array('placeholder' => $placeholder, 'required' => $required, 'class' => $class, 'id' => $id));
             $form->add($element);
             $options = array();
             $options['encoding'] = 'UTF-8';
             if ($lengthMin && $lengthMin > 0) {
                 $options['min'] = $lengthMin;
             }
             if ($lengthMax && $lengthMax > $lengthMin) {
                 $options['max'] = $lengthMax;
                 $element->setAttribute('maxlength', $lengthMax);
             }
             $inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => $options)))));
         }
         if (isset($element->line_upload)) {
             $attributes = $element->line_upload[0];
             //print_r($attributes);
             $name = isset($attributes->name) ? $attributes->name : '';
             $type = isset($attributes->type) ? $attributes->type : '';
             $position = isset($attributes->order) ? $attributes->order : '';
             $label = isset($attributes->data->label) ? $attributes->data->label : '';
             $required = $attributes->data->required == 'true' ? true : false;
             $class = isset($attributes->data->class) ? $attributes->data->class : '';
             $id = isset($attributes->data->id) ? $attributes->data->id : '';
             $filesizeMin = isset($attributes->data->filesize) ? $attributes->data->filesize->min : '';
             $filesizeMax = isset($attributes->data->filesize) ? $attributes->data->filesize->max : '';
             $element = new Element\File($name);
             $element->setLabel($label);
             $element->setName($label);
             $element->setAttributes(array('required' => $required, 'class' => $class, 'id' => $id));
             $form->add($element);
             $inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'validators' => array(array('name' => '\\Zend\\Validator\\File\\Size', 'options' => array('max' => 10 * 1024 * 1024)), array('name' => '\\Zend\\Validator\\File\\Extension', 'options' => array('png,PNG,jpg,JPG,jpeg,JPEG,gif,GIF', 'messages' => array(\Zend\Validator\File\Extension::FALSE_EXTENSION => 'Veuillez télécharger une image')))))));
         }
         if (isset($element->line_radio)) {
             $attributes = $element->line_radio[0];
             $name = isset($attributes->name) ? $attributes->name : '';
             $type = isset($attributes->type) ? $attributes->type : '';
             $position = isset($attributes->order) ? $attributes->order : '';
             $label = isset($attributes->data->label) ? $attributes->data->label : '';
             //                 $required    = ($attributes->data->required == 'yes') ? true : false;
             $required = false;
             $class = isset($attributes->data->class) ? $attributes->data->class : '';
             $id = isset($attributes->data->id) ? $attributes->data->id : '';
             $lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : '';
             $lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : '';
             $innerData = isset($attributes->data->innerData) ? $attributes->data->innerData : array();
             $element = new Element\Radio($name);
             $element->setLabel($label);
             $element->setName($label);
             $element->setAttributes(array('name' => $name, 'required' => $required, 'allowEmpty' => !$required, 'class' => $class, 'id' => $id));
             $values = array();
             foreach ($innerData as $value) {
                 $values[] = $value->label;
             }
             $element->setValueOptions($values);
             $form->add($element);
         }
         if (isset($element->line_dropdown)) {
             $attributes = $element->line_dropdown[0];
             $name = isset($attributes->name) ? $attributes->name : '';
             $type = isset($attributes->type) ? $attributes->type : '';
             $position = isset($attributes->order) ? $attributes->order : '';
             $label = isset($attributes->data->label) ? $attributes->data->label : '';
             //                 $required    = ($attributes->data->required == 'yes') ? true : false;
             $required = false;
             $class = isset($attributes->data->class) ? $attributes->data->class : '';
             $id = isset($attributes->data->id) ? $attributes->data->id : '';
             $lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : '';
             $lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : '';
             $dropdownValues = isset($attributes->data->dropdownValues) ? $attributes->data->dropdownValues : array();
             $element = new Element\Select($name);
             $element->setLabel($label);
             $element->setName($label);
             $element->setAttributes(array('name' => $name, 'required' => $required, 'allowEmpty' => !$required, 'class' => $class, 'id' => $id));
             $values = array();
             foreach ($dropdownValues as $value) {
                 $values[] = $value->dropdown_label;
             }
             $element->setValueOptions($values);
             $form->add($element);
         }
     }
     $form->setInputFilter($inputFilter);
     return $form;
 }
Beispiel #22
0
 /**
  * Prepare the form element (mostly used for rendering purposes)
  *
  * @param  FormInterface $form
  * @return mixed
  */
 public function prepareElement(FormInterface $form)
 {
     $name = $this->getName();
     $this->monthElement->setName($name . '[month]');
     $this->yearElement->setName($name . '[year]');
 }