Example #1
0
 /**
  * Create options element
  *
  * @return Zend_Form_Element_MultiCheckbox
  */
 protected function _options()
 {
     $element = new Zend_Form_Element_MultiCheckbox('options', array('multiOptions' => array('keyRequired' => ' Key Required', 'preModerationRequired' => ' Pre-moderation', 'titleDisplayed' => ' Title Displayed', 'paginatorEnabled' => ' Page Navigation')));
     $element->addDecorators($this->_inputDecorators);
     $element->setLabel('Options');
     return $element;
 }
 public function init()
 {
     // create elements
     $userId = new Zend_Form_Element_Hidden('id');
     $mail = new Zend_Form_Element_Text('email');
     $name = new Zend_Form_Element_Text('name');
     $radio = new Zend_Form_Element_Radio('radio');
     $file = new Zend_Form_Element_File('file');
     $multi = new Zend_Form_Element_MultiCheckbox('multi');
     $captcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => 'Figlet'));
     $submit = new Zend_Form_Element_Button('submit');
     $cancel = new Zend_Form_Element_Button('cancel');
     // config elements
     $mail->setLabel('Mail:')->setAttrib('placeholder', 'data please!')->setRequired(true)->setDescription('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis fringilla purus eget ante ornare vitae iaculis est varius.')->addValidator('emailAddress');
     $name->setLabel('Name:')->setRequired(true);
     $radio->setLabel('Radio:')->setMultiOptions(array('1' => PHP_EOL . 'test1', '2' => PHP_EOL . 'test2'))->setRequired(true);
     $file->setLabel('File:')->setRequired(true)->setDescription('Check file upload');
     $multiOptions = array('view' => PHP_EOL . 'view', 'edit' => PHP_EOL . 'edit', 'comment' => PHP_EOL . 'comment');
     $multi->setLabel('Multi:')->addValidator('Alpha')->setMultiOptions($multiOptions)->setRequired(true);
     $captcha->setLabel('Captcha:')->setRequired(true)->setDescription("This is a test");
     $submit->setLabel('Save')->setAttrib('type', 'submit');
     $cancel->setLabel('Cancel');
     // add elements
     $this->addElements(array($userId, $mail, $name, $radio, $file, $captcha, $multi, $submit, $cancel));
     // add display group
     $this->addDisplayGroup(array('email', 'name', 'radio', 'multi', 'file', 'captcha', 'submit', 'cancel'), 'users');
     // set decorators
     EasyBib_Form_Decorator::setFormDecorator($this, EasyBib_Form_Decorator::BOOTSTRAP_MINIMAL, 'submit', 'cancel');
 }
 public function init()
 {
     $this->setMethod(self::METHOD_POST);
     $this->setName('fillTest');
     $questions = $this->_test->getQuestions();
     foreach ($questions as $q) {
         $options = $q->getOptions();
         if (count($options) == 0) {
             // otevrena odpoved
             $text = $this->createElement('textarea', $q->getid_otazka());
             $text->addFilter('StringTrim');
             $text->setRequired(true);
             $text->setLabel($q->getobsah());
             $text->setDecorators(array(array('ViewScript', array('viewScript' => 'TextArea.php', 'languageId' => $q->getid_jazyk()))));
             $this->addElement($text);
         } else {
             // multicheckbox
             $multicheck = new Zend_Form_Element_MultiCheckbox($q->getid_otazka());
             $multicheck->setLabel($q->getobsah());
             $multicheck->setRequired(true);
             foreach ($options as $o) {
                 $multicheck->addMultiOption($o->getid_moznost(), $o->getobsah());
             }
             $multicheck->setDecorators(array(array('ViewScript', array('viewScript' => 'MultiCheckbox.php', 'languageId' => $q->getid_jazyk()))));
             $this->addElement($multicheck);
         }
     }
     //submit button
     $button = $this->createElement('submit', 'Submit');
     $button->setAttrib('class', 'btn btn-success btn-lg dd-test');
     $this->addElement($button);
 }
Example #4
0
 public function init()
 {
     $this->setAction('/core/submit/new');
     $type = new Zend_Form_Element_MultiCheckbox('submission_type');
     $type->setLabel('')->setRequired(false)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('submission_type'))->setSeparator('<br />')->setDecorators(array('Composite'));
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Title')->setRequired(true)->addValidator('StringLength', true, array(2, 64, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer title', Zend_Validate_StringLength::TOO_LONG => 'Your title is too long')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 64 characters')->setAttrib('maxLength', 64)->setDecorators(array('Composite'));
     $audience = new Zend_Form_Element_Radio('target_audience');
     $audience->setLabel('Please mark the target audience for your presentation')->setRequired(true)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('target_audience'))->setSeparator('<br />')->setDecorators(array('Composite'));
     $publish = new Zend_Form_Element_Radio('publish_paper');
     $publish->setLabel('Please indicate whether you wish to prepare a full paper for possible publication')->setRequired(true)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('publish_paper', 'submit'))->setSeparator('<br />')->setDecorators(array('Composite'));
     $topicModel = new Core_Model_Topic();
     $topicsForSelect = $topicModel->getTopicsForSelect();
     $topicsel = new Zend_Form_Element_MultiCheckbox('topic');
     $topicsel->setLabel('Topic')->setRequired(false)->setAttrib('class', 'tiny')->setMultiOptions($topicsForSelect)->setSeparator('<br />')->setDecorators(array('Composite'));
     $keywords = new Zend_Form_Element_Text('keywords');
     $keywords->setLabel('Keywords')->setRequired(false)->addValidator('StringLength', true, array(2, 500, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide longer keywords', Zend_Validate_StringLength::TOO_LONG => 'Your keywords are too long')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 500 characters')->setDecorators(array('Composite'));
     $abstract = new Zend_Form_Element_Textarea('abstract');
     $abstract->setLabel('Submission Summary (If your submission is accepted, this will be publicly visible!)')->setAttrib('class', 'small')->setDescription('Must be between 5 and 2000 characters')->setRequired(false)->addValidator('StringLength', true, array(5, 2000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer abstract', Zend_Validate_StringLength::TOO_LONG => 'Your abstract is too long')))->setDecorators(array('Composite'));
     $comment = new Zend_Form_Element_Textarea('comment');
     $comment->setLabel('Information for Reviewers')->setAttrib('class', 'small')->setDescription('Must be between 5 and 1000 characters')->setRequired(false)->addValidator('StringLength', true, array(5, 1000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer description', Zend_Validate_StringLength::TOO_LONG => 'Your description is too long')))->setDecorators(array('Composite'));
     $file = new TA_Form_Element_MagicFile('file');
     $file->setLabel('Your submission (File must be pdf and no bigger than 10Mb) *')->setRequired(false)->addDecorators($this->_magicFileElementDecorator)->addValidators(array(array('Count', true, 1), array('Size', true, 10000000), array('Extension', true, array('pdf', 'case' => true)), array('MimeType', false, array('application/pdf'))));
     $file->getValidator('Extension')->setMessage('Only pdf files are allowed!');
     $subform = new Zend_Form_SubForm();
     $subform->setDecorators(array('FormElements'));
     $subform->addElements(array($type, $file, $title, $audience, $topicsel, $keywords, $abstract, $comment));
     $this->addSubForm($subform, 'submission');
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator));
 }
Example #5
0
 public function init()
 {
     $menu_items_model = new Admin_Model_MenuItems();
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Usergroup name')->setRequired(true)->setAttrib("class", "form-control")->setAttrib("style", "width:200px");
     $menu_items = new Zend_Form_Element_Multiselect('admin_menu_item_id');
     $menu_items->addValidator(new Zend_Validate_Digits(), true);
     $menu_items->setLabel('Menu Items: ');
     $menu_items->setAttrib("class", "select2");
     $menu_items->setAttrib("data-placeholder", "Choose...");
     $menu_items->setAttrib("style", "width:200px");
     $menu_items->addMultiOptions($menu_items_model->getForDropDown());
     $permit = new Zend_Form_Element_MultiCheckbox('permit');
     $permit->setLabel('Available resources ');
     $resources_table = new Admin_Model_Resources();
     foreach ($resources_table->getAll() as $resource) {
         $permit->addMultiOption((string) $resource->id, ' ' . $resource->name);
     }
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setLabel('Cancel');
     $cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black');
     $cancel->setAttrib("onClick", "window.location = window.location.origin+'/admin/admin-usersgroups/'");
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setAttrib('class', 'btn btn-primary');
     $submit->setLabel('Confirm');
     $this->setAction('')->setMethod('post')->addElement($name)->addElement($menu_items)->addElement($permit)->addElement($cancel)->addElement($submit);
 }
Example #6
0
 public function init()
 {
     parent::init();
     $this->setAction('/core/feedback/participant');
     $id = new Zend_Form_Element_Hidden('id');
     $id->setRequired(true)->setLabel('id')->addValidators(array('Int'))->setDecorators(array('Composite'));
     $country = new TA_Form_Element_Country('country');
     $country->setLabel('Please select the country in which you work as primary place of employment.')->setDecorators(array('Composite'));
     $orgType = new Zend_Form_Element_Select('org_type');
     $orgType->setLabel('Please select the type of organisation that most closely resembles your primary place of employment.')->setAttrib('class', 'medium')->setMultiOptions(array('0' => '---', 'nren' => 'National Research and Education Network (NREN)', 'high' => 'Higher / Further Education Institute (universities / college / polytechnic...)', 'ari' => 'Academic Research Institute', 'project' => 'Research project', 'admin' => 'Administrative departments of academic institutions', 'local' => 'Local / regional / central government department', 'cultural' => 'Cultural organisation (galeries, librairies, museums, etc.)', 'comm' => 'Commercial organisation', 'other' => 'Other non-profit (specify)'))->setDecorators(array('Composite'));
     $orgOther = new Zend_Form_Element_Text('org_type_other');
     $orgOther->setDescription('Other, please specify')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $occupation = new Zend_Form_Element_Select('occupation');
     $occupation->setLabel('Please select the title that most closely resembles your primary role in the organisation.')->setAttrib('class', 'medium')->setMultiOptions(array('0' => '---', 'director' => 'Director (responsible for overall organisational management)', 'manager' => 'Technical Manager', 'admin' => 'Administrative / Operational Manager', 'tech' => 'Technical staff / Engineer', 'res' => 'Researcher / Scientist', 'prof' => 'Professor / Teacher', 'pr' => 'Public Relations / Communications', 'bizz' => 'Business Development', 'stud' => 'Student', 'other' => 'Other (specify)'))->setDecorators(array('Composite'));
     $occOther = new Zend_Form_Element_Text('occupation_other');
     $occOther->setDescription('Other, please specify')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $interest = new Zend_Form_Element_MultiCheckbox('interest');
     $interest->setLabel('Please select your main areas of interest. Up to three selections are possible.')->setAttrib('class', 'tiny')->setMultiOptions(array('sec' => 'Network security (incident, prevention and response)', 'nom' => 'Network operations management', 'clouds' => 'Storage and clouds', 'grids' => 'Grids', 'media' => 'Media management and distribution', 'auth' => 'Authentication and Authorisation systems and federations', 'wireless' => 'Fixed & mobile wireless and roaming technologies', 'vid' => 'Video / web-based conferencing', 'reg' => 'Regulatory issues including privacy', 'pr' => 'PR / communications / business development', 'strat' => 'Strategic development: European policy setting and / or organisational management', 'other' => 'Other (specify)'))->addValidator('Callback', true, array('callback' => function ($value, $arr) {
         return count($arr['interest']) > 3 ? false : true;
     }, 'messages' => array(Zend_Validate_Callback::INVALID_VALUE => "Please don't select more than three options")))->setDecorators(array('Composite'));
     $intOther = new Zend_Form_Element_Text('interest_other');
     $intOther->setDescription('Other, please specify')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $this->addElements(array($id, $country, $orgType, $orgOther, $occupation, $occOther, $interest, $intOther));
     $this->addElement('submit', 'submit', array('decorators' => $this->_buttonElementDecorator));
 }
Example #7
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setName('ServiceForm');
     // SortNumber, int
     $sort = new Zend_Form_Element_Text('SortNumber');
     $sort->setLabel('Sort number:');
     // ServiceTitle, string
     $title = new Zend_Form_Element_Text('ServiceTitle');
     $title->setLabel('Service title:')->setRequired();
     // service categories, string (composed from MultiCheckbox)
     $vals = array();
     $categories = array();
     $_serviceCategories = new Admin_Model_ServiceCategory();
     foreach ($_serviceCategories->getAllServiceCategories() as $category) {
         $vals[] = $category->ServiceCategoryID;
         $categories[$category->ServiceCategoryID] = $category->CategoryTitle;
     }
     $serviceCategories = new Zend_Form_Element_MultiCheckbox('ServiceCategories');
     $serviceCategories->setLabel('Applicable service categories:')->setRequired()->addMultiOptions($categories)->setValue($vals);
     // ServiceText, string
     $text = new Zend_Form_Element_Textarea('ServiceText');
     $text->setLabel('Service text:')->setRequired();
     // Submit button
     $submit = new Zend_Form_Element_Submit('Submit');
     $submit->setLabel('Submit');
     $this->addElements(array($sort, $title, $serviceCategories, $text, $submit));
 }
 public function addFileIdElement()
 {
     $oFileId = new Zend_Form_Element_MultiCheckbox("file_id");
     $oFileId->setLabel("Załączniki:");
     $oFileId->setRequired(FALSE);
     $oFileId->addMultiOptions(array());
     $this->addElement($oFileId);
 }
 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);
     $oNotificationTypeId = new Zend_Form_Element_MultiCheckbox("notification_type_id");
     $oNotificationTypeId->setLabel("Typ:");
     $oNotificationTypeId->setRequired(FALSE);
     $oNotificationTypeId->addMultiOptions($this->_aAllNotificationType);
     $this->addElement($oNotificationTypeId);
     $oNotificationStatusId = new Zend_Form_Element_MultiCheckbox("notification_status_id");
     $oNotificationStatusId->setLabel("Status:");
     $oNotificationStatusId->setRequired(FALSE);
     $oNotificationStatusId->addMultiOptions($this->_aAllNotificationStatus);
     $this->addElement($oNotificationStatusId);
     $oNotificationPriorityId = new Zend_Form_Element_MultiCheckbox("notification_priority_id");
     $oNotificationPriorityId->setLabel("Priorytet:");
     $oNotificationPriorityId->setRequired(FALSE);
     $oNotificationPriorityId->addMultiOptions($this->_aAllNotificationPriority);
     $this->addElement($oNotificationPriorityId);
     $oNotificationCategoryId = new Zend_Form_Element_Select("search_notification_category_id");
     $oNotificationCategoryId->setLabel("Kategoria pytania:");
     $oNotificationCategoryId->setRequired(FALSE);
     $oNotificationCategoryId->addMultiOptions($this->_aAllNotificationCategory);
     $this->addElement($oNotificationCategoryId);
     $oUserId = new Zend_Form_Element_Select("search_notification_user_id");
     $oUserId->setLabel("Konsultant:");
     $oUserId->setRequired(FALSE);
     $oUserId->addMultiOptions($this->_aAllUser);
     $this->addElement($oUserId);
     $oInitDate = new Zend_Form_Element_Text("init_date");
     $oInitDate->setLabel("Data rozpoczęcia:");
     $oInitDate->setRequired(FALSE);
     $oInitDate->setFilters($this->_aFilters);
     $this->addElement($oInitDate);
     $oBlankNotificationUserId = new Zend_Form_Element_Checkbox("search_blank_notification_user_id");
     $oBlankNotificationUserId->setLabel("Pokaż nieprzydzielone zgłoszenia:");
     $this->addElement($oBlankNotificationUserId);
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oSubmit = $this->createElement("submit", "search_notification");
     $oSubmit->setLabel("Szukaj");
     $this->addElement($oSubmit);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/_defaultform.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
