public function init()
 {
     // search input
     $searchInput = new Zend_Form_Element_Text('search');
     $searchInput->setLabel('Search Key Word');
     $searchInput->setRequired(true);
     $searchInput->addValidator('NotEmpty', true);
     $this->addElement($searchInput);
     // pageSize
     $pageSize = $this->_getHiddenElement('per_page');
     $pageSize->setValue(self::getDefaultFlickrPageSize());
     $this->addElement($pageSize);
     // page
     $page = $this->_getHiddenElement('page');
     $page->setValue(1);
     $this->addElement($page);
     // search button
     $searchButton = new Zend_Form_Element_Submit('submit');
     $searchButton->setLabel('Search');
     $this->addElement($searchButton);
     // reset button
     $resetButton = new Zend_Form_Element_Reset('reset');
     $resetButton->setLabel('Reset');
     $this->addElement($resetButton);
     $this->setMethod(Zend_Form::METHOD_GET);
     $this->setAttrib('id', 'search-form');
 }
Beispiel #2
0
 /**
  * @author code generate
  * @return mixed
  */
 public function __construct($option = array())
 {
     $classId = new Zend_Form_Element_Hidden('UserId');
     $classId->setDecorators(array('ViewHelper'));
     $this->addElement($classId);
     $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("Users", "Email"));
     $email->addValidator('EmailAddress', true);
     $email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => "Email không phù hợp")));
     $this->addElement($email);
     $save = new Zend_Form_Element_Submit('Save');
     $save->setLabel('Đăng ký');
     $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);
 }
Beispiel #3
0
 /**
  * @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);
 }
Beispiel #4
0
 public function init()
 {
     $form = new Zend_Form("form");
     $form->setMethod('post');
     $title = new Zend_Form_Element_Text("title");
     $title->setLabel("Title:");
     $title->setAttrib("placeholder", "Title");
     $title->setAttrib("class", "form-control");
     $title->setRequired();
     $picture = new Zend_Form_Element_File("picture");
     $picture->setLabel("Picture:");
     $picture->setDestination('/var/www/html/RNR/public/images/category');
     $picture->setRequired();
     $id = new Zend_Form_Element_Hidden("id");
     $submit = new Zend_Form_Element_Submit("Submit");
     $submit->setLabel("Save");
     $submit->setAttrib("class", "btn btn-primary");
     $rest = new Zend_Form_Element_Reset('Reset');
     $rest->setAttrib("class", "btn btn-info");
     $this->addElements(array($title, $picture, $submit, $rest, $id));
 }
Beispiel #5
0
 public function init()
 {
     $this->setMethod("post");
     $this->setAttrib("class", "form-horizontal");
     $username = new Zend_Form_Element_Text("userName");
     $username->setLabel("User Name:");
     $username->setRequired();
     $username->setAttrib("placeholder", "User name");
     $username->setAttrib("class", "form-control");
     $username->addFilter(new Zend_Filter_StripTags());
     $email = new Zend_Form_Element_Text("email");
     $email->setRequired()->setLabel("Email:")->addValidator(new Zend_Validate_EmailAddress())->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'user', 'field' => 'email')));
     $email->setAttrib("placeholder", "Email");
     $email->setAttrib("class", "form-control");
     $password = new Zend_Form_Element_Password("password");
     $password->setRequired()->setLabel("Password:"******"placeholder", "Password");
     $password->setAttrib("class", "form-control");
     $country = new Zend_Form_Element_Select('country');
     $country->setMultiOptions(array('Egypt' => 'Egypt', 'Kuwait' => 'Kuwait', 'Canada' => 'Canada'));
     $country->setLabel("Country:");
     $country->setAttrib("class", "form-control");
     $gender = new Zend_Form_Element_Radio('gender');
     $gender->setRequired(true)->setLabel("Gender:")->addMultiOptions(array('male' => 'Male', 'female' => 'Female'))->setSeparator("     ");
     $profilePicture = new Zend_Form_Element_File('profilePicture');
     $profilePicture->setLabel("ProfilePicture:");
     $profilePicture->setDestination('/var/www/html/RNR/public/images/user/profilePicture');
     $signature = new Zend_Form_Element_File('signature');
     $signature->setLabel("Signature:");
     $signature->setDestination('/var/www/html/RNR/public/images/user/signature');
     $id = new Zend_Form_Element_Hidden("id");
     $submit = new Zend_Form_Element_Submit("Submit");
     $submit->setAttrib("class", "btn btn-primary");
     $submit->setLabel("Save");
     $rest = new Zend_Form_Element_Reset('Reset');
     $rest->setAttrib("class", "btn btn-info");
     $this->addElements(array($id, $username, $email, $password, $country, $gender, $profilePicture, $signature, $submit, $rest));
     /* Form Elements & Other Definitions Here ... */
 }
