예제 #1
0
 public function __construct($options = null)
 {
     parent::__construct();
     $this->setName('custom_layout_settings_form');
     $this->addElementPrefixPath('Oibs_Form_Decorator', 'Oibs/Form/Decorator/', 'decorator');
     //echo '<div class="clear"></div>';
     $clear = new Oibs_Form_Element_Note('clear');
     $clear->setValue('<div class="clear"></div>');
     // Font
     $customfont = new Zend_Form_Element_Select('customfont');
     $customfont->setLabel('Custom Font')->setAttrib('id', 'customfont')->addMultiOptions(array('Arial', 'Castellar', 'Times New Roman', 'Microsoft Sans Serif', 'Harrington'));
     // Font size
     $customfontsize = new Zend_Form_Element_Select('customfontsize');
     $customfontsize->setLabel('Font Size')->setAttrib('id', 'customfontsize')->addMultiOptions(array('8', '10', '12', '14', '16'));
     $customsizeclear = new Oibs_Form_Element_Note('customsizeclear');
     $customsizeclear->setValue('<div class="clear"></div>');
     // Font color
     $customfontcolor = $openid = new Zend_Form_Element_Text('customfontcolor');
     $customfontcolor->setLabel('Font Color')->setAttrib('id', 'customfontcolor')->setValue('#000000');
     // Add elements to form
     $this->addElements(array($customfont, $clear, $customfontsize, $customfontcolor));
     // Add decorators
     $customfont->setDecorators(array('InputDecorator'));
     $customfontsize->setDecorators(array('InputDecorator'));
     $customfontcolor->setDecorators(array('ColorPickerDecorator'));
     $this->setDecorators(array('FormElements', 'Form'));
 }
 public function __construct($options = null)
 {
     parent::__construct();
     $this->setMethod('post');
     $this->setEnctype('multipart/form-data');
     //$this->setAction('');
     $this->setName('custom_layout_advanced_form');
     $this->addElementPrefixPath('Oibs_Form_Decorator', 'Oibs/Form/Decorator/', 'decorator');
     $clearall = new Oibs_Form_Element_Note('clearall');
     $clearall->setValue('<div style="clear:both;"></div>');
     $csstextarea = new Zend_Form_Element_Textarea('csscontent');
     $csstextarea->setLabel('Editable custom layout css for advanced users')->setAttrib('id', 'css_textarea')->setAttrib('style', 'width: 575px; height: 660px; margin-left: -5px; margin-right: 10px; margin-bottom: 10px;')->setValue($options['cssContent'])->addDecorator('Label', array('tag' => 'div', 'style' => '/*font-weight:bold;*/ float:left; margin-top:6px'))->addValidators(array(array('StringLength', false)));
     $savecssbutton = new Zend_Form_Element_Submit('save_css_button');
     $savecssbutton->setLabel('Save')->setAttrib('style', 'width:60px; float:right;')->removeDecorator('DefaultDecorator')->removeDecorator('DtDdWrapper');
     $cancelcssbutton = new Zend_Form_Element_Button('cancel_css_button');
     $cancelcssbutton->setLabel('Cancel')->setAttrib('style', 'width:60px; float:right; margin-right:10px')->removeDecorator('DefaultDecorator')->removeDecorator('DtDdWrapper');
     $defaultcssbutton = new Zend_Form_Element_Button('default_css_button');
     $defaultcssbutton->setLabel('Default')->setAttrib('style', 'width:80px; float:left; margin-left: 10px; margin-top:-17px;')->removeDecorator('DefaultDecorator')->removeDecorator('DtDdWrapper');
     $restorecssbutton = new Zend_Form_Element_Button('restore_css_button');
     $restorecssbutton->setLabel('Restore')->setAttrib('style', 'width:80px; float:left; margin-left: -5px; margin-top:-17px;')->removeDecorator('DefaultDecorator')->removeDecorator('DtDdWrapper');
     $defaultcsshidden = new Zend_Form_Element_Hidden('default_css');
     $defaultcsshidden->setAttrib('id', 'default_css')->setValue($options['default_css']);
     $originalcsshidden = new Zend_Form_Element_Hidden('original_css');
     $originalcsshidden->setAttrib('id', 'original_css')->setValue($options['cssContent']);
     $advancedhelp = new Oibs_Form_Element_Note('help_link_advanced');
     $advancedhelp->setValue('<a href="#" onClick="return false;">Help</a>');
     $this->addElements(array($csstextarea, $savecssbutton, $cancelcssbutton, $advancedhelp, $restorecssbutton, $defaultcssbutton, $defaultcsshidden, $originalcsshidden));
     // Add decorators
     $this->setDecorators(array('FormElements', 'Form'));
 }
예제 #3
0
파일: PrivMsgForm.php 프로젝트: jannev/site
 public function __construct($options = null, $data = null)
 {
     parent::__construct($options);
     $translate = Zend_Registry::get('Zend_Translate');
     $this->setDisableLoadDefaultDecorators(true);
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div'))->addDecorator('Form');
     $this->setName('send_privmsg_form');
     $this->addElementPrefixPath('Oibs_Validators', 'OIBS/Validators/', 'validate');
     $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator');
     $header = new Zend_Form_Element_Text('privmsg_header');
     $header->setLabel($translate->_("privmsg-header"))->setRequired(true)->setAttrib('size', 53)->addValidators(array(array('StringLength', true, array(1, 255, 'messages' => array('stringLengthTooShort' => 'field-too-short', 'stringLengthTooLong' => 'field-too-long')))))->setDecorators(array('PrivMsgTextFieldDecorator'));
     $message = new Zend_Form_Element_Textarea('privmsg_message');
     $message->setLabel($translate->_("privmsg-message"))->setRequired(true)->setAttrib('rows', 6)->setAttrib('cols', 40)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty'))), array('StringLength', true, array(1, 1000, 'messages' => array('stringLengthTooLong' => 'field-too-long'))), new Oibs_Validators_MessageTime('')))->setDecorators(array('PrivMsgMessageDecorator'));
     $charCount = new Oibs_Form_Element_Note('charCount');
     $charCount->setValue("Character limit: 0/1000")->removeDecorator('Label')->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'privmsg-charcount', 'class' => 'left'));
     $overlimit = new Oibs_Form_Element_Note('overlimit');
     $overlimit->setValue("Characters over the limit will be cut.")->removeDecorator('Label')->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'privmsg-charcount-cut', 'class' => 'left', 'style' => 'display: none'));
     $clear = new Oibs_Form_Element_Note('clear');
     $clear->setValue("")->removeDecorator('Label')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'clear'));
     $sender_id = new Zend_Form_Element_Hidden('privmsg_sender_id');
     $sender_id->setValue($data['sender_id'])->removeDecorator('DtDdWrapper');
     $receiver_id = new Zend_Form_Element_Hidden('privmsg_receiver_id');
     $receiver_id->setValue($data['receiver_id'])->removeDecorator('DtDdWrapper');
     // Form submit buttom form element
     $submit = new Zend_Form_Element_Submit('privmsg_submit');
     $submit->setLabel($translate->_("privmsg-send"))->removeDecorator('DtDdWrapper');
     $this->addElements(array($header, $message, $charCount, $overlimit, $clear, $sender_id, $receiver_id, $submit));
 }
