public function init() { $locations = new Model_Locations(); $result = $locations->getAllProvinces(); if ($result) { $this->_list["province"][''] = "Select"; foreach ($result as $row) { $this->_list["province"][$row['pkId']] = $row['locationName']; } } //Generate $locations = new Model_Locations(); $result = $locations->getSindhDistricts(); $this->_list["district"][''] = "Select"; if ($result) { foreach ($result as $row) { $this->_list["district"][$row['pkId']] = $row['locationName']; } } $date_from = date('01/m/Y'); $date_to = date('d/m/Y'); foreach ($this->_fields as $col => $name) { switch ($col) { case "name": case "father_name": case "age": case "contact": case "address": case "item_1": case "item_2": case "item_3": case "item_4": case "item_5": case "reffers_to": case "remarks": $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; case "vaccination_date_from": $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true', 'style' => 'position: relative; z-index: 100000;'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array(), "value" => $date_from)); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; case "vaccination_date_to": $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true', 'style' => 'position: relative; z-index: 100000;'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array(), "value" => $date_to)); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; default: break; } if (in_array($col, array_keys($this->_list))) { $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option")))))); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); } if (in_array($col, array_keys($this->_radio))) { $this->addElement("radio", $col, array("attribs" => array(), "allowEmpty" => true, 'separator' => '', "filters" => array("StringTrim", "StripTags"), "validators" => array(), "multiOptions" => $this->_radio[$col], 'value' => '1')); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag")->removeDecorator("<br>"); } } }
public function ajaxAddMoreLogRowsAction() { $this->_helper->layout->disableLayout(); $start = $this->_request->getParam('start'); $end = $this->_request->getParam('end'); $item_pack_sizes = new Model_ItemPackSizes(); $items = $item_pack_sizes->logBookItemPackSize(); $this->view->items = $items; $locations = new Model_Locations(); $result = $locations->getSindhDistricts(); $this->view->locations = $result; $this->view->start = $start; $this->view->end = $end; }