Ejemplo n.º 1
0
 public function addFileIdElement()
 {
     $oFileId = new Zend_Form_Element_MultiCheckbox("file_id");
     $oFileId->setLabel("Załączniki:");
     $oFileId->setRequired(FALSE);
     $oFileId->addMultiOptions(array());
     $this->addElement($oFileId);
 }
Ejemplo n.º 2
0
 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oNotificationTypeId = new Zend_Form_Element_MultiCheckbox("notification_type_id");
     $oNotificationTypeId->setLabel("Typ:");
     $oNotificationTypeId->setRequired(FALSE);
     $oNotificationTypeId->addMultiOptions($this->_aAllNotificationType);
     $this->addElement($oNotificationTypeId);
     $oNotificationStatusId = new Zend_Form_Element_MultiCheckbox("notification_status_id");
     $oNotificationStatusId->setLabel("Status:");
     $oNotificationStatusId->setRequired(FALSE);
     $oNotificationStatusId->addMultiOptions($this->_aAllNotificationStatus);
     $this->addElement($oNotificationStatusId);
     $oNotificationPriorityId = new Zend_Form_Element_MultiCheckbox("notification_priority_id");
     $oNotificationPriorityId->setLabel("Priorytet:");
     $oNotificationPriorityId->setRequired(FALSE);
     $oNotificationPriorityId->addMultiOptions($this->_aAllNotificationPriority);
     $this->addElement($oNotificationPriorityId);
     $oNotificationCategoryId = new Zend_Form_Element_Select("search_notification_category_id");
     $oNotificationCategoryId->setLabel("Kategoria pytania:");
     $oNotificationCategoryId->setRequired(FALSE);
     $oNotificationCategoryId->addMultiOptions($this->_aAllNotificationCategory);
     $this->addElement($oNotificationCategoryId);
     $oUserId = new Zend_Form_Element_Select("search_notification_user_id");
     $oUserId->setLabel("Konsultant:");
     $oUserId->setRequired(FALSE);
     $oUserId->addMultiOptions($this->_aAllUser);
     $this->addElement($oUserId);
     $oInitDate = new Zend_Form_Element_Text("init_date");
     $oInitDate->setLabel("Data rozpoczęcia:");
     $oInitDate->setRequired(FALSE);
     $oInitDate->setFilters($this->_aFilters);
     $this->addElement($oInitDate);
     $oBlankNotificationUserId = new Zend_Form_Element_Checkbox("search_blank_notification_user_id");
     $oBlankNotificationUserId->setLabel("Pokaż nieprzydzielone zgłoszenia:");
     $this->addElement($oBlankNotificationUserId);
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oSubmit = $this->createElement("submit", "search_notification");
     $oSubmit->setLabel("Szukaj");
     $this->addElement($oSubmit);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/_defaultform.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
Ejemplo n.º 3
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'feedforwardinit');
     $id = new Zend_Form_Element_Hidden('id');
     $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
     $appraisal_mode = new Zend_Form_Element_Select('appraisal_mode');
     $appraisal_mode->setLabel("Appraisal");
     $appraisal_mode->setMultiOptions(array('' => 'Select Appraisal'));
     $appraisal_mode->setAttrib('class', 'selectoption');
     $appraisal_mode->setRequired(true);
     $appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal.'));
     $status = new Zend_Form_Element_Select('status');
     $status->setLabel("Status");
     $status->setAttrib('class', 'selectoption');
     $status->setMultiOptions(array('1' => 'Open'));
     //,'2' => 'Close'
     $status->setRegisterInArrayValidator(false);
     $status->setRequired(true);
     $status->addValidator('NotEmpty', false, array('messages' => 'Please select status.'));
     $employee_name_view = new Zend_Form_Element_Radio('employee_name_view');
     $employee_name_view->setLabel("Employee Details");
     $employee_name_view->addMultiOptions(array('1' => 'Show', '0' => 'Hide'));
     $employee_name_view->setSeparator('');
     $employee_name_view->setValue(0);
     $employee_name_view->setRegisterInArrayValidator(false);
     $enable_to = new Zend_Form_Element_MultiCheckbox('enable_to');
     $enable_to->setLabel("Enable To");
     $enable_to->addMultiOptions(array('0' => 'Appraisal Employees', '1' => 'All Employees'));
     $enable_to->setSeparator('');
     $enable_to->setValue(0);
     $enable_to->setRequired(true);
     $enable_to->setRegisterInArrayValidator(false);
     $enable_to->addValidator('NotEmpty', false, array('messages' => 'Please check enable to.'));
     $ff_due_date = new Zend_Form_Element_Text('ff_due_date');
     $ff_due_date->setLabel("Due Date");
     $ff_due_date->setOptions(array('class' => 'brdr_none'));
     $ff_due_date->setRequired(true);
     $ff_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.'));
     $save = new Zend_Form_Element_Submit('submit');
     $save->setAttrib('id', 'submitbutton');
     $save->setLabel('Save & Initialize');
     $save_later = new Zend_Form_Element_Submit('submit');
     $save_later->setAttrib('id', 'submitbutton1');
     $save_later->setLabel('Save & Initialize Later');
     $this->addElements(array($id, $appraisal_mode, $status, $employee_name_view, $ff_due_date, $save, $save_later, $enable_to));
     $this->setElementDecorators(array('ViewHelper'));
 }