예제 #4
0
 public function __construct($parent = null, $options = null)
 {
     parent::__construct($options);
     $parentId = 0;
     if ($parent != null) {
         $parentId = $parent;
     }
     $translate = Zend_Registry::get('Zend_Translate');
     $this->setName('add_group_form');
     $this->addElementPrefixPath('Oibs_Form_Decorator', 'Oibs/Form/Decorator/', 'decorator');
     $clear = '<div class="clear"></div>';
     // Group name (must be unique).
     $groupname = new Zend_Form_Element_Text('groupname');
     $groupname->setLabel('Name')->setRequired(true)->setFilters(array('StringTrim'))->setValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty'))), new Oibs_Validators_GroupExists('groupname'), array('StringLength', false, array(1, 140, 'messages' => array('stringLengthTooLong' => 'Name too long.')))))->setDescription('<div id="progressbar_groupname" class="limit ok"></div>')->setDecorators(array('FieldDecorator'));
     $groupname_clear = new Oibs_Form_Element_Note('groupname_clear');
     $groupname_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // Lead paragraph (description)
     $groupdesc = new Zend_Form_Element_Textarea('groupdesc');
     $groupdesc->setAttrib('cols', '45')->setAttrib('rows', '6')->setLabel('Lead paragraph')->setRequired(true)->setFilters(array('StringTrim'))->setValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Description can't be empty."))), array('StringLength', false, array(1, 320, 'messages' => array('stringLengthTooLong' => 'Description too long.')))))->setDescription('<div id="progressbar_groupdesc" class="limit ok"></div>')->setDecorators(array('FieldDecorator'));
     $groupdesc_clear = new Oibs_Form_Element_Note('groupdesc_clear');
     $groupdesc_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // Body text.
     $groupbody = new Zend_Form_Element_Textarea('groupbody');
     $groupbody->setAttrib('cols', '45')->setAttrib('rows', '20')->setLabel('Body')->setFilters(array('StringTrim'))->setValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Body text can't be empty."))), array('StringLength', false, array(1, 4000, 'messages' => array('stringLengthTooLong' => 'Body text too long.')))))->setDescription('<div id="progressbar_groupbody" class="limit ok"></div>')->setDecorators(array('FieldDecorator'));
     $groupbody_clear = new Oibs_Form_Element_Note('groupbody_clear');
     $groupbody_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     $save = new Zend_Form_Element_Submit('save');
     $save->setLabel($translate->_('groups-btn_create'))->setAttrib('id', 'publish')->setAttrib('class', 'submit-button')->setAttrib('style', 'float: none;');
     $cancel = new Zend_Form_Element_Submit('cancel');
     $cancel->setLabel('Cancel')->setAttrib('id', 'cancel')->setAttrib('class', 'submit-button');
     $this->addElements(array($groupname, $groupname_clear, $groupdesc, $groupdesc_clear, $groupbody, $groupbody_clear, $save));
     $save->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'openOnly' => true, 'id' => 'submit', 'style' => 'clear: both;'))));
     $cancel->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'closeOnly' => true))));
 }
예제 #5
0
 public function __construct($parent = null, $options = null)
 {
     parent::__construct($options);
     $parentId = 0;
     if ($parent != null) {
         $parentId = $parent;
     }
     $translate = Zend_Registry::get('Zend_Translate');
     $this->setName('Create a campaign');
     $this->addElementPrefixPath('Oibs_Form_Decorator', 'Oibs/Form/Decorator/', 'decorator');
     // Clear div
     $clear = '<div class="clear"></div>';
     // Campaign name
     $campaignname = new Zend_Form_Element_Text('campaign_name');
     $campaignname->setLabel('Name')->setRequired(true)->setFilters(array('StringTrim'))->setValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty'))), new Oibs_Validators_CampaignExists('campaign_name'), array('StringLength', false, array(1, 140, 'messages' => array('stringLengthTooLong' => 'Name too long.')))))->setDescription('<div id="progressbar_campaign_name" class="limit ok"></div>')->setDecorators(array('FieldDecorator'));
     $campaignname_clear = new Oibs_Form_Element_Note('campaignname_clear');
     $campaignname_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // Ingress
     $campaigningress = new Zend_Form_Element_TextArea('campaign_ingress');
     $campaigningress->setAttrib('cols', '45')->setAttrib('rows', '6')->setLabel('Ingress')->setRequired(true)->setFilters(array('StringTrim'))->setValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Ingress can't be empty."))), array('StringLength', false, array(1, 320, 'messages' => array('stringLengthTooLong' => 'Ingress too long.')))))->setDescription('<div id="progressbar_campaign_ingress" class="limit ok"></div>')->setDecorators(array('FieldDecorator'));
     $campaigningress_clear = new Oibs_Form_Element_Note('campaigningress_clear');
     $campaigningress_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // Description
     $campaigndesc = new Zend_Form_Element_TextArea('campaign_desc');
     $campaigndesc->setAttrib('cols', '45')->setAttrib('rows', '20')->setLabel('Body text')->setRequired(true)->setFilters(array('StringTrim'))->setValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Body text can't be empty."))), array('StringLength', false, array(1, 4000, 'messages' => array('stringLengthTooLong' => 'Body text too long.')))))->setDescription('<div id="progressbar_campaign_desc" class="limit ok"></div>')->setDecorators(array('FieldDecorator'));
     $campaigndesc_clear = new Oibs_Form_Element_Note('campaigndesc_clear');
     $campaigndesc_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // Start date
     $campaignstart = new Zend_Form_Element_Text('campaign_start');
     $campaignstart->setAttrib('id', 'campaign_start')->setAttrib('name', 'campaign_start')->setLabel('Start date')->setRequired(true)->setAttrib('invalidMessage', 'Invalid date specified')->setAttrib('formalLength', 'long')->setValidators(array(new Zend_Validate_Date('campaign_start')))->setDecorators(array('FieldDecorator'));
     $campaignstart_clear = new Oibs_Form_Element_Note('campaignstart_clear');
     $campaignstart_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // End date
     $campaignend = new Zend_Form_Element_Text('campaign_end');
     $campaignend->setAttrib('id', 'campaign_end')->setLabel('End date')->setRequired(true)->setAttrib('invalidMessage', 'Invalid date specified')->setAttrib('formalLength', 'long')->setValidators(array(new Zend_Validate_Date('campaign_end')))->setDecorators(array('FieldDecorator'));
     $campaignend_clear = new Oibs_Form_Element_Note('campaignend_clear');
     $campaignend_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     $save = new Zend_Form_Element_Submit('save');
     $save->setLabel('Create')->setAttrib('id', 'publish')->setAttrib('class', 'submit-button')->setAttrib('style', 'float: none;');
     $cancel = new Zend_Form_Element_Submit('cancel');
     $cancel->setLabel('Cancel')->setAttrib('id', 'preview')->setAttrib('class', 'submit-button')->setAttrib('style', 'float: none;');
     $this->addElements(array($campaignname, $campaignname_clear, $campaigningress, $campaigningress_clear, $campaigndesc, $campaigndesc_clear, $save));
     $save->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'openOnly' => true, 'id' => 'submit', 'style' => 'clear: both;'))));
     $cancel->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'closeOnly' => true))));
 }