Beispiel #6
0
 /**
  * @author code generate
  * @return mixed
  */
 public function __construct($option = array())
 {
     $classId = new Zend_Form_Element_Hidden('ClassId');
     $classId->setDecorators(array('ViewHelper'));
     $this->addElement($classId);
     $classAddress = new Zend_Form_Element_Text('TutorId');
     $classAddress->setLabel('Mã số của bạn *');
     $classAddress->addFilter('StringTrim');
     $classAddress->setRequired(true);
     $classAddress->addValidator('int');
     $classAddress->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'))));
     $classAddress->addValidator('stringLength', false, array(1, 10, "messages" => "Mã số chỉ dài tối đa 10 chữ số"));
     $this->addElement($classAddress);
     $save = new Zend_Form_Element_Submit('Save');
     $save->setLabel('Ứng tuyển');
     $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);
 }
 /**
  * Class constructor
  *
  * @param $spec
  * @param array $options
  */
 public function __construct($spec, $options = null)
 {
     if (!isset($options['class'])) {
         $options['class'] = '';
     }
     $classes = explode(' ', $options['class']);
     $classes[] = 'btn btn-default';
     if (isset($options['buttonType']) && in_array($options['buttonType'], $this->buttons)) {
         $classes[] = 'btn-' . $options['buttonType'];
         unset($options['buttonType']);
     }
     if (isset($options['disabled'])) {
         $classes[] = 'disabled';
     }
     $classes = array_unique($classes);
     $options['class'] = trim(implode(' ', $classes));
     parent::__construct($spec, $options);
 }
Beispiel #8
0
 /**
  * @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'))));
 }
Beispiel #9
0
 /**
  * Build replyForm
  *
  * @return void
  */
 protected function replyForm()
 {
     $this->setName('replyForm')->setElementsBelongTo('replyForm');
     $element = new Zend_Form_Element_Text('subject', array('disableLoadDefaultDecorators' => true));
     $element->addDecorator('ViewHelper')->setAttribs(array('class' => 'input-title', 'maxlength' => 126, 'tabindex' => 1))->addFilter('StripTags')->addFilter('StringTrim');
     $this->addElement($element);
     $element = new Zend_Form_Element_Textarea('body', array('disableLoadDefaultDecorators' => true));
     $element->addDecorator('ViewHelper')->setRequired(true)->addErrorMessage('Message cannot be empty!')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $this->addElement($element);
     $element = new Zend_Form_Element_Hash('token', array('disableLoadDefaultDecorators' => true));
     $element->addDecorator('ViewHelper')->addErrorMessage('Form must not be resubmitted');
     $this->addElement($element);
     $element = new Zend_Form_Element_Submit('replySubmit', array('disableLoadDefaultDecorators' => true));
     $element->addDecorator('ViewHelper')->setLabel('Post Reply');
     $this->addElement($element);
     $element = new Zend_Form_Element_Reset('reset', array('disableLoadDefaultDecorators' => true));
     $element->addDecorator('ViewHelper')->setLabel('Reset');
     $this->addElement($element);
     $this->clearDecorators();
     $this->addDecorator('FormElements')->addDecorator('Form');
     /*
     		$this->setName('replyForm')
     			->setElementsBelongTo('replyForm')
     			->setMethod('post')
     			->setEnctype('application/x-www-form-urlencoded');
     
     		$subject = new Zend_Form_Element_Text('subject');
     		$subject->setLabel('Post Subject')
     			->setAttribs(array('class' => 'input-title', 'maxlength' => 126))
     			->setRequired(true)
     			->addFilter('StripTags')
     			->addFilter('StringTrim')
     			->addValidator('NotEmpty');
     
     		$message = new Zend_Form_Element_Textarea('message');
     		$message->setLabel('Your Message')
     			->setRequired(true)
     			->addFilter('StripTags')
     			->addFilter('StringTrim')
     			->addValidator('NotEmpty');
     
     		$posthash = new Zend_Form_Element_Hash('token');
     
     		$submit = new Zend_Form_Element_Submit('forumSubmit');
     		$submit->setLabel('Post Reply');
     
     		$this->addElements(array($subject, $message, $posthash, $submit));
     */
 }