Example #10
0
 public function init()
 {
     // Add hosts autocomplete
     $this->addElement('text', 'add_show_hosts_autocomplete', array('label' => _('Search Users:'), 'class' => 'input_text ui-autocomplete-input', 'required' => false));
     $options = array();
     $hosts = Application_Model_User::getHosts();
     foreach ($hosts as $host) {
         $options[$host['index']] = $host['label'];
     }
     //Add hosts selection
     $hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
     $hosts->setLabel(_('DJs:'))->setMultiOptions($options);
     $this->addElement($hosts);
 }
Example #11
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'feedforwardinit');
     $id = new Zend_Form_Element_Hidden('id');
     $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
     $appraisal_mode = new Zend_Form_Element_Select('appraisal_mode');
     $appraisal_mode->setLabel("Appraisal");
     $appraisal_mode->setMultiOptions(array('' => 'Select Appraisal'));
     $appraisal_mode->setAttrib('class', 'selectoption');
     $appraisal_mode->setRequired(true);
     $appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal.'));
     $status = new Zend_Form_Element_Select('status');
     $status->setLabel("Status");
     $status->setAttrib('class', 'selectoption');
     $status->setMultiOptions(array('1' => 'Open'));
     //,'2' => 'Close'
     $status->setRegisterInArrayValidator(false);
     $status->setRequired(true);
     $status->addValidator('NotEmpty', false, array('messages' => 'Please select status.'));
     $employee_name_view = new Zend_Form_Element_Radio('employee_name_view');
     $employee_name_view->setLabel("Employee Details");
     $employee_name_view->addMultiOptions(array('1' => 'Show', '0' => 'Hide'));
     $employee_name_view->setSeparator('');
     $employee_name_view->setValue(0);
     $employee_name_view->setRegisterInArrayValidator(false);
     $enable_to = new Zend_Form_Element_MultiCheckbox('enable_to');
     $enable_to->setLabel("Enable To");
     $enable_to->addMultiOptions(array('0' => 'Appraisal Employees', '1' => 'All Employees'));
     $enable_to->setSeparator('');
     $enable_to->setValue(0);
     $enable_to->setRequired(true);
     $enable_to->setRegisterInArrayValidator(false);
     $enable_to->addValidator('NotEmpty', false, array('messages' => 'Please check enable to.'));
     $ff_due_date = new Zend_Form_Element_Text('ff_due_date');
     $ff_due_date->setLabel("Due Date");
     $ff_due_date->setOptions(array('class' => 'brdr_none'));
     $ff_due_date->setRequired(true);
     $ff_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.'));
     $save = new Zend_Form_Element_Submit('submit');
     $save->setAttrib('id', 'submitbutton');
     $save->setLabel('Save & Initialize');
     $save_later = new Zend_Form_Element_Submit('submit');
     $save_later->setAttrib('id', 'submitbutton1');
     $save_later->setLabel('Save & Initialize Later');
     $this->addElements(array($id, $appraisal_mode, $status, $employee_name_view, $ff_due_date, $save, $save_later, $enable_to));
     $this->setElementDecorators(array('ViewHelper'));
 }
Example #12
0
 /**
  *
  */
 public function getmodulesForm()
 {
     $this->setName('safinstancesModules');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbuttonc');
     $safinstancesSafmodules = new Zend_Form_Element_MultiCheckbox('SafinstancesSafmodules');
     $safinstancesSafmodules->setLabel('SafinstancesSafmodules');
     $options = new Safmodules();
     // AND isalwaysactive != 1
     foreach ($options->fetchAll("istechnical != 1 AND name LIKE 'admin%' ", 'label') as $k) {
         $safinstancesSafmodules->addMultiOption($k->id, $k->label);
     }
     $this->addElements(array($this->idb, $this->hashb, $safinstancesSafmodules));
     $this->addElements(array($submit));
     return $this;
 }
