Exemplo n.º 1
1
 public function __construct($options = null)
 {
     $this->_disabledDefaultActions = true;
     $this->_addRequiredAsterisks = false;
     parent::__construct($options);
     $baseDir = $this->getView()->baseUrl();
     $this->getView()->headLink()->appendStylesheet("{$this->getView()->baseUrl()}/themes/default/css/login.css", 'all');
     $this->setAttrib('class', 'login');
     $regexValidate = new Cible_Validate_Email();
     $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel($this->getView()->getClientText('login_form_email_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setAttrib('class', 'loginTextInput');
     $this->addElement($email);
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel($this->getView()->getClientText('login_form_password_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'loginTextInput')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))));
     $this->addElement($password);
     // checkbox for client persistance
     $status = new Zend_Form_Element_Checkbox('stayOn');
     $status->setLabel($this->getView()->getClientText('login_form_stayOn_label'));
     $status->setValue(1);
     $status->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd'))));
     $this->addElement($status);
     // Submit button
     $submit = new Zend_Form_Element_Submit('submit_login');
     $submit->setLabel('')->setAttrib('class', 'subscribeButton-' . Zend_Registry::get("languageSuffix"));
     $submit->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd'))));
     $this->addElement($submit);
     $this->setAttrib('class', 'login-form');
 }
Exemplo n.º 2
0
 protected function setupButtons()
 {
     $this->addButtons();
     $submitDecorators = $this->getButtonsDecorators();
     $this->submit->setDecorators($submitDecorators);
     $this->cancel->setDecorators($submitDecorators);
     $this->addDisplayGroup(array(self::BUTTON_CANCEL, self::BUTTON_SUBMIT), self::DISPLAY_GROUP_BUTTONS);
     $dg = $this->getDisplayGroup(self::DISPLAY_GROUP_BUTTONS);
     $dg->removeDecorator('Fieldset');
     $dg->removeDecorator('HtmlTag');
     $dg->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'li', 'class' => 'buttons'))));
 }
Exemplo n.º 3
0
 public function init()
 {
     $this->setName('transfer_source');
     $this->setAttrib('class', 'form-inline');
     $host1 = new Zend_Form_Element_Text('host1');
     $host1->setAttrib('class', 'form-control')->setLabel('host1')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('Hostname');
     $edit = new Zend_Form_Element_Hidden('edit');
     //$edit->setLabel('Edition Mode');
     //$edit->clearDecorators();
     $host1->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3'))));
     $user1 = new Zend_Form_Element_Text('user1');
     $user1->setLabel('user1')->setAttrib('class', 'form-control')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('EmailAddress');
     $user1->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3'))));
     $password1 = new Zend_Form_Element_Text('password1');
     $password1->setLabel('pass1')->setAttrib('class', 'form-control')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $password1->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3'))));
     $action = new Zend_Form_Element_Select('action');
     $action->setOptions(array('1' => 'source', '2' => 'target'));
     $action->setAttrib('class', 'form-control');
     $action->options = array('1' => 'source', '2' => 'target');
     $action->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-2'))));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Submit');
     $submit->setAttrib('class', 'btn btn-default');
     $submit->setAttrib('value', 'transfer_source');
     $submit->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'colspan' => 2, 'align' => 'center')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $this->addElements(array($edit, $host1, $user1, $password1, $action, $submit));
     $this->setDecorators(array('FormElements', 'Form'));
 }
Exemplo n.º 4
0
 /**
  *
  * Themes & styles
  *
  */
 public function init()
 {
     $cname = explode('_', get_class());
     $this->preInit(end($cname));
     // use template file
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsStyles.phtml'))));
     // load settings
     $AppOptions = new Application_Model_AppOptions();
     $all_meta = $AppOptions->getAllOptions();
     // fields
     $themes_array = array('/bootstrap/css/bootstrap.min.css' => 'Bootstrap');
     $css_theme = new Zend_Form_Element_Select('css_theme');
     $css_theme->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions($themes_array)->setErrorMessages(array($this->translator->translate('Please select')))->setLabel($this->translator->translate('Choose css theme'))->setRequired(true)->setValue(isset($all_meta['css_theme']) ? $all_meta['css_theme'] : 'bootstrap')->setAttrib('class', 'form-control');
     $wide_layout = new Zend_Form_Element_Checkbox('wide_layout');
     $wide_layout->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['wide_layout']) && $all_meta['wide_layout'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Extra-wide layout on large screens'))->setCheckedValue("1")->setUncheckedValue("0");
     $cover_ysize = new Zend_Form_Element_Text('cover_ysize');
     $cover_ysize->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Cover image height'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['cover_ysize']) ? $all_meta['cover_ysize'] : '220')->setAttrib('class', 'form-control');
     $user_background = new Zend_Form_Element_Checkbox('user_background');
     $user_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['user_background']) && $all_meta['user_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Users can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0");
     $subscriber_background = new Zend_Form_Element_Checkbox('subscriber_background');
     $subscriber_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['subscriber_background']) && $all_meta['subscriber_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Subscribers can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0");
     $custom_css = new Zend_Form_Element_Textarea('css_custom');
     $custom_css->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '15')->setValue(isset($all_meta['css_custom']) ? $all_meta['css_custom'] : '')->setLabel($this->translator->translate('Custom css'))->setAttrib('class', 'form-control');
     $submit = new Zend_Form_Element_Submit('submitbtn');
     $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default');
     $this->addElements(array($css_theme, $wide_layout, $cover_ysize, $user_background, $subscriber_background, $custom_css, $submit));
     $this->postInit();
 }
