public function deleteAction()
 {
     $SysClass = new ctrlSystem();
     $SysClass->initialization();
     try {
         if (!empty($_POST["apiMethod"]) && !empty($_POST["deleteObj"])) {
             $apiServer = dirname(__DIR__) . '/../public/include/apiServer.ini';
             // 取得API設定檔
             $apiURLIni = $SysClass->GetINIInfo($apiServer, "", 'server', '', true, false);
             $apiURL = $apiURLIni["apiURL"];
             $sendDeleteObj = http_build_query($_POST["deleteObj"]);
             $apiMethod = $_POST["apiMethod"];
             // 判斷作業系統
             // $OSCommand = 'ver';
             // $OS = $SysClass->cmdExecute($OSCommand);
             // // 刪除方法 組合指令
             // // EX: $apiURL 加上 'ASS/api/ctrlAdmin/Delete_AssTypeOffice?iUid=1'
             // // windows
             // if($OS){
             //     $curlPath = dirname(__DIR__).'\\..\\public\\include\\windows_curl\\curl.exe';
             //     $curlCMD = $curlPath;
             // }else{//other
             //     $curlCMD = "curl";
             // }
             // $curlCMD = $curlCMD.' "'.$apiURL.$apiMethod."?".$sendDeleteObj.'" -X DELETE --compressed';
             // // echo $curlCMD;
             // // echo $pageContent;
             // $pageContent = $SysClass->cmdExecute($curlCMD);
             $target_url = $apiURL . $apiMethod . "?" . $sendDeleteObj;
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $target_url);
             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
             // curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
             $rs = curl_exec($ch);
             curl_close($ch);
             $pageContent = $rs;
         } else {
             $action = [];
             $action["status"] = false;
             $action["errorMsg"] = "apiMethod or deleteObj is empty";
             $pageContent = $SysClass->Data2Json($action);
         }
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $SysClass->WriteLog("SupplyController", "editorAction", $error->getMessage());
     }
     //關閉資料庫連線
     // $SysClass->DBClose();
     //釋放
     $SysClass = null;
     $this->viewContnet['pageContent'] = $pageContent;
 }
 public function verifymenupositionAction()
 {
     $SysClass = new ctrlSystem();
     // 預設不連資料庫
     // $SysClass->initialization();
     // 連線指定資料庫
     // $SysClass->initialization("設定檔[名稱]",true); -> 即可連資料庫
     // 連線預設資料庫
     // $SysClass->initialization(null,true);
     $SysClass->initialization();
     try {
         $action = array();
         $action["status"] = false;
         $page = $_POST["page"];
         // 例外清單
         $withoutList = ["home", "announcement/list"];
         if ($page) {
             // echo $page;
             if (!in_array($page, $withoutList)) {
                 $userMenu = $_SESSION["userMenu"];
                 if (!empty($userMenu)) {
                     if (in_array($page, $userMenu)) {
                         $action["status"] = true;
                     }
                 } else {
                     if ($_SESSION["isAdmin"]) {
                         $action["status"] = true;
                     } else {
                         $action["status"] = false;
                     }
                 }
             } else {
                 $action["status"] = true;
             }
             // print_r($userMenu);
         } else {
             $action["errMsg"] = "page is undefined";
         }
         $pageContent = $SysClass->Data2Json($action);
         print_r($pageContent);
         // print_r($data);
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         // $SysClass->WriteLog("MenterController", "setloginAction", $error->getMessage());
     }
     //關閉資料庫連線
     // $SysClass->DBClose();
     //釋放
     $SysClass = null;
     $this->viewContnet['pageContent'] = $pageContent;
 }
 public function deleteAction()
 {
     $SysClass = new ctrlSystem();
     $SysClass->initialization();
     try {
         if (!empty($_POST["apiMethod"]) && !empty($_POST["deleteObj"])) {
             // $apiServer = dirname(__DIR__) . '/../../../../public/include/apiServer.ini';
             // 取得API設定檔
             // $apiURLIni = $SysClass->GetINIInfo($apiServer,"",'server','',true,false);
             // $apiURL = $apiURLIni["apiURL"];
             $apiURL = $SysClass->GetAPIUrl('apiURL');
             $sendDeleteObj = http_build_query($_POST["deleteObj"]);
             $apiMethod = $_POST["apiMethod"];
             // 判斷作業系統
             $OSCommand = 'ver';
             $OS = $SysClass->cmdExecute($OSCommand);
             // 刪除方法 組合指令
             // EX: $apiURL 加上 'ASS/api/ctrlAdmin/Delete_AssTypeOffice?iUid=1'
             // windows
             if ($OS) {
                 $curlPath = dirname(__DIR__) . '\\..\\..\\..\\..\\public\\include\\windows_curl\\curl.exe';
                 $curlCMD = $curlPath;
             } else {
                 //other
                 $curlCMD = "curl";
             }
             $curlCMD = $curlCMD . ' "' . $apiURL . $apiMethod . "?" . $sendDeleteObj . '" -X DELETE --compressed';
             // echo $curlCMD;
             // echo $pageContent;
             $pageContent = $SysClass->cmdExecute($curlCMD);
         } else {
             $action = [];
             $action["status"] = false;
             $action["errorMsg"] = "apiMethod or deleteObj is empty";
             $pageContent = $SysClass->Data2Json($action);
         }
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $SysClass->WriteLog("SupplyController", "editorAction", $error->getMessage());
     }
     //關閉資料庫連線
     // $SysClass->DBClose();
     //釋放
     $SysClass = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 public function acinfoAction()
 {
     $SysClass = new ctrlSystem();
     $SysClass->initialization(null, true);
     try {
         //-----BI開始-----
         $action = array();
         $action["status"] = false;
         // $start_time = microtime(true);
         if (!empty($_SESSION["uuid"])) {
             $action["uuid"] = $_SESSION["uuid"];
             $action["userName"] = $_SESSION["userName"];
             $action["isAdmin"] = $_SESSION["isAdmin"];
             $action["sysCode"] = $_SESSION["sysCode"];
             $action["userID"] = $_SESSION["userID"];
             $action["sysList"] = $_SESSION["sysList"];
             $action["orgid"] = $_SESSION["orgid"];
             $action["posid"] = $_SESSION["posid"];
             $action["isSuperiors"] = $_SESSION["isSuperiors"];
             $action["sc"] = $_SESSION["sc"];
             if ($_SESSION["isAdmin"]) {
                 // 是管理者就找看看是不是已經有新增過組織
                 $strSQL = "select count(*) as total from ass_org ";
                 $strSQL .= "where sys_code_id = " . $_SESSION["sysCode"];
                 $data = $SysClass->QueryData($strSQL);
                 // 代表有新增過
                 if ($data[0]["total"] > 1) {
                     $_SESSION["haveOrgs"] = true;
                 } else {
                     $_SESSION["haveOrgs"] = false;
                 }
                 // 是否有新增過部門組織
                 $strSQL = "select count(*) as total from ass_type_office ";
                 $strSQL .= "where sys_code_id = " . $_SESSION["sysCode"];
                 $data = $SysClass->QueryData($strSQL);
                 // 代表有新增過
                 if ($data[0]["total"] > 0) {
                     $_SESSION["haveOrgUnit"] = true;
                 } else {
                     $_SESSION["haveOrgUnit"] = false;
                 }
                 $action["haveOrgs"] = $_SESSION["haveOrgs"];
                 $action["haveOrgUnit"] = $_SESSION["haveOrgUnit"];
             }
             // $action["menuPosition"] = $_SESSION["menuPosition"];
             $action["status"] = true;
         } else {
             $action["msg"] = 'Please Login Again!';
         }
         // $end_time = microtime(true);
         // $action["times"] = $end_time - $start_time;
         $pageContent = json_encode($action);
         //-----BI結束-----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("PageactionController", "acinfoAction", $error->getMessage());
     }
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
 private function userName($userID)
 {
     $SysClass = new ctrlSystem();
     // 預設不連資料庫
     // $SysClass->initialization();
     // 連線指定資料庫
     // $SysClass->initialization("設定檔[名稱]",true); -> 即可連資料庫
     // 連線預設資料庫
     $SysClass->initialization(null, true);
     try {
         //-----BI開始-----
         $userName = "";
         $strSQL = "select t2.name from ass_user t1 ";
         $strSQL .= "left join ass_common t2 on t1.cmid = t2.uid ";
         $strSQL .= "where t1.uid = '" . $userID . "' ";
         $data = $SysClass->QueryData($strSQL);
         if (!empty($data)) {
             $userName = $data[0]["name"];
         }
         return $userName;
         //----BI結束----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         // $SysClass->WriteLog("MenterController", "setloginAction", $error->getMessage());
     }
 }