Example #13
0
 public function init()
 {
     $reply_to = new Zend_Form_Element_Text('reply_to');
     $reply_to->setLabel('Reply To')->setAttribs(array('style' => 'width:550px !important;'))->setRequired(true)->addValidator('NotEmpty');
     $html_signature = new Zend_Form_Element_Text('html_signature');
     $html_signature->setLabel('Html Signature')->setAttribs(array('style' => 'width:550px !important;'))->setRequired(true)->addValidator('NotEmpty');
     $primary_phone = new Zend_Form_Element_Text('primary_phone');
     $primary_phone->setLabel('Primary Phone')->setAttribs(array('style' => 'width:250px !important;'))->setRequired(true)->addValidator(new Zend_Validate_Digits(isValid("+1234567890")));
     $cell_phone = new Zend_Form_Element_Text('cell_phone');
     $cell_phone->setLabel('Cell Phone')->setAttribs(array('style' => 'width:250px !important;'))->setRequired(true)->addValidator(new Zend_Validate_Digits(isValid("+1234567890")));
     $fax = new Zend_Form_Element_Text('fax');
     $fax->setLabel('Fax')->setAttribs(array('style' => 'width:250px !important;'))->setRequired(true)->addValidator('NotEmpty');
     $company = new Zend_Form_Element_Text('company');
     $company->setLabel('Company')->setAttribs(array('style' => 'width:550px !important;'))->setRequired(true)->addValidator('NotEmpty');
     $address = new Zend_Form_Element_Text('address');
     $address->setLabel('Address')->setAttribs(array('style' => 'width:550px !important;'))->setRequired(true)->addValidator('NotEmpty');
     $address2 = new Zend_Form_Element_Text('address2');
     $address2->setLabel('Address2')->setAttribs(array('style' => 'width:550px !important;'))->setRequired(true)->addValidator('NotEmpty');
     $city = new Zend_Form_Element_Text('city');
     $city->setLabel('City')->setAttribs(array('style' => 'width:250px !important;'))->setRequired(true)->addValidator('NotEmpty');
     $state = new Zend_Form_Element_Text('state');
     $state->setLabel('State')->setAttribs(array('style' => 'width:250px !important;'))->setRequired(true)->addValidator('NotEmpty');
     $zip = new Zend_Form_Element_Text('zip');
     $zip->setLabel('Zip')->setAttribs(array('style' => 'width:150px !important;'))->setRequired(true)->addValidator(new Zend_Validate_Digits(isValid("1234567890")));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->setAttribs(array('style' => 'width:350px !important;'))->setRequired(true)->addValidator('EmailAddress', TRUE);
     $report_template_id = new Zend_Form_Element_Select('report_template_id');
     $report_template_id->setLabel('Report Template')->setRequired(true)->setMultiOptions(Jameen_ReportsTemplates::getMultiList());
     $followup_template_id = new Zend_Form_Element_Select('followup_template_id');
     $followup_template_id->setLabel('Followup Template')->setRequired(true)->setMultiOptions(Jameen_FollowupemailTemplates::getMultiList());
     $followup_enabled = new Zend_Form_Element_MultiCheckbox('followup_enabled');
     $followup_enabled->setLabel('Followup Enabled')->setRequired(true)->setAttribs(array('style' => 'width:53px !important;'))->addMultiOptions(array('checkedValue' => false));
     $sms_enabled = new Zend_Form_Element_MultiCheckbox('sms_enabled');
     $sms_enabled->setLabel('Sms Enabled')->setRequired(true)->setAttribs(array('style' => 'width:53px !important;'))->addMultiOptions(array('checkedValue' => false));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('submit');
     $this->addElements(array($reply_to, $html_signature, $primary_phone, $cell_phone, $fax, $company, $address, $address2, $city, $state, $zip, $email, $report_template_id, $followup_template_id, $followup_enabled, $sms_enabled));
     /*
     $this->setElementDecorators(array(
        	array('ViewHelper'),
     	array('Label'),
     	array('Errors', array('class'=>'error')),
     )); 
     */
     $this->setElementDecorators(array('ViewHelper', array(array('wrapperField' => 'HtmlTag'), array('tag' => 'div', 'class' => 'controls cont')), array('Label', array('placement' => 'prepend', 'class' => 'control-label'))));
     $this->setAttribs(array('action' => ''));
 }
Example #14
0
 public function init()
 {
     $this->setTitle('Message Settings')->setDescription('Specify what messaging options will be available to members in this level.');
     $this->loadDefaultDecorators();
     $this->getDecorator('Description')->setOptions(array('tag' => 'h4', 'placement' => 'PREPEND'));
     $send = new Zend_Form_Element_MultiCheckbox('send');
     $send->setLabel('Who can users send private messages to?')->setDescription("If you don't want to allow private messaging, de-select all options below.")->setMultiOptions(array('registered' => 'All Registered Members', 'network' => 'Users in the same network', 'members' => 'Friends'));
     $send->getDecorator('Description')->setOption('placement', 'PREPEND');
     $submit = new Zend_Form_Element_Button('submit', array('type' => 'submit'));
     $submit->setLabel('Edit Level')->setIgnore(true);
     $level_id = new Zend_Form_Element_Hidden('level_id');
     $level_id->addValidator('Int')->addValidator('DbRecordExists', array('table' => Engine_Api::_()->getDbtable('levels', 'authorization'), 'field' => 'level_id'));
     // Add elements
     $this->addElements(array($send, $level_id, $submit));
     // Set element type classes
     //Engine_Form::setFormElementTypeClasses($this);
 }
 public function init()
 {
     // profissional_beleza_nome
     $profissional_beleza_nome = new Zend_Form_Element_Text("profissional_beleza_nome");
     $profissional_beleza_nome->setLabel("Nome: ");
     $profissional_beleza_nome->setAttribs(array('class' => 'form-control'));
     $profissional_beleza_nome->setRequired();
     $profissional_beleza_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
     // profissional_beleza_email
     $profissional_beleza_email = new Zend_Form_Element_Text("profissional_beleza_email");
     $profissional_beleza_email->setLabel("E-mail: ");
     $profissional_beleza_email->setValidators(array('EmailAddress'));
     $profissional_beleza_email->addValidator(new App_Validate_ProfissionalBeleza());
     $profissional_beleza_email->setAttribs(array('class' => 'form-control'));
     $profissional_beleza_email->setRequired();
     $profissional_beleza_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
     /**
      * profisional_beleza_sexo
      */
     $profissional_beleza_sexo = new Zend_Form_Element_Radio("profissional_beleza_sexo");
     $profissional_beleza_sexo->setLabel("Sexo:");
     $profissional_beleza_sexo->setRequired();
     $profissional_beleza_sexo->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
     $profissional_beleza_sexo->setMultiOptions(array('M' => ' Masculino', 'F' => ' Feminino'));
     // profissional_beleza_avatar
     $profissional_beleza_avatar = new Zend_Form_Element_File("profissional_beleza_avatar");
     $profissional_beleza_avatar->setLabel(" \n            Foto: \n        ");
     $profissional_beleza_avatar->addDecorators(App_Forms_Decorators::$ElementDecoratorFile);
     $profissional_beleza_avatar->setAttribs(array('class' => 'filestyle', 'data-buttonText' => 'Selecione a foto', 'data-iconName' => 'fa fa-user'));
     $profissional_beleza_avatar->setRequired();
     $profissional_beleza_avatar->setDestination(Zend_Registry::get('config')->profissional->avatar->path);
     $profissional_beleza_avatar->addValidators(array(array('Extension', false, 'jpg,jpeg,png')));
     $profissional_beleza_avatar->addFilter(new Skoch_Filter_File_Resize(array('width' => 160, 'keepRatio' => true)));
     // especialidade_id
     $especialidade_id = new Zend_Form_Element_MultiCheckbox("especialidade_id");
     $especialidade_id->setLabel("Selecione as especialidades: ");
     $especialidade_id->setAttribs(array('class' => ''));
     $especialidade_id->setRequired();
     $especialidade_id->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
     $especialidade_id->setSeparator(' ');
     $especialidade_id->setMultiOptions($this->getEspecialidades());
     // addElements
     $this->addElements(array($profissional_beleza_nome, $profissional_beleza_email, $profissional_beleza_sexo, $profissional_beleza_avatar, $especialidade_id));
     parent::init();
 }
 /**
  * Configure user form.
  *
  * @return void
  */
 public function init()
 {
     // form config
     $this->setMethod('POST');
     $this->setAction('/test/add');
     $this->setAttrib('id', 'testForm');
     /**
      * Add class to form for label alignment
      *
      * - Vertical   .form-vertical   (not required)	Stacked, left-aligned labels over controls (default)
      * - Inline     .form-inline     Left-aligned label and inline-block controls for compact style
      * - Search     .form-search     Extra-rounded text input for a typical search aesthetic
      * - Horizontal .form-horizontal
      *
      * Use .form-horizontal to have same experience as with Bootstrap v1!
      */
     $this->setAttrib('class', 'form-horizontal');
     // create elements
     $userId = new Zend_Form_Element_Hidden('id');
     $mail = new Zend_Form_Element_Text('email');
     $name = new Zend_Form_Element_Text('name');
     $radio = new Zend_Form_Element_Radio('radio');
     $multi = new Zend_Form_Element_MultiCheckbox('multi');
     $captcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => 'Figlet'));
     $submit = new Zend_Form_Element_Button('submit');
     $cancel = new Zend_Form_Element_Button('cancel');
     // config elements
     $userId->addValidator('digits');
     $mail->setLabel('Mail:')->setRequired(true)->addValidator('emailAddress');
     $name->setLabel('Name:')->setRequired(true);
     $radio->setLabel('Radio:')->setMultiOptions(array('1' => PHP_EOL . 'test1', '2' => PHP_EOL . 'test2'))->setRequired(true);
     $multiOptions = array('view' => PHP_EOL . 'view', 'edit' => PHP_EOL . 'edit', 'comment' => PHP_EOL . 'comment');
     $multi->setLabel('Multi:')->addValidator('Alpha')->setMultiOptions($multiOptions)->setRequired(true);
     $captcha->setLabel('Captcha:')->setRequired(true)->setDescription("This is a test");
     $submit->setLabel('Save');
     $cancel->setLabel('Cancel');
     // add elements
     $this->addElements(array($userId, $mail, $name, $radio, $multi, $captcha, $submit, $cancel));
     // add display group
     $this->addDisplayGroup(array('email', 'name', 'radio', 'multi', 'captcha', 'submit', 'cancel'), 'users');
     $this->getDisplayGroup('users')->setLegend('Add User');
     // set decorators
     EasyBib_Form_Decorator::setFormDecorator($this, EasyBib_Form_Decorator::BOOTSTRAP, 'submit', 'cancel');
 }
