Esempio n. 1
0
 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;
         }
     }
 }
 function ajxnodeAction()
 {
     $this->_helper->viewRenderer->setNoRender(true);
     header('Content-Type: text/html; charset=utf-8');
     $mcId = $this->_getParam('id');
     $mcId = str_replace('/', '', $mcId);
     if (empty($mcId)) {
         $parentsNode = Front_Model_Nestedsubunit::getInstance()->parentNodeCustomField();
         $sub = ' > ';
         foreach ($parentsNode as $node) {
             $tmp[$node['mcId']] = stripslashes($node['mcCategory']) . ' ' . $sub;
         }
         echo json_encode($tmp);
     } else {
         $productCat = Front_Model_Nestedsubunit::getInstance()->itemsTwoLevel($mcId);
         $nodeLevelOne = Myapp_DB_Nestedmaincat::getInstance()->formatTree($productCat, $mcId);
         if ($productCat != $mcId && sizeof($productCat) >= 1) {
             $cat = '{';
             $i = 0;
             foreach ($nodeLevelOne as $node) {
                 $sub = !empty($node['submenu']) ? ' > ' : '';
                 if ($i == 0) {
                     $cat .= '"' . $node['mcId'] . '":"' . stripslashes($node['mcCategory']) . ' ' . $sub . '"';
                 } else {
                     $cat .= ',"' . $node['mcId'] . '":"' . stripslashes($node['mcCategory']) . ' ' . $sub . '"';
                 }
                 $i++;
             }
             $cat .= '}';
             echo $cat;
         } else {
             echo '';
         }
     }
 }