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'); }
public function init() { $obj = new Application_Model_DbTable_Text(); $primaryKey = $obj->getPrimaryKey(); $this->setMethod('post'); $this->setEnctype('multipart/form-data'); $this->setAttrib('idtext', $primaryKey); $this->setAction('/admin/text/new'); $e = new Zend_Form_Element_Hidden($primaryKey); $this->addElement($e); $this->addElement($e); $e = new Zend_Form_Element_Checkbox('estado'); $e->setValue(true); $this->addElement($e); $e = new Zend_Form_Element_Text('url'); $this->addElement($e); $e = new Zend_Form_Element_Text('descripcion'); $this->addElement($e); $e = new Zend_Form_Element_Text('alt'); $this->addElement($e); foreach ($this->getElements() as $element) { $element->removeDecorator('Label'); $element->removeDecorator('DtDdWrapper'); $element->removeDecorator('HtmlTag'); } }
public function init() { $obj = new Application_Model_DbTable_Link(); $primaryKey = $obj->getPrimaryKey(); $this->setMethod('post'); $this->setEnctype('multipart/form-data'); $this->setAttrib('idlink', $primaryKey); $this->setAction('/link/index'); $e = new Zend_Form_Element_Hidden($primaryKey); $this->addElement($e); $e = new Zend_Form_Element_Checkbox('chkEstado[]'); $e->setValue(true); $this->addElement($e); $e = new Zend_Form_Element_Text('txtTitulo[]'); $this->addElement($e); $e = new Zend_Form_Element_Text('txtLink[]'); $this->addElement($e); $e = new Zend_Form_Element_Hidden('txtImagen[]'); $this->addElement($e); foreach ($this->getElements() as $element) { $element->removeDecorator('Label'); $element->removeDecorator('DtDdWrapper'); $element->removeDecorator('HtmlTag'); } }
public function init() { $seoFilter = new Core_Utils_SeoUrl(); $objProj = new Admin_Model_Project(); $obj = new Application_Model_DbTable_Banner(); $primaryKey = $obj->getPrimaryKey(); $this->setMethod('post'); $this->setEnctype('multipart/form-data'); $this->setAttrib('idbanner', $primaryKey); $this->setAction('/banner/new'); $e = new Zend_Form_Element_Hidden($primaryKey); $this->addElement($e); $e = new Zend_Form_Element_Select('codproy'); $e->setMultiOptions($objProj->getFetchPairsAllProjects()); $this->addElement($e); $i = new Zend_Form_Element_File('nombre'); $this->addElement($i); $this->getElement('nombre')->setDestination(ROOT_IMG_DINAMIC . '/banner/origin/')->addValidator('Size', false, 10024000)->addValidator('Extension', true, 'jpg,png,gif,jpeg')->setRequired(false); $e = new Zend_Form_Element_Text('titulo'); $this->addElement($e); $e = new Zend_Form_Element_Textarea('descripcion'); $this->addElement($e); $e = new Zend_Form_Element_Text('fechainicio'); $this->addElement($e); $e = new Zend_Form_Element_Text('fechafin'); $this->addElement($e); $e = new Zend_Form_Element_Checkbox('vchestado'); $e->setValue(true); $this->addElement($e); foreach ($this->getElements() as $element) { $element->removeDecorator('Label'); $element->removeDecorator('DtDdWrapper'); $element->removeDecorator('HtmlTag'); } }
public function init() { $this->setName(strtolower(get_class())); $this->setMethod("post"); $oFormName = new Zend_Form_Element_Hidden("form_name"); $oFormName->setValue(get_class()); $oFormName->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oFormName); $oMessage = new Zend_Form_Element_Textarea("message"); $oMessage->setFilters($this->_aFilters); $oMessage->setRequired(FALSE); $oMessage->removeDecorator("label"); $this->addElement($oMessage); $oIsDing = new Zend_Form_Element_Checkbox("is_ding"); $oIsDing->setLabel("Włącz dźwięk"); $oIsDing->setValue(1); $this->addElement($oIsDing); $oSubmit = new Zend_Form_Element_Submit("send_message"); $oSubmit->setLabel("Wyślij wiadomość"); $this->addElement($oSubmit); $oViewScript = new Zend_Form_Decorator_ViewScript(); $oViewScript->setViewModule("admin"); $oViewScript->setViewScript("_forms/chat.phtml"); $this->clearDecorators(); $this->setDecorators(array(array($oViewScript))); $oElements = $this->getElements(); foreach ($oElements as $oElement) { $oElement->setFilters($this->_aFilters); $oElement->removeDecorator("Errors"); } }
public function init() { $obj = new Application_Model_DbTable_Juego(); $primaryKey = $obj->getPrimaryKey(); $this->setMethod('post'); $this->setEnctype('multipart/form-data'); $this->setAttrib('idjuego', $primaryKey); $this->setAction('/admin/juego/new'); $e = new Zend_Form_Element_Hidden($primaryKey); $this->addElement($e); $this->addElement($e); $e = new Zend_Form_Element_Checkbox('estado'); $e->setValue(true); $this->addElement($e); $e = new Zend_Form_Element_Text('url'); $this->addElement($e); $e = new Zend_Form_Element_Text('nombre'); $this->addElement($e); $i = new Zend_Form_Element_File('avanzado'); $this->addElement($i); $this->getElement('avanzado')->setDestination(ROOT_IMG_DINAMIC . '/juego/avanzado/')->addValidator('Size', false, 10024000)->addValidator('Extension', true, 'jpg,png,gif,jpeg')->setRequired(false); $i = new Zend_Form_Element_File('basico360'); $this->addElement($i); $this->getElement('basico360')->setDestination(ROOT_IMG_DINAMIC . '/juego/basico360/')->addValidator('Size', false, 10024000)->addValidator('Extension', true, 'jpg,png,gif,jpeg')->setRequired(false); foreach ($this->getElements() as $element) { $element->removeDecorator('Label'); $element->removeDecorator('DtDdWrapper'); $element->removeDecorator('HtmlTag'); } }
public function renderFormElement() { $elm = new Zend_Form_Element_Checkbox($this->getName(), array('label' => $this->getLabel() . ':')); $elm->setDescription($this->getDescription()); $elm->setValue($this->getValue()); $elm->setRequired($this->getRequired()); return $elm; }
public function frm_table_time_charge($data = null) { $menu_code = new Zend_Form_Element_Text('menu_code'); $menu_code->setAttribs(array('class' => 'form-control')); $description = new Zend_Form_Element_Text('description'); $description->setAttribs(array('class' => 'form-control', 'required' => true)); $amount_to_charge = new Zend_Form_Element_Text('amount_to_charge'); $amount_to_charge->setAttribs(array('class' => 'form-control')); $free_amt = new Zend_Form_Element_Text('free_amt'); $free_amt->setAttribs(array('class' => 'form-control')); $child = new Zend_Form_Element_Text('child'); $child->setAttribs(array('checked' => 'checked', 'class' => 'form-control')); $show_description = new Zend_Form_Element_Text('show_description'); $show_description->setAttribs(array('class' => 'form-control')); $photo = new Zend_Form_Element_File('photo'); $background = new Zend_Form_Element_Text('background'); $background->setAttribs(array('class' => 'form-control color-picker-rgba')); $font_color = new Zend_Form_Element_Text('font_color'); $font_color->setAttribs(array('class' => 'form-control', 'id' => "selected-color1")); $interval_time = new Zend_Form_Element_Text('interval_time'); $interval_time->setAttribs(array('class' => 'form-control')); $apply = new Zend_Form_Element_Select('apply'); $apply->setAttribs(array('class' => 'form-control')); $apply_opt = array("" => $this->tr->translate("SELECT_APPLY_TO_COMPANY")); $apply->setMultiOptions($apply_opt); $combo = new Zend_Form_Element_Checkbox('combo'); $combo->setAttribs(array('class' => 'red')); $active = new Zend_Form_Element_Checkbox('active'); $active->setAttribs(array('class' => 'form-control')); $execute_number = new Zend_Form_Element_Text('execute_number'); $execute_number->setAttribs(array('class' => 'form-control')); $setting = new Zend_Form_Element_Select('setting'); $setting->setAttribs(array('class' => 'form-control')); $setting_opt = array("" => $this->tr->translate("SELECT_SETTING")); $setting->setMultiOptions($setting_opt); $arrange = new Zend_Form_Element_Text('arrange'); $arrange->setAttribs(array('class' => 'form-control')); $resize = new Zend_Form_Element_Text('resize'); $resize->setAttribs(array('class' => 'form-control', 'id' => "resize", 'value' => 12, 'placeholder' => '12')); $note = new Zend_Form_Element_Textarea('note'); $note->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 100px;")); $id = new Zend_Form_Element_Hidden('id'); if ($data != null) { // print_r($data); $id->setValue($data['id']); $description->setValue($data['description']); $interval_time->setValue($data['time_interval']); $execute_number->setValue($data['execute_amount']); $amount_to_charge->setValue($data['fee_charge']); $free_amt->setValue($data['free_amount']); $child->setValue($data['chil_per']); $active->setValue($data['nul_mul']); } $this->addElements(array($id, $apply, $active, $combo, $menu_code, $description, $amount_to_charge, $free_amt, $child, $show_description, $background, $font_color, $interval_time, $execute_number, $setting, $arrange, $resize, $note)); return $this; }
/** * Builds a form form data * @return unknown_type */ private function _prepareForm() { !isset($this->_options) ? $this->_options = array() : null; !isset($this->_options[self::DATA]) ? $this->_options[self::DATA] = array() : null; $action = $this->_options[self::ACTION]; $model = $this->_options[self::MODEL]; $this->setAction($action); $this->setMethod('post'); foreach ($this->_options[self::DATA] as $fieldName => $fieldValue) { if ($model->isLocked($fieldName)) { continue; } $typeElement = $model->getTypeElement($fieldName); try { if ($typeElement == Fgsl_Form_Constants::TEXT) { $text = new Zend_Form_Element_Text($fieldName); } if ($typeElement == Fgsl_Form_Constants::PASSWORD) { $text = new Zend_Form_Element_Password($fieldName); } if ($typeElement == Fgsl_Form_Constants::SELECT) { $text = new Zend_Form_Element_Select($fieldName); $selectOptions = $model->getSelectOptions($fieldName); $text->addMultiOptions($selectOptions); } if ($typeElement == Fgsl_Form_Constants::CHECKBOX) { $text = new Zend_Form_Element_Checkbox($fieldName); } $text->setLabel($model->getFieldLabel($fieldName)); isset($this->_options[self::DATA][$fieldName]) ? $text->setValue($this->_options[self::DATA][$fieldName]) : ''; if (isset($this->_options['readonly'])) { if (array_key_exists($fieldName, $this->_options['readonly'])) { $text->setAttrib('readonly', 'readonly'); } } $this->addElement($text); } catch (Exception $e) { return null; } } /** * Stores primary key value into a HTML hidden element */ if ($this->_options[self::DATA][$model->getFieldKey()] !== '') { $text = new Zend_Form_Element_Hidden($model->getFieldKey()); $text->setValue($model->getKeyValue($this->_options[self::DATA])); $this->addElement($text); } $formType = $this->_options[self::DATA][$model->getFieldKey()] === '' ? $this->_getLabel(self::INSERT_LABEL) : $this->_getLabel(self::EDIT_LABEL); $text = new Zend_Form_Element_Submit(ucfirst($formType)); $this->addElement($text); $text = new Zend_Form_Element_Submit('Return'); $text->setAttrib('name', 'return'); $this->addElement($text); return $this; }
/** * @see Zend_Form_Element_Checkbox::setValue */ public function setValue($value) { if ('on' === $value) { $this->_value = $this->getCheckedValue(); $this->checked = true; return $this; } else { return parent::setValue($value); } }
public function init() { parent::init(); $element = new Zend_Form_Element_Checkbox('useExisting'); $element->setRequired(true); $element->setValue(1); $element->setLabel('Use existing image:'); $this->useExisting = $element; $this->addElement('hidden', 'existingFilename', array('required' => true, 'ignore' => false, 'decorators' => array('ViewHelper'))); }
public function init() { $obj = new Application_Model_DbTable_User(); $primaryKey = $obj->getPrimaryKey(); $this->setMethod('post'); $this->setEnctype('multipart/form-data'); $this->setAttrib('iduser', $primaryKey); $this->setAction('/admin/usuarios/edit'); $e = new Zend_Form_Element_Hidden($primaryKey); $this->addElement($e); $objType = new Admin_Model_Role(); $e = new Zend_Form_Element_Select('idrol'); $e->setMultiOptions($objType->getRoleAll()); $this->addElement($e); $e = new Zend_Form_Element_Text('email'); $e->setAttrib('class', 'inpt-medium'); $e->setAttrib('placeholder', 'Correo'); $this->addElement($e); $e = new Zend_Form_Element_Text('login'); $e->setAttrib('class', 'inpt-medium'); $e->setAttrib('placeholder', 'usuario'); $this->addElement($e); $e = new Zend_Form_Element_Text('name'); $e->setAttrib('class', 'inpt-medium'); $e->setAttrib('placeholder', 'nombre'); $this->addElement($e); $e = new Zend_Form_Element_Text('apepat'); $e->setAttrib('class', 'inpt-medium'); $e->setAttrib('placeholder', 'Apellido Paterno'); $this->addElement($e); $e = new Zend_Form_Element_Text('apemat'); $e->setAttrib('class', 'inpt-medium'); $e->setAttrib('placeholder', 'Apellido Materno'); $this->addElement($e); $e = new Zend_Form_Element_Submit('Guardar'); $this->addElement($e); $e = new Zend_Form_Element_Checkbox('state'); $e->setValue(true); $this->addElement($e); $e = new Zend_Form_Element_Password('confirmone'); $e->setRequired(false); $e->setAttrib('class', 'inpt-medium'); $e->setAttrib('placeholder', 'Contraseña'); $this->addElement($e); $e = new Zend_Form_Element_Password('confirmtwo'); $e->setRequired(false); $e->setAttrib('class', 'inpt-medium'); $e->setAttrib('placeholder', 'Repetir Contraseña'); $this->addElement($e); foreach ($this->getElements() as $element) { $element->removeDecorator('Label'); $element->removeDecorator('DtDdWrapper'); $element->removeDecorator('HtmlTag'); } }
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() { $obj = new Application_Model_DbTable_Banner(); $primaryKey = $obj->getPrimaryKey(); $this->setMethod('post'); $this->setEnctype('multipart/form-data'); $this->setAttrib('idtCp', $primaryKey); $this->setAction('/cp/new'); $e = new Zend_Form_Element_Hidden($primaryKey); $this->addElement($e); $e = new Zend_Form_Element_Select('posicion'); $e->setMultiOptions(array(1 => 'BANNER 1', 2 => 'BANNER 2', 3 => 'BANNER 3', 4 => 'BANNER 4', 5 => 'BANNER 5', 6 => 'BANNER 6', 7 => 'BANNER 7', 8 => 'BANNER 8', 9 => 'BANNER 9', 10 => 'BANNER 10')); $this->addElement($e); $e = new Zend_Form_Element_Checkbox('estado'); $e->setValue(true); $this->addElement($e); $e = new Zend_Form_Element_Text('descripcion'); $this->addElement($e); $e = new Zend_Form_Element_Text('enlace'); $this->addElement($e); $e = new Zend_Form_Element_Text('alt'); $this->addElement($e); $i = new Zend_Form_Element_File('avanzado'); $this->addElement($i); $this->getElement('avanzado')->setDestination(ROOT_IMG_DINAMIC . '/banners/avanzado/')->addValidator('Size', false, 10024000)->addValidator('Extension', true, 'jpg,png,gif,jpeg')->setRequired(false); // // $i = new Zend_Form_Element_Image('submitImage'); // $this->addElement($i); // $this->getElement('submitImage') // ->setImage(ROOT_IMG_DINAMIC . '/banners/avanzado/nxqbhjpgckomuzi.gif'); // // $i = new Zend_Form_Element_File('basico128'); $this->addElement($i); $this->getElement('basico128')->setDestination(ROOT_IMG_DINAMIC . '/banners/basico128/')->addValidator('Size', false, 10024000)->addValidator('Extension', true, 'jpg,png,gif,jpeg')->setRequired(false); $i = new Zend_Form_Element_File('basico240'); $this->addElement($i); $this->getElement('basico240')->setDestination(ROOT_IMG_DINAMIC . '/banners/basico240/')->addValidator('Size', false, 10024000)->addValidator('Extension', true, 'jpg,png,gif,jpeg')->setRequired(false); $i = new Zend_Form_Element_File('basico360'); $this->addElement($i); $this->getElement('basico360')->setDestination(ROOT_IMG_DINAMIC . '/banners/basico360/')->addValidator('Size', false, 10024000)->addValidator('Extension', true, 'jpg,png,gif,jpeg')->setRequired(false); foreach ($this->getElements() as $element) { $element->removeDecorator('Label'); $element->removeDecorator('DtDdWrapper'); $element->removeDecorator('HtmlTag'); } }
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); }
public function init() { $obj = new Application_Model_DbTable_Banner2(); $primaryKey = $obj->getPrimaryKey(); $this->setMethod('post'); $this->setEnctype('multipart/form-data'); $this->setAttrib('idbanner', $primaryKey); $this->setAction('/banner2/index'); $e = new Zend_Form_Element_Hidden($primaryKey); $this->addElement($e); $e = new Zend_Form_Element_Checkbox('chkEstado[]'); $e->setValue(true); $this->addElement($e); $e = new Zend_Form_Element_Text('txtTitulo[]'); $this->addElement($e); $e = new Zend_Form_Element_Text('txtLink[]'); $this->addElement($e); $e = new Zend_Form_Element_Hidden('txtImagen[]'); $this->addElement($e); $e = new Zend_Form_Element_Hidden('txtNombre[]'); $this->addElement($e); $i = new Zend_Form_Element_File('avanzado'); $this->addElement($i); $this->getElement('avanzado[]')->setDestination(ROOT_IMG_DINAMIC . '/banner/avanzado/')->addValidator('Size', false, 10024000)->addValidator('Extension', true, 'jpg,png,gif,jpeg')->setRequired(false); $i = new Zend_Form_Element_File('basico128'); $this->addElement($i); $this->getElement('basico128[]')->setDestination(ROOT_IMG_DINAMIC . '/banner/basico128/')->addValidator('Size', false, 10024000)->addValidator('Extension', true, 'jpg,png,gif,jpeg')->setRequired(false); $i = new Zend_Form_Element_File('basico240'); $this->addElement($i); $this->getElement('basico240[]')->setDestination(ROOT_IMG_DINAMIC . '/banner/basico240/')->addValidator('Size', false, 10024000)->addValidator('Extension', true, 'jpg,png,gif,jpeg')->setRequired(false); $i = new Zend_Form_Element_File('basico360'); $this->addElement($i); $this->getElement('basico360[]')->setDestination(ROOT_IMG_DINAMIC . '/banner/basico360/')->addValidator('Size', false, 10024000)->addValidator('Extension', true, 'jpg,png,gif,jpeg')->setRequired(false); foreach ($this->getElements() as $element) { $element->removeDecorator('Label'); $element->removeDecorator('DtDdWrapper'); $element->removeDecorator('HtmlTag'); } }
public function init() { $roleDt = new Application_Model_DbTable_Role(); $primaryKey = $roleDt->getPrimaryKey(); $this->setMethod('post'); $this->setEnctype('multipart/form-data'); $this->setAttrib('idrol', $primaryKey); $this->setAction('/admin/role/edit'); $objType2 = new Admin_Model_Acl(); $objfea = new Admin_Model_AclRole(); $e = new Zend_Form_Element_Hidden($primaryKey); $this->addElement($e); $e = new Zend_Form_Element_MultiCheckbox('idacl'); $e->setMultiOptions($objType2->getGreatAll()); if ($this->_idrol !== null) { $ma = $objfea->getRoleAcl($this->_idrol); $idsgreat = array(); foreach ($ma as $resulta) { $idsgreat[] = $resulta['idacl']; } $e->setValue($idsgreat); $role = new Admin_Model_Role(); $b = $role->getRoleId($this->_idrol); } $this->addElement($e); $e = new Zend_Form_Element_Text('name'); $e->setAttrib('class', 'inpt-medium'); $e->setAttrib('placeholder', 'Nombre'); $this->addElement($e); $e = new Zend_Form_Element_Checkbox('state'); $e->setValue(true); $this->addElement($e); foreach ($this->getElements() as $element) { $element->removeDecorator('Label'); $element->removeDecorator('DtDdWrapper'); $element->removeDecorator('HtmlTag'); } }
public function init() { $roleDt = new Application_Model_DbTable_Acl(); $primaryKey = $roleDt->getPrimaryKey(); $this->setMethod('post'); $this->setEnctype('multipart/form-data'); $this->setAttrib('idacl', $primaryKey); $this->setAction('/admin/acl/edit'); $e = new Zend_Form_Element_Hidden($primaryKey); $this->addElement($e); $e = new Zend_Form_Element_Text('urlacl'); $e->setAttrib('class', 'inpt-medium'); $e->setAttrib('placeholder', 'Ruta de Acceso'); $this->addElement($e); $e = new Zend_Form_Element_Checkbox('state'); $e->setValue(true); $this->addElement($e); foreach ($this->getElements() as $element) { $element->removeDecorator('Label'); $element->removeDecorator('DtDdWrapper'); $element->removeDecorator('HtmlTag'); } }
/** * Constructs the form * * @param boolean $hideGroup When true group checkbox is hidden * @return \Gems_Form_TableForm */ public function getForm($hideGroup = false) { $form = new \Gems_Form(); $form->setAttrib('target', '_blank'); if ($hideGroup) { $element = new \Zend_Form_Element_Hidden('group'); } else { $element = new \Zend_Form_Element_Checkbox('group'); $element->setLabel($this->_('Group surveys')); } $element->setValue(1); $form->addElement($element); $element = new \Zend_Form_Element_Select('format'); $element->setLabel($this->_('Output format')); $outputFormats = array('html' => 'HTML'); if ($this->_pdf->hasPdfExport()) { $outputFormats['pdf'] = 'PDF'; $element->setValue('pdf'); } $element->setMultiOptions($outputFormats); $form->addElement($element); $element = new \Zend_Form_Element_Submit('export'); $element->setLabel($this->_('Export'))->setAttrib('class', 'button'); $form->addElement($element); $links = $this->menu->getMenuList(); $links->addParameterSources($this->request, $this->menu->getParameterSource()); $links->addCurrentParent($this->_('Cancel')); if (count($links)) { $element = new \MUtil_Form_Element_Html('menuLinks'); $element->setValue($links); // $element->setOrder(999); $form->addElement($element); } return $form; }
public function addInterfaceCheckbox($value) { $form = new Zend_Form(); $checkbox_element = new Zend_Form_Element_Checkbox("checktoogleInterface"); $checkbox_element->setValue($value); $checkbox_element->setAttrib("id", "checktoogleInterface"); $form->addElement($checkbox_element); $form->setElementDecorators(array('ViewHelper')); $form->setDecorators(array('FormElements', 'Form')); $this->view->interfacingcheckbox = $form; }
function getFormElement($v, $value = '') { $this->toTpl('hasForm', 1); $v = $this->doQoolHook('front_pre_getformelement_element', $v); $value = $this->doQoolHook('front_pre_getformelement_value', $value); switch ($v['value']) { case "editor": $this->loadEditorBtns(); $this->toTpl("loadEditor", 1); $this->toTpl("isEditor", 1); $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'editor span12'); if ($value != '') { $element->setValue($value); } break; case "fileinput": $element = new Zend_Form_Element_File($v['name']); $element->setAttrib('class', 'input-file'); break; case "captcha": $element = new Zend_Form_Element_Captcha($v['name'], array('label' => $this->t("Please verify you are a human"), 'captcha' => $config->site->captcha_adapter, 'captchaOptions' => array('captcha' => $config->site->captcha_adapter, 'wordLen' => 6, 'timeout' => 300))); return $element; break; case "multifileinputs": $element = new Zend_Form_Element_File($v['name']); $element->setAttrib('class', 'input-file'); $element->setMultiFile(10); break; case "multifileinput": $name = $v['name'] . "[]"; $element = new Zend_Form_Element_File($name); $element->setAttrib('class', 'input-file'); $element->setAttrib('multiple', 'multiple'); $element->setMultiFileForQool(1); $this->toTpl('filelist', true); break; case "checkbox": $element = new Zend_Form_Element_Checkbox($v['name']); $element->setAttrib('class', 'checkbox'); $element->setValue($value); break; case "editarea": $this->toTpl('editarea', 1); $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'editarea span12'); $element->setAttrib('id', 'editarea'); $element->setAttrib('style', 'height:500px'); if ($value != '') { $element->setValue($value); } break; case "password": $element = new Zend_Form_Element_Password($v['name']); break; case "textarea": $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'span9'); $element->setAttrib('style', 'height:80px'); if ($value != '') { $element->setValue($value); } break; case "hidden": $element = new Zend_Form_Element_Hidden($v['name']); $element->setValue($value); $element->setDecorators(array("ViewHelper")); break; case "textinput": $element = new Zend_Form_Element_Text($v['name']); if ($value != '') { $element->setValue($value); } break; case "selectbox": $element = new Zend_Form_Element_Select($v['name']); if ($v['use_pool'] && method_exists($this, $v['use_pool'])) { if ($v['pool_type'] != '0') { $this->pool_type = $v['pool_type']; } if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($this->{$v}['use_pool']() as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if ($value != '') { $element->setValue($value); } } break; case "multiselectbox": $element = new Zend_Form_Element_Multiselect($v['name']); if ($v['use_pool'] && method_exists($this, $v['use_pool'])) { if ($v['pool_type'] != '0') { $this->pool_type = $v['pool_type']; } if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($this->{$v}['use_pool']() as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if (is_array($value)) { foreach ($value as $a) { $vals[] = $a['selected_value']; } $element->setValue($vals); } } break; case "treeselectbox": $element = new Zend_Form_Element_Select($v['name']); if ($v['use_pool'] && method_exists($this, $v['use_pool'])) { if ($v['pool_type'] != '0') { $this->pool_type = $v['pool_type']; } if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } if ($value != '') { $element->setValue($value); } //x10 times nested support. Needs fix foreach ($this->{$v}['use_pool']() as $vo) { $element->addMultiOption($vo['id'], $vo['title']); foreach ($vo['kids'] as $a) { $element->addMultiOption($a['id'], "|_" . $a['title']); foreach ($a['kids'] as $b) { $element->addMultiOption($b['id'], "|__" . $b['title']); foreach ($b['kids'] as $c) { $element->addMultiOption($c['id'], "|___" . $c['title']); foreach ($c['kids'] as $d) { $element->addMultiOption($d['id'], "|____" . $d['title']); foreach ($d['kids'] as $e) { $element->addMultiOption($e['id'], "|_____" . $e['title']); foreach ($e['kids'] as $f) { $element->addMultiOption($f['id'], "|______" . $f['title']); foreach ($f['kids'] as $g) { $element->addMultiOption($g['id'], "|______" . $g['title']); foreach ($g['kids'] as $h) { $element->addMultiOption($h['id'], "|_______" . $h['title']); foreach ($h['kids'] as $i) { $element->addMultiOption($i['id'], "|________" . $i['title']); foreach ($i['kids'] as $j) { $element->addMultiOption($j['id'], "|_________" . $j['title']); foreach ($j['kids'] as $l) { $element->addMultiOption($l['id'], "|__________" . $l['title']); } } } } } } } } } } } } } break; } if ($v['required']) { $element->setRequired(true); } if ($v['title']) { $element->setLabel($v['title']); } else { $element->setLabel($this->t(ucfirst(str_replace("_", " ", $v['name'])))); } if ($v['attributes']) { foreach ($v['attributes'] as $k => $r) { $element->setAttrib($k, $r); } } //$element->setDecorators(array("ViewHelper")); $element = $this->doQoolHook('front_post_getformelement_object', $element); return $element; }
public function FrmTables($data = null) { $table_code = new Zend_Form_Element_Text('table_code'); $table_code->setAttribs(array('class' => 'form-control', 'required' => true, 'onkeyup' => 'displayPhoto()')); $db = new Application_Model_DbTable_DbGlobal(); $g_code = new Zend_Form_Element_Select('group_code'); $g_code->setAttribs(array('class' => 'form-control select2me', 'onchange' => 'displayDescriptions()')); $option = $db->getGroupCode(); $g_code->setMultiOptions($option); $g_code1 = new Zend_Form_Element_Text('g_code1'); $g_code1->setAttribs(array('class' => 'form-control')); $est_time = new Zend_Form_Element_Text('est_time'); $est_time->setAttribs(array('class' => 'form-control clockface_1 clockface-open', 'data-format' => "hh:mm A", 'id' => 'mask_number')); $price = new Zend_Dojo_Form_Element_NumberTextBox('price'); $price->setAttribs(array('class' => 'form-control')); $max_seat = new Zend_Form_Element_Text('max_seat'); $max_seat->setAttribs(array('class' => 'form-control', 'id' => 'mask_number')); $time = new Zend_Form_Element_Text('time'); $time->setAttribs(array('class' => 'form-control')); $time->setValue('00:00'); $description = new Zend_Form_Element_Text('description'); $description->setAttribs(array('class' => 'form-control', 'required' => true, 'onkeyup' => 'displayPhoto()')); $lang_1 = new Zend_Form_Element_Text('lang_1'); $lang_1->setAttribs(array('class' => 'form-control', 'onkeyup' => 'displayPhoto()')); $lang_2 = new Zend_Form_Element_Text('lang_2'); $lang_2->setAttribs(array('checked' => 'checked', 'class' => 'form-control', 'onkeyup' => 'displayPhoto()')); $lang_3 = new Zend_Form_Element_Text('lang_3'); $lang_3->setAttribs(array('checked' => 'checked', 'class' => 'form-control')); if ($data != null) { // print_r($data); } $db = new Application_Model_DbTable_DbGlobal(); $description_opt = array("" => $this->tr->translate("SELECT_DESCRIPTION")); $show_description1 = new Zend_Form_Element_Select('show_description'); $show_description1->setAttribs(array('class' => 'form-control', 'onchange' => 'displayPhoto()')); $opt = $db->getVewOptoinTypeByType(1, 1, null, 1); $show_description1->setMultiOptions($opt); $type_of_table = new Zend_Form_Element_Select('type_of_table'); $type_of_table->setAttribs(array('class' => 'form-control select2me', 'onchange' => 'popoupTableType()')); $opt_type_table = $db->getTypeOfTable(); $type_of_table->setMultiOptions($opt_type_table); $apply_to_company = new Zend_Form_Element_Select('apply_to_company'); $apply_to_company->setAttribs(array('class' => 'form-control')); $opt = array('0' => 'select company', '1' => 'A', '2' => 'B', '3' => 'C'); $apply_to_company->setMultiOptions($opt); $photo = new Zend_Form_Element_File('photo'); $background = new Zend_Form_Element_Text('background'); $background->setAttribs(array('class' => 'form-control color-picker-rgba')); $backgroun_color = new Zend_Form_Element_Text('backgroun_color'); $backgroun_color->setAttribs(array('class' => 'colorpicker-rgba form-control', 'onclick' => 'displayPhoto()')); $apply = new Zend_Form_Element_Select('apply'); $apply->setAttribs(array('class' => 'form-control')); $apply_opt = array("" => $this->tr->translate("SELECT_APPLY_TO_COMPANY")); $apply->setMultiOptions($apply_opt); $combo = new Zend_Form_Element_Checkbox('combo'); $combo->setAttribs(array('class' => 'red')); $active = new Zend_Form_Element_Checkbox('active'); $active->setAttribs(array('class' => 'red', 'checked' => 'checked')); $time_ck = new Zend_Form_Element_Checkbox('time_ck'); $time_ck->setAttribs(array('class' => 'red')); $dicount_ck = new Zend_Form_Element_Checkbox('dicount_ck'); $dicount_ck->setAttribs(array('class' => 'red')); $format = new Zend_Form_Element_Text('demo4'); $format->setAttribs(array('class' => 'form-control', 'id' => "demo4", 'value' => 12, 'placeholder' => '12')); $font_color = new Zend_Form_Element_text('font_color'); $font_color->setAttribs(array('class' => 'colorpicker-default form-control', 'onclick' => 'displayPhoto()')); $font_site = new Zend_Form_Element_text('font_size'); $font_site->setAttribs(array('class' => ' spinner-input form-control', 'onkeyup' => 'displayPhoto()', 'onclick' => 'displayPhoto()')); $font_site->setValue(20); $resize = new Zend_Form_Element_Text('resize'); $resize->setAttribs(array('class' => 'form-control', 'id' => "resize", 'value' => 12, 'placeholder' => '12')); $note = new Zend_Form_Element_Textarea('note'); $note->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 150px;")); $note1 = new Zend_Form_Element_Textarea('note1'); $note1->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 150px;")); $id = new Zend_Form_Element_Hidden('id'); if ($data != null) { //print_r($data);exit(); $id->setValue($data['id']); $table_code->setValue($data['code']); $description->setValue($data['description']); $lang_1->setValue($data['lang1']); $lang_2->setValue($data['lang2']); $g_code->setValue($data['tbl_groupid']); $type_of_table->setValue($data['tbl_type']); $show_description1->setValue($data['display_by']); $max_seat->setValue($data['max_sit']); $apply_to_company->setValue($data['compid']); $active->setValue($data['active']); $time_ck->setValue($data['time_charge_id']); $dicount_ck->setValue($data['is_discound']); $price->setValue($data['price']); $est_time->setValue($data['est_time']); $backgroun_color->setValue($data['backgroud_color']); $font_color->setValue($data['font_color']); $font_site->setValue($data['font_size']); $note->setValue($data['note']); } $this->addElements(array($id, $photo, $dicount_ck, $time_ck, $type_of_table, $est_time, $price, $max_seat, $time, $g_code, $apply, $active, $combo, $table_code, $description, $lang_1, $lang_2, $lang_3, $note1, $backgroun_color, $g_code1, $show_description1, $apply_to_company, $background, $font_color, $format, $font_color, $font_site, $resize, $note)); return $this; }
public function FrmMenu($data = null) { //item_code $item_code = new Zend_Form_Element_Text('item_code'); $item_code->setAttribs(array('class' => 'form-control', 'onkeyup' => 'displayPhoto()')); $menu_code = new Zend_Form_Element_Text('menu_code'); $menu_code->setAttribs(array('class' => 'form-control')); //menu_group $menu_group = new Zend_Form_Element_Select('menu_group'); $menu_group->setAttribs(array('class' => 'form-control input-xlarge select2me', 'onClick' => 'FuncMenuGroup()')); $db = new Menu_Model_DbTable_DbMenu(); $opt = $db->getAllGroupMenu(); $menu_group->setMultiOptions($opt); $root_code = new Zend_Form_Element_Select('root_code'); $root_code->setAttribs(array('class' => 'form-control', 'onClick' => 'FuncRootMenuCode()')); $select_root_code_opt = array("" => $this->tr->translate("SELECT_GROUP_CODE"), -1 => $this->tr->translate("ADD_NEW")); $root_code->setMultiOptions($select_root_code_opt); //root_menu $root_menu = new Zend_Form_Element_Select('root_menu'); $root_menu->setAttribs(array('class' => 'form-control input-xlarge select2me', 'onClick' => 'FuncRootMenuCode()')); $db = new Menu_Model_DbTable_DbMenu(); $opt = $db->getAllRootMenu(); $root_menu->setMultiOptions($opt); $root_menus = new Zend_Form_Element_Select('root_menus'); $root_menus->setAttribs(array('class' => 'form-control', 'onClick' => 'FuncRootMenuCode()')); $root_menu_opt = array("" => $this->tr->translate("SELECT_ROOT_MENU"), -1 => $this->tr->translate("ADD_NEW")); $root_menus->setMultiOptions($root_menu_opt); $print_code = new Zend_Form_Element_Select('print_code'); $print_code->setAttribs(array('class' => 'form-control input-xlarge select2me', 'onClick' => 'FuncRootMenuCode()')); $select_print_code_opt = array("" => $this->tr->translate("SELECT_PRINT_CODE"), -1 => $this->tr->translate("ADD_NEW")); $print_code->setMultiOptions($select_print_code_opt); $description = new Zend_Form_Element_Text('description'); $description->setAttribs(array('class' => 'form-control', 'onchange' => 'displayPhoto()')); $lang_1 = new Zend_Form_Element_Text('lang_1'); $lang_1->setAttribs(array('class' => 'form-control', 'onchange' => 'displayPhoto()')); $lang_2 = new Zend_Form_Element_Text('lang_2'); $lang_2->setAttribs(array('checked' => 'checked', 'class' => 'form-control', 'onchange' => 'displayPhoto()')); $lang_3 = new Zend_Form_Element_Text('lang_3'); $lang_3->setAttribs(array('checked' => 'checked', 'class' => 'form-control')); $note = new Zend_Form_Element_Text('note'); $note->setAttribs(array('checked' => 'checked', 'class' => 'form-control')); if ($data != null) { // print_r($data); } $db = new Application_Model_DbTable_DbGlobal(); $show_description = new Zend_Form_Element_Select('show_description'); $show_description->setAttribs(array('class' => 'form-control', 'onchange' => 'displayPhoto()')); $opt = $db->getVewOptoinTypeByType(1, 1, null, 1); $show_description->setMultiOptions($opt); $photo = new Zend_Form_Element_File('photo'); $background = new Zend_Form_Element_Text('background'); $background->setAttribs(array('class' => 'form-control color-picker-rgba')); $font_color = new Zend_Form_Element_Text('font_color'); $font_color->setAttribs(array('class' => 'form-control', 'id' => "selected-color1")); $font_size = new Zend_Form_Element_Text('demo3'); $font_size->setAttribs(array('class' => 'form-control', 'id' => "demo3", 'value' => 12, 'placeholder' => '0')); $font_size = new Zend_Form_Element_Select('demo3'); $font_size->setAttribs(array('class' => 'form-control')); $description_opt = array("" => $this->tr->translate("\$600"), -1 => $this->tr->translate("\$500")); $font_size->setMultiOptions($description_opt); $photo = new Zend_Form_Element_File('photo'); $background = new Zend_Form_Element_Text('background'); $background->setAttribs(array('class' => 'form-control color-picker-rgba')); $apply = new Zend_Form_Element_Select('apply'); $apply->setAttribs(array('class' => 'form-control')); $apply_opt = array("" => $this->tr->translate("SELECT_APPLY_TO_COMPANY"), -1 => $this->tr->translate("ADD_NEW")); $apply->setMultiOptions($apply_opt); $combo = new Zend_Form_Element_Checkbox('combo'); $combo->setAttribs(array('class' => 'red')); $print_to = new Zend_Form_Element_Checkbox('print_to'); $print_to->setAttribs(array('class' => 'red')); $show_screen = new Zend_Form_Element_Checkbox('show_screen'); $show_screen->setAttribs(array('class' => 'red')); $discount = new Zend_Form_Element_Checkbox('discount'); $discount->setAttribs(array('class' => 'red')); $time = new Zend_Form_Element_Checkbox('time'); $time->setAttribs(array('class' => 'red')); $is_root = new Zend_Form_Element_Checkbox('$is_root'); $is_root->setAttribs(array('class' => 'red')); $require_qty = new Zend_Form_Element_Checkbox('require_qty'); $require_qty->setAttribs(array('class' => 'red')); $is_service = new Zend_Form_Element_Checkbox('is_service'); $is_service->setAttribs(array('class' => 'red')); $active = new Zend_Form_Element_Checkbox('active'); $active->setAttribs(array('class' => 'red', 'Checked' => 'Checked')); $format = new Zend_Form_Element_Text('demo4'); $format->setAttribs(array('class' => 'form-control', 'id' => "demo4", 'value' => 12, 'placeholder' => '0')); $setting = new Zend_Form_Element_Select('setting'); $setting->setAttribs(array('class' => 'form-control')); $setting_opt = array("" => $this->tr->translate("SELECT_SETTING")); $setting->setMultiOptions($setting_opt); $arrange = new Zend_Form_Element_Text('arrange'); $arrange->setAttribs(array('class' => 'form-control')); $resize = new Zend_Form_Element_Text('resize'); $resize->setAttribs(array('class' => 'form-control', 'id' => "resize", 'value' => 12, 'placeholder' => '12')); $note = new Zend_Form_Element_Textarea('note'); $note->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 100px;")); $backgroun_color = new Zend_Form_Element_Text('backgroun_color'); $backgroun_color->setAttribs(array('class' => 'colorpicker-rgba form-control', 'onclick' => 'displayPhoto()')); $font_site = new Zend_Form_Element_text('font_size'); $font_site->setAttribs(array('class' => ' spinner-input form-control', 'onkeyup' => 'displayPhoto()', 'onclick' => 'displayPhoto()')); $font_site->setValue(18); $apply = new Zend_Form_Element_Select('apply'); $apply->setAttribs(array('class' => 'form-control')); $font_color = new Zend_Form_Element_text('font_color'); $font_color->setAttribs(array('class' => 'colorpicker-default form-control', 'onclick' => 'displayPhoto()')); $select_apply = new Zend_Form_Element_Select('select_apply'); $select_apply->setAttribs(array('class' => 'form-control', 'onClick' => 'FuncApplyCompany()')); $select_apply_opt = array("" => $this->tr->translate("SELECT_APPLY_TO_COMPANY"), -1 => $this->tr->translate("ADD_NEW")); $select_apply->setMultiOptions($select_apply_opt); $photo = new Zend_Form_Element_file('photo'); $id = new Zend_Form_Element_Hidden('id'); if (!empty($data)) { $id->setValue($data['id']); $item_code->setValue($data['bar_code']); $description->setValue($data['desc']); $lang_1->setValue($data['lang1']); $lang_2->setValue($data['lang2']); $font_size->setValue($data['price']); $show_description->setValue($data['display_by']); $menu_group->setValue($data['category_id']); $root_menu->setValue($data['root_menuid']); $print_code->setValue($data['print_code']); $print_to->setValue($data['printto_print']); $is_service->setValue($data['is_service']); $backgroun_color->setValue($data['background_color']); $font_color->setValue($data['font_color']); $font_site->setValue($data['font_size']); $active->setValue($data['status']); $note->setValue($data['note']); $show_screen->setValue($data['showscreen']); $is_root->setValue($data['is_root']); $time->setValue($data['time']); $discount->setValue($data['is_discound']); $require_qty->setValue($data['is_reqty']); } $this->addElements(array($select_apply, $require_qty, $root_code, $menu_group, $item_code, $apply, $active, $combo, $menu_code, $description, $lang_1, $lang_2, $lang_3, $print_code, $print_to, $show_screen, $time, $discount, $show_description, $background, $font_color, $font_size, $format, $setting, $arrange, $resize, $note, $is_root, $root_menu, $root_menus, $id, $photo, $note, $backgroun_color, $font_site, $font_color, $is_service)); return $this; }
public function FrmMenu($data = null) { $combo_code = new Zend_Form_Element_Text('combo_code'); $combo_code->setAttribs(array('class' => 'form-control', 'onkeyup' => 'displayPhoto()')); $description = new Zend_Form_Element_Text('description'); $description->setAttribs(array('class' => 'form-control', 'onchange' => 'displayPhoto()')); $lang_1 = new Zend_Form_Element_Text('lang_1'); $lang_1->setAttribs(array('class' => 'form-control', 'onchange' => 'displayPhoto()')); $lang_2 = new Zend_Form_Element_Text('lang_2'); $lang_2->setAttribs(array('checked' => 'checked', 'class' => 'form-control', 'onchange' => 'displayPhoto()')); $lang_3 = new Zend_Form_Element_Text('lang_3'); $lang_3->setAttribs(array('checked' => 'checked', 'class' => 'form-control')); if ($data != null) { } $db = new Application_Model_DbTable_DbGlobal(); $show_description = new Zend_Form_Element_Select('show_description'); $show_description->setAttribs(array('class' => 'form-control', 'required' => 'true', 'onchange' => 'displayPhoto()')); $opt = $db->getVewOptoinTypeByType(1, 1, null, 1); $show_description->setMultiOptions($opt); //$photo = new Zend_Form_Element_File('photo'); $background = new Zend_Form_Element_select('background'); $background->setAttribs(array('class' => 'form-control color-picker-rgba')); $otp = array('0' => 'apply to company', '1' => 'A', '2' => 'B', '3' => 'C'); $background->setMultiOptions($otp); $font_color = new Zend_Form_Element_Text('font_color'); $font_color->setAttribs(array('class' => 'form-control', 'id' => "selected-color1")); $font_size = new Zend_Form_Element_Text('demo3'); $font_size->setAttribs(array('class' => 'form-control', 'id' => "demo3", 'value' => 12, 'placeholder' => '12')); $apply_to_company = new Zend_Form_Element_Select('apply_to_company'); $apply_to_company->setAttribs(array('class' => 'form-control')); $apply_opt = array("" => $this->tr->translate("SELECT_APPLY_TO_COMPANY")); $apply_to_company->setMultiOptions($apply_opt); $combo_item = new Zend_Form_Element_Checkbox('combo_item'); $combo_item->setAttribs(array('class' => 'red')); $active = new Zend_Form_Element_Checkbox('active'); $active->setAttribs(array('class' => 'red', 'checked' => 'checked')); $user_activate = new Zend_Form_Element_Checkbox('user_activate'); $user_activate->setAttribs(array('class' => 'red', 'onclick' => 'setDefaulTime()')); $note = new Zend_Form_Element_Textarea('note'); $note->setAttribs(array('class' => 'form-control', 'id' => "demo4", 'value' => 12, 'placeholder' => '12')); $setting = new Zend_Form_Element_Select('setting'); $setting->setAttribs(array('class' => 'form-control')); $setting_opt = array("" => $this->tr->translate("SELECT_SETTING")); $setting->setMultiOptions($setting_opt); $arrange = new Zend_Form_Element_Text('arrange'); $arrange->setAttribs(array('class' => 'form-control')); $resize = new Zend_Form_Element_Text('resize'); $resize->setAttribs(array('class' => 'form-control', 'id' => "resize", 'value' => 12, 'placeholder' => '12')); $backgroun_color = new Zend_Form_Element_Text('backgroun_color'); $backgroun_color->setAttribs(array('class' => 'colorpicker-rgba form-control', 'onclick' => 'displayPhoto()')); $font_site = new Zend_Form_Element_text('font_size'); $font_site->setAttribs(array('class' => ' spinner-input form-control', 'onkeyup' => 'displayPhoto()', 'onclick' => 'displayPhoto()')); $font_site->setValue(18); $apply = new Zend_Form_Element_Select('apply'); $apply->setAttribs(array('class' => 'form-control')); $font_color = new Zend_Form_Element_text('font_color'); $font_color->setAttribs(array('class' => 'colorpicker-default form-control', 'onclick' => 'displayPhoto()')); $note = new Zend_Form_Element_Textarea('note'); $note->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 100px;")); $from_time = new Zend_Form_Element_Text('from_time'); $from_time->setAttribs(array('class' => 'form-control clockface-open', 'id' => 'clockface_1')); $to_time = new Zend_Form_Element_Text('to_time'); $to_time->setAttribs(array('class' => 'form-control clockface-open', 'id' => 'clockface_2')); $id = new Zend_Form_Element_Hidden('id'); if (!empty($data)) { $id->setValue($data['id']); $combo_code->setValue($data['menu_code']); $description->setValue($data['desc']); $lang_1->setValue($data['lang1']); $lang_2->setValue($data['lang2']); $show_description->setValue($data['display_by']); $backgroun_color->setValue($data['background_color']); $font_color->setValue($data['font_color']); $font_site->setValue($data['font_size']); $from_time->setValue($data['date']); $note->setValue($data['note']); $active->setValue($data['status']); $combo_item->setValue($data['is_combo']); $apply_to_company->setValue($data['apply_company']); } $this->addElements(array($apply, $active, $description, $lang_1, $lang_2, $lang_3, $show_description, $background, $font_color, $font_size, $note, $combo_code, $combo_item, $id, $note, $backgroun_color, $font_site, $font_color, $apply_to_company, $user_activate, $from_time, $to_time)); return $this; }
public function FrmTable($data = null) { $menu_code = new Zend_Form_Element_Text('group_code'); $menu_code->setAttribs(array('class' => 'form-control', 'required' => 'true', 'onkeyup' => 'displayPhoto()')); $description = new Zend_Form_Element_Text('description'); $description->setAttribs(array('class' => 'form-control', 'onkeyup' => 'displayPhoto()')); $lang_1 = new Zend_Form_Element_Text('lang_1'); $lang_1->setAttribs(array('class' => 'form-control', 'onkeyup' => 'displayPhoto()')); $font_color = new Zend_Form_Element_text('font_color'); $font_color->setAttribs(array('class' => 'colorpicker-default form-control', 'onclick' => 'displayPhoto()')); $lang_2 = new Zend_Form_Element_Text('lang_2'); $lang_2->setAttribs(array('checked' => 'checked', 'class' => 'form-control', 'onkeyup' => 'displayPhoto()')); $lang_3 = new Zend_Form_Element_Text('lang_3'); $lang_3->setAttribs(array('checked' => 'checked', 'class' => 'form-control')); if ($data != null) { // print_r($data); } $db = new Application_Model_DbTable_DbGlobal(); $show_description = new Zend_Form_Element_Select('show_description'); $show_description->setAttribs(array('class' => 'form-control', 'required' => 'true', 'onchange' => 'displayPhoto()')); $opt = $db->getVewOptoinTypeByType(1, 1, null, 1); $show_description->setMultiOptions($opt); $apply_to = new Zend_Form_Element_Select('apply_to_company'); $apply_to->setAttribs(array('class' => 'form-control')); $otp = array('0' => 'apply to company', '1' => 'A', '2' => 'B', '3' => 'C'); $apply_to->setMultiOptions($otp); $photo = new Zend_Form_Element_File('photo'); $backgroun_color = new Zend_Form_Element_Text('backgroun_color'); $backgroun_color->setAttribs(array('class' => 'colorpicker-rgba form-control', 'onclick' => 'displayPhoto()')); $font_site = new Zend_Form_Element_text('font_size'); $font_site->setAttribs(array('class' => ' spinner-input form-control', 'onkeyup' => 'displayPhoto()', 'onclick' => 'displayPhoto()')); $font_site->setValue(18); $apply = new Zend_Form_Element_Select('apply'); $apply->setAttribs(array('class' => 'form-control')); $apply_opt = array("" => $this->tr->translate("SELECT_APPLY_TO_COMPANY")); $apply->setMultiOptions($apply_opt); $combo = new Zend_Form_Element_Checkbox('combo'); $combo->setAttribs(array('class' => 'red')); $active = new Zend_Form_Element_Checkbox('active'); $active->setAttribs(array('class' => 'checker', 'checked' => 'checked')); $format = new Zend_Form_Element_Text('demo4'); $format->setAttribs(array('class' => 'form-control', 'id' => "demo4", 'value' => 12, 'placeholder' => '12')); $setting = new Zend_Form_Element_Select('setting'); $setting->setAttribs(array('class' => 'form-control')); $setting_opt = array("" => $this->tr->translate("SELECT_SETTING")); $setting->setMultiOptions($setting_opt); $arrange = new Zend_Form_Element_Text('arrange'); $arrange->setAttribs(array('class' => 'form-control')); $resize = new Zend_Form_Element_Text('resize'); $resize->setAttribs(array('class' => 'form-control', 'id' => "resize", 'value' => 12, 'placeholder' => '12')); $note = new Zend_Form_Element_Textarea('note'); $note->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 100px;")); $location = new Zend_Form_Element_Textarea('location'); $location->setAttribs(array('class' => 'form-control', 'style' => "margin-top: 0px; margin-bottom: 0px; height: 100px;")); $photo = new Zend_Form_Element_File('photo'); $id = new Zend_Form_Element_Hidden('id'); if ($data != null) { //print_r($data);exit(); $dbs = $id->setValue($data['id']); $menu_code->setValue($data['CODE']); $description->setValue($data['description']); $lang_1->setValue($data['lang1']); $lang_2->setValue($data['lang2']); $show_description->setValue($data['display_by']); $apply_to->setValue($data['compid']); $note->setValue($data['note']); $backgroun_color->setValue($data['background_color']); $font_color->setValue($data['font_color']); $font_site->setValue($data['font_size']); $active->setValue($data['status']); $id->setValue($data['id']); } $this->addElements(array($id, $photo, $location, $apply, $active, $combo, $menu_code, $description, $lang_1, $lang_2, $apply_to, $show_description, $backgroun_color, $font_color, $font_site, $format, $setting, $arrange, $resize, $note)); return $this; }
public function __construct($options = null) { $this->_addSubmitSaveClose = true; parent::__construct($options); $this->setName('page'); //$imageSrc = $options['imageSrc']; $pageID = $options['pageID']; $imageHeaderArray = $options['imageHeaderArray']; // contains the id of the page $id = new Zend_Form_Element_Hidden('id'); $id->removeDecorator('Label'); $id->removeDecorator('HtmlTag'); // input text for the title of the page $title = new Zend_Form_Element_Text('PI_PageTitle'); $title->setLabel($this->getView()->getCibleText('label_titre_page'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => Cible_Translation::getCibleText('error_field_required')))->setAttrib('class', 'stdTextInput')->setAttrib('onBlur', 'javascript:fillInControllerName();'); $lblTit = $title->getDecorator('Label'); $lblTit->setOption('class', $this->_labelCSS); // input text for the index of the page $uniqueIndexValidator = new Zend_Validate_Db_NoRecordExists('PagesIndex', 'PI_PageIndex'); $uniqueIndexValidator->setMessage($this->getView()->getCibleText('label_index_already_exists'), Zend_Validate_Db_NoRecordExists::ERROR_RECORD_FOUND); $reservedWordValidator = new Cible_Validate_Db_NoRecordExists('Modules', 'M_MVCModuleTitle'); $reservedWordValidator->setMessage($this->getView()->getCibleText('label_index_reserved'), Zend_Validate_Db_NoRecordExists::ERROR_RECORD_FOUND); $index = new Zend_Form_Element_Text('PI_PageIndex'); $index->setLabel($this->getView()->getCibleText('label_name_controller'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => Cible_Translation::getCibleText('error_field_required')))->addValidator('stringLength', true, array(1, 50, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => $this->getView()->getCibleText('label_index_more_char'), Zend_Validate_StringLength::TOO_LONG => $this->getView()->getCibleText('label_index_less_char'))))->addValidator('regex', true, array('/^[a-z0-9][a-z0-9_-]*[a-z0-9]$/', 'messages' => $this->getView()->getCibleText('label_only_character_allowed')))->addValidator($uniqueIndexValidator, true)->addValidator($reservedWordValidator, true)->setAttrib('class', 'stdTextInput'); $lblId = $index->getDecorator('Label'); $lblId->setOption('class', $this->_labelCSS); // textarea for the meta and title of the page $metaTitle = new Zend_Form_Element_Textarea('PI_MetaTitle'); $metaTitle->setLabel('Titre (meta)')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextareaShort'); $lblMetaTitle = $metaTitle->getDecorator('Label'); $lblMetaTitle->setOption('class', $this->_labelCSS); // textarea for the meta description of the page $metaDescription = new Zend_Form_Element_Textarea('PI_MetaDescription'); $metaDescription->setLabel($this->getView()->getCibleText('label_description_meta'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextareaShort'); $lblMetaDescr = $metaDescription->getDecorator('Label'); $lblMetaDescr->setOption('class', $this->_labelCSS); // textarea for the meta keywords of the page $metaKeyWords = new Zend_Form_Element_Textarea('PI_MetaKeywords'); $metaKeyWords->setLabel($this->getView()->getCibleText('label_keywords_meta'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextareaShort'); $lblMetaKey = $metaKeyWords->getDecorator('Label'); $lblMetaKey->setOption('class', $this->_labelCSS); // textarea for the meta keywords of the page $metaOthers = new Zend_Form_Element_Textarea('PI_MetaOther'); $metaOthers->setLabel($this->getView()->getCibleText('label_other_meta'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextareaShort'); $lblMetaOther = $metaOthers->getDecorator('Label'); $lblMetaOther->setOption('class', $this->_labelCSS); // select box for the templates $layout = new Zend_Form_Element_Select('P_LayoutID'); $layout->setLabel($this->getView()->getCibleText('label_layout_page'))->setAttrib('class', 'stdSelect'); // select box for the templates $template = new Zend_Form_Element_Select('P_ViewID'); $template->setLabel($this->getView()->getCibleText('label_model_page'))->setAttrib('class', 'stdSelect'); // checkbox for the status (0 = offline, 1 = online) $status = new Zend_Form_Element_Checkbox('PI_Status'); $status->setValue(1); $status->setLabel($this->getView()->getCibleText('form_check_label_online')); $status->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); // checkbox for the show title of the page (0 = offline, 1 = online) $showTitle = new Zend_Form_Element_Checkbox('P_ShowTitle'); $showTitle->setValue(1); $showTitle->setLabel($this->getView()->getCibleText('form_check_label_show_title')); $showTitle->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); // image group // ImageSrc /*$imageSrc = new Zend_Form_Element_Select('P_BannerGroupID'); $imageSrc->setLabel($this->getView()->getCibleText('form_banner_image_group_extranet'))->setAttrib('class','stdSelect'); $imageSrc->addMultiOption('', 'Sans image'); $group = new GroupObject(); $groupArray = $group->groupCollection(); foreach ($groupArray as $group1) { $imageSrc->addMultiOption($group1['BG_ID'],$group1['BG_Name']); }*/ // page image $imageSrc = new Zend_Form_Element_Select('PI_TitleImageSrc'); $imageSrc->setLabel("Image de l'entête")->setAttrib('class', 'stdSelect'); $imageSrc->addMultiOption('', 'Sans image'); $i = 1; foreach ($imageHeaderArray as $img => $path) { $imageSrc->addMultiOption($path, $path); $i++; } $altImage = new Zend_Form_Element_Text('PI_AltPremiereImage'); $altImage->setLabel($this->getView()->getCibleText('label_altFirstImage'))->setAttrib('class', 'stdTextInput'); // add element to the form $this->addElements(array($title, $index, $status, $showTitle, $layout, $template, $imageSrc, $altImage, $metaTitle, $metaDescription, $metaKeyWords, $metaOthers, $id)); }
public function init() { if (isset($this->advertisement)) { $user = Advertisement::getUser($this->advertisement->id); $element = new Zend_Form_Element_Hidden('id'); $element->setValue($this->advertisement->id); $this->addElement($element); $element = new Zend_Form_Element_Hidden('password'); $element->setValue($this->password); $this->addElement($element); $this->setAction('/' . strtolower($this->city->name) . '/bulletin/update'); } else { $this->setAction('/' . strtolower($this->city->name) . '/bulletin/create'); } $element = new Zend_Form_Element_Hidden('city'); $element->setValue($this->city->id); $this->addElement($element); $this->setMethod('POST'); $this->setName('createAdForm'); $element = new Zend_Form_Element_Text('name'); $element->setLabel('怎么称呼您'); $element->setDescription('必填,中英文都可,2到30个字'); $element->setRequired(true); //$element->addValidator(new Zend_Validate_StringLength(2,30)); if (isset($user)) { $element->setValue($user->name); } $this->addElement($element); $element = new Zend_Form_Element_Text('email'); $element->setLabel('您的Email'); $element->setRequired(true); $element->addValidator(new Zend_Validate_EmailAddress()); $element->addValidator('NotEmpty'); $element->setDescription('必填,将不会显示在您的帖子里'); if (isset($user)) { $element->setValue($user->email); } $this->addElement($element); $element = new Zend_Form_Element_Text('mobile'); $element->setLabel('您的手机号'); $element->addFilter(new Zend_Filter_HtmlEntities()); $element->addFilter(new Zend_Filter_StripTags()); $element->setDescription('方便其他用户联系您'); if (isset($user)) { $element->setValue($user->mobile); } $this->addElement($element); $this->addDisplayGroup(array('name', 'email', 'mobile'), 'aboutYou'); $this->getDisplayGroup('aboutYou')->removeDecorator('DtDdWrapper'); // radio box $element = new Zend_Form_Element_Radio('type'); $element->addMultiOptions(array('lease' => '供', 'want' => '求'))->removeDecorator('Label'); $element->setSeparator('')->setValue(Advertisement::LEASE); if (isset($this->advertisement)) { $element->setValue($this->advertisement->type); } $this->addElement($element); // category $element = new Zend_Form_Element_Checkbox("isBusiness"); $element->setLabel('是商铺/店面吗?'); if (isset($this->advertisement) && $this->advertisement->category_id == Category::SHOP) { $element->setValue(1); } else { $element->setValue(0); } $this->addElement($element); $element = new Zend_Form_Element_Text('title'); $element->setLabel('帖子标题'); $element->setRequired(true); $element->addValidator('NotEmpty'); //$element->addValidator(new Zend_Validate_StringLength(10,30)); $element->setDescription('必填,5-100字,概括题目,突出重点'); if (isset($this->advertisement)) { $element->setValue($this->advertisement->title); } $this->addElement($element); $element = new Zend_Form_Element_Text('address'); $element->setLabel('房子的住址'); $element->setDescription('必填,以便用户在地图上方便的找到'); if (isset($this->advertisement)) { $element->setValue($this->advertisement->address); } $this->addElement($element); $element = new Zend_Form_Element_Text('rent'); $element->setLabel('租金'); if (isset($this->advertisement)) { $element->setValue($this->advertisement->rent); } $this->addElement($element); $element = new Zend_Form_Element_Select('currency'); //$element->setLabel("货币"); $element->addMultiOptions(Currency::getAvailableCurrencyAsArray()); if (isset($this->advertisement)) { $element->setValue(Advertisement::getCurrency($this->advertisement)->id); } else { $element->setValue(127); } $this->addElement($element); $element = new Zend_Form_Element_Radio('rent_measurement'); $element->addMultiOptions(array('month' => '每月', 'day' => '每日'))->setSeparator('')->setDescription('必填')->removeDecorator('Label'); $element->setSeparator('')->setValue(Advertisement::RENT_MONTHLY); if (isset($this->advertisement)) { if ($this->advertisement->rent_measurement == Advertisement::RENT_MONTHLY) { $element->setValue('month'); } else { if ($this->advertisement->rent_measurement == Advertisement::RENT_DAILY) { $element->setValue('day'); } } } $element->setRequired(true); $element->addValidator('NotEmpty'); $element->addValidator(new Zend_Validate_Alnum()); $this->addElement($element); // start date and stop date $element = new Zend_Form_Element_Text('start_date'); $element->setRequired(true); $element->addValidator('NotEmpty'); $element->setLabel('开始日期'); $element->setDescription('必填,格式为2010-09-11'); if (isset($this->advertisement)) { $element->setValue($this->advertisement->start_date); } $this->addElement($element); $element = new Zend_Form_Element_Text('stop_date'); $element->setLabel('结束日期'); $element->setDescription('同上,留空则为长期'); if (isset($this->advertisement)) { $element->setValue($this->advertisement->stop_date); } $this->addElement($element); $element = new Zend_Form_Element_Text('area'); $element->setLabel('面积(平方米)'); $element->addValidator(new Zend_Validate_Alnum()); if (isset($this->advertisement)) { $element->setValue($this->advertisement->area); } $this->addElement($element); $element = new Zend_Form_Element_Text('num_of_room'); $element->setLabel('房间数'); $element->addValidator(new Zend_Validate_Alnum()); $element->setDescription('卧房数'); if (isset($this->advertisement)) { $element->setValue($this->advertisement->num_of_room); } $this->addElement($element); $element = new Zend_Form_Element_Textarea('description'); $element->setLabel('其他描述'); $element->setDescription('更多详细信息,例如: 交通是否方便? 是否有独立卫生间和厨房? 是否仅限女生? 是否有家具? 月租是否包括网费? 您的个人习惯等等。'); $element->setAttrib('rows', 4); if (isset($this->advertisement)) { $element->setValue($this->advertisement->description); } $this->addElement($element); $element = new Elements(); $element->addReCaptcha($this); $element = new Zend_Form_Element_Submit('post'); $element->setValue('提交')->removeDecorator('Label'); $this->addElement($element); $this->addDisplayGroup(array('isBusiness', 'type', 'title', 'address', 'rent', 'currency', 'rent_measurement', 'start_date', 'stop_date', 'area', 'num_of_room', 'description', 'challenge', 'post'), 'aboutRoom'); $this->getDisplayGroup('aboutRoom')->removeDecorator('DtDdWrapper'); }
/** * Accepts an array with parameters and mixed values and returns a Zend Form Element to be used by a Zend Form object * * @param array $v * @param mixed $value * @return object */ function getFormElement($v, $value = '') { $config = $this->config; $this->toTpl('hasForm', 1); $v = $this->doQoolHook('pre_getformelement_element', $v); $value = $this->doQoolHook('pre_getformelement_value', $value); switch ($v['value']) { case "editor": $this->loadEditorBtns(); $this->toTpl("loadEditor", 1); $this->toTpl("isEditor", 1); $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'editor span12'); if ($value != '') { $element->setValue($value); } break; case "rte": $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'cleditor span12'); $this->toTpl("isRTE", 1); if ($value != '') { $element->setValue($value); } break; case "fileinput": $element = new Zend_Form_Element_File($v['name']); $element->setAttrib('class', 'input-file'); break; case "dropboxchooser": $element = new Zend_Form_Element_Dropbox($v['name']); $element->setAttrib('style', 'visibility:hidden'); $element->setAttrib('data-multiselect', true); break; case "captcha": if ($config->site->captcha_adapter == 'ReCaptcha') { //Do whats needed for recaptcha to work with form } $element = new Zend_Form_Element_Captcha($v['name'], array('label' => $this->t("Please verify you are a human"), 'captcha' => $config->site->captcha_adapter, 'captchaOptions' => array('captcha' => $config->site->captcha_adapter, 'wordLen' => 6, 'timeout' => 300))); return $element; break; case "multifileinputs": $element = new Zend_Form_Element_File($v['name']); $element->setAttrib('class', 'input-file'); $element->setMultiFile(10); break; case "multifileinput": $name = $v['name'] . "[]"; $element = new Zend_Form_Element_File($name); $element->setAttrib('class', 'input-file'); $element->setAttrib('multiple', 'multiple'); $element->setMultiFileForQool(1); $this->toTpl('filelist', true); break; case "checkbox": $element = new Zend_Form_Element_Checkbox($v['name']); $element->setAttrib('class', 'checkbox'); $element->setValue($value); break; case "editarea": $this->toTpl('editarea', 1); $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'editarea span12'); $element->setAttrib('id', 'editarea'); $element->setAttrib('style', 'height:500px'); if ($value != '') { $element->setValue($value); } break; case "password": $element = new Zend_Form_Element_Password($v['name']); break; case "textarea": $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'span9'); $element->setAttrib('style', 'height:80px'); if ($value != '') { $element->setValue($value); } break; case "hidden": $element = new Zend_Form_Element_Hidden($v['name']); $element->setValue($value); $element->setDecorators(array("ViewHelper")); break; case "textinput": $element = new Zend_Form_Element_Text($v['name']); if ($value != '') { $element->setValue($value); } break; case "datepicker": $element = new Zend_Form_Element_Text($v['name']); $element->setAttrib('class', 'input-xlarge datepicker'); if ($value != '') { $element->setValue($value); } break; case "imageselect": $element = new Zend_Form_Element_Text($v['name']); $element->setAttrib('class', 'imageselector'); $this->toTpl("hiddenEditor", 1); if ($value != '') { $element->setValue($value); } break; case "selectbox": $element = new Zend_Form_Element_Select($v['name']); if ($v['use_pool'] && method_exists($this, $v['use_pool'])) { if ($v['pool_type'] != '0') { $this->pool_type = $v['pool_type']; } if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($this->{$v}['use_pool']() as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if ($value != '') { $element->setValue($value); } } elseif (is_array($v['use_pool'])) { if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($v['use_pool'] as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if ($value != '') { $element->setValue($value); } } elseif ($v['use_pool']) { //the pools might have been assigned by an addon //include the file and run it. require_once $this->dirs['structure']['addons'] . DIR_SEP . Zend_Registry::get('controller') . DIR_SEP . "func.php"; if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($v['use_pool']($this) as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if ($value != '') { $element->setValue($value); } } break; case "multiselectbox": $element = new Zend_Form_Element_Multiselect($v['name']); $element->setAttrib('data-rel', 'chosen'); if ($v['use_pool'] && method_exists($this, $v['use_pool'])) { if ($v['pool_type'] != '0') { $this->pool_type = $v['pool_type']; } if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($this->{$v}['use_pool']() as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if (is_array($value)) { foreach ($value as $a) { $vals[] = $a['selected_value']; } $element->setValue($vals); } } else { //the pools might have been assigned by an addon //include the file and run it. require_once $this->dirs['structure']['addons'] . DIR_SEP . Zend_Registry::get('controller') . DIR_SEP . "func.php"; if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($v['use_pool']($this) as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if ($value != '') { $element->setValue($value); } } break; case "treeselectbox": $element = new Zend_Form_Element_Select($v['name']); if ($v['use_pool'] && method_exists($this, $v['use_pool'])) { if ($v['pool_type'] != '0') { $this->pool_type = $v['pool_type']; } if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } if ($value != '') { $element->setValue($value); } //x10 times nested support. Needs fix foreach ($this->{$v}['use_pool']() as $vo) { $element->addMultiOption($vo['id'], $vo['title']); foreach ($vo['kids'] as $a) { $element->addMultiOption($a['id'], "|_" . $a['title']); foreach ($a['kids'] as $b) { $element->addMultiOption($b['id'], "|__" . $b['title']); foreach ($b['kids'] as $c) { $element->addMultiOption($c['id'], "|___" . $c['title']); foreach ($c['kids'] as $d) { $element->addMultiOption($d['id'], "|____" . $d['title']); foreach ($d['kids'] as $e) { $element->addMultiOption($e['id'], "|_____" . $e['title']); foreach ($e['kids'] as $f) { $element->addMultiOption($f['id'], "|______" . $f['title']); foreach ($f['kids'] as $g) { $element->addMultiOption($g['id'], "|______" . $g['title']); foreach ($g['kids'] as $h) { $element->addMultiOption($h['id'], "|_______" . $h['title']); foreach ($h['kids'] as $i) { $element->addMultiOption($i['id'], "|________" . $i['title']); foreach ($i['kids'] as $j) { $element->addMultiOption($j['id'], "|_________" . $j['title']); foreach ($j['kids'] as $l) { $element->addMultiOption($l['id'], "|__________" . $l['title']); } } } } } } } } } } } } } break; } if ($v['required']) { $element->setRequired(true); } if ($v['title']) { $element->setLabel($v['title']); } else { $element->setLabel($this->t(ucfirst(str_replace("_", " ", $v['name'])))); } if ($v['attributes']) { foreach ($v['attributes'] as $k => $r) { $element->setAttrib($k, $r); } } //$element->setDecorators(array("ViewHelper")); $element = $this->doQoolHook('post_getformelement_object', $element); return $element; }
public function __construct($options = null) { $this->_addSubmitSaveClose = true; parent::__construct($options); $this->setName('page'); $imageSrc = $options['imageSrc']; $isNewImage = $options['isNewImage']; $menuId = $options['menuId']; if ($menuId == '') { $pathTmp = "../../../../../data/images/menu/tmp"; } else { $pathTmp = "../../../../../data/images/menu/{$menuId}/tmp"; } // input text for the title of the page $title = new Zend_Form_Element_Text('MenuTitle'); $title->setLabel(Cible_Translation::getCibleText('form_label_menu_title'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => Cible_Translation::getCibleText('error_field_required')))->setAttrib('class', 'stdTextInput'); $this->addElement($title); $menuItemType = new Zend_Form_Element_Radio('menuItemType'); $menuItemType->setLabel(Cible_Translation::getCibleText('form_label_menu_type'))->addMultiOption('page', Cible_Translation::getCibleText('form_label_menu_type_page'))->addMultiOption('placeholder', Cible_Translation::getCibleText('form_label_menu_type_placeholder'))->addMultiOption('external', Cible_Translation::getCibleText('form_label_menu_type_external'))->setValue('page')->setAttrib('onclick', 'javascript:openTypePanel(this.value)')->setSeparator(''); $this->addElement($menuItemType); $menuItemSecured = new Zend_Form_Element_Radio('menuItemSecured'); $menuItemSecured->setLabel(Cible_Translation::getCibleText('manage_block_secured_menu_status'))->addMultiOption('0', Cible_Translation::getCibleText('button_no'))->addMultiOption('1', Cible_Translation::getCibleText('button_yes'))->setValue('0')->setSeparator(''); $this->addElement($menuItemSecured); $controllerName = new Zend_Form_Element_Text('ControllerName'); $controllerName->setLabel(Cible_Translation::getCibleText('form_label_menu_destination_page'))->setAttrib('onfocus', "openPagePicker('page-picker-pagePicker');")->setRequired(true)->addValidator('NotEmpty', true, array('messages' => Cible_Translation::getCibleText('error_field_required')))->setAttrib('class', 'stdTextInput'); $this->addElement($controllerName); $pagePicker = new Cible_Form_Element_PagePicker('pagePicker', array('menu' => 'Principal', 'associatedElement' => 'ControllerName', 'onclick' => "javascript:closePagePicker(\"page-picker-pagePicker\")")); $pagePicker->setLabel(Cible_Translation::getCibleText('form_label_page_picker'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => Cible_Translation::getCibleText('error_page_selection_required'))); $pagePicker->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => "page-picker", 'id' => "page-picker-pagePicker")))); $this->addElement($pagePicker); $this->addDisplayGroup(array('ControllerName', 'pagePicker'), 'pageSelectionGroup'); $this->getDisplayGroup('pageSelectionGroup')->setAttrib('class', 'pageSelectionGroup')->removeDecorator('DtDdWrapper'); $link = new Zend_Form_Element_Text('MenuLink'); $link->setLabel(Cible_Translation::getCibleText('form_label_menu_destination_link'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => Cible_Translation::getCibleText('error_field_required')))->addPrefixPath('Cible', 'Cible')->setAttrib('class', 'stdTextInput'); $this->addElement($link); // input text for the css li $style = new Zend_Form_Element_Text('MenuTitleStyle'); $style->setLabel(Cible_Translation::getCibleText('form_label_menu_title_style'))->setAttrib('class', 'stdTextInput'); $this->addElement($style); $this->addDisplayGroup(array('MenuLink'), 'externalLinkSelectionGroup'); $this->getDisplayGroup('externalLinkSelectionGroup')->setAttrib('class', 'externalLinkSelectionGroup')->setAttrib('style', 'display: none')->removeDecorator('DtDdWrapper'); // Uses image $loadImage = new Zend_Form_Element_Checkbox('loadImage'); $loadImage->setLabel($this->getView()->getCibleText('form_label_menu_load_image')); $loadImage->removeDecorator('DtDdWrapper'); $loadImage->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); // Show this menu item $MID_Show = new Zend_Form_Element_Checkbox('MID_Show'); $MID_Show->setValue(1); $MID_Show->setLabel($this->getView()->getCibleText('form_label_menu_show_item')); $MID_Show->removeDecorator('DtDdWrapper'); $MID_Show->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($MID_Show); $this->addElement($loadImage); // hidden specify if new image for the news $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage)); $newImage->removeDecorator('Label'); $this->addElement($newImage); // To allow to display title and image $imgTitle = new Zend_Form_Element_Checkbox('menuImgAndTitle'); $imgTitle->setLabel($this->getView()->getCibleText('form_label_menu_display_image_and_title')); $imgTitle->removeDecorator('DtDdWrapper'); $imgTitle->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($imgTitle); // IMAGE $imageTmp = new Zend_Form_Element_Hidden('menuImage_tmp'); $imageTmp->removeDecorator('Label'); $this->addElement($imageTmp); $imageOrg = new Zend_Form_Element_Hidden('menuImage_original'); $imageOrg->removeDecorator('Label'); $this->addElement($imageOrg); $imageView = new Zend_Form_Element_Image('menuImage_preview', array('onclick' => 'return false;')); $imageView->setImage($imageSrc)->removeDecorator('DtDdWrapper'); $this->addElement($imageView); $imagePicker = new Cible_Form_Element_ImagePicker('menuImage', array('onchange' => "document.getElementById('imageView').src = document.getElementById('menuImage').value", 'associatedElement' => 'menuImage_preview', 'pathTmp' => $pathTmp, 'contentID' => $menuId)); $imagePicker->removeDecorator('Label'); $this->addElement($imagePicker); $this->addDisplayGroup(array('menuImgAndTitle', 'isNewImage', 'menuImage_tmp', 'menuImage_original', 'menuImage_preview', 'menuImage'), 'imageGroup'); $this->getDisplayGroup('imageGroup')->setAttrib('class', 'imageGroup')->setAttrib('style', 'display: none')->removeDecorator('DtDdWrapper'); }
public function __construct($options = null) { $galleryID = $options['galleryID']; $imageSrc = $options['imageSrc']; $isNewImage = $options['isNewImage']; if ($galleryID) { $this->_addSubmitSaveClose = true; } parent::__construct($options); // show online $showOnline = new Zend_Form_Element_Checkbox('G_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); // gallery position $position = new Zend_Form_Element_Text('G_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); // default gallery image $imageTmp = new Zend_Form_Element_Hidden('ImageSrc_tmp'); $imageTmp->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true)))); $this->addElement($imageTmp); // hidden specify if new image for the gallery $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage)); $newImage->setDecorators(array('ViewHelper')); $this->addElement($newImage); $imageOrg = new Zend_Form_Element_Hidden('ImageSrc_original'); $imageOrg->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'closeOnly' => true)))); $this->addElement($imageOrg); $imageView = new Zend_Form_Element_Image('ImageSrc_preview', array('onclick' => 'return false;')); $imageView->setImage($imageSrc); $imageView->removeDecorator('label'); $this->addElement($imageView); $imagePicker = new Cible_Form_Element_ImageGalleryPicker('ImageSrc', array('associatedElement' => 'imageView', 'galleryID' => $galleryID)); $imagePicker->removeDecorator('Label'); $this->addElement($imagePicker); $blockCategory = new Zend_Form_Element_Select('G_CategoryID'); $blockCategory->setLabel('Catégorie de cette galerie')->setAttrib('class', 'largeSelect')->setOrder(5); $categories = new Categories(); $select = $categories->select()->setIntegrityCheck(false)->from('Categories')->join('CategoriesIndex', 'C_ID = CI_CategoryID')->where('C_ModuleID = ?', 9)->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']); } $gall = new Categories(); $select = $gall->select()->setIntegrityCheck(false)->from('Galleries')->where('G_ID = ?', $galleryID); $gallArray = $gall->fetchAll($select); $blockCategory->setValue($gallArray[0]['G_CategoryID']); $this->addElement($blockCategory); // Title $title = new Zend_Form_Element_Text('GI_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 = new Zend_Form_Element_Text('GI_Description'); // $description->setLabel($this->getView()->getCibleText('form_label_description')) // ->setRequired(false); // Description $description = new Cible_Form_Element_Editor('GI_Description', array('mode' => Cible_Form_Element_Editor::ADVANCED)); $description->setLabel($this->getView()->getCibleText('form_label_description'))->setAttrib('class', 'mediumEditor'); $this->addElement($description); }