Example #17
0
 public function init()
 {
     $this->_categoria = new Application_Model_Categoria();
     $validarTamanho = new Zend_Validate_StringLength(1, 100);
     $validarEmail = new Zend_Validate_EmailAddress();
     /*filtros*/
     $stripTags = new Zend_Filter_StripTags();
     $trim = new Zend_Filter_StringTrim();
     $customDecorateInput = new Tokem_CustomDecorator();
     $customDecorateSelectVende = new Tokem_CustomDecoratorSelectVende();
     $customDecorateSelectCategoria = new Tokem_CustomDecoratorSelectCategoria();
     $customDecorateSelectPermissao = new Tokem_CustomDecoratorSelectPermissao();
     $customDecorateButton = new Tokem_CustomDecoratorButton();
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $categoria = $this->createElement('select', 'select_categoria', array('label' => 'Categoria', 'elemName' => 'select_categoria', 'required' => true, 'class' => 'form-control'));
     // var_dump($this->_categoria->fetchAll());
     // exit;
     foreach ($this->_categoria->fetchAll() as $row) {
         $categoria->addMultiOption($row['cat_id'], $row['cat_nome']);
     }
     $categoria->setDecorators(array($customDecorateSelectCategoria));
     /*Elementos do formulario*/
     $nome = new Zend_Form_Element_Text('pro_nome');
     $nome->setLabel('Nome do Produto:')->setRequired(true)->addFilter($stripTags)->addFilter($trim)->addValidator($validarTamanho)->setDecorators(array($customDecorateInput));
     $descricao = new Zend_Form_Element_Text('pro_descricao');
     $descricao->setLabel('Descrição:')->setRequired(true)->addFilter($stripTags)->addFilter($trim)->addValidator($validarTamanho)->setDecorators(array($customDecorateInput));
     $identificador = new Zend_Form_Element_Text('pro_identificador');
     $identificador->setLabel('Identificador externo:')->setRequired(false)->addFilter($stripTags)->addFilter($trim)->addValidator($validarTamanho)->setDecorators(array($customDecorateInput));
     $valor = new Zend_Form_Element_Text('pro_valor');
     $valor->setLabel('Valor R$:')->setRequired(true)->addFilter($stripTags)->addFilter($trim)->addValidator($validarTamanho)->setDecorators(array($customDecorateInput));
     $pontuacao = new Zend_Form_Element_Text('pro_pontos');
     $pontuacao->setLabel('Pontos:')->setRequired(true)->addFilter($stripTags)->addFilter($trim)->addValidator($validarTamanho)->setDecorators(array($customDecorateInput));
     $numeros = new Zend_Form_Element_MultiCheckbox('pro_tamanhos');
     $numeros->setLabel('Numeração:')->setRequired(true)->addMultioption("33", "33")->addMultioption("34", "34")->addMultioption("35", "35")->addMultioption("36", "36")->addMultioption("37", "37")->addMultioption("38", "38")->addMultioption("39", "39")->addMultioption("40", "40")->addMultioption("41", "41")->addMultioption("42", "42")->addMultioption("43", "43")->addMultioption("44", "44")->addMultioption("45", "45")->addMultioption("Unico", "U")->addMultioption("pp", "PP")->addMultioption("p", "P")->addMultioption("m", "M")->addMultioption("g", "G")->addMultioption("gg", "GG");
     $file = new Zend_Form_Element_File('imagens');
     $file->setLabel('Imagem: Tamanho Ideal (650px x 650px)')->setValueDisabled(true)->setAttrib('class', 'input-xxlarge')->setMultiFile(1)->addValidator('Count', false, array('min' => 0, 'max' => 5))->addValidator(new Zend_Validate_File_Size('5MB'))->addValidator('Extension', false, 'jpg,png,gif')->addValidator('ImageSize', false, array('minwidth' => 80, 'maxwidth' => 3500, 'minheight' => 80, 'maxheight' => 3500));
     $submit = new Zend_Form_Element('btn_enviar', array('elemName' => 'btn_enviar', 'label' => 'Enviar Dados', 'type' => 'submit', 'required' => false, 'decorators' => array($customDecorateButton), 'setAttrib' => array('name', 'btn_enviar')));
     $this->addElements(array($identificador, $categoria, $nome, $descricao, $valor, $pontuacao, $numeros, $file, $submit));
 }
 protected function addProviderElements()
 {
     $element = new Zend_Form_Element_Hidden('providerElements');
     $element->setLabel('Cross Kaltura Specific Configuration');
     $element->setDecorators(array('ViewHelper', array('Label', array('placement' => 'append')), array('HtmlTag', array('tag' => 'b'))));
     // add elements
     $this->addElement('text', 'target_service_url', array('label' => 'Target Service URL:', 'filters' => array('StringTrim'), 'required' => true));
     $this->addElement('text', 'target_account_id', array('label' => 'Target Account ID:', 'filters' => array('StringTrim'), 'required' => true));
     $this->addElement('text', 'target_login_id', array('label' => 'Target Login ID:', 'filters' => array('StringTrim'), 'required' => true));
     $this->addElement('text', 'target_login_password', array('label' => 'Target Login Password:'******'filters' => array('StringTrim'), 'required' => true));
     $this->addElement('textarea', 'metadata_xslt', array('label' => 'Metadata XSLT:', 'filters' => array('StringTrim')));
     $this->addElement('checkbox', 'distribute_remote_flavor_asset_content', array('label' => 'Distribute Remote Flavor Asset Content Instead Of Local:'));
     $this->addElement('checkbox', 'distribute_remote_thumb_asset_content', array('label' => 'Distribute Remote Thumb Asset Content Instead Of Local:'));
     $this->addElement('checkbox', 'distribute_remote_caption_asset_content', array('label' => 'Distribute Remote Caption Asset Content Instead Of Local:'));
     $this->addElement('checkbox', 'distribute_captions', array('label' => 'Distribute Captions:'));
     $this->addElement('checkbox', 'distribute_cue_points', array('label' => 'Distribute Cue Points:'));
     // add metadata fields that trigger update
     $metadataFields = $this->getMetadataFields();
     if (count($metadataFields)) {
         $xpathsElement = new Zend_Form_Element_MultiCheckbox(self::ELEMENT_METADATA_XPATHS_THAT_TRIGGER_UPDATE);
         $xpathsElement->setLabel('Metadata Fields That Trigger Update:');
         $xpathsElement->setMultiOptions($this->getMetadataFields());
         $this->addElement($xpathsElement);
     }
     // add source to target mapping tables
     $this->addElement('textarea', self::ELEMENT_MAP_ACCESS_CONTROL_IDS, array('label' => 'Access Control Profile IDs map:', 'filters' => array('StringTrim')));
     $this->addElement('textarea', self::ELEMENT_MAP_CONVERSION_PROFILE_IDS, array('label' => 'Conversion Profile IDs map:', 'filters' => array('StringTrim')));
     $this->addElement('textarea', self::ELEMENT_MAP_METADATA_PROFILE_IDS, array('label' => 'Metadata Profile IDs map:', 'filters' => array('StringTrim')));
     $this->addElement('textarea', self::ELEMENT_MAP_STORAGE_PROFILE_IDS, array('label' => 'Storage Profile IDs map:', 'filters' => array('StringTrim')));
     $this->addElement('textarea', self::ELEMENT_MAP_FLAVOR_PARAMS_IDS, array('label' => 'Flavor Params IDs map:', 'filters' => array('StringTrim')));
     $this->addElement('textarea', self::ELEMENT_MAP_THUMB_PARAMS_IDS, array('label' => 'Thumb Params IDs map:', 'filters' => array('StringTrim')));
     $this->addElement('textarea', self::ELEMENT_MAP_CAPTION_PARAMS_IDS, array('label' => 'Caption Params IDs map:', 'filters' => array('StringTrim')));
     // add display groups
     $this->addDisplayGroup(array('target_service_url', 'target_account_id', 'target_login_id', 'target_login_password'), 'target_account', array('legend' => 'Target', 'decorators' => array('FormElements', 'Fieldset')));
     $this->addDisplayGroup(array('distribute_captions', 'distribute_cue_points', 'distribute_remote_flavor_asset_content', 'distribute_remote_thumb_asset_content', 'distribute_remote_caption_asset_content'), 'distribution_behaviour', array('legend' => 'Distribution Behaviour', 'decorators' => array('FormElements', 'Fieldset')));
     $this->addDisplayGroup(array('metadata_xslt', self::ELEMENT_METADATA_XPATHS_THAT_TRIGGER_UPDATE), 'metadata_modifications', array('legend' => 'Metadata Modifications', 'decorators' => array('FormElements', 'Fieldset')));
     $this->addDisplayGroup(array(self::ELEMENT_MAP_ACCESS_CONTROL_IDS, self::ELEMENT_MAP_CONVERSION_PROFILE_IDS, self::ELEMENT_MAP_METADATA_PROFILE_IDS, self::ELEMENT_MAP_STORAGE_PROFILE_IDS, self::ELEMENT_MAP_FLAVOR_PARAMS_IDS, self::ELEMENT_MAP_THUMB_PARAMS_IDS, self::ELEMENT_MAP_CAPTION_PARAMS_IDS), 'object_id_maps', array('legend' => 'Source/Target ID Mapping', 'decorators' => array('FormElements', 'Fieldset')));
 }