예제 #6
0
 public function __construct($parent = null, $options = null)
 {
     parent::__construct($options);
     $parentId = 0;
     if ($parent != null) {
         $parentId = $parent;
     }
     $translate = Zend_Registry::get('Zend_Translate');
     $this->setName('add_group_form');
     $this->addElementPrefixPath('Oibs_Form_Decorator', 'Oibs/Form/Decorator/', 'decorator');
     $clear = '<div class="clear"></div>';
     // Group name (must be unique).
     $groupname = new Zend_Form_Element_Text('groupname');
     $groupname->setLabel('Name')->setRequired(true)->setFilters(array('StringTrim'))->setValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty'))), array('StringLength', false, array(1, 140, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'Name too long.'))), array(new Oibs_Validators_GroupExists($options), false)))->setDescription('<div id="progressbar_groupname" class="limit ok"></div>')->setDecorators(array('FieldDecorator'));
     $groupname_clear = new Oibs_Form_Element_Note('groupname_clear');
     $groupname_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // Group type
     $groupTypes_model = new Default_Model_GroupTypes();
     $groupTypes = $groupTypes_model->getAllTypes();
     $grouptype = new Zend_Form_Element_Select('grouptype');
     $grouptype->setLabel('Type')->setAttrib('id', 'grouptype');
     foreach ($groupTypes as $type) {
         $grouptype->addMultiOption($type['id_gtp'], $type['name_gtp']);
     }
     $grouptype->setDecorators(array('FieldDecorator'));
     $grouptype_clear = new Oibs_Form_Element_Note('grouptype_clear');
     $grouptype_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // Lead paragraph (description)
     $groupdesc = new Zend_Form_Element_Textarea('groupdesc');
     $groupdesc->setAttrib('cols', '45')->setAttrib('rows', '6')->setLabel('Lead paragraph')->setRequired(true)->setValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Description can't be empty."))), array('StringLength', false, array(1, 320, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'Description too long.')))))->setDescription('<div id="progressbar_groupdesc" class="limit ok"></div>')->setDecorators(array('FieldDecorator'));
     $groupdesc_clear = new Oibs_Form_Element_Note('groupdesc_clear');
     $groupdesc_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // Body text.
     $groupbody = new Zend_Form_Element_Textarea('groupbody');
     $groupbody->setAttrib('cols', '45')->setAttrib('rows', '20')->setLabel('Body')->setValidators(array(array('StringLength', false, array(1, 4000, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'Body text too long.')))))->setDecorators(array('FieldDecorator'));
     $groupbody_clear = new Oibs_Form_Element_Note('groupbody_clear');
     $groupbody_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     $weblinks_websites = new Oibs_Form_Element_Note('weblinks_websites');
     $weblinks_websites->setValue('<div class="input-column-website1"><label><strong>Links to websites:</strong></label></div>');
     $weblinks_name = new Oibs_Form_Element_Note('weblinks_name');
     $weblinks_name->setValue('<div class="input-column-website2">Name</div>');
     $weblinks_url = new Oibs_Form_Element_Note('weblinks_url');
     $weblinks_url->setValue('<div class="input-column-website3">Url</div><div class="clear"></div>');
     $nameTooLongText = 'Name too long (max 45)';
     $urlTooLongText = 'URL too long (max 150)';
     $weblinks_name_site1 = new Zend_Form_Element_Text('weblinks_name_site1');
     $weblinks_name_site1->setLabel('Web site 1')->setAttrib('id', 'website1-name')->addValidators(array(array('StringLength', false, array(0, 45, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $nameTooLongText)))));
     $weblinks_url_site1 = new Zend_Form_Element_Text('weblinks_url_site1');
     $weblinks_url_site1->setAttrib('id', 'website1-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $urlTooLongText)))));
     $weblinks_name_site2 = new Zend_Form_Element_Text('weblinks_name_site2');
     $weblinks_name_site2->setLabel('Web site 2')->setAttrib('id', 'website2-name')->addValidators(array(array('StringLength', false, array(0, 45, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $nameTooLongText)))));
     $weblinks_url_site2 = new Zend_Form_Element_Text('weblinks_url_site2');
     $weblinks_url_site2->setAttrib('id', 'website2-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'messages' => array('stringLengthTooLong' => $urlTooLongText)))));
     $weblinks_name_site3 = new Zend_Form_Element_Text('weblinks_name_site3');
     $weblinks_name_site3->setLabel('Web site 3')->setAttrib('id', 'website3-name')->setAttrib('id', 'website2-name')->addValidators(array(array('StringLength', false, array(0, 45, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $nameTooLongText)))));
     $weblinks_url_site3 = new Zend_Form_Element_Text('weblinks_url_site3');
     $weblinks_url_site3->setAttrib('id', 'website3-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $urlTooLongText)))));
     $weblinks_name_site4 = new Zend_Form_Element_Text('weblinks_name_site4');
     $weblinks_name_site4->setLabel('Web site 4')->setAttrib('id', 'website4-name')->setAttrib('id', 'website2-name')->addValidators(array(array('StringLength', false, array(0, 45, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $nameTooLongText)))));
     $weblinks_url_site4 = new Zend_Form_Element_Text('weblinks_url_site4');
     $weblinks_url_site4->setAttrib('id', 'website4-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $urlTooLongText)))));
     $weblinks_name_site5 = new Zend_Form_Element_Text('weblinks_name_site5');
     $weblinks_name_site5->setLabel('Web site 5')->setAttrib('id', 'website5-name')->setAttrib('id', 'website2-name')->addValidators(array(array('StringLength', false, array(0, 45, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $nameTooLongText)))));
     $weblinks_url_site5 = new Zend_Form_Element_Text('weblinks_url_site5');
     $weblinks_url_site5->setAttrib('id', 'website5-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $urlTooLongText)))));
     $weblinks_websites->setDecorators(array('ViewHelper'));
     $weblinks_name->setDecorators(array('ViewHelper'));
     $weblinks_url->setDecorators(array('ViewHelper'));
     $weblinks_name_site1->setDecorators(array('InputWebsiteNameDecorator'));
     $weblinks_url_site1->setDecorators(array('InputWebsiteUrlDecorator'));
     $weblinks_name_site2->setDecorators(array('InputWebsiteNameDecorator'));
     $weblinks_url_site2->setDecorators(array('InputWebsiteUrlDecorator'));
     $weblinks_name_site3->setDecorators(array('InputWebsiteNameDecorator'));
     $weblinks_url_site3->setDecorators(array('InputWebsiteUrlDecorator'));
     $weblinks_name_site4->setDecorators(array('InputWebsiteNameDecorator'));
     $weblinks_url_site4->setDecorators(array('InputWebsiteUrlDecorator'));
     $weblinks_name_site5->setDecorators(array('InputWebsiteNameDecorator'));
     $weblinks_url_site5->setDecorators(array('InputWebsiteUrlDecorator'));
     $save = new Zend_Form_Element_Submit('save');
     if (is_array($options) && $options['mode'] == 'edit') {
         $save->setLabel('Save');
     } else {
         $save->setLabel('Create');
     }
     $save->setAttrib('id', 'publish')->setAttrib('class', 'submit-button')->setAttrib('style', 'float: none;');
     $this->addElements(array($groupname, $groupname_clear, $grouptype, $grouptype_clear, $groupdesc, $groupdesc_clear, $groupbody, $groupbody_clear, $weblinks_websites, $weblinks_name, $weblinks_url, $weblinks_name_site1, $weblinks_url_site1, $weblinks_name_site2, $weblinks_url_site2, $weblinks_name_site3, $weblinks_url_site3, $weblinks_name_site4, $weblinks_url_site4, $weblinks_name_site5, $weblinks_url_site5, $save));
     $save->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'openOnly' => true, 'id' => 'submit', 'style' => 'clear: both;'))));
 }
