function init() { $auth = Zend_Auth::getInstance(); $this->_userInfo = $auth->getIdentity(); $this->_dirApp = Zend_Registry::get('dirApp')->toArray(); $this->view = Myapp_View_Smarty::getInstance(); $this->view->setView($this->_dirApp['template_front'] . $this->_dirApp['style'] . '/'); $smarty = $this->view->getEngine(); $smarty->compile_dir = $this->_dirApp['template_front_cache']; $viewRenderer = $this->_helper->getHelper('viewRenderer'); $viewRenderer->setView($this->view)->setViewBasePathSpec($smarty->template_dir)->setViewScriptPathSpec(':controller/:action.:suffix')->setViewScriptPathNoControllerSpec(':action.:suffix')->setViewSuffix($this->_dirApp['template_extension']); $this->_base_url = $this->_dirApp['base_url']; $this->view->assign('base_url', $this->_base_url); $this->view->assign('base_tpl', $this->_dirApp['base_tpl']); $this->_model = Front_Model_Locations::getInstance(); $this->_module = $this->_getParam('module'); $this->_control = $this->_getParam('controller'); $action = $this->_getParam('action'); $this->view->assign('form', array('module' => $this->_module, 'control' => $this->_control, 'action' => $action, 'lang' => $_SESSION['lang'])); $this->_lable = Zend_Registry::get('lable'); $this->view->assign('lable', $this->_lable); if (empty($this->_userInfo->adminId)) { $this->_redirect($this->_base_url . 'login/'); } if ($this->_userInfo->adminId != '') { $file_name = $this->_dirApp['dir_auth'] . $this->_userInfo->adminLogin . '.ini'; $sessionAuth = Myapp_File_Createauth::getInstance()->compareSession($file_name); if ($sessionAuth == true) { $this->_redirect($this->_base_url . 'logout/'); } } $this->view->assign('userInfo', $this->_userInfo); }
public static function getInstance() { if (!isset(self::$instance)) { $c = __CLASS__; self::$instance = new $c(); } return self::$instance; }
function step7Action() { $this->view->assign('breadcrumb', $this->_lable['add']['value'] . ' ' . $this->_lable['admin']['value']); $id = $this->_getParam('id'); $option = $this->_getParam('option'); $step = 7; $option = empty($option) ? 'add' : $option; $this->view->assign('id', $id); $this->view->assign('step', $step); $countries = $this->_model->country(); $this->view->assign('countries', $countries); $general = Front_Model_General::getInstance(); $type = "'job_title','job_category','emp_status'"; $select_box = $general->selectAllItems($type); $this->view->assign('cbxJobTitle', $select_box['items']['job_title']); $this->view->assign('cbxEmpStatus', $select_box['items']['emp_status']); $this->view->assign('cbxJobCategory', $select_box['items']['job_category']); //--- Tiểu đơn vị $emp_sub_unit = ''; $rowNested = ''; $model_nestedsubunit = Front_Model_Nestedsubunit::getInstance(); $nestedsubunit = $model_nestedsubunit->listItem(0, 'all', 0); $nestedMainCat = Myapp_DB_Nestedmaincat::getInstance(); $arrNested = $nestedMainCat->cmbNested($nestedsubunit, 'sub', $emp_sub_unit, $rowNested); $this->view->assign('arrNested', $arrNested); //--- end tiểu đơn vị //--- Vị trí $model = Front_Model_Locations::getInstance(); $locations = $model->getItems(); $this->view->assign('locations', $locations); //--- end Vị trí $cbx = new Zend_Config_Ini(APPLICATION_PATH . '/configs/general.ini', 'SETTING'); $preset_general = $cbx->toArray(); $immigration = $preset_general['immigration']; $this->view->assign('immigration', $immigration); if ($id == '') { $this->view->assign('msg', $this->_lable['url_invalid']['value']); $this->_helper->viewRenderer('step'); header("refresh:" . $this->_lable['timewait']['value'] . ";url=" . $this->_base_url . $this->_control . "/step1/"); return; } else { $this->_model->emp_id = $id; $tb_employee = $this->_model->employee(); $this->view->assign('data', $tb_employee); $contractExtend = $this->_model->getContractExtend(); $this->view->assign('contractExtend', $contractExtend); } $general = Front_Model_General::getInstance(); $general->_type = "'relation'"; $select_box = $general->getSomeFieldsTime(); $this->view->assign('select_box', $select_box); if ($this->_request->isPost()) { $data = $this->_getParam('data'); $this->view->assign('data', $data); $emp_sub_unit = $data['emp_sub_unit']; if (!empty($emp_sub_unit)) { $rowNested = $model_nestedsubunit->getNodeInfo($emp_sub_unit); } // echo '<pre>'; // print_r($rowNested); // echo '</pre>'; $arrNested = $nestedMainCat->cmbNested($nestedsubunit, 'sub', $emp_sub_unit, $rowNested); $this->view->assign('arrNested', $arrNested); $emp_info = array('emp_job_title' => $data['emp_job_title'], 'emp_status' => $data['emp_status'], 'emp_job_cat' => $data['emp_job_cat'], 'joined_date' => $data['joined_date'], 'emp_sub_unit' => $data['emp_sub_unit'], 'emp_location' => $data['emp_location']); $contract_extend = array('emp_number' => $this->_model->emp_id, 'econ_extend_start_date' => $data['econ_extend_start_date'], 'econ_extend_end_date' => $data['econ_extend_end_date']); $this->view->assign('contractExtend', $contract_extend); $update = $this->_model->updateStep7($emp_info, $contract_extend); if ($update) { //$this->_model->updateStep7($emp_info, $contract_extend); $this->view->assign('alert', 'success'); $this->view->assign('msg', $this->_lable['update_succ']['value']); $this->_helper->viewRenderer('step7'); header("refresh:" . $this->_lable['timewait']['value'] . ";url=" . $this->_base_url . $this->_control . "/step8/?id={$id}"); return; } else { $this->view->assign('alert', 'danger'); $this->view->assign('msg', $this->_lable['update_fail']['value']); $this->view->assign('data', $data); $this->_helper->viewRenderer('step7'); return; } } }