Example #19
0
 public function init()
 {
     parent::init();
     $this->setAction('/core/feedback/general');
     $id = new Zend_Form_Element_Hidden('id');
     $id->setRequired(true)->setLabel('id')->addValidators(array('Int'))->setDecorators(array('Composite'));
     $confRating = new Zend_Form_Element_Radio('rating');
     $confRating->setLabel('How would you rate the conference overall?')->setAttrib('class', 'tiny')->setMultiOptions($this->_getFieldValues('rating', 'feedback'))->setDecorators(array('Composite'));
     $partReasons = new Zend_Form_Element_MultiCheckbox('part_reasons');
     $partReasons->setLabel('Please select your top three reasons for participating in the TERENA conference')->setAttrib('class', 'tiny')->setMultiOptions(array('networking' => 'Networking opportunities (i.e. opportunities to form new professional contacts)', 'collaboration' => 'Collaboration opportunities (i.e. opportunities to work together with others on a common area of interest)', 'interesting' => 'Interesting topic/speaker that could help me in my job', 'exposure' => 'Visibility/exposure within the Research & Education Community', 'management' => 'It is encouraged by my management', 'support' => 'To support the ongoing development of the research & education community as a whole', 'other' => 'Other'))->setDecorators(array('Composite'));
     $partOther = new Zend_Form_Element_Text('why_other_spec');
     $partOther->setDescription('Other, please specify')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $confHear = new Zend_Form_Element_MultiCheckbox('conf_hear');
     $confHear->setLabel('How did you hear about the conference? (check all that apply)')->setAttrib('class', 'tiny')->setMultiOptions(array('last' => 'During the last conference', 'pp' => 'Printed promotion', 'email' => 'Email', 'col' => 'Colleagues', 'web' => 'TERENA or NREN website', 'sns' => 'Social networking site (Facebook, Linkedin, Twitter...etc)', 'other' => 'Other'))->setDecorators(array('Composite'));
     $hearOther = new Zend_Form_Element_Text('heard_other_spec');
     $hearOther->setDescription('Other, please specify')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $beenBefore = new Zend_Form_Element_Radio('been_before');
     $beenBefore->setLabel('Have you been to a TERENA conference before?')->setAttrib('class', 'tiny')->setMultiOptions(array('no' => 'No', 'yesone' => 'Yes, once', 'yestwice' => 'Yes, twice', 'yesthree' => 'Yes, three times and more'))->setDecorators(array('Composite'));
     $comeAgain = new Zend_Form_Element_Radio('come_again');
     $comeAgain->setLabel('Will you come to the TERENA conference again?')->setAttrib('class', 'tiny')->setMultiOptions(array('yes' => 'Yes, definitely', 'maybe' => 'Yes, maybe', 'un' => 'Undecided', 'probnot' => 'Probably not', 'no' => 'No'))->setDecorators(array('Composite'));
     $this->addElements(array($id, $confRating, $partReasons, $partOther, $confHear, $hearOther, $beenBefore, $comeAgain));
     $this->addElement('submit', 'submit', array('decorators' => $this->_buttonElementDecorator));
 }
Example #20
0
 public function getConfigForm($populate = false)
 {
     $form = new Stuffpress_Form();
     // Add the blog url element
     $element = $form->createElement('text', 'url', array('label' => 'Feed URL', 'decorators' => $form->elementDecorators));
     $element->setRequired(true);
     $form->addElement($element);
     // Add the blog title element
     $element = $form->createElement('text', 'title', array('label' => 'Title', 'decorators' => $form->elementDecorators));
     $element->setRequired(false);
     $form->addElement($element);
     // Add the icon path element
     $element = $form->createElement('text', 'icon', array('label' => 'Icon', 'decorators' => $form->elementDecorators));
     $element->setRequired(false);
     $form->addElement($element);
     // Options
     $options = array();
     if ($this->getPropertyDefault('hide_content')) {
         $options[] = 'hide_content';
     }
     $e = new Zend_Form_Element_MultiCheckbox('options', array('decorators' => $form->elementDecorators, 'multiOptions' => array('hide_content' => 'Hide blog post (only title will be shown)')));
     $e->setLabel('Options');
     $e->setValue($options);
     $form->addElement($e);
     // Populate
     if ($populate) {
         $options = array();
         $values = $this->getProperties();
         if ($this->getProperty('hide_content')) {
             $options[] = 'hide_content';
         }
         $values['options'] = $options;
         $form->populate($values);
     }
     return $form;
 }
Example #21
0
 public function getConfigForm($populate = false)
 {
     $form = new Stuffpress_Form();
     // Add the blog url element
     $label = $this->getServiceName() . " username";
     $element = $form->createElement('text', 'username', array('label' => $label, 'decorators' => $form->elementDecorators));
     $element->setRequired(true);
     $form->addElement($element);
     // Options
     $options = array();
     if ($this->getPropertyDefault('hide_replies')) {
         $options[] = 'hide_replies';
     }
     $e = new Zend_Form_Element_MultiCheckbox('options', array('decorators' => $form->elementDecorators, 'multiOptions' => array('hide_replies' => 'Hide @replies tweets')));
     $e->setLabel('Options');
     $e->setValue($options);
     $form->addElement($e);
     if ($populate) {
         $options = array();
         $values = $this->getProperties();
         if ($this->getProperty('hide_replies')) {
             $options[] = 'hide_replies';
         }
         $values['options'] = $options;
         $form->populate($values);
     }
     return $form;
 }
Example #22
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setName('consumer');
     $id = new Zend_Form_Element_Hidden('id');
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel($this->getView()->translate('CONTACT INFORMATION_EMAIL'))->setRequired(true)->setDescription('*')->setAttrib('readOnly', true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addErrorMessage($this->getView()->translate('Register_email_is_invalid'))->addValidator('EmailAddress');
     $email->setDecorators(array('ViewHelper', array('Description', array('color' => 'red', 'tag' => 'font')), 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'input-area')), array('Label')));
     $phone = new Zend_Form_Element_Text('phone');
     $phone->setLabel($this->getView()->translate('CONTACT INFORMATION_PHONE'))->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(0, 50))))->addErrorMessage($this->getView()->translate('Please_enter_your_phone'));
     $phone->setDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'input-area')), array('Label')));
     $login_phone = new Zend_Form_Element_Text('login_phone');
     $login_phone->setLabel($this->getView()->translate('CONTACT INFORMATION_PHONE'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('readOnly', true)->addValidators(array(array('StringLength', false, array(0, 50))))->addErrorMessage($this->getView()->translate('Please_enter_your_phone'));
     $login_phone->setDecorators(array('ViewHelper', array('Description', array('color' => 'red', 'tag' => 'font')), 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'input-area')), array('Label')));
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel($this->getView()->translate('CONTACT INFORMATION_NAME'))->setRequired(true)->setDescription('*')->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(1, 50))))->addErrorMessage($this->getView()->translate('Please_enter_your_name'));
     $name->setDecorators(array('ViewHelper', array('Description', array('color' => 'red', 'tag' => 'font')), 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'input-area')), array('Label')));
     $recipients_name = new Zend_Form_Element_Text('recipients_name');
     $recipients_name->setLabel($this->getView()->translate('CONTACT INFORMATION_RECIPIENTS_NAME'))->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(1, 30))))->addErrorMessage($this->getView()->translate('Please_enter_your_recipients_name'));
     $recipients_name->setDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'input-area')), array('Label')));
     $address1 = new Zend_Form_Element_Text('address1');
     $address1->setLabel($this->getView()->translate('CONTACT INFORMATION_ADDRESS1'))->setAttribs(array('rows' => 3, 'cols' => 80))->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(0, 240))))->addErrorMessage($this->getView()->translate('Please_enter_your_address'));
     $address1->setDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'input-area')), array('Label')));
     $postalcode = new Zend_Form_Element_Text('postalcode');
     $postalcode->setLabel($this->getView()->translate('CONTACT POSTAL_CODE'))->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(0, 30))))->addErrorMessage($this->getView()->translate('Please_enter_your_postalcode'));
     $postalcode->setDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'input-area')), array('Label')));
     $birthdate = new Zend_Form_Element_Text('birthdate');
     $birthdate->setLabel($this->getView()->translate('CONTACT BIRTHDAY'))->setAttrib('readOnly', true)->addFilter('StripTags')->addFilter('StringTrim')->addErrorMessage($this->getView()->translate('Please_enter_your_birthdate'))->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area', 'id' => 'birthdate_value')), array('Label')));
     //
     $gender = new Zend_Form_Element_Radio('gender');
     $gender->setLabel($this->getView()->translate('Consumer_gender'))->addMultiOptions(array('0' => $this->getView()->translate('Consumer_gender_Female'), '1' => $this->getView()->translate('Consumer_gender_Male')))->setSeparator('&nbsp;&nbsp;')->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area', 'id' => 'gender_value')), array('Label')));
     //
     //		$birth_year = new Zend_Form_Element_Select('birth_year');
     //		$birth_year->setLabel($this->getView()->translate('Consumer_birth_year'));
     //		$birth_year->addMultiOption('', '');
     //		$birth_year->addMultiOption('<1960', $this->getView()->translate('Consumer_birth_year_Before 1960'));
     //		for($i = 1960; $i<=1995; $i++){
     //			$birth_year->addMultiOption($i, $i);
     //		}
     //		$birth_year->addMultiOption('>1995', $this->getView()->translate('Consumer_birth_year_After 1995'));
     //
     $profession = new Zend_Form_Element_Select('profession');
     $profession->setLabel($this->getView()->translate('Consumer_profession'))->addMultiOptions(array('' => '', 'Student' => $this->getView()->translate('Consumer_profession_Student'), 'Education' => $this->getView()->translate('Consumer_profession_Education'), 'Freelancers' => $this->getView()->translate('Consumer_profession_Freelancers'), 'Housewife/Retirement' => $this->getView()->translate('Consumer_profession_Housewife/Retirement'), 'Manufacturing/Operating' => $this->getView()->translate('Consumer_profession_Manufacturing/Operating'), 'Construction' => $this->getView()->translate('Consumer_profession_Construction'), 'Art/Design' => $this->getView()->translate('Consumer_profession_Art/Design'), 'Advertising/Marketing' => $this->getView()->translate('Consumer_profession_Advertising/Marketing'), 'Finance/Banking' => $this->getView()->translate('Consumer_profession_Finance/Banking'), 'IT/Electronics Industry' => $this->getView()->translate('Consumer_profession_IT/Electronics Industry'), 'Service Industry' => $this->getView()->translate('Consumer_profession_Service Industry'), 'Financial Accounting' => $this->getView()->translate('Consumer_profession_Financial Accounting'), 'Servant/Interpreter' => $this->getView()->translate('Consumer_profession_Servant/Interpreter'), 'HR/Administration' => $this->getView()->translate('Consumer_profession_HR/Administration'), 'Medical treatment' => $this->getView()->translate('Consumer_profession_Medical treatment'), 'Consulting/Lawyer' => $this->getView()->translate('Consumer_profession_Consulting/Lawyer'), 'Marketing' => $this->getView()->translate('Consumer_profession_Marketing'), 'Purchasing/Distributing' => $this->getView()->translate('Consumer_profession_Purchasing/Distributing'), 'Biology/Pharmacy' => $this->getView()->translate('Consumer_profession_Biology/Pharmacy'), 'Supporting' => $this->getView()->translate('Consumer_profession_Supporting'), 'Other' => $this->getView()->translate('Consumer_profession_Other')))->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area', 'id' => 'profession_value')), array('Label')));
     //
     $education = new Zend_Form_Element_Select('education');
     $education->setLabel($this->getView()->translate('Consumer_education'))->addMultiOptions(array('' => '', 'High-School' => $this->getView()->translate('Consumer_education_High-School'), 'Junior college' => $this->getView()->translate('Consumer_education_Junior_college'), 'Bachelor' => $this->getView()->translate('Consumer_education_Bachelor'), 'Master' => $this->getView()->translate('Consumer_education_Master'), 'Doctorate' => $this->getView()->translate('Consumer_education_Doctorate'), 'Other' => $this->getView()->translate('Consumer_education_Other')))->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area', 'id' => 'education_value')), array('Label')));
     //
     $have_children = new Zend_Form_Element_Radio('have_children');
     $have_children->setLabel($this->getView()->translate('Consumer_have_children'))->addMultiOptions(array('0' => $this->getView()->translate('No'), '1' => $this->getView()->translate('Yes')))->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area', 'id' => 'have_children_value')), array('Label')));
     $have_children->setSeparator('&nbsp;');
     //
     $children_birth_year = new Zend_Form_Element_Select('children_birth_year');
     $children_birth_year->setLabel($this->getView()->translate('Consumer_children_birth_year'));
     $children_birth_year->addMultiOption('', '');
     $children_birth_year->addMultiOption('<1980', $this->getView()->translate('Consumer_children_birth_year_Before 1980'));
     for ($i = 1980; $i <= 2010; $i++) {
         $children_birth_year->addMultiOption($i, $i);
     }
     $children_birth_year->addMultiOption('>2010', $this->getView()->translate('Consumer_children_birth_year_After 2010'))->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area', 'id' => 'children_birth_year_value')), array('Label')));
     //
     $income = new Zend_Form_Element_Select('income');
     $income->setLabel($this->getView()->translate('Consumer_income_level_per_month'));
     $income->addMultiOption('', '');
     for ($i = 0; $i < 20000; $i = $i + 2000) {
         $income->addMultiOption($i . "-" . ($i + 2000), $i . "-" . ($i + 2000));
     }
     $income->addMultiOption('>20000', '>20000')->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area', 'id' => 'income_value')), array('Label')));
     //
     $online_shopping = new Zend_Form_Element_Radio('online_shopping');
     $online_shopping->setLabel($this->getView()->translate('Consumer_do_your_often_go_shopping_online'))->addMultiOptions(array('Once a week or more' => $this->getView()->translate('Consumer_do_your_often_go_shopping_online_Once a week or more'), 'Once a month or more' => $this->getView()->translate('Consumer_do_your_often_go_shopping_online_Once a month or more'), 'Less then once a month' => $this->getView()->translate('Consumer_do_your_often_go_shopping_online_Less then once a month'), 'Never' => $this->getView()->translate('Consumer_do_your_often_go_shopping_online_Never')))->setSeparator('')->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area', 'id' => 'onlineShopping_value')), array('Label')));
     //
     $use_extra_bonus_for = new Zend_Form_Element_MultiCheckbox('use_extra_bonus_for');
     $use_extra_bonus_for->setLabel($this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for'))->addMultiOptions(array('Traveling' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Traveling'), 'House ware' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_House ware'), 'Further education' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Further education'), 'Clothes and shoes' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Clothes and shoes'), 'Electronic products' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Electronic products'), 'Good food' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Good food'), 'Luxury' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Luxury'), 'Skin care products' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Skin care products'), 'Gym and yoga' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Gym and yoga'), 'Party' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_High-level party'), 'Investment and stock' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Investment and stock')))->setSeparator('');
     $use_extra_bonus_for->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area multi-lines form-multi-options', 'id' => 'bonus_value')), array('Label')));
     //
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel($this->getView()->translate('CONTACT INFORMATION_EDIT'))->setAttrib('id', 'edit');
     $this->addElements(array($id, $email, $login_phone, $name, $recipients_name, $phone, $address1, $postalcode, $birthdate, $gender, $profession, $education, $have_children, $children_birth_year, $income, $online_shopping, $use_extra_bonus_for, $submit));
 }
