public function init() { $identity = new App_Auth(); $stock_master = new Model_StockMaster(); $wh_id = $identity->getWarehouseId(); $result1 = $stock_master->getUnpickedIssueNo($wh_id); $this->_list["stock_master_id"][''] = "Select Issue No"; if ($result1 != false) { foreach ($result1 as $row) { // $this->_list["make"][$wh['pkId']] = $wh['ccmMakeName']; $this->_list["stock_master_id"][$row['stc_master_pkid']] = $row['transaction_number']; } } foreach ($this->_fields as $col => $name) { switch ($col) { case "stock_master_id": $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, "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("stock_master_id", array_keys($this->_list))) { $this->addElement("select", "stock_master_id", array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list["stock_master_id"], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option")))))); $this->getElement("stock_master_id")->removeDecorator("Label")->removeDecorator("HtmlTag"); } } }
public function run() { if ($this->_appID) { return; } session_start(); $this->_appID = md5(time()); App_Db::connect(include __DIR__ . '/../config/db.php'); App_Auth::init(); $strUrl = preg_replace('/\\?.*$/', '', $_SERVER['REQUEST_URI']); $arrUrlPart = explode('/', $strUrl); $strCtrl = !empty($arrUrlPart[1]) ? $arrUrlPart[1] : 'index'; $strAction = !empty($arrUrlPart[2]) ? $arrUrlPart[2] : 'index'; $strCtrlCls = 'Ctrl_' . ucfirst(self::transUrlPart($strCtrl)); $arrParam = $_REQUEST; $arrParam['action'] = $strAction; if (!class_exists($strCtrlCls)) { $arrParam['action'] = '404'; $this->_objCtrl = new Ctrl_Index('index', $arrParam); } else { $this->_objCtrl = new $strCtrlCls($strCtrl, $arrParam); } $this->_objCtrl->{self::transUrlPart($strAction) . 'Action'}(); echo $this->_objCtrl->getView()->render(); }
/** * @return App_Auth */ public static function getInstance() { if (!self::$_instance) { self::$_instance = new self(); } return self::$_instance; }
public function indexAction() { $auth = App_Auth::getInstance(); $role = $auth->getRoleId(); if (in_array($role, array(4, 5))) { $this->_helper->viewRenderer('user-admin'); } }
public function __construct() { $this->_auth = App_Auth::getInstance(); $cache = Zend_Registry::get('cacheManager')->getCache('file'); if (!($this->_acl = $cache->load('acl'))) { $this->_acl = new App_Acl(); $cache->save($this->_acl, 'acl'); } $this->_em = Zend_Registry::get("doctrine"); }
public function getInstance() { if (null === self::$_instance) { self::$_instance = new self(); if (!empty($_SESSION['user'])) { $strUserCls = self::getUserClass(); self::$_instance->_objUser = $strUserCls::fetchById($_SESSION['user']); } } return self::$_instance; }
/** * Logout * * @return NULL */ public function logoutAction() { $auth = App_Auth::getInstance(); $role_id = $auth->getRoleId(); //$this->redirect("index"); if ($role_id == 32) { $auth->logout(); // parent::_redirect('/index/login'); $this->redirect("index/login"); } else { $auth->logout(); $this->redirect("index"); } }
public function init() { $this->_identity = App_Auth::getInstance(); if ($this->_identity->hasIdentity()) { $this->_userid = $this->_identity->getIdentity(); $this->_user_level = $this->_identity->getUserLevel($this->_userid); } $this->_em = Zend_Registry::get('doctrine'); $this->_initSession(); if (isset($this->_request->lang) && !empty($this->_request->lang)) { $this->_session->lang = $this->_request->lang; } $this->_initLocale(); $this->_initTranslation(); }
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"); } } }
/** * Returns an instance of Zend_Auth * * Singleton pattern implementation * * @return Zend_Auth Provides a fluent interface */ public static function getInstance() { if (null === self::$_instance) { self::$_instance = new self(); } // self::$_instance = new self(); try { if (!Zend_Session::isStarted()) { Zend_Session::start(); } } catch (Zend_Session_Exception $e) { echo $e->getFile(); echo $e->getMessage(); echo $e->getTrace(); } self::$_session_id = session_id(); return self::$_instance; }
public function isExpiryEdit($batch_id) { $result = 0; $auth = App_Auth::getInstance(); $wh_id = $auth->getWarehouseId(); $role_id = $auth->getRoleId(); if ($role_id == 3) { $em = Zend_Registry::get('doctrine'); $str_sql = $em->createQueryBuilder()->select("sd")->from('StockDetail', 'sd')->join('sd.stockBatchWarehouse', 'sb')->join('sd.stockMaster', 'sm')->andWhere("sd.isReceived = 1")->andWhere("sm.fromWarehouse = {$wh_id}")->andWhere("sm.transactionType = 2")->andWhere("sb.pkId = {$batch_id}"); $row = $str_sql->getQuery()->getResult(); if (count($row) > 0) { return false; } else { return true; } } else { return false; } }
public function isAdjDelete($master_id) { $em = Zend_Registry::get('doctrine'); $identity = App_Auth::getInstance(); $store_wh_id = $identity->getWarehouseId(); $str_sql = $em->createQueryBuilder()->select("sb.pkId as stock_batch_id,DATE_FORMAT(sm.transactionDate,'%Y-%m-%d') transactionDate")->from('StockDetail', 'sd')->join('sd.stockBatchWarehouse', 'sb')->join('sd.stockMaster', 'sm')->andWhere("sm.pkId = {$master_id}"); $row = $str_sql->getQuery()->getResult(); if (!empty($row) && count($row) > 0) { $str_sql2 = $em->createQueryBuilder()->select("sd.pkId")->from('StockDetail', 'sd')->join('sd.stockBatchWarehouse', 'sb')->join('sd.stockMaster', 'sm')->join('sm.transactionType', 'tt')->where("DATE_FORMAT(sm.transactionDate,'%Y-%m-%d') >= '" . $row[0]['transactionDate'] . "' ")->andWhere("sb.pkId= '" . $row[0]['stock_batch_id'] . "' ")->andWhere("sm.fromWarehouse = '" . $store_wh_id . "' ")->andWhere("tt.nature = '-'"); $row2 = $str_sql2->getQuery()->getResult(); if (!empty($row2) && count($row2) > 0) { return false; } else { return true; } } else { return false; } }
public function dashlets($dashboard_id = null, $role_id = null) { $html = ''; $base_url = Zend_Registry::get("baseurl"); if (empty($role_id)) { $auth = App_Auth::getInstance(); $role_id = $auth->getRoleId(); } $role_resource = new Model_RoleResources(); $role_resource->form_values = array('type_id' => 4, 'role_id' => $role_id, 'parent_id' => $dashboard_id); $dashlets = $role_resource->getRoleResourcesByTypeByParent(); $count = 1; foreach ($dashlets as $row) { if ($row->getResource()->getLevel() == 2) { $class = "col-md-12"; } else { $class = "col-md-6"; } $html .= '<div class="' . $class . '"> <div data-toggle="collapse-widget" class="widget"> <div class="widget-head"> <h4 class="heading glyphicons cargo"><i></i>' . $row->getResource()->getDescription() . '</h4> </div> <div class="widget-body dashlets" id="' . $row->getResource()->getPkId() . '" href="' . $row->getResource()->getResourceName() . '"> <center><img src="' . $base_url . '/images/ajax-loader.gif"/></center> </div> </div> </div>'; /*if ($count % 2 == 0) { $html .= '</div><br/><div class="row">'; } if($row->getResource()->getLevel() == 1){ $count++; } */ } return $html; }
public function isReceiveDelete($detail_id, $wh_id) { $em = Zend_Registry::get('doctrine'); $identity = App_Auth::getInstance(); $store_wh_id = $identity->getWarehouseId(); $str_sql = $em->createQueryBuilder()->select("sb.pkId as stock_batch_id,sm.transactionDate")->from('StockDetail', 'sd')->join('sd.stockBatchWarehouse', 'sb')->join('sd.stockMaster', 'sm')->andWhere("sd.pkId = {$detail_id}"); $row = $str_sql->getQuery()->getResult(); $str_sql2 = $em->createQueryBuilder()->select("sd.pkId")->from('StockDetail', 'sd')->join('sd.stockBatchWarehouse', 'sb')->join('sd.stockMaster', 'sm')->where("sm.transactionDate >= '" . $row[0]['transactionDate'] . "'")->andWhere("sb.pkId= '" . $row[0]['stock_batch_id'] . "'")->andWhere("sm.fromWarehouse = '" . $store_wh_id . "'")->andWhere("sm.transactionType IN (2,5,6,7,9,11,13,14,17)"); //echo $str_sql2->getQuery()->getSql(); //exit; $row2 = $str_sql2->getQuery()->getResult(); if (count($row2) > 0) { return false; } else { return true; } // // $str_sql2 = $em->createQueryBuilder() // ->select("sd.pkId") // ->from('StockDetail', 'sd') // ->join('sd.stockBatchWarehouse', 'sb') // ->join('sd.stockMaster', 'sm') // ->join('sm.fromWarehouse', 'w') // ->join('w.stakeholder', 's') // ->join('s.stakeholderType', 'st') // ->where("sd.pkId= '" . $detail_id . "' ") // ->andWhere("w.pkId = '" . $wh_id . "' ") // ->andWhere("st.pkId = 2"); // //echo $str_sql2->getQuery()->getSql(); // //exit; // $row2 = $str_sql2->getQuery()->getResult(); // if (!empty($row2) && count($row2) > 0) { // return true; // } else { // return false; // } }
public function reportedUcsAction() { $form = new Form_Campaigns_LqasDataEntry(); $campaigns_lqas_data = new Model_Campaigns(); $params = array(); if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { $campaignId = $form->getValue('campaign_search_id'); if (!empty($campaignId)) { $params['campaignId'] = $campaignId; } $campaigns_lqas_data->form_values = $params; $auth = App_Auth::getInstance(); $district_id = $auth->getDistrictId($auth->getIdentity()); $campaigns_lqas_data->form_values['district_id'] = $district_id; $campaigns_lqas_data->form_values['campaign_id'] = $campaignId; $all_ucs = $campaigns_lqas_data->getAllDistrictUcs(); $reported_uc = $campaigns_lqas_data->getAllReportedUcs(); $this->view->reported_uc = $reported_uc; $this->view->all_uc = $all_ucs; } } // print($params); $this->view->form = $form; }
/** * Initializes the application with global standards for the view * * @access public * @return void */ public function init() { //$seconds = 60 * 60 * 24 * 1; // 1 day //Zend_Session::RememberMe($seconds); $appName = Zend_Registry::get('appName'); $moduleName = $this->getRequest()->getModuleName(); $controllerName = $this->getRequest()->getControllerName(); $actionName = $this->getRequest()->getActionName(); $controller = $this->getActionController(); $view = new Zend_View(); $auth = App_Auth::getInstance(); if ($auth->hasIdentity()) { $identity = $auth->getIdentity(); Zend_Layout::getMvcInstance()->assign('user_name', $auth->getUserName()); } if ($auth->hasIdentity()) { $identity = $auth->getIdentity(); Zend_Layout::getMvcInstance()->assign('user_role', $auth->getRoleId()); } /* if ($auth->hasIdentity()) { $identity = $auth->getIdentity(); if ($identity->role_id == 2 && $controllerName != 'accounts' && $controllerName != 'error' && $controllerName != 'index') { $accounts = new Application_Model_Accounts(); $select = $accounts->select()->where("user_id=" . $identity->id); $result = $accounts->fetchRow($select); if (count($result) == 0) { $this->getResponse()->setRedirect('/accounts/create'); } } } */ /* if ($_SERVER['REQUEST_URI'] == '/index/login' || $_SERVER['REQUEST_URI'] == '/index/login/') { $this->getResponse()->setRedirect('/login'); } */ $baseUrl = Zend_Registry::get('baseurl'); //echo $_SERVER['REQUEST_URI']; if ($controllerName != 'index' && $moduleName != 'api' && $controllerName != 'error' && !$auth->hasIdentity()) { $this->getResponse()->setRedirect($baseUrl . '/index?referrer=' . base64_encode(str_replace("/vlmisr2/", "", $_SERVER['REQUEST_URI']))); } if ($moduleName == 'cadmin' && !$auth->hasIdentity()) { $this->getResponse()->setRedirect($baseUrl . '/index?referrer=' . base64_encode(str_replace("/vlmisr2/", "", $_SERVER['REQUEST_URI']))); } if ($moduleName == 'iadmin' && !$auth->hasIdentity()) { $this->getResponse()->setRedirect($baseUrl . '/index?referrer=' . base64_encode(str_replace("/vlmisr2/", "", $_SERVER['REQUEST_URI']))); } if ($moduleName == 'campaign' && !$auth->hasIdentity()) { $this->getResponse()->setRedirect($baseUrl . '/campaign/manage-campaigns?referrer=' . base64_encode(str_replace("/vlmisr2/", "", $_SERVER['REQUEST_URI']))); } //$view->headScript()->appendFile($baseUrl . '/js/braintree.js'); //$view->headLink()->appendStylesheet($baseUrl . '/css/main.css'); Zend_Registry::set('controller', $controllerName); Zend_Registry::set('action', $actionName); //Get the scripts and css directories $scripts = empty($moduleName) ? new App_Directory('js/' . $controllerName) : new App_Directory('js/' . $moduleName . '/' . $controllerName); $css = empty($moduleName) ? new App_Directory('css/' . $controllerName) : new App_Directory('css/' . $moduleName . '/' . $controllerName); //Append the scripts (if any) that pertain to this action and controller if ($scripts->exists()) { $scripts = $scripts->getFiles(); foreach ($scripts as $script) { if ($script === $actionName . ".js") { if (empty($moduleName)) { $view->inlineScript()->appendFile($baseUrl . '/js/' . $controllerName . '/' . $script); } else { $view->inlineScript()->appendFile($baseUrl . '/js/' . $moduleName . '/' . $controllerName . '/' . $script); } } } } //Append the stylesheets (if any) that pertain to this action and controller if ($css->exists()) { $css = $css->getFiles(); foreach ($css as $stylesheet) { if ($stylesheet === $actionName . ".css") { if (empty($moduleName)) { $view->headLink()->appendStylesheet($baseUrl . '/css/' . $controllerName . '/' . $stylesheet); } else { $view->headLink()->appendStylesheet($baseUrl . '/css/' . $moduleName . '/' . $controllerName . '/' . $stylesheet); } } } } $appName = Zend_Registry::get('appName'); $view->inlineScript()->prependScript('var appName = "' . $appName . '"'); $view->prefix = $this->getRequest()->isXmlHttpRequest() || $this->getRequest()->getParam('ajax') == 'true' ? 'ajax' : 'page'; $view->action = $actionName; $view->controller = $controllerName; if ($moduleName == 'default') { Zend_Registry::set('resource', $controllerName . "/" . $actionName); } else { Zend_Registry::set('resource', $moduleName . "/" . $controllerName . "/" . $actionName); } $arr_data = App_Controller_Functions::getPageTitleAndMeta(Zend_Registry::get('resource')); Zend_Registry::set('pageTitle', $arr_data['pageTitle']); Zend_Registry::set('metaTitle', $arr_data['metaTitle']); Zend_Registry::set('metaDescription', $arr_data['metaDescription']); }
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 stockIssueAction() { $form = new Form_StockIssueDispatch(); $stock_master = new Model_StockMaster(); $stakeholder_item_pack_sizes = new Model_StakeholderItemPackSizes(); $this->view->form = $form; if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { // App_Controller_Functions::pr($form->getValues()); $data = $form->getValues(); $stock_master->form_values = $data; $form->month->setValue($data['month']); $form->year->setValue($data['year']); $form->activity_id->setValue($data['activity_id']); $stakeholder_item_pack_sizes->form_values['stakeholder_id'] = $data['activity_id']; $this->view->activity_id = $data['activity_id']; $this->view->month = $data['month']; $this->view->year = $data['year']; } } else { if ($this->_request->month) { $form->month->setValue($this->_request->month); $form->year->setValue($this->_request->year); $stock_master->form_values['month'] = $this->_request->month; $stock_master->form_values['year'] = $this->_request->year; $stakeholder_item_pack_sizes->form_values['stakeholder_id'] = '1'; $this->view->activity_id = 1; $this->view->month = $this->_request->month; $this->view->year = $this->_request->year; } else { $form->month->setValue(date('m')); $form->year->setValue(date('Y')); $stock_master->form_values['month'] = date('m'); $stock_master->form_values['year'] = date('Y'); $stakeholder_item_pack_sizes->form_values['stakeholder_id'] = '1'; $this->view->activity_id = 1; $this->view->month = date('m'); $this->view->year = date('Y'); } } $items = $stakeholder_item_pack_sizes->getAllProductsByStakeholderTypeVaccines(); $dataset_search = $stock_master->getStockIssueVoucherList(); $this->view->result = $dataset_search; $this->view->wh_id = $this->_identity->getWarehouseId(); $this->view->items = $items; $auth = App_Auth::getInstance(); $this->view->role_id = $auth->getRoleId(); }
public function allLevelCombo($office_term = "", $postfix = null) { $identity = App_Auth::getInstance(); $translate = Zend_Registry::get('Zend_Translate'); $base_url = Zend_Registry::get('baseurl'); $user_lvl = $identity->getRoleId(); switch ($user_lvl) { case 4: $arr_province = array('1' => $translate->translate('Federal'), '2' => $translate->translate('Province'), '3' => $translate->translate('Division'), '4' => $translate->translate('District')); break; default: $arr_province = array('1' => $translate->translate('Federal'), '2' => $translate->translate('Province'), '3' => $translate->translate('Division'), '4' => $translate->translate('District')); break; } ?> <div class="col-md-3"> <label class="control-label" for="office" class="col-md-7"><?php if (empty($office_term)) { echo $translate->translate("Office"); } else { echo $office_term; } ?> <span class="red">*</span></label> <div class="controls"> <select name="office" id="office<?php echo $postfix; ?> " class="col-md-3"> <option value=""><?php echo $translate->translate("Select"); ?> </option> <?php foreach ($arr_province as $key => $value) { ?> <option value="<?php echo $key; ?> " ><?php echo $value; ?> </option> <?php } ?> </select> </div> </div> <div class="col-md-3" id="div_combo1<?php echo $postfix; ?> " <?php if (empty($translate->prov_id) || isset($translate->office_id) == 1 || empty($translate->office_id)) { ?> style="display:none;" <?php } else { ?> style="display:block;"<?php } ?> > <label class="control-label" id="lblcombo1"><?php echo $translate->translate("Province"); ?> <span class="red">*</span></label> <div class="controls"> <select name="combo1" id="combo1<?php echo $postfix; ?> " class="col-md-3"> </select> </div> </div> <div class="col-md-3" id="div_combo2<?php echo $postfix; ?> " <?php if (empty($translate->dist_id) || isset($translate->office_id) == 1 || empty($translate->office_id)) { ?> style="display:none;" <?php } ?> > <label class="control-label" id="lblcombo2"><?php echo $translate->translate("District"); ?> <span class="red">*</span></label> <div class="controls"> <select name="combo2" id="combo2<?php echo $postfix; ?> " class="col-md-3"> </select> </div> </div> <div class="col-md-3" id="wh_combo<?php echo $postfix; ?> " <?php if (empty($translate->warehouse)) { ?> style="display:none;" <?php } ?> > <label class="control-label" id="wh_l"><?php echo $translate->translate("Warehouse"); ?> <span class="red">*</span></label> <div class="controls"> <select name="warehouse<?php echo $postfix; ?> " id="warehouse<?php echo $postfix; ?> " class="col-md-3"> </select> </div> </div> <div class="col-md-1" id="loader<?php echo $postfix; ?> " style="display:none;"><img src="<?php echo $base_url; ?> /images/loader.gif" style="margin-top:8px; float:left" alt="" /></div> <?php return true; }
public function usersAddCombo($office_term) { $identity = App_Auth::getInstance(); $translate = Zend_Registry::get('Zend_Translate'); $base_url = Zend_Registry::get('baseurl'); $user_lvl = $identity->getRoleId(); if ($office_term == "routine") { $arr_location_level = array('1' => $translate->translate('National'), '2' => $translate->translate('Provincial'), '3' => $translate->translate('Division'), '4' => $translate->translate('District'), '5' => $translate->translate('Tehsil'), '6' => $translate->translate('EPI Center')); } if ($office_term == "im") { $arr_location_level = array('1' => $translate->translate('National'), '2' => $translate->translate('Provincial'), '3' => $translate->translate('Division'), '4' => $translate->translate('District'), '5' => $translate->translate('Tehsil')); } if ($office_term == "campaigns") { $arr_location_level = array('1' => $translate->translate('National'), '2' => $translate->translate('Provincial'), '4' => $translate->translate('District')); } ?> <div class="col-md-4"> <label class="control-label" for="office_type" class="col-md-7"><?php echo $translate->translate("Office Type"); ?> <span class="red">*</span></label> <div class="controls"> <select name="office_type_add" id="office_type_add" class="form-control"> <option value=""><?php echo $translate->translate("Select"); ?> </option> <?php foreach ($arr_location_level as $key => $value) { ?> <option value="<?php echo $key; ?> " <?php if (!empty($office_term['office_type_add']) && $key == $office_term['office_type_add']) { echo 'selected'; } ?> ><?php echo $value; ?> </option> <?php } ?> </select> </div> </div> <div class="col-md-4" id="div_combo1_add" <?php if (empty($translate->prov_id) || isset($translate->office_id) == 1 || empty($translate->office_id)) { ?> style="display:none;" <?php } else { ?> style="display:block;"<?php } ?> > <label class="control-label" id="lblcombo1_add"><?php echo $translate->translate("Province"); ?> <span class="red">*</span></label> <div class="controls"> <select name="combo1_add" id="combo1_add" class="form-control"> </select> </div> </div> <div class="col-md-4" id="div_combo2_add" <?php if (empty($translate->dist_id) || isset($translate->office_id) == 1 || empty($translate->office_id)) { ?> style="display:none;" <?php } ?> > <label class="control-label" id="lblcombo2_add"><?php echo $translate->translate("District"); ?> <span class="red">*</span></label> <div class="controls"> <select name="combo2_add" id="combo2_add" class="form-control"> </select> </div> </div> <div class="col-md-4" id="div_combo3_add" <?php if (empty($translate->tehsil_id)) { ?> style="display:none;" <?php } ?> > <label class="control-label" id="lblcombo3_add"><?php echo $translate->translate("Tehsil"); ?> <span class="red">*</span></label> <div class="controls"> <select name="combo3_add" id="combo3_add" class="form-control"> </select> </div> </div> <div class="col-md-4" id="div_combo4_add" <?php if (empty($translate->uc_id)) { ?> style="display:none;" <?php } ?> > <label class="control-label" id="lblcombo4_add"><?php echo $translate->translate("UC"); ?> <span class="red">*</span></label> <div class="controls"> <select name="combo4_add" id="combo4_add" class="col-md-10"> </select> </div> </div> <div class="col-md-1" id="loader" style="display:none;"><img src="<?php echo $base_url; ?> /images/loader.gif" style="margin-top:8px; float:left" alt="" /></div> <?php // return true; }
public function reportsAction() { $oRequest = App_Request::getInstance(); if ('admin' == App_Auth::getInstance()->getIdentity()->user_type) { $oClientModel = new Model_Client(); $oUserModel = new Model_User(); $oPackageModel = new Model_Package(); $this->view->couriers = count($oUserModel->setOption('type', 'courier')->getList()); $this->view->admins = count($oUserModel->setOption('type', 'admin')->getList()); $this->view->clients = count($oClientModel->getList()); $this->view->packages_total = count($oPackageModel->getList()); $this->view->packages_new = count($oPackageModel->setOption('type', 'new')->getList()); $this->view->packages_delivered = count($oPackageModel->setOption('type', 'complete')->getList()); } else { $this->view->setView('admin/noperms.phtml'); } }
public function searchRefrigeratorAction() { $arr_data = array(); $form = new Form_SearchRefrigerator(); $identity = App_Auth::getInstance(); if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { $cold_chain = new Model_ColdChain(); $data = $form->getValues(); $data['warehouse'] = $this->_request->warehouse; $data['office'] = $this->_request->office; $data['combo1'] = $this->_request->combo1; $cold_chain->form_values = $data; $cold_chain->form_values['warehouse'] = $this->_request->warehouse; $arr_data = $cold_chain->searchRefrigerator(); $form->office_id->setValue($data['office']); $form->combo1_id->setValue($data['combo1']); $form->warehouse_id->setValue($data['warehouse']); $form->model_id->setValue($data['ccm_model_id']); } } else { $form->placed_at->setValue(1); $form->office_id->setValue($identity->getUserLevel($identity->getIdentity())); $role_id = $this->_identity->getRoleId(); //echo $role_id; //exit; if ($role_id != 11) { $form->combo1_id->setValue($identity->getUserProvinceId()); } $form->warehouse_id->setValue($this->_identity->getWarehouseId()); } $this->view->form = $form; $this->view->result = $arr_data; $base_url = Zend_Registry::get('baseurl'); $this->view->inlineScript()->appendFile($base_url . '/js/all_level_combos.js'); }
public function routineCombo($office_term) { $identity = App_Auth::getInstance(); $translate = Zend_Registry::get('Zend_Translate'); $base_url = Zend_Registry::get('baseurl'); $user_lvl = $identity->getRoleId(); $em = Zend_Registry::get('doctrine'); $str_sql = $em->createQueryBuilder()->select("l.pkId,l.locationName")->from('Locations', 'l')->where("l.parent = 10"); $result = $str_sql->getQuery()->getResult(); ?> <div class="col-md-3"> <label class="control-label" for="province" class="col-md-7"><?php echo $translate->translate("Province"); ?> <span class="red">*</span></label> <div class="controls"> <select name="combo1" id="combo1" class="form-control"> <option value=""><?php echo $translate->translate("Select"); ?> </option> <?php foreach ($result as $row) { ?> <option value="<?php echo $row['pkId']; ?> " <?php if (!empty($office_term['combo1']) && $row['pkId'] == $office_term['combo1']) { echo 'selected'; } ?> ><?php echo $row['locationName']; ?> </option>"; <?php } ?> </select> </div> </div> <div class="col-md-3" id="div_combo2" <?php if (empty($translate->dist_id) || isset($translate->office_id) == 1 || empty($translate->office_id)) { ?> style="display:none;" <?php } ?> > <label class="control-label" id="lblcombo2"><?php echo $translate->translate("District"); ?> <span class="red">*</span></label> <div class="controls"> <select name="combo2" id="combo2" class="form-control"> </select> </div> </div> <div class="col-md-3" id="div_combo3" <?php if (empty($translate->tehsil_id)) { ?> style="display:none;" <?php } ?> > <label class="control-label" id="lblcombo3"><?php echo $translate->translate("Tehsil"); ?> <span class="red">*</span></label> <div class="controls"> <select name="combo3" id="combo3" class="form-control"> </select> </div> </div> <div class="col-md-3" id="div_combo4" <?php if (empty($translate->uc_id)) { ?> style="display:none;" <?php } ?> > <label class="control-label" id="lblcombo4"><?php echo $translate->translate("UC"); ?> <span class="red">*</span></label> <div class="controls"> <select name="combo4" id="combo4" class="form-control"> </select> </div> </div> <div class="col-md-1" id="loader" style="display:none;"><img src="<?php echo $base_url; ?> /images/loader.gif" style="margin-top:8px; float:left" alt="" /></div> <?php // return true; }
function __construct() { $this->_identity = App_Auth::getInstance(); $this->_user_id = $this->_identity->getIdentity(); $this->_em = Zend_Registry::get('doctrine'); }
public function getAllQuantityAssetsUpdate() { $auth = App_Auth::getInstance(); $s_sql = $this->_em->createQueryBuilder()->select("MAX(cs.pkId)")->from("CcmStatusHistory", "cs"); $max_id = $s_sql->getQuery()->getResult(); $sub_sql = $this->_em->createQueryBuilder()->select("MAX(cs.statusDate)")->from("CcmStatusHistory", "cs")->where("cs.pkId='" . $max_id[0][1] . "'"); $max_date = $sub_sql->getQuery()->getResult(); $sub_sql_w = $this->_em->createQueryBuilder()->select("w.pkId")->from('WarehouseUsers', 'wu')->join('wu.warehouse', 'w')->join('wu.user', 'u')->where('u.pkId=' . $this->_user_id); $sub_sql_w->getQuery()->getSql(); $row_sub = $sub_sql_w->getQuery()->getResult(); foreach ($row_sub as $rs) { $wh_id[] = $rs['pkId']; $warehouse_id = implode(',', $wh_id); } $str_sql = $this->_em->createQueryBuilder()->select("DISTINCT cc.pkId,cc.assetId,at.pkId as ccmAssetId,at.assetTypeName," . "csh.workingQuantity as quantity")->from('CcmStatusHistory', 'csh')->join('csh.ccm', 'cc')->join('cc.ccmAssetType', 'at')->join('cc.warehouse', 'w')->where("w.pkId IN ({$warehouse_id}) ")->andWhere('at.pkId IN (2,4,5)')->andWhere("csh.statusDate='" . $max_date[0][1] . "'")->groupBy('at.assetTypeName'); //echo $str_sql->getQuery()->getSql(); $row = $str_sql->getQuery()->getResult(); if (!empty($row) && count($row) > 0) { return $row; } else { return false; } }
public function locationsCombo($office_term) { $identity = App_Auth::getInstance(); $translate = Zend_Registry::get('Zend_Translate'); $base_url = Zend_Registry::get('baseurl'); $user_lvl = $identity->getRoleId(); $arr_location_level = array('3' => $translate->translate('Division'), '4' => $translate->translate('District'), '5' => $translate->translate('Tehsil'), '6' => $translate->translate('UC')); ?> <div class="col-md-3"> <label class="control-label" for="location_level" class="col-md-7"><?php echo $translate->translate("Location Level"); ?> <span class="red">*</span></label> <div class="controls"> <select name="location_level" id="location_level" class="form-control"> <!-- <option value=""><?php //echo $translate->translate("Select"); ?> </option> --> <?php foreach ($arr_location_level as $key => $value) { ?> <option value="<?php echo $key; ?> " <?php if (!empty($office_term['location_level']) && $key == $office_term['location_level']) { echo 'selected'; } ?> ><?php echo $value; ?> </option> <?php } ?> </select> </div> </div> <div class="col-md-3" id="div_combo1" <?php if (empty($translate->prov_id) || isset($translate->office_id) == 1 || empty($translate->office_id)) { ?> style="display:none;" <?php } else { ?> style="display:block;"<?php } ?> > <label class="control-label" id="lblcombo1"><?php echo $translate->translate("Province"); ?> <span class="red">*</span></label> <div class="controls"> <select name="combo1" id="combo1" class="form-control"> </select> </div> </div> <div class="col-md-3" id="div_combo2" <?php if (empty($translate->dist_id) || isset($translate->office_id) == 1 || empty($translate->office_id)) { ?> style="display:none;" <?php } ?> > <label class="control-label" id="lblcombo2"><?php echo $translate->translate("District"); ?> <span class="red">*</span></label> <div class="controls"> <select name="combo2" id="combo2" class="form-control"> </select> </div> </div> <div class="col-md-3" id="div_combo3" <?php if (empty($translate->tehsil_id)) { ?> style="display:none;" <?php } ?> > <label class="control-label" id="lblcombo3"><?php echo $translate->translate("Tehsil"); ?> <span class="red">*</span></label> <div class="controls"> <select name="combo3" id="combo3" class="form-control"> </select> </div> </div> <div class="col-md-1" id="loader" style="display:none;"><img src="<?php echo $base_url; ?> /images/loader.gif" style="margin-top:8px; float:left" alt="" /></div> <?php // return true; }
/** * get authenticated user * @return App_Models_SzUser * */ public function isLogin() { $auth = App_Auth::getInstance(); $auth->getStorage(); return $auth->hasIdentity(); }
public function allLevelCampaign($data_array) { $identity = App_Auth::getInstance(); $translate = Zend_Registry::get('Zend_Translate'); $base_url = Zend_Registry::get('baseurl'); $user_lvl = $identity->getRoleId(); $districts_array = false; $office = $data_array["level"]; $province = $data_array["province"]; $district = $data_array["district"]; $facility_type = $data_array["facility_type"]; if (!empty($province)) { $locations = new Model_Locations(); $locations->form_values = array('parent_id' => 10, 'geo_level_id' => 2); $provinces_array = $locations->getLocationsByLevel(); } if (!empty($district)) { $location = new Model_Locations(); $location->form_values = array('province_id' => $province, 'geo_level_id' => 4); $districts_array = $location->getLocationsByLevelByProvince(); } switch ($user_lvl) { case 1: case 2: case 3: $arr_province = array('1' => $translate->translate('National'), '2' => $translate->translate('Province'), '6' => $translate->translate('District')); break; case 4: $arr_province = array('1' => $translate->translate('National'), '2' => $translate->translate('Province'), '6' => $translate->translate('District')); break; case 5: $arr_province = array('2' => $translate->translate('Province')); break; case 6: $arr_province = array('1' => $translate->translate('National'), '2' => $translate->translate('Province'), '6' => $translate->translate('District')); break; case 7: $arr_province = array(); case 8: $arr_province = array('6' => $translate->translate('District')); break; default: $arr_province = array('1' => $translate->translate('National'), '2' => $translate->translate('Province')); break; } if ($facility_type == 3) { $arr_province = array('1' => $translate->translate('National'), '2' => $translate->translate('Province'), '6' => $translate->translate('District')); } ?> <?php if ($facility_type != 1 && $facility_type != 2) { ?> <div class="col-md-2" id="div_office_combo"> <label class="control-label" for="office"><?php if (empty($office_term)) { echo $translate->translate("Office"); } else { echo $office_term; } ?> </label> <div class="controls"> <select name="office" id="office" class="form-control input-small"> <option value=""><?php echo $translate->translate("Select"); ?> </option> <?php foreach ($arr_province as $key => $value) { ?> <option value="<?php echo $key; ?> " <?php if ($key == $office) { ?> selected=""<?php } ?> ><?php echo $value; ?> </option> <?php } ?> </select> </div> </div> <?php } ?> <div class="col-md-2" id="div_combo1" <?php if (empty($province)) { ?> style="display:none;" <?php } ?> > <label class="control-label" id="lblcombo1"> <?php echo $translate->translate("Province"); ?> <span class="red">*</span> </label> <div class="controls"> <select name="combo1" id="combo1" class="form-control input-small"> <?php if ($provinces_array != false) { ?> <option value=""><?php echo $translate->translate("Select"); ?> </option> <?php foreach ($provinces_array as $row) { ?> <option value="<?php echo $row['key']; ?> " <?php if (!empty($province) && $row['key'] == $province) { echo 'selected'; } ?> > <?php echo $row['value']; ?> </option> <?php } } ?> </select> </div> </div> <div class="col-md-2" id="div_combo2" <?php if ($district == '') { ?> style="display:none;" <?php } ?> > <label class="control-label" id="lblcombo2"> <?php echo $translate->translate("District"); ?> <span class="red">*</span> </label> <div class="controls"> <select name="combo2" id="combo2" class="form-control input-small"> <?php if ($districts_array != false) { ?> <option value=""><?php echo $translate->translate("Select"); ?> </option> <?php foreach ($districts_array as $row) { ?> <option value="<?php echo $row['key']; ?> " <?php if (!empty($district) && $row['key'] == $district) { echo 'selected'; } ?> > <?php echo $row['value']; ?> </option> <?php } } ?> </select> </div> </div> <div class="col-md-1" id="loader" style="display:none;"> <img src="<?php echo $base_url; ?> /images/loader.gif" style="margin-top:8px; float:left" alt="" /> </div> <?php return true; }
public static function run() { self::initAutoLoad(); App_Config::getInstance(); try { $http = App_Http::getInstance(); // if($http->isXHR()){ // if(!App_CSRFUtil::getInstance()->isValid()){ // throw new Exception('Invalid token'); // } // } $className = 'App_Controller_' . $http->getModuleName() . '_' . $http->getControllerName(); if ($http->isAdminModule()) { $auth = App_Auth::getInstance()->getInstance(); if (!$auth->isAuthAction()) { $http->setModuleName("Admin")->setControllerName("Auth")->setActionName("login"); $className = 'App_Controller_' . $http->getModuleName() . '_' . $http->getControllerName(); } } $ctrl = new $className(); $ctrl->dispatch($http->getActionName() . 'Action'); } catch (App_Request_Params_Exceptions $e) { die($e->getMessage()); } catch (App_Mysql_Exceptions $e) { die($e->getMessage()); } catch (Exception $e) { die($e->getMessage()); } }
/** * Set the default registry instance to a specified instance. * * @param Registry $registry An object instance of type Registry, * or a subclass. * @return void * @throws App_Exception if registry is already initialized. */ public static function setInstance(App_Auth $oAuth) { if (self::$_instance !== null) { throw new App_Exception('Auth is already initialized'); } self::$_instance = $oAuth; }