public function init() { $campaign_types = new Model_CampaignTypes(); $result1 = $campaign_types->getAllCampaignTypes(); $this->_list["campaign_type_id"][''] = 'Select'; foreach ($result1 as $row) { $this->_list["campaign_type_id"][$row['pkId']] = $row['camapignTypeName']; } //$result2 = $_em->getRepository('Items')->findAll(); $campaign = new Model_Campaigns(); $result2 = $campaign->campaignVaccines(); foreach ($result2 as $row) { $this->_list["item_id"][$row['pkId']] = $row['itemName']; } foreach ($this->_fields as $col => $name) { switch ($col) { case "campaign_name": $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => true, "required" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; case "date_from": case "date_to": $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; case "catch_up_days": $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => true, "required" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; default: break; } if ($col == "item_id") { $list_type = "multiselect"; //"multiselect"; } else { $list_type = "select"; } if (in_array($col, array_keys($this->_list))) { $this->addElement($list_type, $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col])); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); } } foreach ($this->_hidden as $col => $name) { switch ($col) { case "campaign_id": case "campaign_update_id": $this->addElement("hidden", $col); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; default: break; } } }
public function checkCampaignTypeAction() { $this->_helper->layout->disableLayout(); $form_values = $this->_request->campaign_type_name; $campaign_type = new Model_CampaignTypes(); $campaign_type->form_values = $form_values; $result = $campaign_type->checkCampaignType(); $this->view->result = $result; }