Example #23
0
 private function getForm($sources)
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setMethod('post');
     $form->setAction('admin/story/submit');
     $form->setName('formCreateStory');
     // Title
     $e = $form->createElement('text', 'title', array('size' => 25, 'label' => 'Title', 'decorators' => array('ViewHelper', 'Errors'), 'maxlength' => 35));
     $e->setRequired(true);
     $e->addValidator('stringLength', false, array(0, 40));
     $e->addFilter('StripTags');
     $form->addElement($e);
     // Subtitle
     $e = $form->createElement('text', 'subtitle', array('size' => 25, 'label' => 'Subtitle', 'decorators' => array('ViewHelper', 'Errors'), 'maxlength' => 35));
     $e->setRequired(false);
     $e->addValidator('stringLength', false, array(0, 40));
     $e->addFilter('StripTags');
     $form->addElement($e);
     // From
     // TODO Validate the date
     $e = $form->createElement('text', 'date_from', array('size' => 25, 'readonly' => 'readonly', 'label' => 'From', 'decorators' => array('ViewHelper', 'Errors')));
     $e->setRequired(true);
     $form->addElement($e);
     // To
     // TODO Validate the date
     $e = $form->createElement('text', 'date_to', array('size' => 25, 'label' => 'To', 'readonly' => 'readonly', 'decorators' => array('ViewHelper', 'Errors')));
     $e->setRequired(true);
     $form->addElement($e);
     // Sources
     $e = new Zend_Form_Element_MultiCheckbox('sources', array('decorators' => array('ViewHelper', 'Errors'), 'multiOptions' => $sources, 'class' => 'checkbox'));
     $e->setLabel('Sources');
     $form->addElement($e);
     // Save button
     $e = $form->createElement('submit', 'post', array('label' => 'Create', 'decorators' => $form->buttonDecorators));
     $form->addElement($e);
     return $form;
 }
Example #24
0
 public function __construct($options = null)
 {
     Zend_Dojo::enableForm($this);
     parent::__construct();
     $cust = new settings_Model_Customization();
     $sample = $cust->fetchcustomized();
     foreach ($sample as $cust1) {
         switch ($cust1['feild_type']) {
             case "text":
                 $Instance = new Zend_Form_Element_Text($cust1['feild_name']);
                 $Instance->setLabel($cust1['display_name']);
                 $Instance->setAttrib('size', '8');
                 if ($cust1['feild_name']) {
                     $Instance->setRequired(true)->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td', 'requiredSuffix' => ' *')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
                 }
                 break;
             case "radio":
                 $Instance = new Zend_Form_Element_Radio($cust1['feild_name']);
                 $Instance->setLabel($cust1['display_name']);
                 $appliesTo = $cust->getTableInfo($cust1['table_name']);
                 foreach ($appliesTo as $appliesTo1) {
                     foreach ($appliesTo as $key => $value) {
                         $i = 1;
                         foreach ($value as $key1 => $value1) {
                             if ($i % 2 == 0) {
                                 //faltu start
                                 $f2 = $appliesTo1[$key1];
                             } else {
                                 $f1 = $appliesTo1[$key1];
                             }
                             $Instance->addMultiOption($f1, $f2);
                             $i++;
                         }
                         //faltu end
                     }
                 }
                 if ($cust1['feild_name']) {
                     $Instance->setRequired(true)->addValidators(array(array('NotEmpty')))->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td', 'requiredSuffix' => ' *')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
                 }
                 break;
             case "select":
                 $Instance = new Zend_Form_Element_Select($cust1['feild_name']);
                 $Instance->setLabel($cust1['display_name']);
                 $appliesTo = $cust->getTableInfo($cust1['table_name']);
                 foreach ($appliesTo as $appliesTo1) {
                     foreach ($appliesTo as $key => $value) {
                         $i = 1;
                         foreach ($value as $key1 => $value1) {
                             if ($i % 2 == 0) {
                                 //faltu start
                                 $f2 = $appliesTo1[$key1];
                             } else {
                                 $f1 = $appliesTo1[$key1];
                             }
                             $Instance->addMultiOption($f1, $f2);
                             $i++;
                         }
                         //faltu end
                     }
                 }
                 if ($cust1['feild_name']) {
                     $Instance->setRequired(true)->addValidators(array(array('NotEmpty')))->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td', 'requiredSuffix' => ' *')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
                 }
                 break;
             case "description":
                 $Instance = new Zend_Form_Element_Textarea($cust1['feild_name'], array('rows' => 3, 'cols' => 20));
                 $Instance->setLabel($cust1['display_name']);
                 if ($cust1['feild_name']) {
                     $Instance->setRequired(true)->addValidators(array(array('NotEmpty')))->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td', 'requiredSuffix' => ' *')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
                 }
                 break;
             case "checkbox":
                 $Instance = new Zend_Form_Element_MultiCheckbox($cust1['feild_name']);
                 $Instance->setLabel($cust1['display_name']);
                 $appliesTo = $cust->getTableInfo($cust1['table_name']);
                 foreach ($appliesTo as $appliesTo1) {
                     foreach ($appliesTo as $key => $value) {
                         $i = 1;
                         foreach ($value as $key1 => $value1) {
                             if ($i % 2 == 0) {
                                 //faltu starta
                                 $f2 = $appliesTo1[$key1];
                             } else {
                                 $f1 = $appliesTo1[$key1];
                             }
                             $Instance->addMultiOption($f1, $f2);
                             $i++;
                         }
                         //faltu end
                     }
                 }
                 if ($cust1['feild_name']) {
                     $Instance->setRequired(true)->addValidators(array(array('NotEmpty')))->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td', 'requiredSuffix' => ' *')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
                 }
                 break;
         }
         $this->addElements(array($Instance));
     }
 }
