public function init() { $list_detail = new Model_ListDetail(); $list_detail->form_values = array('master_id' => Model_ListMaster::USER_ROLE_CATEGORIES); $result = $list_detail->getListDetailByMasterId(); $this->_list["category_id"][''] = "Select"; foreach ($result as $rs) { $this->_list["category_id"][$rs['pkId']] = $rs['listValue']; } foreach ($this->_fields as $col => $name) { switch ($col) { case "role_name": case "description": $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; 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())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); } } }
public function ajaxEditAction() { $this->_helper->layout->setLayout("ajax"); $ccm_warehouse_id = $this->_request->getParam('ccm_warehouse_id', ''); $ccm_warehouses = $this->_em->find('CcmWarehouses', $ccm_warehouse_id); $form = new Form_Cadmin_HealthFacility(); $form->addFields(); $form->addHidden(); $form->routine_immunization_ice_pack->setValue($ccm_warehouses->getRoutineImmunizationIcepackRequirments()); $form->snid_nid_ice_pack->setValue($ccm_warehouses->getCampaignIcepackRequirments()); $form->grid_electricity_availibility->setValue($ccm_warehouses->getElectricityAvailability()->getPkId()); $form->vaccine_supply_mode->setValue($ccm_warehouses->getVaccineSupplyMode()->getPkId()); //$form->vaccine_supply_mode->setValue($ccm_warehouses->vaccineSupplyMode()->getPkId()); $form->id->setValue($ccm_warehouses->getPkId()); $list_detail = new Model_ListDetail(); $list_detail->form_values['master_id'] = Model_ListMaster::Service_Types; $result23 = $list_detail->getListDetailByMasterId(); $this->view->services_type = $result23; $list_detail->form_values['master_id'] = Model_ListMaster::VACCINATION_STAFF; $result1 = $list_detail->getListDetailByMasterId(); $this->view->epi_vaccination_staff = $result1; $ccm_wh_vaccination_staff = $this->_em->getRepository("CcmWarehousesVaccinationStaff")->findBy(array('ccmWarehouse' => $ccm_warehouse_id)); $this->view->update_vaccination_staff = $ccm_wh_vaccination_staff; $vac_staff = array(); foreach ($ccm_wh_vaccination_staff as $row_1) { array_push($vac_staff, $row_1->getVaccinationStaff()->getPkId()); } $this->view->vac_staff = $vac_staff; $services_type = $this->_em->getRepository("WarehousesServiceTypes")->findBy(array('warehouse' => $ccm_warehouses->getWarehouse()->getPkId())); $this->view->update_services_type = $services_type; $ser_type = array(); foreach ($services_type as $row) { array_push($ser_type, $row->getServiceType()->getPkId()); } $this->view->ser_type = $ser_type; $warehouse_table = $this->_em->getRepository("Warehouses")->find($ccm_warehouses->getWarehouse()->getPkId()); $form->health_facility_type->setValue($warehouse_table->getWarehouseType()->getPkId()); $list_detail->form_values['master_id'] = Model_ListMaster::SOLAR_ENERGY; $result2 = $list_detail->getListDetailByMasterId(); $this->view->solar_energy = $result2; $solar_energy = $this->_em->getRepository("CcmWarehousesSolarEnergy")->findBy(array('ccmWarehouse' => $ccm_warehouse_id)); // $this->view->update_solar_energy = $solar_energy->getSolarEnergy()->getPkId(); $so_energy = array(); foreach ($solar_energy as $row_2) { array_push($so_energy, $row_2->getSolarEnergy()->getPkId()); } $form->old_warehouse->setValue($ccm_warehouses->getWarehouse()->getWarehouseName()); $form->old_warehouse_val->setValue($ccm_warehouses->getWarehouse()->getpkId()); $warehouses = $this->_em->find('Warehouses', $ccm_warehouses->getWarehouse()->getpkId()); $form->office_level->setValue($warehouses->getStakeholderOffice()->getPkId()); $this->view->so_energy = $so_energy; $this->view->form = $form; $base_url = Zend_Registry::get("baseurl"); $this->view->inlineScript()->appendFile($base_url . '/js/all_level_combos2.js'); }
public function init() { $list_detail = new Model_ListDetail(); $list_detail->form_values['master_id'] = Model_ListMaster::GRID_ELECTRICITY_AVAL; $result = $list_detail->getListDetailByMasterId(); foreach ($result as $list) { $this->_list["grid_electricity_availibility"][''] = 'Select'; $this->_list["grid_electricity_availibility"][$list['pkId']] = $list['listValue']; } $warehouse = new Model_Warehouses(); $res_warehouse = $warehouse->getHealthFacilityTypes(); foreach ($res_warehouse as $row) { // $this->_checkbox["vaccine_supply_mode"][$list12['pkId']] = $list12['listValue']; $this->_list["health_facility_type"][''] = 'Select'; $this->_list["health_facility_type"][$row['pkId']] = $row['warehouseTypeName']; } $list_detail->form_values['master_id'] = Model_ListMaster::VACCINATION_STAFF; $result1 = $list_detail->getListDetailByMasterId(); foreach ($result1 as $list1) { $this->_checkbox["epi_vaccination_staff"][$list1['pkId']] = $list1['listValue']; } $list_detail->form_values['master_id'] = Model_ListMaster::Service_Types; $result13 = $list_detail->getListDetailByMasterId(); foreach ($result13 as $list13) { $this->_checkbox["services_type"][$list13['pkId']] = $list13['listValue']; } $list_detail->form_values['master_id'] = Model_ListMaster::Vaccine_Supply_Mode; $result12 = $list_detail->getListDetailByMasterId(); foreach ($result12 as $list12) { // $this->_checkbox["vaccine_supply_mode"][$list12['pkId']] = $list12['listValue']; $this->_list["vaccine_supply_mode"][''] = 'Select'; $this->_list["vaccine_supply_mode"][$list12['pkId']] = $list12['listValue']; } $list_detail->form_values['master_id'] = Model_ListMaster::SOLAR_ENERGY; $result2 = $list_detail->getListDetailByMasterId(); foreach ($result2 as $list2) { $this->_checkbox["solar_energy"][$list2['pkId']] = $list2['listValue']; } foreach ($this->_fields as $col => $name) { switch ($col) { case "routine_immunization_ice_pack": case "snid_nid_ice_pack": case "vaccine_supply_mode": case "facility_total_population": case "live_birth_per_year": case "pregnant_women_per_year": case "women_of_child_bearing_age": $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; case "estimation_year": $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; 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])); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); } if (in_array($col, array_keys($this->_checkbox))) { $this->addElement("checkbox", $col, array("attribs" => array(), "allowEmpty" => true, 'separator' => '', "filters" => array("StringTrim", "StripTags"), "validators" => array(), "multiOptions" => $this->_checkbox[$col])); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); } } foreach ($this->_hidden as $col => $name) { switch ($col) { case "old_warehouse_val": case "office_level": $this->addElement("hidden", $col); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; default: break; } } }