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");
        } */
 }
예제 #2
0
 public function locationsCombosTwoAction()
 {
     $this->_helper->layout->disableLayout();
     //$stakeholder_id = $this->_identity->getStakeholderId();
     if (isset($this->_request->combo1) && !empty($this->_request->combo1)) {
         // $office = $this->_request->office;
         $province_id = $this->_request->combo1;
         $location = new Model_Locations();
         $location->form_values = array('province_id' => $province_id, 'geo_level_id' => 4);
         $this->view->result = $location->districtLocations();
         if (!empty($this->_request->district_id)) {
             $this->view->district_id = $this->_request->district_id;
         }
     }
 }
 public function ajaxGetDistrictAction()
 {
     $this->_helper->layout->disableLayout();
     if (isset($this->_request->province_id) && !empty($this->_request->province_id)) {
         $locations = new Model_Locations();
         $locations->form_values['province_id'] = $this->_request->province_id;
         $array = $locations->districtLocations();
         $this->view->data = $array;
     }
 }
 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 nonReportedDistrictsByUcAction()
 {
     $this->_helper->layout->setLayout('reports');
     $this->view->report_id = 'SNONREPDIST';
     $this->view->report_title = 'Non-reported EPI Centers Report for';
     $this->view->actionpage = 'non-reported-districts-by-uc';
     $this->view->parameters = 'TS01IP';
     $this->view->parameter_width = '100%';
     $item_pack_sizes = new Model_ItemPackSizes();
     $warehouses_data = new Model_WarehousesData();
     $item = $item_pack_sizes->productsReport();
     $this->view->item_id = $item;
     $location = new Model_Locations();
     if (isset($this->_request->province) && !empty($this->_request->province)) {
         $this->view->province = $this->_request->province;
     } else {
         $this->view->province = $province = 1;
     }
     if (isset($this->_request->district) && !empty($this->_request->district)) {
         $this->view->district1 = $this->_request->district;
     } else {
         $this->view->district1 = 33;
     }
     if (isset($this->_request->tehsil) && !empty($this->_request->tehsil)) {
         $this->view->tehsil = $this->_request->tehsil;
     } else {
         $this->view->tehsil = 1;
     }
     $location->form_values['province_id'] = $province;
     $location_name = $location->districtLocations();
     $this->view->location_name = $location_name;
     if (!empty($this->_request->year_sel) && !empty($this->_request->month_sel)) {
         $this->view->year_sel = $year = $this->_request->year_sel;
         $this->view->month_sel = $month = $this->_request->month_sel;
     } else {
         $year = date("Y");
         if (date('d') > 10) {
             $month = date("m", strtotime("-1"));
         } else {
             $month = date("m", strtotime("-2"));
         }
         $this->view->year_sel = $year;
         $this->view->month_sel = $month;
     }
     if (isset($this->_request->province) && !empty($this->_request->province)) {
         $locations = new Model_Locations();
         $locations->form_values['pk_id'] = $this->_request->province;
         $this->view->location_name = $locations->getLocationName();
     } else {
         $this->view->location_name = "Punjab";
     }
     if (isset($this->_request->wh_type) && !empty($this->_request->wh_type)) {
         $this->view->wh_type = $wh_type = $this->_request->wh_type;
     } else {
         $this->view->wh_type = $wh_type = 2;
     }
     $end_date = $year . '-' . $month . '-01';
     $end_date = date('Y-m-d', strtotime("-1 days", strtotime("+1 month", strtotime($end_date))));
     $start_date = date('Y-m-d', strtotime("-364 days", strtotime($end_date)));
     // Start date and End date
     $begin = new DateTime($start_date);
     $end = new DateTime($end_date);
     $diff = $begin->diff($end);
     $interval = DateInterval::createFromDateString('1 month');
     $period = new DatePeriod($begin, $interval, $end);
     $this->view->period = $period;
     $this->view->sel_item = $this->_request->prod_sel;
     $stakeholder = new Model_Stakeholders();
     $stk = $stakeholder->nationReport();
     $this->view->stk = $stk;
     $locations = new Model_Locations();
     $lct = $locations->devisionalReport();
     $this->view->location = $lct;
     $locations->form_values['geo_level_id'] = '4';
     $locations->form_values['province_id'] = '1';
     $district = $locations->getLocationsByLevelByProvince();
     $this->view->district = $district;
 }