Exemplo n.º 5
0
 /**
  *
  * Edit Group form
  *
  */
 public function init()
 {
     $cname = explode('_', get_class());
     $this->preInit(end($cname));
     // use template file
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/EditGroup.phtml'))));
     // get group from database
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $group = $request->getParam('name');
     $Profiles = new Application_Model_Profiles();
     $ProfilesMeta = new Application_Model_ProfilesMeta();
     $profile = $Profiles->getProfile($group, false, true);
     $owners_profile = $Profiles->getProfileByField('id', $profile->owner);
     $username_minchars = Zend_Registry::get('config')->get('username_minchars');
     $username_maxchars = Zend_Registry::get('config')->get('username_maxchars');
     // fields
     $id = new Zend_Form_Element_Hidden('id');
     $id->setValue($profile->id);
     $name = new Zend_Form_Element_Text('name');
     $name->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Group Name'))->setValue($profile->name)->setIgnore(true)->setAttrib('readonly', true)->setAttrib('class', 'form-control');
     $screenname = new Zend_Form_Element_Text('screen_name');
     $screenname->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->setValue($profile->screen_name)->addValidator('alnum', false, array('allowWhiteSpace' => true))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid name between %d and %d characters'), $username_minchars, $username_maxchars)))->setLabel($this->translator->translate('Screen Name'))->setRequired(true)->setAttrib('class', 'form-control');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setValue($ProfilesMeta->getMetaValue('description', $profile->id))->setLabel($this->translator->translate('About this group'))->setAttrib('class', 'form-control');
     $profile_privacy = new Zend_Form_Element_Select('profile_privacy');
     $profile_privacy->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions(Zend_Registry::get('group_privacy_array'))->setErrorMessages(array($this->translator->translate('Select group visibility')))->setLabel($this->translator->translate('Select group visibility'))->setRequired(true)->setValue($profile->profile_privacy)->setAttrib('class', 'form-control');
     $is_hidden = new Zend_Form_Element_Checkbox('is_hidden');
     $is_hidden->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($profile->is_hidden) && $profile->is_hidden == 1 ? 1 : 0)->setLabel($this->translator->translate('Remove?'))->setCheckedValue("1")->setUncheckedValue("0");
     $submit = new Zend_Form_Element_Submit('formsubmit');
     $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default');
     $this->addElements(array($id, $name, $screenname, $profile_privacy, $description, $is_hidden, $submit));
     $this->postInit();
 }
Exemplo n.º 6
0
 public function init()
 {
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel(_("Confirm"))->setAttrib('id', 'submitbutton')->setAttrib('class', 'btn btn-primary pull-right');
     $submit->setDecorators(array('ViewHelper', 'Description', 'Errors'));
     $this->addElement($this->_admin())->addElement($this->_tipo_usuario())->addElement($submit);
 }
Exemplo n.º 7
0
 /**
  * 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');
     $username = new Zend_Form_Element_Text('username');
     // $this->t = Zend_Registry::get('Zend_Translate');
     $username->setOptions(array('label' => $this->t('Username'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($username);
     $password = new Zend_Form_Element_Password('password');
     $password->setOptions(array('label' => $this->t('Password'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($password);
     $authentification = new LoginAttempt();
     if ($authentification->canAttemptToLogin() == FALSE) {
         $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $this->t("no humain"), 'captcha' => array("captcha" => "Image", "wordLen" => 4, "font" => "font/tahoma.ttf", "height" => 100, "width" => 300, "fontSize" => 50, "imgDir" => "data/captchas", "imgUrl" => "data/captchas")));
         $this->addElement($captcha);
     }
     $connexion = new Zend_Form_Element_Submit('Connexion');
     $connexion->setOptions(array('label' => $this->t('Log In')));
     $connexion->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'dd', 'openOnly' => true))));
     $this->addElement($connexion);
     $inscription = new Zend_Form_Element_Submit('inscription');
     $inscription->setOptions(array('label' => $this->t('Sign Up')));
     $inscription->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'dd', 'closeOnly' => true))));
     $this->addElement($inscription);
     $this->clearDecorators();
 }
Exemplo n.º 8
0
 public function init()
 {
     $this->setName('f2')->setMethod('post');
     $nams = Default_Model_Constraints::nam();
     $namOption = array("multiOptions" => $nams);
     $nam = new Zend_Form_Element_Select('nam', $namOption);
     $nam->setValue(date('Y'))->setLabel('Năm (*)')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'nam'));
     $bizHDD = new Default_Model_Hdd();
     $hdds = $bizHDD->getDSHDByNam(date('Y'));
     if ($hdds == null) {
         $hdsOptions = array("multiOptions" => array('-1' => '== Chưa thành lập =='));
     } else {
         $hdds = array('0' => '== Tất cả ==') + $hdds;
         $hddsOptions = array("multiOptions" => $hdds);
     }
     $noi_nhan = new Zend_Form_Element_Select('noi_nhan', $hddsOptions);
     $noi_nhan->setRequired(true)->setLabel('Hội đồng')->setValue('0')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_nhan'))->setRegisterInArrayValidator(false);
     $tieu_de = new Zend_Form_Element_Text('tieu_de');
     $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $noi_dung = new Zend_Form_Element_Textarea('noi_dung');
     $noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $url = new Zend_View_Helper_Url();
     $link = $url->url(array('module' => 'admin', 'controller' => 'hoi-dong', 'action' => 'ds-mail-tb'), null, true);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($nam, $noi_nhan, $tieu_de, $noi_dung, $submit, $cancel));
     $this->addDisplayGroup(array('submit', 'cancel'), 'btn_submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
 }
Exemplo n.º 9
0
 public function init()
 {
     $this->setMethod('post');
     //        $this->setAction('/index/login');
     $this->setAttrib('id', 'msform');
     $email = new Zend_Form_Element_Text('email');
     $email->setAttrib('placeholder', 'E-mail');
     $email->setAttrib('autocomplete', 'off');
     $email->addFilter('StripTags');
     $email->addFilter('HtmlEntities');
     $email->addFilter('StringTrim');
     $email->setRequired(true)->addErrorMessage('Username Required');
     $email->addValidator('EmailAddress')->addErrorMessage('Invalid Email used');
     $email->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
     $password = new Zend_Form_Element_Password('password');
     $password->setAttrib('placeholder', 'Password');
     $password->setAttrib('autocomplete', 'off');
     $password->addFilter('StripTags');
     $password->addFilter('HtmlEntities');
     $password->addFilter('StringTrim');
     $password->setRequired(true)->addErrorMessage('Password Required');
     $password->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
     $link = new Zend_Form_Element_Note('forgot_password', array('value' => '<a href="#" id="link">Forgot your password ?</a>'));
     $submit = new Zend_Form_Element_Submit('SignIn');
     $submit->setLabel('Sign In');
     $submit->setAttrib('class', 'btn btn-info');
     $register = new Zend_Form_Element_Button('register');
     $register->setLabel('Register');
     $register->setAttrib('class', 'btn btn-warning');
     $this->addElements(array($email, $password, $submit, $register, $link));
     $this->setElementDecorators(array('ViewHelper'));
     $submit->setDecorators(array('ViewHelper'));
     $register->setDecorators(array('ViewHelper'));
     $this->setDecorators(array('FormElements', 'Form'));
 }
Exemplo n.º 10
0
 public function init()
 {
     $this->setName('f2')->setMethod('post')->setAttribs(array('id' => 'user'));
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int')->removeDecorator('label');
     $username = new Zend_Form_Element_Text('ten_dang_nhap');
     $username->setLabel('Tên đăng nhập (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 32))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 83%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ten_dang_nhap', 'class' => 'text-input'));
     $password = new Zend_Form_Element_Password('mat_khau');
     $password->setLabel('Mật khẩu (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mat_khau', 'class' => 'text-input'));
     $repassword = new Zend_Form_Element_Password('mat_khau_2');
     $repassword->setLabel('Nhập lại mật khẩu (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator(new Zend_Validate_Identical('mat_khau'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mat_khau_2', 'class' => 'text-input'));
     $ho = new Zend_Form_Element_Text('ho');
     $ho->setLabel('Họ (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 100))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 83%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ho', 'class' => 'text-input'));
     $ten = new Zend_Form_Element_Text('ten');
     $ten->setLabel('Tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 20))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ten', 'class' => 'text-input'));
     $ngay_sinh = new Zend_Form_Element_Text('ngay_sinh');
     $ngay_sinh->setLabel('Ngày sinh (*)')->setDescription('(dd-mm-YYYY)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'span')), array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ngay_sinh', 'class' => 'text-input'));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_EmailAddress())->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'email', 'class' => 'text-input'));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $url = new Zend_View_Helper_Url();
     $link = $url->url(array('module' => 'admin', 'controller' => 'index', 'action' => 'index'));
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($id, $username, $password, $repassword, $ho, $ten, $ngay_sinh, $email, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submitbtn', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
 }
Exemplo n.º 11
0
 public function init()
 {
     $this->setName('f2')->setMethod('get');
     //->setAction(Khcn_View_Helper_GetBaseUrl::getBaseUrl() . '/de-tai/cap-nhat-session');
     $sorts = array('' => '', 'ma' => 'Mã', 'nam' => 'Năm');
     $sortsOption = array("multiOptions" => $sorts);
     $order = new Zend_Form_Element_Select('order', $sortsOption);
     $order->setLabel('<strong>Sắp xếp theo</strong> : ')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array('Label', array('tag' => 'span', 'escape' => false)), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'class' => 'order'))))->setAttribs(array('id' => 'order'));
     $directions = array('asc' => 'Tăng dần', 'desc' => 'Giảm dần');
     $directionsOption = array("multiOptions" => $directions);
     $direction = new Zend_Form_Element_Select('direction', $directionsOption);
     $direction->setLabel('')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array('Label', array('tag' => 'span', 'escape' => false)), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'class' => 'direction'))))->setAttribs(array('id' => 'direction', 'style' => 'display : none'));
     $nams = array();
     for ($i = 2005; $i < 2030; $i++) {
         $nams[$i] = $i;
     }
     $nams = array('0' => '------') + $nams;
     $namsOption = array("multiOptions" => $nams);
     $from = new Zend_Form_Element_Select('from', $namsOption);
     $from->setLabel('<strong>Danh sách đề tài</strong> : Từ ')->setValue(date('Y'))->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array('Label', array('tag' => 'span', 'escape' => false)), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'class' => 'from'))))->setAttribs(array('id' => 'from'));
     $to = new Zend_Form_Element_Select('to', $namsOption);
     $to->setLabel('Đến ')->setValue(date('Y') + 1)->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'class' => 'to'))))->setAttribs(array('id' => 'to'));
     $submit = new Zend_Form_Element_Submit('loc');
     $submit->setLabel('Lọc');
     $submit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))));
     $this->addElements(array($order, $direction, $from, $to, $submit));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'span', 'class' => 'search_dt')), 'Form'));
 }
Exemplo n.º 12
0
 public function init()
 {
     $this->setName('f2')->setMethod('post');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int');
     $ma = new Zend_Form_Element_Text('ma');
     $ma->setLabel('Mã (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 10))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input');
     $ten = new Zend_Form_Element_Text('ten');
     $ten->setLabel('Tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input');
     $mo_ta = new Zend_Form_Element_Textarea('mo_ta');
     $mo_ta->setLabel('Mô tả')->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta', 'class' => 'textarea', 'rows' => '4'));
     $loai_lv = new Default_Model_LoaiLinhVuc();
     $llvOptions = array("multiOptions" => $loai_lv->getMultiOptions());
     $ma_loai = new Zend_Form_Element_Select('ma_loai', $llvOptions);
     $ma_loai->setLabel('Loại lĩnh vực')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $url = new Zend_View_Helper_Url();
     $link = $url->url(array('module' => 'admin', 'controller' => 'linh-vuc', 'action' => 'index'), null, true);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($id, $ma, $ten, $mo_ta, $ma_loai, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'linh_vuc')), 'Form'));
 }
Exemplo n.º 13
0
 public function init()
 {
     $this->setName('f2')->setMethod('post');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int');
     $ma = new Zend_Form_Element_Text('ma');
     $ma->setLabel('Mã')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToUpper')->addValidator(new Zend_Validate_StringLength(0, 10))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input'));
     $ten = new Zend_Form_Element_Text('ten');
     $ten->setLabel('Tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 250))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input');
     $ofSGUOptions = array("multiOptions" => array('1' => 'Thuộc', '0' => 'Không thuộc'));
     $thuoc_sgu = new Zend_Form_Element_Radio('thuoc_sgu', $ofSGUOptions);
     $thuoc_sgu->setRequired(true)->setLabel('Thuộc SGU')->setValue('1')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'class' => 'radio_inline'))))->setAttribs(array('id' => 'thuoc_sgu'));
     $deptOptions = array("multiOptions" => array('1' => 'Khoa - Bộ môn TT', '0' => 'Phòng ban - Trung tâm'));
     $la_khoa = new Zend_Form_Element_Radio('la_khoa', $deptOptions);
     $la_khoa->setRequired(true)->setLabel('Loại đơn vị')->setValue('1')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'la_khoa', 'class' => 'radio_inline'))));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $url = new Zend_View_Helper_Url();
     $link = $url->url(array('module' => 'admin', 'controller' => 'don-vi', 'action' => 'index'), null, true);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($id, $ma, $ten, $thuoc_sgu, $la_khoa, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'don_vi')), 'Form'));
 }
Exemplo n.º 14
0
 public function init()
 {
     $this->setName('f2')->setMethod('post');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int');
     $ma = new Zend_Form_Element_Text('ma');
     $ma->setLabel('Mã')->addFilter('StripTags')->addFilter('StringTrim')->addValidator(new Zend_Validate_StringLength(0, 10))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input'));
     $ho_ten = new Zend_Form_Element_Text('ho_ten');
     $ho_ten->setLabel('Họ tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 120))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input');
     $chuc_vu = new Zend_Form_Element_Text('chuc_vu');
     $chuc_vu->setLabel('Chức vụ')->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input');
     $don_vi = new Default_Model_DonVi();
     $dvOptions = array("multiOptions" => $don_vi->getDSDV());
     $ma_don_vi = new Zend_Form_Element_Select('ma_don_vi', $dvOptions);
     $ma_don_vi->setRequired(true)->setLabel('Đơn vị (*)')->setValue(Default_Model_Constraints::ID_DHSG)->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $hoc_vi = new Default_Model_HocVi();
     $hvOptions = array("multiOptions" => $hoc_vi->getDSHV());
     $ma_hoc_vi = new Zend_Form_Element_Select('ma_hoc_vi', $hvOptions);
     $ma_hoc_vi->setRequired(true)->setLabel('Học vị (*)')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->addFilter('StripTags')->addFilter('StringTrim')->addValidator(new Zend_Validate_EmailAddress())->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'id' => 'email'));
     $so_dien_thoai = new Zend_Form_Element_Text('so_dien_thoai');
     $so_dien_thoai->setLabel('Số điện thoại')->addFilter('StringTrim')->addValidator(new Zend_Validate_Int())->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'onkeypress' => 'return inputNumber(event)'));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $link = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => 'admin', 'controller' => 'giang-vien', 'action' => 'index'), null, true);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($id, $ma, $ho_ten, $ma_don_vi, $ma_hoc_vi, $chuc_vu, $email, $so_dien_thoai, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'giang_vien')), 'Form'));
 }
Exemplo n.º 15
0
 public function init()
 {
     $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post');
     $this->addElement('Hidden', 'search', array('value' => 1));
     $tieu_de = new Zend_Form_Element_Text('tieu_de');
     $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $cateOptions = Khcn_Api::_()->getDbTable('loai_audio', 'default')->getListAssoc();
     $loai_audio_id = new Zend_Form_Element_Select('loai_audio_id');
     $loai_audio_id->setLabel('Loại (*)')->addMultiOptions($cateOptions)->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input');
     $noi_dung = new Zend_Form_Element_Textarea('noi_dung');
     $noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea'));
     $soundcloud_embed = new Zend_Form_Element_Text('soundcloud_embed');
     $soundcloud_embed->setLabel('Embed SoundCloud')->setDescription('How to get SoundCloud embed code? <a href="http://help.soundcloud.com/customer/portal/articles/243751-how-can-i-put-my-track-or-playlist-on-my-site-or-blog-" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai());
     $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions);
     $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '"'));
     $this->addElements(array($tieu_de, $loai_audio_id, $noi_dung, $soundcloud_embed, $trang_thai, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
 }
 /**
  *
  * Change network background
  *
  */
 public function init()
 {
     $cname = explode('_', get_class());
     $this->preInit(end($cname));
     // use template file
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsBackground.phtml'))));
     // load settings
     $AppOptions = new Application_Model_AppOptions();
     $all_meta = $AppOptions->getAllOptions();
     // fields
     $background_image = new Zend_Form_Element_File('background');
     $background_image->setDecorators(array('File', 'Errors'))->setLabel($this->translator->translate('Choose Picture (jpg, png or gif)'))->addValidator('Extension', false, 'jpg,jpeg,png,gif');
     $background_color = new Zend_Form_Element_Text('background_color');
     $background_color->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->setValue(isset($all_meta['background_color']) ? $all_meta['background_color'] : 'ff0000')->setErrorMessages(array($this->translator->translate('Please pick a color')))->setLabel($this->translator->translate('Background Color'))->setRequired(true)->setAttrib('class', 'form-control colorpicker-input');
     $background_repeat = new Zend_Form_Element_Checkbox('background_repeat');
     $background_repeat->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_repeat']) && $all_meta['background_repeat'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Repeat background'))->setCheckedValue("1")->setUncheckedValue("0");
     $background_scroll = new Zend_Form_Element_Checkbox('background_scroll');
     $background_scroll->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_scroll']) && $all_meta['background_scroll'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Scroll background'))->setCheckedValue("1")->setUncheckedValue("0");
     $background_stretch = new Zend_Form_Element_Checkbox('background_stretch');
     $background_stretch->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_stretch']) && $all_meta['background_stretch'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Stretch background'))->setCheckedValue("1")->setUncheckedValue("0");
     $disable_image = new Zend_Form_Element_Checkbox('background_noimage');
     $disable_image->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_noimage']) && $all_meta['background_noimage'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable custom image'))->setCheckedValue("1")->setUncheckedValue("0");
     $submit = new Zend_Form_Element_Submit('formsubmit');
     $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default');
     $this->addElements(array($background_image, $background_repeat, $background_scroll, $background_stretch, $disable_image, $background_color, $submit));
     $this->postInit();
 }
