Exemplo n.º 1
0
 private function _admin()
 {
     $e = new Zend_Form_Element_Checkbox('admin');
     $e->setLabel(_('Is administrator?') . ":");
     $e->setAttrib('data-on-color', 'success');
     $e->setAttrib('data-off-color', 'danger');
     $e->setAttrib('data-on-text', _('Yes'));
     $e->setAttrib('data-off-text', _('No'));
     return $e;
 }
Exemplo n.º 2
0
 public function init()
 {
     $this->setName('add_new_post');
     $this->setMethod('Post');
     $this->setAttrib('encrypt', 'multipart/form-data');
     $heading = new Zend_Form_Element_Text('heading', array('disableLoadDefaultDecorators' => true));
     $heading->setRequired(true)->setLabel('* Blog Post Title:')->setAttrib('id', 'heading')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $url = new Zend_Form_Element_Text('url');
     $url->setRequired(true)->setAttrib('id', 'url')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control set-txt")->removeDecorator('htmlTag');
     $description = new Zend_Form_Element_Textarea('description', array('disableLoadDefaultDecorators' => true));
     $description->setRequired(true)->setLabel('* Description:')->setAttrib('id', 'description')->setAttrib('contenteditable', 'true')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     /*$categories = new Zend_Form_Element_Text('categories',array('disableLoadDefaultDecorators' =>true));
     		$categories->setLabel(' Category:')
     			->setAttrib('id', 'categories')
     			->addFilter('StripTags')
     			->addFilter('StringTrim')
     			->addValidator('NotEmpty')
     			->setAttrib("class", "form-control")
     			->removeDecorator('htmlTag');*/
     $is_comment = new Zend_Form_Element_Checkbox('is_comment', array('disableLoadDefaultDecorators' => true));
     $is_comment->setAttrib("id", "is_comment")->setLabel('Mark as No Comments:')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
     $tags = new Zend_Form_Element_Text('tags', array('disableLoadDefaultDecorators' => true));
     $tags->setLabel('Tags:')->setAttrib('id', 'tags')->setAttrib('placeholder', 'Separate tags with comma,')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $image = new Zend_Form_Element_File('image');
     $image->addValidator('Count', false, 1)->addValidator('ImageSize', false, array('minwidth' => 700, 'maxwidth' => 1000, 'minheight' => 500))->addValidator('Size', false, 1000240000)->setErrorMessages(array("Upload an image:"))->addValidator('Extension', false, 'jpg,png,gif,jpeg,jpg');
     // only JPEG, PNG, and GIFs
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submit-btn');
     $submit->setAttrib('class', 'btn btn-lg btn-primary float-right')->removeDecorator('HtmlTag')->removeDecorator('Label')->setLabel("Publish");
     $this->setElementDecorators(array('Errors', 'ViewHelper', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('Label', array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('heading', 'is_comment', 'url', 'image', 'description', 'tags'));
     $this->addElements(array($heading, $url, $is_comment, $image, $description, $tags, $submit));
 }
Exemplo n.º 3
0
 public function init()
 {
     $this->setName('add_video_link');
     //$this->setAction('newExpert');
     $this->setMethod('Post');
     $this->setAttrib('enctype', 'multipart/form-data');
     $title = new Zend_Form_Element_Text('title', array('disableLoadDefaultDecorators' => true));
     $title->setRequired(true)->setLabel('* Video Title:')->setAttrib('id', 'video_title')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $url_video = new Zend_Form_Element_Text('url_video', array('disableLoadDefaultDecorators' => true));
     $url_video->setRequired(true)->setLabel('* Video URL:')->setAttrib('id', 'url_video')->addValidator('NotEmpty')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim')->removeDecorator('htmlTag');
     $short_description = new Zend_Form_Element_Textarea('short_description', array('disableLoadDefaultDecorators' => true));
     $short_description->setRequired(true)->setAttrib("id", "short_description")->setLabel(' *Short Description:')->setAttrib("class", "form-control")->setAttrib('ROWS', '5')->setAttrib('COLS', '3')->addFilter('StringTrim');
     $video_img = new Zend_Form_Element_File('video_img');
     //$video_img->setRequired(true)
     $video_img->addValidator('Count', false, 1)->addValidator('ImageSize', false, array('minwidth' => 100, 'maxwidth' => 1000, 'minheight' => 100, 'maxheight' => 1000))->addValidator('Size', false, 1000240000)->setErrorMessages(array("Upload an image:"))->addValidator('Extension', false, 'jpg,png,gif,jpeg');
     // only JPEG, PNG, and GIFs
     $is_featured = new Zend_Form_Element_Checkbox('is_featured', array('disableLoadDefaultDecorators' => true));
     $is_featured->setAttrib("id", "is_featured")->setLabel('Featured:')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
     $is_main = new Zend_Form_Element_Checkbox('is_main', array('disableLoadDefaultDecorators' => true));
     $is_main->setAttrib("id", "is_main")->setLabel('Mark main video:')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submit-btn');
     $submit->setAttrib('class', 'btn btn-lg btn-primary float-right')->removeDecorator('HtmlTag')->removeDecorator('Label')->setLabel("Save");
     $this->setElementDecorators(array('Errors', 'ViewHelper', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('Label', array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('title', 'short_description', 'url_video', 'video_img', 'is_featured', 'is_main'));
     //$this->addElement('hash', 'csrf', array('ignore' => true,));
     $this->addElements(array($title, $short_description, $video_img, $url_video, $is_featured, $is_main, $submit));
 }
Exemplo n.º 4
0
 public function startFrom()
 {
     $setting = $this->setting;
     if (Application_Model_Preference::GetPlanLevel() == 'disabled') {
         $output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
         $output_sound_device->setLabel('Hardware Audio Output')->setRequired(false)->setValue($setting['output_sound_device'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper'));
         if (Application_Model_Preference::GetEnableStreamConf() == "false") {
             $output_sound_device->setAttrib("readonly", true);
         }
         $this->addElement($output_sound_device);
         $output_types = array("ALSA" => "ALSA", "AO" => "AO", "OSS" => "OSS", "Portaudio" => "Portaudio", "Pulseaudio" => "Pulseaudio");
         $output_type = new Zend_Form_Element_Select('output_sound_device_type');
         $output_type->setLabel("Output Type")->setMultiOptions($output_types)->setValue($setting['output_sound_device_type'])->setDecorators(array('ViewHelper'));
         if ($setting['output_sound_device'] != "true") {
             $output_type->setAttrib("disabled", "disabled");
         }
         $this->addElement($output_type);
     }
     $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
     $icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')->setRequired(false)->setValue($setting['icecast_vorbis_metadata'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper'));
     if (Application_Model_Preference::GetEnableStreamConf() == "false") {
         $icecast_vorbis_metadata->setAttrib("readonly", true);
     }
     $this->addElement($icecast_vorbis_metadata);
     $stream_format = new Zend_Form_Element_Radio('streamFormat');
     $stream_format->setLabel('Stream Label:');
     $stream_format->setMultiOptions(array("Artist - Title", "Show - Artist - Title", "Station name - Show name"));
     $stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
     $stream_format->setDecorators(array('ViewHelper'));
     $this->addElement($stream_format);
 }
Exemplo n.º 5
0
 public function init()
 {
     $this->setName('add_testimonial');
     //$this->setAction('newExpert');
     $this->setMethod('Post');
     $this->setAttrib('enctype', 'multipart/form-data');
     $first_name = new Zend_Form_Element_Text('first_name', array('disableLoadDefaultDecorators' => true));
     $first_name->setRequired(true)->setLabel('* First Name:')->setAttrib('id', 'video_title')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $last_name = new Zend_Form_Element_Text('last_name', array('disableLoadDefaultDecorators' => true));
     $last_name->setRequired(true)->setLabel('* Last Name:')->setAttrib('id', 'url_video')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $email = new Zend_Form_Element_Text('email', array('disableLoadDefaultDecorators' => true));
     $email->setRequired(true)->setLabel('* Email:')->setAttrib('id', 'email')->setAttrib('size', '30')->addFilter('StripTags')->addFilter('StringTrim')->setErrorMessages(array("Write Email"))->addValidator('EmailAddress', true)->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $short_description = new Zend_Form_Element_Textarea('short_description', array('disableLoadDefaultDecorators' => true));
     $short_description->setRequired(true)->setAttrib("id", "short_description")->setLabel(' *Testimonial:')->setAttrib("class", "form-control")->setAttrib('ROWS', '5')->setAttrib('COLS', '3')->setErrorMessages(array("Write Description for Testimonial"))->addFilter('StringTrim');
     $image1 = new Zend_Form_Element_File('image1');
     //$image1->setRequired(true)
     $image1->addValidator('Count', false, 1)->addValidator('ImageSize', false, array('minwidth' => 100, 'maxwidth' => 400, 'minheight' => 100, 'maxheight' => 400))->addValidator('Size', false, 1000240000)->setErrorMessages(array("*Upload an image:"))->addValidator('Extension', false, 'jpg,png,gif');
     // only JPEG, PNG, and GIFs
     $is_featured = new Zend_Form_Element_Checkbox('is_featured', array('disableLoadDefaultDecorators' => true));
     $is_featured->setAttrib("id", "is_featured")->setLabel('Featured:')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setAttrib('class', 'btn btn-lg btn-primary float-right')->removeDecorator('HtmlTag')->removeDecorator('Label')->setLabel("Save");
     $this->setElementDecorators(array('Errors', 'ViewHelper', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('Label', array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('first_name', 'last_name', 'email', 'short_description', 'image1', 'is_featured'));
     //$this->addElement('hash', 'csrf', array('ignore' => true,));
     $this->addElements(array($first_name, $last_name, $image1, $email, $is_featured, $short_description, $submit));
 }
Exemplo n.º 6
0
 /**
  * Builds a form form data 
  * @return unknown_type
  */
 private function _prepareForm()
 {
     !isset($this->_options) ? $this->_options = array() : null;
     !isset($this->_options[self::DATA]) ? $this->_options[self::DATA] = array() : null;
     $action = $this->_options[self::ACTION];
     $model = $this->_options[self::MODEL];
     $this->setAction($action);
     $this->setMethod('post');
     foreach ($this->_options[self::DATA] as $fieldName => $fieldValue) {
         if ($model->isLocked($fieldName)) {
             continue;
         }
         $typeElement = $model->getTypeElement($fieldName);
         try {
             if ($typeElement == Fgsl_Form_Constants::TEXT) {
                 $text = new Zend_Form_Element_Text($fieldName);
             }
             if ($typeElement == Fgsl_Form_Constants::PASSWORD) {
                 $text = new Zend_Form_Element_Password($fieldName);
             }
             if ($typeElement == Fgsl_Form_Constants::SELECT) {
                 $text = new Zend_Form_Element_Select($fieldName);
                 $selectOptions = $model->getSelectOptions($fieldName);
                 $text->addMultiOptions($selectOptions);
             }
             if ($typeElement == Fgsl_Form_Constants::CHECKBOX) {
                 $text = new Zend_Form_Element_Checkbox($fieldName);
             }
             $text->setLabel($model->getFieldLabel($fieldName));
             isset($this->_options[self::DATA][$fieldName]) ? $text->setValue($this->_options[self::DATA][$fieldName]) : '';
             if (isset($this->_options['readonly'])) {
                 if (array_key_exists($fieldName, $this->_options['readonly'])) {
                     $text->setAttrib('readonly', 'readonly');
                 }
             }
             $this->addElement($text);
         } catch (Exception $e) {
             return null;
         }
     }
     /**
      * Stores primary key value into a HTML hidden element 
      */
     if ($this->_options[self::DATA][$model->getFieldKey()] !== '') {
         $text = new Zend_Form_Element_Hidden($model->getFieldKey());
         $text->setValue($model->getKeyValue($this->_options[self::DATA]));
         $this->addElement($text);
     }
     $formType = $this->_options[self::DATA][$model->getFieldKey()] === '' ? $this->_getLabel(self::INSERT_LABEL) : $this->_getLabel(self::EDIT_LABEL);
     $text = new Zend_Form_Element_Submit(ucfirst($formType));
     $this->addElement($text);
     $text = new Zend_Form_Element_Submit('Return');
     $text->setAttrib('name', 'return');
     $this->addElement($text);
     return $this;
 }
Exemplo n.º 7
0
 public function init()
 {
     $penaltyname = new Zend_Form_Element_Text('penaltyname');
     $penaltyname->addValidator(new Zend_Validate_Db_NoRecordExists('ob_penalty_details', 'penalty_name', 'recordstatus_id=3'));
     $penaltyname->setAttrib('class', 'txt_put');
     $penaltyname->setAttrib('id', 'penaltyname');
     $penaltyname->setLabel('penaltyname')->setRequired(true)->addValidators(array(array('NotEmpty')));
     $penalty_per_month = new Zend_Form_Element_Text('penalty_per_month');
     $penalty_per_month->setAttrib('class', 'txt_put');
     $penalty_per_month->setAttrib('id', 'penalty_per_month');
     $penalty_per_month->setLabel('penalty_per_month')->setRequired(true)->addValidators(array(array('NotEmpty')));
     $penalty_per_day = new Zend_Form_Element_Text('penalty_per_day');
     $penalty_per_day->setAttrib('class', 'txt_put');
     $penalty_per_day->setAttrib('id', 'penalty_per_day');
     $penalty_per_day->setLabel('penalty_per_day')->setRequired(true)->addValidators(array(array('NotEmpty')));
     $status = new Zend_Form_Element_Checkbox('status');
     $status->setAttrib('class', 'txt_put');
     $status->setAttrib('id', 'status');
     $status->setLabel('Active')->setRequired(true);
     $unit_per_month = new Zend_Form_Element_Select('unit_per_month');
     $unit_per_month->addMultiOption('', 'Select...');
     $unit_per_month->addMultiOptions(array('Rs' => 'Flat', '%' => 'Percentage'));
     $unit_per_month->setAttrib('class', 'txt_put');
     $unit_per_month->setAttrib('id', 'unit_per_month');
     $unit_per_month->setRequired(true);
     $unit_per_day = new Zend_Form_Element_Select('unit_per_day');
     $unit_per_day->addMultiOption('', 'Select...');
     $unit_per_day->addMultiOptions(array('Rs' => 'Flat', '%' => 'Percentage'));
     $unit_per_day->setAttrib('class', 'txt_put');
     $unit_per_day->setAttrib('id', 'unit_per_day');
     $unit_per_day->setRequired(true);
     $creditlinename = new Zend_Form_Element_Select('creditlinename');
     $creditlinename->addMultiOption('', 'Select...');
     $creditlinename->setAttrib('class', 'txt_put');
     $creditlinename->setAttrib('id', 'creditlinename');
     $creditlinename->setRequired(true);
     $submit = new Zend_Form_Element_Submit('Submit');
     $submit->setAttrib('class', 'savings');
     $submit->setAttrib('id', 'Submit');
     $this->addElements(array($penaltyname, $penalty_per_month, $penalty_per_day, $status, $unit_per_month, $unit_per_day, $creditlinename, $submit));
 }
 public function checkBoxChildConstruct($form, $childs, $class = 1)
 {
     foreach ($childs as $child) {
         $checkBox = new Zend_Form_Element_Checkbox($child['P_ID']);
         $checkBox->setLabel($child['PI_PageTitle']);
         $checkBox->setAttrib('class', "childNiveau_{$class}");
         $form->addElement($checkBox);
         if (count($child['child'] > 0)) {
             FormExtranetGroupAssociate::checkBoxChildConstruct($this, $child['child'], $class++);
         }
     }
 }
Exemplo n.º 9
0
 public function init()
 {
     $country_list = Application_Model_Preference::GetCountryList();
     $isSass = Application_Model_Preference::GetPlanLevel() == 'disabled' ? false : true;
     $this->isSass = $isSass;
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/support-setting.phtml', "isSaas" => $isSass)), array('File', array('viewScript' => 'form/support-setting.phtml', 'placement' => false))));
     //Station name
     $this->addElement('text', 'stationName', array('class' => 'input_text', 'label' => 'Station Name', 'required' => true, 'filters' => array('StringTrim'), 'validator' => array('NotEmpty'), 'value' => Application_Model_Preference::GetStationName(), 'decorators' => array('ViewHelper')));
     // Phone number
     $this->addElement('text', 'Phone', array('class' => 'input_text', 'label' => 'Phone:', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetPhone(), 'decorators' => array('ViewHelper')));
     //Email
     $this->addElement('text', 'Email', array('class' => 'input_text', 'label' => 'Email:', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetEmail(), 'decorators' => array('ViewHelper')));
     // Station Web Site
     $this->addElement('text', 'StationWebSite', array('label' => 'Station Web Site:', 'required' => false, 'class' => 'input_text', 'value' => Application_Model_Preference::GetStationWebSite(), 'decorators' => array('ViewHelper')));
     // county list dropdown
     $this->addElement('select', 'Country', array('label' => 'Country:', 'required' => false, 'value' => Application_Model_Preference::GetStationCountry(), 'multiOptions' => $country_list, 'decorators' => array('ViewHelper')));
     // Station city
     $this->addElement('text', 'City', array('label' => 'City:', 'required' => false, 'class' => 'input_text', 'value' => Application_Model_Preference::GetStationCity(), 'decorators' => array('ViewHelper')));
     // Station Description
     $description = new Zend_Form_Element_Textarea('Description');
     $description->class = 'input_text_area';
     $description->setLabel('Station Description:')->setRequired(false)->setValue(Application_Model_Preference::GetStationDescription())->setDecorators(array('ViewHelper'))->setAttrib('ROWS', '2')->setAttrib('COLS', '58');
     $this->addElement($description);
     // Station Logo
     $upload = new Zend_Form_Element_File('Logo');
     $upload->setLabel('Station Logo:')->setRequired(false)->setDecorators(array('File'))->addValidator('Count', false, 1)->addValidator('Extension', false, 'jpg,jpeg,png,gif')->addFilter('ImageSize');
     $upload->setAttrib('accept', 'image/*');
     $this->addElement($upload);
     if (!$isSass) {
         //enable support feedback
         $this->addElement('checkbox', 'SupportFeedback', array('label' => 'Send support feedback', 'required' => false, 'value' => Application_Model_Preference::GetSupportFeedback(), 'decorators' => array('ViewHelper')));
         // checkbox for publicise
         $checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
         $checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')->setRequired(false)->setDecorators(array('ViewHelper'))->setValue(Application_Model_Preference::GetPublicise());
         if (Application_Model_Preference::GetSupportFeedback() == '0') {
             $checkboxPublicise->setAttrib("disabled", "disabled");
         }
         $this->addElement($checkboxPublicise);
         // text area for sending detail
         $this->addElement('textarea', 'SendInfo', array('class' => 'sending_textarea', 'required' => false, 'filters' => array('StringTrim'), 'readonly' => true, 'cols' => 61, 'rows' => 5, 'value' => Application_Model_Preference::GetSystemInfo(false, true), 'decorators' => array('ViewHelper')));
         // checkbox for privacy policy
         $checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
         $checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")->setDecorators(array('ViewHelper'));
         $this->addElement($checkboxPrivacy);
     }
     // submit button
     $submit = new Zend_Form_Element_Submit("submit");
     $submit->class = 'ui-button ui-state-default right-floated';
     $submit->setIgnore(true)->setLabel("Save")->setDecorators(array('ViewHelper'));
     $this->addElement($submit);
 }
Exemplo n.º 10
0
 /**
  * Create a module selection form for system installation
  *
  * @param array|Zend_Config $options
  */
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setName('modules');
     $this->setLegend('Modules');
     $mod_dir = ZfApplication::$_base_path . "/app";
     $iterator = new DirectoryIterator($mod_dir);
     foreach ($iterator as $file) {
         if ($file->isDir() && $file->getFilename() != "." && $file->getFilename() != ".." && substr($file->getFilename(), 0, 1) != ".") {
             $module = new Zend_Form_Element_Checkbox($file->getFilename(), array('value' => 1));
             $module->setAttrib('id', 'modules_' . $file->getFilename())->setLabel($file->getFilename());
             $this->addElement($module);
         }
     }
 }
Exemplo n.º 11
0
 public function init()
 {
     $this->setName('add_main_banner');
     $this->setMethod('Post');
     $this->setAttrib('enctype', 'multipart/form-data');
     $targetUrl = new Zend_Form_Element_Text('target_url', array('disableLoadDefaultDecorators' => true));
     $targetUrl->setRequired(true)->setLabel('* Target Url:')->setAttrib('id', 'target_url')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $banner_img = new Zend_Form_Element_File('banner_img');
     $banner_img->addValidator('Count', false, 1)->addValidator('ImageSize', false, array('minwidth' => 1600, 'maxwidth' => 1700, 'minheight' => 500))->addValidator('Size', false, 1000240000)->setErrorMessages(array("Upload an image:"))->addValidator('Extension', false, 'jpg,png,gif,jpeg,jpg');
     // only JPEG, PNG, and GIFs
     $is_main = new Zend_Form_Element_Checkbox('is_main', array('disableLoadDefaultDecorators' => true));
     $is_main->setAttrib("id", "is_main")->setLabel('Mark main Banner:')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submit-btn');
     $submit->setAttrib('class', 'btn btn-lg btn-primary float-right')->removeDecorator('HtmlTag')->removeDecorator('Label')->setLabel("Save");
     $this->setElementDecorators(array('Errors', 'ViewHelper', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('Label', array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('targetUrl', 'banner_img', 'is_main'));
     $this->addElements(array($targetUrl, $banner_img, $is_main, $submit));
 }
Exemplo n.º 12
0
 public function init()
 {
     $this->setName('image_block');
     $block = new Zend_Form_Element_File('block');
     $block->setRequired(true)->addValidator('Count', false, 1)->addValidator('FilesSize', false, array('min' => '1kB', 'max' => '5MB'))->addValidator('ImageSize', false, array('minwidth' => 10, 'minheight' => 10))->addFilter('StringTrim')->setErrorMessages(array("Upload an image"))->addValidator('Extension', false, 'jpeg,jpg,png,gif');
     // only JPEG, PNG, and GIFs
     $name = new Zend_Form_Element_Text('name', array('disableLoadDefaultDecorators' => true));
     $name->setRequired(true)->setAttrib('id', 'image-name')->addFilter('StringTrim')->addFilter('StripTags')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $caption = new Zend_Form_Element_Text('caption', array('disableLoadDefaultDecorators' => true));
     $caption->setAttrib('id', 'caption')->addFilter('StringTrim')->addFilter('StripTags')->addFilter('htmlentities')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $disable_link = new Zend_Form_Element_Checkbox('disable_link', array('disableLoadDefaultDecorators' => true));
     $disable_link->setAttrib("id", "disable_link")->setAttrib("class", "float-left")->addFilter('StringTrim')->removeDecorator('htmlTag');
     $link = new Zend_Form_Element_Text('link', array('disableLoadDefaultDecorators' => true));
     $link->setAttrib('id', 'link')->addFilter('StringTrim')->addFilter('StripTags')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setAttrib('class', 'btn btn-middium btn-primary pull-right')->removeDecorator('HtmlTag')->removeDecorator('Label')->setLabel("Update");
     $this->setElementDecorators(array('Errors', 'ViewHelper', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('block', 'name', 'link', 'caption', 'disable_link'));
     $this->addElements(array($block, $name, $link, $caption, $disable_link, $submit));
 }
Exemplo n.º 13
0
 public function startFrom()
 {
     $setting = $this->setting;
     if (Application_Model_Preference::GetPlanLevel() == 'disabled') {
         $output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
         $output_sound_device->setLabel(_('Hardware Audio Output'))->setRequired(false)->setValue($setting['output_sound_device'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper'));
         if (Application_Model_Preference::GetEnableStreamConf() == "false") {
             $output_sound_device->setAttrib("readonly", true);
         }
         $this->addElement($output_sound_device);
         $output_types = array("ALSA" => "ALSA", "AO" => "AO", "OSS" => "OSS", "Portaudio" => "Portaudio", "Pulseaudio" => "Pulseaudio");
         $output_type = new Zend_Form_Element_Select('output_sound_device_type');
         $output_type->setLabel(_("Output Type"))->setMultiOptions($output_types)->setValue($setting['output_sound_device_type'])->setDecorators(array('ViewHelper'));
         if ($setting['output_sound_device'] != "true") {
             $output_type->setAttrib("disabled", "disabled");
         }
         $this->addElement($output_type);
     }
     $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
     $icecast_vorbis_metadata->setLabel(_('Icecast Vorbis Metadata'))->setRequired(false)->setValue($setting['icecast_vorbis_metadata'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper'));
     if (Application_Model_Preference::GetEnableStreamConf() == "false") {
         $icecast_vorbis_metadata->setAttrib("readonly", true);
     }
     $this->addElement($icecast_vorbis_metadata);
     $stream_format = new Zend_Form_Element_Radio('streamFormat');
     $stream_format->setLabel(_('Stream Label:'));
     $stream_format->setMultiOptions(array(_("Artist - Title"), _("Show - Artist - Title"), _("Station name - Show name")));
     $stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
     $stream_format->setDecorators(array('ViewHelper'));
     $this->addElement($stream_format);
     $offAirMeta = new Zend_Form_Element_Text('offAirMeta');
     $offAirMeta->setLabel(_('Off Air Metadata'))->setValue(Application_Model_StreamSetting::getOffAirMeta())->setDecorators(array('ViewHelper'));
     $this->addElement($offAirMeta);
     $enable_replay_gain = new Zend_Form_Element_Checkbox("enableReplayGain");
     $enable_replay_gain->setLabel(_("Enable Replay Gain"))->setValue(Application_Model_Preference::GetEnableReplayGain())->setDecorators(array('ViewHelper'));
     $this->addElement($enable_replay_gain);
     $replay_gain = new Zend_Form_Element_Hidden("replayGainModifier");
     $replay_gain->setLabel(_("Replay Gain Modifier"))->setValue(Application_Model_Preference::getReplayGainModifier())->setAttribs(array('style' => "border: 0; color: #f6931f; font-weight: bold;"))->setDecorators(array('ViewHelper'));
     $this->addElement($replay_gain);
 }
Exemplo n.º 14
0
 public function init()
 {
     $this->setName('add_testimonial');
     $first_name = new Zend_Form_Element_Text('first_name', array('disableLoadDefaultDecorators' => true));
     $first_name->setRequired(true)->setAttrib('id', 'first_name')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $last_name = new Zend_Form_Element_Text('last_name', array('disableLoadDefaultDecorators' => true));
     $last_name->setRequired(true)->setAttrib('id', 'last_name')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $email = new Zend_Form_Element_Text('email', array('disableLoadDefaultDecorators' => true));
     $email->setRequired(true)->setAttrib('id', 'email')->setAttrib('size', '30')->addFilter('StripTags')->addFilter('StringTrim')->setErrorMessages(array("Write Email"))->addValidator('EmailAddress', true)->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $short_description = new Zend_Form_Element_Textarea('short_description', array('disableLoadDefaultDecorators' => true));
     $short_description->setRequired(true)->setAttrib("id", "editor1")->setAttrib("class", "form-control")->setAttrib('name', 'short_description')->setErrorMessages(array("Write Description for Testimonial"))->addFilter('StringTrim');
     $image1 = new Zend_Form_Element_File('image1');
     $image1->addValidator('Count', false, 1)->addValidator('FilesSize', false, array('min' => '1kB', 'max' => '5MB'))->addValidator('ImageSize', false, array('minwidth' => 10, 'minheight' => 10))->addFilter('StringTrim')->setErrorMessages(array("Upload an image"))->addValidator('Extension', false, 'jpeg,jpg,png,gif');
     // only JPEG, PNG, and GIFs
     $is_featured = new Zend_Form_Element_Checkbox('is_featured', array('disableLoadDefaultDecorators' => true));
     $is_featured->setAttrib("id", "is_featured")->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setAttrib('class', 'btn btn-md btn-primary float-right')->removeDecorator('HtmlTag')->removeDecorator('Label')->setLabel("Save");
     $this->setElementDecorators(array('Errors', 'ViewHelper', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('first_name', 'last_name', 'email', 'short_description', 'image1', 'is_featured'));
     $this->addElements(array($first_name, $last_name, $image1, $email, $is_featured, $short_description, $submit));
 }
Exemplo n.º 15
0
 public function init()
 {
     $this->setName('add_video_link');
     $this->setAttrib('enctype', 'multipart/form-data');
     $title = new Zend_Form_Element_Text('title', array('disableLoadDefaultDecorators' => true));
     $title->setRequired(true)->setAttrib('id', 'video_title')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
     $url_video = new Zend_Form_Element_Text('url_video', array('disableLoadDefaultDecorators' => true));
     $url_video->setRequired(true)->setAttrib('id', 'url_video')->addValidator('NotEmpty')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim')->removeDecorator('htmlTag');
     $short_description = new Zend_Form_Element_Textarea('short_description', array('disableLoadDefaultDecorators' => true));
     $short_description->setRequired(true)->setAttrib("id", "editor1")->setAttrib("class", "form-control")->addFilter('StringTrim');
     $video_img = new Zend_Form_Element_File('video_img');
     $video_img->addValidator('Count', false, 1)->addValidator('FilesSize', false, array('min' => '1kB', 'max' => '5MB'))->addValidator('ImageSize', false, array('minwidth' => 10, 'minheight' => 10))->addFilter('StringTrim')->setErrorMessages(array("Upload an image"))->addValidator('Extension', false, 'jpeg,jpg,png,gif');
     // only JPEG, PNG, and GIFs
     $is_featured = new Zend_Form_Element_Checkbox('is_featured', array('disableLoadDefaultDecorators' => true));
     $is_featured->setAttrib("id", "is_featured")->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
     $is_main = new Zend_Form_Element_Checkbox('is_main', array('disableLoadDefaultDecorators' => true));
     $is_main->setAttrib("id", "is_main")->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submit-btn');
     $submit->setAttrib('class', 'btn btn-md btn-primary float-right')->removeDecorator('HtmlTag')->removeDecorator('Label')->setLabel("Save");
     $this->setElementDecorators(array('Errors', 'ViewHelper', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('title', 'short_description', 'url_video', 'video_img', 'is_featured', 'is_main'));
     $this->addElements(array($title, $short_description, $video_img, $url_video, $is_featured, $is_main, $submit));
 }
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'emplcommunicationdetails');
     $id = new Zend_Form_Element_Hidden('id');
     $userid = new Zend_Form_Element_Hidden('user_id');
     $personalemail = new Zend_Form_Element_Text('personalemail');
     $personalemail->setAttrib('maxLength', 50);
     $personalemail->addFilter('StripTags');
     $personalemail->addFilter('StringTrim');
     $personalemail->addValidator("regex", true, array('pattern' => '/^(?!.*\\.{2})[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid email.')));
     $perm_streetaddress = new Zend_Form_Element_Text('perm_streetaddress');
     $perm_streetaddress->setAttrib('maxLength', 100);
     $perm_streetaddress->addFilter(new Zend_Filter_StringTrim());
     $perm_country = new Zend_Form_Element_Select('perm_country');
     $perm_country->setAttrib('onchange', 'displayParticularState(this,"","perm_state","")');
     $perm_country->setRegisterInArrayValidator(false);
     $perm_state = new Zend_Form_Element_Select('perm_state');
     $perm_state->setAttrib('onchange', 'displayParticularCity(this,"","perm_city","")');
     $perm_state->setRegisterInArrayValidator(false);
     $perm_state->addMultiOption('', 'Select State');
     $perm_city = new Zend_Form_Element_Select('perm_city');
     $perm_city->setRegisterInArrayValidator(false);
     $perm_city->addMultiOption('', 'Select City');
     $perm_pincode = new Zend_Form_Element_Text('perm_pincode');
     $perm_pincode->setAttrib('maxLength', 10);
     $perm_pincode->addFilter(new Zend_Filter_StringTrim());
     $perm_pincode->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 10, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Postal code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Postal code must contain at least %min% characters.')))));
     $perm_pincode->addValidator("regex", true, array('pattern' => '/^(?!0{3})[0-9a-zA-Z]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid postal code.')));
     $current_streetaddress = new Zend_Form_Element_Text('current_streetaddress');
     $current_streetaddress->setAttrib('maxLength', 100);
     $current_streetaddress->addFilter(new Zend_Filter_StringTrim());
     $current_country = new Zend_Form_Element_Select('current_country');
     $current_country->setAttrib('onchange', 'displayParticularState(this,"","current_state","")');
     $current_country->setRegisterInArrayValidator(false);
     $current_country->addMultiOption('', 'Select Country');
     $current_state = new Zend_Form_Element_Select('current_state');
     $current_state->setAttrib('onchange', 'displayParticularCity(this,"","current_city","")');
     $current_state->setRegisterInArrayValidator(false);
     $current_state->addMultiOption('', 'Select State');
     $current_city = new Zend_Form_Element_Select('current_city');
     $current_city->setRegisterInArrayValidator(false);
     $current_city->addMultiOption('', 'Select City');
     $current_pincode = new Zend_Form_Element_Text('current_pincode');
     $current_pincode->setAttrib('maxLength', 10);
     $current_pincode->addFilter(new Zend_Filter_StringTrim());
     $current_pincode->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 10, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Postal code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Postal code must contain at least %min% characters.')))));
     $current_pincode->addValidator("regex", true, array('pattern' => '/^(?!0{3})[0-9a-zA-Z]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid postal code.')));
     $address_flag = new Zend_Form_Element_Checkbox('address_flag');
     $address_flag->setAttrib('onclick', 'populateCurrentAddress(this)');
     $emergency_number = new Zend_Form_Element_Text('emergency_number');
     $emergency_number->setAttrib('maxLength', 10);
     $emergency_number->addFilter(new Zend_Filter_StringTrim());
     $emergency_number->addValidator("regex", true, array('pattern' => '/^(?!0{10})[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.')));
     $emergency_name = new Zend_Form_Element_Text('emergency_name');
     $emergency_name->setAttrib('maxLength', 50);
     $emergency_name->addFilter(new Zend_Filter_StringTrim());
     $emergency_name->addValidator("regex", true, array('pattern' => '/^([a-zA-Z.]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.')));
     $emergency_email = new Zend_Form_Element_Text('emergency_email');
     $emergency_email->setAttrib('maxLength', 50);
     $emergency_email->addFilter(new Zend_Filter_StringTrim());
     $emergency_email->addValidator("regex", true, array('pattern' => '/^(?!.*\\.{2})[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid email.')));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $userid, $personalemail, $perm_streetaddress, $perm_country, $perm_state, $perm_city, $perm_pincode, $current_streetaddress, $current_country, $current_state, $current_city, $current_pincode, $address_flag, $emergency_number, $emergency_name, $emergency_email, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Exemplo n.º 17
0
 public function startForm()
 {
     $prefix = "s" . $this->prefix;
     $stream_number = $this->prefix;
     $setting = $this->setting;
     $stream_types = $this->stream_types;
     $stream_bitrates = $this->stream_bitrates;
     $this->setIsArray(true);
     $this->setElementsBelongTo($prefix . "_data");
     $disable_all = Application_Model_Preference::GetEnableStreamConf() == "false";
     $enable = new Zend_Form_Element_Checkbox('enable');
     $enable->setLabel('Enabled:')->setValue($setting[$prefix . '_enable'] == 'true' ? 1 : 0)->setDecorators(array('ViewHelper'));
     if ($disable_all) {
         $enable->setAttrib("disabled", "disabled");
     }
     $this->addElement($enable);
     $type = new Zend_Form_Element_Select('type');
     $type->setLabel("Stream Type:")->setMultiOptions($stream_types)->setValue(isset($setting[$prefix . '_type']) ? $setting[$prefix . '_type'] : 0)->setDecorators(array('ViewHelper'));
     if ($disable_all) {
         $type->setAttrib("disabled", "disabled");
     }
     $this->addElement($type);
     $bitrate = new Zend_Form_Element_Select('bitrate');
     $bitrate->setLabel("Bit Rate:")->setMultiOptions($stream_bitrates)->setValue(isset($setting[$prefix . '_bitrate']) ? $setting[$prefix . '_bitrate'] : 0)->setDecorators(array('ViewHelper'));
     if ($disable_all) {
         $bitrate->setAttrib("disabled", "disabled");
     }
     $this->addElement($bitrate);
     $output = new Zend_Form_Element_Select('output');
     $output->setLabel("Service Type:")->setMultiOptions(array("icecast" => "Icecast", "shoutcast" => "SHOUTcast"))->setValue(isset($setting[$prefix . '_output']) ? $setting[$prefix . '_output'] : "icecast")->setDecorators(array('ViewHelper'));
     if ($disable_all) {
         $output->setAttrib("disabled", "disabled");
     }
     $this->addElement($output);
     $channels = new Zend_Form_Element_Select('channels');
     $channels->setLabel("Channels:")->setMultiOptions(array("mono" => "1 - Mono", "stereo" => "2 - Stereo"))->setValue(isset($setting[$prefix . '_channels']) ? $setting[$prefix . '_channels'] : "stereo")->setDecorators(array('ViewHelper'));
     if ($disable_all) {
         $channels->setAttrib("disabled", "disabled");
     }
     $this->addElement($channels);
     $host = new Zend_Form_Element_Text('host');
     $host->setLabel("Server")->setValue(isset($setting[$prefix . '_host']) ? $setting[$prefix . '_host'] : "")->setValidators(array(array('regex', false, array('/^[0-9a-zA-Z-_.]+$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper'));
     if ($disable_all) {
         $host->setAttrib("disabled", "disabled");
     }
     $host->setAttrib('alt', 'domain');
     $this->addElement($host);
     $port = new Zend_Form_Element_Text('port');
     $port->setLabel("Port")->setValue(isset($setting[$prefix . '_port']) ? $setting[$prefix . '_port'] : "")->setValidators(array(new Zend_Validate_Between(array('min' => 0, 'max' => 99999))))->addValidator('regex', false, array('pattern' => '/^[0-9]+$/', 'messages' => array('regexNotMatch' => 'Only numbers are allowed.')))->setDecorators(array('ViewHelper'));
     if ($disable_all) {
         $port->setAttrib("disabled", "disabled");
     }
     $this->addElement($port);
     $pass = new Zend_Form_Element_Text('pass');
     $pass->setLabel("Password")->setValue(isset($setting[$prefix . '_pass']) ? $setting[$prefix . '_pass'] : "")->setValidators(array(array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper'));
     if ($disable_all) {
         $pass->setAttrib("disabled", "disabled");
     }
     $pass->setAttrib('alt', 'regular_text');
     $this->addElement($pass);
     $genre = new Zend_Form_Element_Text('genre');
     $genre->setLabel("Genre")->setValue(isset($setting[$prefix . '_genre']) ? $setting[$prefix . '_genre'] : "")->setDecorators(array('ViewHelper'));
     if ($disable_all) {
         $genre->setAttrib("disabled", "disabled");
     }
     $this->addElement($genre);
     $url = new Zend_Form_Element_Text('url');
     $url->setLabel("URL")->setValue(isset($setting[$prefix . '_url']) ? $setting[$prefix . '_url'] : "")->setValidators(array(array('regex', false, array('/^[0-9a-zA-Z\\-_.:\\/]+$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper'));
     if ($disable_all) {
         $url->setAttrib("disabled", "disabled");
     }
     $url->setAttrib('alt', 'url');
     $this->addElement($url);
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel("Name")->setValue(isset($setting[$prefix . '_name']) ? $setting[$prefix . '_name'] : "")->setDecorators(array('ViewHelper'));
     if ($disable_all) {
         $name->setAttrib("disabled", "disabled");
     }
     $this->addElement($name);
     $description = new Zend_Form_Element_Text('description');
     $description->setLabel("Description")->setValue(isset($setting[$prefix . '_description']) ? $setting[$prefix . '_description'] : "")->setDecorators(array('ViewHelper'));
     if ($disable_all) {
         $description->setAttrib("disabled", "disabled");
     }
     $this->addElement($description);
     $mount = new Zend_Form_Element_Text('mount');
     $mount->setLabel("Mount Point")->setValue(isset($setting[$prefix . '_mount']) ? $setting[$prefix . '_mount'] : "")->setValidators(array(array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper'));
     if ($disable_all) {
         $mount->setAttrib("disabled", "disabled");
     }
     $mount->setAttrib('alt', 'regular_text');
     $this->addElement($mount);
     $user = new Zend_Form_Element_Text('user');
     $user->setLabel("Username")->setValue(isset($setting[$prefix . '_user']) ? $setting[$prefix . '_user'] : "")->setValidators(array(array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper'));
     if ($disable_all) {
         $user->setAttrib("disabled", "disabled");
     }
     $user->setAttrib('alt', 'regular_text');
     $this->addElement($user);
     $liquidsopa_error_msg = '<div class="stream-status status-info"><h3>Getting information from the server...</h3></div>';
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number" => $stream_number, "enabled" => $enable->getValue(), "liquidsoap_error_msg" => $liquidsopa_error_msg))));
 }
Exemplo n.º 18
0
 public function __construct($options = null)
 {
     $this->_disabledDefaultActions = true;
     parent::__construct($options);
     $baseDir = $this->getView()->baseUrl();
     if (!empty($options['mode']) && $options['mode'] == 'edit') {
         $this->_mode = 'edit';
     } else {
         $this->_mode = 'add';
     }
     $langId = Zend_Registry::get('languageID');
     $this->setAttrib('id', 'accountManagement');
     $this->setAttrib('class', 'step3');
     //            $addressParams = array(
     //                "fieldsValue" => array(),
     //                "display"   => array(),
     //                "required" => array(),
     //            );
     //Hidden fields for the state and cities id
     $selectedState = new Zend_Form_Element_Hidden('selectedState');
     $selectedState->removeDecorator('label');
     $selectedCity = new Zend_Form_Element_Hidden('selectedCity');
     $selectedCity->removeDecorator('label');
     $this->addElement($selectedState);
     $this->addElement($selectedCity);
     // Salutation
     $salutation = new Zend_Form_Element_Select('salutation');
     $salutation->setLabel($this->getView()->getCibleText('form_label_salutation'))->setAttrib('class', 'smallTextInput')->setOrder(1);
     $greetings = $this->getView()->getAllSalutation();
     foreach ($greetings as $greeting) {
         $salutation->addMultiOption($greeting['S_ID'], $greeting['ST_Value']);
     }
     // language hidden field
     $language = new Zend_Form_Element_Hidden('language', array('value' => $langId));
     $language->removeDecorator('label');
     // langauge hidden field
     // FirstName
     $firstname = new Zend_Form_Element_Text('firstName');
     $firstname->setLabel($this->getView()->getCibleText('form_label_fName'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttribs(array('class' => 'stdTextInput'))->setOrder(2);
     // LastName
     $lastname = new Zend_Form_Element_Text('lastName');
     $lastname->setLabel($this->getView()->getCibleText('form_label_lName'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttribs(array('class' => 'stdTextInput'))->setOrder(3);
     // email
     $regexValidate = new Cible_Validate_Email();
     $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
     $emailNotFoundInDBValidator = new Zend_Validate_Db_NoRecordExists('GenericProfiles', 'GP_Email');
     $emailNotFoundInDBValidator->setMessage($this->getView()->getClientText('validation_message_email_already_exists'), 'recordFound');
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel($this->getView()->getCibleText('form_label_email'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setAttribs(array('maxlength' => 50, 'class' => 'stdTextInput'))->setOrder(4);
     if ($this->_mode == 'add') {
         $email->addValidator($emailNotFoundInDBValidator);
     }
     // email
     // password
     $password = new Zend_Form_Element_Password('password');
     if ($this->_mode == 'add') {
         $password->setLabel($this->getView()->getCibleText('form_label_password'));
     } else {
         $password->setLabel($this->getView()->getCibleText('form_label_newPwd'));
     }
     $password->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInput')->setRequired(true)->setOrder(5)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))));
     // password
     // password confirmation
     $passwordConfirmation = new Zend_Form_Element_Password('passwordConfirmation');
     if ($this->_mode == 'add') {
         $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmPwd'));
     } else {
         $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmNewPwd'));
     }
     $passwordConfirmation->addFilter('StripTags')->addFilter('StringTrim')->setRequired(true)->setOrder(6)->setAttrib('class', 'stdTextInput');
     if (!empty($_POST['identification']['password'])) {
         $passwordConfirmation->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('error_message_password_isEmpty'))));
         $Identical = new Zend_Validate_Identical($_POST['identification']['password']);
         $Identical->setMessages(array('notSame' => $this->getView()->getCibleText('error_message_password_notSame')));
         $passwordConfirmation->addValidator($Identical);
     }
     // password confirmation
     // Company name
     $company = new Zend_Form_Element_Text('company');
     $company->setLabel($this->getView()->getCibleText('form_label_company'))->setRequired(false)->setOrder(7)->setAttribs(array('class' => 'stdTextInput'));
     // function in company
     $functionCompany = new Zend_Form_Element_Text('functionCompany');
     $functionCompany->setLabel($this->getView()->getCibleText('form_label_account_function_company'))->setRequired(false)->setOrder(8)->setAttribs(array('class' => 'stdTextInput'));
     // Are you a retailer
     $retailer = new Zend_Form_Element_Select('isRetailer');
     $retailer->setLabel($this->getView()->getClientText('form_label_retailer'))->setAttrib('class', 'smallTextInput');
     $retailer->addMultiOption(0, $this->getView()->getCibleText('button_no'));
     $retailer->addMultiOption(1, $this->getView()->getCibleText('button_yes'));
     // Text Subscribe
     $textSubscribe = $this->getView()->getCibleText('form_label_subscribe');
     $textSubscribe = str_replace('%URL_PRIVACY_POLICY%', Cible_FunctionsPages::getPageLinkByID($this->_config->page_privacy_policy->pageID), $textSubscribe);
     // Newsletter subscription
     $newsletterSubscription = new Zend_Form_Element_Checkbox('newsletterSubscription');
     $newsletterSubscription->setLabel($textSubscribe);
     if ($this->_mode == 'add') {
         $newsletterSubscription->setChecked(1);
     }
     $newsletterSubscription->setAttrib('class', 'long-text');
     $newsletterSubscription->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
     if ($this->_mode == 'add') {
         $termsAgreement = new Zend_Form_Element_Checkbox('termsAgreement');
         $termsAgreement->setLabel(str_replace('%URL_TERMS_CONDITIONS%', Cible_FunctionsPages::getPageLinkByID($this->_config->termsAndConditions->pageId), $this->getView()->getClientText('form_label_terms_agreement')));
         $termsAgreement->setAttrib('class', 'long-text');
         $termsAgreement->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
         $termsAgreement->setRequired(true);
         $termsAgreement->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'You must agree to the terms')));
     } else {
         $termsAgreement = new Zend_Form_Element_Hidden('termsAgreement', array('value' => 1));
     }
     // Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel($this->getView()->getCibleText('form_label_next_step_btn'))->setAttrib('class', 'nextStepButton');
     // Reference number for the job
     $txtConnaissance = new Cible_Form_Element_Html('knowYou', array('value' => $this->getView()->getCibleText('form_account_mieux_vous_connaitre_legend')));
     $txtConnaissance->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'description left'))));
     $refJobId = new Zend_Form_Element_Text('refJobId');
     $refJobId->setLabel('refJobId')->setRequired(false)->setAttribs(array('class' => 'stdTextInput'));
     // Reference number for the role
     $refRoleId = new Zend_Form_Element_Text('refRoleId');
     $refRoleId->setLabel('refRoleId')->setRequired(false)->setAttribs(array('class' => 'stdTextInput'));
     // Reference number for the job title
     $refJobTitleId = new Zend_Form_Element_Text('refJobTitleId');
     $refJobTitleId->setLabel('refJobTitleId')->setRequired(false)->setAttribs(array('class' => 'stdTextInput'));
     $refJobTitleId = new Zend_Form_Element_Text('refJobTitleId');
     $refJobTitleId->setLabel('refJobTitleId')->setRequired(false)->setAttribs(array('class' => 'stdTextInput'));
     // Provincial tax exemption
     $noProvTax = new Zend_Form_Element_Checkbox('noProvTax');
     $noProvTax->setLabel($this->getView()->getCibleText('form_label_account_provincial_tax'));
     $noProvTax->setAttrib('class', 'long-text')->setOrder(13);
     $noProvTax->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
     // Provincial tax exemption
     $noFedTax = new Zend_Form_Element_Checkbox('noFedTax');
     $noFedTax->setLabel($this->getView()->getCibleText('form_label_account_federal_tax'));
     $noFedTax->setAttrib('class', 'long-text')->setOrder(14);
     $noFedTax->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
     /*  Identification sub form */
     $identificationSub = new Zend_Form_SubForm();
     $identificationSub->setName('identification')->removeDecorator('DtDdWrapper');
     $identificationSub->setLegend($this->getView()->getCibleText('form_account_subform_identification_legend'));
     $identificationSub->setAttrib('class', 'identificationClass subFormClass');
     $identificationSub->addElement($language);
     $identificationSub->addElement($salutation);
     $identificationSub->addElement($lastname);
     $identificationSub->addElement($firstname);
     $identificationSub->addElement($email);
     $identificationSub->addElement($password);
     $identificationSub->addElement($passwordConfirmation);
     $identificationSub->addElement($company);
     $this->addSubForm($identificationSub, 'identification');
     //            $identificationSub->addElement($functionCompany);
     $addrContactMedia = new Cible_View_Helper_FormAddress($identificationSub);
     if ($options['resume']) {
         $addrContactMedia->setProperty('addScript', false);
     }
     $addrContactMedia->enableFields(array('firstTel', 'secondTel', 'fax', 'webSite'));
     $addrContactMedia->formAddress();
     $identificationSub->addElement($noProvTax);
     $identificationSub->addElement($noFedTax);
     /*  Identification sub form */
     /* billing address */
     // Billing address
     $addressFacturationSub = new Zend_Form_SubForm();
     $addressFacturationSub->setName('addressFact')->removeDecorator('DtDdWrapper');
     $addressFacturationSub->setLegend($this->getView()->getCibleText('form_account_subform_addBilling_legend'));
     $addressFacturationSub->setAttrib('class', 'addresseBillingClass subFormClass');
     $billingAddr = new Cible_View_Helper_FormAddress($addressFacturationSub);
     $billingAddr->setProperty('addScriptState', false);
     if ($options['resume']) {
         $billingAddr->setProperty('addScript', false);
     }
     $billingAddr->enableFields(array('firstAddress', 'secondAddress', 'state', 'cityTxt', 'zipCode', 'country', 'firstTel', 'secondTel'));
     $billingAddr->formAddress();
     $addrBill = new Zend_Form_Element_Hidden('addrBill');
     $addrBill->removeDecorator('label');
     $addressFacturationSub->addElement($addrBill);
     $addressFacturationSub->getElement('AI_SecondAddress')->removeDecorator('label');
     $this->addSubForm($addressFacturationSub, 'addressFact');
     /* delivery address */
     $addrShip = new Zend_Form_Element_Hidden('addrShip');
     $addrShip->removeDecorator('label');
     $addressShippingSub = new Zend_Form_SubForm();
     $addressShippingSub->setName('addressShipping')->removeDecorator('DtDdWrapper');
     $addressShippingSub->setLegend($this->getView()->getCibleText('form_account_subform_addShipping_legend'));
     $addressShippingSub->setAttrib('class', 'addresseShippingClass subFormClass');
     $shipAddr = new Cible_View_Helper_FormAddress($addressShippingSub);
     if ($options['resume']) {
         $shipAddr->setProperty('addScript', false);
     }
     $shipAddr->duplicateAddress($addressShippingSub);
     $shipAddr->setProperty('addScriptState', false);
     $shipAddr->enableFields(array('firstAddress', 'secondAddress', 'state', 'cityTxt', 'zipCode', 'country', 'firstTel', 'secondTel'));
     $shipAddr->formAddress();
     $addressShippingSub->addElement($addrShip);
     $this->addSubForm($addressShippingSub, 'addressShipping');
     if ($this->_mode == 'edit') {
         $this->addElement($termsAgreement);
     }
     $this->addElement($submit);
     $submit->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'stepBottomNext'))));
     if ($this->_mode == 'add') {
         $termsAgreement->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox', 'id' => 'dd-terms-agreement'))));
     }
 }
Exemplo n.º 19
0
 /**
  * Faz o parse de um campo <boolean>
  * @param SimpleXMLElement $element
  */
 protected function parseBoolean($element)
 {
     $form_element = new Zend_Form_Element_Checkbox((string) $element->id);
     $form_element->setLabel((string) $element->label);
     $form_element->setDescription("Habilitar");
     if (isset($element->value) && $element->value == "true") {
         $form_element->setAttrib('checked', 'checked');
     } else {
         if (isset($element->default) && $element->default == "true") {
             $form_element->setAttrib('checked', 'checked');
         }
     }
     return $form_element;
 }
Exemplo n.º 20
0
 function getFormElement($v, $value = '')
 {
     $this->toTpl('hasForm', 1);
     $v = $this->doQoolHook('front_pre_getformelement_element', $v);
     $value = $this->doQoolHook('front_pre_getformelement_value', $value);
     switch ($v['value']) {
         case "editor":
             $this->loadEditorBtns();
             $this->toTpl("loadEditor", 1);
             $this->toTpl("isEditor", 1);
             $element = new Zend_Form_Element_Textarea($v['name']);
             $element->setAttrib('class', 'editor span12');
             if ($value != '') {
                 $element->setValue($value);
             }
             break;
         case "fileinput":
             $element = new Zend_Form_Element_File($v['name']);
             $element->setAttrib('class', 'input-file');
             break;
         case "captcha":
             $element = new Zend_Form_Element_Captcha($v['name'], array('label' => $this->t("Please verify you are a human"), 'captcha' => $config->site->captcha_adapter, 'captchaOptions' => array('captcha' => $config->site->captcha_adapter, 'wordLen' => 6, 'timeout' => 300)));
             return $element;
             break;
         case "multifileinputs":
             $element = new Zend_Form_Element_File($v['name']);
             $element->setAttrib('class', 'input-file');
             $element->setMultiFile(10);
             break;
         case "multifileinput":
             $name = $v['name'] . "[]";
             $element = new Zend_Form_Element_File($name);
             $element->setAttrib('class', 'input-file');
             $element->setAttrib('multiple', 'multiple');
             $element->setMultiFileForQool(1);
             $this->toTpl('filelist', true);
             break;
         case "checkbox":
             $element = new Zend_Form_Element_Checkbox($v['name']);
             $element->setAttrib('class', 'checkbox');
             $element->setValue($value);
             break;
         case "editarea":
             $this->toTpl('editarea', 1);
             $element = new Zend_Form_Element_Textarea($v['name']);
             $element->setAttrib('class', 'editarea span12');
             $element->setAttrib('id', 'editarea');
             $element->setAttrib('style', 'height:500px');
             if ($value != '') {
                 $element->setValue($value);
             }
             break;
         case "password":
             $element = new Zend_Form_Element_Password($v['name']);
             break;
         case "textarea":
             $element = new Zend_Form_Element_Textarea($v['name']);
             $element->setAttrib('class', 'span9');
             $element->setAttrib('style', 'height:80px');
             if ($value != '') {
                 $element->setValue($value);
             }
             break;
         case "hidden":
             $element = new Zend_Form_Element_Hidden($v['name']);
             $element->setValue($value);
             $element->setDecorators(array("ViewHelper"));
             break;
         case "textinput":
             $element = new Zend_Form_Element_Text($v['name']);
             if ($value != '') {
                 $element->setValue($value);
             }
             break;
         case "selectbox":
             $element = new Zend_Form_Element_Select($v['name']);
             if ($v['use_pool'] && method_exists($this, $v['use_pool'])) {
                 if ($v['pool_type'] != '0') {
                     $this->pool_type = $v['pool_type'];
                 }
                 if ($v['novalue']) {
                     $element->addMultiOption(0, $this->t('No Selection'));
                 }
                 foreach ($this->{$v}['use_pool']() as $ko => $vo) {
                     if ($v['noself'] && $vo['id'] == $v['noself']) {
                     } else {
                         $element->addMultiOption($vo['id'], $vo['title']);
                     }
                 }
                 if ($value != '') {
                     $element->setValue($value);
                 }
             }
             break;
         case "multiselectbox":
             $element = new Zend_Form_Element_Multiselect($v['name']);
             if ($v['use_pool'] && method_exists($this, $v['use_pool'])) {
                 if ($v['pool_type'] != '0') {
                     $this->pool_type = $v['pool_type'];
                 }
                 if ($v['novalue']) {
                     $element->addMultiOption(0, $this->t('No Selection'));
                 }
                 foreach ($this->{$v}['use_pool']() as $ko => $vo) {
                     if ($v['noself'] && $vo['id'] == $v['noself']) {
                     } else {
                         $element->addMultiOption($vo['id'], $vo['title']);
                     }
                 }
                 if (is_array($value)) {
                     foreach ($value as $a) {
                         $vals[] = $a['selected_value'];
                     }
                     $element->setValue($vals);
                 }
             }
             break;
         case "treeselectbox":
             $element = new Zend_Form_Element_Select($v['name']);
             if ($v['use_pool'] && method_exists($this, $v['use_pool'])) {
                 if ($v['pool_type'] != '0') {
                     $this->pool_type = $v['pool_type'];
                 }
                 if ($v['novalue']) {
                     $element->addMultiOption(0, $this->t('No Selection'));
                 }
                 if ($value != '') {
                     $element->setValue($value);
                 }
                 //x10 times nested support. Needs fix
                 foreach ($this->{$v}['use_pool']() as $vo) {
                     $element->addMultiOption($vo['id'], $vo['title']);
                     foreach ($vo['kids'] as $a) {
                         $element->addMultiOption($a['id'], "|_" . $a['title']);
                         foreach ($a['kids'] as $b) {
                             $element->addMultiOption($b['id'], "|__" . $b['title']);
                             foreach ($b['kids'] as $c) {
                                 $element->addMultiOption($c['id'], "|___" . $c['title']);
                                 foreach ($c['kids'] as $d) {
                                     $element->addMultiOption($d['id'], "|____" . $d['title']);
                                     foreach ($d['kids'] as $e) {
                                         $element->addMultiOption($e['id'], "|_____" . $e['title']);
                                         foreach ($e['kids'] as $f) {
                                             $element->addMultiOption($f['id'], "|______" . $f['title']);
                                             foreach ($f['kids'] as $g) {
                                                 $element->addMultiOption($g['id'], "|______" . $g['title']);
                                                 foreach ($g['kids'] as $h) {
                                                     $element->addMultiOption($h['id'], "|_______" . $h['title']);
                                                     foreach ($h['kids'] as $i) {
                                                         $element->addMultiOption($i['id'], "|________" . $i['title']);
                                                         foreach ($i['kids'] as $j) {
                                                             $element->addMultiOption($j['id'], "|_________" . $j['title']);
                                                             foreach ($j['kids'] as $l) {
                                                                 $element->addMultiOption($l['id'], "|__________" . $l['title']);
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             break;
     }
     if ($v['required']) {
         $element->setRequired(true);
     }
     if ($v['title']) {
         $element->setLabel($v['title']);
     } else {
         $element->setLabel($this->t(ucfirst(str_replace("_", " ", $v['name']))));
     }
     if ($v['attributes']) {
         foreach ($v['attributes'] as $k => $r) {
             $element->setAttrib($k, $r);
         }
     }
     //$element->setDecorators(array("ViewHelper"));
     $element = $this->doQoolHook('front_post_getformelement_object', $element);
     return $element;
 }
Exemplo n.º 21
0
 public function initMyForm($cid, $cidresume)
 {
     global $mySession;
     $db = new Db();
     $title_val = "";
     $description_val = "";
     $url_val = "";
     $camplength_val = "";
     $campaign_category_val = '';
     if ($mySession->TeeLoggedID != "") {
         if ($mySession->camptitl != "" && $mySession->showurl != "") {
             //echo "in form with session values"; die;
             $title_val = $mySession->camptitl;
             $description_val = $mySession->descrip;
             $url_val = $mySession->showurl;
             $camplength_val = $mySession->camplength;
             $campaign_category_val = $mySession->campaign_category;
         }
     }
     if ($cid != "") {
         $qur = $db->runquery("SELECT * FROM  " . LAUNCHCAMPAIGN . " WHERE campaign_id='" . $cid . "'");
         if ($qur != "" and count($qur) > 0) {
             //prd($qur);
             $title_val = $qur[0]['title'];
             $description_val = $qur[0]['description'];
             $url_val = $qur[0]['url'];
             $camplength_val = $qur[0]['campaign_length'];
             $campaign_category_val = $qur[0]['campaign_category'];
         }
     }
     # FORM ELEMENT:camptitle
     # TYPE : text
     $camptitle = new Zend_Form_Element_Text('camptitle');
     $camptitle->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'setgoaltxt')->setAttrib("style", "width:450px; height:30px;")->setvalue($title_val);
     # FORM ELEMENT:description
     # TYPE : text
     $description = new Zend_Form_Element_Textarea('description');
     $description->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'setgoaltxt')->setAttrib("style", "width:450px; height:120px;")->setvalue($description_val);
     $daysArr = array();
     $daysArr[1]['key'] = "3";
     $daysArr[1]['value'] = "3 Days";
     $daysArr[2]['key'] = "7";
     $daysArr[2]['value'] = "7 Days";
     $daysArr[3]['key'] = "10";
     $daysArr[3]['value'] = "10 Days";
     $daysArr[4]['key'] = "14";
     $daysArr[4]['value'] = "14 Days";
     $daysArr[5]['key'] = "21";
     $daysArr[5]['value'] = "21 Days";
     $no_ofdays = new Zend_Form_Element_Select('no_ofdays');
     $no_ofdays->addMultiOptions($daysArr)->setAttrib('class', 'setgoaltxt')->setAttrib("style", "width:150px; height:30px;")->setvalue($camplength_val);
     # FORM ELEMENT:url
     # TYPE : text
     if ($cid != "" || $cid != 0) {
         $url = new Zend_Form_Element_Text('url');
         $url->setRequired(true)->setAttrib('class', 'setgoaltxt')->setAttrib("readonly", "readonly")->setAttrib("style", "width:100px; height:30px;")->setvalue($url_val);
     } else {
         /*$url= new Zend_Form_Element_Text('url');
         		$url->setRequired(true)
         		->addDecorator('Errors', array('class'=>'errmsg'))
         		->setAttrib('class','setgoaltxt')
         		->setAttrib("onkeypress","return checkspecchar(event)")
         		->setAttrib('onkeyup','uniqueurl(this.value)')
         		->setAttrib("style","width:100px; height:30px;")
         		->setvalue($url_val);*/
         $url = new Zend_Form_Element_Text('url');
         $url->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'setgoaltxt')->setAttrib('onblur', 'uniqueurl(this.value)')->setAttrib("style", "width:100px; height:30px;")->setvalue($url_val);
     }
     # FORM ELEMENT:check
     # TYPE : text
     $add_checkbox = new Zend_Form_Element_Checkbox('add_checkbox');
     $add_checkbox->setAttrib('onclick', 'opendiv(this.id);');
     $newcheckbx = new Zend_Form_Element_Checkbox('newcheckbx');
     $newcheckbx->setAttrib('onclick', 'newdivaddr(this.id);');
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->addValidator('NotEmpty', true, array('messages' => 'First name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("onkeypress", "return checkcharonly(event);")->setAttrib('class', 'changeaddress');
     if (array_key_exists('newcheckbx', $_REQUEST) && $_REQUEST['newcheckbx'] == 1) {
         $firstname->setRequired(true);
     }
     $firstname->setAttrib("style", "width:180px; height:30px;");
     $this->addElement($firstname);
     # FORM ELEMENT:last name
     # TYPE : text
     $lastname = new Zend_Form_Element_Text('lastname');
     $lastname->addValidator('NotEmpty', true, array('messages' => 'Last name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("onkeypress", "return checkcharonly(event);")->setAttrib('class', 'changeaddress');
     if (array_key_exists('newcheckbx', $_REQUEST) && $_REQUEST['newcheckbx'] == 1) {
         $lastname->setRequired(true);
     }
     $lastname->setAttrib("style", "width:180px; height:30px;");
     //if(@$_REQUEST['lastname']!="")
     //			{
     //			$lastname-> addValidator('Alpha', true)
     //			->addDecorator('Errors', array('class'=>'errmsg'))
     //			->addErrorMessage('Enter only characters');
     //			}
     $this->addElement($lastname);
     # FORM ELEMENT:address
     # TYPE : text
     $newaddress = new Zend_Form_Element_Text('newaddress');
     $newaddress->addValidator('NotEmpty', true, array('messages' => 'Address is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox');
     if (array_key_exists('newcheckbx', $_REQUEST) && $_REQUEST['newcheckbx'] == 1) {
         $newaddress->setRequired(true);
     }
     $this->addElement($newaddress);
     # FORM ELEMENT:city
     # TYPE : text
     $newcity = new Zend_Form_Element_Text('newcity');
     $newcity->addValidator('NotEmpty', true, array('messages' => 'City is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("onkeypress", "return checkcharonly(event);")->setAttrib('class', 'changeaddress');
     if (array_key_exists('newcheckbx', $_REQUEST) && $_REQUEST['newcheckbx'] == 1) {
         $newcity->setRequired(true);
     }
     $newcity->setAttrib("style", "width:100px; height:30px;");
     //if(@$_REQUEST['newcity']!="")
     //			{
     //			$newcity-> addValidator('Alpha', true)
     //			->addDecorator('Errors', array('class'=>'errmsg'))
     //			->addErrorMessage('Enter only characters');
     //			}
     $this->addElement($newcity);
     # FORM ELEMENT:state
     # TYPE : text
     $StateArr = array();
     $StateArr[0]['key'] = "";
     $StateArr[0]['value'] = "- - Select  State- -";
     $StateData = $db->runQuery("select * from " . STATE . " order by state_name");
     if ($StateData != "" and count($StateData) > 0) {
         $i = 1;
         foreach ($StateData as $key => $StateValues) {
             $StateArr[$i]['key'] = $StateValues['state_id'];
             $StateArr[$i]['value'] = $StateValues['state_name'];
             $i++;
         }
     }
     $newstate = new Zend_Form_Element_Select('newstate');
     $newstate->addMultiOptions($StateArr)->addValidator('NotEmpty', true, array('messages' => 'State is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress');
     if (array_key_exists('newcheckbx', $_REQUEST) && $_REQUEST['newcheckbx'] == 1) {
         $newstate->setRequired(true);
     }
     $newstate->setAttrib("style", "width:100px; height:33px;")->setAttrib("onchange", "getneighborhoodcities(this.value);");
     $this->addElement($newstate);
     # FORM ELEMENT:zipcode
     # TYPE : text
     $newzipcode = new Zend_Form_Element_Text('newzipcode');
     $newzipcode->addValidator('NotEmpty', true, array('messages' => 'zip code is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setAttrib("onkeypress", "return checknummsp(event);");
     if (array_key_exists('newcheckbx', $_REQUEST) && $_REQUEST['newcheckbx'] == 1) {
         $newzipcode->setRequired(true);
     }
     $newzipcode->setAttrib("style", "width:100px; height:30px;");
     //if(@$_REQUEST['newzipcode']!="")
     //			{
     //			$newzipcode-> addValidator('Digits', true)
     //			->addDecorator('Errors', array('class'=>'errmsg'))
     //			->addErrorMessage('Please enter only numbers');
     //			}
     //
     $this->addElement($newzipcode);
     # FORM ELEMENT:instruction
     # TYPE : text
     $instruction = new Zend_Form_Element_Textarea('instruction');
     $instruction->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'setgoaltxt');
     if (array_key_exists('newcheckbx', $_REQUEST) && $_REQUEST['newcheckbx'] == 1) {
         $instruction->setRequired(true);
     }
     $instruction->setAttrib("style", "width:450px; height:120px;");
     $this->addElement($instruction);
     $address_val = "";
     $val1 = "";
     $val2 = "";
     $city_val = "";
     $state_val = "";
     $zip_val = "";
     $qur = $db->runquery("SELECT * FROM  " . ADDRESS . " WHERE user_id='" . $mySession->TeeLoggedID . "' ");
     //$qur=$db->runquery("select * from ".ADDRESS." join ".STATE." on ".STATE.".state_id=".ADDRESS.".state where user_id='".$mySession->TeeLoggedID."' ");
     if ($qur != "" and count($qur) > 0) {
         $public_name = $qur[0]['public_name'];
         $address_val = explode("||", $qur[0]['address']);
         //prd($address_val);
         //prd($address_val);
         $val1 = $address_val[0];
         $val2 = $address_val[1];
         $city_val = $qur[0]['city'];
         $state_val = $qur[0]['state'];
         $zip_val = $qur[0]['zipcode'];
     }
     # FORM ELEMENT:first name
     # TYPE : text
     //	$firstname= new Zend_Form_Element_Text('firstname');
     //			$firstname
     //			->addValidator('NotEmpty',true,array('messages' =>'First name is required'))
     //			->addDecorator('Errors', array('class'=>'errmsg'))
     //			->setAttrib('class','changeaddress');
     //
     //			if($_REQUEST['add_checkbox']==1)
     //			{
     //			$instruction->setRequired(true);
     //			}
     //			$firstname->setAttrib("style","width:180px; height:30px;");
     //			$this->addElement($firstname);
     //
     //
     //			# FORM ELEMENT:last name
     //			# TYPE : text
     //
     //			$lastname= new Zend_Form_Element_Text('lastname');
     //			$lastname
     //			->addValidator('NotEmpty',true,array('messages' =>'Last name is required'))
     //			->addDecorator('Errors', array('class'=>'errmsg'))
     //			->setAttrib('class','changeaddress');
     //			if($_REQUEST['add_checkbox']==1)
     //			{
     //			$instruction->setRequired(true);
     //			}
     //			$lastname->setAttrib("style","width:180px; height:30px;");
     //			$this->addElement($lastname);
     //
     # FORM ELEMENT:address
     # TYPE : text
     $address = new Zend_Form_Element_Text('address');
     $address->addValidator('NotEmpty', true, array('messages' => 'Address is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox')->setAttrib("readonly", "readonly")->setValue($val1);
     //	if($_REQUEST['add_checkbox']==1)
     //			{
     //			$instruction->setRequired(true);
     //			}
     $this->addElement($address);
     $address1 = new Zend_Form_Element_Text('address1');
     $address1->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox')->setAttrib("readonly", "readonly")->setValue($val2);
     $this->addElement($address1);
     # FORM ELEMENT:city
     # TYPE : text
     $city = new Zend_Form_Element_Text('city');
     $city->addValidator('NotEmpty', true, array('messages' => 'City is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setAttrib("readonly", "readonly")->setValue($city_val);
     //if($_REQUEST['add_checkbox']==1)
     //			{
     //			$instruction->setRequired(true);
     //			}
     $city->setAttrib("style", "width:100px; height:30px;");
     $this->addElement($city);
     # FORM ELEMENT:state
     # TYPE : text
     $StateArr = array();
     $StateArr[0]['key'] = "";
     $StateArr[0]['value'] = "- - Select  State- -";
     $StateData = $db->runQuery("select * from " . STATE . " order by state_name");
     if ($StateData != "" and count($StateData) > 0) {
         $i = 1;
         foreach ($StateData as $key => $StateValues) {
             $StateArr[$i]['key'] = $StateValues['state_id'];
             $StateArr[$i]['value'] = $StateValues['state_name'];
             $i++;
         }
     }
     $state = new Zend_Form_Element_Select('state');
     $state->addMultiOptions($StateArr)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setValue($state_val);
     //if($_REQUEST['add_checkbox']==1)
     //			{
     //			$instruction->setRequired(true);
     //			}
     $state->setAttrib("style", "width:100px; height:33px;")->setAttrib("onchange", "getneighborhoodcities(this.value);");
     $this->addElement($state);
     # FORM ELEMENT:zipcode
     # TYPE : text
     $zipcode = new Zend_Form_Element_Text('zipcode');
     $zipcode->addValidator('NotEmpty', true, array('messages' => 'zip code is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setAttrib("readonly", "readonly")->setValue($zip_val);
     //if($_REQUEST['add_checkbox']==1)
     //			{
     //			$instruction->setRequired(true);
     //			}
     $zipcode->setAttrib("style", "width:100px; height:30px;");
     $this->addElement($zipcode);
     // Campaign category
     $CampaignCaArr = array();
     $CampaignCaArr[1]['key'] = "1";
     $CampaignCaArr[1]['value'] = "Discover";
     $CampaignCaArr[2]['key'] = "2";
     $CampaignCaArr[2]['value'] = "Support";
     $campaign_category = new Zend_Form_Element_Select('campaign_category');
     $campaign_category->addMultiOptions($CampaignCaArr)->setAttrib('class', 'setgoaltxt')->setAttrib("style", "width:150px; height:30px;")->setvalue($campaign_category_val);
     $this->addElements(array($camptitle, $description, $no_ofdays, $url, $newcheckbx, $add_checkbox, $campaign_category));
 }
 public function addInterfaceCheckbox($value)
 {
     $form = new Zend_Form();
     $checkbox_element = new Zend_Form_Element_Checkbox("checktoogleInterface");
     $checkbox_element->setValue($value);
     $checkbox_element->setAttrib("id", "checktoogleInterface");
     $form->addElement($checkbox_element);
     $form->setElementDecorators(array('ViewHelper'));
     $form->setDecorators(array('FormElements', 'Form'));
     $this->view->interfacingcheckbox = $form;
 }
Exemplo n.º 23
0
 /**
  * Accepts an array with parameters and mixed values and returns a Zend Form Element to be used by a Zend Form object
  *
  * @param array $v
  * @param mixed $value
  * @return object
  */
 function getFormElement($v, $value = '')
 {
     $config = $this->config;
     $this->toTpl('hasForm', 1);
     $v = $this->doQoolHook('pre_getformelement_element', $v);
     $value = $this->doQoolHook('pre_getformelement_value', $value);
     switch ($v['value']) {
         case "editor":
             $this->loadEditorBtns();
             $this->toTpl("loadEditor", 1);
             $this->toTpl("isEditor", 1);
             $element = new Zend_Form_Element_Textarea($v['name']);
             $element->setAttrib('class', 'editor span12');
             if ($value != '') {
                 $element->setValue($value);
             }
             break;
         case "rte":
             $element = new Zend_Form_Element_Textarea($v['name']);
             $element->setAttrib('class', 'cleditor span12');
             $this->toTpl("isRTE", 1);
             if ($value != '') {
                 $element->setValue($value);
             }
             break;
         case "fileinput":
             $element = new Zend_Form_Element_File($v['name']);
             $element->setAttrib('class', 'input-file');
             break;
         case "dropboxchooser":
             $element = new Zend_Form_Element_Dropbox($v['name']);
             $element->setAttrib('style', 'visibility:hidden');
             $element->setAttrib('data-multiselect', true);
             break;
         case "captcha":
             if ($config->site->captcha_adapter == 'ReCaptcha') {
                 //Do whats needed for recaptcha to work with form
             }
             $element = new Zend_Form_Element_Captcha($v['name'], array('label' => $this->t("Please verify you are a human"), 'captcha' => $config->site->captcha_adapter, 'captchaOptions' => array('captcha' => $config->site->captcha_adapter, 'wordLen' => 6, 'timeout' => 300)));
             return $element;
             break;
         case "multifileinputs":
             $element = new Zend_Form_Element_File($v['name']);
             $element->setAttrib('class', 'input-file');
             $element->setMultiFile(10);
             break;
         case "multifileinput":
             $name = $v['name'] . "[]";
             $element = new Zend_Form_Element_File($name);
             $element->setAttrib('class', 'input-file');
             $element->setAttrib('multiple', 'multiple');
             $element->setMultiFileForQool(1);
             $this->toTpl('filelist', true);
             break;
         case "checkbox":
             $element = new Zend_Form_Element_Checkbox($v['name']);
             $element->setAttrib('class', 'checkbox');
             $element->setValue($value);
             break;
         case "editarea":
             $this->toTpl('editarea', 1);
             $element = new Zend_Form_Element_Textarea($v['name']);
             $element->setAttrib('class', 'editarea span12');
             $element->setAttrib('id', 'editarea');
             $element->setAttrib('style', 'height:500px');
             if ($value != '') {
                 $element->setValue($value);
             }
             break;
         case "password":
             $element = new Zend_Form_Element_Password($v['name']);
             break;
         case "textarea":
             $element = new Zend_Form_Element_Textarea($v['name']);
             $element->setAttrib('class', 'span9');
             $element->setAttrib('style', 'height:80px');
             if ($value != '') {
                 $element->setValue($value);
             }
             break;
         case "hidden":
             $element = new Zend_Form_Element_Hidden($v['name']);
             $element->setValue($value);
             $element->setDecorators(array("ViewHelper"));
             break;
         case "textinput":
             $element = new Zend_Form_Element_Text($v['name']);
             if ($value != '') {
                 $element->setValue($value);
             }
             break;
         case "datepicker":
             $element = new Zend_Form_Element_Text($v['name']);
             $element->setAttrib('class', 'input-xlarge datepicker');
             if ($value != '') {
                 $element->setValue($value);
             }
             break;
         case "imageselect":
             $element = new Zend_Form_Element_Text($v['name']);
             $element->setAttrib('class', 'imageselector');
             $this->toTpl("hiddenEditor", 1);
             if ($value != '') {
                 $element->setValue($value);
             }
             break;
         case "selectbox":
             $element = new Zend_Form_Element_Select($v['name']);
             if ($v['use_pool'] && method_exists($this, $v['use_pool'])) {
                 if ($v['pool_type'] != '0') {
                     $this->pool_type = $v['pool_type'];
                 }
                 if ($v['novalue']) {
                     $element->addMultiOption(0, $this->t('No Selection'));
                 }
                 foreach ($this->{$v}['use_pool']() as $ko => $vo) {
                     if ($v['noself'] && $vo['id'] == $v['noself']) {
                     } else {
                         $element->addMultiOption($vo['id'], $vo['title']);
                     }
                 }
                 if ($value != '') {
                     $element->setValue($value);
                 }
             } elseif (is_array($v['use_pool'])) {
                 if ($v['novalue']) {
                     $element->addMultiOption(0, $this->t('No Selection'));
                 }
                 foreach ($v['use_pool'] as $ko => $vo) {
                     if ($v['noself'] && $vo['id'] == $v['noself']) {
                     } else {
                         $element->addMultiOption($vo['id'], $vo['title']);
                     }
                 }
                 if ($value != '') {
                     $element->setValue($value);
                 }
             } elseif ($v['use_pool']) {
                 //the pools might have been assigned by an addon
                 //include the file and run it.
                 require_once $this->dirs['structure']['addons'] . DIR_SEP . Zend_Registry::get('controller') . DIR_SEP . "func.php";
                 if ($v['novalue']) {
                     $element->addMultiOption(0, $this->t('No Selection'));
                 }
                 foreach ($v['use_pool']($this) as $ko => $vo) {
                     if ($v['noself'] && $vo['id'] == $v['noself']) {
                     } else {
                         $element->addMultiOption($vo['id'], $vo['title']);
                     }
                 }
                 if ($value != '') {
                     $element->setValue($value);
                 }
             }
             break;
         case "multiselectbox":
             $element = new Zend_Form_Element_Multiselect($v['name']);
             $element->setAttrib('data-rel', 'chosen');
             if ($v['use_pool'] && method_exists($this, $v['use_pool'])) {
                 if ($v['pool_type'] != '0') {
                     $this->pool_type = $v['pool_type'];
                 }
                 if ($v['novalue']) {
                     $element->addMultiOption(0, $this->t('No Selection'));
                 }
                 foreach ($this->{$v}['use_pool']() as $ko => $vo) {
                     if ($v['noself'] && $vo['id'] == $v['noself']) {
                     } else {
                         $element->addMultiOption($vo['id'], $vo['title']);
                     }
                 }
                 if (is_array($value)) {
                     foreach ($value as $a) {
                         $vals[] = $a['selected_value'];
                     }
                     $element->setValue($vals);
                 }
             } else {
                 //the pools might have been assigned by an addon
                 //include the file and run it.
                 require_once $this->dirs['structure']['addons'] . DIR_SEP . Zend_Registry::get('controller') . DIR_SEP . "func.php";
                 if ($v['novalue']) {
                     $element->addMultiOption(0, $this->t('No Selection'));
                 }
                 foreach ($v['use_pool']($this) as $ko => $vo) {
                     if ($v['noself'] && $vo['id'] == $v['noself']) {
                     } else {
                         $element->addMultiOption($vo['id'], $vo['title']);
                     }
                 }
                 if ($value != '') {
                     $element->setValue($value);
                 }
             }
             break;
         case "treeselectbox":
             $element = new Zend_Form_Element_Select($v['name']);
             if ($v['use_pool'] && method_exists($this, $v['use_pool'])) {
                 if ($v['pool_type'] != '0') {
                     $this->pool_type = $v['pool_type'];
                 }
                 if ($v['novalue']) {
                     $element->addMultiOption(0, $this->t('No Selection'));
                 }
                 if ($value != '') {
                     $element->setValue($value);
                 }
                 //x10 times nested support. Needs fix
                 foreach ($this->{$v}['use_pool']() as $vo) {
                     $element->addMultiOption($vo['id'], $vo['title']);
                     foreach ($vo['kids'] as $a) {
                         $element->addMultiOption($a['id'], "|_" . $a['title']);
                         foreach ($a['kids'] as $b) {
                             $element->addMultiOption($b['id'], "|__" . $b['title']);
                             foreach ($b['kids'] as $c) {
                                 $element->addMultiOption($c['id'], "|___" . $c['title']);
                                 foreach ($c['kids'] as $d) {
                                     $element->addMultiOption($d['id'], "|____" . $d['title']);
                                     foreach ($d['kids'] as $e) {
                                         $element->addMultiOption($e['id'], "|_____" . $e['title']);
                                         foreach ($e['kids'] as $f) {
                                             $element->addMultiOption($f['id'], "|______" . $f['title']);
                                             foreach ($f['kids'] as $g) {
                                                 $element->addMultiOption($g['id'], "|______" . $g['title']);
                                                 foreach ($g['kids'] as $h) {
                                                     $element->addMultiOption($h['id'], "|_______" . $h['title']);
                                                     foreach ($h['kids'] as $i) {
                                                         $element->addMultiOption($i['id'], "|________" . $i['title']);
                                                         foreach ($i['kids'] as $j) {
                                                             $element->addMultiOption($j['id'], "|_________" . $j['title']);
                                                             foreach ($j['kids'] as $l) {
                                                                 $element->addMultiOption($l['id'], "|__________" . $l['title']);
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             break;
     }
     if ($v['required']) {
         $element->setRequired(true);
     }
     if ($v['title']) {
         $element->setLabel($v['title']);
     } else {
         $element->setLabel($this->t(ucfirst(str_replace("_", " ", $v['name']))));
     }
     if ($v['attributes']) {
         foreach ($v['attributes'] as $k => $r) {
             $element->setAttrib($k, $r);
         }
     }
     //$element->setDecorators(array("ViewHelper"));
     $element = $this->doQoolHook('post_getformelement_object', $element);
     return $element;
 }
Exemplo n.º 24
0
 public function init()
 {
     $this->decoradores = array('ViewHelper', array('Errors', array('tag' => 'div', 'style' => 'color:red;')), 'HtmlTag', 'Label');
     $this->validatorLenghtCP = new Zend_Validate_StringLength(5, 5);
     $this->validatorLenghtCP->setMessages(array(Zend_Validate_StringLength::TOO_SHORT => 'El CP es de %min% digitos.', Zend_Validate_StringLength::TOO_LONG => 'El CP es de %max% digitos.'));
     // Operacion OLD
     /*
     $this->addElement(
                             'select', 
                             'operacion', 
                             array(
                                     'label' => ' ', 
                                     'required' => false, 
                                     'filters' => array('stringTrim')
                                  )
                       );
     
     $operacion = array('0' => 'Alquiler', '1' => 'Venta');
     
     $this->operacion->addMultiOptions($operacion);  
     //$this->municipio->removeDecorator('Errors');
     $this->operacion->setAttrib('class','form_select_medium');
     $this->operacion->removeDecorator('HtmlTag');
     $this->operacion->removeDecorator('Label');
     */
     $this->addElement('select', 'operacion', array('label' => ' ', 'required' => false, 'filters' => array('stringTrim')));
     $operacion = array('0' => 'Apartamentos en alquiler', '1' => 'Habitación individual en alquiler', '2' => 'Habitación doble en alquiler');
     $this->operacion->addMultiOptions($operacion);
     //$this->municipio->removeDecorator('Errors');
     $this->operacion->setAttrib('class', 'form_select_medium');
     $this->operacion->removeDecorator('HtmlTag');
     $this->operacion->removeDecorator('Label');
     // Tipo vivienda
     /*
     $this->addElement(  'radio', 
                         'tipoVivienda', 
                         array(  'label' => 'Tipo de vivienda (*)',
                                 'multiOptions' => array(
                                                             
                                                             0 => 'Piso',
                                                             1 => 'Dúplex',
                                                             2 => 'Estudio',
                                                             3 => 'Ático',
                                                             4 => 'Loft',
                                                             5 => 'Casa/Chalet'
                                                        )
                                             ));        
     
     $this->tipoVivienda->setValue('Piso');
     $this->tipoVivienda->setAttrib('class','form_input_contact');
     $this->tipoVivienda->removeDecorator('Errors');
     $this->tipoVivienda->removeDecorator('HtmlTag');
     $this->tipoVivienda->removeDecorator('Label');
     */
     //Precio / Mes
     $this->addElement('text', 'precio', array('label' => 'Precio / Mes (*)', 'required' => true, 'filters' => array('stringTrim')));
     $this->precio->addValidator('NotEmpty', true, array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => 'Ingresar el precio.')));
     $this->precio->addValidator('digits', true, array('messages' => array(Zend_Validate_Digits::NOT_DIGITS => 'Ingresar cantidad entera')));
     $this->precio->setDecorators($this->decoradores);
     $this->precio->setAttrib('class', 'form_input_contact_small');
     //$this->precio->removeDecorator('Errors');
     $this->precio->removeDecorator('HtmlTag');
     $this->precio->removeDecorator('Label');
     // Deposito
     $this->addElement('text', 'deposito', array('label' => 'Deposito', 'required' => false, 'filters' => array('stringTrim')));
     $this->deposito->setAttrib('class', 'form_input_contact_small');
     $this->deposito->removeDecorator('Errors');
     $this->deposito->removeDecorator('HtmlTag');
     $this->deposito->removeDecorator('Label');
     // Superficie
     /*
     $this->addElement(
                         'text', 
                         'superficie', 
                         array(
                                 'label' => 'Superficie (m2) (*)', 
                                 'required' => true, 
                                 'filters' => array('stringTrim')
                           )
                  );
     
     $this->superficie->addValidator('NotEmpty',
                      true,
                      array('messages' => array(
                                                 Zend_Validate_NotEmpty::IS_EMPTY => 'Ingresar la superficie m2.'
                                               )
                           ));
     
     $this->superficie->addValidator('digits', true, array('messages' => array(Zend_Validate_Digits::NOT_DIGITS => 'Ingresar cantidad entera')));
     $this->superficie->setDecorators($this->decoradores);
     $this->superficie->setAttrib('class','form_input_contact_small');
     //$this->superficie->removeDecorator('Errors');
     $this->superficie->removeDecorator('HtmlTag');
     $this->superficie->removeDecorator('Label');
     */
     // Número de dormitorios
     $dbDormitorio = new Application_Model_DbTable_TipoDormitorio();
     $dormitorios = $dbDormitorio->getDormitoriosList();
     $this->addElement('select', 'numeroDormitorios', array('label' => ' ', 'required' => false, 'filters' => array('stringTrim')));
     /*   foreach($dormitorios as $key => $value){
             $this->numeroDormitorios->addMultiOption($key,$value);
          }*/
     $this->numeroDormitorios->addMultiOptions($dormitorios);
     //$this->numeroDormitorios->removeDecorator('Errors');
     $this->numeroDormitorios->setAttrib('class', 'form_select_bit');
     $this->numeroDormitorios->removeDecorator('HtmlTag');
     $this->numeroDormitorios->removeDecorator('Label');
     // Número de baños
     $dbBanyo = new Application_Model_DbTable_TipoBanyo();
     $banyos = $dbBanyo->getBanyosList();
     $this->addElement('select', 'numeroBanyos', array('label' => ' ', 'required' => false, 'filters' => array('stringTrim')));
     /*   foreach($banyos as $key => $value){
             $this->numeroBanyos->addMultiOption($key,$value);
          }*/
     $this->numeroBanyos->addMultiOptions($banyos);
     //$this->numeroBanyos->removeDecorator('Errors');
     $this->numeroBanyos->setAttrib('class', 'form_select_bit');
     $this->numeroBanyos->removeDecorator('HtmlTag');
     $this->numeroBanyos->removeDecorator('Label');
     // Titulo anuncio
     $this->addElement('text', 'titulo', array('label' => 'Titulo (*)', 'required' => true, 'filters' => array('stringTrim')));
     $this->titulo->addValidator('NotEmpty', true, array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => 'Ingresar titulo del anuncio.')));
     $this->titulo->setDecorators($this->decoradores);
     $this->titulo->setAttrib('class', 'form_input_contact');
     //$this->titulo->removeDecorator('Errors');
     $this->titulo->removeDecorator('HtmlTag');
     $this->titulo->removeDecorator('Label');
     // Descripcion completa
     $this->addElement('textarea', 'descripcion', array('label' => 'Descripción completa', 'required' => false, 'filters' => array('stringTrim')));
     //$this->descripcion->setDecorators($this->decoradores);
     $this->descripcion->setAttrib('class', 'form_input_contact');
     $this->descripcion->removeDecorator('Errors');
     $this->descripcion->removeDecorator('HtmlTag');
     $this->descripcion->removeDecorator('Label');
     // Alta de suministros
     /* Versión para la web*/
     $altaSuministros = new Zend_Form_Element_Checkbox('altaSuministros');
     $altaSuministros->setLabel('Alta de suministros')->setRequired(FALSE);
     $altaSuministros->setUncheckedValue(0);
     $altaSuministros->setCheckedValue(1);
     $altaSuministros->setAttrib('class', 'form_input_contact_very_small');
     $altaSuministros->removeDecorator('Errors');
     $altaSuministros->removeDecorator('HtmlTag');
     $altaSuministros->removeDecorator('Label');
     $this->addElement($altaSuministros);
     /*
     $this->addElement(
                         'checkBox',
                         'altaSuministros',
                         array   (
                                     'label' => 'Alta de suministros',
                                     'required' => false,
                                     'checkedValue' => '1',
                                     'uncheckedValue'  => '0',
                                 )
                       ); 
     
     $this->altaSuministros->setAttrib('class','form_input_contact_very_small');
     $this->altaSuministros->removeDecorator('Errors');
     $this->altaSuministros->removeDecorator('HtmlTag');
     $this->altaSuministros->removeDecorator('Label');
     */
     // Ascensor
     /*
     $ascensor = new Zend_Form_Element_Checkbox('ascensor');
     $ascensor->setLabel('Ascensor')
              ->setRequired(FALSE);
     
     $ascensor->setUncheckedValue(0);
     $ascensor->setCheckedValue(1);
     $ascensor->setAttrib('class','form_input_contact_very_small');
     $ascensor->removeDecorator('Errors');
     $ascensor->removeDecorator('HtmlTag');
     $ascensor->removeDecorator('Label');
     $this->addElement($ascensor);
     */
     $this->addElement('checkBox', 'ascensor', array('label' => 'Ascensor', 'required' => false, 'checkedValue' => '1', 'uncheckedValue' => '0'));
     $this->ascensor->setAttrib('class', 'form_input_contact_very_small');
     $this->ascensor->removeDecorator('Errors');
     $this->ascensor->removeDecorator('HtmlTag');
     $this->ascensor->removeDecorator('Label');
     // Piso exterior
     $this->addElement('checkBox', 'pisoExterior', array('label' => 'Piso exterior', 'required' => false, 'checkedValue' => '1', 'uncheckedValue' => '0'));
     $this->pisoExterior->setAttrib('class', 'form_input_contact_very_small');
     $this->pisoExterior->removeDecorator('Errors');
     $this->pisoExterior->removeDecorator('HtmlTag');
     $this->pisoExterior->removeDecorator('Label');
     // Balcon
     $this->addElement('checkBox', 'balcon', array('label' => 'Balcón', 'required' => false, 'checkedValue' => '1', 'uncheckedValue' => '0'));
     $this->balcon->setAttrib('class', 'form_input_contact_very_small');
     $this->balcon->removeDecorator('Errors');
     $this->balcon->removeDecorator('HtmlTag');
     $this->balcon->removeDecorator('Label');
     // Amueblado
     /*
     $this->addElement(  'radio', 
                         'amueblado', 
                         array(  'label' => '¿Amueblado?',
                                 'multiOptions' => array(
                                                             
                                                             1 => 'Si',
                                                             0 => 'No',
                                                        ),
                                             ));        
     
     //$this->amueblado->setAttrib('class','radio-amueblado');
     $this->amueblado->removeDecorator('Errors');
     $this->amueblado->removeDecorator('HtmlTag');
     $this->amueblado->removeDecorator('Label');
     */
     // Código postal
     $this->addElement('text', 'codigoPostal', array('label' => 'Código Postal (*)', 'required' => true, 'filters' => array('stringTrim')));
     $this->codigoPostal->addValidator('NotEmpty', true, array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => 'Ingresar el CP.')));
     //$this->codigoPostal->addValidator('stringLength', false, array(5, 5));
     $this->codigoPostal->addValidator($this->validatorLenghtCP);
     $this->codigoPostal->addValidator('digits', true, array('messages' => array(Zend_Validate_Digits::NOT_DIGITS => 'Sólo digitos')));
     $this->codigoPostal->setDecorators($this->decoradores);
     $this->codigoPostal->setAttrib('class', 'form_input_contact_small');
     //$this->codigoPostal->removeDecorator('Errors');
     $this->codigoPostal->removeDecorator('HtmlTag');
     $this->codigoPostal->removeDecorator('Label');
     // Provincia
     $this->addElement('text', 'provincia', array('label' => 'Provincia (*)', 'required' => false, 'filters' => array('stringTrim'), 'value' => 'Barcelona'));
     $this->provincia->setAttrib('disabled', 'disabled');
     $this->provincia->setAttrib('class', 'form_input_contact_small');
     $this->provincia->removeDecorator('Errors');
     $this->provincia->removeDecorator('HtmlTag');
     $this->provincia->removeDecorator('Label');
     // Municipio
     $dbMunicipio = new Application_Model_DbTable_Municipio();
     $municipios = $dbMunicipio->getMunicipiosList();
     $this->addElement('select', 'municipio', array('label' => ' ', 'required' => false, 'filters' => array('stringTrim')));
     /*   foreach($municipios as $key => $value){
             $this->municipio->addMultiOption($key,$value);
          }*/
     $this->municipio->addMultiOptions($municipios);
     //$this->municipio->removeDecorator('Errors');
     $this->municipio->setAttrib('class', 'form_select_medium');
     $this->municipio->removeDecorator('HtmlTag');
     $this->municipio->removeDecorator('Label');
     // Tipo de via
     $dbVias = new Application_Model_DbTable_TipoVias();
     $vias = $dbVias->getViasList();
     $this->addElement('select', 'tipoVia', array('label' => ' ', 'required' => false, 'filters' => array('stringTrim')));
     /*   foreach($vias as $key => $value){
             $this->tipoVia->addMultiOption($key,$value);
          }*/
     $this->tipoVia->addMultiOptions($vias);
     //$this->tipoVia->removeDecorator('Errors');
     $this->tipoVia->setAttrib('class', 'form_select_medium');
     $this->tipoVia->removeDecorator('HtmlTag');
     $this->tipoVia->removeDecorator('Label');
     //Nombre de la calle
     $this->addElement('text', 'direccion', array('label' => 'Nombre de la calle (*)', 'required' => true, 'filters' => array('stringTrim')));
     $this->direccion->addValidator('NotEmpty', true, array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => 'Ingresar la dirección.')));
     $this->direccion->setDecorators($this->decoradores);
     $this->direccion->setAttrib('class', 'form_input_contact');
     //$this->direccion->removeDecorator('Errors');
     $this->direccion->removeDecorator('HtmlTag');
     $this->direccion->removeDecorator('Label');
     // Nº
     $this->addElement('text', 'numero', array('label' => 'Nº (*)', 'required' => true, 'filters' => array('stringTrim')));
     $this->numero->addValidator('NotEmpty', true, array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => 'Ingresar el Nº.')));
     //$this->numero->addValidator('stringLength', false, array(5, 5));
     //$this->numero->addValidator( $this->validatorLenghtCP );
     $this->numero->addValidator('digits', true, array('messages' => array(Zend_Validate_Digits::NOT_DIGITS => 'Sólo digitos')));
     $this->numero->setDecorators($this->decoradores);
     $this->numero->setAttrib('class', 'form_input_contact_small');
     //$this->numero->removeDecorator('Errors');
     $this->numero->removeDecorator('HtmlTag');
     $this->numero->removeDecorator('Label');
     // Bis
     $this->addElement('checkBox', 'bis', array('label' => 'Bis', 'required' => false, 'checkedValue' => '1', 'uncheckedValue' => '0'));
     $this->bis->setAttrib('class', 'form_input_contact_very_small');
     $this->bis->removeDecorator('Errors');
     $this->bis->removeDecorator('HtmlTag');
     $this->bis->removeDecorator('Label');
     // S/N
     $this->addElement('checkBox', 'sinNumero', array('label' => 'S/N', 'required' => false, 'checkedValue' => '1', 'uncheckedValue' => '0'));
     $this->sinNumero->setAttrib('class', 'form_input_contact_very_small');
     $this->sinNumero->removeDecorator('Errors');
     $this->sinNumero->removeDecorator('HtmlTag');
     $this->sinNumero->removeDecorator('Label');
     // Escalera
     $this->addElement('text', 'escalera', array('label' => 'Escalera (*)', 'required' => false, 'filters' => array('stringTrim')));
     $this->escalera->setAttrib('class', 'form_input_contact_small');
     $this->escalera->removeDecorator('Errors');
     $this->escalera->removeDecorator('HtmlTag');
     $this->escalera->removeDecorator('Label');
     // Piso / Planta
     $dbPlantas = new Application_Model_DbTable_TipoPlanta();
     $plantas = $dbPlantas->getPlantasList();
     $this->addElement('select', 'tipoPlanta', array('label' => ' ', 'required' => false, 'filters' => array('stringTrim')));
     /*   foreach($plantas as $key => $value){
             $this->tipoPlanta->addMultiOption($key,$value);
          }*/
     $this->tipoPlanta->addMultiOptions($plantas);
     //$this->tipoPlanta->removeDecorator('Errors');
     $this->tipoPlanta->setAttrib('class', 'form_select_medium');
     $this->tipoPlanta->removeDecorator('HtmlTag');
     $this->tipoPlanta->removeDecorator('Label');
     // Puerta
     $this->addElement('text', 'puerta', array('label' => 'Puerta', 'required' => false, 'filters' => array('stringTrim')));
     $this->puerta->setAttrib('class', 'form_input_contact_small');
     $this->puerta->removeDecorator('Errors');
     $this->puerta->removeDecorator('HtmlTag');
     $this->puerta->removeDecorator('Label');
     // Otra información
     $this->addElement('textarea', 'informacion', array('label' => 'Otra información', 'required' => false, 'filters' => array('stringTrim')));
     $this->informacion->setAttrib('class', 'form_input_contact');
     $this->informacion->removeDecorator('Errors');
     $this->informacion->removeDecorator('HtmlTag');
     $this->informacion->removeDecorator('Label');
     $this->addElement('Submit', 'Grabar');
 }
Exemplo n.º 25
0
 public function myInit($cid)
 {
     global $mySession;
     $db = new Db();
     $public_name = "";
     $description_val = "";
     $shippingaddr = "";
     $firstname_val = "";
     $lastname_val = "";
     $address_val = "";
     $city_val = "";
     $state_val = "";
     $zipcode_val = "";
     $url_val = "";
     $instruction_val = '';
     $qur = $db->runquery("SELECT * FROM  " . LAUNCHCAMPAIGN . " WHERE campaign_id='" . $cid . "' ");
     if ($qur != "" and count($qur) > 0) {
         $public_name = $qur[0]['title'];
         $url_val = $qur[0]['url'];
         $description_val = $qur[0]['description'];
         $shippingaddr_val = $qur[0]['new_address'];
     }
     $url = new Zend_Form_Element_Hidden('url');
     $url->setValue($url_val);
     $this->addElement($url);
     # FORM ELEMENT:camptitle
     # TYPE : text
     $camptitle = new Zend_Form_Element_Text('camptitle');
     $camptitle->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'setgoaltxt')->setAttrib("style", "width:450px; height:30px;")->setValue($public_name);
     # FORM ELEMENT:description
     # TYPE : text
     $description = new Zend_Form_Element_Textarea('description');
     $description->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'setgoaltxt')->setAttrib("style", "width:450px; height:120px;")->setValue($description_val);
     # FORM ELEMENT:check
     # TYPE : text
     $shippingaddr = new Zend_Form_Element_Checkbox('shippingaddr');
     $shippingaddr->setAttrib('onclick', 'opendiv(this.id);');
     if ($shippingaddr_val == 1) {
         $qur1 = $db->runquery("SELECT * FROM  " . SHIPPING_ADDRESS . " WHERE url='" . $url_val . "' ");
         //prd($qur1);
         if ($qur1 != "" and count($qur1) > 0) {
             $firstname_val = $qur1[0]['fname'];
             $lastname_val = $qur1[0]['lname'];
             $address_val = $qur1[0]['address'];
             $city_val = $qur1[0]['city'];
             $state_val = $qur1[0]['state'];
             $instruction_val = $qur1[0]['instruction'];
             $zipcode_val = $qur1[0]['zipcode'];
         }
     }
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->addValidator('NotEmpty', true, array('messages' => 'First name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("onkeypress", "return checkcharonly(event);")->setAttrib('class', 'changeaddress');
     if (array_key_exists('shippingaddr', $_REQUEST) && $_REQUEST['shippingaddr'] == 1) {
         $firstname->setRequired(true);
     }
     $firstname->setAttrib("style", "width:180px; height:30px;")->setValue($firstname_val);
     $this->addElement($firstname);
     # FORM ELEMENT:last name
     # TYPE : text
     $lastname = new Zend_Form_Element_Text('lastname');
     $lastname->addValidator('NotEmpty', true, array('messages' => 'Last name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("onkeypress", "return checkcharonly(event);")->setAttrib('class', 'changeaddress');
     if (array_key_exists('shippingaddr', $_REQUEST) && $_REQUEST['shippingaddr'] == 1) {
         $lastname->setRequired(true);
     }
     $lastname->setAttrib("style", "width:180px; height:30px;")->setValue($lastname_val);
     $this->addElement($lastname);
     # FORM ELEMENT:address
     # TYPE : text
     $newaddress = new Zend_Form_Element_Text('newaddress');
     $newaddress->addValidator('NotEmpty', true, array('messages' => 'Address is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox')->setValue($address_val);
     if (array_key_exists('shippingaddr', $_REQUEST) && $_REQUEST['shippingaddr'] == 1) {
         $newaddress->setRequired(true);
     }
     $this->addElement($newaddress);
     # FORM ELEMENT:city
     # TYPE : text
     $newcity = new Zend_Form_Element_Text('newcity');
     $newcity->addValidator('NotEmpty', true, array('messages' => 'City is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("onkeypress", "return checkcharonly(event);")->setAttrib('class', 'changeaddress')->setValue($city_val);
     if (array_key_exists('shippingaddr', $_REQUEST) && $_REQUEST['shippingaddr'] == 1) {
         $newcity->setRequired(true);
     }
     $newcity->setAttrib("style", "width:100px; height:30px;");
     $this->addElement($newcity);
     # FORM ELEMENT:state
     # TYPE : text
     $StateArr = array();
     $StateArr[0]['key'] = "";
     $StateArr[0]['value'] = "- - Select  State- -";
     $StateData = $db->runQuery("select * from " . STATE . " order by state_name");
     if ($StateData != "" and count($StateData) > 0) {
         $i = 1;
         foreach ($StateData as $key => $StateValues) {
             $StateArr[$i]['key'] = $StateValues['state_id'];
             $StateArr[$i]['value'] = $StateValues['state_name'];
             $i++;
         }
     }
     $newstate = new Zend_Form_Element_Select('newstate');
     $newstate->addMultiOptions($StateArr)->addValidator('NotEmpty', true, array('messages' => 'State is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setValue($state_val);
     if (array_key_exists('shippingaddr', $_REQUEST) && $_REQUEST['shippingaddr'] == 1) {
         $newstate->setRequired(true);
     }
     $newstate->setAttrib("style", "width:100px; height:33px;")->setAttrib("onchange", "getneighborhoodcities(this.value);");
     $this->addElement($newstate);
     # FORM ELEMENT:zipcode
     # TYPE : text
     $newzipcode = new Zend_Form_Element_Text('newzipcode');
     $newzipcode->addValidator('NotEmpty', true, array('messages' => 'zip code is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setAttrib("onkeypress", "return checknummsp(event);")->setValue($zipcode_val);
     if (array_key_exists('shippingaddr', $_REQUEST) && $_REQUEST['shippingaddr'] == 1) {
         $newzipcode->setRequired(true);
     }
     $newzipcode->setAttrib("style", "width:100px; height:30px;");
     $this->addElement($newzipcode);
     # FORM ELEMENT:instruction
     # TYPE : text
     $instruction = new Zend_Form_Element_Textarea('instruction');
     $instruction->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'setgoaltxt')->setValue($instruction_val);
     if (array_key_exists('shippingaddr', $_REQUEST) && $_REQUEST['shippingaddr'] == 1) {
         $instruction->setRequired(true);
     }
     $instruction->setAttrib("style", "width:450px; height:120px;");
     $this->addElement($instruction);
     $this->addElements(array($camptitle, $description, $shippingaddr));
 }
Exemplo n.º 26
0
 /**
  * _createElement
  */
 private function _createElement($col)
 {
     if (preg_match('/^(enum|set)\\((.+)\\)/', $col['DATA_TYPE'], $matches)) {
         $col['DATA_TYPE'] = $matches[1];
         $col['DATA_LIST'] = $this->_getEnumList($matches[2], $col['NULLABLE']);
     }
     $datetimeValidator = new \Zend_Validate_Date(array('format' => 'yyyy-MM-dd HH:ii:ss'));
     switch ($col['DATA_TYPE']) {
         case 'int':
             $element = new \Zend_Form_Element_Text($col['COLUMN_NAME']);
             $element->setAttrib('size', $col['LENGTH'])->setAttrib('maxlength', $col['LENGTH'])->addValidator('Int');
             break;
         case 'varchar':
             $element = new \Zend_Form_Element_Text($col['COLUMN_NAME']);
             if ($col['LENGTH']) {
                 $element->setAttrib('size', $col['LENGTH']);
                 $element->setAttrib('maxlength', $col['LENGTH']);
             }
             break;
         case 'date':
             $element = new \Zend_Form_Element_Text($col['COLUMN_NAME']);
             $element->setAttrib('size', 10)->setAttrib('maxlength', 10)->addValidator('Date');
             break;
         case 'datetime':
             $element = new \Zend_Form_Element_Text($col['COLUMN_NAME']);
             $element->setAttrib('size', 19)->setAttrib('maxlength', 19)->addValidator($datetimeValidator);
             break;
         case 'text':
             $element = new \Zend_Form_Element_Textarea($col['COLUMN_NAME']);
             $element->setAttrib('class', 'xxlarge')->setAttrib('cols', 100)->setAttrib('rows', 20);
             break;
         case 'tinyint':
             $element = new \Zend_Form_Element_Checkbox($col['COLUMN_NAME']);
             $element->setAttrib('size', 1)->setAttrib('max_length', 1);
             break;
         case 'enum':
             $element = new \Zend_Form_Element_Select($col['COLUMN_NAME']);
             $element->addMultiOptions($col['DATA_LIST']);
             break;
         case 'set':
             $element = new \Zend_Form_Element_Select($col['COLUMN_NAME']);
             $element->addMultiOptions($col['DATA_LIST']);
             break;
         default:
             throw new \Zend_Exception($col['DATA_TYPE'] . ' is not implemented');
     }
     $element->setLabel($col['COLUMN_NAME']);
     $element->setRequired(!$col['NULLABLE']);
     $this->addElement($element);
 }
Exemplo n.º 27
0
 public function init()
 {
     //     public function __construct($app,$value) {
     // //         Zend_Dojo::enableForm($this);
     // //         parent::__construct($app);
     // //         parent::__construct($value);
     $membertitle = new Zend_Form_Element_Select('membertitle');
     $membertitle->setAttrib('class', 'txt_put');
     $membertitle->setAttrib('id', 'membertitle');
     $membertitle->setAttrib('tabindex', '3');
     $membertitle->setAttrib($value, 'true');
     $memberfirstname = new Zend_Form_Element_Text('memberfirstname');
     $memberfirstname->setAttrib('class', '');
     $memberfirstname->setAttrib('size', '10');
     $memberfirstname->setAttrib('id', 'memberfirstname');
     $memberfirstname1 = new Zend_Form_Element_Text('memberfirstname1');
     $memberfirstname1->setAttrib('class', '');
     $memberfirstname1->setAttrib('id', 'memberfirstname1');
     $memberfirstname1->setAttrib('size', '10');
     //$memberfirstname1->setAttrib('style','background-color:	#5CB3FF');
     $memberaddressline1 = new Zend_Form_Element_Text('memberaddressline1');
     $memberaddressline1->setAttrib('class', 'txt_put');
     $memberaddressline1->setAttrib('id', 'memberaddressline1');
     $memberaddressline1->setAttrib('tabindex', '13');
     $memberaddressline1->setAttrib($value, 'true');
     // echo $value;
     $membermiddlename = new Zend_Form_Element_Text('membermiddlename');
     $membermiddlename->setAttrib('class', 'txt_put');
     $membermiddlename->setAttrib('id', 'membermiddlename');
     $membermiddlename->setAttrib('tabindex', '5');
     $membermiddlename->setAttrib($value, 'true');
     $memberaddressline2 = new Zend_Form_Element_Text('memberaddressline2');
     $memberaddressline2->setAttrib('class', 'txt_put');
     $memberaddressline2->setAttrib('id', 'memberaddressline2');
     $memberaddressline2->setAttrib('tabindex', '14');
     $memberaddressline2->setAttrib($value, 'true');
     $memberlastname = new Zend_Form_Element_Text('memberlastname');
     $memberlastname->setAttrib('class', 'txt_put');
     $memberlastname->setAttrib('id', 'closedate');
     $memberlastname->setAttrib('tabindex', '6');
     $memberlastname->setAttrib($value, 'true');
     $MFI_member = new Zend_Form_Element_Select('MFI_member');
     //         $MFI_member->addMultiOption('','Select');
     $MFI_member->setAttrib('class', 'txt_put');
     $MFI_member->setAttrib('id', 'MFI_member');
     $memberaddressline3 = new Zend_Form_Element_Text('memberaddressline3');
     $memberaddressline3->setAttrib('class', 'txt_put');
     $memberaddressline3->setAttrib('id', 'memberaddressline3');
     $memberaddressline3->setAttrib('tabindex', '15');
     $memberaddressline3->setAttrib($value, 'true');
     $memberpersonalid = new Zend_Form_Element_Text('memberpersonalid ');
     $memberpersonalid->setAttrib('class', 'txt_put');
     $memberpersonalid->setAttrib('id', 'memberpersonalid');
     $memberpersonalid->setAttrib('tabindex', '7');
     $memberpersonalid->setAttrib($value, 'true');
     $memberdateofbirth = new Zend_Form_Element_Text('memberdateofbirth ');
     $memberdateofbirth->setAttrib('tabindex', '8');
     $memberdateofbirth->setAttrib('class', 'txt_put');
     $memberdateofbirth->setAttrib('size', '10');
     $memberdateofbirth->setAttrib('id', 'memberdateofbirth');
     $memberdateofbirth->setAttrib($value, 'true');
     $memberdateofbirth->setRequired(true)->addValidator(new Zend_Validate_Date('YYYY-MM-DD'), true, array('messages' => array(Zend_Validate_Date::FALSEFORMAT => 'Enter the valid date')));
     $membercity = new Zend_Form_Element_Text('membercity');
     $membercity->setAttrib('class', 'txt_put');
     $membercity->setAttrib('id', 'membercity');
     $membercity->setAttrib('tabindex', '16');
     $membercity->setAttrib($value, 'true');
     $gender_id = new Zend_Form_Element_Select('gender_id');
     $gender_id->addMultiOption('', 'Select');
     $gender_id->setAttrib('class', 'txt_put');
     $gender_id->setAttrib('id', 'gender_id');
     $gender_id->setAttrib('tabindex', '9');
     $gender_id->setAttrib($value, 'true');
     $memberstate = new Zend_Form_Element_Text('memberstate');
     $memberstate->setAttrib('class', 'txt_put');
     $memberstate->setAttrib('id', 'memberstate');
     $memberstate->setAttrib('tabindex', '17');
     $memberstate->setAttrib($value, 'true');
     $membercountry = new Zend_Form_Element_Text('membercountry');
     $membercountry->setAttrib('class', 'txt_put');
     $membercountry->setAttrib('id', 'membercountry');
     $membercountry->setAttrib('tabindex', '18');
     $membercountry->setAttrib($value, 'true');
     $memberpincode = new Zend_Form_Element_Text('memberpincode');
     $memberpincode->setAttrib('class', 'txt_put');
     $memberpincode->setAttrib('id', 'memberpincode');
     $memberpincode->setAttrib('tabindex', '19');
     $memberpincode->setAttrib($value, 'true');
     $memberphone = new Zend_Form_Element_Text('memberphone');
     $memberphone->setAttrib('class', 'txt_put');
     $memberphone->setAttrib('id', 'memberphone');
     $memberphone->setAttrib('tabindex', '20');
     $memberphone->setAttrib($value, 'true');
     $memberchildrennumber = new Zend_Form_Element_Text('memberchildrennumber');
     $memberchildrennumber->setAttrib('class', 'txt_put');
     $memberchildrennumber->setAttrib('id', 'memberchildrennumber');
     $memberprofession = new Zend_Form_Element_Text('memberprofession');
     $memberprofession->setAttrib('class', 'txt_put');
     $memberprofession->setAttrib('id', 'memberprofession');
     $membereducation = new Zend_Form_Element_Text('membereducation');
     $membereducation->setAttrib('class', 'txt_put');
     $membereducation->setAttrib('id', 'membereducation');
     //         $photo = new Zend_Form_Element_File('photo');
     //         $photo->setAttrib('size', '11');
     //         $photo->setLabel('Upload an image:');
     //         $photo->setAttrib('tabindex', '12');
     $membereconomicalstatusdescription = new Zend_Form_Element_Select('membereconomicalstatusdescription');
     $membereconomicalstatusdescription->addMultiOption('', 'Select');
     $membereconomicalstatusdescription->setAttrib('class', 'txt_put');
     $membereconomicalstatusdescription->setAttrib('id', 'membereconomicalstatusdescription');
     $relationship = new Zend_Form_Element_Select('relationship');
     $relationship->setAttrib('class', 'txt_put');
     $relationship->setAttrib('id', 'relationship');
     $physicalstatus_id = new Zend_Form_Element_Select('physicalstatus_id');
     $physicalstatus_id->addMultiOption('', 'Select');
     $physicalstatus_id->setAttrib('class', 'txt_put');
     $physicalstatus_id->setAttrib('id', 'physicalstatus_id');
     $physicalstatus_id->setAttrib('tabindex', '11');
     $physicalstatus_id->setAttrib($value, 'true');
     $membermaritalstatus_id = new Zend_Form_Element_Select('membermaritalstatus_id');
     $membermaritalstatus_id->addMultiOption('', 'Select');
     $membermaritalstatus_id->setAttrib('class', 'txt_put');
     $membermaritalstatus_id->setAttrib('id', 'membermaritalstatus_id');
     $membermaritalstatus_id->setAttrib('tabindex', '10');
     $membermaritalstatus_id->setAttrib($value, 'true');
     $memberStatus = new Zend_Form_Element_Radio('memberstatus_id');
     //$memberStatus->setAttrib('checked', 'true');
     $memberStatus->setAttrib('id', 'memberstatus_id');
     $memberId = new Zend_Form_Element_Text('member_id');
     $memberId->setAttrib('class', 'txt_put');
     $memberId->setAttrib('readonly', 'true');
     $memberId->setAttrib('size', '10');
     $memberhouse = new Zend_Form_Element_Checkbox('memberhouse');
     $memberhouse->setAttrib('id', 'memberhouse ');
     $memberhouse->setAttrib('class', 'txt_put');
     $memberhouse->setAttrib('onchange', 'toggleStatus()');
     $memberhouse->setAttrib($value, 'true');
     $memberhouse = new Zend_Form_Element_Checkbox('memberhouse');
     $memberhouse->setAttrib('class', 'txt_put');
     $memberhouse->setAttrib('id', 'memberhouse');
     $memberhouse->setAttrib('onchange', 'togglehouse();');
     $memberland = new Zend_Form_Element_Checkbox('memberland');
     $memberland->setAttrib('class', 'txt_put');
     $memberland->setAttrib('id', 'memberland');
     $memberland->setAttrib('onchange', 'toggleland();');
     $memberland->setAttrib($value, 'true');
     $homeSize = new Zend_Form_Element_Text('memberhomesize');
     $homeSize->setAttrib('class', 'txt_put');
     $homeSize->setAttrib('id', 'memberhomesize');
     $homeSize->setAttrib('size', '8');
     $homeSize->setAttrib($value, 'true');
     $landSize = new Zend_Form_Element_Text('memberlandsize');
     $landSize->setAttrib('class', 'txt_put');
     $landSize->setAttrib('id', 'memberlandsize');
     $landSize->setAttrib('size', '8');
     $landSize->setAttrib($value, 'true');
     $numlandSize = new Zend_Form_Element_Text('numlandSize');
     $numlandSize->setAttrib('class', 'txt_put');
     $numlandSize->setAttrib('id', 'numlandSize');
     $numlandSize->setAttrib('size', '8');
     $numlandSize->setAttrib($value, 'true');
     $otherlivingassets = new Zend_Form_Element_Select('otherlivingassets');
     $otherlivingassets->setAttrib('class', 'txt_put');
     $otherlivingassets->setAttrib('id', 'otherlivingassets');
     $otherlivingassets->addMultiOption('', 'Select');
     $otherlivingassets->setAttrib('onchange', 'livingassets();');
     $otherlivingassets->setAttrib($value, 'true');
     $othernonlivingassets = new Zend_Form_Element_Select('othernonlivingassets');
     $othernonlivingassets->setAttrib('class', 'txt_put');
     $othernonlivingassets->setAttrib('id', 'othernonlivingassets');
     $othernonlivingassets->addMultiOption('', 'Select');
     $othernonlivingassets->setAttrib('onchange', 'nonlivingassets();');
     $othernonlivingassets->setAttrib($value, 'true');
     $numotherassets = new Zend_Form_Element_Text('numotherassets');
     $numotherassets->setAttrib('class', 'txt_put');
     $numotherassets->setAttrib('id', 'numotherassets');
     $numotherassets->setAttrib('size', '8');
     $numotherassets->setAttrib($value, 'true');
     $OFFICE_TYPE = new Zend_Form_Element_Select('officeType');
     $OFFICE_TYPE->addMultiOption('', 'Select');
     $OFFICE_TYPE->setAttrib('class', 'txt_put');
     $OFFICE_TYPE->setAttrib('tabindex', '1');
     $OFFICE_TYPE->setAttrib($value, 'true');
     $SUB_OFFICE = new Zend_Form_Element_Select('subOffice');
     $SUB_OFFICE->setAttrib('class', 'txt_put');
     $SUB_OFFICE->setAttrib('tabindex', '2');
     $SUB_OFFICE->setAttrib($value, 'true');
     $transporation_for_schoolstatus = new Zend_Form_Element_Select('transporation_for_schoolstatus');
     $transporation_for_schoolstatus->addMultiOption('', 'Select');
     $transporation_for_schoolstatus->setAttrib('class', 'txt_put');
     $transporation_for_schoolstatus->setAttrib('id', 'transporation_for_schoolstatus');
     $transporation_for_schoolstatus = new Zend_Form_Element_Select('transporation_for_schoolstatus');
     $transporation_for_schoolstatus->addMultiOption('', 'Select');
     $transporation_for_schoolstatus->setAttrib('class', 'txt_put');
     $transporation_for_schoolstatus->setAttrib('id', 'transporation_for_schoolstatus');
     $school_locationstatus = new Zend_Form_Element_Select('school_locationstatus');
     $school_locationstatus->addMultiOption('', 'Select...');
     $school_locationstatus->setAttrib('class', 'txt_put');
     $school_locationstatus->setAttrib('id', 'school_locationstatus');
     $qualificationdetails = new Zend_Form_Element_Select('qualificationdetails');
     $qualificationdetails->addMultiOption('', 'Select...');
     $qualificationdetails->setAttrib('class', 'txt_put');
     $qualificationdetails->setAttrib('id', 'qualificationdetails');
     $profession = new Zend_Form_Element_Select('profession');
     $profession->addMultiOption('', 'Select');
     $profession->setAttrib('class', 'txt_put');
     $profession->setAttrib('id', 'profession');
     $health_problem = new Zend_Form_Element_Select('health_problem');
     $health_problem->addMultiOption('', 'Select');
     $health_problem->setAttrib('class', 'txt_put');
     $health_problem->setAttrib('id', 'health_problem');
     $earningsstatus = new Zend_Form_Element_Select('earningsstatus');
     $earningsstatus->addMultiOption('', 'Select');
     $earningsstatus->setAttrib('class', 'txt_put');
     $earningsstatus->setAttrib('id', 'earningsstatus');
     $submit = new Zend_Form_Element_Submit('Save');
     $submit->setAttrib('id', 'save');
     $this->addElements(array($OFFICE_TYPE, $SUB_OFFICE, $memberfirstname, $memberfirstname1, $membertitle, $memberaddressline1, $membermiddlename, $memberaddressline2, $memberlastname, $gender_id, $memberaddressline3, $memberpersonalid, $membercity, $memberdateofbirth, $memberstate, $membercountry, $MFI_member, $membermaritalstatus_id, $membereconomicalstatusdescription, $memberpincode, $memberchildrennumber, $memberphone, $memberhouse, $memberland, $otherlivingassets, $othernonlivingassets, $physicalstatus_id, $relationship, $memberStatus, $homeSize, $landSize, $memberId, $transporation_for_schoolstatus, $school_locationstatus, $qualificationdetails, $profession, $health_problem, $earningsstatus, $numlandSize, $numotherassets));
     $memberId = new Zend_Form_Element_Hidden('memberId');
     $submit = new Zend_Form_Element_Submit('Submit');
     $submit->setAttrib('class', 'officesubmit');
     $this->addElements(array($submit, $memberId));
 }
Exemplo n.º 28
0
    public function __construct($options = null)
    {
        $this->_disabledDefaultActions = true;
        parent::__construct($options);
        $baseDir = $this->getView()->baseUrl();
        if (!empty($options['mode']) && $options['mode'] == 'edit') {
            $this->_mode = 'edit';
        } else {
            $this->_mode = 'add';
        }
        $langId = Zend_Registry::get('languageID');
        $this->setAttrib('id', 'accountManagement');
        //            $addressParams = array(
        //                "fieldsValue" => array(),
        //                "display"   => array(),
        //                "required" => array(),
        //            );
        // Salutation
        $salutation = new Zend_Form_Element_Select('salutation');
        $salutation->setLabel($this->getView()->getCibleText('form_label_salutation'))->setAttrib('class', 'smallSelect')->setAttrib('tabindex', '1')->setOrder(1);
        $greetings = $this->getView()->getAllSalutation();
        foreach ($greetings as $greeting) {
            $salutation->addMultiOption($greeting['S_ID'], $greeting['ST_Value']);
        }
        // Language
        $languages = new Zend_Form_Element_Select('language');
        $languages->setLabel($this->getView()->getCibleText('form_label_language'))->setAttrib('class', 'stdSelect')->setAttrib('tabindex', '9')->setOrder(9);
        foreach (Cible_FunctionsGeneral::getAllLanguage() as $lang) {
            $languages->addMultiOption($lang['L_ID'], $lang['L_Title']);
        }
        // FirstName
        $firstname = new Zend_Form_Element_Text('firstName');
        $firstname->setLabel($this->getView()->getCibleText('form_label_fName'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttribs(array('class' => 'stdTextInput'))->setAttrib('tabindex', '2')->setOrder(2);
        // LastName
        $lastname = new Zend_Form_Element_Text('lastName');
        $lastname->setLabel($this->getView()->getCibleText('form_label_lName'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttribs(array('class' => 'stdTextInput'))->setAttrib('tabindex', '3')->setOrder(3);
        // email
        $regexValidate = new Cible_Validate_Email();
        $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
        $emailNotFoundInDBValidator = new Zend_Validate_Db_NoRecordExists('GenericProfiles', 'GP_Email');
        $emailNotFoundInDBValidator->setMessage($this->getView()->getClientText('validation_message_email_already_exists'), 'recordFound');
        $email = new Zend_Form_Element_Text('email');
        $email->setLabel($this->getView()->getCibleText('form_label_email'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setAttribs(array('maxlength' => 50, 'class' => 'stdTextInput'))->setAttrib('tabindex', '5')->setOrder(5);
        if ($this->_mode == 'add') {
            $email->addValidator($emailNotFoundInDBValidator);
        }
        // email
        // password
        $password = new Zend_Form_Element_Password('password');
        if ($this->_mode == 'add') {
            $password->setLabel($this->getView()->getCibleText('form_label_password'));
        } else {
            $password->setLabel($this->getView()->getCibleText('form_label_newPwd'));
        }
        $password->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInput')->setAttrib('tabindex', '6')->setRequired(true)->setOrder(6)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))));
        // password
        // password confirmation
        $passwordConfirmation = new Zend_Form_Element_Password('passwordConfirmation');
        if ($this->_mode == 'add') {
            $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmPwd'));
        } else {
            $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmPwd'));
        }
        //                $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmNewPwd'));
        $passwordConfirmation->addFilter('StripTags')->addFilter('StringTrim')->setRequired(true)->setOrder(7)->setAttrib('class', 'stdTextInput')->setAttrib('tabindex', '7')->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd')), array('label', array('class' => 'test', 'tag' => 'dt', 'tagClass' => 'alignVertical'))));
        if (!empty($_POST['identification']['password'])) {
            $passwordConfirmation->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('error_message_password_isEmpty'))));
            $Identical = new Zend_Validate_Identical($_POST['identification']['password']);
            $Identical->setMessages(array('notSame' => $this->getView()->getCibleText('error_message_password_notSame')));
            $passwordConfirmation->addValidator($Identical);
        }
        // password confirmation
        // Company name
        $company = new Zend_Form_Element_Text('company');
        $company->setLabel($this->getView()->getCibleText('form_label_company'))->setRequired(false)->setAttrib('tabindex', '4')->setOrder(4)->setAttribs(array('class' => 'stdTextInput'));
        // Account number
        $account = new Zend_Form_Element_Text('accountNum');
        $account->setLabel($this->getView()->getCibleText('form_label_account'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setOrder(8)->setAttribs(array('class' => 'stdTextInput'))->setAttrib('tabindex', '8')->setDecorators(array('ViewHelper', 'Errors', array(array('row' => 'HtmlTag'), array('tag' => 'dd')), array('label', array('class' => 'test', 'tag' => 'dt', 'tagClass' => 'alignVertical'))));
        // Text Subscribe
        $textSubscribe = $this->getView()->getCibleText('form_label_subscribe');
        $textSubscribe = str_replace('%URL_PRIVACY_POLICY%', Cible_FunctionsPages::getPageLinkByID($this->_config->privacyPolicy->pageId), $textSubscribe);
        // Newsletter subscription
        $newsletterSubscription = new Zend_Form_Element_Checkbox('newsletterSubscription');
        $newsletterSubscription->setLabel($textSubscribe);
        if ($this->_mode == 'add') {
            $newsletterSubscription->setChecked(1);
        }
        $newsletterSubscription->setAttrib('class', 'long-text');
        $newsletterSubscription->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'id' => 'subscribeNewsletter', 'class' => 'label_after_checkbox'))));
        if ($this->_mode == 'add') {
            $termsAgreement = new Zend_Form_Element_Checkbox('termsAgreement');
            $termsAgreement->setLabel(str_replace('%URL_TERMS_CONDITIONS%', Cible_FunctionsPages::getPageLinkByID($this->_config->termsAndConditions->pageId), $this->getView()->getClientText('form_label_terms_agreement')));
            $termsAgreement->setAttrib('class', 'long-text');
            $termsAgreement->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
            $termsAgreement->setRequired(true);
            $termsAgreement->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'You must agree to the terms')));
        } else {
            $termsAgreement = new Zend_Form_Element_Hidden('termsAgreement', array('value' => 1));
        }
        // Submit button
        $submit = new Zend_Form_Element_Submit('submit');
        $submitLabel = $this->getView()->getCibleText('form_account_button_submit');
        if ($this->_mode == 'edit') {
            $submitLabel = $this->getView()->getCibleText('button_submit');
        }
        $submit->setLabel($submitLabel)->setAttrib('class', 'stdButton subscribeButton1-' . Zend_Registry::get("languageSuffix"));
        // Captcha
        // Refresh button
        $refresh_captcha = new Zend_Form_Element_Button('refresh_captcha');
        $refresh_captcha->setLabel($this->getView()->getCibleText('button_refresh_captcha'))->setAttrib('onclick', "refreshCaptcha('captcha-id')")->setAttrib('class', 'stdButton')->removeDecorator('Label')->removeDecorator('DtDdWrapper');
        $refresh_captcha->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'dd-refresh-captcha-button'))));
        $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $this->getView()->getCibleText('form_label_securityCaptcha'), 'captcha' => 'Image', 'captchaOptions' => array('captcha' => 'Word', 'wordLen' => 5, 'fontSize' => 28, 'height' => 67, 'width' => 169, 'timeout' => 300, 'dotNoiseLevel' => 0, 'lineNoiseLevel' => 0, 'font' => Zend_Registry::get('application_path') . "/../{$this->_config->document_root}/captcha/fonts/ARIAL.TTF", 'imgDir' => Zend_Registry::get('application_path') . "/../{$this->_config->document_root}/captcha/tmp", 'imgUrl' => "{$baseDir}/captcha/tmp")));
        $captcha->setAttrib('class', 'stdTextInputCatcha');
        $captcha->setRequired(true);
        $captcha->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'id' => 'dd_captcha'))))->addDecorator('Label', array('class' => 'clear'));
        $french = array('badCaptcha' => 'Veuillez saisir la chaîne ci-dessus correctement.');
        $english = array('badCaptcha' => 'Captcha value is wrong');
        $translate = new Zend_Translate('array', $french, 'fr');
        $this->setTranslator($translate);
        $this->getView()->jQuery()->enable();
        $script = <<<EOS

            function refreshCaptcha(id){
                \$.getJSON('{$this->getView()->baseUrl()}/newsletter/index/captcha-reload',
                    function(data){

                        \$("dd#dd_captcha img").attr({src : data['url']});
                        \$("#"+id).attr({value: data['id']});

                });
            }

EOS;
        $this->getView()->headScript()->appendScript($script);
        // Captcha
        /*  Identification sub form */
        $identificationSub = new Cible_Form_SubForm();
        $identificationSub->setName('identification')->removeDecorator('DtDdWrapper');
        $identificationSub->setLegend($this->getView()->getCibleText('form_account_subform_identification_legend'));
        $identificationSub->setAttrib('class', 'identificationClass subFormClass');
        $identificationSub->addElement($languages);
        $identificationSub->addElement($salutation);
        $identificationSub->addElement($lastname);
        $identificationSub->addElement($firstname);
        $identificationSub->addElement($email);
        $identificationSub->addElement($password);
        $identificationSub->addElement($passwordConfirmation);
        $identificationSub->addElement($company);
        $identificationSub->addElement($account);
        $identificationSub->addDisplayGroup(array('salutation', 'firstName', 'company', 'password', 'accountNum'), 'leftColumn');
        $identificationSub->addDisplayGroup(array('lastName', 'email', 'passwordConfirmation', 'language'), 'rightColumn')->removeDecorator('DtDdWrapper');
        $leftColGroup = $identificationSub->getDisplayGroup('leftColumn');
        $rightColGroup = $identificationSub->getDisplayGroup('rightColumn');
        $leftColGroup->removeDecorator('DtDdWrapper');
        $rightColGroup->removeDecorator('DtDdWrapper');
        $this->addSubForm($identificationSub, 'identification');
        // Billing address
        $addressFacturationSub = new Cible_Form_SubForm();
        $addressFacturationSub->setName('addressFact')->removeDecorator('DtDdWrapper');
        $addressFacturationSub->setLegend($this->getView()->getCibleText('form_account_subform_addBilling_legend'));
        $addressFacturationSub->setAttrib('class', 'addresseBillingClass subFormClass');
        $billingAddr = new Cible_View_Helper_FormAddress($addressFacturationSub);
        $billingAddr->enableFields(array('firstAddress', 'secondAddress', 'cityTxt', 'zipCode', 'country', 'state', 'firstTel', 'secondTel', 'fax'));
        $billingAddr->formAddress();
        $addrBill = new Zend_Form_Element_Hidden('addrBill');
        $addrBill->removeDecorator('label');
        $addressFacturationSub->addElement($addrBill);
        $this->addSubForm($addressFacturationSub, 'addressFact');
        /* delivery address */
        $addrShip = new Zend_Form_Element_Hidden('addrShip');
        $addrShip->removeDecorator('label');
        $addressShippingSub = new Cible_Form_SubForm();
        $addressShippingSub->setName('addressShipping')->removeDecorator('DtDdWrapper');
        $addressShippingSub->setLegend($this->getView()->getCibleText('form_account_subform_addShipping_legend'));
        $addressShippingSub->setAttrib('class', 'addresseShippingClass subFormClass');
        $shipAddr = new Cible_View_Helper_FormAddress($addressShippingSub);
        $shipAddr->duplicateAddress($addressShippingSub);
        $shipAddr->setProperty('addScriptState', false);
        $shipAddr->enableFields(array('firstAddress', 'secondAddress', 'cityTxt', 'zipCode', 'country', 'state', 'firstTel', 'secondTel', 'fax'));
        $shipAddr->formAddress();
        $addressShippingSub->addElement($addrShip);
        $this->addSubForm($addressShippingSub, 'addressShipping');
        if ($this->_mode == 'add') {
            $this->getView()->jQuery()->enable();
            $script = <<<EOS

                function refreshCaptcha(id){
                    \$.getJSON('{$this->getView()->baseUrl()}/order/index/captcha-reload',
                        function(data){
                            \$("dd#dd_captcha img").attr({src : data['url']});
                            \$("#"+id).attr({value: data['id']});
                    });
                }

EOS;
            //                $this->getView()->headScript()->appendScript($script);
            //                $this->addElement($refresh_captcha);
            //                $this->addElement($captcha);
            $this->addElement($newsletterSubscription);
            $this->addElement($termsAgreement);
        }
        $this->addElement($submit);
        $submit->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'account-submit'))));
        if ($this->_mode == 'add') {
            $termsAgreement->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox', 'id' => 'dd-terms-agreement'))));
        }
        $captchaError = array('badCaptcha' => $this->getView()->getCibleText('validation_message_captcha_error'));
        $translate = new Zend_Translate('array', $captchaError, $this->getView()->registryGet('languageSuffix'));
        $this->setTranslator($translate);
    }
Exemplo n.º 29
0
 /**
  *Function for making the form of the edit module action
  */
 private function _editModuleForm($id)
 {
     require_once 'Zend/Form/Element/Checkbox.php';
     $db = Zend_Registry::get('db');
     $langCode = $this->_sesija->langAdmin;
     $res = $db->fetchAll("SELECT moduleId, moduleName, templateId, enabled, templates_{$langCode}.title FROM modules LEFT JOIN templates_{$langCode} ON templates_{$langCode}.id = modules.templateId  WHERE moduleId = ?", array($id));
     $resTemplates = $db->fetchAll("SELECT * FROM templates_{$langCode}");
     foreach ($resTemplates as $result) {
         $templateArray[$result['id']] = $result['title'];
         if ($result['id'] == $res[0]['templateId']) {
             $selValue = $result['id'];
         }
     }
     if (!empty($templateArray)) {
         $enabledMod = new Zend_Form_Element_Checkbox('enabled_mod');
         $enabledMod->setLabel('Enabled');
         $form = new Zend_Form(array('action' => $this->_host . 'modules/edit-module/id/' . $id, 'id' => 'editModuleForm', 'method' => 'post', 'elements' => array('template_id' => array('select', array('required' => true, 'label' => 'Template:', 'style' => 'width:200px;', 'multioptions' => $templateArray, 'value' => $selValue)), 'submit' => array('submit', array('label' => 'Save', 'order' => 100, 'value' => $this->_translate->_('Submit'))))));
         foreach ($res as $result) {
             //$moduleArray[$result['templateId']] = $result['title'];
             if ($result['enabled'] == '1') {
                 $attr = "checked";
                 $enabledMod->setAttrib('checked', $attr);
             } else {
                 $attr = "";
             }
             //$enabledValue = $result['enabled'];
         }
         $form->addElements(array($enabledMod));
         return $form;
     }
 }
Exemplo n.º 30
0
 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oUserRoleId = new Zend_Form_Element_Select("role_id");
     $oUserRoleId->setLabel("Grupa użytkownika:");
     $oUserRoleId->setRequired(TRUE);
     $oUserRoleId->addMultiOptions($this->_aAllUserRole);
     $this->addElement($oUserRoleId);
     $oUserFbId = new Zend_Form_Element_Text("user_fb_id");
     $oUserFbId->setLabel("ID profilu z facebooka:")->setFilters($this->_aFilters);
     $oUserFbId->addValidator(new Zend_Validate_Alpha(array("allowWhiteSpace" => true)));
     $oUserFbId->setRequired(FALSE);
     $oUserFbId->setAttrib("class", "valid");
     $this->addElement($oUserFbId);
     $oFirstName = new Zend_Form_Element_Text("first_name");
     $oFirstName->setLabel("Imię:")->setFilters($this->_aFilters);
     $oFirstName->addValidator(new Zend_Validate_Alpha(array("allowWhiteSpace" => true)));
     $oFirstName->setRequired(TRUE);
     $oFirstName->setAttrib("class", "valid");
     $this->addElement($oFirstName);
     $oLastName = new Zend_Form_Element_Text("last_name");
     $oLastName->setLabel("Nazwisko:")->setFilters($this->_aFilters);
     $oLastName->addValidator(new Zend_Validate_Alpha(array("allowWhiteSpace" => true)));
     $oLastName->setRequired(TRUE);
     $oLastName->setAttrib("class", "valid");
     $this->addElement($oLastName);
     $oEmailAddress = new Zend_Form_Element_Text("email_address");
     $oEmailAddress->setLabel("Adres e-mail:")->setFilters($this->_aFilters);
     $oEmailAddress->addValidator(new Zend_Validate_EmailAddress());
     $oEmailAddress->addValidator(new AppCms2_Validate_CheckUser());
     $oEmailAddress->setRequired(TRUE);
     $oEmailAddress->setAttrib("class", "valid");
     $this->addElement($oEmailAddress);
     $oEmailAddressConfirm = new Zend_Form_Element_Text("email_address_confirm");
     $oEmailAddressConfirm->setLabel("Powtórz adres e-mail:")->setFilters($this->_aFilters);
     $oEmailAddressConfirm->addValidator(new AppCms2_Validate_EmailConfirmation());
     $oEmailAddressConfirm->addValidator(new Zend_Validate_EmailAddress());
     $oEmailAddressConfirm->addValidator(new AppCms2_Validate_CheckUser());
     $oEmailAddressConfirm->setRequired(TRUE);
     $oEmailAddressConfirm->setAttrib("class", "valid");
     $this->addElement($oEmailAddressConfirm);
     $oPassword = new Zend_Form_Element_Password("password");
     $oPassword->setLabel("Hasło:")->setFilters($this->_aFilters);
     $oPassword->setRequired(TRUE);
     $oPassword->setAttrib("class", "valid");
     $this->addElement($oPassword);
     $oPhoneNumber = new Zend_Form_Element_Text("phone_number");
     $oPhoneNumber->setLabel("Numer telefonu:")->setFilters($this->_aFilters);
     $oPhoneNumber->addValidator(new AppCms2_Validate_CellPhone());
     $oPhoneNumber->setRequired(FALSE);
     $oPhoneNumber->setAttrib("class", "valid");
     $this->addElement($oPhoneNumber);
     $oUserCategoryId = new Zend_Form_Element_Select("user_category_id");
     $oUserCategoryId->setLabel("Kategoria użytkownika:")->setFilters($this->_aFilters);
     $oUserCategoryId->addMultiOptions($this->_aCategory);
     $oUserCategoryId->setRequired(TRUE);
     $oUserCategoryId->setAttrib("class", "valid");
     $this->addElement($oUserCategoryId);
     $oIsActive = new Zend_Form_Element_Checkbox("is_active");
     $oIsActive->setLabel("Konto aktywne:")->setFilters($this->_aFilters);
     $oIsActive->setRequired(FALSE);
     $oIsActive->setAttrib("class", "valid");
     $this->addElement($oIsActive);
     $oOwner = new Zend_Form_Element_Checkbox("owner_account");
     $oOwner->setLabel("Głowne konto:")->setFilters($this->_aFilters);
     $oOwner->setRequired(FALSE);
     $oOwner->setAttrib("class", "valid");
     $this->addElement($oOwner);
     $oUserEditId = new Zend_Form_Element_Hidden("user_edit_id");
     $oUserEditId->setValue(0);
     $oUserEditId->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oUserEditId);
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oSubmit = $this->createElement("submit", "submit");
     $oSubmit->setLabel("Zapisz");
     $this->addElement($oSubmit);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/register.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }