public function init()
 {
     $_em = Zend_Registry::get('doctrine');
     $result1 = $_em->getRepository('CampaignTypes')->findAll();
     $this->_list["campaign_type_id"][''] = 'Select';
     foreach ($result1 as $row) {
         $this->_list["campaign_type_id"][$row->getPkId()] = $row->getCamapignTypeName();
     }
     //$result2 = $_em->getRepository('Items')->findAll();
     $campaign = new Model_Campaigns();
     $result2 = $campaign->campaignVaccines();
     $this->_list["item_id"][''] = 'Select';
     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"), "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");
         }
     }
 }
 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 init()
 {
     $auth = App_Auth::getInstance();
     $role_id = $auth->getRoleId();
     if ($auth->getStakeholderId() != 10) {
         $warehouse_id = $auth->getWarehouseId();
     } else {
         $warehouse_id = "";
     }
     $district_id = $auth->getDistrictId($auth->getIdentity());
     $campaign = new Model_Campaigns();
     if ($role_id == Model_Roles::CAMPAIGN && empty($warehouse_id)) {
         $result1 = $campaign->allCampaigns();
         $this->_list["campaign_id"][''] = 'Select';
         foreach ($result1 as $row) {
             $this->_list["campaign_id"][$row['pkId']] = $row['campaignName'];
         }
     } else {
         $campaign->form_values['district_id'] = $district_id;
         $result1 = $campaign->districtCampaigns();
         $this->_list["campaign_id"][''] = 'Select';
         foreach ($result1 as $row) {
             $this->_list["campaign_id"][$row['pkId']] = $row['campaignName'];
         }
     }
     /* $campaign->form_values['province_id'] = $auth->getProvinceId();
        $result2 = $campaign->getProvinces();
        $this->_list["province_id"][''] = 'Select';
        foreach ($result2 as $row) {
        $this->_list["province_id"][$row['pkId']] = $row['locationName'];
        } */
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             default:
                 break;
         }
         if ($col == "campaign_id") {
             $attribute_class = "form-control";
         } else {
             $attribute_class = "form-control";
         }
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => $attribute_class), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col]));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
 public function init()
 {
     //$result2 = $_em->getRepository('Items')->findAll();
     $campaign = new Model_Campaigns();
     $result2 = $campaign->campaignVaccines();
     $this->_list["item_id"][''] = 'Select';
     $this->_list["item_id_add"][''] = 'Select';
     $this->_list["item_id_edit"][''] = 'Select';
     foreach ($result2 as $row) {
         $this->_list["item_id"][$row['pkId']] = $row['itemName'];
         $this->_list["item_id_add"][$row['pkId']] = $row['itemName'];
         $this->_list["item_id_edit"][$row['pkId']] = $row['itemName'];
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "age_group1_min":
             case "age_group1_max":
             case "age_group2_min":
             case "age_group2_max":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control  input-xsmall"), "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");
         }
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "campaign_item_groups_id":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
 }
 public function ajaxGetCampaignsByDistrictAction()
 {
     $this->_helper->layout->disableLayout();
     $district = $this->_request->district;
     $campaign = new Model_Campaigns();
     $campaign->form_values['district_id'] = $district;
     $campaign_data = $campaign->getCampaignsByDistrictReport();
     $this->view->campaign_data = $campaign_data;
 }
 public function init()
 {
     //Generate Provinces Combo
     $locations = new Model_Locations();
     $provinces = $locations->getAllProvinces();
     $this->_list["combo1"][''] = "Select";
     $this->_list["combo1_add"][''] = "Select";
     if ($provinces) {
         foreach ($provinces as $row) {
             $this->_list["combo1"][$row['pkId']] = $row['locationName'];
             $this->_list["combo1_add"][$row['pkId']] = $row['locationName'];
         }
     }
     $this->_list["combo2_add"][''] = "Select Province";
     $this->_list["combo2"][''] = "Select Province";
     //Generate Facility Type Combo
     $warehouse = new Model_Warehouses();
     $warehouse->form_values['stakeholder_id'] = 1;
     $wh_types = $warehouse->getAllHealthFacilityTypesByStakeholder();
     $this->_list["facility_type"][''] = "Select";
     if ($wh_types) {
         foreach ($wh_types as $row) {
             $this->_list["facility_type"][$row['pkId']] = $row['warehouseTypeName'];
         }
     }
     $this->_list["year"][''] = "Select";
     $yy = date('Y');
     $end_year = 2014;
     for ($i = $yy; $i >= $end_year; $i = $i - 1) {
         $this->_list["year"][$i] = $i;
     }
     $campaign = new Model_Campaigns();
     $result1 = $campaign->allCampaigns();
     $this->_list["campaign_id"][''] = 'Select';
     foreach ($result1 as $row) {
         $this->_list["campaign_id"][$row['pkId']] = $row['campaignName'];
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             /* case "abc":
                $this->addElement("text", $col, array(
                "attribs" => array("class" => "form-control"),
                "allowEmpty" => true,
                "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(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "district_id_hidden":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
 }
 public function ajaxGetNumberDosesAction()
 {
     $this->_helper->layout->disableLayout();
     $form_values = $this->_request->getPost();
     $vials_used = $form_values['vials_used'];
     $coverage_not_accessible = $form_values['coverage_not_accessible'];
     $campaign = new Model_Campaigns();
     $campaign->form_values = $form_values;
     $result = $campaign->getNumberOfDoses();
     $this->view->data = $result;
     // $this->view->vials_used = $vials_used;
     // $this->view->coverage_not_accessible = $coverage_not_accessible;
 }
 public function init()
 {
     $auth = App_Auth::getInstance();
     $role_id = $auth->getRoleId();
     if ($auth->getStakeholderId() != 10) {
         $warehouse_id = $auth->getWarehouseId();
     } else {
         $warehouse_id = "";
     }
     $district_id = $auth->getDistrictId($auth->getIdentity());
     $campaign = new Model_Campaigns();
     if ($role_id == Model_Roles::CAMPAIGN && empty($warehouse_id)) {
         $result1 = $campaign->allCampaigns();
         $this->_list["campaign_id"][''] = 'Select';
         $this->_list["campaign_add_id"][''] = 'Select';
         $this->_list["campaign_edit_id"][''] = 'Select';
         foreach ($result1 as $row) {
             $this->_list["campaign_id"][$row['pkId']] = $row['campaignName'];
             $this->_list["campaign_add_id"][$row['pkId']] = $row['campaignName'];
             $this->_list["campaign_edit_id"][$row['pkId']] = $row['campaignName'];
         }
     } else {
         $campaign->form_values['district_id'] = $district_id;
         $result1 = $campaign->districtCampaigns();
         $this->_list["campaign_id"][''] = 'Select';
         $this->_list["campaign_add_id"][''] = 'Select';
         $this->_list["campaign_edit_id"][''] = 'Select';
         foreach ($result1 as $row) {
             $this->_list["campaign_id"][$row['pkId']] = $row['campaignName'];
             $this->_list["campaign_add_id"][$row['pkId']] = $row['campaignName'];
             $this->_list["campaign_edit_id"][$row['pkId']] = $row['campaignName'];
         }
     }
     /* $campaign->form_values['province_id'] = $auth->getProvinceId();
        $result2 = $campaign->getProvinces();
        $this->_list["province_id"][''] = 'Select';
        foreach ($result2 as $row) {
        $this->_list["province_id"][$row['pkId']] = $row['locationName'];
        } */
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "num_tally_sheets":
             case "num_finger_markers":
             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 "arrival_date_mobiliztion_material":
             case "dpec_meeting_date":
                 $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 ($col == "campaign_id") {
             $attribute_class = "form-control";
         } else {
             $attribute_class = "form-control";
         }
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => $attribute_class), "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("multiCheckbox", $col, array("attribs" => array(), "allowEmpty" => true, 'separator' => '', "filters" => array("StringTrim", "StripTags"), "validators" => array(), "multiOptions" => $this->_checkbox[$col]));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag")->removeDecorator("<br>");
         }
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "readiness_id":
             case "province_id_hidden":
             case "district_id_hidden":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
 }
 public function init()
 {
     $auth = App_Auth::getInstance();
     $role_id = $auth->getRoleId();
     if ($auth->getStakeholderId() != 10) {
         $warehouse_id = $auth->getWarehouseId();
     } else {
         $warehouse_id = "";
     }
     $district_id = $auth->getDistrictId($auth->getIdentity());
     //$district_id = 33;
     $campaign = new Model_Campaigns();
     if ($role_id == Model_Roles::CAMPAIGN && empty($warehouse_id)) {
         $result1 = $campaign->allCampaigns();
         $this->_list["campaign_id"][''] = 'Select';
         foreach ($result1 as $row) {
             $this->_list["campaign_id"][$row['pkId']] = $row['campaignName'];
         }
     } else {
         $campaign->form_values['district_id'] = $district_id;
         $result1 = $campaign->districtCampaigns();
         $this->_list["campaign_id"][''] = 'Select';
         foreach ($result1 as $row) {
             $this->_list["campaign_id"][$row['pkId']] = $row['campaignName'];
         }
     }
     $campaign->form_values['province_id'] = $auth->getProvinceId();
     $result2 = $campaign->getProvinces();
     $this->_list["province_id"][''] = 'Select';
     foreach ($result2 as $row) {
         $this->_list["province_id"][$row['pkId']] = $row['locationName'];
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "wh_name":
             case "daily_target":
             case "household_visited":
             case "multiple_family_household":
             case "target_age_six_months":
             case "target_age_sixty_months":
             case "total_coverage":
             case "refusal_covered":
             case "coverage_mobile_children":
             case "coverage_not_accessible":
             case "record_not_accessible":
             case "record_refusal":
             case "reported_with_weakness":
             case "zero_dose":
             case "teams_reported":
             case "inaccessible_coverage":
             case "vials_given":
             case "vials_used":
             case "vials_expired":
             case "vials_returned":
             case "recon_syr_wasted":
             case "ad_syr_wasted":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'value' => '0'), "allowEmpty" => true, "required" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 $this->getElement($col)->setValue(0);
                 break;
             default:
                 break;
         }
         if ($col == "campaign_id") {
             $attribute_class = "form-control";
         } else {
             $attribute_class = "form-control";
         }
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => $attribute_class), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col]));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
 public function vlmisAction()
 {
     $salt = '159jboFHjeQK5mc1K0cdSz5';
     $token = sha1(md5($salt . date('Y-m-d')));
     if (!$this->_identity->login('userdashboard', base64_encode(123))) {
         $error = true;
         throw new Exception();
     }
     if ($token != $_GET['token']) {
         $this->view->message = 'Invalid Token';
     }
     $province = isset($_GET['combo1']) ? $_GET['combo1'] : 1;
     $level = isset($_GET['office']) ? $_GET['office'] : 1;
     $role_id = 4;
     $this->view->level = $level;
     $this->view->province = $province;
     $this->_helper->layout->setLayout('vlmis-dashboad');
     $auth = App_Auth::getInstance();
     //$role_id = $auth->getRoleId();
     $campaign = new Model_Campaigns();
     $location = new Model_Locations();
     $location->form_values = array('geo_level_id' => 4, 'province_id' => $province);
     $res = $location->getLocationsByLevelByProvince();
     $district = $res[0]['key'];
     $this->view->district = $district;
     switch ($level) {
         case 1:
             $this->view->campaigns = $campaign->getAllCampaigns();
             break;
         case 2:
             $location->form_values = array("province_id" => $province);
             $dists = $location->districtLocations();
             foreach ($dists as $dist) {
                 $arr_dist[] = $dist['pk_id'];
             }
             $campaign->form_values = array("districts" => implode(",", $arr_dist));
             $this->view->campaigns = $campaign->getCampaignsByDistrict();
             break;
         case 6:
             $campaign->form_values = array("districts" => $district);
             $this->view->campaigns = $campaign->getCampaignsByDistrict();
             break;
         default:
             $this->view->campaigns = $campaign->getAllCampaigns();
             break;
     }
     $this->view->provinces = $location->getProvincesName();
     $item = new Model_ItemPackSizes();
     $this->view->items = $item->getAllItemsByCategoryAndActivity("1", "1");
     // Default Filters for IM
     $this->view->item = 6;
     $this->view->date = Zend_Registry::get('report_month');
     // Default Filters for Campaign
     $this->view->camp = 23;
     $this->view->user_role = $role_id;
     $this->view->prov = $province;
     $r = $this->_request->getParam("ri_btn", '');
     if ($r == 'ri') {
         $this->view->r = $r;
         $this->view->item = $this->_request->getParam("items", '');
         $this->view->date = $this->_request->getParam("date", '');
         $this->view->period = $this->_request->getParam("period", '');
     }
     $i = $this->_request->getParam("im_btn", '');
     if ($i == 'im') {
         $this->view->i = $i;
         $this->view->item = $this->_request->getParam("items", '');
         $this->view->date = $this->_request->getParam("date", '');
         $this->view->period = $this->_request->getParam("period", '');
     }
     $c = $this->_request->getParam("camp_btn", '');
     if ($c == 'camp') {
         $this->view->c = $c;
         $this->view->camp = $this->_request->getParam("camp", '');
         $this->view->prov = $this->_request->getParam("prov", '');
     }
     $role_resource = new Model_RoleResources();
     $role_resource->form_values = array('type_id' => 3, 'role_id' => $role_id);
     $dashboards = $role_resource->getRoleResourcesByTypeForVlmisDashboard();
     $this->view->dashboards = $dashboards;
     $this->view->ri = 472;
     $this->view->im = 330;
     $this->view->campaign = 333;
     $period = new Model_Period();
     $time_intervals = $period->getTimeIntervals();
     $this->view->time_intervals = $time_intervals;
     $this->view->quarter = Model_Period::QUARTER;
     $this->view->halfyear = Model_Period::HALFYEAR;
     $this->view->annual = Model_Period::ANNUAL;
     $base_url = Zend_Registry::get('baseurl');
     $this->view->inlineScript()->appendFile($base_url . '/js/all_level_area_combo.js');
     $this->view->id = $this->_request->getParam("id", $dashboards[0]->getResource()->getPkId());
     /* if ($role_id == 7) {
        $this->view->province = $this->_identity->getProvinceId();
        $this->renderScript("dashboard/user-tehsil.phtml");
        } */
 }
 /**
  * Campaign Management Dashlet
  */
 public function differentMissedTypesAction()
 {
     $campaign = new Model_Campaigns();
     $this->view->campaigns = $campaign->getAllCampaigns();
     $wh_data = new Model_WarehousesData();
     $params["level"] = $this->_request->getParam("level");
     $params["loc_id"] = $this->_request->getParam("district");
     $params["prov_id"] = $this->_request->getParam("province");
     $params["camp"] = $this->_request->getParam('camp');
     $wh_data->form_values = $params;
     $xmlstore = $wh_data->differentMissedTypes();
     $this->view->xmlstore = $xmlstore;
     $this->view->camp = $params["camp"];
 }
 public function provinceAction()
 {
     $auth = App_Auth::getInstance();
     $role_id = $auth->getRoleId();
     $this->view->level = 2;
     $this->view->province = $this->_identity->getProvinceId();
     $province = $this->_request->getParam("combo1", 1);
     if (!empty($province) && $province != 'null') {
         $this->view->province = $province;
     }
     $campaign = new Model_Campaigns();
     $location = new Model_Locations();
     $location->form_values = array("province_id" => $province);
     $dists = $location->districtLocations();
     foreach ($dists as $dist) {
         $arr_dist[] = $dist['pk_id'];
     }
     $campaign->form_values = array("districts" => implode(",", $arr_dist));
     $this->view->campaigns = $campaign->getCampaignsByDistrict();
     $this->view->provinces = $location->getProvincesName();
     $item = new Model_ItemPackSizes();
     $this->view->items = $item->getAllItems();
     // Default Filters for IM
     $this->view->item = 6;
     $this->view->date = Zend_Registry::get('report_month');
     // Default Filters for Campaign
     $this->view->camp = 23;
     $this->view->user_role = $role_id;
     $this->view->prov = $this->_identity->getProvinceId();
     $r = $this->_request->getParam("ri_btn", '');
     if ($r == 'ri') {
         $this->view->r = $r;
         $this->view->item = $this->_request->getParam("items", '');
         $this->view->date = $this->_request->getParam("date", '');
         $this->view->period = $this->_request->getParam("period", '');
     }
     $i = $this->_request->getParam("im_btn", '');
     if ($i == 'im') {
         $this->view->i = $i;
         $this->view->item = $this->_request->getParam("items", '');
         $this->view->date = $this->_request->getParam("date", '');
         $this->view->period = $this->_request->getParam("period", '');
     }
     $c = $this->_request->getParam("camp_btn", '');
     if ($c == 'camp') {
         $this->view->c = $c;
         $this->view->camp = $this->_request->getParam("camp", '');
         $this->view->prov = $this->_request->getParam("prov", '');
     }
     $role_resource = new Model_RoleResources();
     $role_resource->form_values = array('type_id' => 3, 'role_id' => $role_id);
     $dashboards = $role_resource->getRoleResourcesByType();
     $this->view->dashboards = $dashboards;
     $this->view->ri = 472;
     $this->view->im = 330;
     $this->view->campaign = 333;
     $period = new Model_Period();
     $time_intervals = $period->getTimeIntervals();
     $this->view->time_intervals = $time_intervals;
     $this->view->quarter = Model_Period::QUARTER;
     $this->view->halfyear = Model_Period::HALFYEAR;
     $this->view->annual = Model_Period::ANNUAL;
     $base_url = Zend_Registry::get('baseurl');
     $this->view->inlineScript()->appendFile($base_url . '/js/all_level_area_combo.js');
 }
 public function init()
 {
     $auth = App_Auth::getInstance();
     $role_id = $auth->getRoleId();
     if ($auth->getStakeholderId() != 10) {
         $warehouse_id = $auth->getWarehouseId();
     } else {
         $warehouse_id = "";
     }
     $district_id = $auth->getDistrictId($auth->getIdentity());
     $locations = new Model_Locations();
     $locations->form_values['district_id'] = $district_id;
     $result13 = $locations->getAllUcsByCampaignId();
     $this->_list["uc_id"][''] = 'All';
     // $this->_list["uc_add_id"][''] = 'Select';
     //  $this->_list["uc_edit_id"][''] = 'Select';
     foreach ($result13 as $row) {
         //  $this->_list["uc_id"][$row['pkId']] = $row['warehouseName'];
         // $this->_list["uc_add_id"][$row['pkId']] = $row['warehouseName'];
         //  $this->_list["uc_edit_id"][$row['pkId']] = $row['warehouseName'];
     }
     $campaign = new Model_Campaigns();
     if ($role_id == Model_Roles::CAMPAIGN && empty($warehouse_id)) {
         $result1 = $campaign->allCampaigns();
         $this->_list["campaign_id"][''] = 'Select';
         //   $this->_list["campaign_add_id"][''] = 'Select';
         $this->_list["campaign_edit_id"][''] = 'Select';
         foreach ($result1 as $row) {
             $this->_list["campaign_id"][$row['pkId']] = $row['campaignName'];
             //   $this->_list["campaign_add_id"][$row['pkId']] = $row['campaignName'];
             $this->_list["campaign_edit_id"][$row['pkId']] = $row['campaignName'];
         }
     } else {
         $campaign->form_values['district_id'] = $district_id;
         $result1 = $campaign->districtCampaigns();
         $this->_list["campaign_id"][''] = 'Select';
         //  $this->_list["campaign_add_id"][''] = 'Select';
         $this->_list["campaign_edit_id"][''] = 'Select';
         foreach ($result1 as $row) {
             $this->_list["campaign_id"][$row['pkId']] = $row['campaignName'];
             //  $this->_list["campaign_add_id"][$row['pkId']] = $row['campaignName'];
             $this->_list["campaign_edit_id"][$row['pkId']] = $row['campaignName'];
         }
     }
     /* $campaign->form_values['province_id'] = $auth->getProvinceId();
        $result2 = $campaign->getProvinces();
        $this->_list["province_id"][''] = 'Select';
        foreach ($result2 as $row) {
        $this->_list["province_id"][$row['pkId']] = $row['locationName'];
        } */
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "inaccessible_children":
             case "no_of_mobile_teams":
             case "inaccessible_area":
             case "no_of_fixed_teams":
             case "area_in_charge":
             case "no_of_transist_points":
             case "aics_trained":
             case "no_of_teams_trained":
             case "area_mobile_population":
             case "uc_add_id":
             case "campaign_add_id":
             case "target":
                 $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 "date_upec_meeting":
                 $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 ($col == "campaign_id") {
             $attribute_class = "form-control";
         } else {
             $attribute_class = "form-control";
         }
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => $attribute_class), "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 "readiness_uc_id":
             case "uc_edit_id_hidden":
             case "campaign_add_id_hidden":
             case "warehouse_add_id_hidden":
             case "uc_id_hidden":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
 }