Exemplo n.º 17
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAction('/login');
     $this->setOptions(array('class' => 'niceform', 'id' => 'form1'));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
     //$this->getDecorator('HtmlTag')->setOptions(array('tag' => 'fieldset'));
     /*$this->setDecorators(array(
       				'Errors',
         			'FormElements',
        				array('HtmlTag', array('tag' => 'fieldset')),
         			'Form'
     		));*/
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel('username');
     $username->setRequired(true);
     $username->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array('Label', array('tag' => 'td'), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))));
     $pass = new Zend_Form_Element_Password('password');
     $pass->setlabel('password');
     $pass->setRequired(true);
     $pass->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array('Label', array('tag' => 'td'), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))));
     /*
     $pass->setDecorators(array(
     	      		'ViewHelper',
      		'Errors',
     	      		array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')),
     	      		array(array('label' => 'HtmlTag'), array('tag' => 'td', 'placement' => 'prepend')),
     	      		array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
     	      ));
     */
     $submit = new Zend_Form_Element_Submit('login');
     $submit->setLabel('login');
     $submit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array(array('label' => 'HtmlTag'), array('tag' => 'td', 'placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $this->addElements(array($username, $pass, $submit));
 }
Exemplo n.º 18
0
 /**
  *
  * Change notifications form
  *
  */
 public function init()
 {
     $cname = explode('_', get_class());
     $this->preInit(end($cname));
     // use template file
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/Notifications.phtml'))));
     // fields
     $ProfilesMeta = new Application_Model_ProfilesMeta();
     $notifications_meta = json_decode($ProfilesMeta->getMetaValue('bulk_notifications'), true);
     $n1 = new Zend_Form_Element_Checkbox('notification_email_1');
     $n1->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($notifications_meta['notification_email_1']) && $notifications_meta['notification_email_1'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Email when someone posts a new comment'))->setCheckedValue("1")->setUncheckedValue("0");
     $n2 = new Zend_Form_Element_Checkbox('notification_email_2');
     $n2->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($notifications_meta['notification_email_2']) && $notifications_meta['notification_email_2'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Email when someone likes your post'))->setCheckedValue("1")->setUncheckedValue("0");
     $n3 = new Zend_Form_Element_Checkbox('notification_email_3');
     $n3->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($notifications_meta['notification_email_3']) && $notifications_meta['notification_email_3'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Email when someone follows you'))->setCheckedValue("1")->setUncheckedValue("0");
     $n4 = new Zend_Form_Element_Checkbox('notification_email_4');
     $n4->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($notifications_meta['notification_email_4']) && $notifications_meta['notification_email_4'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Email on new friends'))->setCheckedValue("1")->setUncheckedValue("0");
     $n6 = new Zend_Form_Element_Checkbox('notification_email_6');
     $n6->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($notifications_meta['notification_email_6']) && $notifications_meta['notification_email_6'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Email when you lose a follower'))->setCheckedValue("1")->setUncheckedValue("0");
     $n7 = new Zend_Form_Element_Checkbox('notification_email_7');
     $n7->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($notifications_meta['notification_email_7']) && $notifications_meta['notification_email_7'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Email when someone posts on your wall'))->setCheckedValue("1")->setUncheckedValue("0");
     $n8 = new Zend_Form_Element_Checkbox('notification_email_8');
     $n8->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($notifications_meta['notification_email_8']) && $notifications_meta['notification_email_8'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Email when someone sends you a private message'))->setCheckedValue("1")->setUncheckedValue("0");
     $submit = new Zend_Form_Element_Submit('submitbtn');
     $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default');
     $this->addElements(array($n1, $n2, $n3, $n4, $n6, $n7, $n8, $submit));
     $this->postInit();
 }
Exemplo n.º 19
0
 public function init()
 {
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel(_("Confirm"))->setAttrib('id', 'submitbutton')->setAttrib('class', 'btn btn-primary pull-right');
     $submit->setDecorators(array('ViewHelper', 'Description', 'Errors'));
     $this->addElements(array($this->_id_encontro(), $this->_tipo_mensagem_certificado(), $this->_mensagem(), $submit));
 }
Exemplo n.º 20
0
 public function init()
 {
     $this->setName('param');
     $this->setAttrib('class', 'form-inline');
     $host1 = new Zend_Form_Element_Text('host1');
     $host1->setAttrib('class', 'form-control')->setLabel('host1')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('Hostname');
     $host1->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-md-4')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'row form-inline', 'openOnly' => true))));
     $user1 = new Zend_Form_Element_Text('user1');
     $user1->setLabel('user1')->setAttrib('class', 'form-control')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('EmailAddress');
     $user1->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-md-4'))));
     $password1 = new Zend_Form_Element_Text('password1');
     $password1->setLabel('pass1')->setAttrib('class', 'form-control')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $password1->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-md-4')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'closeOnly' => 'true'))));
     $host2 = new Zend_Form_Element_Text('host2');
     $host2->setAttrib('class', 'form-control')->setLabel('host2')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('Hostname');
     $host2->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-md-4')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'row', 'openOnly' => true))));
     $user2 = new Zend_Form_Element_Text('user2');
     $user2->setLabel('user2')->setAttrib('class', 'form-control')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('EmailAddress');
     $user2->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-md-4'))));
     $password2 = new Zend_Form_Element_Text('password2');
     $password2->setLabel('pass2')->setAttrib('class', 'form-control')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $password2->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-md-4')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'closeOnly' => 'true'))));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Submit');
     $submit->setAttrib('class', 'btn btn-default');
     $submit->setAttrib('value', 'transfer_source');
     $submit->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-md-4 col-md-offset-4 text-center'))));
     $this->addElements(array($host1, $user1, $password1, $host2, $user2, $password2, $submit));
     $this->setDecorators(array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-inline')), 'Form'));
 }
Exemplo n.º 21
0
 /**
  *
  * Change password form
  *
  */
 public function init()
 {
     $cname = explode('_', get_class());
     $this->preInit(end($cname));
     // use template file
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/ChangePassword.phtml'))));
     $Profiles = new Application_Model_Profiles();
     // fields
     $password_old = new Zend_Form_Element_Password('passwordold');
     $password_old->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('autocomplete', 'off')->setRequired(true)->setErrorMessages(array($this->translator->translate('Password is required')))->setLabel($this->translator->translate('Old Password:'******'class', 'form-control');
     // check if blank password (facebook-registered user) and remove old password field if so
     if (Zend_Auth::getInstance()->hasIdentity()) {
         $profile = $Profiles->getProfile(Zend_Auth::getInstance()->getIdentity()->name);
         if ($profile->password == '') {
             $password_old->setAttrib('class', 'hidden');
             $password_old->setRequired(false);
             $password_old->setLabel('');
         }
     }
     $password1 = new Zend_Form_Element_Password('password1');
     $password1->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('autocomplete', 'off')->setRequired(true)->addValidator('StringLength', false, array(5))->setErrorMessages(array($this->translator->translate('Min 5 characters')))->setLabel($this->translator->translate('New Password:'******'class', 'form-control');
     $password2 = new Zend_Form_Element_Password('password2');
     $password2->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('autocomplete', 'off')->setRequired(true)->addValidator('Identical', false, array('token' => 'password1'))->setErrorMessages(array($this->translator->translate('The passwords do not match')))->setLabel($this->translator->translate('Confirm Password:'******'class', 'form-control');
     $submit = new Zend_Form_Element_Submit('changepass');
     $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Change Password'))->setAttrib('class', 'submit btn btn-default');
     $this->addElements(array($password_old, $password1, $password2, $submit));
     $this->postInit();
 }
Exemplo n.º 22
0
 public function init()
 {
     $this->setName('f2')->setMethod('post');
     $ten = new Zend_Form_Element_Text('ten');
     $ten->setLabel('Tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 255))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input medium-input'));
     $statusOptions = array("multiOptions" => array(1 => 'Thuộc SGU', 0 => 'Liên kết trang mạng'));
     $is_sgu = new Zend_Form_Element_Radio('is_sgu', $statusOptions);
     $is_sgu->setRequired(true)->setLabel('Liên kết')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $url = new Zend_Form_Element_Text('url');
     $url->setLabel('Url (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 255))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input');
     $file = new Zend_Form_Element_File('file');
     $file->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/small/images/lien_ket')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $maxOrder = Khcn_Api::_()->getDbTable('lien_ket', 'default')->getMaxOrderItem();
     $order = new Zend_Form_Element_Text('order');
     $order->setLabel('Thứ tự *')->setValue($maxOrder->order + 1)->addValidator(new Zend_Validate_Int())->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input tinysmall-input'));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $Url = new Zend_View_Helper_Url();
     $link = $Url->url(array('module' => 'admin', 'controller' => 'lien-ket', 'action' => 'index'), null, true);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($ten, $is_sgu, $url, $file, $order, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'lien_ket')), 'Form'));
 }
Exemplo n.º 23
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);
 }
Exemplo n.º 24
0
 public function init()
 {
     $bookingid = new Zend_Form_Element_Hidden("booking_id");
     $priceModel = new Admin_Model_Price();
     $fromOption = $priceModel->getAllLocation();
     $toOption = $priceModel->getAllLocation(true);
     $numberOption = array();
     for ($i = 1; $i <= 20; $i++) {
         $numberOption[$i] = $i;
     }
     $timeOption = array();
     for ($j = 0; $j <= 23; $j++) {
         $timeOption[$j] = strlen($j) == 1 ? "0" . $j . ":00" : $j . ":00";
     }
     $pickupLocation = new Zend_Form_Element_Select("pickup_location");
     $pickupLocation->setLabel("Pickup Location")->setAttribs(array('class' => 'form-select', 'id' => 'pickup-location'))->addmultiOptions($fromOption)->setRequired(true);
     $returnLocation = new Zend_Form_Element_Select('return_location');
     $returnLocation->setLabel('Return Location')->setAttribs(array('class' => 'form-select', 'id' => 'return-location'))->addmultiOptions($toOption)->setRequired(true);
     $number = new Zend_Form_Element_Select("number");
     $number->setLabel("Number Of Vehicals")->setAttribs(array('class' => 'form-select'))->addmultiOptions($numberOption)->setRequired(true);
     $pickupDate = new Zend_Form_Element_Text("pickup_date");
     $pickupDate->setLabel("Pickup Date")->setAttribs(array('class' => 'form-text'))->setRequired(true);
     $returnDate = new Zend_Form_Element_Text("return_date");
     $returnDate->setLabel("Return Date")->setAttribs(array('class' => 'form-text'))->setRequired(true);
     $pickuptime = new Zend_Form_Element_Select("pickup_time");
     $pickuptime->setLabel("Pickup Time")->setAttribs(array('class' => 'form-number-select'))->addmultiOptions($timeOption)->setRequired(true);
     $returnTime = new Zend_Form_Element_Select("return_time");
     $returnTime->setLabel("Return Time")->setAttribs(array('class' => 'form-number-select'))->addmultiOptions($timeOption)->setRequired(true);
     $submit = new Zend_Form_Element_Submit("submit");
     $submit->setLabel("Book Now");
     $this->addElements(array($bookingid, $pickupLocation, $returnLocation, $number, $pickupDate, $pickuptime, $returnDate, $returnTime, $submit));
     $this->setElementDecorators(array('viewHelper', 'Errors'));
     $submit->setDecorators(array('viewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'submit-wrapper')), array('Label', array('tag' => 'div'))));
     $submit->removeDecorator("label");
 }
Exemplo n.º 25
0
 public function init()
 {
     $this->setName('transfer_target');
     $this->setAttrib('class', 'form-inline');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int');
     $host2 = new Zend_Form_Element_Text('host2');
     $host2->setAttrib('class', 'form-control')->setLabel('host2');
     $host2->setDecorators(array('ViewHelper', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3'))));
     $user2 = new Zend_Form_Element_Text('user2');
     $user2->setLabel('user2');
     $user2->setAttrib('class', 'form-control');
     $user2->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3'))));
     $password2 = new Zend_Form_Element_Text('password2');
     $password2->setLabel('pass2');
     $password2->setAttrib('class', 'form-control');
     $password2->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3'))));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Submit');
     $submit->setAttrib('class', 'btn btn-default');
     $submit->setValue('transfer_target');
     $submit->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'colspan' => 2, 'align' => 'center')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $this->addElements(array($host2, $user2, $password2, $submit));
     $this->setDecorators(array('FormElements', 'Form'));
 }
Exemplo n.º 26
0
 /**
  *
  * Edit Album form
  *
  */
 public function init()
 {
     $cname = explode('_', get_class());
     $this->preInit(end($cname));
     // use template file
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/EditAlbum.phtml'))));
     // get group from database
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $album_id = $request->getParam('id');
     $Albums = new Application_Model_Albums();
     $album = $Albums->getAlbum($album_id);
     $username_minchars = Zend_Registry::get('config')->get('username_minchars');
     $username_maxchars = Zend_Registry::get('config')->get('username_maxchars');
     // fields
     $id = new Zend_Form_Element_Hidden('id');
     $id->setValue($album);
     $album_name = new Zend_Form_Element_Text('album_name');
     $album_name->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->addValidator('alnum', false, array('allowWhiteSpace' => true))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid name between %d and %d characters'), $username_minchars, $username_maxchars)))->setLabel($this->translator->translate('Album Name'))->setRequired(true)->setValue($album['name'])->setAttrib('class', 'form-control');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setValue($album['description'])->setLabel($this->translator->translate('About this album'))->setAttrib('class', 'form-control');
     $submit = new Zend_Form_Element_Submit('formsubmit');
     $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default');
     $this->addElements(array($id, $album_name, $description, $submit));
     $this->postInit();
 }
Exemplo n.º 27
0
 public function init()
 {
     $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post');
     $this->addElement('Hidden', 'search', array('value' => 1));
     $tieu_de = new Zend_Form_Element_Text('tieu_de');
     $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $quan_trong = new Zend_Form_Element_Select('quan_trong');
     $quan_trong->setLabel('Quan Trọng')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $noi_bat = new Zend_Form_Element_Select('noi_bat');
     $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $photo = new Zend_Form_Element_File('photo');
     $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/tin_tuc')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $image = new Zend_Form_Element_Image('image');
     $image->setLabel('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai());
     $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions);
     $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $mo_ta_tom_tat = new Zend_Form_Element_Textarea('mo_ta_tom_tat');
     $mo_ta_tom_tat->setLabel('Mô tả tóm tắt')->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta_tom_tat', 'class' => 'textarea', 'rows' => '4'));
     $mo_ta_chi_tiet = new Zend_Form_Element_Textarea('mo_ta_chi_tiet');
     $mo_ta_chi_tiet->setLabel('Mô tả chi tiết (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta_chi_tiet', 'class' => 'text-input textarea'));
     $pdf = new Zend_Form_Element_File('pdf');
     $pdf->setLabel('Upload PDF')->setDescription('(*.pdf < 10MB )')->setDestination(BASE_PATH . '/upload/files/tin_tuc')->addValidator(new Zend_Validate_File_Extension(array('pdf')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $url = new Zend_View_Helper_Url();
     $link = $url->url(array('module' => 'admin', 'controller' => 'tin-tuc', 'action' => 'index'), null, true);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($tieu_de, $quan_trong, $noi_bat, $photo, $image, $pdf, $trang_thai, $mo_ta_tom_tat, $mo_ta_chi_tiet, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'tin_tuc')), 'Form'));
 }
Exemplo n.º 28
0
 public function init()
 {
     $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post');
     $this->addElement('Hidden', 'search', array('value' => 1));
     $tieu_de = new Zend_Form_Element_Text('tieu_de');
     $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $cateOptions = Khcn_Api::_()->getDbTable('loai_thong_tin', 'default')->getListAssoc();
     $loai_thong_tin_id = new Zend_Form_Element_Select('loai_thong_tin_id');
     $loai_thong_tin_id->setLabel('Loại (*)')->addMultiOptions($cateOptions)->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input');
     $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai());
     $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions);
     $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $noi_dung = new Zend_Form_Element_Textarea('noi_dung');
     $noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea'));
     $noi_bat = new Zend_Form_Element_Select('noi_bat');
     $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $photo = new Zend_Form_Element_File('photo');
     $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/thong_tin')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '"'));
     $this->addElements(array($loai_thong_tin_id, $tieu_de, $noi_dung, $trang_thai, $noi_bat, $photo, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
 }
Exemplo n.º 29
0
 public function init()
 {
     $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post');
     $this->addElement('Hidden', 'search', array('value' => 1));
     $tieu_de = new Zend_Form_Element_Text('tieu_de');
     $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $noi_dung = new Zend_Form_Element_Textarea('noi_dung');
     $noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea'));
     $soundcloud_embed = new Zend_Form_Element_Text('soundcloud_embed');
     $soundcloud_embed->setLabel('Embed SoundCloud')->setDescription('How to get SoundCloud embed code? <a href="http://help.soundcloud.com/customer/portal/articles/243751-how-can-i-put-my-track-or-playlist-on-my-site-or-blog-" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $youtube_embed = new Zend_Form_Element_Text('youtube_embed');
     $youtube_embed->setLabel('Embed Youtube')->setDescription('How to get Youtube embed code? <a href="https://support.google.com/youtube/answer/171780?hl=en" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $link_nct = new Zend_Form_Element_Text('link_nct');
     $link_nct->setLabel('Nhac cua tui')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $link_mp3 = new Zend_Form_Element_Text('link_mp3');
     $link_mp3->setLabel('Mp3')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
     $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai());
     $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions);
     $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $noi_bat = new Zend_Form_Element_Select('noi_bat');
     $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $photo = new Zend_Form_Element_File('photo');
     $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/bai_giang')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '"'));
     $this->addElements(array($tieu_de, $noi_dung, $soundcloud_embed, $youtube_embed, $link_nct, $link_mp3, $trang_thai, $noi_bat, $photo, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
 }
Exemplo n.º 30
0
 public function __construct($parent = null, $options = null)
 {
     parent::__construct($options);
     $parentId = 0;
     if ($parent != null) {
         $parentId = $parent;
     }
     $translate = Zend_Registry::get('Zend_Translate');
     $this->setName('add_group_form');
     $this->addElementPrefixPath('Oibs_Form_Decorator', 'Oibs/Form/Decorator/', 'decorator');
     $clear = '<div class="clear"></div>';
     // Group name (must be unique).
     $groupname = new Zend_Form_Element_Text('groupname');
     $groupname->setLabel('Name')->setRequired(true)->setFilters(array('StringTrim'))->setValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty'))), new Oibs_Validators_GroupExists('groupname'), array('StringLength', false, array(1, 140, 'messages' => array('stringLengthTooLong' => 'Name too long.')))))->setDescription('<div id="progressbar_groupname" class="limit ok"></div>')->setDecorators(array('FieldDecorator'));
     $groupname_clear = new Oibs_Form_Element_Note('groupname_clear');
     $groupname_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // Lead paragraph (description)
     $groupdesc = new Zend_Form_Element_Textarea('groupdesc');
     $groupdesc->setAttrib('cols', '45')->setAttrib('rows', '6')->setLabel('Lead paragraph')->setRequired(true)->setFilters(array('StringTrim'))->setValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Description can't be empty."))), array('StringLength', false, array(1, 320, 'messages' => array('stringLengthTooLong' => 'Description too long.')))))->setDescription('<div id="progressbar_groupdesc" class="limit ok"></div>')->setDecorators(array('FieldDecorator'));
     $groupdesc_clear = new Oibs_Form_Element_Note('groupdesc_clear');
     $groupdesc_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // Body text.
     $groupbody = new Zend_Form_Element_Textarea('groupbody');
     $groupbody->setAttrib('cols', '45')->setAttrib('rows', '20')->setLabel('Body')->setFilters(array('StringTrim'))->setValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Body text can't be empty."))), array('StringLength', false, array(1, 4000, 'messages' => array('stringLengthTooLong' => 'Body text too long.')))))->setDescription('<div id="progressbar_groupbody" class="limit ok"></div>')->setDecorators(array('FieldDecorator'));
     $groupbody_clear = new Oibs_Form_Element_Note('groupbody_clear');
     $groupbody_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     $save = new Zend_Form_Element_Submit('save');
     $save->setLabel($translate->_('groups-btn_create'))->setAttrib('id', 'publish')->setAttrib('class', 'submit-button')->setAttrib('style', 'float: none;');
     $cancel = new Zend_Form_Element_Submit('cancel');
     $cancel->setLabel('Cancel')->setAttrib('id', 'cancel')->setAttrib('class', 'submit-button');
     $this->addElements(array($groupname, $groupname_clear, $groupdesc, $groupdesc_clear, $groupbody, $groupbody_clear, $save));
     $save->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'openOnly' => true, 'id' => 'submit', 'style' => 'clear: both;'))));
     $cancel->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'closeOnly' => true))));
 }