예제 #7
0
 public function init()
 {
     $this->setMethod('post');
     $this->setEnctype('multipart/form-data');
     $this->setName('edit_profile_form');
     $this->setAttrib('id', 'edit-profile-form');
     $this->addElementPrefixPath('Oibs_Form_Decorator', 'Oibs/Form/Decorator/', 'decorator');
     $mailvalid = new Zend_Validate_EmailAddress();
     $mailvalid->setMessage('email-invalid', Zend_Validate_EmailAddress::INVALID);
     $mailvalid->setMessage('email-invalid-hostname', Zend_Validate_EmailAddress::INVALID_HOSTNAME);
     $mailvalid->setMessage('email-invalid-mx-record', Zend_Validate_EmailAddress::INVALID_MX_RECORD);
     $mailvalid->setMessage('email-dot-atom', Zend_Validate_EmailAddress::DOT_ATOM);
     $mailvalid->setMessage('email-quoted-string', Zend_Validate_EmailAddress::QUOTED_STRING);
     $mailvalid->setMessage('email-invalid-local-part', Zend_Validate_EmailAddress::INVALID_LOCAL_PART);
     $mailvalid->setMessage('email-length-exceeded', Zend_Validate_EmailAddress::LENGTH_EXCEEDED);
     $mailvalid->hostnameValidator->setMessage('hostname-invalid-hostname', Zend_Validate_Hostname::INVALID_HOSTNAME);
     $mailvalid->hostnameValidator->setMessage('hostname-local-name-not-allowed', Zend_Validate_Hostname::LOCAL_NAME_NOT_ALLOWED);
     $mailvalid->hostnameValidator->setMessage('hostname-unknown-tld', Zend_Validate_Hostname::UNKNOWN_TLD);
     $mailvalid->hostnameValidator->setMessage('hostname-invalid-local-name', Zend_Validate_Hostname::INVALID_LOCAL_NAME);
     $mailvalid->hostnameValidator->setMessage('hostname-undecipherable-tld', Zend_Validate_Hostname::UNDECIPHERABLE_TLD);
     // Clear div
     $clear = '<div class="clear"></div>';
     // Headers
     $accountInformation = new Oibs_Form_Element_Note('accountinformation');
     $accountInformation->setValue($clear . '<h3>Account information</h3>' . $clear);
     $personalInformation = new Oibs_Form_Element_Note('personalinformation');
     $personalInformation->setValue('<h3>Personal Information</h3>' . $clear);
     $locationInformation = new Oibs_Form_Element_Note('locationinformation');
     $locationInformation->setValue('<h3>Location Information</h3>' . $clear);
     $employmentInformation = new Oibs_Form_Element_Note('employmentinformation');
     $employmentInformation->setValue('<h3>Employment Information</h3>' . $clear);
     $subscribeInformation = new Oibs_Form_Element_Note('subscribeinformation');
     $subscribeInformation->setValue('<h3>Subscribe settings</h3>' . $clear);
     // Public text
     $publictext = 'Public';
     // Username for description
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $usernametext = $identity->username;
     $username = new Zend_Form_Element_Hidden('username');
     $username->setLabel('Username')->setDescription($usernametext);
     $usernamepublic = new Zend_Form_Element_Hidden('username_publicity');
     $usernamepublic->setLabel($publictext);
     $openid = new Zend_Form_Element_Text('openid');
     $openid->setLabel('Open-ID')->setAttrib('id', 'open-ID')->addValidators(array(new Oibs_Validators_OpenidExists()));
     $openidclear = new Oibs_Form_Element_Note('openidclear');
     $openidclear->setValue($clear);
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel('New password')->setAttrib('id', 'password')->addValidators(array(new Oibs_Validators_RepeatValidator('confirm_password'), array('NotEmpty', true, array('messages' => array('isEmpty' => 'Empty'))), array('StringLength', false, array(4, 22, 'messages' => array('stringLengthTooShort' => 'Password too short (4-22 characters)', 'stringLengthTooLong' => 'Password too long (4-22 characters)')))));
     $passwordclear = new Oibs_Form_Element_Note('passwordclear');
     $passwordclear->setValue($clear);
     $confirmpassword = new Zend_Form_Element_Password('confirm_password');
     $confirmpassword->setLabel('Confirm password')->setAttrib('id', 'confirm-password')->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Empty'))), array('StringLength', false, array(4, 22, 'messages' => array('stringLengthTooShort' => 'Password too short (4-22 characters)', 'stringLengthTooLong' => 'Password too long (4-22 characters)')))));
     $confirmpasswordclear = new Oibs_Form_Element_Note('confirm_passwordclear');
     $confirmpasswordclear->setValue($clear);
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->setAttrib('id', 'email')->setRequired(true)->addFilter('StringtoLower')->addValidators(array($mailvalid, array('NotEmpty', true, array('messages' => array('isEmpty' => 'Email empty'))), array('StringLength', false, array(6, 50, 'messages' => array('stringLengthTooShort' => 'Email too short (6-50 characters)', 'stringLengthTooLong' => 'Email too long (6-50 characters)')))));
     $emailclear = new Oibs_Form_Element_Note('emailclear');
     $emailclear->setValue($clear);
     $gravatar = new Zend_Form_Element_Hidden('gravatartext');
     $gravatar->setLabel('Gravatar')->setDescription('<div style="text-align: right;">Enable <a href="http://www.gravatar.com">gravatar</a></div>');
     $gravatarcheck = new Zend_Form_Element_Checkbox('gravatar');
     $phone = new Zend_Form_Element_Text('phone');
     $phone->setLabel('Phone')->setAttrib('id', 'phone');
     $phonepublic = new Zend_Form_Element_Checkbox('phone_publicity');
     $phonepublic->setLabel($publictext);
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->setLabel('First name')->setAttrib('id', 'first-name');
     $firstnamepublic = new Zend_Form_Element_Checkbox('firstname_publicity');
     $firstnamepublic->setLabel($publictext);
     // DB: surname
     $lastname = new Zend_Form_Element_Text('surname');
     $lastname->setLabel('Last name')->setAttrib('id', 'last-name');
     $lastnamepublic = new Zend_Form_Element_Checkbox('surname_publicity');
     $lastnamepublic->setLabel($publictext);
     $gender = new Zend_Form_Element_Select('gender');
     $gender->setLabel('Gender')->setAttrib('id', 'gender')->addMultiOptions(array('Select', 'Male', 'Female'));
     $genderpublic = new Zend_Form_Element_Checkbox('gender_publicity');
     $genderpublic->setLabel($publictext);
     $birthday = new Zend_Form_Element_Text('birthday');
     $birthday->setLabel('Date of Birth')->setAttrib('id', 'birthday')->setValidators(array(new Zend_Validate_Date('birthday')));
     $birthdaypublic = new Zend_Form_Element_Checkbox('birthday_publicity');
     $birthdaypublic->setLabel($publictext);
     $biography = new Zend_Form_Element_Textarea('biography');
     $biography->setLabel('Biography')->setAttrib('id', 'biography')->setAttrib('rows', 30)->setAttrib('cols', 45)->addValidators(array(array('StringLength', false, array(0, 4000, 'messages' => array('stringLengthTooLong' => 'Biography too long')))));
     //->setDescription('<div id="progressbar_biography" class="progress_ok"></div>');
     $biographypublic = new Zend_Form_Element_Checkbox('biography_publicity');
     $biographypublic->setLabel($publictext);
     $intereststext = new Oibs_Form_Element_Note('intereststext');
     $intereststext->setValue('<div class="input-column1"></div>' . '<div class="input-column2 help">(Use commas to separate tags)</div><div class="clear"></div>');
     $interests = new Zend_Form_Element_Text('interests');
     $interests->setLabel('My interest (tags)')->setAttrib('id', 'interests');
     $interestsclear = new Oibs_Form_Element_Note('interestsclear');
     $interestsclear->setValue($clear);
     $weblinks_websites = new Oibs_Form_Element_Note('weblinks_websites');
     $weblinks_websites->setValue('<div class="input-column-website1"><label><strong>Links to my websites:</strong></label></div>');
     $weblinks_name = new Oibs_Form_Element_Note('weblinks_name');
     $weblinks_name->setValue('<div class="input-column-website2">Name</div>');
     $weblinks_url = new Oibs_Form_Element_Note('weblinks_url');
     $weblinks_url->setValue('<div class="input-column-website3">Url</div><div class="clear"></div>');
     $nameTooLongText = 'Name too long (max 45)';
     $urlTooLongText = 'URL too long (max 150)';
     $weblinks_name_site1 = new Zend_Form_Element_Text('weblinks_name_site1');
     $weblinks_name_site1->setLabel('Web site 1')->setAttrib('id', 'website1-name')->addValidators(array(array('StringLength', false, array(0, 45, 'messages' => array('stringLengthTooLong' => $nameTooLongText)))));
     $weblinks_url_site1 = new Zend_Form_Element_Text('weblinks_url_site1');
     $weblinks_url_site1->setAttrib('id', 'website1-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'messages' => array('stringLengthTooLong' => $urlTooLongText)))));
     $weblinks_name_site2 = new Zend_Form_Element_Text('weblinks_name_site2');
     $weblinks_name_site2->setLabel('Web site 2')->setAttrib('id', 'website2-name')->addValidators(array(array('StringLength', false, array(0, 45, 'messages' => array('stringLengthTooLong' => $nameTooLongText)))));
     $weblinks_url_site2 = new Zend_Form_Element_Text('weblinks_url_site2');
     $weblinks_url_site2->setAttrib('id', 'website2-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'messages' => array('stringLengthTooLong' => $urlTooLongText)))));
     $weblinks_name_site3 = new Zend_Form_Element_Text('weblinks_name_site3');
     $weblinks_name_site3->setLabel('Web site 3')->setAttrib('id', 'website3-name')->setAttrib('id', 'website2-name')->addValidators(array(array('StringLength', false, array(0, 45, 'messages' => array('stringLengthTooLong' => $nameTooLongText)))));
     $weblinks_url_site3 = new Zend_Form_Element_Text('weblinks_url_site3');
     $weblinks_url_site3->setAttrib('id', 'website3-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'messages' => array('stringLengthTooLong' => $urlTooLongText)))));
     $weblinks_name_site4 = new Zend_Form_Element_Text('weblinks_name_site4');
     $weblinks_name_site4->setLabel('Web site 4')->setAttrib('id', 'website4-name')->setAttrib('id', 'website2-name')->addValidators(array(array('StringLength', false, array(0, 45, 'messages' => array('stringLengthTooLong' => $nameTooLongText)))));
     $weblinks_url_site4 = new Zend_Form_Element_Text('weblinks_url_site4');
     $weblinks_url_site4->setAttrib('id', 'website4-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'messages' => array('stringLengthTooLong' => $urlTooLongText)))));
     $weblinks_name_site5 = new Zend_Form_Element_Text('weblinks_name_site5');
     $weblinks_name_site5->setLabel('Web site 5')->setAttrib('id', 'website5-name')->setAttrib('id', 'website2-name')->addValidators(array(array('StringLength', false, array(0, 45, 'messages' => array('stringLengthTooLong' => $nameTooLongText)))));
     $weblinks_url_site5 = new Zend_Form_Element_Text('weblinks_url_site5');
     $weblinks_url_site5->setAttrib('id', 'website5-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'messages' => array('stringLengthTooLong' => $urlTooLongText)))));
     $languages = new Default_Model_Languages();
     $allLanguages = $languages->getAllNamesAndIds();
     $userlanguage = new Zend_Form_Element_Select('userlanguage');
     $userlanguage->setLabel('User interface language')->setAttrib('id', 'user-interface-language')->addMultiOption('', 'Select');
     foreach ($allLanguages as $language) {
         $userlanguage->addMultiOption($language['id_lng'], $language['name_lng']);
     }
     $userlanguageclear = new Oibs_Form_Element_Note('userlanguageclear');
     $userlanguageclear->setValue($clear);
     /*
             $avatar = new Zend_Form_Element_File('avatar');
             $avatar->setLabel('Avatar image');
     */
     // DB: city
     $hometown = new Zend_Form_Element_Text('city');
     $hometown->setLabel('Hometown')->setAttrib('id', 'hometown')->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Hometown empty'))), array('Regex', true, array('/^[\\p{L}0-9.\\- ]*$/'))));
     $hometownpublic = new Zend_Form_Element_Checkbox('city_publicity');
     $hometownpublic->setLabel($publictext);
     $hometownpublic->helper = 'FormHidden';
     $address = new Zend_Form_Element_Text('address');
     $address->setLabel('Address')->setAttrib('id', 'address');
     $addresspublic = new Zend_Form_Element_Checkbox('address_publicity');
     $addresspublic->setLabel($publictext)->setAttrib('checked', 'checked')->setValue(1);
     $addresspublic->helper = 'FormHidden';
     $country_model = new Default_Model_Countries();
     $allCountries = $country_model->getAllCountries();
     $usercountry = new Zend_Form_Element_Select('country');
     $usercountry->setLabel('Country of Residence')->setAttrib('id', 'country')->addMultiOption('', 'Select');
     foreach ($allCountries as $country) {
         $usercountry->addMultiOption($country['iso_ctr'], $country['printable_name_ctr']);
     }
     $usercountrypublic = new Zend_Form_Element_Checkbox('country_publicity');
     $usercountrypublic->setLabel($publictext);
     $timezone_model = new Default_Model_Timezones();
     $allTimezones = $timezone_model->getAllTimezones();
     $usertimezone = new Zend_Form_Element_Select('usertimezone');
     $usertimezone->setLabel('Time Zone')->setAttrib('id', 'time-zone')->addMultiOption('', 'Select');
     foreach ($allTimezones as $timezone) {
         $usertimezone->addMultiOption($timezone['id_tmz'], $timezone['gmt_tmz'] . ' ' . $timezone['timezone_location_tmz']);
     }
     $usertimezonepublic = new Zend_Form_Element_Checkbox('usertimezone_publicity');
     $usertimezonepublic->setLabel($publictext);
     $userProfilesModel = new Default_Model_UserProfiles();
     $employments = $userProfilesModel->getEmployments();
     $employments = array_merge(array('' => 'Select'), $employments);
     $employment = new Zend_Form_Element_Select('employment');
     $employment->setLabel('I am currently')->setAttrib('id', 'status')->setRequired(true)->addMultiOptions($employments)->setErrorMessages(array('Select status'));
     $employmentpublic = new Zend_Form_Element_Checkbox('employment_publicity');
     $employmentpublic->setLabel($publictext);
     // DB: company
     $employer_organization = new Zend_Form_Element_Text('company');
     $employer_organization->setLabel('Employer / Organization')->setAttrib('id', 'employer-organization');
     $employer_organizationpublic = new Zend_Form_Element_Checkbox('company_publicity');
     $employer_organizationpublic->setLabel($publictext);
     //Subscribe things
     $favouritesModel = new Default_Model_UserHasFavourites();
     $subscribeOptions = $favouritesModel->getFollows();
     unset($subscribeOptions['8']);
     //Unsetting the translation box till its in use.
     //print_r($subscribeOptions);die;
     $test = new Zend_Form_Element_MultiCheckbox('lol');
     //$test->setV
     $subscribeClasses = array("own_follows" => "Own contents", "fvr_follows" => "Favourite contents");
     foreach ($subscribeClasses as $key => $value) {
         $subscribe[$key] = new Zend_Form_Element_MultiCheckbox($key);
         $subscribe[$key]->setLabel('Activities you want to follow in your ' . $value);
         $subscribe[$key]->addMultiOptions($subscribeOptions);
     }
     $subscribeclear = new Oibs_Form_Element_Note('subscribeclear');
     $subscribeclear->setValue($clear);
     $save = new Zend_Form_Element_Submit('save');
     $save->setLabel('Save profile')->setAttrib('id', 'save-profile')->setAttrib('class', 'submit-button');
     $cancel = new Zend_Form_Element_Submit('cancel');
     $cancel->setLabel('Cancel')->setAttrib('id', 'cancel')->setAttrib('class', 'submit-button');
     $this->addElements(array($accountInformation, $username, $usernamepublic, $openid, $openidclear, $password, $passwordclear, $confirmpassword, $confirmpasswordclear, $personalInformation, $email, $emailclear, $gravatar, $gravatarcheck, $phone, $phonepublic, $firstname, $firstnamepublic, $lastname, $lastnamepublic, $gender, $genderpublic, $birthday, $birthdaypublic, $biography, $biographypublic, $weblinks_websites, $weblinks_name, $weblinks_url, $weblinks_name_site1, $weblinks_url_site1, $weblinks_name_site2, $weblinks_url_site2, $weblinks_name_site3, $weblinks_url_site3, $weblinks_name_site4, $weblinks_url_site4, $weblinks_name_site5, $weblinks_url_site5, $userlanguage, $userlanguageclear, $locationInformation, $hometown, $hometownpublic, $address, $addresspublic, $usercountry, $usercountrypublic, $usertimezone, $usertimezonepublic, $employmentInformation, $employment, $employmentpublic, $employer_organization, $employer_organizationpublic, $save, $cancel));
     $accountInformation->setDecorators(array('ViewHelper'));
     $personalInformation->setDecorators(array('ViewHelper'));
     $locationInformation->setDecorators(array('ViewHelper'));
     $employmentInformation->setDecorators(array('ViewHelper'));
     $subscribeInformation->setDecorators(array('ViewHelper'));
     $username->setDecorators(array('InputDecorator'));
     $usernamepublic->setDecorators(array('PublicDecorator'));
     $openid->setDecorators(array('InputDecorator'));
     $openidclear->setDecorators(array('ViewHelper'));
     $password->setDecorators(array('InputDecorator'));
     $passwordclear->setDecorators(array('ViewHelper'));
     $confirmpassword->setDecorators(array('InputDecorator'));
     $confirmpasswordclear->setDecorators(array('ViewHelper'));
     $email->setDecorators(array('InputDecorator'));
     $emailclear->setDecorators(array('ViewHelper'));
     $gravatar->setDecorators(array('InputDecorator'));
     $gravatarcheck->setDecorators(array('PublicDecorator'));
     $phone->setDecorators(array('InputDecorator'));
     $phonepublic->setDecorators(array('PublicDecorator'));
     $firstname->setDecorators(array('InputDecorator'));
     $firstnamepublic->setDecorators(array('PublicDecorator'));
     $lastname->setDecorators(array('InputDecorator'));
     $lastnamepublic->setDecorators(array('PublicDecorator'));
     $gender->setDecorators(array('InputDecorator'));
     $genderpublic->setDecorators(array('PublicDecorator'));
     $birthday->setDecorators(array('InputDecorator'));
     $birthdaypublic->setDecorators(array('PublicDecorator'));
     $biography->setDecorators(array('InputDecorator'));
     $biographypublic->setDecorators(array('PublicDecorator'));
     $intereststext->setDecorators(array('ViewHelper'));
     $interests->setDecorators(array('InputDecorator'));
     $interestsclear->setDecorators(array('ViewHelper'));
     $weblinks_websites->setDecorators(array('ViewHelper'));
     $weblinks_name->setDecorators(array('ViewHelper'));
     $weblinks_url->setDecorators(array('ViewHelper'));
     $weblinks_name_site1->setDecorators(array('InputWebsiteNameDecorator'));
     $weblinks_url_site1->setDecorators(array('InputWebsiteUrlDecorator'));
     $weblinks_name_site2->setDecorators(array('InputWebsiteNameDecorator'));
     $weblinks_url_site2->setDecorators(array('InputWebsiteUrlDecorator'));
     $weblinks_name_site3->setDecorators(array('InputWebsiteNameDecorator'));
     $weblinks_url_site3->setDecorators(array('InputWebsiteUrlDecorator'));
     $weblinks_name_site4->setDecorators(array('InputWebsiteNameDecorator'));
     $weblinks_url_site4->setDecorators(array('InputWebsiteUrlDecorator'));
     $weblinks_name_site5->setDecorators(array('InputWebsiteNameDecorator'));
     $weblinks_url_site5->setDecorators(array('InputWebsiteUrlDecorator'));
     $userlanguage->setDecorators(array('InputDecorator'));
     $userlanguageclear->setDecorators(array('ViewHelper'));
     $hometown->setDecorators(array('InputDecorator'));
     $hometownpublic->setDecorators(array('PublicDecorator'));
     $address->setDecorators(array('InputDecorator'));
     $addresspublic->setDecorators(array('PublicDecorator'));
     $usercountry->setDecorators(array('InputDecorator'));
     $usercountrypublic->setDecorators(array('PublicDecorator'));
     $usertimezone->setDecorators(array('InputDecorator'));
     $usertimezonepublic->setDecorators(array('PublicDecorator'));
     $employment->setDecorators(array('InputDecorator'));
     $employmentpublic->setDecorators(array('PublicDecorator'));
     $employer_organization->setDecorators(array('InputDecorator'));
     $employer_organizationpublic->setDecorators(array('PublicDecorator'));
     $subscribe['own_follows']->setDecorators(array('InputDecorator'));
     $subscribe['fvr_follows']->setDecorators(array('InputDecorator'));
     $subscribeclear->setDecorators(array('ViewHelper'));
     $save->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'openOnly' => true, 'id' => 'save_changes'))));
     $cancel->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'closeOnly' => true))));
     $this->setDecorators(array('FormElements', 'Form'));
 }
    public function __construct($options = null)
    {
        parent::__construct();
        $this->setName('custom_layout_settings_form');
        $this->addElementPrefixPath('Oibs_Form_Decorator', 'Oibs/Form/Decorator/', 'decorator');
        $clear = new Oibs_Form_Element_Note('clear');
        $clear->setValue('<div class="clear"></div>');
        $bgimageclear = new Oibs_Form_Element_Note('clear');
        $bgimageclear->setValue('<div style="clear:both;"></div>');
        $testdivstart = new Oibs_Form_Element_Note('testdivstart');
        $testdivstart->setValue('<div class="backgrounddiv" style="float:right; width:410px; margin-top:-5px; padding-left:20px; border-left:1px solid silver;">');
        $testdivend = new Oibs_Form_Element_Note('testdivend');
        $testdivend->setValue('</div>');
        $testdiv2start = new Oibs_Form_Element_Note('testdiv2start');
        $testdiv2start->setValue('<div class="fontdiv" style="float:left; width:280px; /*border:1px solid black;*/ margin-top:-25px;">');
        $testdiv2end = new Oibs_Form_Element_Note('testdiv2end');
        $testdiv2end->setValue('</div>');
        // Headers
        $fontheader = new Oibs_Form_Element_Note('fontheader');
        $fontheader->setValue('<center><div style="font-weight:bold; font-size:1.35em; margin-top:-20px;"><label>Custom font</label></div></center>');
        $bgheader = new Oibs_Form_Element_Note('bgheader');
        $bgheader->setValue('<center><div style="font-weight:bold; font-size:1.35em; margin-top:-20px;"><label>Custom background</label></div></center>');
        // Font
        $customfont = new Zend_Form_Element_Select('customfont');
        $customfont->setLabel('Font')->setAttrib('id', 'customfont')->setAttrib('style', 'margin-top:-1px;')->addMultiOptions(array('Arial', 'Castellar', 'Times New Roman', 'Microsoft Sans Serif', 'Harrington'));
        $customfontclear = new Oibs_Form_Element_Note('customfontclear');
        $customfontclear->setValue('<div style="clear:both;"></div>');
        // Custom font preview text
        $customfontpreviewtext = new Oibs_Form_Element_Note('custompreviewtext');
        $customfontpreviewtext->setValue('<div style="float:right; width:250px; display:block; padding-right:50px;">
											Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz</div>');
        // Font size
        $customfontsize = new Zend_Form_Element_Select('customfontsize');
        //$customfontsize->setLabel('Font Size')
        $customfontsize->setLabel('')->setAttrib('id', 'customfontsize')->setAttrib('style', 'float:left; text-align:left; margin-bottom:5px; margin-left:10px; margin-top:-8px;')->addMultiOptions(array('8', '10', '12', '14', '16'));
        $customsizeclear = new Oibs_Form_Element_Note('customsizeclear');
        $customsizeclear->setValue('<div class="clear"></div>');
        // Font color
        $customfontcolor = new Zend_Form_Element_Text('customfontcolor');
        $customfontcolor->setLabel('Color')->setAttrib('id', 'customfontcolor')->setAttrib('style', 'margin-top:-1px;')->setValue('#000000');
        $customfontcolorclear = new Oibs_Form_Element_Note('customfontcolorlear');
        $customfontcolorclear->setValue('<div class="clear"></div>');
        // For font color picker script
        $customfontcolorpicker = new Oibs_Form_Element_Note('customfontcolorpicker');
        $customfontcolorpicker->setValue('<center><div id="picker" style="margin-top:0px; margin-left:10px; /*border:1px solid silver;*/"></div></center>');
        //
        $backgroundimage = new Zend_Form_Element_File('backgroundimage');
        $backgroundimage->setLabel('Image :')->setDestination('../www/upload')->addValidator('Count', false, 1)->addValidator('Size', false, 524288)->addValidator('Extension', false, 'jpg,png,gif')->removeDecorator('DtDdWrapper')->removeDecorator('DefaultDecorator')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'form_addcontent_row', 'style' => '/*float:right;*/ margin-top:6px'))->addDecorator('Label', array('tag' => 'div', 'class' => 'form_addcontent_row', 'style' => 'font-weight:bold; float:left; padding-right:10px; margin-top:6px; width:60px'));
        // Background color input
        $custombgcolor = new Zend_Form_Element_Text('custombgcolor');
        $custombgcolor->setLabel('Color')->setAttrib('id', 'custombgcolor')->setAttrib('style', 'margin-top:-1px;')->setValue('#ffffff');
        // For background color picker script
        $custombgcolorpicker = new Oibs_Form_Element_Note('custombgcolorpicker');
        $custombgcolorpicker->setValue('<center><div id="custombgcolorpicker" style="margin-top:20px; margin-left:10px; /*border:1px solid silver;*/"></div></center>');
        // Submit button
        $submit = new Zend_Form_Element_Button('custom_layout_button');
        //$submit->setLabel($translate->_("account-register-submit"))
        $submit->setLabel('Save')->setAttrib('style', 'width:60px; float:right; margin-right:10px')->removeDecorator('DefaultDecorator')->removeDecorator('DtDdWrapper');
        $submitclear = new Oibs_Form_Element_Note('submitclear');
        $submitclear->setValue('<div style="clear:both;"></div>');
        $savebgimagebutton = new Zend_Form_Element_Button('savebgimagebutton');
        //$savebgimagebutton->setLabel($translate->_("account-register-submit"))
        $savebgimagebutton->setLabel('Upload')->setAttrib('style', 'float:right; margin-right:50px; margin-top:6px; width:60px')->removeDecorator('DefaultDecorator')->removeDecorator('DtDdWrapper');
        $bgimageinuse = new Zend_Form_Element_Checkbox('bgimage_in_use');
        $bgimageinuse->setLabel(' Use < no imagefile uploaded>');
        $bgcolorinuse = new Zend_Form_Element_Checkbox('bgcolor_in_use');
        $bgcolorinuse->setLabel(' Use');
        // Block separator
        $blockseparator = new Oibs_Form_Element_Note('blockseparator');
        $blockseparator->setValue('<center><div style="width:696px; height:1px; border-bottom:1px solid silver; margin-bottom:10px;"></div></center>');
        // Add elements to form
        /*$this->addElements(array(//$customfontpreviewtext,
        								 //$customfontclear,						 
        								 $customfont,
        								 //$clear,
        								 $customfontsize,
        								 $customsizeclear,
        								 $customfontcolor,
        								 $customfontcolorclear,
        								 $customfontcolorpicker,
        								 $backgroundimage));
        		
        		*/
        /*
                 $this->addElements(array(//$customfontpreviewtext,
        								 //$customfontclear,
        								 $testdivstart,
        								 $backgroundimage,
        								 $custombgcolor,
        								 $testdivend,
        								 //$clear,
        								 $testdiv2start,
        								 $customfont,
        								 //$clear,
        								 $customfontsize,
        								 $customsizeclear,
        								 $customfontcolor,
        								 $testdiv2end,
        								 $customfontcolorclear,
        								 $customfontcolorpicker,
        								 $clear));
        */
        $this->addElements(array($testdivstart, $savebgimagebutton, $backgroundimage, $bgimageinuse, $custombgcolor, $custombgcolorpicker, $testdivend, $testdiv2start, $customfont, $customfontsize, $customsizeclear, $customfontcolor, $customfontcolorclear, $customfontcolorpicker, $testdiv2end, $submitclear, $blockseparator, $submit));
        // Add decorators
        $customfont->setDecorators(array('InputDecorator2'));
        //$customfontpreviewtext->setDecorators(array(''));
        //$customfontsize->setDecorators(array('InputDecorator'));
        //$customfontcolor->setDecorators(array('ColorPickerDecorator'));
        $customfontcolor->setDecorators(array('InputDecorator2'));
        //$backgroundimage->setDecorators(array('UploadDecorator'));
        $custombgcolor->setDecorators(array('InputDecorator3'));
        $bgimageinuse->setDecorators(array('CheckBoxDecorator'));
        $bgcolorinuse->setDecorators(array('CheckBoxDecorator'));
        $this->setDecorators(array('FormElements', 'Form'));
    }