Ejemplo n.º 4
0
 public function __construct($options = null)
 {
     $this->_disabledDefaultActions = false;
     unset($options['object']);
     parent::__construct($options);
     $label = new Cible_Form_Element_Html('txtAddToNewsletter', array('value' => $this->getView()->getCibleText('profile_addto_newletter_label')));
     $label->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'h2'))));
     $newsletterCategories = $this->getView()->GetAllNewsletterCategories();
     $newsletterCategories = $newsletterCategories->toArray();
     foreach ($newsletterCategories as $cat) {
         $catLst[$cat['C_ID']] = $cat['CI_Title'];
     }
     $chkCat = new Zend_Form_Element_MultiCheckbox("NP_Categories");
     $chkCat->addMultiOptions($catLst);
     $chkCat->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'id' => '', 'class' => 'label_after_checkbox'))));
     $this->addElement($label);
     $this->addElement($chkCat);
 }
Ejemplo n.º 5
0
 public function init($ppty_id)
 {
     global $mySession;
     $db = new Db();
     $country_id_value = "";
     $state_id_value = "";
     $city_id_value = "";
     $address_value = "";
     $zipcode_value = "";
     $telephone_value = "";
     $website_value = "";
     $no_of_bedroom_value = "";
     $no_of_bathroom_value = "";
     $no_of_en_suite_bathroom_value = "";
     $occupancy_value = "";
     $company_name_value = "";
     $agent_name_value = "";
     $agent_address_value = "";
     $agent_telephone = "";
     $agent_email_value = "";
     $direction_property_value = "";
     $key_instruction_value = "";
     $late_instruction_value = "";
     $arrival_instruction_value = "";
     $title_value = "";
     $introduction_value = "Up to 300 Characters";
     $sub_area_value = "";
     $local_area_value = "";
     $accomodation_type_value = "";
     $rating_value = "";
     $meta_keywords_value = "";
     $meta_description_value = "";
     if ($ppty_id != "") {
         $pptyData = $db->runQuery("select * from " . PROPERTY . " where id = '" . $ppty_id . "' ");
         //prd($pptyData);
         $title_value = $pptyData[0]['property_title'];
         $introduction_value = $pptyData[0]['brief_desc'];
         $country_id_value = $pptyData[0]['country_id'];
         $state_id_value = $pptyData[0]['state_id'];
         $city_id_value = $pptyData[0]['city_id'];
         $sub_area_value = $pptyData[0]['sub_area_id'];
         $local_area_value = $pptyData[0]['local_area_id'];
         $zipcode_value = $pptyData[0]['zipcode'];
         $accomodation_type_value = $pptyData[0]['property_type'];
         $no_of_bedroom_value = $pptyData[0]['bedrooms'];
         $no_of_bathroom_value = $pptyData[0]['bathrooms'];
         $no_of_en_suite_bathroom_value = $pptyData[0]['en_bedrooms'];
         $occupancy_value = $pptyData[0]['maximum_occupancy'];
         $meta_keywords_value = $pptyData[0]['meta_keywords'];
         $meta_description_value = $pptyData[0]['meta_description'];
         //get attribute values
         $attributeVal = $db->runQuery("select attrib.attribute_id, attrib.attribute_name from " . ATTRIBUTE_ANS . " attrib_ans inner join " . ATTRIBUTE . " attrib on attrib_ans.ans_attribute_id = attrib.attribute_id where attribute_status = '1' and attrib_ans.ans_property_id= '{$ppty_id}' ");
         $attributeVal = array_map(function ($x) {
             return $x['attribute_id'];
         }, $attributeVal);
     }
     $title = new Zend_Form_Element_Text('title');
     $title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Title is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required limitmatch")->setAttrib("placeholder", "Up to 100 Characters")->setAttrib("maxlength", "100")->setValue($title_value);
     $meta_keywords = new Zend_Form_Element_Text('meta_keywords');
     $meta_keywords->addValidator('NotEmpty', true, array('messages' => 'Keywords is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput  limitmatch")->setAttrib("placeholder", "Up to 100 Characters")->setAttrib("maxlength", "100")->setValue($meta_keywords_value);
     $meta_description = new Zend_Form_Element_Text('meta_description');
     $meta_description->addValidator('NotEmpty', true, array('messages' => 'Description is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput  limitmatch")->setAttrib("placeholder", "Up to 200 Characters")->setAttrib("maxlength", "200")->setValue($meta_description_value);
     $introduction = new Zend_Form_Element_Textarea('introduction');
     $introduction->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Title is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required limitmatch1")->setAttrib("placeholder", "Up to 300 Characters ")->setAttrib("maxlength", "300")->setValue($introduction_value);
     $CountryArr = array();
     $CountryArr[0]['key'] = "";
     $CountryArr[0]['value'] = "- - Country - -";
     $CountryData = $db->runQuery("select * from " . COUNTRIES . "  order by country_name");
     if ($CountryData != "" and count($CountryData) > 0) {
         $i = 1;
         foreach ($CountryData as $key => $CountryValues) {
             $CountryArr[$i]['key'] = $CountryValues['country_id'];
             $CountryArr[$i]['value'] = $CountryValues['country_name'];
             $i++;
         }
     }
     $country_id = new Zend_Form_Element_Select('country_id');
     $country_id->setRequired(true)->addMultiOptions($CountryArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required")->setAttrib("onchange", "getCountryState(this.value);")->setValue($country_id_value);
     $stateArr = array();
     $stateArr[0]['key'] = "";
     $stateArr[0]['value'] = "- - State - -";
     /* if($userId != "")
                   {
                   $stateData=$db->runQuery("select * from ".USERS." as u inner join ".STATE." as s on s.state_id = u.state_id
                   where u.user_id='".$userId."'");
                   $stateArr[0]['key'] = $stateData[0]['state_id'];
                   $stateArr[0]['value'] = $stateData[0]['state_name'];
                   $state_id_value = $adminData[0]['state_id'];
     
                   } */
     //		echo $_REQUEST['country_id']; exit;
     if ($_REQUEST['country_id'] != "" || $ppty_id != "") {
         if ($_REQUEST['country_id'] != "") {
             $stateData = $db->runQuery("select * from " . STATE . " as s inner join " . COUNTRIES . " as c on s.country_id = c.country_id\n\t\t\t \t\t\t\t\t\t  where s.country_id='" . $_REQUEST['country_id'] . "'");
             $state_id_value = $_REQUEST['state_id'];
         } else {
             $stateData = $db->runQuery("select * from " . STATE . " as s inner join " . COUNTRIES . " as c on s.country_id = c.country_id\n\t \t\t\t\t\t\t  where s.country_id='" . $country_id_value . "'");
         }
         $i = 1;
         foreach ($stateData as $values) {
             $stateArr[$i]['key'] = $values['state_id'];
             $stateArr[$i]['value'] = $values['state_name'];
             $i++;
         }
     }
     $state_id = new Zend_Form_Element_Select('state_id');
     $state_id->setRequired(true)->addMultiOptions($stateArr)->addValidator('NotEmpty', true, array('messages' => 'State is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setRegisterInArrayValidator(false)->setAttrib("class", "mws-textinput required")->setAttrib("onchange", "getStateCity(this.value);")->setValue($state_id_value);
     $cityArr = array();
     $cityArr[0]['key'] = "";
     $cityArr[0]['value'] = "- - City - -";
     /* if($userId != "")
                   {
                   $cityData=$db->runQuery("select * from ".USERS." as u inner join ".CITIES." as c on c.city_id = u.city_id
                   where u.user_id='".$userId."'");
                   $cityArr[0]['key'] = $cityData[0]['city_id'];
                   $cityArr[0]['value'] = $cityData[0]['city_name'];
                   $city_id_value = $cityData[0]['city_id'];
     
                   } */
     if ($_REQUEST['state_id'] != "" || $ppty_id != "") {
         if ($_REQUEST['state_id'] != "") {
             $cityData = $db->runQuery("select * from " . CITIES . " where state_id='" . $_REQUEST['state_id'] . "'");
             $city_id_value = $_REQUEST['city_id'];
         } else {
             $cityData = $db->runQuery("select * from " . CITIES . " where state_id='" . $state_id_value . "'");
         }
         $i = 1;
         foreach ($cityData as $values) {
             $cityArr[$i]['key'] = $values['city_id'];
             $cityArr[$i]['value'] = $values['city_name'];
             $i++;
         }
     }
     $city_id = new Zend_Form_Element_Select('city_id');
     $city_id->setRequired(true)->addMultiOptions($cityArr)->setRegisterInArrayValidator(false)->addValidator('NotEmpty', true, array('messages' => 'City is required.'))->setAttrib("class", "mws-textinput required")->setAttrib("onchange", "getCitySub(this.value);")->setValue($city_id_value);
     /*             * ** SUB AREA[OPTIONAL] **** */
     /*             * ************************** */
     $subareaArr = array();
     $subareaArr[0]['key'] = "";
     $subareaArr[0]['value'] = "- - Sub Area - -";
     if ($_REQUEST['city_id'] != "" || $ppty_id != "") {
         if ($_REQUEST['city_id'] != "") {
             $subareaData = $db->runQuery("select * from " . SUB_AREA . " where city_id ='" . $_REQUEST['city_id'] . "'");
             $sub_area_value = $_REQUEST['sub_area'];
         } else {
             $subareaData = $db->runQuery("select * from " . SUB_AREA . " where city_id ='" . $city_id_value . "'");
         }
         $i = 1;
         foreach ($subareaData as $values) {
             $subareaArr[$i]['key'] = $values['sub_area_id'];
             $subareaArr[$i]['value'] = $values['sub_area_name'];
             $i++;
         }
     }
     //prd($sub_area_value);
     $sub_area = new Zend_Form_Element_Select('sub_area');
     $sub_area->addMultiOptions($subareaArr)->setRegisterInArrayValidator(false)->setAttrib("class", "mws-textinput")->setAttrib("onchange", "getSubLocal(this.value);")->setValue($sub_area_value);
     /*             * ** LOCAL AREA[OPTIONAL] ** */
     /*             * ************************** */
     $localareaArr = array();
     $localareaArr[0]['key'] = "";
     $localareaArr[0]['value'] = "- - Local Area - -";
     if ($_REQUEST['sub_area'] != "" || $ppty_id != "") {
         if ($_REQUEST['sub_area'] != "") {
             $localareaData = $db->runQuery("select * from " . LOCAL_AREA . " where sub_area_id ='" . $_REQUEST['sub_area'] . "'");
             $local_area_value = $_REQUEST['local_area'];
         } else {
             $localareaData = $db->runQuery("select * from " . LOCAL_AREA . " where sub_area_id ='" . $sub_area_value . "'");
         }
         $i = 1;
         foreach ($localareaData as $values) {
             $localareaArr[$i]['key'] = $values['local_area_id'];
             $localareaArr[$i]['value'] = $values['local_area_name'];
             $i++;
         }
     }
     $local_area = new Zend_Form_Element_Select('local_area');
     $local_area->addMultiOptions($localareaArr)->setRegisterInArrayValidator(false)->setAttrib("class", "mws-textinput")->setValue($local_area_value);
     /* 		$address= new Zend_Form_Element_Textarea('address');
          $address->setAttrib("class","mws-textinput required")
          ->setAttrib("rows","4")
          ->setAttrib("cols","30")
          ->setValue($address_value); */
     $zipcode = new Zend_Form_Element_Text('zipcode');
     $zipcode->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Zipcode is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", "7")->setValue($zipcode_value);
     /* $telephone = new Zend_Form_Element_Text('telephone');
        $telephone->setRequired(true)
        ->addValidator('NotEmpty',true,array('messages' =>'Telephone number is required.'))
        ->addDecorator('Errors', array('class'=>'errmsg'))
        ->setAttrib("class","mws-textinput required")
        ->setAttrib("maxlength","15")
        ->setValue($telephone_value); */
     /* $website = new Zend_Form_Element_Text('website');
        $website->addDecorator('Errors', array('class'=>'errmsg'))
        ->setAttrib("class","mws-textinput url")
        ->setValue($website_value); */
     $accomodationData = $db->runQuery("select * from " . PROPERTY_TYPE . " order by ptyle_name");
     $accomodationArr[0]['key'] = "";
     $accomodationArr[0]['value'] = "- - select -- ";
     $i = 1;
     foreach ($accomodationData as $key => $Data) {
         $accomodationArr[$i]['key'] = $Data['ptyle_id'];
         $accomodationArr[$i]['value'] = $Data['ptyle_name'];
         $i++;
     }
     $accomodation_type = new Zend_Form_Element_Select('accomodation_type');
     $accomodation_type->setRequired(true)->addMultiOptions($accomodationArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required")->setValue($accomodation_type_value);
     /** number of bedrooms * */
     $no_of_bedroomArr[0]['key'] = "";
     $no_of_bedroomArr[0]['value'] = "- - Select - -";
     for ($i = 1; $i <= 10; $i++) {
         $no_of_bedroomArr[$i]['key'] = $i;
         $no_of_bedroomArr[$i]['value'] = $i;
     }
     $no_of_bedroom = new Zend_Form_Element_Select('no_of_bedroom');
     $no_of_bedroom->setRequired(true)->addMultiOptions($no_of_bedroomArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required")->setValue($no_of_bedroom_value);
     /** number of bathrooms * */
     $no_of_bathroomArr[0]['key'] = "";
     $no_of_bathroomArr[0]['value'] = "- - Select - -";
     for ($i = 1, $k = 1; $i <= 20; $k = $k + 0.5, $i++) {
         $no_of_bathroomArr[$i]['key'] = $k;
         $no_of_bathroomArr[$i]['value'] = $k;
     }
     $no_of_bathroom = new Zend_Form_Element_Select('no_of_bathroom');
     $no_of_bathroom->setRequired(true)->addMultiOptions($no_of_bathroomArr)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required")->setValue($no_of_bathroom_value);
     /** number of En-Suite Bathrooms * */
     $no_of_nbathroomArr[0]['key'] = "";
     $no_of_nbathroomArr[0]['value'] = "- - Select - -";
     for ($i = 1, $k = 0; $k <= 8; $i++, $k++) {
         $no_of_nbathroomArr[$i]['key'] = $k;
         $no_of_nbathroomArr[$i]['value'] = $k;
     }
     $no_of_en_suite_bathroom = new Zend_Form_Element_Select('no_of_en_suite_bathroom');
     $no_of_en_suite_bathroom->setRequired(true)->addMultiOptions($no_of_nbathroomArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required")->setValue($no_of_en_suite_bathroom_value);
     /** maximum occupancy * */
     $occupancyArr[0]['key'] = "";
     $occupancyArr[0]['value'] = "- - Select - -";
     for ($i = 1; $i <= 20; $i++) {
         $occupancyArr[$i]['key'] = $i;
         $occupancyArr[$i]['value'] = $i;
     }
     $occupancy = new Zend_Form_Element_Select('occupancy');
     $occupancy->setRequired(true)->addMultiOptions($occupancyArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required")->setValue($occupancy_value);
     /** Rating * */
     /* 		
                   for($i = 1; $i<=5;$i++)
                   {
                   $ratingArr[$i]['key'] = $i;
                   }
     
     
      $rating = new Zend_Form_Element_Radio('rating');
                   $rating->setRequired(true)
                   ->addMultiOptions($ratingArr)
                   ->setRegisterInArrayValidator(false)
                   ->removeDecorator('label')
                   ->setAttrib("class","star")
                   ->setValue($rating_value);
     */
     $primesData = $db->runQuery("select * from " . ATTRIBUTE . " where attribute_status = '1' ");
     foreach ($primesData as $primesKey => $primesVal) {
         $primesArr[$primesKey]['key'] = $primesVal['attribute_id'];
         $primesArr[$primesKey]['value'] = $primesVal['attribute_name'];
     }
     $primes = new Zend_Form_Element_MultiCheckbox('primes');
     $primes->addMultiOptions($primesArr)->setAttrib("class", "mws-textinput")->setAttrib('label_style', '')->setAttrib("padding", "5px")->setValue($attributeVal);
     /* hidden field for checking the step */
     $step = new Zend_Form_Element_Hidden('step');
     $step->setValue("1");
     $ppty_no = new Zend_Form_Element_Hidden('ppty_no');
     $ppty_no->setValue(generate_property_no(11));
     $this->addElements(array($title, $introduction, $country_id, $state_id, $city_id, $zipcode, $accomodation_type, $no_of_bedroom, $no_of_bathroom, $no_of_en_suite_bathroom, $occupancy, $step, $sub_area, $local_area, $ppty_no, $meta_keywords, $meta_description, $primes));
 }
Ejemplo n.º 6
0
 /**
  * Defines and build an input field which is not a text field.
  * According to the parameter elem, it will set the element.
  *
  * $params['exclude']   => boolean; The column will not be built.<br />
  * $params['required '] => boolean;<br />
  * $params['elem']      => select, checkbox, radio, editor;<br />
  *                         If $params['elem'] = select, then the $params['src']<br />
  *                         parameter must be defined.
  * $params['src']       => string; name of the source for the element.<br />
  *
  * @param array $meta
  * @param array $params
  *
  * @return void
  */
 public function setElementInput(array $meta, array $params)
 {
     if (!empty($params)) {
         if (!isset($params['elem'])) {
             $params['elem'] = '';
         }
         $fieldId = $meta['COLUMN_NAME'];
         switch ($params['elem']) {
             case 'select':
                 if (empty($params['src'])) {
                     throw new Exception('Trying to build an element but no data source given');
                 }
                 $this->_defineSrc($params, $meta);
                 $element = new Zend_Form_Element_Select($fieldId);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId))->setAttrib('class', 'largeSelect')->addMultiOptions($this->_srcData);
                 $element = $this->_setBasicDecorator($element);
                 break;
             case 'checkbox':
                 $element = new Zend_Form_Element_Checkbox($fieldId);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId));
                 $this->_decoParams['class'] .= 'label_after_checkbox';
                 $this->_decoParams['labelPos'] = 'append';
                 $element = $this->_setBasicDecorator($element);
                 break;
             case 'radio':
                 $this->_defineSrc($params, $meta);
                 $element = new Zend_Form_Element_Radio($fieldId);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId));
                 $element->setSeparator('')->addMultiOptions($this->_srcData);
                 $this->_decoParams['class'] .= 'radio radioInline';
                 $element = $this->_setBasicDecorator($element);
                 break;
             case 'hidden':
                 $element = new Zend_Form_Element_Hidden($fieldId);
                 $element->removeDecorator('Label');
                 $element->removeDecorator('DtDdWrapper');
                 break;
             case 'multiCheckbox':
                 if (empty($params['src'])) {
                     throw new Exception('Trying to build an element but no data source given');
                 }
                 $this->_defineSrc($params, $meta);
                 $element = new Zend_Form_Element_MultiCheckbox($fieldId);
                 $element->addMultiOptions($this->_srcData);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId));
                 $element->setAttrib('class', 'multicheckbox');
                 $element->setSeparator(' ');
                 $element = $this->_setBasicDecorator($element);
                 break;
             case 'multiSelect':
                 break;
             default:
                 $element = new Zend_Form_Element_Text($fieldId);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId))->addFilter('StringTrim')->setAttrib('class', 'smallTextInput');
                 $element = $this->_setBasicDecorator($element);
                 break;
         }
         if (!empty($params['disabled'])) {
             $element->setAttrib('disabled', (bool) $params['disabled']);
         }
         $this->addElement($element);
     }
 }