Beispiel #10
0
 /**
  * Initialization form
  */
 public function init()
 {
     parent::init();
     //---------------- Форма ----------------
     // Указываем action формы
     $urlAction = $this->getUrl('register', 'account');
     $this->setAction($urlAction);
     // Указываем метод формы
     $this->setMethod('post');
     // Задаем атрибут class для формы
     //$this->setAttrib('class', 'register');
     $this->setAttrib('class', 'myfrm span5');
     $this->setAttrib('id', 'registration-form');
     //---------------- Username ----------------
     // Text элемент "Имя входа пользователя". Проверяется на алфавитные символы и цифры, а также на длину
     // Валидатор Alnum использует установленную локаль для определения алфавита символов.
     $username = new Zend_Form_Element_Text('username', array('required' => true, 'label' => $this->Translate('Имя входа пользователя') . ' (Login)', 'maxlength' => '30', 'validators' => array(array('Alnum', true, array(true)), array('UserName'), array('NoDbRecordExists', true, array('users', 'username'))), 'filters' => array('StringTrim')));
     $this->addElement($username);
     //---------------- Email ----------------
     // Используемый собственный элемент App_Form_Element_Email
     $email = new Default_Form_Element_Email('email', array('required' => true));
     // Добавление элемента в форму
     $this->addElement($email);
     //---------------- First name user ----------------
     // Text элемент "Имя пользователя". Проверяется на алфавитные символы и цифры, а также на длину
     // Валидатор Alnum использует установленную локаль для определения алфавита символов.
     $first_name = new Zend_Form_Element_Text('first_name', array('label' => 'Имя пользователя', 'maxlength' => '150', 'size' => '60', 'validators' => array(array('Alnum', true, array(true)), array('StringLength', true, array(0, 150))), 'filters' => array('StringTrim')));
     $this->addElement($first_name);
     //---------------- Last name user ----------------
     // Text элемент "Фамилия пользователя". Проверяется на алфавитные символы и цифры, а также на длину
     // Валидатор Alnum использует установленную локаль для определения алфавита символов.
     $last_name = new Zend_Form_Element_Text('last_name', array('label' => 'Фамилия пользователя', 'maxlength' => '150', 'size' => '60', 'validators' => array(array('Alnum', true, array(true)), array('StringLength', true, array(0, 150))), 'filters' => array('StringTrim')));
     $this->addElement($last_name);
     //---------------- Captcha ----------------
     // Элемент CAPTCHA, защита от спама
     $urlBase = Default_Plugin_SysBox::getBaseURL();
     $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => 'Введите символы', 'captcha' => array('captcha' => 'Image', 'wordLen' => 4, 'width' => 260, 'timeout' => 120, 'expiration' => 300, 'font' => APPLICATION_PUBLIC . '/fonts/arial.ttf', 'imgDir' => APPLICATION_PUBLIC . '/images/captcha/', 'imgUrl' => $urlBase . '/images/captcha/', 'gcFreq' => 5)));
     $this->addElement($captcha);
     //---------------- Submit ----------------
     // Кнопка Submit
     $submit = new Zend_Form_Element_Submit('send', array('label' => 'Зарегистрироваться'));
     $submit->setAttrib('class', 'btn btn-primary');
     // Перезаписываем декораторы, что-бы
     //перезаписать стандартный набор декораторов для кнопки 'submit'
     $submit->setDecorators(array('ViewHelper'));
     $this->addElement($submit);
     //---------------- Reset ----------------
     // Кнопка Reset, возвращает форму в начальное состояние
     $reset = new Zend_Form_Element_Reset('reset', array('label' => 'Очистить'));
     $reset->setAttrib('class', 'btn');
     // Перезаписываем декораторы, что-бы выставить две кнопки в ряд
     $reset->setDecorators(array('ViewHelper'));
     $this->addElement($reset);
     //---------------- Группа Авторизационные данные ----------------
     // Группируем элементы
     // Группа полей связанных с авторизационными данными
     $this->addDisplayGroup(array('username', 'email'), 'authDataGroup', array('legend' => 'Авторизационные данные'));
     //---------------- Группа Личная информация ----------------
     // Группа полей связанных с личной информацией
     $this->addDisplayGroup(array('first_name', 'last_name'), 'privateDataGroup', array('legend' => 'Личная информация'));
     //---------------- Группа Защита от спама ----------------
     // Защита от спама
     $this->addDisplayGroup(array('captcha'), 'captchaGroup', array('legend' => 'Защита от спама'));
     //---------------- Группа полей кнопок ----------------
     $this->addDisplayGroup(array('send', 'reset'), 'buttonsGroup');
 }
