public function init() { // if (!$this->hasTranslator()) { // $this->setTranslator(Zend_Registry::get('Zend_Translate')); // } $itemid = new Zend_Form_Element_Hidden('ItemID'); $itemid->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden')))); $maTS = new Zend_Form_Element_Text('MaTS'); $maTS->setOptions(array('label' => 'Mã TS', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $tenTS = new Zend_Form_Element_Text('TenTS'); $tenTS->setOptions(array('label' => 'Tên tài sản', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $descr = new Zend_Form_Element_Textarea('Description'); $descr->setOptions(array('label' => 'Mô tả', 'style' => "width: 200px; height: 50px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $type = new Zend_Form_Element_Select('Type'); $type->setOptions(array('label' => 'Loại bảo mật', 'required' => TRUE, 'MultiOptions' => array(1 => 'Bảo mật thấp', 0 => 'Bảo mật cao')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label')))); $startDate = new Zend_Form_Element_Text('StartDate'); $startDate->setOptions(array('label' => 'Bắt đầu SD', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $price = new Zend_Form_Element_Text('Price'); $price->setOptions(array('label' => 'Giá', 'required' => TRUE, 'filters' => array('Int')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $warrantyTime = new Zend_Form_Element_Text('WarrantyTime'); $warrantyTime->setOptions(array('label' => 'Bảo hành', 'required' => TRUE, 'filters' => array('Int')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $status = new Zend_Form_Element_Select('Status'); $status->setOptions(array('label' => 'Tình trạng', 'required' => TRUE, 'MultiOptions' => array(0 => 'Có thể mượn', 1 => 'Đang cho mượn', 2 => 'Hỏng')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label')))); $place = new Zend_Form_Element_Textarea('Place'); $place->setOptions(array('label' => 'Địa điểm hiện tại', 'style' => "width: 200px; height: 50px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $this->setName('item-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($itemid, $maTS, $tenTS, $descr, $type, $startDate, $price, $warrantyTime, $status, $place))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form')); }
public function init() { // if (!$this->hasTranslator()) { // $this->setTranslator(Zend_Registry::get('Zend_Translate')); // } $userid = new Zend_Form_Element_Hidden('UserID'); $userid->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden')))); $username = new Zend_Form_Element_Text('Username'); $username->setOptions(array('label' => 'Username', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $birthday = new Zend_Form_Element_Text('Birthday'); $birthday->setOptions(array('label' => 'Birthday', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $role = new Zend_Form_Element_Select('Role'); $role->setOptions(array('label' => 'User Type', 'MultiOptions' => array(3 => 'User', 2 => 'IT', 1 => 'Admin', 0 => 'SuperAdmin')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label')))); $fullname = new Zend_Form_Element_Text('FullName'); $fullname->setOptions(array('label' => 'FullName'))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $email = new Zend_Form_Element_Text('Email'); $email->setOptions(array('label' => 'Email', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $group = new Zend_Form_Element_Text('Group'); $group->setOptions(array('label' => 'Group'))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $phone = new Zend_Form_Element_Text('Phone'); $phone->setOptions(array('label' => 'Phone'))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $address = new Zend_Form_Element_Textarea('Address'); $address->setOptions(array('label' => 'Address', 'style' => "width: 200px; height: 150px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $this->setName('user-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($userid, $username, $role, $fullname, $email, $birthday, $group, $phone, $address))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form')); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $idMember = App_Utilities::getIdMember(); $member_id = new Zend_Form_Element_Hidden('member_id'); $member_id->addFilter('Int')->setValue($idMember); $this->addElement($member_id); $start_date = new Zend_Form_Element_Text('start_date'); $start_date->setOptions(array('label' => $this->t('Start date'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($start_date); $end_date = new Zend_Form_Element_Text('end_date'); $end_date->setOptions(array('label' => $this->t('End Date'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($end_date); $is_posted = new Zend_Form_Element_Checkbox('is_posted'); $this->addElement($is_posted); $companyName = new Zend_Form_Element_Text('name'); $companyName->setOptions(array('label' => $this->t('Company'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($companyName); $function = new Zend_Form_Element_Text('function'); $function->setOptions(array('label' => $this->t('function'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($function); $mission = new Zend_Form_Element_Textarea('mission'); $mission->setOptions(array('label' => $this->t('mission'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($mission); $city_name = new Zend_Form_Element_Text('city_name'); $city_name->setOptions(array('label' => $this->t('city'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($city_name); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save'), 'required' => true)); $this->addElement($submit); }
public function init() { // if (!$this->hasTranslator()) { // $this->setTranslator(Zend_Registry::get('Zend_Translate')); // } $requestid = new Zend_Form_Element_Hidden('RequestID'); $requestid->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden')))); $maTS = new Zend_Form_Element_Text('MaTS'); $maTS->setOptions(array('label' => 'Mã TS', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); // // $UserID = new Zend_Form_Element_Text('UserID'); // $UserID->setOptions(array( // 'label' => 'UserID', // 'required' => TRUE, // 'filters' => array('StringTrim') // )) // ->setDecorators(array( // array('ViewHelper', array('helper' => 'formText')), // array('Label', array('class' => 'label')) // )); $utype = new Zend_Form_Element_Select('Type'); $utype->setOptions(array('label' => 'Loại yêu cầu', 'required' => TRUE, 'MultiOptions' => array(0 => 'Yêu cầu mượn TS', 1 => 'Yêu cầu nâng cấp')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label')))); $detail = new Zend_Form_Element_Textarea('Detail'); $detail->setOptions(array('label' => 'Chi tiết yêu cầu', 'style' => "width: 200px; height: 100px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $this->setName('item-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($requestid, $maTS, $utype, $detail))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form')); }
public function init() { $name = new Zend_Form_Element_Text('Name'); $name->setOptions(array('label' => 'Name', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $email = new Zend_Form_Element_Text('Email'); $email->setOptions(array('label' => 'Email', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $subject = new Zend_Form_Element_Select('Subject'); $subject->setOptions(array('label' => 'Subject', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $content = new Zend_Form_Element_Textarea('Content'); $content->setOptions(array('label' => 'Content', 'style' => "width: 300px; height: 200px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $this->setName('item-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($name, $email, $subject, $content))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form')); }
/** * @author code generate * @return mixed */ public function __construct($option = array()) { $contactId = new Zend_Form_Element_Hidden('ContactId'); $contactId->setDecorators(array('ViewHelper')); $this->addElement($contactId); $contactName = new Zend_Form_Element_Text('ContactName'); $contactName->setLabel('Họ tên *'); $contactName->addFilter('StringTrim'); $contactName->setRequired(true); $contactName->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $contactName->addValidator('stringLength', false, array(1, 50, "messages" => " dài tối đa 50 ký tự")); $this->addElement($contactName); $userId = new Zend_Form_Element_Text('UserId'); $userId->setLabel('UserId'); $userId->addFilter('StringTrim'); $userId->setAttrib('disabled', true); $userId->setDecorators(array('ViewHelper')); $this->addElement($userId); $contactPhone = new Zend_Form_Element_Text('ContactPhone'); $contactPhone->setLabel('Điện thoại *'); $contactPhone->addFilter('StringTrim'); $contactPhone->setRequired(true); $contactPhone->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $contactPhone->addValidator('stringLength', false, array(1, 15, "messages" => " dài tối đa 50 ký tự")); $this->addElement($contactPhone); $contactTitle = new Zend_Form_Element_Text('ContactTitle'); $contactTitle->setLabel('Tiêu đề *'); $contactTitle->addFilter('StringTrim'); $contactTitle->setRequired(true); $contactTitle->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $contactTitle->addValidator('stringLength', false, array(1, 250, "messages" => " dài tối đa 250 ký tự")); $this->addElement($contactTitle); $contactContent = new Zend_Form_Element_Textarea('ContactContent'); $contactContent->setLabel('Nội dung *'); $contactContent->setRequired(true); $contactContent->setOptions(array('cols' => '10', 'rows' => '4')); $contactContent->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $contactPhone->addValidator('stringLength', false, array(1, 2000, "messages" => " dài tối đa 2000 ký tự")); $this->addElement($contactContent); $save = new Zend_Form_Element_Submit('Save'); $save->setLabel('Gửi'); $save->setAttrib('class', 'btn btn-primary'); $save->setDecorators(array('ViewHelper')); $this->addElement($save); $reset = new Zend_Form_Element_Reset('Reset'); $reset->setLabel('Làm lại'); $reset->setAttrib('class', 'btn btn-primary'); $reset->setDecorators(array('ViewHelper')); $this->addElement($reset); }
public function init() { // if (!$this->hasTranslator()) { // $this->setTranslator(Zend_Registry::get('Zend_Translate')); // } $maTS = new Zend_Form_Element_Text('MaTS'); $maTS->setOptions(array('label' => 'Mã TS', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $Username = new Zend_Form_Element_Text('Username'); $Username->setOptions(array('label' => 'Người mượn', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $detail = new Zend_Form_Element_Textarea('Detail'); $detail->setOptions(array('label' => 'Chi tiết', 'style' => "width: 200px; height: 100px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $place = new Zend_Form_Element_Textarea('Place'); $place->setOptions(array('label' => 'Địa điểm', 'style' => "width: 200px; height: 100px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $this->setName('item-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($maTS, $Username, $detail, $place))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form')); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $idMember = App_Utilities::getIdMember(); $member_id = new Zend_Form_Element_Hidden('member_id'); $member_id->addFilter('Int')->setValue($idMember); $this->addElement($member_id); $file = new Zend_Form_Element_File('image_url'); $file->setLabel('image')->setAttrib('enctype', 'multipart/form-data')->setDestination(APPLICATION_PATH . '/../public/frontend/images/profil/')->setRequired(false); $this->addElement($file); $profil_description = new Zend_Form_Element_Textarea('profil_description'); $profil_description->setOptions(array('label' => $this->t('description'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($profil_description); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save'), 'required' => true)); $this->addElement($submit); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $nameCompany = new Zend_Form_Element_Text('name'); $nameCompany->setOptions(array('label' => $this->t('Raison social'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($nameCompany); $synopsis = new Zend_Form_Element_Textarea('synopsis'); $synopsis->setOptions(array('label' => $this->t('synopsis'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($synopsis); $file = new Zend_Form_Element_File('logo'); $file->setLabel('image')->setAttrib('enctype', 'multipart/form-data')->setDestination(APPLICATION_PATH . '/../public/frontend/images/logo/')->setRequired(false); $this->addElement($file); $rc = new Zend_Form_Element_Text('rc'); $rc->setOptions(array('label' => $this->t('rc'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($rc); $patente = new Zend_Form_Element_Text('patente'); $patente->setOptions(array('label' => $this->t('patente'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($patente); $createDate = new Zend_Form_Element_Text('create_date'); $createDate->setOptions(array('label' => $this->t('create_date'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($createDate); $tel = new Zend_Form_Element_Text('tel'); $tel->setOptions(array('label' => $this->t('tel'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($tel); $fax = new Zend_Form_Element_Text('fax'); $fax->setOptions(array('label' => $this->t('fax'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($fax); $adress = new Zend_Form_Element_Text('adress'); $adress->setOptions(array('label' => $this->t('adress'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($adress); $description = new Zend_Form_Element_Text('description'); $description->setOptions(array('label' => $this->t('description'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($description); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save'), 'required' => true)); $this->addElement($submit); }
/** * Zend_Form_Element_Textarea wrapper * @param string $title * @param string $label * @return Zend_Form_Element_Textarea */ protected function elementTextarea($title, $options = null) { $el = new Zend_Form_Element_Textarea($title); if (is_array($options)) { $el->setOptions($options); } else { if (!empty($options)) { $el->setLabel($options); } } $el->setRequired(true)->addFilter('StringTrim')->addValidator('NotEmpty'); return $el; }
/** * @author code generate * @return mixed */ public function __construct($option = array()) { $userId = new Zend_Form_Element_Hidden('TutorId'); $userId->setDecorators(array('ViewHelper')); $this->addElement($userId); $birthDay = new Zend_Form_Element_Text('Birthday'); $birthDay->setLabel('Ngày sinh *'); $birthDay->addFilter('StringTrim'); $birthDay->setRequired(true); $birthDay->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $birthDay->addValidator('stringLength', false, array(2, 50, "messages" => "Ngày sinh dài tối đa 50 ký tự")); $this->addElement($birthDay); $gender = new Zend_Form_Element_Select('Gender'); $gender->setLabel('Giới tính *'); $gender->addFilter('StringTrim'); $gender->setRequired(true); $gender->setMultiOptions(array('1' => 'Nam', '0' => 'Nữ')); $gender->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $gender->setSeparator(''); $gender->setValue("1"); $this->addElement($gender); $email = new Zend_Form_Element_Text('Email'); $email->setLabel('Email *'); $email->addFilter('StringTrim'); $email->setRequired(true); $email->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $email->addValidator(new Zend_Validate_Db_NoRecordExists("Tutors", "Email")); $email->addValidator('EmailAddress', true); $email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => "Email không phù hợp"))); $this->addElement($email); $userName = new Zend_Form_Element_Text('UserName'); $userName->setLabel('Họ tên *'); $userName->addFilter('StringTrim'); $userName->setRequired(true); $userName->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $userName->addValidator('stringLength', false, array(2, 50, "messages" => "Họ tên dài tối đa 2-50 ký tự")); $this->addElement($userName); $address = new Zend_Form_Element_Text('Address'); $address->setLabel('Địa chỉ *'); $address->addFilter('StringTrim'); $address->setRequired(true); $address->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $userName->addValidator('stringLength', false, array(1, 100, "messages" => "Địa chỉ dài tối đa 100 ký tự")); $this->addElement($address); $phone = new Zend_Form_Element_Text('Phone'); $phone->setLabel('Điện thoại *'); $phone->addFilter('StringTrim'); $phone->setRequired(true); $phone->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $phone->addValidator('stringLength', false, array(6, 50, "messages" => "Điện thoại dài tối đa 6-50 ký tự")); $this->addElement($phone); $required = new Zend_Validate_NotEmpty(); $required->setType($required->getType() | Zend_Validate_NotEmpty::INTEGER | Zend_Validate_NotEmpty::ZERO); $level = new Zend_Form_Element_Select('Level'); $level->setLabel('Trình độ *'); $level->addFilter('StringTrim'); $level->addValidator('Int'); $level->setRequired(true); $level->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $level->addValidators(array($required)); $level->setMultiOptions(unserialize(TUTOR_LEVELS)); $this->addElement($level); $university = new Zend_Form_Element_Text('University'); $university->setLabel('Trường tốt nghiệp *'); $university->addFilter('StringTrim'); $university->setRequired(true); $university->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $university->addValidator('stringLength', false, array(1, 100, "messages" => "Trường tố nghiệp dài tối đa 100 ký tự")); $this->addElement($university); $subject = new Zend_Form_Element_Text('Subject'); $subject->setLabel('Chuyên ngành *'); $subject->addFilter('StringTrim'); $subject->setRequired(true); $subject->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $subject->addValidator('stringLength', false, array(1, 100, "messages" => "Chuyên ngành dài tối đa 100 ký tự")); $this->addElement($subject); $experienceYears = new Zend_Form_Element_Select('ExperienceYears'); $experienceYears->setLabel('Số Năm Kinh Nghiệm *'); $experienceYears->addFilter('StringTrim'); $experienceYears->setRequired(false); $experienceYears->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $options = unserialize(EXPERIENCE_YEAR); //$experienceYears->addMultiOptions(array_combine($options, $options)); $experienceYears->setMultiOptions(unserialize(EXPERIENCE_YEAR)); $this->addElement($experienceYears); $career = new Zend_Form_Element_Select('Career'); $career->setLabel('Hiện tại là *'); $career->addFilter('StringTrim'); $career->addValidator('Int'); $career->setRequired(true); $career->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $career->setMultiOptions(unserialize(TUTOR_CAREERS)); $this->addElement($career); $careerLocation = new Zend_Form_Element_Text('CareerLocation'); $careerLocation->setLabel('Nơi Công Tác ( Giáo hoặc Giảng Viên ) *'); $careerLocation->addFilter('StringTrim'); $careerLocation->setRequired(false); $careerLocation->setAttrib('style', 'min-height: 30px;'); $careerLocation->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $careerLocation->addValidator('stringLength', false, array(1, 100, "messages" => "Nơi Công Tác dài tối đa 100 ký tự")); $this->addElement($careerLocation); $teachableInClass = new Zend_Form_Element_Text('TeachableInClass'); $teachableInClass->setLabel('Lớp Có Thể Dạy'); $teachableInClass->addFilter('StringTrim'); $teachableInClass->setRequired(false); $teachableInClass->setAttrib('disabled', true); $teachableInClass->setDescription('<a id="grades-modal" class="btn btn-info" title="Chọn lớp">...</a>'); $teachableInClass->setDecorators(array('ViewHelper', array('Description', array('escape' => false)), array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control col-lg-6')), array('Label', array('class' => 'control-label col-lg-2')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $this->addElement($teachableInClass); $teachableSubjects = new Zend_Form_Element_Text('TeachableSubjects'); $teachableSubjects->setLabel('Môn Có Thể Dạy'); $teachableSubjects->addFilter('StringTrim'); $teachableSubjects->setRequired(false); $teachableSubjects->setAttrib('disabled', true); $teachableSubjects->setDescription('<a id="subjects-modal" class="btn btn-info" title="Chọn môn">...</a>'); $teachableSubjects->setDecorators(array('ViewHelper', array('Description', array('escape' => false)), array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control col-lg-6')), array('Label', array('class' => 'control-label col-lg-2')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $this->addElement($teachableSubjects); $teachableDistricts = new Zend_Form_Element_Text('TeachableDistricts'); $teachableDistricts->setLabel('Khu Vực Có Thể Dạy'); $teachableDistricts->addFilter('StringTrim'); $teachableDistricts->setRequired(false); $teachableDistricts->setAttrib('disabled', true); $teachableDistricts->setDescription('<span id="districts-modal" class="btn btn-info" title="Chọn quận">...</span>'); $teachableDistricts->setDecorators(array('ViewHelper', array('Description', array('escape' => false)), array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control col-lg-6')), array('Label', array('class' => 'control-label col-lg-2')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $this->addElement($teachableDistricts); $avatar = new Zend_Form_Element_Hidden('Upload'); $avatar->setLabel('Hình đại diện'); $avatar->setRequired(false); $avatar->setDescription('fieldlabel'); $avatar->setDecorators(array('ViewHelper', array(array('Description' => 'HtmlTag'), array('tag' => 'div', 'id' => "file-uploader")), array(array('Errors' => 'HtmlTag'), array('placement' => 'append', 'tag' => 'img', 'id' => 'progress-img', 'src' => "/scripts/upload/loading.gif")), array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control', 'style' => "position: relative;float: left;margin-left: 20px;")), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $this->addElement($avatar); $avatarNote = new Zend_Form_Element_Hidden('Avatar'); $avatarNote->setLabel('Chú ý'); $avatarNote->setRequired(false); $avatarNote->setDescription("Kích thước khoảng: 240 x 120 (px)<br>Kích cỡ cho phép: " . IMAGE_SIZE_LIMIT . " kB"); $avatarNote->setDecorators(array('ViewHelper', array('Description', array('escape' => false, 'tag' => 'div')), array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group', 'style' => "float: left;")))); $this->addElement($avatarNote); $introduction = new Zend_Form_Element_Textarea('Introduction'); $introduction->setLabel('Giới thiệu bản thân'); $introduction->addFilter('StringTrim'); $introduction->setRequired(false); $introduction->setOptions(array('cols' => '10', 'rows' => '4')); /* $introduction->setDecorators(array('ViewHelper')); */ $introduction->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $subject->addValidator('stringLength', false, array(1, 2000, "messages" => "Giới thiệu bản thân dài tối đa 2000 ký tự")); $this->addElement($introduction); $isDisabled = new Zend_Form_Element_Text('IsDisabled'); $isDisabled->setLabel('IsDisabled'); $isDisabled->addFilter('StringTrim'); $isDisabled->addValidator('Int'); $isDisabled->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $this->addElement($isDisabled); $submit = new Zend_Form_Element_Submit('Save'); $submit->setLabel('Đăng ký'); $submit->setAttrib('class', 'btn btn-primary'); $submit->setDecorators(array('ViewHelper')); $this->addElement($submit); $reset = new Zend_Form_Element_Reset('Reset'); $reset->setLabel('Làm lại'); $reset->setAttrib('class', 'btn btn-primary'); $reset->setDecorators(array('ViewHelper')); $this->addElement($reset); $this->addDisplayGroup(array('UserName', 'Gender', 'Birthday', 'Email', 'Address', 'Phone'), 'contact', array('disableLoadDefaultDecorators' => false, 'legend' => 'Thông tin cá nhân')); $contact = $this->getDisplayGroup('contact'); $contact->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'fieldset', 'class' => 'well the-fieldset')))); $this->addDisplayGroup(array('Level', 'University', 'Subject', 'Career', 'CareerLocation', 'ExperienceYears'), 'level', array('disableLoadDefaultDecorators' => false, 'legend' => 'Thông tin học vấn')); $level = $this->getDisplayGroup('level'); $level->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'fieldset', 'class' => 'well the-fieldset')))); $this->addDisplayGroup(array('TeachableInClass', 'TeachableSubjects', 'TeachableDistricts', 'Upload', 'Avatar', 'Introduction'), 'extra', array('disableLoadDefaultDecorators' => false, 'legend' => 'Thông tin thêm')); $extra = $this->getDisplayGroup('extra'); $extra->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'fieldset', 'class' => 'well the-fieldset')))); $this->addDisplayGroup(array('Save', 'Reset'), 'submit', array('disableLoadDefaultDecorators' => false, 'legend' => 'Thông tin học vấn')); $submit = $this->getDisplayGroup('submit'); $submit->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'fieldset', 'class' => 'well the-fieldset')))); }