public function __construct($options = null) { $this->_disabledDefaultActions = true; $this->_addRequiredAsterisks = false; parent::__construct($options); $baseDir = $this->getView()->baseUrl(); $this->getView()->headLink()->appendStylesheet("{$this->getView()->baseUrl()}/themes/default/css/login.css", 'all'); $this->setAttrib('class', 'login'); $regexValidate = new Cible_Validate_Email(); $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch'); $email = new Zend_Form_Element_Text('email'); $email->setLabel($this->getView()->getClientText('login_form_email_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setAttrib('class', 'loginTextInput'); $this->addElement($email); $password = new Zend_Form_Element_Password('password'); $password->setLabel($this->getView()->getClientText('login_form_password_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'loginTextInput')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field')))); $this->addElement($password); // checkbox for client persistance $status = new Zend_Form_Element_Checkbox('stayOn'); $status->setLabel($this->getView()->getClientText('login_form_stayOn_label')); $status->setValue(1); $status->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd')))); $this->addElement($status); // Submit button $submit = new Zend_Form_Element_Submit('submit_login'); $submit->setLabel('')->setAttrib('class', 'subscribeButton-' . Zend_Registry::get("languageSuffix")); $submit->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd')))); $this->addElement($submit); $this->setAttrib('class', 'login-form'); }
/** * * Change notifications form * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/Notifications.phtml')))); // fields $ProfilesMeta = new Application_Model_ProfilesMeta(); $notifications_meta = json_decode($ProfilesMeta->getMetaValue('bulk_notifications'), true); $n1 = new Zend_Form_Element_Checkbox('notification_email_1'); $n1->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($notifications_meta['notification_email_1']) && $notifications_meta['notification_email_1'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Email when someone posts a new comment'))->setCheckedValue("1")->setUncheckedValue("0"); $n2 = new Zend_Form_Element_Checkbox('notification_email_2'); $n2->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($notifications_meta['notification_email_2']) && $notifications_meta['notification_email_2'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Email when someone likes your post'))->setCheckedValue("1")->setUncheckedValue("0"); $n3 = new Zend_Form_Element_Checkbox('notification_email_3'); $n3->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($notifications_meta['notification_email_3']) && $notifications_meta['notification_email_3'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Email when someone follows you'))->setCheckedValue("1")->setUncheckedValue("0"); $n4 = new Zend_Form_Element_Checkbox('notification_email_4'); $n4->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($notifications_meta['notification_email_4']) && $notifications_meta['notification_email_4'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Email on new friends'))->setCheckedValue("1")->setUncheckedValue("0"); $n6 = new Zend_Form_Element_Checkbox('notification_email_6'); $n6->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($notifications_meta['notification_email_6']) && $notifications_meta['notification_email_6'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Email when you lose a follower'))->setCheckedValue("1")->setUncheckedValue("0"); $n7 = new Zend_Form_Element_Checkbox('notification_email_7'); $n7->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($notifications_meta['notification_email_7']) && $notifications_meta['notification_email_7'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Email when someone posts on your wall'))->setCheckedValue("1")->setUncheckedValue("0"); $n8 = new Zend_Form_Element_Checkbox('notification_email_8'); $n8->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($notifications_meta['notification_email_8']) && $notifications_meta['notification_email_8'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Email when someone sends you a private message'))->setCheckedValue("1")->setUncheckedValue("0"); $submit = new Zend_Form_Element_Submit('submitbtn'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($n1, $n2, $n3, $n4, $n6, $n7, $n8, $submit)); $this->postInit(); }
/** * * Change network background * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsBackground.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $background_image = new Zend_Form_Element_File('background'); $background_image->setDecorators(array('File', 'Errors'))->setLabel($this->translator->translate('Choose Picture (jpg, png or gif)'))->addValidator('Extension', false, 'jpg,jpeg,png,gif'); $background_color = new Zend_Form_Element_Text('background_color'); $background_color->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->setValue(isset($all_meta['background_color']) ? $all_meta['background_color'] : 'ff0000')->setErrorMessages(array($this->translator->translate('Please pick a color')))->setLabel($this->translator->translate('Background Color'))->setRequired(true)->setAttrib('class', 'form-control colorpicker-input'); $background_repeat = new Zend_Form_Element_Checkbox('background_repeat'); $background_repeat->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_repeat']) && $all_meta['background_repeat'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Repeat background'))->setCheckedValue("1")->setUncheckedValue("0"); $background_scroll = new Zend_Form_Element_Checkbox('background_scroll'); $background_scroll->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_scroll']) && $all_meta['background_scroll'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Scroll background'))->setCheckedValue("1")->setUncheckedValue("0"); $background_stretch = new Zend_Form_Element_Checkbox('background_stretch'); $background_stretch->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_stretch']) && $all_meta['background_stretch'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Stretch background'))->setCheckedValue("1")->setUncheckedValue("0"); $disable_image = new Zend_Form_Element_Checkbox('background_noimage'); $disable_image->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_noimage']) && $all_meta['background_noimage'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable custom image'))->setCheckedValue("1")->setUncheckedValue("0"); $submit = new Zend_Form_Element_Submit('formsubmit'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($background_image, $background_repeat, $background_scroll, $background_stretch, $disable_image, $background_color, $submit)); $this->postInit(); }
/** * * @param array $options Options to build the form */ public function __construct($options = null) { parent::__construct($options); // Title $title = new Zend_Form_Element_Text('FSI_Title'); $title->setLabel($this->getView()->getCibleText('form_section_title_label') . " <span class='field_required'>*</span>")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'section_title_edit', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $this->addElement($title); // Show title $showTitle = new Zend_Form_Element_Checkbox('FS_ShowTitle'); $showTitle->setLabel($this->getView()->getCibleText('form_section_showtitle_label')); $showTitle->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($showTitle); // Repeat section $repeat = new Zend_Form_Element_Checkbox('FS_Repeat'); $repeat->setLabel($this->getView()->getCibleText('form_label_has_profil')); $repeat->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($repeat); // Repeat min $repeatMin = new Zend_Form_Element_Text('FS_RepeatMin'); $repeatMin->setLabel($this->getView()->getCibleText('form_section_repeatMin_label') . " <span class='field_required'>*</span>")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'section_RepeatMin'); $this->addElement($repeatMin); // Repeat max $repeatMax = new Zend_Form_Element_Text('FS_RepeatMax'); $repeatMax->setLabel($this->getView()->getCibleText('form_section_repeatMax_label') . " <span class='field_required'>*</span>")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'section_RepeatMax'); $this->addElement($repeatMax); // Sequence - hidden input $sequence = new Zend_Form_Element_Hidden('FS_Seq'); $this->addElement($sequence); // page break - hiden input $pageBreak = new Zend_Form_Element_Hidden('FS_PageBreak'); $this->addElement($pageBreak); // Set the form id $this->setAttrib('id', 'section'); }
public function __construct($options = null) { $baseDir = $options['baseDir']; $pageID = $options['pageID']; parent::__construct($options); /****************************************/ // PARAMETERS /****************************************/ // select box category (Parameter #1) $blockCategory = new Zend_Form_Element_Select('Param1'); $blockCategory->setLabel('Catégorie d\'évènement de ce bloc')->setAttrib('class', 'largeSelect'); $categories = new Categories(); $select = $categories->select()->setIntegrityCheck(false)->from('Categories')->join('CategoriesIndex', 'C_ID = CI_CategoryID')->where('C_ModuleID = ?', 7)->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->order('CI_Title'); $categoriesArray = $categories->fetchAll($select); foreach ($categoriesArray as $category) { $blockCategory->addMultiOption($category['C_ID'], $category['CI_Title']); } // number of news to show in front-end (Parameter #2) $at_least_one = new Zend_Validate_GreaterThan('0'); $at_least_one->setMessage('Vous devez afficher au moins un événement.'); $not_null = new Zend_Validate_NotEmpty(); $not_null->setMessage($this->getView()->getCibleText('validation_message_empty_field')); $blockNewsMax = new Zend_Form_Element_Text('Param2'); $blockNewsMax->setLabel('Nombre d\'évènement à afficher')->setRequired(true)->setValue('1')->addValidator($not_null, true)->addValidator($at_least_one, true)->setAttrib('class', 'smallTextInput'); // show the breif text in front-end (Parameter #3) $blockShowBrief = new Zend_Form_Element_Checkbox('Param3'); $blockShowBrief->setLabel('Afficher le texte bref'); $blockShowBrief->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElements(array($blockCategory, $blockNewsMax, $blockShowBrief)); $this->removeDisplayGroup('parameters'); $this->addDisplayGroup(array('Param999', 'Param1', 'Param2', 'Param3'), 'parameters'); $parameters = $this->getDisplayGroup('parameters'); //$parameters->setLegend($this->_view->getCibleText('form_parameters_fieldset')); }
/** * * Edit Group form * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/EditGroup.phtml')))); // get group from database $request = Zend_Controller_Front::getInstance()->getRequest(); $group = $request->getParam('name'); $Profiles = new Application_Model_Profiles(); $ProfilesMeta = new Application_Model_ProfilesMeta(); $profile = $Profiles->getProfile($group, false, true); $owners_profile = $Profiles->getProfileByField('id', $profile->owner); $username_minchars = Zend_Registry::get('config')->get('username_minchars'); $username_maxchars = Zend_Registry::get('config')->get('username_maxchars'); // fields $id = new Zend_Form_Element_Hidden('id'); $id->setValue($profile->id); $name = new Zend_Form_Element_Text('name'); $name->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Group Name'))->setValue($profile->name)->setIgnore(true)->setAttrib('readonly', true)->setAttrib('class', 'form-control'); $screenname = new Zend_Form_Element_Text('screen_name'); $screenname->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->setValue($profile->screen_name)->addValidator('alnum', false, array('allowWhiteSpace' => true))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid name between %d and %d characters'), $username_minchars, $username_maxchars)))->setLabel($this->translator->translate('Screen Name'))->setRequired(true)->setAttrib('class', 'form-control'); $description = new Zend_Form_Element_Textarea('description'); $description->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setValue($ProfilesMeta->getMetaValue('description', $profile->id))->setLabel($this->translator->translate('About this group'))->setAttrib('class', 'form-control'); $profile_privacy = new Zend_Form_Element_Select('profile_privacy'); $profile_privacy->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions(Zend_Registry::get('group_privacy_array'))->setErrorMessages(array($this->translator->translate('Select group visibility')))->setLabel($this->translator->translate('Select group visibility'))->setRequired(true)->setValue($profile->profile_privacy)->setAttrib('class', 'form-control'); $is_hidden = new Zend_Form_Element_Checkbox('is_hidden'); $is_hidden->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($profile->is_hidden) && $profile->is_hidden == 1 ? 1 : 0)->setLabel($this->translator->translate('Remove?'))->setCheckedValue("1")->setUncheckedValue("0"); $submit = new Zend_Form_Element_Submit('formsubmit'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($id, $name, $screenname, $profile_privacy, $description, $is_hidden, $submit)); $this->postInit(); }
/** * * Themes & styles * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsStyles.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $themes_array = array('/bootstrap/css/bootstrap.min.css' => 'Bootstrap'); $css_theme = new Zend_Form_Element_Select('css_theme'); $css_theme->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions($themes_array)->setErrorMessages(array($this->translator->translate('Please select')))->setLabel($this->translator->translate('Choose css theme'))->setRequired(true)->setValue(isset($all_meta['css_theme']) ? $all_meta['css_theme'] : 'bootstrap')->setAttrib('class', 'form-control'); $wide_layout = new Zend_Form_Element_Checkbox('wide_layout'); $wide_layout->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['wide_layout']) && $all_meta['wide_layout'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Extra-wide layout on large screens'))->setCheckedValue("1")->setUncheckedValue("0"); $cover_ysize = new Zend_Form_Element_Text('cover_ysize'); $cover_ysize->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Cover image height'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['cover_ysize']) ? $all_meta['cover_ysize'] : '220')->setAttrib('class', 'form-control'); $user_background = new Zend_Form_Element_Checkbox('user_background'); $user_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['user_background']) && $all_meta['user_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Users can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0"); $subscriber_background = new Zend_Form_Element_Checkbox('subscriber_background'); $subscriber_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['subscriber_background']) && $all_meta['subscriber_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Subscribers can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0"); $custom_css = new Zend_Form_Element_Textarea('css_custom'); $custom_css->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '15')->setValue(isset($all_meta['css_custom']) ? $all_meta['css_custom'] : '')->setLabel($this->translator->translate('Custom css'))->setAttrib('class', 'form-control'); $submit = new Zend_Form_Element_Submit('submitbtn'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($css_theme, $wide_layout, $cover_ysize, $user_background, $subscriber_background, $custom_css, $submit)); $this->postInit(); }
/** * @param string $content * @return string */ public function render($content) { $prepend = $this->getElement()->getAttrib('prepend'); $append = $this->getElement()->getAttrib('append'); if (null === $prepend && null === $append) { return $content; } $placement = 'prepend'; $addOn = $prepend; if (null !== $append) { $placement = 'append'; $addOn = $append; } if (is_array($addOn)) { $addOn = new Zend_Config($addOn, true); } $addOnClass = 'add-on'; if ($addOn instanceof Zend_Config) { if (isset($addOn->active) && true === $addOn->active) { $addOnClass .= ' active'; unset($addOn->active); } $prependedElement = new Zend_Form_Element_Checkbox($addOn); $prependedElement->setDecorators(array(array('ViewHelper'))); $addOn = $prependedElement->render($this->getElement()->getView()); } $this->getElement()->setAttrib('prepend', null); $this->getElement()->setAttrib('append', null); $span = '<span class="' . $addOnClass . '">' . $addOn . '</span>'; return '<div class="input-' . $placement . '"> ' . ('prepend' == $placement ? $span : '') . $content . ('append' == $placement ? $span : '') . ' </div>'; }
public function __construct($options = null) { parent::__construct($options); // Title $title = new Zend_Form_Element_Text('NR_Title'); $title->setLabel($this->getView()->getCibleText('form_label_title'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $this->addElement($title); // Date picker $datePicker = new Cible_Form_Element_DatePicker('NR_Date', array('jquery.params' => array('changeYear' => true, 'changeMonth' => true))); $datePicker->setLabel($this->getView()->getCibleText('form_extranet_newsletter_label_releaseDate'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator('Date', true, array('messages' => array('dateNotYYYY-MM-DD' => $this->getView()->getCibleText('validation_message_invalid_date'), 'dateInvalid' => $this->getView()->getCibleText('validation_message_invalid_date'), 'dateFalseFormat' => $this->getView()->getCibleText('validation_message_invalid_date')))); $this->addElement($datePicker); // Language $language = new Zend_Form_Element_Select('NR_LanguageID'); $language->setLabel($this->getView()->getCibleText('form_label_language'))->setAttrib('class', 'largeSelect'); $languagesData = Cible_FunctionsGeneral::getAllLanguage(); foreach ($languagesData as $languageData) { $language->addMultiOption($languageData['L_ID'], $languageData['L_Title']); } $this->addElement($language); // Category $category = new Zend_Form_Element_Select('NR_CategoryID'); $category->setLabel($this->getView()->getCibleText('form_label_category'))->setAttrib('class', 'largeSelect'); $categoriesData = $this->getView()->getAllNewsletterCategories(); foreach ($categoriesData as $categoryData) { $category->addMultiOption($categoryData['C_ID'], $categoryData['CI_Title']); } $this->addElement($category); // Model $model = new Zend_Form_Element_Select('NR_ModelID'); $model->setLabel($this->getView()->getCibleText('form_label_model'))->setAttrib('class', 'largeSelect'); $modelsData = $this->getView()->getAllNewsletterModels(); foreach ($modelsData as $modelData) { $model->addMultiOption($modelData['NMI_NewsletterModelID'], $modelData['NMI_Title']); } $this->addElement($model); //if($this->salutationDefaultText!=""){ $intro = new Cible_Form_Element_Editor('NR_TextIntro', array('mode' => Cible_Form_Element_Editor::ADVANCED)); $intro->setLabel($this->getView()->getCibleText('form_label_newsletter_text_intro'))->setAttrib('class', 'largeEditor'); $this->addElement($intro); // show online $showOnline = new Zend_Form_Element_Checkbox('NR_Online'); $showOnline->setLabel($this->getView()->getCibleText('form_label_showOnline')); $showOnline->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($showOnline); // email // $regexValidate = new Cible_Validate_Email(); // $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch'); $email = new Zend_Form_Element_Text('NR_AdminEmail'); $email->setLabel($this->getView()->getCibleText('newsletter_form_label_admin_email'))->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->setAttrib('class', 'stdTextInput'); /*$email->setDecorators(array( 'ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'dd_form dd_email')) ));*/ // $email->setAttrib('class', 'newsletter_form_element text_email'); $this->addElement($email); }
protected function _addTags() { $tags = $this->_tagRepository->fetchEntities(); $group = current($this->getDisplayGroups()); foreach ($tags as $tag) { $element = new \Zend_Form_Element_Checkbox('tag_' . $tag->id, array('class' => 'checkbox', 'label' => $tag->name)); $element->setDecorators($this->_config->elementDecorators->toArray()); $this->addElement($element); $group->addElement($element); } }
public function __construct($options = null) { $this->_disabledDefaultActions = true; parent::__construct($options); $newsletterCategories = $this->getView()->GetAllNewsletterCategories(); $newsletterCategories = $newsletterCategories->toArray(); foreach ($newsletterCategories as $cat) { $chkCat = new Zend_Form_Element_Checkbox("chkNewsletter{$cat['C_ID']}"); $chkCat->setLabel($cat['CI_Title']); $chkCat->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($chkCat); } }
public function __construct($options = null) { $this->_addSubmitSaveClose = false; parent::__construct($options); $galleryID = $options['galleryID']; $imageSrc = ""; // show online $showOnline = new Zend_Form_Element_Checkbox('GI_Online'); $showOnline->setValue(1); $showOnline->setLabel($this->getView()->getCibleText('form_label_showOnline')); $showOnline->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($showOnline); // image position $position = new Zend_Form_Element_Text('GI_Position'); $position->setLabel($this->getView()->getCibleText('form_label_position')); $position->setRequired(true); $position->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field')))); $position->addValidator('Int', true, array('messages' => array('notInt' => $this->getView()->getCibleText('validation_message_int_field')))); $this->addElement($position); // IMAGE /* $imageSrc = ""; $imageView = new Zend_Form_Element_Image('imageView',array('src' => $imageSrc)); $imageView->setOrder(4); $this->addElement($imageView); */ if ($galleryID != "") { $imageTmp = new Zend_Form_Element_Hidden('ImageSrc_tmp'); $imageTmp->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true)))); $this->addElement($imageTmp); $imageOrg = new Zend_Form_Element_Hidden('ImageSrc_original'); $imageOrg->setDecorators(array('ViewHelper')); $this->addElement($imageOrg); $imageView = new Zend_Form_Element_Image('ImageSrc_preview', array('src' => $imageSrc, 'onclick' => 'return false;')); $imageView->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'closeOnly' => true)))); $this->addElement($imageView); $imagePicker = new Cible_Form_Element_ImageGalleryPicker('ImageSrc', array('associatedElement' => 'imageView', 'galleryID' => $galleryID)); $imagePicker->removeDecorator('label'); $this->addElement($imagePicker); } // Title $title = new Zend_Form_Element_Text('II_Title'); $title->setLabel($this->getView()->getCibleText('form_label_title'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $this->addElement($title); // Description $title = new Zend_Form_Element_Text('II_Description'); $title->setLabel($this->getView()->getCibleText('form_label_description'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $this->addElement($title); }
public function init() { // usuario_nome $usuario_nome = new Zend_Form_Element_Text('usuario_nome'); $usuario_nome->setLabel('Nome Completo: '); $usuario_nome->setRequired(); $usuario_nome->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); $usuario_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu nome')); $usuario_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // usuario_email $usuario_email = new Zend_Form_Element_Text('usuario_email'); $usuario_email->setLabel('E-mail: '); $usuario_email->addValidator(new App_Validate_UsuarioEmail()); $usuario_email->setRequired(); $usuario_email->addValidator('EmailAddress'); $usuario_email->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu e-mail')); $usuario_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // usuario_cep $usuario_cep = new Zend_Form_Element_Text('usuario_cep'); $usuario_cep->setLabel('CEP: '); $usuario_cep->setRequired(); $usuario_cep->addValidator(new App_Validate_Cep()); $usuario_cep->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu CEP')); $usuario_cep->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // usuario_senha $usuario_senha = new Zend_Form_Element_Password("usuario_senha"); $usuario_senha->setLabel("Senha: "); $usuario_senha->setRequired(); $usuario_senha->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe sua senha')); $usuario_senha->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // usuario_politica_termo $usuario_politica_termo = new Zend_Form_Element_Checkbox('usuario_politica_termo'); $usuario_politica_termo->setLabel(" \n Li e concordo com a \n <a href='' data-toggle='modal' data-target='#modal-politica'>Política de Privacidade</a> e \n <a href='' data-toggle='modal' data-target='#modal-termo'>Termo de Uso</a>.\n "); $usuario_politica_termo->setDecorators(App_Forms_Decorators::$checkboxElementDecorators_termo); //$usuario_politica_termo->addDecorator(); //$usuario_politica_termo->setValue(0); //$usuario_politica_termo->setCheckedValue('') ; $usuario_politica_termo->setUnCheckedValue(''); $usuario_politica_termo->setRequired(); $usuario_politica_termo->addErrorMessage('Você precisa concordar com nossa Pólitica de Privacidade e Termo de Uso'); // captcha $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => 'Informe os careacteres da imagem: ', 'class' => 'form-control', 'captcha' => array('captcha' => 'Image', 'wordLen' => 3, 'timeout' => 300, 'font' => APPLICATION_PATH . '/../public/views/fonts/Exo-SemiBold.ttf', 'imgDir' => APPLICATION_PATH . '/../public/views/captcha/', 'imgUrl' => '/../public/views/captcha/'))); $captcha->removeDecorator('ViewHelper'); $this->addElements(array($usuario_nome, $usuario_email, $usuario_cep, $usuario_senha, $usuario_politica_termo)); parent::init(); $this->getElement('submit')->setLabel('Cadastrar'); }
/** * * @param array $options Options to build the form */ public function __construct($options = null) { // Disable the defaults buttons if (isset($options['disableAction'])) { $this->_disabledDefaultActions = $options['disableAction']; } if (isset($options['recipients'])) { $recipients = $options['recipients']; $recipientsList = $this->_setRecipientList($recipients); unset($options['recipients']); } parent::__construct($options); // Title $title = new Zend_Form_Element_Text('FI_Title'); $title->setLabel($this->getView()->getCibleText('form_label_title'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $this->addElement($title); // Notification $notification = new Zend_Form_Element_Checkbox('F_Notification'); $notification->setLabel($this->getView()->getCibleText('form_label_has_notification')); $notification->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($notification); $emailList = new Zend_Form_Element_Textarea('FN_Email'); $emailList->setAttrib('title', $this->getView()->getCibleText('form_notification_emails_info')); if (!empty($recipientsList)) { $emailList->setValue($recipientsList); } $emailList->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'formRecipientsEmail')))); $this->addElement($emailList); // isSercure // $hasProfil = new Zend_Form_Element_Checkbox('F_Profil'); // $hasProfil->setLabel($this->getView()->getCibleText( // 'form_label_has_profil')); // $hasProfil->setDecorators(array( // 'ViewHelper', // array('label', array('placement' => 'append')), // array( // array('row' => 'HtmlTag'), // array('tag' => 'dd', 'class' => 'label_after_checkbox')), // )); // // $this->addElement($hasProfil); //hasCaptcha $hasCaptcha = new Zend_Form_Element_Checkbox('F_Captcha'); $hasCaptcha->setLabel($this->getView()->getCibleText('form_label_has_captcha'))->setValue(true)->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($hasCaptcha); $this->setAttrib('id', 'Form'); }
public function __construct($options = null) { parent::__construct($options); $moduleID = -1; $moduleName = ''; if (!empty($options['moduleID'])) { $moduleID = $options['moduleID']; $moduleName = Cible_FunctionsModules::getModuleNameByID($moduleID); } // input text for the title of the text module $categoryTitle = new Zend_Form_Element_Text('Title'); $categoryTitle->setLabel($this->getView()->getCibleText('form_category_title_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->_view->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $label = $categoryTitle->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($categoryTitle); $categoryDescription = new Zend_Form_Element_Textarea('WordingShowAllRecords'); $categoryDescription->setLabel($this->_view->getCibleText('form_category_view_all_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextarea'); $label = $categoryDescription->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($categoryDescription); $views = Cible_FunctionsCategories::getCategoryViews($moduleID); foreach ($views as $view) { $pickerName = $view['MV_Name']; $controllerName = new Zend_Form_Element_Text("{$pickerName}_controllerName"); $controllerName->setLabel($this->getView()->getCibleText("form_select_option_view_{$moduleName}_{$pickerName}"))->setAttrib('onfocus', "openPagePicker('page-picker-{$pickerName}');"); $this->addElement($controllerName); $pagePicker = new Cible_Form_Element_PagePicker("{$pickerName}_pageID", array('associatedElement' => "{$pickerName}_controllerName", 'onclick' => "javascript:closePagePicker(\"page-picker-{$pickerName}\")")); $pagePicker->setLabel($this->_view->getCibleText('form_category_associated_page_label')); $pagePicker->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => "page-picker", 'id' => "page-picker-{$pickerName}")))); $this->addElement($pagePicker); } // Check if want to put that category in the RSS Feed $showInRss = new Zend_Form_Element_Checkbox('ShowInRss'); $showInRss->setValue(1); $showInRss->setLabel($this->_view->getCibleText('form_category_add_to_rss_label')); $showInRss->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($showInRss); // How many last news in the RSS Feed $rssItemsCount = new Zend_Form_Element_Text('RssItemsCount'); $rssItemsCount->setLabel($this->getView()->getCibleText('form_category_how_many_items_for_rss_label'))->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->_view->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'shortTextInput'); $this->addElement($rssItemsCount); $module = new Zend_Form_Element_Hidden('ModuleID'); $module->setValue($moduleID)->removeDecorator('label')->removeDecorator('DtDdWrapper'); $this->addElement($module); }
/** * * Login page form * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname), true, false); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/Login.phtml')))); // fields $name = new Zend_Form_Element_Text('name'); $name->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Username or email'))->addFilter('StringToLower')->setErrorMessages(array($this->translator->translate('Enter your username or email')))->setAttrib('class', 'form-control')->setRequired(true); $password = new Zend_Form_Element_Password('password'); $password->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Password'))->setErrorMessages(array($this->translator->translate('Enter your password')))->setAttrib('class', 'form-control')->setAttrib('autocomplete', 'off')->setRequired(true); $remember = new Zend_Form_Element_Checkbox('remember_me'); $remember->setDecorators(array('ViewHelper', 'Errors'))->setValue('1')->setLabel($this->translator->translate('Remember me')); $login = new Zend_Form_Element_Submit('loginbtn'); $login->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Sign In'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($name, $password, $login, $remember)); $this->postInit(); }
public function __construct($options = null) { $baseDir = $options['baseDir']; $pageID = $options['pageID']; parent::__construct($options); /****************************************/ // PARAMETERS /****************************************/ // select box category (Parameter #1) $blockCategory = new Zend_Form_Element_Select('Param1'); $blockCategory->setLabel($this->getView()->getCibleText('label_category_news_bloc'))->setAttrib('class', 'largeSelect')->setOrder(3); $categories = new Categories(); $select = $categories->select()->setIntegrityCheck(false)->from('Categories')->join('CategoriesIndex', 'C_ID = CI_CategoryID')->where('C_ModuleID = ?', 2)->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->order('CI_Title'); $categoriesArray = $categories->fetchAll($select); foreach ($categoriesArray as $category) { $blockCategory->addMultiOption($category['C_ID'], $category['CI_Title']); } $this->addElement($blockCategory); // number of news to show in front-end (Parameter #2) $blockNewsMax = new Zend_Form_Element_Text('Param2'); $blockNewsMax->setLabel($this->getView()->getCibleText('label_number_news_show'))->setAttrib('class', 'smallTextInput')->setOrder(4); $this->addElement($blockNewsMax); // show the breif text in front-end (Parameter #3) $blockShowBrief = new Zend_Form_Element_Checkbox('Param3'); $blockShowBrief->setLabel($this->getView()->getCibleText('label_show_brief_text'))->setOrder(5); $blockShowBrief->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($blockShowBrief); // display order (Parameter #4) $blockOrder = new Zend_Form_Element_Select('Param4'); $blockOrder->setLabel($this->getView()->getCibleText('label_order_display'))->setAttrib('class', 'largeSelect')->setOrder(6); $blockOrder->addMultiOption('ND_Date DESC', $this->getView()->getCibleText('label_date_desc')); $blockOrder->addMultiOption('ND_Date ASC', $this->getView()->getCibleText('label_date_asc')); $blockOrder->addMultiOption('ND_Title ASC', $this->getView()->getCibleText('label_alpha_asc')); $this->addElement($blockOrder); // display news date (Parameter #5) $blockDate = new Zend_Form_Element_Checkbox('Param5'); $blockDate->setLabel($this->getView()->getCibleText('label_date_news'))->setOrder(7); $blockDate->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($blockDate); $this->removeDisplayGroup('parameters'); $this->addDisplayGroup(array('Param999', 'Param1', 'Param2', 'Param3', 'Param4', 'Param5'), 'parameters'); $parameters = $this->getDisplayGroup('parameters'); //$parameters->setLegend($this->_view->getCibleText('form_parameters_fieldset')); }
/** * * Change network logo * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname), true, false); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsLogo.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $logo_image = new Zend_Form_Element_File('logo_image'); $logo_image->setDecorators(array('File', 'Errors'))->setLabel($this->translator->translate('Choose Picture (jpg, png or gif)'))->addValidator('Extension', false, 'jpg,jpeg,png,gif'); $disable_image = new Zend_Form_Element_Checkbox('logo_noimage'); $disable_image->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['logo_noimage']) && $all_meta['logo_noimage'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable custom image'))->setCheckedValue("1")->setUncheckedValue("0"); $submit = new Zend_Form_Element_Submit('formsubmit'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($logo_image, $disable_image, $submit)); $this->postInit(); }
public function __construct($options = null) { // $this->_disabledDefaultActions = true; // $this->_object = $options['object']; unset($options['object']); parent::__construct($options); // Subform for the retailer status on website $retailerForm = new Cible_Form_SubForm(); $retailerForm->setName('retailerForm')->removeDecorator('DtDdWrapper'); //checkbox to set the retailers address as valid $isValid = new Zend_Form_Element_Checkbox('R_Active'); $isValid->setLabel($this->getView()->getCibleText('form_label_approved_onweb')); $isValid->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $retailerForm->addElement($isValid); $isRetailer = new Zend_Form_Element_Radio('isDistributeur'); $isRetailer->setLabel($this->getView()->getCibleText('form_label_Display_web'))->setOrder(0); $isRetailer->setSeparator(''); $isRetailer->setAttrib('class', 'vertAlignRadio'); $isRetailer->addMultiOptions(array(1 => $this->getView()->getCibleText('form_account_no'), 2 => $this->getView()->getCibleText('form_account_yes')))->setValue(1); $txtFr = new Cible_Form_Element_Html('lblFr', array('value' => $this->getView()->getCibleText('form_address_retailer_fr'))); $txtFr->setOrder(1)->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'formLanguage')))); $retailerForm->addElement($txtFr); $adressRetailer = new Cible_View_Helper_FormAddress($retailerForm); $adressRetailer->enableFields(array('name' => true, 'firstAddress' => false, 'secondAddress' => false, 'state' => false, 'cityTxt' => false, 'zipCode' => false, 'country' => false, 'firstTel' => false, 'secondTel' => false, 'fax' => false, 'email' => false, 'webSite' => false)); $adressRetailer->formAddress(); $retailerForm->addElement($isRetailer); $retailerForm->getElement('AI_SecondTel')->setAttrib('class', 'stdTextInput phoneFree'); // Subform for the retailer status on website $retailerFormEn = new Cible_Form_SubForm(); $retailerFormEn->setName('retailerFormEn')->removeDecorator('DtDdWrapper'); $txtEn = new Cible_Form_Element_Html('lblEn', array('value' => $this->getView()->getCibleText('form_address_retailer_en'))); $txtEn->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'formLanguage')))); $adressRetailerEn = new Cible_View_Helper_FormAddress($retailerFormEn); $adressRetailerEn->enableFields(array('name' => false, 'firstAddress' => false, 'secondAddress' => false, 'firstTel' => false, 'secondTel' => false, 'webSite' => false)); $adressRetailerEn->formAddress(); $retailerFormEn->addElement($txtEn); $retailerFormEn->getElement('AI_SecondTel')->setAttrib('class', 'stdTextInput phoneFree'); //*** Add subform to the form ***/ $this->addSubForm($retailerForm, 'retailerForm'); $this->addSubForm($retailerFormEn, 'retailerFormEn'); }
/** * * Change network background * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/CustomBackground.phtml')))); // load settings $Profiles = new Application_Model_Profiles(); $ProfilesMeta = new Application_Model_ProfilesMeta(); $request = Zend_Controller_Front::getInstance()->getRequest(); $request_profile_id = $request->getParam('id', false); $profile = $Profiles->getProfileByField('id', $request_profile_id); if (Zend_Auth::getInstance()->getIdentity()->role == 'admin' && $request_profile_id || $request_profile_id && $Profiles->getProfile($profile->name, false, true)) { // admin or own group & page $profile_id = $request_profile_id; } else { // editing profile $profile_id = Zend_Auth::getInstance()->getIdentity()->id; } $all_meta = $ProfilesMeta->getMetaValues($profile_id); // fields $background_image = new Zend_Form_Element_File('background'); $background_image->setDecorators(array('File', 'Errors'))->setLabel($this->translator->translate('Choose Picture (jpg, png or gif)'))->addValidator('Count', false, 1)->addValidator('Size', false, Zend_Registry::get('config')->get('max_file_upload_size'))->addValidator('Extension', false, 'jpg,jpeg,png,gif'); $background_image->getValidator('Count')->setMessage($this->translator->translate('File not allowed or too big')); $background_image->getValidator('Size')->setMessage($this->translator->translate('File not allowed or too big')); $background_image->getValidator('Extension')->setMessage($this->translator->translate('File not allowed or too big')); $background_repeat = new Zend_Form_Element_Checkbox('background_repeat'); $background_repeat->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_repeat']) && $all_meta['background_repeat'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Repeat background'))->setCheckedValue("1")->setUncheckedValue("0"); $background_scroll = new Zend_Form_Element_Checkbox('background_scroll'); $background_scroll->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_scroll']) && $all_meta['background_scroll'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Scroll background'))->setCheckedValue("1")->setUncheckedValue("0"); $background_stretch = new Zend_Form_Element_Checkbox('background_stretch'); $background_stretch->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_stretch']) && $all_meta['background_stretch'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Stretch background'))->setCheckedValue("1")->setUncheckedValue("0"); $disable_image = new Zend_Form_Element_Checkbox('background_noimage'); $disable_image->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_noimage']) && $all_meta['background_noimage'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable custom image'))->setCheckedValue("1")->setUncheckedValue("0"); $submit = new Zend_Form_Element_Submit('formsubmit'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($background_image, $background_repeat, $background_scroll, $background_stretch, $disable_image, $submit)); $this->postInit(); }
/** * * Login page form * */ public function init() { $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl(); $translator = $this->getTranslator(); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'Form.phtml')))); $this->setName(get_class()); $this->setMethod('post'); $this->setAction(''); $username_minchars = Zend_Registry::get('config')->get('username_minchars'); $username_maxchars = Zend_Registry::get('config')->get('username_maxchars'); $session = new Zend_Session_Namespace('Default'); // fields // lowercase, alnum without whitespaces $name = new Zend_Form_Element_Text('name'); $name->setDecorators(array('ViewHelper', 'Errors'))->setRequired(true)->addFilter('StringToLower')->addValidator('alnum', false, array('allowWhiteSpace' => false))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setLabel($translator->translate('Username'))->setErrorMessages(array(sprintf($translator->translate('Please choose a valid username between %d and %d characters'), $username_minchars, $username_maxchars)))->setValue($session->fb_user_display_name)->setAttrib('class', 'form-control alnum-only'); $confirm = new Zend_Form_Element_Checkbox('confirm'); $confirm->setDecorators(array('ViewHelper', 'Errors'))->setLabel($translator->translate('Accept Terms & Conditions'))->addValidator('GreaterThan', false, array(0))->setErrorMessages(array($translator->translate('Please Read and Agree to our Terms & Conditions'))); $register = new Zend_Form_Element_Submit('registerfbsubmit'); $register->setDecorators(array('ViewHelper'))->setLabel($translator->translate('Create account'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($name, $confirm, $register)); }
/** * * General settings * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/Settings.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $php_post_max_size = Application_Plugin_Common::returnBytes(ini_get('post_max_size')); $php_upload_max_filesize = Application_Plugin_Common::returnBytes(ini_get('upload_max_filesize')); $info_class = ''; if ($all_meta['max_file_upload_size'] > $php_post_max_size || $all_meta['max_file_upload_size'] > $php_upload_max_filesize) { $info_class = 'warning'; } $filesize_php_info = '<span class="' . $info_class . '">(' . $this->translator->translate('php ini settings:') . ' post_max_size = ' . $php_post_max_size . ', upload_max_filesize = ' . $php_upload_max_filesize . ')</span>'; $max_file_upload_size = new Zend_Form_Element_Text('max_file_upload_size'); $max_file_upload_size->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Max file upload size in bytes') . ' ' . $filesize_php_info)->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['max_file_upload_size']) ? $all_meta['max_file_upload_size'] : '1048576')->setAttrib('class', 'form-control'); $max_images_per_post = new Zend_Form_Element_Text('max_images_per_post'); $max_images_per_post->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Max images per post'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['max_images_per_post']) ? $all_meta['max_images_per_post'] : '5')->setAttrib('class', 'form-control'); $max_files_per_user = new Zend_Form_Element_Text('max_files_per_user'); $max_files_per_user->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Max files per user'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['max_files_per_user']) ? $all_meta['max_files_per_user'] : '******')->setAttrib('class', 'form-control'); $max_storage_per_user = new Zend_Form_Element_Text('max_storage_per_user'); $max_storage_per_user->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Max storage space per user (in bytes)'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['max_storage_per_user']) ? $all_meta['max_storage_per_user'] : '******')->setAttrib('class', 'form-control'); $resample_images = new Zend_Form_Element_Checkbox('resample_images'); $resample_images->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['resample_images']) && $all_meta['resample_images'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Resample uploaded images'))->setCheckedValue("1")->setUncheckedValue("0"); $keep_original = new Zend_Form_Element_Checkbox('keep_original'); $keep_original->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['keep_original']) && $all_meta['keep_original'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Keep original file'))->setCheckedValue("1")->setUncheckedValue("0"); $resample_maxwidth = new Zend_Form_Element_Text('resample_maxwidth'); $resample_maxwidth->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Resample image max width'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['resample_maxwidth']) ? $all_meta['resample_maxwidth'] : '400')->setAttrib('class', 'form-control'); $resample_maxheight = new Zend_Form_Element_Text('resample_maxheight'); $resample_maxheight->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Resample image max height'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['resample_maxwidth']) ? $all_meta['resample_maxheight'] : '400')->setAttrib('class', 'form-control'); $submit = new Zend_Form_Element_Submit('submitbtn'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($max_file_upload_size, $max_images_per_post, $max_files_per_user, $max_storage_per_user, $resample_images, $keep_original, $resample_maxwidth, $resample_maxheight, $submit)); $this->postInit(); }
/** * * Activate account form * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname), true, false); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/ActivateAccount.phtml')))); // fields $confirm = new Zend_Form_Element_Checkbox('confirm'); $confirm->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Accept Terms & Conditions'))->addValidator('GreaterThan', false, array(0))->setErrorMessages(array($this->translator->translate('Please Read and Agree to our Terms & Conditions'))); $register = new Zend_Form_Element_Submit('activatesubmit'); $register->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Create Account'))->setAttrib('class', 'submit btn btn-default'); if (Zend_Registry::get('config')->get('recaptcha_active') == 1) { $privateKey = Zend_Registry::get('config')->get('recaptcha_privatekey'); $publicKey = Zend_Registry::get('config')->get('recaptcha_publickey'); $recaptcha = new Zend_Service_ReCaptcha($publicKey, $privateKey, array('ssl' => true)); $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => '', 'captcha' => array('captcha' => 'ReCaptcha', 'service' => $recaptcha))); $captcha->setDecorators(array('ViewHelper', 'Errors')); $this->addElements(array($captcha, $confirm, $register)); } else { $this->addElements(array($confirm, $register)); } $this->postInit(); }
public function init() { $this->setMethod('post'); $this->setAttribs(array('name' => 'masterForm')); $this->setDecorators(array('FormElements')); $this->setElementDecorators(array('DijitElement', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'th')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $decs = array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'th')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))); $media_dir = new Zend_Form_Element_Text(array('name' => 'media_dir', 'label' => 'Media directory', 'required' => true, 'dojoType' => 'freeadmin.form.PathSelector')); $media_dir->setDecorators($decs); //$inotify = new Zend_Form_Element_Checkbox(array( $inotify = new Zend_Form_Element_Hidden(array('name' => 'inotify', 'label' => 'Automatic discover')); //$inotify->setDecorators($decs); $inotify->setDecorators(array('ViewHelper')); //$enabled = new Zend_Form_Element_Checkbox(array( // 'name' => 'enabled', // 'label' => 'Enabled', // 'dojoType' => 'dijit.form.CheckBox') // ); //$enabled->setDecorators($decs); //$tivo = new Zend_Form_Element_Checkbox(array( $tivo = new Zend_Form_Element_Hidden(array('name' => 'tivo', 'label' => 'Enable TiVo')); //$tivo->setDecorators($decs); $tivo->setDecorators(array('ViewHelper')); $friendly_name = new Zend_Form_Element_Text(array('name' => 'friendly_name', 'label' => 'Friendly name', 'dojoType' => 'dijit.form.TextBox')); $friendly_name->setDecorators($decs); $model_number = new Zend_Form_Element_Text(array('name' => 'model_number', 'label' => 'Model number', 'dojoType' => 'dijit.form.TextBox')); $model_number->setDecorators($decs); $serial = new Zend_Form_Element_Text(array('name' => 'serial', 'label' => 'Serial', 'dojoType' => 'dijit.form.TextBox')); $serial->setDecorators($decs); $auxiliary = new Zend_Form_Element_Text(array('name' => 'auxiliary', 'label' => 'Auxiliary parameters', 'dojoType' => 'dijit.form.Textarea')); $auxiliary->setDecorators($decs); $rescan = new Zend_Form_Element_Checkbox(array('name' => 'rescan', 'label' => 'Rescan on (re)start', 'dojoType' => 'dijit.form.CheckBox')); $rescan->setDecorators($decs); $strict_dlna = new Zend_Form_Element_Checkbox(array('name' => 'strict_dlna', 'label' => 'Strict DLNA', 'dojoType' => 'dijit.form.CheckBox')); $strict_dlna->setDecorators($decs); $this->addElement($friendly_name)->addElement($media_dir)->addElement('NumberTextBox', 'port', array('label' => 'Port', 'required' => true, 'allowEmpty' => false))->addElement($inotify)->addElement('TextBox', 'notify_interval', array('label' => 'Discover interval (seconds)', 'required' => true, 'allowEmpty' => false))->addElement($tivo)->addElement($strict_dlna)->addElement($model_number)->addElement($serial)->addElement($rescan)->addElement($auxiliary); }
/** * * Edit Page form (admin only) * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/AdminPage.phtml')))); // get group from database $request = Zend_Controller_Front::getInstance()->getRequest(); $request_profile_id = $request->getParam('id'); $Profiles = new Application_Model_Profiles(); $ProfilesMeta = new Application_Model_ProfilesMeta(); $profile = $Profiles->getProfileByField('id', $request_profile_id); $owners_profile = $Profiles->getProfileByField('id', $profile->owner); // fields $profile_id = new Zend_Form_Element_Text('id'); $profile_id->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Id'))->setValue($profile->id)->setIgnore(true)->setAttrib('readonly', true)->setAttrib('class', 'form-control'); $username_minchars = Zend_Registry::get('config')->get('username_minchars'); $username_maxchars = Zend_Registry::get('config')->get('username_maxchars'); // lowercase, alnum without whitespaces $name = new Zend_Form_Element_Text('name'); $name->setDecorators(array('ViewHelper', 'Errors'))->setRequired(true)->addFilter('StringToLower')->addValidator('alnum', false, array('allowWhiteSpace' => false))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid username between %d and %d characters'), $username_minchars, $username_maxchars)))->setAttrib('class', 'form-control alnum-only')->setValue($profile->name)->setLabel($this->translator->translate('Username')); $screenname = new Zend_Form_Element_Text('screen_name'); $screenname->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->setValue($profile->screen_name)->addValidator('alnum', false, array('allowWhiteSpace' => true))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid name between %d and %d characters'), $username_minchars, $username_maxchars)))->setLabel($this->translator->translate('Screen Name'))->setRequired(true)->setAttrib('class', 'form-control'); $owner_name = isset($owners_profile->name) ? $owners_profile->name : '-'; $owner = new Zend_Form_Element_Text('owner'); $owner->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Owner') . ' (' . $this->translator->translate('Current') . ': ' . $owner_name . ')')->setValue($owner_name)->setRequired(true)->setAttrib('class', 'form-control'); $badges = new Zend_Form_Element_Text('badges'); $badges->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Badges based on Glyphicon font separated by comma (e.g. "bullhorn,earphone")'))->setValue($ProfilesMeta->getMetaValue('badges', $profile->id))->setAttrib('class', 'form-control'); $description = new Zend_Form_Element_Textarea('description'); $description->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setValue($ProfilesMeta->getMetaValue('description', $profile->id))->setLabel($this->translator->translate('About this page'))->setAttrib('class', 'form-control'); $is_hidden = new Zend_Form_Element_Checkbox('is_hidden'); $is_hidden->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($profile->is_hidden) && $profile->is_hidden == 1 ? 1 : 0)->setLabel($this->translator->translate('Hide?'))->setCheckedValue("1")->setUncheckedValue("0"); $submit = new Zend_Form_Element_Submit('formsubmit'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($profile_id, $owner, $name, $screenname, $badges, $description, $is_hidden, $submit)); $this->postInit(); }
public function init() { $this->setMethod('post'); $this->setEnctype('multipart/form-data'); $this->setName('edit_profile_form'); $this->setAttrib('id', 'edit-profile-form'); $this->addElementPrefixPath('Oibs_Form_Decorator', 'Oibs/Form/Decorator/', 'decorator'); $mailvalid = new Zend_Validate_EmailAddress(); $mailvalid->setMessage('email-invalid', Zend_Validate_EmailAddress::INVALID); $mailvalid->setMessage('email-invalid-hostname', Zend_Validate_EmailAddress::INVALID_HOSTNAME); $mailvalid->setMessage('email-invalid-mx-record', Zend_Validate_EmailAddress::INVALID_MX_RECORD); $mailvalid->setMessage('email-dot-atom', Zend_Validate_EmailAddress::DOT_ATOM); $mailvalid->setMessage('email-quoted-string', Zend_Validate_EmailAddress::QUOTED_STRING); $mailvalid->setMessage('email-invalid-local-part', Zend_Validate_EmailAddress::INVALID_LOCAL_PART); $mailvalid->setMessage('email-length-exceeded', Zend_Validate_EmailAddress::LENGTH_EXCEEDED); $mailvalid->hostnameValidator->setMessage('hostname-invalid-hostname', Zend_Validate_Hostname::INVALID_HOSTNAME); $mailvalid->hostnameValidator->setMessage('hostname-local-name-not-allowed', Zend_Validate_Hostname::LOCAL_NAME_NOT_ALLOWED); $mailvalid->hostnameValidator->setMessage('hostname-unknown-tld', Zend_Validate_Hostname::UNKNOWN_TLD); $mailvalid->hostnameValidator->setMessage('hostname-invalid-local-name', Zend_Validate_Hostname::INVALID_LOCAL_NAME); $mailvalid->hostnameValidator->setMessage('hostname-undecipherable-tld', Zend_Validate_Hostname::UNDECIPHERABLE_TLD); // Clear div $clear = '<div class="clear"></div>'; // Headers $accountInformation = new Oibs_Form_Element_Note('accountinformation'); $accountInformation->setValue($clear . '<h3>Account information</h3>' . $clear); $personalInformation = new Oibs_Form_Element_Note('personalinformation'); $personalInformation->setValue('<h3>Personal Information</h3>' . $clear); $locationInformation = new Oibs_Form_Element_Note('locationinformation'); $locationInformation->setValue('<h3>Location Information</h3>' . $clear); $employmentInformation = new Oibs_Form_Element_Note('employmentinformation'); $employmentInformation->setValue('<h3>Employment Information</h3>' . $clear); $subscribeInformation = new Oibs_Form_Element_Note('subscribeinformation'); $subscribeInformation->setValue('<h3>Subscribe settings</h3>' . $clear); // Public text $publictext = 'Public'; // Username for description $auth = Zend_Auth::getInstance(); $identity = $auth->getIdentity(); $usernametext = $identity->username; $username = new Zend_Form_Element_Hidden('username'); $username->setLabel('Username')->setDescription($usernametext); $usernamepublic = new Zend_Form_Element_Hidden('username_publicity'); $usernamepublic->setLabel($publictext); $openid = new Zend_Form_Element_Text('openid'); $openid->setLabel('Open-ID')->setAttrib('id', 'open-ID')->addValidators(array(new Oibs_Validators_OpenidExists())); $openidclear = new Oibs_Form_Element_Note('openidclear'); $openidclear->setValue($clear); $password = new Zend_Form_Element_Password('password'); $password->setLabel('New password')->setAttrib('id', 'password')->addValidators(array(new Oibs_Validators_RepeatValidator('confirm_password'), array('NotEmpty', true, array('messages' => array('isEmpty' => 'Empty'))), array('StringLength', false, array(4, 22, 'messages' => array('stringLengthTooShort' => 'Password too short (4-22 characters)', 'stringLengthTooLong' => 'Password too long (4-22 characters)'))))); $passwordclear = new Oibs_Form_Element_Note('passwordclear'); $passwordclear->setValue($clear); $confirmpassword = new Zend_Form_Element_Password('confirm_password'); $confirmpassword->setLabel('Confirm password')->setAttrib('id', 'confirm-password')->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Empty'))), array('StringLength', false, array(4, 22, 'messages' => array('stringLengthTooShort' => 'Password too short (4-22 characters)', 'stringLengthTooLong' => 'Password too long (4-22 characters)'))))); $confirmpasswordclear = new Oibs_Form_Element_Note('confirm_passwordclear'); $confirmpasswordclear->setValue($clear); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email')->setAttrib('id', 'email')->setRequired(true)->addFilter('StringtoLower')->addValidators(array($mailvalid, array('NotEmpty', true, array('messages' => array('isEmpty' => 'Email empty'))), array('StringLength', false, array(6, 50, 'messages' => array('stringLengthTooShort' => 'Email too short (6-50 characters)', 'stringLengthTooLong' => 'Email too long (6-50 characters)'))))); $emailclear = new Oibs_Form_Element_Note('emailclear'); $emailclear->setValue($clear); $gravatar = new Zend_Form_Element_Hidden('gravatartext'); $gravatar->setLabel('Gravatar')->setDescription('<div style="text-align: right;">Enable <a href="http://www.gravatar.com">gravatar</a></div>'); $gravatarcheck = new Zend_Form_Element_Checkbox('gravatar'); $phone = new Zend_Form_Element_Text('phone'); $phone->setLabel('Phone')->setAttrib('id', 'phone'); $phonepublic = new Zend_Form_Element_Checkbox('phone_publicity'); $phonepublic->setLabel($publictext); $firstname = new Zend_Form_Element_Text('firstname'); $firstname->setLabel('First name')->setAttrib('id', 'first-name'); $firstnamepublic = new Zend_Form_Element_Checkbox('firstname_publicity'); $firstnamepublic->setLabel($publictext); // DB: surname $lastname = new Zend_Form_Element_Text('surname'); $lastname->setLabel('Last name')->setAttrib('id', 'last-name'); $lastnamepublic = new Zend_Form_Element_Checkbox('surname_publicity'); $lastnamepublic->setLabel($publictext); $gender = new Zend_Form_Element_Select('gender'); $gender->setLabel('Gender')->setAttrib('id', 'gender')->addMultiOptions(array('Select', 'Male', 'Female')); $genderpublic = new Zend_Form_Element_Checkbox('gender_publicity'); $genderpublic->setLabel($publictext); $birthday = new Zend_Form_Element_Text('birthday'); $birthday->setLabel('Date of Birth')->setAttrib('id', 'birthday')->setValidators(array(new Zend_Validate_Date('birthday'))); $birthdaypublic = new Zend_Form_Element_Checkbox('birthday_publicity'); $birthdaypublic->setLabel($publictext); $biography = new Zend_Form_Element_Textarea('biography'); $biography->setLabel('Biography')->setAttrib('id', 'biography')->setAttrib('rows', 30)->setAttrib('cols', 45)->addValidators(array(array('StringLength', false, array(0, 4000, 'messages' => array('stringLengthTooLong' => 'Biography too long'))))); //->setDescription('<div id="progressbar_biography" class="progress_ok"></div>'); $biographypublic = new Zend_Form_Element_Checkbox('biography_publicity'); $biographypublic->setLabel($publictext); $intereststext = new Oibs_Form_Element_Note('intereststext'); $intereststext->setValue('<div class="input-column1"></div>' . '<div class="input-column2 help">(Use commas to separate tags)</div><div class="clear"></div>'); $interests = new Zend_Form_Element_Text('interests'); $interests->setLabel('My interest (tags)')->setAttrib('id', 'interests'); $interestsclear = new Oibs_Form_Element_Note('interestsclear'); $interestsclear->setValue($clear); $weblinks_websites = new Oibs_Form_Element_Note('weblinks_websites'); $weblinks_websites->setValue('<div class="input-column-website1"><label><strong>Links to my websites:</strong></label></div>'); $weblinks_name = new Oibs_Form_Element_Note('weblinks_name'); $weblinks_name->setValue('<div class="input-column-website2">Name</div>'); $weblinks_url = new Oibs_Form_Element_Note('weblinks_url'); $weblinks_url->setValue('<div class="input-column-website3">Url</div><div class="clear"></div>'); $nameTooLongText = 'Name too long (max 45)'; $urlTooLongText = 'URL too long (max 150)'; $weblinks_name_site1 = new Zend_Form_Element_Text('weblinks_name_site1'); $weblinks_name_site1->setLabel('Web site 1')->setAttrib('id', 'website1-name')->addValidators(array(array('StringLength', false, array(0, 45, 'messages' => array('stringLengthTooLong' => $nameTooLongText))))); $weblinks_url_site1 = new Zend_Form_Element_Text('weblinks_url_site1'); $weblinks_url_site1->setAttrib('id', 'website1-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'messages' => array('stringLengthTooLong' => $urlTooLongText))))); $weblinks_name_site2 = new Zend_Form_Element_Text('weblinks_name_site2'); $weblinks_name_site2->setLabel('Web site 2')->setAttrib('id', 'website2-name')->addValidators(array(array('StringLength', false, array(0, 45, 'messages' => array('stringLengthTooLong' => $nameTooLongText))))); $weblinks_url_site2 = new Zend_Form_Element_Text('weblinks_url_site2'); $weblinks_url_site2->setAttrib('id', 'website2-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'messages' => array('stringLengthTooLong' => $urlTooLongText))))); $weblinks_name_site3 = new Zend_Form_Element_Text('weblinks_name_site3'); $weblinks_name_site3->setLabel('Web site 3')->setAttrib('id', 'website3-name')->setAttrib('id', 'website2-name')->addValidators(array(array('StringLength', false, array(0, 45, 'messages' => array('stringLengthTooLong' => $nameTooLongText))))); $weblinks_url_site3 = new Zend_Form_Element_Text('weblinks_url_site3'); $weblinks_url_site3->setAttrib('id', 'website3-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'messages' => array('stringLengthTooLong' => $urlTooLongText))))); $weblinks_name_site4 = new Zend_Form_Element_Text('weblinks_name_site4'); $weblinks_name_site4->setLabel('Web site 4')->setAttrib('id', 'website4-name')->setAttrib('id', 'website2-name')->addValidators(array(array('StringLength', false, array(0, 45, 'messages' => array('stringLengthTooLong' => $nameTooLongText))))); $weblinks_url_site4 = new Zend_Form_Element_Text('weblinks_url_site4'); $weblinks_url_site4->setAttrib('id', 'website4-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'messages' => array('stringLengthTooLong' => $urlTooLongText))))); $weblinks_name_site5 = new Zend_Form_Element_Text('weblinks_name_site5'); $weblinks_name_site5->setLabel('Web site 5')->setAttrib('id', 'website5-name')->setAttrib('id', 'website2-name')->addValidators(array(array('StringLength', false, array(0, 45, 'messages' => array('stringLengthTooLong' => $nameTooLongText))))); $weblinks_url_site5 = new Zend_Form_Element_Text('weblinks_url_site5'); $weblinks_url_site5->setAttrib('id', 'website5-url')->addValidators(array(new Oibs_Validators_UrlValidator(), array('StringLength', false, array(0, 150, 'messages' => array('stringLengthTooLong' => $urlTooLongText))))); $languages = new Default_Model_Languages(); $allLanguages = $languages->getAllNamesAndIds(); $userlanguage = new Zend_Form_Element_Select('userlanguage'); $userlanguage->setLabel('User interface language')->setAttrib('id', 'user-interface-language')->addMultiOption('', 'Select'); foreach ($allLanguages as $language) { $userlanguage->addMultiOption($language['id_lng'], $language['name_lng']); } $userlanguageclear = new Oibs_Form_Element_Note('userlanguageclear'); $userlanguageclear->setValue($clear); /* $avatar = new Zend_Form_Element_File('avatar'); $avatar->setLabel('Avatar image'); */ // DB: city $hometown = new Zend_Form_Element_Text('city'); $hometown->setLabel('Hometown')->setAttrib('id', 'hometown')->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Hometown empty'))), array('Regex', true, array('/^[\\p{L}0-9.\\- ]*$/')))); $hometownpublic = new Zend_Form_Element_Checkbox('city_publicity'); $hometownpublic->setLabel($publictext); $hometownpublic->helper = 'FormHidden'; $address = new Zend_Form_Element_Text('address'); $address->setLabel('Address')->setAttrib('id', 'address'); $addresspublic = new Zend_Form_Element_Checkbox('address_publicity'); $addresspublic->setLabel($publictext)->setAttrib('checked', 'checked')->setValue(1); $addresspublic->helper = 'FormHidden'; $country_model = new Default_Model_Countries(); $allCountries = $country_model->getAllCountries(); $usercountry = new Zend_Form_Element_Select('country'); $usercountry->setLabel('Country of Residence')->setAttrib('id', 'country')->addMultiOption('', 'Select'); foreach ($allCountries as $country) { $usercountry->addMultiOption($country['iso_ctr'], $country['printable_name_ctr']); } $usercountrypublic = new Zend_Form_Element_Checkbox('country_publicity'); $usercountrypublic->setLabel($publictext); $timezone_model = new Default_Model_Timezones(); $allTimezones = $timezone_model->getAllTimezones(); $usertimezone = new Zend_Form_Element_Select('usertimezone'); $usertimezone->setLabel('Time Zone')->setAttrib('id', 'time-zone')->addMultiOption('', 'Select'); foreach ($allTimezones as $timezone) { $usertimezone->addMultiOption($timezone['id_tmz'], $timezone['gmt_tmz'] . ' ' . $timezone['timezone_location_tmz']); } $usertimezonepublic = new Zend_Form_Element_Checkbox('usertimezone_publicity'); $usertimezonepublic->setLabel($publictext); $userProfilesModel = new Default_Model_UserProfiles(); $employments = $userProfilesModel->getEmployments(); $employments = array_merge(array('' => 'Select'), $employments); $employment = new Zend_Form_Element_Select('employment'); $employment->setLabel('I am currently')->setAttrib('id', 'status')->setRequired(true)->addMultiOptions($employments)->setErrorMessages(array('Select status')); $employmentpublic = new Zend_Form_Element_Checkbox('employment_publicity'); $employmentpublic->setLabel($publictext); // DB: company $employer_organization = new Zend_Form_Element_Text('company'); $employer_organization->setLabel('Employer / Organization')->setAttrib('id', 'employer-organization'); $employer_organizationpublic = new Zend_Form_Element_Checkbox('company_publicity'); $employer_organizationpublic->setLabel($publictext); //Subscribe things $favouritesModel = new Default_Model_UserHasFavourites(); $subscribeOptions = $favouritesModel->getFollows(); unset($subscribeOptions['8']); //Unsetting the translation box till its in use. //print_r($subscribeOptions);die; $test = new Zend_Form_Element_MultiCheckbox('lol'); //$test->setV $subscribeClasses = array("own_follows" => "Own contents", "fvr_follows" => "Favourite contents"); foreach ($subscribeClasses as $key => $value) { $subscribe[$key] = new Zend_Form_Element_MultiCheckbox($key); $subscribe[$key]->setLabel('Activities you want to follow in your ' . $value); $subscribe[$key]->addMultiOptions($subscribeOptions); } $subscribeclear = new Oibs_Form_Element_Note('subscribeclear'); $subscribeclear->setValue($clear); $save = new Zend_Form_Element_Submit('save'); $save->setLabel('Save profile')->setAttrib('id', 'save-profile')->setAttrib('class', 'submit-button'); $cancel = new Zend_Form_Element_Submit('cancel'); $cancel->setLabel('Cancel')->setAttrib('id', 'cancel')->setAttrib('class', 'submit-button'); $this->addElements(array($accountInformation, $username, $usernamepublic, $openid, $openidclear, $password, $passwordclear, $confirmpassword, $confirmpasswordclear, $personalInformation, $email, $emailclear, $gravatar, $gravatarcheck, $phone, $phonepublic, $firstname, $firstnamepublic, $lastname, $lastnamepublic, $gender, $genderpublic, $birthday, $birthdaypublic, $biography, $biographypublic, $weblinks_websites, $weblinks_name, $weblinks_url, $weblinks_name_site1, $weblinks_url_site1, $weblinks_name_site2, $weblinks_url_site2, $weblinks_name_site3, $weblinks_url_site3, $weblinks_name_site4, $weblinks_url_site4, $weblinks_name_site5, $weblinks_url_site5, $userlanguage, $userlanguageclear, $locationInformation, $hometown, $hometownpublic, $address, $addresspublic, $usercountry, $usercountrypublic, $usertimezone, $usertimezonepublic, $employmentInformation, $employment, $employmentpublic, $employer_organization, $employer_organizationpublic, $save, $cancel)); $accountInformation->setDecorators(array('ViewHelper')); $personalInformation->setDecorators(array('ViewHelper')); $locationInformation->setDecorators(array('ViewHelper')); $employmentInformation->setDecorators(array('ViewHelper')); $subscribeInformation->setDecorators(array('ViewHelper')); $username->setDecorators(array('InputDecorator')); $usernamepublic->setDecorators(array('PublicDecorator')); $openid->setDecorators(array('InputDecorator')); $openidclear->setDecorators(array('ViewHelper')); $password->setDecorators(array('InputDecorator')); $passwordclear->setDecorators(array('ViewHelper')); $confirmpassword->setDecorators(array('InputDecorator')); $confirmpasswordclear->setDecorators(array('ViewHelper')); $email->setDecorators(array('InputDecorator')); $emailclear->setDecorators(array('ViewHelper')); $gravatar->setDecorators(array('InputDecorator')); $gravatarcheck->setDecorators(array('PublicDecorator')); $phone->setDecorators(array('InputDecorator')); $phonepublic->setDecorators(array('PublicDecorator')); $firstname->setDecorators(array('InputDecorator')); $firstnamepublic->setDecorators(array('PublicDecorator')); $lastname->setDecorators(array('InputDecorator')); $lastnamepublic->setDecorators(array('PublicDecorator')); $gender->setDecorators(array('InputDecorator')); $genderpublic->setDecorators(array('PublicDecorator')); $birthday->setDecorators(array('InputDecorator')); $birthdaypublic->setDecorators(array('PublicDecorator')); $biography->setDecorators(array('InputDecorator')); $biographypublic->setDecorators(array('PublicDecorator')); $intereststext->setDecorators(array('ViewHelper')); $interests->setDecorators(array('InputDecorator')); $interestsclear->setDecorators(array('ViewHelper')); $weblinks_websites->setDecorators(array('ViewHelper')); $weblinks_name->setDecorators(array('ViewHelper')); $weblinks_url->setDecorators(array('ViewHelper')); $weblinks_name_site1->setDecorators(array('InputWebsiteNameDecorator')); $weblinks_url_site1->setDecorators(array('InputWebsiteUrlDecorator')); $weblinks_name_site2->setDecorators(array('InputWebsiteNameDecorator')); $weblinks_url_site2->setDecorators(array('InputWebsiteUrlDecorator')); $weblinks_name_site3->setDecorators(array('InputWebsiteNameDecorator')); $weblinks_url_site3->setDecorators(array('InputWebsiteUrlDecorator')); $weblinks_name_site4->setDecorators(array('InputWebsiteNameDecorator')); $weblinks_url_site4->setDecorators(array('InputWebsiteUrlDecorator')); $weblinks_name_site5->setDecorators(array('InputWebsiteNameDecorator')); $weblinks_url_site5->setDecorators(array('InputWebsiteUrlDecorator')); $userlanguage->setDecorators(array('InputDecorator')); $userlanguageclear->setDecorators(array('ViewHelper')); $hometown->setDecorators(array('InputDecorator')); $hometownpublic->setDecorators(array('PublicDecorator')); $address->setDecorators(array('InputDecorator')); $addresspublic->setDecorators(array('PublicDecorator')); $usercountry->setDecorators(array('InputDecorator')); $usercountrypublic->setDecorators(array('PublicDecorator')); $usertimezone->setDecorators(array('InputDecorator')); $usertimezonepublic->setDecorators(array('PublicDecorator')); $employment->setDecorators(array('InputDecorator')); $employmentpublic->setDecorators(array('PublicDecorator')); $employer_organization->setDecorators(array('InputDecorator')); $employer_organizationpublic->setDecorators(array('PublicDecorator')); $subscribe['own_follows']->setDecorators(array('InputDecorator')); $subscribe['fvr_follows']->setDecorators(array('InputDecorator')); $subscribeclear->setDecorators(array('ViewHelper')); $save->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'openOnly' => true, 'id' => 'save_changes')))); $cancel->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'closeOnly' => true)))); $this->setDecorators(array('FormElements', 'Form')); }
public function getForm($data, $protection = 0) { $elementDecorators = array(array('Label'), array('ViewHelper'), array('Errors')); $form = new Zend_Form(); $form->setAction('/user/registration/first-form/')->setMethod('post'); //firstname field $firstName = new Zend_Form_Element_Text('firstname', array('maxLength' => '30', 'id' => 'name', 'validators' => array(array('stringLength', false, array(3, 100)), array('Alpha')))); if (isset($data['u_name'])) { $firstName->setValue($data['u_name']); } if ($protection) { $firstName->setAttrib('readonly', 'true'); } $firstName->setDecorators($elementDecorators); //lastname field $lastName = new Zend_Form_Element_Text('lastname', array('maxLength' => '30', 'id' => 'lname', 'validators' => array(array('stringLength', false, array(3, 100)), array('Alpha')))); $lastName->setDecorators($elementDecorators); if (isset($data['u_family_name'])) { $lastName->setValue($data['u_family_name']); } if ($protection) { $lastName->setAttrib('readonly', 'true'); } //selecting gender: Male (1) or Female (0) $gender = new Zend_Form_Element_Radio('sex', array('separator' => '', 'multiOptions' => array('1' => 'זכר ', '0' => 'נקבה'))); $gender->setDecorators($elementDecorators); $gender->setValue($data['u_sex_id']); if (isset($data['u_sex_id'])) { $gender->setValue($data['u_sex_id']); } if ($protection) { $gender->setAttrib('readonly', 'true'); } //birthday field: validation for yyyy-mm-dd input $birthday = new Zend_Form_Element_Text('datepicker', array('size' => 10)); $birthday->setDecorators($elementDecorators); if (isset($data['u_date_of_birth'])) { $birthday->setValue(date("d/m/Y", strtotime($data['u_date_of_birth']))); } if ($protection) { $birthday->setAttrib('readonly', 'true'); } //heigth $heigth = new Zend_Form_Element_Select('heigth', array()); for ($i = 120; $i <= 300; $i++) { $heigth->addMultiOption($i, $i); } $heigth->setDecorators($elementDecorators); if (isset($data['uht_height'])) { $heigth->setValue($data['uht_height']); } if ($protection) { $heigth->setAttrib('disabled', 'true'); } //weight $weight = new Zend_Form_Element_Select('weight', array('label' => '')); for ($i = 20; $i <= 300; $i++) { $weight->addMultiOption($i, $i); } $weight->setDecorators($elementDecorators); if (isset($data['uht_weight'])) { $weight->setValue($data['uht_weight']); } //email field with validation $email = new Zend_Form_Element_Text('email', array()); $email->addValidator(new Zend_Validate_EmailAddress()); $email->setDecorators($elementDecorators); if (isset($data['u_email'])) { $email->setValue($data['u_email']); } if ($protection) { $email->setAttrib('readonly', 'true'); } // password field $password1 = new Zend_Form_Element_Password('password1', array('id' => 'pass')); $password1->setDecorators($elementDecorators); // password confirmation field $password2 = new Zend_Form_Element_Password('password2', array('id' => 'c_pass')); $password2->addValidator(new User_Form_UserFirstFormPasswordValidator('password1')); $password2->setDecorators($elementDecorators); $state = new Zend_Form_Element_Select('state', array('requred' => true)); $state->setMultiOptions(array('1' => 'מדינה:')); $state->setDecorators($elementDecorators); if (isset($data['u_state'])) { $state->setValue($data['u_state']); } $address = new Zend_Form_Element_Text('address', array('required' => false, 'id' => 'full_adr')); $address->setDecorators($elementDecorators); if (isset($data['u_address'])) { $address->setValue($data['u_address']); } $pregnant = new Zend_Form_Element_Radio('pregnant', array('separator' => '', 'multioptions' => array('Yes' => 'לא', 'No' => 'כן'))); $pregnant->setDecorators($elementDecorators); if ($data['uht_pregnant']) { $pregnant->setValue($data['uht_pregnant']); } $pregnantSince = new Zend_Form_Element_Select('pregnantsince', array('id' => 'hz1')); $pregnantSince->setMultiOptions(array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9')); $pregnantSince->setDecorators($elementDecorators); if ($data['uht_pregnant']) { $pregnant->setValue($data['uht_pregnant']); } if ($data['uht_pregnant_since']) { $pregnantSince->setValue($data['uht_pregnant_since']); } $objectives = new Zend_Form_Element_Textarea('objectives', array('id' => 'obj', 'rows' => '20', 'cols' => '20')); if ($data['u_objectives']) { $objectives->setValue($data['u_objectives']); } $terms = new Zend_Form_Element_Checkbox('terms', array('required' => 'true,')); $heartPressure = new Zend_Form_Element_Checkbox('heartpressure', array()); $heartPressure->setDecorators($elementDecorators); if ($data['uht_heart_or_pb']) { $heartPressure->setChecked(true); } $diabetes = new Zend_Form_Element_Checkbox('diabetes', array()); $diabetes->setDecorators($elementDecorators); if ($data['uht_diabetes']) { $diabetes->setChecked(true); } $migrene = new Zend_Form_Element_Checkbox('migrene', array()); $migrene->setDecorators($elementDecorators); if ($data['uht_migrene']) { $migrene->setChecked(true); } $babies = new Zend_Form_Element_Checkbox('babies', array()); $babies->setDecorators($elementDecorators); if ($data['uht_babies']) { $babies->setChecked(true); } $nosleep = new Zend_Form_Element_Checkbox('nosleep', array()); $nosleep->setDecorators($elementDecorators); if ($data['uht_nosleep']) { $nosleep->setChecked(true); } $digestion = new Zend_Form_Element_Checkbox('digestion', array()); $digestion->setDecorators($elementDecorators); if ($data['uht_digestion']) { $digestion->setChecked(true); } $menopause = new Zend_Form_Element_Checkbox('menopause', array()); $menopause->setDecorators($elementDecorators); if ($data['uht_menopause']) { $menopause->setChecked(true); } $sclorosies = new Zend_Form_Element_Checkbox('sclorosies', array()); $sclorosies->setDecorators($elementDecorators); if ($data['uht_sclorosies']) { $sclorosies->setChecked(true); } $epilepsy = new Zend_Form_Element_Checkbox('epilepsy', array()); $epilepsy->setDecorators($elementDecorators); if ($data['uht_epilepsy']) { $epilepsy->setChecked(true); } $cancer = new Zend_Form_Element_Checkbox('cancer', array()); $cancer->setDecorators($elementDecorators); if ($data['uht_cancer']) { $cancer->setChecked(true); } $asthma = new Zend_Form_Element_Checkbox('asthma', array()); $asthma->setDecorators($elementDecorators); if ($data['uht_asthma']) { $asthma->setChecked(true); } $artritis = new Zend_Form_Element_Checkbox('artritis', array()); $artritis->setDecorators($elementDecorators); if ($data['uht_Artritis']) { $artritis->setChecked(true); } $hernia = new Zend_Form_Element_Checkbox('hernia', array()); $hernia->setDecorators($elementDecorators); if ($data['uht_hernia']) { $hernia->setChecked(true); } $depression = new Zend_Form_Element_Checkbox('depression', array()); $depression->setDecorators($elementDecorators); if ($data['uht_depression_or_anxiety']) { $depression->setChecked(true); } $headaches = new Zend_Form_Element_Checkbox('headaches', array()); $headaches->setDecorators($elementDecorators); if ($data['uht_headaches']) { $headaches->setChecked(true); } $fatigue = new Zend_Form_Element_Checkbox('fatigue', array()); $fatigue->setDecorators($elementDecorators); if ($data['uht_fatigue']) { $fatigue->setChecked(true); } $injury = new Zend_Form_Element_Checkbox('injury', array()); $injury->setDecorators($elementDecorators); if ($data['uht_injury']) { $injury->setChecked(true); } $injuryText = new Zend_Form_Element_Textarea('injurytext', array('id' => 'obj', 'rows' => '20', 'cols' => '20')); if ($data['uht_injury_text']) { $injuryText->setValue($data['uht_injury_text']); } $medication = new Zend_Form_Element_Checkbox('medication', array()); $medication->setDecorators($elementDecorators); if ($data['uht_medication']) { $medication->setChecked(true); } $medicationText = new Zend_Form_Element_Textarea('medicationtext', array('id' => 'obj', 'rows' => '20', 'cols' => '20')); if ($data['uht_which_medication']) { $medicationText->setValue($data['uht_which_medication']); } $walk = new Zend_Form_Element_Radio('walk', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא'))); if ($data['uht_walk']) { $walk->setValue($data['uht_walk']); } $walk->setDecorators($elementDecorators); $hands = new Zend_Form_Element_Radio('hands', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא'))); if ($data['uht_hands']) { $hands->setValue($data['uht_hands']); } $hands->setDecorators($elementDecorators); $legs = new Zend_Form_Element_Radio('legs', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא'))); if ($data['uht_sit']) { $legs->setValue($data['uht_sit']); } $legs->setDecorators($elementDecorators); $backashes = new Zend_Form_Element_Radio('backashes', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא'))); if ($data['uht_backashes']) { $backashes->setValue($data['uht_backashes']); } $backashes->setDecorators($elementDecorators); if ($protection) { $backashes->setAttrib('disabled', 'true'); } $slippedDisk = new Zend_Form_Element_Radio('disc', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא'))); if ($protection) { $slippedDisk->setAttrib('disabled', 'true'); } if ($data['uht_slipped_disk']) { $slippedDisk->setValue($data['uht_slipped_disk']); } $slippedDisk->setDecorators($elementDecorators); $generalQuestionsText1 = new Zend_Form_Element_Text('general1', array('id' => 'f_1')); $generalQuestionsText2 = new Zend_Form_Element_Text('general2', array('id' => 'f_2')); $generalQuestionsText3 = new Zend_Form_Element_Text('general3', array('id' => 'f_3')); $generalQuestionsText1->setDecorators($elementDecorators); if ($protection) { $generalQuestionsText1->setAttrib('readonly', 'true'); $generalQuestionsText2->setAttrib('readonly', 'true'); $generalQuestionsText3->setAttrib('readonly', 'true'); } $generalQuestionsText2->setDecorators($elementDecorators); $generalQuestionsText3->setDecorators($elementDecorators); if (isset($data['uht_general1'])) { $generalQuestionsText1->setValue($data['uht_general1']); } if (isset($data['uht_general2'])) { $generalQuestionsText2->setValue($data['uht_general2']); } if (isset($data['uht_general3'])) { $generalQuestionsText3->setValue($data['uht_general3']); } $lowerback = new Zend_Form_Element_Checkbox('lowerback', array()); $lowerback->setDecorators($elementDecorators); if ($data['uht_lower_back']) { $lowerback->setChecked(true); } $upperback = new Zend_Form_Element_Checkbox('upperback', array()); $upperback->setDecorators($elementDecorators); if ($data['uht_upper_back']) { $upperback->setChecked(true); } $feet = new Zend_Form_Element_Checkbox('feet', array()); $feet->setDecorators($elementDecorators); if ($data['uht_ankles_and_feet']) { $feet->setChecked(true); } $neck = new Zend_Form_Element_Checkbox('neck', array()); $neck->setDecorators($elementDecorators); if ($data['uht_neck_and_shoulders']) { $neck->setChecked(true); } $breath = new Zend_Form_Element_Checkbox('breath', array()); $breath->setDecorators($elementDecorators); if ($data['uht_breath']) { $breath->setChecked(true); } $pelvis = new Zend_Form_Element_Checkbox('pelvis', array()); $pelvis->setDecorators($elementDecorators); if ($data['uht_thighs_or_pelvis']) { $pelvis->setChecked(true); } $knees = new Zend_Form_Element_Checkbox('knees', array()); $knees->setDecorators($elementDecorators); if ($data['uht_thighs_or_pelvis']) { $knees->setChecked(true); } $wrists = new Zend_Form_Element_Checkbox('wrists', array()); $wrists->setDecorators($elementDecorators); if ($data['uht_wrists']) { $wrists->setChecked(true); } $head = new Zend_Form_Element_Checkbox('head', array()); $head->setDecorators($elementDecorators); if ($data['uht_head']) { $head->setChecked(true); } $ankles = new Zend_Form_Element_Checkbox('ankles', array()); $ankles->setDecorators($elementDecorators); if ($data['uht_ankles']) { $ankles->setChecked(true); } $externalMails = new Zend_Form_Element_Checkbox('external', array()); $externalMails->setDecorators($elementDecorators); if ($data['u_external_emails']) { $externalMails->setChecked(true); } $moreInfo = new Zend_Form_Element_Textarea('moreinfo', array('id' => 'obj', 'rows' => '20', 'cols' => '20')); if ($data['uht_more_info']) { $moreInfo->setValue($data['uht_more_info']); } $form->addElements(array($firstName, $lastName, $gender, $birthday, $heigth, $weight, $email, $password1, $password2, $state, $address, $pregnant, $pregnantSince, $objectives, $terms, $heartPressure, $diabetes, $migrene, $babies, $nosleep, $digestion, $menopause, $sclorosies, $epilepsy, $cancer, $asthma, $artritis, $hernia, $depression, $fatigue, $headaches, $injury, $injuryText, $medication, $medicationText, $walk, $hands, $legs, $backashes, $slippedDisk, $generalQuestionsText1, $generalQuestionsText2, $generalQuestionsText3, $lowerback, $upperback, $feet, $neck, $breath, $pelvis, $knees, $wrists, $head, $ankles, $moreInfo, $externalMails)); return $form; }
/** * * General settings * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/Settings.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $limit_posts = new Zend_Form_Element_Text('limit_posts'); $limit_posts->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Max posts per page'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['limit_posts']) ? $all_meta['limit_posts'] : '5')->setAttrib('class', 'form-control'); $max_post_length = new Zend_Form_Element_Text('max_post_length'); $max_post_length->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Max post length'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['max_post_length']) ? $all_meta['max_post_length'] : '2000')->setAttrib('class', 'form-control'); $limit_comments = new Zend_Form_Element_Text('limit_comments'); $limit_comments->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Number of visible comments per resource'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['limit_comments']) ? $all_meta['limit_comments'] : '3')->setAttrib('class', 'form-control'); $pagination_limit = new Zend_Form_Element_Text('pagination_limit'); $pagination_limit->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Pagination limit'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['pagination_limit']) ? $all_meta['pagination_limit'] : '10')->setAttrib('class', 'form-control'); $max_scroll_fetches = new Zend_Form_Element_Text('max_scroll_fetches'); $max_scroll_fetches->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Maximum fetches on infinite scroll (0 = no limit)'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['max_scroll_fetches']) ? $all_meta['max_scroll_fetches'] : '0')->setAttrib('class', 'form-control'); $languages_array = array_merge(array('' => ''), Zend_Registry::get('languages_array')); $default_language = new Zend_Form_Element_Select('default_language'); $default_language->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions($languages_array)->setLabel($this->translator->translate('Choose default language'))->setRequired(true)->setValue(isset($all_meta['default_language']) ? $all_meta['default_language'] : '')->setAttrib('class', 'form-control'); $username_minchars = new Zend_Form_Element_Text('username_minchars'); $username_minchars->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Min chars for username'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['username_minchars']) ? $all_meta['username_minchars'] : '5')->setAttrib('class', 'form-control'); $username_maxchars = new Zend_Form_Element_Text('username_maxchars'); $username_maxchars->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Max chars for username'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['username_maxchars']) ? $all_meta['username_maxchars'] : '20')->setAttrib('class', 'form-control'); $sidebar_max_users = new Zend_Form_Element_Text('sidebar_max_users'); $sidebar_max_users->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Max users to show on sidebar boxes'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['sidebar_max_users']) ? $all_meta['sidebar_max_users'] : '3')->setAttrib('class', 'form-control'); $user_manage_groups = new Zend_Form_Element_Checkbox('user_manage_groups'); $user_manage_groups->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['user_manage_groups']) && $all_meta['user_manage_groups'] == 1 ? 1 : 0)->setLabel($this->translator->translate('User can manage groups'))->setCheckedValue("1")->setUncheckedValue("0"); $user_manage_pages = new Zend_Form_Element_Checkbox('user_manage_pages'); $user_manage_pages->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['user_manage_pages']) && $all_meta['user_manage_pages'] == 1 ? 1 : 0)->setLabel($this->translator->translate('User can manage pages'))->setCheckedValue("1")->setUncheckedValue("0"); $disable_groups_pages = new Zend_Form_Element_Checkbox('disable_groups_pages'); $disable_groups_pages->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['disable_groups_pages']) && $all_meta['disable_groups_pages'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable groups and pages feature (only admin can manage them)'))->setCheckedValue("1")->setUncheckedValue("0"); $user_activation_disabled = new Zend_Form_Element_Checkbox('user_activation_disabled'); $user_activation_disabled->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['user_activation_disabled']) && $all_meta['user_activation_disabled'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable user activation after registration'))->setCheckedValue("1")->setUncheckedValue("0"); $allow_addons = new Zend_Form_Element_Checkbox('allow_addons'); $allow_addons->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['allow_addons']) && $all_meta['allow_addons'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Load addons'))->setCheckedValue("1")->setUncheckedValue("0"); $disable_ajax_validator = new Zend_Form_Element_Checkbox('disable_ajax_validator'); $disable_ajax_validator->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['disable_ajax_validator']) && $all_meta['disable_ajax_validator'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable Ajax form validation'))->setCheckedValue("1")->setUncheckedValue("0"); $newuser_notify_email = new Zend_Form_Element_Text('newuser_notify_email'); $newuser_notify_email->addValidator('EmailAddress', true)->addFilter('StringToLower')->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('When new user signs up send notification to this email'))->setValue(isset($all_meta['newuser_notify_email']) ? $all_meta['newuser_notify_email'] : '')->setAttrib('class', 'form-control'); $report_notify_email = new Zend_Form_Element_Text('report_notify_email'); $report_notify_email->addValidator('EmailAddress', true)->addFilter('StringToLower')->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('When resource is reported send notification to this email'))->setValue(isset($all_meta['report_notify_email']) ? $all_meta['report_notify_email'] : '')->setAttrib('class', 'form-control'); $auto_follow_users = new Zend_Form_Element_Text('auto_follow_users'); $auto_follow_users->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Upon registration follow these users (usernames separated by comma)'))->setValue(isset($all_meta['auto_follow_users']) ? $all_meta['auto_follow_users'] : '')->setAttrib('class', 'form-control'); $heartbeatfreq = new Zend_Form_Element_Text('heartbeatfreq'); $heartbeatfreq->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Notification freqency in seconds (heartbeat)'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['heartbeatfreq']) ? $all_meta['heartbeatfreq'] : '5')->setAttrib('class', 'form-control'); $session_lifetime = new Zend_Form_Element_Text('session_lifetime'); $session_lifetime->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Session lifetime (Remember me) time in seconds. Set to 0 to use php server settings.'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['session_lifetime']) ? $all_meta['session_lifetime'] : '0')->setAttrib('class', 'form-control'); $recaptcha_active = new Zend_Form_Element_Checkbox('recaptcha_active'); $recaptcha_active->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['recaptcha_active']) && $all_meta['recaptcha_active'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Use ReCaptcha'))->setCheckedValue("1")->setUncheckedValue("0"); $recaptcha_privatekey = new Zend_Form_Element_Text('recaptcha_privatekey'); $recaptcha_privatekey->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('ReCaptcha Private Key'))->setValue(isset($all_meta['recaptcha_privatekey']) ? $all_meta['recaptcha_privatekey'] : '123456789')->setAttrib('class', 'form-control'); $recaptcha_publickey = new Zend_Form_Element_Text('recaptcha_publickey'); $recaptcha_publickey->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('ReCaptcha Public Key'))->setValue(isset($all_meta['recaptcha_publickey']) ? $all_meta['recaptcha_publickey'] : '123456789')->setAttrib('class', 'form-control'); $facebook_appid = new Zend_Form_Element_Text('facebook_appid'); $facebook_appid->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Facebook app id'))->setValue(isset($all_meta['facebook_appid']) ? $all_meta['facebook_appid'] : '123456789')->setAttrib('class', 'form-control'); $facebook_secret = new Zend_Form_Element_Text('facebook_secret'); $facebook_secret->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Facebook secret'))->setValue(isset($all_meta['facebook_secret']) ? $all_meta['facebook_secret'] : '123456789')->setAttrib('class', 'form-control'); $allow_guests = new Zend_Form_Element_Checkbox('allow_guests'); $allow_guests->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['allow_guests']) && $all_meta['allow_guests'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Allow public posts so the guests can explore the site'))->setCheckedValue("1")->setUncheckedValue("0"); $submit = new Zend_Form_Element_Submit('submitbtn'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($default_language, $facebook_appid, $facebook_secret, $allow_addons, $user_manage_groups, $user_manage_pages, $disable_groups_pages, $user_activation_disabled, $allow_guests, $disable_ajax_validator, $limit_posts, $max_post_length, $limit_comments, $pagination_limit, $max_scroll_fetches, $newuser_notify_email, $report_notify_email, $auto_follow_users, $username_minchars, $username_maxchars, $sidebar_max_users, $heartbeatfreq, $session_lifetime, $recaptcha_active, $recaptcha_publickey, $recaptcha_privatekey, $submit)); $this->postInit(); }
public function init() { /** * salao_cnpj */ $salao_cnpj = new Zend_Form_Element_Text("salao_cnpj"); $salao_cnpj->setLabel("CNPJ: "); $salao_cnpj->setRequired(); $salao_cnpj->addValidator(new App_Validate_Cnpj()); $salao_cnpj->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o CNPJ')); $salao_cnpj->setDecorators(App_Forms_Decorators::$simpleElementDecorators); /** * salao_salao */ $salao_salao = new Zend_Form_Element_Text('salao_nome'); $salao_salao->setLabel('Nome do Salão: '); $salao_salao->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o nome do salão')); $salao_salao->setRequired(); $salao_salao->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); $salao_salao->setDecorators(App_Forms_Decorators::$simpleElementDecorators); /** * salao_nome */ $salao_nome = new Zend_Form_Element_Text('salao_proprietario'); $salao_nome->setLabel('Nome Proprietário: '); $salao_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o nome do proprietário')); $salao_nome->setRequired(); $salao_nome->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); $salao_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); /** * salao_email */ $salao_email = new Zend_Form_Element_Text('salao_email'); $salao_email->setLabel('E-mail: '); $salao_email->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o e-mail de contato')); $salao_email->setRequired(); $salao_email->addValidator(new App_Validate_Salao()); $salao_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators); /** * senha */ $senha = new Zend_Form_Element_Password('senha'); $senha->setLabel("Senha: "); $senha->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe a senha')); $senha->setRequired(); $senha->setDecorators(App_Forms_Decorators::$simpleElementDecorators); /** * salao_contato */ $salao_contato = new Zend_Form_Element_Text('salao_contato'); $salao_contato->setLabel('Telefone: '); $salao_contato->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe um telefone de contato')); $salao_contato->setRequired(); $salao_contato->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); $salao_contato->setDecorators(App_Forms_Decorators::$simpleElementDecorators); /** * profisional_cep */ $salao_cep = new Zend_Form_Element_Text('salao_cep'); $salao_cep->setLabel('CEP: '); $salao_cep->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o cep do salão')); $salao_cep->setRequired(); $salao_cep->addValidator(new App_Validate_Cep()); $salao_cep->setDecorators(App_Forms_Decorators::$simpleElementDecorators); /** * profisional_logradouro */ $salao_logradouro = new Zend_Form_Element_Text('salao_logradouro'); $salao_logradouro->setLabel("Logradouro: "); $salao_logradouro->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o logradouro', 'readonly' => true)); $salao_logradouro->setRequired(); $salao_logradouro->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); $salao_logradouro->setDecorators(App_Forms_Decorators::$simpleElementDecorators); //$salao_logradouro->setOrder(7); /** * sala_numero */ $salao_numero = new Zend_Form_Element_Text('salao_numero'); $salao_numero->setLabel('Número: '); $salao_numero->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o numero')); $salao_numero->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_numero->setRequired(); $salao_numero->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); /** * sala_complemento */ $salao_complemento = new Zend_Form_Element_Text('salao_complemento'); $salao_complemento->setLabel('Complemento: '); $salao_complemento->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o complemento')); //$salao_complemento->setRequired(); /** * profisional_bairro */ $salao_bairro = new Zend_Form_Element_Text('salao_bairro'); $salao_bairro->setLabel("Bairro: "); $salao_bairro->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o bairro', 'readonly' => true)); $salao_bairro->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_bairro->setRequired(); $salao_bairro->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); /** * profisional_cidade */ $salao_cidade = new Zend_Form_Element_Text('salao_cidade'); $salao_cidade->setLabel('Cidade: '); $salao_cidade->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe a cidade', 'readonly' => true)); $salao_cidade->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_cidade->setRequired(); $salao_cidade->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); /** * estado_id */ $formEstado = new App_Forms_Estado("estado_id"); $estado_id = $formEstado->elementEstado(); $estado_id->setLabel('Estado: '); $estado_id->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $estado_id->setRequired(); $estado_id->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); $estado_id->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o estado', 'readonly' => true)); /** * salao_cupom */ $salao_cupom = new Zend_Form_Element_Text('salao_cupom'); $salao_cupom->setLabel('Cupom Promocional: '); $salao_cupom->setAttribs(array('class' => 'form-control', 'placeholder' => 'Tem cupom promocional?')); $salao_cupom->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // salao_politica_termo $salao_politica_termo = new Zend_Form_Element_Checkbox('salao_politica_termo'); $salao_politica_termo->setLabel(" \n Li e concordo com a \n <a href='' data-toggle='modal' data-target='#modal-politica'>Política de Privacidade</a> e \n <a href='' data-toggle='modal' data-target='#modal-termo'>Termo de Uso</a>.\n "); $salao_politica_termo->setDecorators(App_Forms_Decorators::$checkboxElementDecorators_termo); //$salao_politica_termo->addDecorator(); //$salao_politica_termo->setValue(0); //$salao_politica_termo->setCheckedValue('') ; $salao_politica_termo->setUnCheckedValue(''); $salao_politica_termo->setRequired(); $salao_politica_termo->addErrorMessage('Você precisa concordar com nossa Pólitica de Privacidade e Termo de Uso'); /** * Add elements */ $this->addElements(array($salao_salao, $salao_nome, $salao_contato, $salao_email, $senha, $salao_cep, $salao_logradouro, $salao_numero, $salao_complemento, $salao_bairro, $salao_cidade, $estado_id, $salao_cupom, $salao_politica_termo)); parent::init(); $this->getElement('submit')->setLabel('Cadastrar'); }
private function _certificados_liberados() { $e = new Zend_Form_Element_Checkbox('certificados_liberados'); $e->setLabel("* Certificados liberados? "); $e->setDecorators(array('ViewHelper', 'Description', 'Errors', array('HtmlTag', ''), array('Label', ''))); return $e; }