public function __construct($options = null) { parent::__construct(); $this->setName('layout_form'); $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator'); $this->removeDecorator('Errors'); $this->removeDecorator('HtmlTag'); $this->removeDecorator('Label'); //$this->setAction($this->_generateActionUrl()); $layout_select = new Zend_Form_Element_Select('layout_select'); $layout_select->setAttrib('onchange', '$("#submitLayoutSelection").click();'); $layout_select->removeDecorator('Errors'); $layout_select->removeDecorator('Label'); $layout_select->removeDecorator('HtmlTag'); /*foreach($options as $language) $translation_select->addMultiOption($language['iso6391_lng'], $language['name_lng']); */ $layout_select->addMultiOption('default', 'Default'); $layout_select->addMultiOption('custom', 'Custom'); //$layout_select->setValue($this->_getCurrentLayoutSelect()); $layout_select->setValue('default'); $submit = new Zend_Form_Element_Submit('submitLayoutSelection'); $submit->removeDecorator('DtDdWrapper'); $submit->setAttrib('style', 'display: none;'); $this->addElements(array($layout_select, $submit)); }
public function __construct($number) { //$number = number family members //create a health form elements... //$fieldtype,$fieldname,$table,$columnname,$cssname,$labelname,$required,$validationtype,$min,$max,$rows,$cols,$decorator,$value $formfield = new App_Form_Field(); $ownername = $formfield->field('Text', 'ownername', '', '', '', '', true, '', '', '', '', '', 0, 0); $survey = $formfield->field('Text', 'survey', '', '', '', '', true, '', '', '', '', '', 0, 0); $survey->setAttrib('size', 10); $acre = $formfield->field('Text', 'acre', '', '', '', '', true, '', '', '', '', '', 0, 0); $acre->setAttrib('size', 5); $acrevalue = $formfield->field('Text', 'acrevalue', '', '', '', '', true, '', '', '', '', '', 0, 0); $acrevalue->setAttrib('size', 5); $tenant = new Zend_Form_Element_Select('tenant'); $tenant->removeDecorator('DtDdWrapper'); $tenant->removeDecorator('HtmlTag'); $tenant->removeDecorator('label'); $village = $formfield->field('Text', 'village', '', '', '', '', true, '', '', '', '', '', 0, 0); $ownertype = new Zend_Form_Element_Select('ownertype'); $ownertype->removeDecorator('DtDdWrapper'); $ownertype->removeDecorator('HtmlTag'); $ownertype->removeDecorator('label'); $land_id = $formfield->field('Hidden', 'land_id', '', '', '', '', '', '', '', '', '', '', 0, 0); $this->addElements(array($tenant, $ownername, $village, $survey, $acre, $acrevalue, $ownertype, $land_id)); }
/** * Te get Zend Form Element Select * @param string $id * @param array $options * @param string $select = '' * @param bool $elementequired = true * @return Zend_Form_Element_Select */ public function getComboBox($id, $options, $select = '', $elementequired = true, $disable = false) { $element = new Zend_Form_Element_Select($id); $element->removeDecorator('HtmlTag'); $element->removeDecorator('DtDdWrapper'); $element->removeDecorator('Label'); if ($elementequired) { $element->setAttribs(array('class' => 'validate[required]')); } $element->addMultiOptions($options); if ($select !== '') { $element->setValue($select); } if ($disable) { $element->setAttrib('disabled', 'disabled'); } return $element; }
/** * Inicializace formulare * */ public function init() { $this->setMethod(self::METHOD_POST); //nazev testu $name = $this->createElement('text', 'nazev'); $name->addFilter('StringTrim'); $name->setRequired(true); $name->setAttrib('class', 'form-control dd-test'); $name->setAttrib('placeholder', 'Name'); $name->removeDecorator('Label'); $this->addElement($name); //kategorie testu $technology = new Zend_Form_Element_Select('id_technologie'); $technology->removeDecorator('Label'); $technology->setAttrib('class', 'form-control dd-test'); $this->addElement($technology); //obtiznost $seniority = new Zend_Form_Element_Select('id_seniorita'); $seniority->removeDecorator('Label'); $seniority->setAttrib('class', 'form-control dd-test'); $this->addElement($seniority); //prideleny cas $time = $this->createElement('text', 'pocet_minut'); $time->setRequired(true); $validator = new Zend_Validate_Digits(); $validator->isValid("1234567890"); $time->addValidator($validator); $time->setAttrib('class', 'form-control dd-test'); $time->setAttrib('placeholder', 'Allotted time'); $time->removeDecorator('Label'); $this->addElement($time); //popis $name = $this->createElement('textarea', 'popis'); $name->addFilter('StringTrim'); $name->setRequired(true); $name->setAttrib('class', 'form-control dd-test'); $name->setAttrib('placeholder', 'Description'); $name->removeDecorator('Label'); $this->addElement($name); //submit button $button = $this->createElement('submit', 'saveTest', array('label' => 'Save General Information')); $button->setAttrib('class', 'extra-button-own'); $this->addElement($button); }
function setForm($check,$id) { $form=new Zend_Form; $form->setMethod('post')->setAction(''); $category_name = new Zend_Form_Element_Text('category_name'); $category_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên chuyên mục không được để trống')); $category_parent_id = new Zend_Form_Element_Select('category_parent_id'); $category_parent_id->addMultiOption('0', ''); if($check==1) { $list = $this->mChuyenmuc->getListParentSubOne($id); } else { $list = $this->mChuyenmuc->getListCmParent(); } foreach($list as $item) { $category_parent_id->addMultiOption($item['category_id'],$item['category_name']); } $is_active= new Zend_Form_Element_Radio('is_active'); $is_active->setRequired(true) ->setLabel('Are you sure?') ->setMultiOptions(array( "1" => "Có", "0" => "Không")); $category_name->removeDecorator('HtmlTag')->removeDecorator('Label'); $category_parent_id->removeDecorator('HtmlTag')->removeDecorator('Label'); $is_active->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($category_name,$category_parent_id,$is_active)); return $form; }
/** * Inicializace formulare * */ public function init() { $this->setMethod(self::METHOD_POST); // ################## FIRST COLUMN ################### // datum pohovoru $elem = new Zend_Form_Element_Text('datum_pohovoru'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', array('form-control', 'date-picker')); $elem->setAttrib('placeholder', 'Pick a date…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'datum_pohovoru'); // Multi select (perzonalista – pokročilé informace) $elem = new Zend_Form_Element_Multiselect('perzonalista_informace'); $elem->removeDecorator('Label'); $elem->setAttrib('placeholder', 'Pick an interviewers…'); $elem->setAttrib('class', 'form-control'); $this->addElement($elem, 'perzonalista_informace'); // vzdělání $elem = new Zend_Form_Element_Text('vzdelani'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Education…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'vzdelani'); // motivace $elem = new Zend_Form_Element_Textarea('motivace'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Motivation…'); $elem->setAttrib('rows', '1'); $elem->removeDecorator('Label'); $this->addElement($elem, 'motivace'); // preferovaná práce $elem = new Zend_Form_Element_Textarea('preferovana_prace'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Kind of work preferred…'); $elem->setAttrib('rows', '1'); $elem->removeDecorator('Label'); $this->addElement($elem, 'preferovana_prace'); // ambice $elem = new Zend_Form_Element_Textarea('ambice'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Ambitions…'); $elem->setAttrib('rows', '1'); $elem->removeDecorator('Label'); $this->addElement($elem, 'ambice'); // jazyky $elem = new Zend_Form_Element_Text('jazyky'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Languages…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'jazyky'); // cestování $elem = new Zend_Form_Element_Text('cestovani'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Travelling…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'cestovani'); // ################## SECOND COLUMN ################### // plusy_minusy $elem = new Zend_Form_Element_Textarea('plusy_minusy'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Pluses/Minuses…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'plusy_minusy'); // zkusenosti_v_tymu $elem = new Zend_Form_Element_Textarea('zkusenosti_v_tymu'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Team work experience…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'zkusenosti_v_tymu'); // pracovni_misto $elem = new Zend_Form_Element_Textarea('pracovni_misto'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Domain/Areas of work…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'pracovni_misto'); // knowhow $elem = new Zend_Form_Element_Textarea('knowhow'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Skills and technologies…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'knowhow'); // dalsi_informace $elem = new Zend_Form_Element_Textarea('dalsi_informace'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Other informations…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'dalsi_informace'); // ################## THIRD COLUMN ################### // shrnuti_pohovoru $elem = new Zend_Form_Element_Textarea('shrnuti_pohovoru'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Summary of the interview…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'shrnuti_pohovoru'); // idealni_pozice $elem = new Zend_Form_Element_Text('idealni_pozice'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Ideal for position/project…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'idealni_pozice'); // datum_zahajeni $elem = new Zend_Form_Element_Text('datum_zahajeni'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', array('form-control', 'date-picker')); $elem->setAttrib('placeholder', 'Posible starting date…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'datum_zahajeni'); // uvazek $elem = new Zend_Form_Element_Select('id_uvazek'); $elem->removeDecorator('Label'); $elem->setAttrib('class', 'form-control'); $this->addElement($elem, 'id_uvazek'); // mzda $elem = new Zend_Form_Element_Text('mzda'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Salary…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'mzda'); $elem = new Zend_Form_Element_Select('id_mena'); $elem->removeDecorator('Label'); $elem->setAttrib('class', 'form-control'); $this->addElement($elem, 'id_mena'); // datum_pristiho_kontaktu $elem = new Zend_Form_Element_Text('datum_pristiho_kontaktu'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', array('form-control', 'date-picker')); $elem->setAttrib('placeholder', 'Pick a date…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'datum_pristiho_kontaktu'); // ###################### BUTTON ###################### $save = new Zend_Form_Element_Submit('saveButton'); $save->setLabel('Save'); $save->setAttrib('class', 'btn btn-success'); $save->setDecorators(array('ViewHelper')); $this->addElement($save, 'saveButton'); }
/** * Inicializace formulare * */ public function init() { $this->setMethod(self::METHOD_POST); // ################## FIRST COLUMN ################### // Photo (id_foto) // File picker $profilePhotoPicker = new Zend_Form_Element_File('profilePhoto'); $profilePhotoPicker->setDestination(PUBLIC_PATH . '/temp'); $profilePhotoPicker->addValidator('Count', false, 1); $profilePhotoPicker->addValidator('Size', false, 2097152); $profilePhotoPicker->removeDecorator('Label'); $this->addElement($profilePhotoPicker, 'profilePhoto'); $avatar = new Zend_Form_Element_Image('avatar'); $avatar->setAttrib('class', array("profile-user-img", "img-responsive", "img-circle")); $this->addElement($avatar, 'avatar'); // First name (jmeno) $firstName = $this->createElement('text', 'jmeno'); $firstName->addFilter('StringTrim'); $firstName->setRequired(true); $firstName->setAttrib('class', 'form-control'); $firstName->setAttrib('placeholder', 'First name'); $firstName->removeDecorator('Label'); $this->addElement($firstName); // Last name (prijmeni) $lastName = $this->createElement('text', 'prijmeni'); $lastName->addFilter('StringTrim'); $lastName->setRequired(true); $lastName->setAttrib('class', 'form-control'); $lastName->setAttrib('placeholder', 'Surname'); $lastName->removeDecorator('Label'); $this->addElement($lastName); // Date of birth (datum_narozeni) // Date picker $birthdate = $this->createElement('text', 'datum_narozeni'); $birthdate->setRequired(true); $birthdate->setAttrib('class', array('form-control', 'date-picker')); $birthdate->removeDecorator('Label'); $birthdate->setAttrib('placeholder', 'Birthdate'); $this->addElement($birthdate); // ################## SECOND COLUMN ################## // Status (id_status) // Select box $status = new Zend_Form_Element_Select('id_status'); $status->removeDecorator('Label'); $status->setAttrib('class', 'form-control'); $this->addElement($status, 'id_status'); // Position (id_pozice) // Select box $position = new Zend_Form_Element_Select('id_pozice'); $position->removeDecorator('Label'); $position->setAttrib('class', 'form-control'); $this->addElement($position, 'id_pozice'); // Technology (kandidat_technologie) // Multi select $technology = new Zend_Form_Element_Multiselect('kandidat_technologie'); $technology->removeDecorator('Label'); $technology->setAttrib('class', 'form-control'); $this->addElement($technology, 'kandidat_technologie'); // Seniority (id_seniorita) // Select box $seniority = new Zend_Form_Element_Select('id_seniorita'); $seniority->removeDecorator('Label'); $seniority->setAttrib('class', 'form-control'); $this->addElement($seniority, 'id_seniorita'); // Comment (komentar) $comment = $this->createElement('textarea', 'komentar'); $comment->addFilter('StringTrim'); $comment->setAttrib('class', 'form-control'); $comment->setAttrib('rows', '3'); $comment->setAttrib('placeholder', 'Enter your comment…'); $comment->removeDecorator('Label'); $this->addElement($comment); // ################### ATTACHEMENTS ################### // Attchements (kandidat_priloha) // File picker $attachments = new Zend_Form_Element_File('attachments'); $attachments->setDestination(PUBLIC_PATH . '/temp'); $attachments->addValidator('Count', false, array('min' => 0, 'max' => 4)); $attachments->addValidator('Size', false, 2097152); $attachments->setMultiFile(4); $attachments->removeDecorator('Label'); $this->addElement($attachments, 'attachments'); $attachmentsCheckGroup = new Zend_Form_Element_MultiCheckbox('attachmentsCheckGroup'); $comment->removeDecorator('Label'); $this->addElement($attachmentsCheckGroup, 'attachmentsCheckGroup'); // ###################### BUTTON ###################### $close = new Zend_Form_Element_Submit('closeButton'); $close->setLabel('Back'); $close->setAttrib('class', 'btn btn-default'); $close->setDecorators(array('ViewHelper')); $this->addElement($close, 'closeButton'); $save = new Zend_Form_Element_Submit('saveButton'); $save->setLabel('Save'); $save->setAttrib('class', 'btn btn-success'); $save->setDecorators(array('ViewHelper')); $this->addElement($save, 'saveButton'); $delete = new Zend_Form_Element_Submit('deleteButton'); $delete->setLabel('Delete'); $delete->setAttrib('class', 'btn btn-danger'); $delete->setAttrib('onclick', 'if (confirm("Are you sure?")) { document.form.submit(); } return false;'); $delete->setDecorators(array('ViewHelper')); $this->addElement($delete, 'deleteButton'); }
/** * @todo : description * @return mixed * @throws Centurion_Exception */ public function generateList() { $select = $this->getSelectFiltred(); //TODO: move all of this in a view helper (except pagination, ) $headCol = array(); foreach ($this->_displays as $key => $col) { if (is_string($col)) { $label = $col; } else { if (is_array($col) && isset($col['label'])) { $label = $col['label']; } else { throw new Centurion_Exception(sprintf('Col %s have no label', $key)); } } $params = array('page' => 0, 'sort' => $key, 'order' => $this->_sort !== $key || $this->_order === Zend_Db_Select::SQL_DESC ? Zend_Db_Select::SQL_ASC : Zend_Db_Select::SQL_DESC); $params += $this->getFilter()->getValuesForUrl(); if (!isset($col['sortable']) || $col['sortable'] !== false) { $link = $this->view->url($params); } else { $link = null; } $headCol[$key] = array('label' => $label, 'link' => $link); } $this->_headCol = $headCol; $this->_preGenerateList(); $paginator = $this->getPaginator($select); $this->_postGenerateList($paginator); $result = array(); foreach ($paginator as $row) { $temp = array(); if ($this->_showCheckbox) { //TODO : id en dur, utiliser la pk du model $temp['checkbox'] = '<input type="checkbox" value="' . $row->id . '" name="rowId[]">'; } foreach ($this->_displays as $key => $options) { if (is_string($options) || !isset($options['type'])) { $value = $row->{$key}; } else { if ($options['type'] === self::COLS_ROW_COL) { if (isset($options['col'])) { $col = $options['col']; } else { $col = $key; } $value = $row->{$col}; } else { if ($options['type'] === self::COLS_ROW_FUNCTION) { if (isset($options['function'])) { $function = $options['function']; } else { $function = $key; } $value = $row->{$function}(); } else { if ($options['type'] === self::COLS_CALLBACK) { if (!isset($options['callback'])) { $options['callback'] = array($this, $key); } $params = array_merge(array($row), isset($options['callbackParams']) ? (array) $options['callbackParams'] : array()); $value = call_user_func_array($options['callback'], $params); } else { if ($options['type'] === self::COLS_TYPE_PREVIEW) { $value = '<a href="' . $this->view->url(array('object' => $row), $options['param']['route']) . '">' . $this->view->translate('Preview') . '</a>'; } else { if ($options['type'] === self::COL_TYPE_FIRSTCOL) { $value = $this->view->renderToString('centurion/_first_col.phtml', array('extraParam' => $this->_extraParam, 'row' => $row, 'first' => $options['param'], 'controller' => $this->_request->getControllerName(), 'module' => $this->_request->getModuleName())); } else { if ($options['type'] === self::COL_TYPE_ONOFF) { if (isset($options['onoffLabel']) && count($options['onoffLabel']) === 2) { $onLabel = $options['onoffLabel'][0]; $offLabel = $options['onoffLabel'][1]; } else { $onLabel = $this->view->translate('On'); $offLabel = $this->view->translate('Off'); } if (isset($options['column'])) { $column = $options['column']; } else { $column = $key; } //TODO : id en dur, utiliser la pk du model $element = new Zend_Form_Element_Select(array('disableTranslator' => true, 'name' => $key . '_' . $row->id, 'class' => 'field-switcher')); $element->addMultiOption('1', $onLabel); $element->addMultiOption('0', $offLabel); $element->removeDecorator('Label'); $element->setValue($row->{$column}); $value = $element->render(); } else { //TODO: more explicit (add type, ...) throw new Centurion_Exception(sprintf('I don\'t now what to do with the col %s', $key)); } } } } } } } if (is_array($options) && isset($options['filters'])) { $options['filters'] = (array) $options['filters']; //TODO: allow to use real filter (instance of Zend_Filter_Interface) foreach ($options['filters'] as $filter) { if ($filter === self::COL_DISPLAY_DATE) { if ($value == '0000-00-00 00:00:00' || $value == null) { $value = ''; } else { $date = new Zend_Date($value, Centurion_Date::MYSQL_DATETIME); $value = $date->toString(Zend_Date::DATE_MEDIUM); } } } } $temp[$key] = $value; } $temp['row'] = $row; //TODO : id en dur, utiliser la pk du model $result[$row->id] = $temp; } $this->_result = $result; return $this->_result; }
function setForm() { $form = new Zend_Form; $form->setAction('')->setMethod('post'); $comment_content = new Zend_Form_Element_Textarea('comment_content'); $comment_content->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Nội dung bình luận không được để trống')); $comment_content->setAttrib('rows', '5'); $news_id = new Zend_Form_Element_Select('news_id'); foreach($this->mComment->getListNews() as $news) { $news_id->addMultiOption($news['news_id'],$news['news_title']); } $comment_content->removeDecorator('HtmlTag')->removeDecorator('Label'); $news_id->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($comment_content,$news_id)); return $form; }
$areatopoi_data = $table_areatopoi->getPoiAreaId($poi_id); $this->view->area_data = $areatopoi_data; } elseif ($type == 'pusharea') { $this->getResponse()->setHeader('Content-Type', 'text/xml'); $areatopoi_data = $table_areatopoi->getPoiAreaId($poi_id); $this->view->area_data = $areatopoi_data; } elseif ($type == 'pushcategory') { $this->getResponse()->setHeader('Content-Type', 'text/xml'); $category_data = $table_categorytopoi->getCategoryIdByPoiId($poi_id); $this->view->category_data = $category_data; } } public function destinationdataindoAction() { $type = $this->_getParam('type'); $poi_id = $this->_getParam('poiid'); $this->view->type = $type; /* preparing table instance */ $table_categorytopoi = new Model_DbTable_CategoryToPoi(); $table_category = new Model_DbTable_Category(); $table_destination = new Model_DbTable_Destination(); $table_areatopoi = new Model_DbTable_AreaToPoi(); /* get the main category */ if ($type == 'category') { $main_category = $table_destination->getMainCategoryById($poi_id); $category_data = $table_categorytopoi->getCategoryByPoiId($poi_id, 2); $this->view->category_data = $category_data; $this->view->main_category = $main_category; } elseif ($type == 'area') { $areatopoi_data = $table_areatopoi->getPoiAreaId($poi_id);
function formInsert() { $form = new Zend_Form; $form->setMethod('post')->setAction(''); $link = new Zend_Form_Element_Text('link'); $link ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Liên kết không được để trống')); $title = new Zend_Form_Element_Text('title'); $title ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tiêu đề không được để trống')); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', '5'); $description->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mô tả không được để trống')); $is_active = $form->createElement("radio","is_active",array( "label" => "Kích hoạt", "multioptions"=> array( "1" => "Có", "0" => "Không"))); if($this->role == "0") { $listCategoryId = $this->mVideo->getListCategory(); } else { $listCategoryId = $this->mVideo->getCategoryIdByUserId($this->user_id); } $listCategory = array(); foreach($listCategoryId as $category) { $listCategory[] = $this->mVideo->getCategoryByCategoryId($category['category_id']); } $categoryId = new Zend_Form_Element_Select('category_id'); foreach($listCategory as $category) { $categoryId->addMultiOption($category['category_id'],$category['category_name']); } $link->removeDecorator('HtmlTag')->removeDecorator('Label'); $title->removeDecorator('HtmlTag')->removeDecorator('Label'); $description->removeDecorator('HtmlTag')->removeDecorator('Label'); $categoryId->removeDecorator('HtmlTag')->removeDecorator('Label'); $is_active->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($link,$title,$description,$is_active,$categoryId)); return $form; }
/** * Add a select (dropdown list) element to the form. * * @param array $question * * @return void */ private function _addSelect($question) { $elemName = $question['FQT_TypeName'] . self::UNDERSCORE . $question['FQ_ElementID']; $element = new Zend_Form_Element_Select($elemName); $element->removeDecorator('DtDdWrapper'); $element->addDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'answer-zone')))); $element->setAttrib('class', 'stdSelect'); $this->_addExtras($element, $question); $this->addElement($element); $this->_displayGroupElements[] = $elemName; }