Example #25
0
 public function getConfigForm($populate = false)
 {
     $form = new Stuffpress_Form();
     $element = $form->createElement('text', 'username', array('label' => 'Username', 'decorators' => $form->elementDecorators));
     $element->setRequired(true);
     $form->addElement($element);
     $element = $form->createElement('text', 'userid', array('label' => 'User ID', 'decorators' => $form->elementDecorators));
     $element->setRequired(true);
     $form->addElement($element);
     $options = array();
     if ($this->getPropertyDefault('hide_content')) {
         $options[] = 'hide_content';
     }
     $e = new Zend_Form_Element_MultiCheckbox('options', array('decorators' => $form->elementDecorators, 'multiOptions' => array('hide_content' => 'Hide Scribd description (only title will be shown)')));
     $e->setLabel('Options');
     $e->setValue($options);
     $form->addElement($e);
     if ($populate) {
         $options = array();
         $values = $this->getProperties();
         if ($this->getProperty('hide_content')) {
             $options[] = 'hide_content';
         }
         $values['options'] = $options;
         $form->populate($values);
     }
     return $form;
 }
 private function getFormSettings()
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setMethod('post');
     $form->setName('formSettings');
     // Timezone setting
     $e = $form->createElement('select', 'timezoneid', array('label' => 'Timezone', 'class' => 'width1', 'decorators' => array('ViewHelper', 'Errors'), 'registerInArrayValidator' => false));
     $form->addElement($e);
     // Notifications
     $e = new Zend_Form_Element_MultiCheckbox('alerts', array('decorators' => array('ViewHelper', 'Errors'), 'multiOptions' => array('on_comment' => 'When someone comments on my items', 'on_news' => 'When storytlr releases cool new features')));
     $e->setLabel('Notifications');
     $form->addElement($e);
     // Privacy
     $e = new Zend_Form_Element_MultiCheckbox('privacy', array('decorators' => array('ViewHelper', 'Errors'), 'multiOptions' => array('is_private' => 'Make my lifestream private')));
     $e->setLabel('Privacy');
     $form->addElement($e);
     // Save button
     $e = $form->createElement('button', 'save', array('label' => 'Save', 'onclick' => "submitFormSettings();", 'decorators' => $form->buttonDecorators));
     $form->addElement($e);
     return $form;
 }
Example #27
0
 public function agregarPregunta(Zend_Form $contenedor, Encuesta_Model_Pregunta $pregunta)
 {
     $ePregunta = null;
     if ($pregunta->getTipo() == "AB") {
         $ePregunta = new Zend_Form_Element_Text($pregunta->getIdPregunta());
         $ePregunta->setAttrib("class", "form-control");
     } else {
         //Obtenemos las Opciones
         $opciones = $this->opcionDAO->obtenerOpcionesPregunta($pregunta->getIdPregunta());
         if ($pregunta->getTipo() == "SS") {
             $ePregunta = new Zend_Form_Element_Radio($pregunta->getIdPregunta());
         } elseif ($pregunta->getTipo() == "MS") {
             $ePregunta = new Zend_Form_Element_MultiCheckbox($pregunta->getIdPregunta());
         }
         foreach ($opciones as $opcion) {
             $ePregunta->addMultiOption($opcion->getIdOpcion(), $opcion->getOpcion())->setSeparator("");
         }
     }
     $ePregunta->setLabel($pregunta->getPregunta());
     //$ePregunta->setAttrib("class", "form-control");
     $ePregunta->setDecorators($this->decoratorsPregunta);
     $contenedor->addElement($ePregunta);
     return $contenedor;
 }
Example #28
0
    public function __construct($options = null)
    {
        $countries = new Countries();
        $countries_options = $countries->getOptions();
        $counties = new Counties();
        $counties_options = $counties->getCountyname2();
        parent::__construct($options);
        $decorators = array(array('ViewHelper'), array('Description', array('tag' => '', 'placement' => 'append')), array('Errors', array('placement' => 'append', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *')), array('HtmlTag', array('tag' => 'li')));
        $this->setName('request');
        $email = new Zend_Form_Element_Text('email');
        $email->setLabel('Enter your email address: ')->setDecorators($decorators)->addValidator('EmailAddress', false, array('allow' => Zend_Validate_Hostname::ALLOW_DNS, 'mx' => true, 'deep' => true))->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
        $title = new Zend_Form_Element_Select('title');
        $title->setLabel('Title: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setValue('Mr')->addErrorMessage('Choose title of person')->addMultiOptions(array('Mr' => 'Mr', 'Mrs' => 'Mrs', 'Miss' => 'Miss', 'Ms' => 'Ms', 'Dr' => 'Dr.', 'Prof' => 'Prof.', 'Sir' => 'Sir', 'Lady' => 'Lady', 'Other' => 'Other', 'Captain' => 'Captain', 'Master' => 'Master', 'Dame' => 'Dame', 'Duke' => 'Duke', 'Baron' => 'Baron', 'Duchess' => 'Duchess'))->setDecorators($decorators);
        $fullname = new Zend_Form_Element_Text('fullname');
        $fullname->setLabel('Enter your name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 50)->addErrorMessage('Please enter a valid name!')->setDecorators($decorators);
        $address = new Zend_Form_Element_Text('address');
        $address->SetLabel('Address: ')->setRequired(true)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
        $town_city = new Zend_Form_Element_Text('town_city');
        $town_city->SetLabel('Town: ')->setRequired(true)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators);
        $postcode = new Zend_Form_Element_Text('postcode');
        $postcode->SetLabel('Postcode: ')->setRequired(true)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addValidator('ValidPostCode')->setDecorators($decorators);
        $county = new Zend_Form_Element_Select('county');
        $county->setLabel('County: ')->addValidators(array('NotEmpty'))->addMultiOptions(array(NULL => NULL, 'Choose county' => $counties_options))->addValidator('InArray', false, array(array_keys($counties_options)))->setDecorators($decorators);
        $country = new Zend_Form_Element_Select('country');
        $country->SetLabel('Country: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('InArray', false, array(array_keys($countries_options)))->addMultiOptions(array(NULL => 'Please choose a country of residence', 'Valid countries' => $countries_options))->setValue('GB')->setDecorators($decorators);
        $tel = new Zend_Form_Element_Text('tel');
        $tel->SetLabel('Contact number: ')->setRequired(false)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
        $leaflets = new Zend_Form_Element_MultiCheckbox('leaflets');
        $leaflets->setLabel('Scheme leaflets: ')->addMultiOptions(array('Advice for finders' => 'Advice for finders', 'Treasure Act' => 'Treasure Act'))->setOptions(array('separator' => ''))->setDecorators($decorators);
        $message = new Pas_Form_Element_RawText('message');
        $message->setValue('<p>Some of our literature is now rather bulky, and therefore we have to 
	charge postage or arrange collection from your local FLO. Please tick what you would like and
	we will contact you about delivery if needed.</p>')->setAttrib('class', 'info');
        $reports = new Zend_Form_Element_MultiCheckbox('reports');
        $reports->setLabel('Annual Reports: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array('Report 2000' => 'Annual report 2000 - 2001', 'Annual report 2001/3' => 'Annual report 2001 - 2003', 'Report 2003/4' => 'Annual report 2003 - 2004', 'Annual report 2004/5' => 'Annual report 2004 - 2005', 'AR 2005/6' => 'Annual Report 2005 -2006'))->setOptions(array('separator' => ''))->setDecorators($decorators);
        $treasure = new Zend_Form_Element_MultiCheckbox('treasure');
        $treasure->setLabel('Treasure Reports: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array('T Report 2000' => 'Report 2000', 'T Report 2001' => 'Report 2001', 'T Report 2002' => 'Report 2002', 'T report 2003' => 'Report 2003'))->setOptions(array('separator' => ''))->setDecorators($decorators);
        $combined = new Zend_Form_Element_MultiCheckbox('combined');
        $combined->setLabel('Combined Treasure & PAS Reports: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array('Report 2007' => 'Annual report 2007'))->setOptions(array('separator' => ''))->setDecorators($decorators);
        $codes = new Zend_Form_Element_MultiCheckbox('codes');
        $codes->setLabel('Codes of practice: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array('Responsible metal detecting' => 'Responsible Metal Detecting', 'Treasure CofP' => 'Treasure Code of Practice'))->setOptions(array('separator' => ''))->setDecorators($decorators);
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'submitbutton')->removeDecorator('label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setAttrib('class', 'large')->setLabel('Submit your request');
        $auth = Zend_Auth::getInstance();
        if (!$auth->hasIdentity()) {
            $privateKey = $this->_config->webservice->recaptcha->privatekey;
            $pubKey = $this->_config->webservice->recaptcha->pubkey;
            $captcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => 'ReCaptcha', 'label' => 'Prove you are not a robot', 'captchaOptions' => array('captcha' => 'ReCaptcha', 'privKey' => $privateKey, 'pubKey' => $pubKey, 'theme' => 'clean')));
            $this->addElements(array($title, $fullname, $address, $town_city, $county, $postcode, $country, $tel, $email, $message, $leaflets, $reports, $combined, $treasure, $codes, $captcha, $submit));
            $this->addDisplayGroup(array('title', 'fullname', 'email', 'address', 'town_city', 'county', 'postcode', 'country', 'tel', 'message', 'leaflets', 'reports', 'combined', 'treasure', 'codes', 'captcha'), 'details')->removeDecorator('HtmlTag');
            $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
            $this->details->removeDecorator('DtDdWrapper');
            $this->details->removeDecorator('HtmlTag');
            $this->details->setLegend('Enter your comments: ');
        } else {
            $this->addElements(array($title, $fullname, $address, $town_city, $county, $postcode, $country, $tel, $message, $email, $leaflets, $reports, $combined, $treasure, $codes, $submit));
            $this->addDisplayGroup(array('title', 'fullname', 'email', 'address', 'town_city', 'county', 'postcode', 'country', 'tel', 'message', 'leaflets', 'reports', 'combined', 'treasure', 'codes'), 'details')->removeDecorator('HtmlTag');
            $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
            $this->details->removeDecorator('DtDdWrapper');
            $this->details->setLegend('Enter your comments: ');
        }
        $this->addDisplayGroup(array('submit'), 'submit');
        $this->submit->removeDecorator('DtDdWrapper');
        $this->submit->removeDecorator('HtmlTag');
    }
Example #29
0
 /**
  * Defines and build an input field which is not a text field.
  * According to the parameter elem, it will set the element.
  *
  * $params['exclude']   => boolean; The column will not be built.<br />
  * $params['required '] => boolean;<br />
  * $params['elem']      => select, checkbox, radio, editor;<br />
  *                         If $params['elem'] = select, then the $params['src']<br />
  *                         parameter must be defined.
  * $params['src']       => string; name of the source for the element.<br />
  *
  * @param array $meta
  * @param array $params
  *
  * @return void
  */
 public function setElementInput(array $meta, array $params)
 {
     if (!empty($params)) {
         if (!isset($params['elem'])) {
             $params['elem'] = '';
         }
         $fieldId = $meta['COLUMN_NAME'];
         switch ($params['elem']) {
             case 'select':
                 if (empty($params['src'])) {
                     throw new Exception('Trying to build an element but no data source given');
                 }
                 $this->_defineSrc($params, $meta);
                 $element = new Zend_Form_Element_Select($fieldId);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId))->setAttrib('class', 'largeSelect')->addMultiOptions($this->_srcData);
                 $element = $this->_setBasicDecorator($element);
                 break;
             case 'checkbox':
                 $element = new Zend_Form_Element_Checkbox($fieldId);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId));
                 $this->_decoParams['class'] .= 'label_after_checkbox';
                 $this->_decoParams['labelPos'] = 'append';
                 $element = $this->_setBasicDecorator($element);
                 break;
             case 'radio':
                 $this->_defineSrc($params, $meta);
                 $element = new Zend_Form_Element_Radio($fieldId);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId));
                 $element->setSeparator('')->addMultiOptions($this->_srcData);
                 $this->_decoParams['class'] .= 'radio radioInline';
                 $element = $this->_setBasicDecorator($element);
                 break;
             case 'hidden':
                 $element = new Zend_Form_Element_Hidden($fieldId);
                 $element->removeDecorator('Label');
                 $element->removeDecorator('DtDdWrapper');
                 break;
             case 'multiCheckbox':
                 if (empty($params['src'])) {
                     throw new Exception('Trying to build an element but no data source given');
                 }
                 $this->_defineSrc($params, $meta);
                 $element = new Zend_Form_Element_MultiCheckbox($fieldId);
                 $element->addMultiOptions($this->_srcData);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId));
                 $element->setAttrib('class', 'multicheckbox');
                 $element->setSeparator(' ');
                 $element = $this->_setBasicDecorator($element);
                 break;
             case 'multiSelect':
                 break;
             default:
                 $element = new Zend_Form_Element_Text($fieldId);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId))->addFilter('StringTrim')->setAttrib('class', 'smallTextInput');
                 $element = $this->_setBasicDecorator($element);
                 break;
         }
         if (!empty($params['disabled'])) {
             $element->setAttrib('disabled', (bool) $params['disabled']);
         }
         $this->addElement($element);
     }
 }