예제 #9
0
 public function __construct($parent = null, $options = null)
 {
     parent::__construct($options);
     $parentId = 0;
     if ($parent != null) {
         $parentId = $parent;
     }
     $translate = Zend_Registry::get('Zend_Translate');
     $this->setName('Create a campaign');
     $this->addElementPrefixPath('Oibs_Form_Decorator', 'Oibs/Form/Decorator/', 'decorator');
     // Clear div
     $clear = '<div class="clear"></div>';
     // Campaign name
     $campaignname = new Zend_Form_Element_Text('campaign_name');
     $campaignname->setLabel('Name')->setRequired(true)->setFilters(array('StringTrim'))->setValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty'))), array('StringLength', false, array(1, 140, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'Name too long.')))))->setDescription('<div id="progressbar_campaign_name" class="limit ok"></div>')->setDecorators(array('FieldDecorator'));
     $campaignname_clear = new Oibs_Form_Element_Note('campaignname_clear');
     $campaignname_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // Ingress
     $campaigningress = new Zend_Form_Element_Textarea('campaign_ingress');
     $campaigningress->setAttrib('cols', '45')->setAttrib('rows', '6')->setLabel('Lead paragraph')->setRequired(true)->setValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Lead paragraph can't be empty."))), array('StringLength', false, array(1, 320, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'Lead paragraph too long.')))))->setDescription('<div id="progressbar_campaign_ingress" class="limit ok"></div>')->setDecorators(array('FieldDecorator'));
     $campaigningress_clear = new Oibs_Form_Element_Note('campaigningress_clear');
     $campaigningress_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // Body text
     $campaigndesc = new Zend_Form_Element_Textarea('campaign_desc');
     $campaigndesc->setAttrib('cols', '45')->setAttrib('rows', '20')->setLabel('Body text')->setValidators(array(array('StringLength', false, array(1, 4000, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'Body text too long.')))))->setDecorators(array('FieldDecorator'));
     $campaigndesc_clear = new Oibs_Form_Element_Note('campaigndesc_clear');
     $campaigndesc_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     // Start date
     $campaignstart = new Zend_Form_Element_Text('campaign_start');
     $campaignstart->setAttrib('id', 'campaign_start')->setAttrib('name', 'campaign_start')->setLabel('Start date (empty means current day)')->setAttrib('invalidMessage', 'Invalid date specified')->setAttrib('formalLength', 'long')->setValidators(array(new Zend_Validate_Date('yyyy-MM-dd'), new Oibs_Validators_StartdateValidator('campaign_start')))->setDecorators(array('FieldDecorator'));
     $campaignstart_clear = new Oibs_Form_Element_Note('campaignstart_clear');
     $campaignstart_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     //$validator = new Zend_Validate_Date('yyyy-MM-dd');
     // End date
     $campaignend = new Zend_Form_Element_Text('campaign_end');
     $campaignend->setAttrib('id', 'campaign_end')->setLabel('End date (empty means permanent campaign)')->setAttrib('invalidMessage', 'Invalid date specified')->setAttrib('formalLength', 'long')->setValidators(array(new Zend_Validate_Date('yyyy-MM-dd'), new Oibs_Validators_EnddateValidator('campaign_start')))->setDecorators(array('FieldDecorator'));
     $campaignend_clear = new Oibs_Form_Element_Note('campaignend_clear');
     $campaignend_clear->setValue($clear)->setDecorators(array('ViewHelper'));
     $weblinks_websites = new Oibs_Form_Element_Note('weblinks_websites');
     $weblinks_websites->setValue('<div class="input-column-website1"><label><strong>Links to websites:</strong></label></div>');
     $weblinks_name = new Oibs_Form_Element_Note('weblinks_name');
     $weblinks_name->setValue('<div class="input-column-website2">Name</div>');
     $weblinks_url = new Oibs_Form_Element_Note('weblinks_url');
     $weblinks_url->setValue('<div class="input-column-website3">Url</div><div class="clear"></div>');
     $nameTooLongText = 'Name too long (max 45)';
     $urlTooLongText = 'URL too long (max 150)';
     $weblinks_name_site1 = new Zend_Form_Element_Text('weblinks_name_site1');
     $weblinks_name_site1->setLabel('Web site 1')->setAttrib('id', 'website1-name')->addValidators(array(array('StringLength', false, array(0, 45, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $nameTooLongText)))));
     $weblinks_url_site1 = new Zend_Form_Element_Text('weblinks_url_site1');
     $weblinks_url_site1->setAttrib('id', 'website1-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $urlTooLongText)))));
     $weblinks_name_site2 = new Zend_Form_Element_Text('weblinks_name_site2');
     $weblinks_name_site2->setLabel('Web site 2')->setAttrib('id', 'website2-name')->addValidators(array(array('StringLength', false, array(0, 45, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $nameTooLongText)))));
     $weblinks_url_site2 = new Zend_Form_Element_Text('weblinks_url_site2');
     $weblinks_url_site2->setAttrib('id', 'website2-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $urlTooLongText)))));
     $weblinks_name_site3 = new Zend_Form_Element_Text('weblinks_name_site3');
     $weblinks_name_site3->setLabel('Web site 3')->setAttrib('id', 'website3-name')->setAttrib('id', 'website2-name')->addValidators(array(array('StringLength', false, array(0, 45, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $nameTooLongText)))));
     $weblinks_url_site3 = new Zend_Form_Element_Text('weblinks_url_site3');
     $weblinks_url_site3->setAttrib('id', 'website3-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $urlTooLongText)))));
     $weblinks_name_site4 = new Zend_Form_Element_Text('weblinks_name_site4');
     $weblinks_name_site4->setLabel('Web site 4')->setAttrib('id', 'website4-name')->setAttrib('id', 'website2-name')->addValidators(array(array('StringLength', false, array(0, 45, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $nameTooLongText)))));
     $weblinks_url_site4 = new Zend_Form_Element_Text('weblinks_url_site4');
     $weblinks_url_site4->setAttrib('id', 'website4-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $urlTooLongText)))));
     $weblinks_name_site5 = new Zend_Form_Element_Text('weblinks_name_site5');
     $weblinks_name_site5->setLabel('Web site 5')->setAttrib('id', 'website5-name')->setAttrib('id', 'website2-name')->addValidators(array(array('StringLength', false, array(0, 45, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $nameTooLongText)))));
     $weblinks_url_site5 = new Zend_Form_Element_Text('weblinks_url_site5');
     $weblinks_url_site5->setAttrib('id', 'website5-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => $urlTooLongText)))));
     $weblinks_websites->setDecorators(array('ViewHelper'));
     $weblinks_name->setDecorators(array('ViewHelper'));
     $weblinks_url->setDecorators(array('ViewHelper'));
     $weblinks_name_site1->setDecorators(array('InputWebsiteNameDecorator'));
     $weblinks_url_site1->setDecorators(array('InputWebsiteUrlDecorator'));
     $weblinks_name_site2->setDecorators(array('InputWebsiteNameDecorator'));
     $weblinks_url_site2->setDecorators(array('InputWebsiteUrlDecorator'));
     $weblinks_name_site3->setDecorators(array('InputWebsiteNameDecorator'));
     $weblinks_url_site3->setDecorators(array('InputWebsiteUrlDecorator'));
     $weblinks_name_site4->setDecorators(array('InputWebsiteNameDecorator'));
     $weblinks_url_site4->setDecorators(array('InputWebsiteUrlDecorator'));
     $weblinks_name_site5->setDecorators(array('InputWebsiteNameDecorator'));
     $weblinks_url_site5->setDecorators(array('InputWebsiteUrlDecorator'));
     $save = new Zend_Form_Element_Submit('save');
     $save->setAttrib('id', 'publish')->setAttrib('class', 'submit-button')->setAttrib('style', 'float: none;');
     if ($options['mode'] == 'edit') {
         $save->setLabel('Save');
     } else {
         $save->setLabel('Create');
     }
     // Group admin can edit campaign start and end day only before campaign has started
     $date = new Zend_Date(date("Y-m-d", time()), Zend_Date::ISO_8601);
     $startdate = new Zend_Date($options['startdate'], Zend_Date::ISO_8601);
     if ($date->compare($startdate) == -1) {
         $this->addElements(array($campaignname, $campaignname_clear, $campaigningress, $campaigningress_clear, $campaigndesc, $campaigndesc_clear, $campaignstart, $campaignstart_clear, $campaignend, $campaignend_clear, $weblinks_websites, $weblinks_name, $weblinks_url, $weblinks_name_site1, $weblinks_url_site1, $weblinks_name_site2, $weblinks_url_site2, $weblinks_name_site3, $weblinks_url_site3, $weblinks_name_site4, $weblinks_url_site4, $weblinks_name_site5, $weblinks_url_site5, $save));
     } else {
         $this->addElements(array($campaignname, $campaignname_clear, $campaigningress, $campaigningress_clear, $campaigndesc, $campaigndesc_clear, $weblinks_websites, $weblinks_name, $weblinks_url, $weblinks_name_site1, $weblinks_url_site1, $weblinks_name_site2, $weblinks_url_site2, $weblinks_name_site3, $weblinks_url_site3, $weblinks_name_site4, $weblinks_url_site4, $weblinks_name_site5, $weblinks_url_site5, $save));
     }
     $save->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'id' => 'submit', 'style' => 'clear: both;'))));
 }