Beispiel #11
0
 /**
  * Initialization form
  */
 public function init()
 {
     parent::init();
     //---------------- Форма ----------------
     // Указываем action формы
     $urlAction = $this->getRouteUrl('get_comments', array('username' => $this->username, 'post_id' => $this->post_id));
     $this->setAction($urlAction);
     // Указываем метод формы
     $this->setMethod('post');
     // Задаем атрибут class для формы
     //$this->setAttrib('class', 'register');
     $this->setAttrib('class', 'myfrm');
     $this->setAttrib('id', 'form-add-comment');
     //---------------- Комментарий ----------------
     // Text элемент
     $ckeditor_comment = new Zend_Form_Element_Textarea('ckeditor_comment', array('label' => $this->Translate('Текст комментария') . ':', 'required' => TRUE, 'rows' => 12, 'cols' => 60, 'validators' => array(array('StringLength', true, array(0, 1024))), 'filters' => array('Sanitize')));
     $this->addElement($ckeditor_comment);
     //---------------- Captcha ----------------
     // Элемент CAPTCHA, защита от спама
     //        $urlBase = Default_Plugin_SysBox::getBaseURL();
     //        $captcha = new Zend_Form_Element_Captcha('captcha', array(
     //                    'label' => 'Введите символы',
     //                    'captcha' => array(
     //                        'captcha' => 'Image', // Тип CAPTCHA
     //                        'wordLen' => 4, // Количество генерируемых символов
     //                        'width' => 260, // Ширина изображения
     //                        'timeout' => 120, // Время жизни сессии хранящей символы 120
     //                        'expiration' => 300, // Время жизни изображения в файловой системе
     //                        'font' => APPLICATION_PUBLIC . '/fonts/arial.ttf', // Путь к шрифту
     //                        'imgDir' => APPLICATION_PUBLIC . '/images/captcha/', // Путь к изобр.
     //                        'imgUrl' => $urlBase . '/images/captcha/', // Адрес папки с изображениями
     //                        'gcFreq' => 5        // Частота вызова сборщика мусора
     //                    ),
     //                ));
     //
     //        $this->addElement($captcha);
     //----------- Скрытый элемент уникального кода автора сообщения -----------
     //        $user_id = new Zend_Form_Element_Hidden('user_id');
     //        $user_id->setValue($this->user_id);
     //        $this->addElement($user_id);
     //---------------- Submit ----------------
     // Кнопка Submit
     $send_comment = new Zend_Form_Element_Submit('send_comment', array('label' => 'Комментировать'));
     $send_comment->setAttrib('class', 'btn btn-primary');
     // Перезаписываем декораторы, что-бы
     //перезаписать стандартный набор декораторов для кнопки 'submit'
     $send_comment->setDecorators(array('ViewHelper'));
     $this->addElement($send_comment);
     //---------------- Reset ----------------
     // Кнопка Reset, возвращает форму в начальное состояние
     $reset_comment = new Zend_Form_Element_Reset('reset_comment', array('label' => 'Очистить'));
     $reset_comment->setAttrib('class', 'btn');
     // Перезаписываем декораторы, что-бы выставить две кнопки в ряд
     $reset_comment->setDecorators(array('ViewHelper'));
     $this->addElement($reset_comment);
     //---------------- Группа комментария ----------------
     // Защита от спама
     $this->addDisplayGroup(array('ckeditor_comment'), 'commentGroup', array('legend' => 'Оставить свой комментарий'));
     //---------------- Группа полей кнопок ----------------
     $this->addDisplayGroup(array('send_comment', 'reset_comment'), 'buttonsGroup');
 }
Beispiel #12
0
 public function contentnewAction()
 {
     $this->toTpl('theInclude', 'form');
     $data = $this->_request->getParams();
     $data = $this->doQoolHook('pre_contentnew', $data);
     $this->addToBreadcrumb(array('itemlist', $this->t('Items List'), $data['id']));
     $this->addToBreadcrumb(array('contentnew', $this->t('Add Content Item'), $data['id']));
     //get all needed fields to build a form that will manage this content type
     $t = $this->getDbTables();
     $d = $t['data'];
     $sql = "SELECT * FROM {$d} WHERE `group_id`=" . (int) $data['id'] . " ORDER BY `order` ASC";
     $sel = $this->selectAll($sql);
     $sel = $this->doQoolHook('post_getdatafields', $sel);
     $form = new Zend_Form();
     $form = $this->addCSRF($form);
     $form->setView($this->tpl);
     $form->setAttrib('class', 'form-horizontal');
     $form->removeDecorator('dl');
     $form->setAction($this->config->host->folder . '/admin/addcontentitem')->setMethod('post');
     $contenttype = new Zend_Form_Element_Hidden('contenttype');
     $contenttype->setValue($data['id']);
     $form->addElement($contenttype);
     foreach ($sel as $k => $v) {
         $form->addElement($this->getFormElement($v));
     }
     //we need something to move the buttons down...
     $form->addElement('hidden', 'dummy', array('required' => false, 'ignore' => true, 'autoInsertNotEmptyValidator' => false, 'decorators' => array(array('HtmlTag', array('tag' => 'hr', 'id' => 'wmd-button-bar', 'class' => 'divider')))));
     $form->dummy->clearValidators();
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setAttrib('class', 'btn btn-primary');
     $submit->setDecorators(array("ViewHelper"));
     $submit->setLabel($this->t("Save"));
     $form->addElement($submit);
     $reset = new Zend_Form_Element_Reset('reset');
     $reset->setAttrib('class', 'btn');
     $reset->setDecorators(array("ViewHelper"));
     $reset->setLabel($this->t("Reset"));
     $form->addElement($reset);
     $this->toTpl('formTitle', $this->t("Add new content item"));
     $form = $this->doQoolHook('post_contentnew', $form);
     $this->toTpl('theForm', $form);
 }