Example #30
0
 protected function buildAutoForm()
 {
     //
     global $gANNOTATION_KEYS;
     extract($gANNOTATION_KEYS);
     if ($this->recurseSubEntities) {
         $this->addSaveButton('upper_submit');
     }
     foreach ($this->entityColumns as $propertyName => $def) {
         if (!isset($def['annotations'][$annoKeyAwe])) {
             continue;
         }
         $elementType = false;
         $element = false;
         // annotation keys
         $anno = $def['annotations'];
         // determine element type
         if (isset($anno[$annoKeyId])) {
             $elementType = 'hidden_primary_key';
         } else {
             if (isset($anno[$annoKeyM21])) {
                 $elementType = $this->recurseSubEntities ? 'foreign_dropdown' : 'hidden_foreign_key';
             } else {
                 if (isset($anno[$annoKey12m]) && $this->recurseSubEntities && $anno[$annoKeyAwe]->editInline && $this->repopData && !$this->isRestful) {
                     $elementType = 'foreign_editInline';
                 } else {
                     if (isset($anno[$annoKeyM2m])) {
                         $elementType = 'foreign_multi_checkbox';
                     } else {
                         if (isset($anno[$annoKeyCol])) {
                             $elementType = 'entity';
                         }
                     }
                 }
             }
         }
         // Render that type of element
         switch ($elementType) {
             case 'hidden_primary_key':
                 //
                 $element = new Zend_Form_Element_Hidden('id');
                 $element->setDecorators(array('ViewHelper'));
                 if ($this->repopData) {
                     $element->setValue($this->repopData->id);
                 }
                 break;
             case 'hidden_foreign_key':
                 //
                 $elementName = isset($anno[$annoKeyJoinColumn]->name) ? $anno[$annoKeyJoinColumn]->name : $propertyName . '_id';
                 $element = new Zend_Form_Element_Hidden($elementName);
                 $element->setDecorators(array('ViewHelper'));
                 $element->setValue($this->repopData->{$propertyName}->id);
                 break;
             case 'entity':
                 //
                 // setup properties
                 // use a label param if set,
                 // otherwise use the @Column annotation's name property
                 // replace underscores with spaces and capitalize each word
                 // otherwise default to the property name of the object
                 $label = $anno[$annoKeyAwe]->label ? $anno[$annoKeyAwe]->label : ucwords(str_replace('_', ' ', preg_replace('[^a-zA-Z0-9_]', '', isset($anno[$annoKeyCol]) && $anno[$annoKeyCol]->name ? $anno[$annoKeyCol]->name : $propertyName)));
                 $type = $anno[$annoKeyAwe]->type ? $anno[$annoKeyAwe]->type : $this->getDefaultElementType($anno[$annoKeyCol]->type);
                 $colType = $anno[$annoKeyCol]->type;
                 $params = isset($anno[$annoKeyAwe]->params) ? $anno[$annoKeyAwe]->params : array();
                 $validators = count((array) $anno[$annoKeyAwe]->validators) ? (array) $anno[$annoKeyAwe]->validators : $this->getDefaultElementValidators($anno[$annoKeyCol]);
                 // build element
                 $element = new $type($propertyName, $params);
                 $element->setLabel($label);
                 $validatorList = array();
                 foreach ($validators as $v => $args) {
                     $validatorList[] = new $v((array) $args);
                 }
                 $element->setValidators($validatorList);
                 // repopulate data
                 if ($this->repopData) {
                     if ($colType == 'datetime' || $colType == 'date') {
                         $value = $this->repopData->{$propertyName}->format('Y-m-d');
                     } else {
                         $value = $this->repopData->{$propertyName};
                     }
                     $element->setValue($value);
                 }
                 break;
             case 'foreign_dropdown':
                 //
                 // setup properties
                 $label = $anno[$annoKeyAwe]->label ? $anno[$annoKeyAwe]->label : ucwords(str_replace('_', ' ', preg_replace('[^a-zA-Z0-9_]', '', isset($anno[$annoKeyCol]) && $anno[$annoKeyCol]->name ? $anno[$annoKeyCol]->name : $propertyName)));
                 $targetEntity = $anno[$annoKeyM21]->targetEntity;
                 $displayColumn = $anno[$annoKeyAwe]->displayColumn;
                 $join_column = $anno[$annoKeyJoinColumn]->name;
                 // get related entities
                 $dql = "select e from {$targetEntity} e";
                 $foreignEntities = $this->_doctrine->createQuery($dql)->getResult();
                 $dropdowns = array();
                 $dropdowns[''] = '';
                 foreach ($foreignEntities as $id => $f) {
                     $dropdowns[$f->id] = $f->{$displayColumn};
                 }
                 // build element
                 $element = new Zend_Form_Element_Select($join_column);
                 $element->setMultiOptions($dropdowns);
                 $element->setLabel($label);
                 // repopulate data
                 if ($this->repopData && $this->repopData->{$propertyName}) {
                     $element->setValue($this->repopData->{$propertyName}->id);
                 }
                 break;
             case 'foreign_multi_checkbox':
                 //
                 // setup properties
                 $label = $anno[$annoKeyAwe]->label ? $anno[$annoKeyAwe]->label : ucwords(str_replace('_', ' ', preg_replace('[^a-zA-Z0-9_]', '', isset($anno[$annoKeyCol]) && $anno[$annoKeyCol]->name ? $anno[$annoKeyCol]->name : $propertyName)));
                 $targetEntity = $anno[$annoKeyM2m]->targetEntity;
                 $displayColumn = $anno[$annoKeyAwe]->displayColumn;
                 $inverseColumn = $anno[$annoKeyJoinTable]->inverseJoinColumns[0]->name;
                 $targetId = str_replace('\\', '_', $targetEntity);
                 $attribute = str_replace('_id', '', "{$inverseColumn}s");
                 // get related entities
                 $dql = "select e from {$targetEntity} e";
                 $foreignEntities = $this->_doctrine->createQuery($dql)->getResult();
                 $foreignColumns = $this->getEntityColumnDefs($targetEntity);
                 $options = array();
                 if (count($foreignEntities)) {
                     foreach ($foreignEntities as $fe) {
                         $options[$fe->id] = $fe->{$displayColumn};
                     }
                 }
                 // build element
                 $element = new Zend_Form_Element_MultiCheckbox("{$inverseColumn}s");
                 $element->setMultiOptions($options);
                 $element->setLabel($label);
                 // repopulate data
                 $values = array();
                 foreach ($this->repopData->{$attribute} as $subEntity) {
                     $values[] = $subEntity->id;
                 }
                 $element->setValue($values);
                 break;
             case 'foreign_editInline':
                 //
                 // setup properties
                 $label = $anno[$annoKeyAwe]->label ? $anno[$annoKeyAwe]->label : ucwords(str_replace('_', ' ', preg_replace('[^a-zA-Z0-9_]', '', isset($anno[$annoKeyCol]) && $anno[$annoKeyCol]->name ? $anno[$annoKeyCol]->name : $propertyName)));
                 $targetEntity = $anno[$annoKey12m]->targetEntity;
                 $editInline = $anno[$annoKeyAwe]->editInline;
                 $targetId = str_replace('\\', '_', $targetEntity);
                 $subformName = "{$targetId}_subform";
                 // get sub entities
                 $sub_entities = $this->repopData->{$propertyName};
                 $subEntityColumns = $this->getEntityColumnDefs($targetEntity);
                 // build sub forms
                 $subform = new Zend_Form_SubForm();
                 $subform->setLegend($label);
                 $recurse = false;
                 $parent = $this->repopData;
                 $x = 0;
                 foreach ($sub_entities as $subEntity) {
                     $autoCrudForm = new Awe_Form_AutoMagic($subformName, $subEntityColumns, $subEntity, $recurse, $parent);
                     $subform->addSubform($autoCrudForm, $x++);
                 }
                 $this->addSubform($subform, $targetId);
                 break;
         }
         if ($element) {
             $this->getAutoSubform('entity')->addElement($element);
         }
     }
     if ($this->recurseSubEntities) {
         $this->addSaveButton('lower_submit');
     }
 }