コード例 #1
0
 public function getDBdataAction()
 {
     $VTs = new clsSystem();
     //先初始化
     $VTs->initialization('');
     //-----------BI開始------------
     $type = $_GET['type'];
     $action = [];
     $action["status"] = false;
     switch ($type) {
         case 'getDateList':
             $pageType = $_GET['ptype'];
             $strSQL = "SELECT DISTINCT date(datec) as datef FROM `qc_checklist` WHERE typeid=" . $pageType . " AND imgid is not null order by datec desc";
             $data = $VTs->QueryData($strSQL);
             if (!empty($data)) {
                 $action["status"] = true;
             }
             break;
         case 'qc_checklist':
             // $strSQL="SELECT * FROM `qc_checklist` where imgid is not null AND typeid=1 order by uid desc";
             $datel = $_GET['datel'];
             $sLimit = @$_GET["sLimit"];
             $eLimit = @$_GET["eLimit"];
             if ($datel == 0) {
                 $datel = date("Y-m-d");
             }
             $data['date'] = $datel;
             $limit = "";
             if (isset($_GET["sLimit"]) and isset($_GET["eLimit"])) {
                 if ($sLimit >= 0 and $eLimit >= 1) {
                     $limit = " limit " . $sLimit . "," . $eLimit;
                 }
             }
             $strSQL = "SELECT t1.uid AS uid, t1.datec AS datec ,t1.remark AS remark,t5.name AS ma_name ,t2.count AS count,t2.place AS place,t6.imgfile AS imgfile\n\t\t\t\t\t\tFROM qc_checklist AS t1\n\t\t\t\t\t\tLEFT JOIN el_petition AS t2 ON t2.uid=t1.dataid\n\t\t\t\t\t\tLEFT JOIN prj_materiel AS t3 ON t2.prj_mid=t3.uid \n\t\t\t\t\t\tLEFT JOIN prj_materiel_items AS t4 ON t3.uid=t4.prj_mid\n\t\t\t\t\t\tLEFT JOIN el_materiel AS t5 ON t4.materielid=t5.uid\n\t\t\t\t\t\tLEFT JOIN img_picture AS t6 ON t1.imgid = t6.uid\n\t\t\t\t\t\twhere t1.imgid is not null AND t1.typeid=1\n\t\t\t\t\t\tAND to_days(t1.datec)=to_days('" . $datel . "')\n\t\t\t\t\t\torder by t1.uid desc " . $limit . ";";
             $arr_d = $VTs->QueryData($strSQL);
             $filePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\qc_img\\";
             if (!file_exists($filePath)) {
                 $tmpFilePath = str_replace("\\", "/", $filePath);
                 if (!file_exists($tmpFilePath)) {
                     $VTs->CreateDirectory($tmpFilePath);
                 }
             }
             if (!empty($arr_d)) {
                 //CreateDirectory
                 foreach ($arr_d as $i => $d) {
                     $filePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\qc_img\\";
                     $filePath .= $d["imgfile"];
                     if (file_exists($filePath)) {
                         $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true);
                         $arr_d[$i]["imgs"] = $imgArr;
                     } else {
                         $filePath = str_replace("\\", "/", $filePath);
                         if (file_exists($filePath)) {
                             $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true);
                             $arr_d[$i]["imgs"] = $imgArr;
                         } else {
                             $arr_d[$i]["imgs"] = null;
                         }
                     }
                 }
                 $data["checklist"] = $arr_d;
                 $action["status"] = true;
             }
             break;
         case 'qc_checklist_c':
             // $strSQL="SELECT * FROM `qc_checklist` where imgid is not null AND typeid=2 order by uid desc";
             $datel = $_GET['datel'];
             if ($datel == 0) {
                 $datel = date("Y-m-d");
             }
             $data['date'] = $datel;
             $strSQL = "SELECT t1.datec AS datec ,t1.remark AS remark,t1.uid,t7.name as fl,t8.name as typec,t9.name as model,t4.name as area,t6.name as typed,t10.imgfile as imgfile\n\t\t\t\t\t\tFROM qc_checklist t1\n\t\t\t\t\t\tLEFT JOIN eng_worklist_areaitem t2 ON t2.uid = t1.dataid\n\t\t\t\t\t\tLEFT JOIN eng_worklist_workitem t3 ON t3.uid = t2.wl_wiid\n\t\t\t\t\t\tLEFT JOIN eng_set_area t4 ON t4.uid = t2.areaid\n\t\t\t\t\t\tLEFT JOIN eng_pace_modelitems t5 ON t5.uid = t2.p_miid\n\t\t\t\t\t\tLEFT JOIN eng_type_d t6 ON t6.uid = t5.type_d\n\t\t\t\t\t\tLEFT JOIN eng_str_b t7 ON t7.uid = t3.strid_b\n\t\t\t\t\t\tLEFT JOIN eng_type_c t8 ON t8.uid = t3.typeid_c\n\t\t\t\t\t\tLEFT JOIN eng_pace_model t9 ON t9.uid = t3.p_modelid\n\t\t\t\t\t\tLEFT JOIN img_picture t10 ON t1.imgid = t10.uid\n\t\t\t\t\t\twhere t1.imgid is not null AND t1.typeid=2 \n\t\t\t\t\t\tAND to_days(t1.datec)=to_days('" . $datel . "')\n\t\t\t\t\t\torder by uid desc;";
             $arr_d = $VTs->QueryData($strSQL);
             $filePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\qc_img\\";
             if (!file_exists($filePath)) {
                 $VTs->CreateDirectory($filePath);
             }
             if (!empty($arr_d)) {
                 //CreateDirectory
                 foreach ($arr_d as $i => $d) {
                     $filePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\qc_img\\";
                     $filePath .= $d["imgfile"];
                     if (file_exists($filePath)) {
                         $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true);
                         $arr_d[$i]["imgs"] = $imgArr;
                     } else {
                         $arr_d[$i]["imgs"] = null;
                     }
                 }
                 $data["checklist"] = $arr_d;
                 $action["status"] = true;
             }
             break;
         case 'title':
             $strSQL = "SELECT name FROM `prj_project` WHERE uid=1";
             $d = $VTs->QueryData($strSQL);
             $data = $d[0];
             break;
     }
     // $data = $VTs->QueryData($strSQL);
     $data["status"] = $action["status"];
     $pageContent = $VTs->Data2Json($data);
     //-----------BI結束------------
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
コード例 #2
0
 public function getpurchaseimgAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization();
     try {
         //-----BI開始-----
         $action = [];
         $action["status"] = false;
         if ($_GET["uid"]) {
             //先取出照片檔名
             $strSQL = "select b.imgfile from el_petition as a ";
             $strSQL .= "left join el_purchase_img as b on a.purchase = b.uid ";
             $strSQL .= "where a.uid = '" . $_GET["uid"] . "'";
             $imgFileData = $VTs->QueryData($strSQL);
             $imgFileData = $imgFileData[0]["imgfile"];
             //CreateDirectory
             $filePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\purchase_img\\";
             if (file_exists($filePath)) {
                 $filePath .= $imgFileData;
                 $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true);
                 $action["imgs"] = $imgArr;
             } else {
                 $filePath = str_replace("\\", "/", $filePath);
                 if (file_exists($filePath)) {
                     $filePath .= $imgFileData;
                     $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true);
                     $action["imgs"] = $imgArr;
                 } else {
                     $action["msg"] = 'Can not find img files';
                     //$action["test"] = $filePath;
                 }
             }
             //再取出對應說明
             $strSQL = "select uid,img_number,purchase_number,purchase_count from el_purchase where petition_id = '" . $_GET["uid"] . "'";
             $imgMemo = $VTs->QueryData($strSQL);
             $tmpImgMemo = [];
             foreach ($imgMemo as $content) {
                 $tmpImgMemo[$content["img_number"]] = ["uid" => $content["uid"], "purchase_number" => $content["purchase_number"], "purchase_count" => $content["purchase_count"]];
             }
             $action["imgMemo"] = (object) $tmpImgMemo;
             //$action["test"] = $strSQL;
             $action["status"] = true;
         } else {
             $action["msg"] = "id or value is empty";
         }
         $pageContent = $VTs->Data2Json($action);
         //----BI結束----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("IndexController", "indexAction", $error->getMessage());
     }
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
コード例 #3
0
 public function usercarddetailAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization("tmpCardDB");
     try {
         //-----BI開始-----
         $action = array();
         $action["status"] = false;
         if ($_POST["uid"]) {
             //先尋找已新增卡片資料
             $strSQL = "select ui.uid, ci.number, ui.user_id, ui.name, ui.purpose, ui.use_date, ui.company, ui.phone, img.imgfile from tc_user_info as ui ";
             $strSQL .= "left join tc_card_info as ci on ui.card_id = ci.uid ";
             $strSQL .= "left join tc_img as img on ui.img_id = img.uid ";
             $strSQL .= "where ui.uid = " . $_POST["uid"];
             $data = $VTs->QueryData($strSQL);
             if (!empty($data)) {
                 $filePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\tmpcard_img\\";
                 if (file_exists($filePath)) {
                     $filePath .= $data[0]["imgfile"];
                     $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true);
                 } else {
                     $imgArr = 'Can not find img files';
                 }
                 $data[0]["imgfile"] = $imgArr;
                 $action["ui_data"] = $data;
                 $action["status"] = true;
             } else {
                 $action["msg"] = "暫無資料";
             }
         } else {
             $action["msg"] = "id is empty";
         }
         $pageContent = $VTs->Data2Json($action);
         //----BI結束----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("IndexController", "indexAction", $error->getMessage());
     }
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
コード例 #4
0
 public function reportAction()
 {
     //echo "targetid:".$_GET["targetid"];
     $VTs = new clsSystem();
     $VTs->initialization('oldhouseDB');
     //-----BI開始-----  
     try {
         $page = $_GET["page"];
         #序號
         $no = 1;
         switch ($page) {
             case "main_page":
                 $html_path = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\oldhouse\\table-2.html";
                 #主頁面
                 $html = $VTs->GetHtmlContent($html_path);
                 #檢驗基本資料
                 $strSQL = "select t2.`hname`, t2.`htel`, t2.`hmobil`,\n                                       t2.`ZipCode`, t2.`City`, t2.`Area`, t2.`Vil`, t2.`Verge`, t2.`Road`, t2.`addr`,\n                                       t3.desc 'strType', t1.`htmid1`, t1.`htmid2`, t5.desc 'type', t1.date, t8.name 'ename', t7.`licenseid` 'license'\n                               from qc_info as t1\n                                    left join qc_house as t2 on t2.uid = t1.`huid`\n                                        left join house_type as t3 on t3.`uid` = t1.htid\n                                    left join house_type_structure as t5 on t5.uid = t1.htsid\n                                    left join `eng_engineer_city` as t6 on t6.uid = t2.`ecid`\n                                    left join `eng_engineer` as t7 on t7.uid = t6.`eid`\n                                        left join `ass_common` as t8 on t8.uid = t7.`cmid`\n                               where huid = " . $_GET["targetid"] . "\n                               limit 1";
                 $data = $VTs->QueryData($strSQL);
                 //$VTs->Debug($data);
                 $scale1 = !empty($data[0]["htmid1"]) ? " " . $data[0]["htmid1"] . " " : " _ ";
                 $scale2 = !empty($data[0]["htmid2"]) ? " " . $data[0]["htmid2"] . " " : " _ ";
                 #主頁面基本資料置換
                 $dataArr = ["owner" => $data[0]["hname"], "tel" => $data[0]["htel"], "mobile" => $data[0]["hmobil"], "addr" => $data[0]["ZipCode"] . " " . $data[0]["City"] . " " . $data[0]["Area"] . " " . $data[0]["Vil"] . " " . $data[0]["Verge"] . " " . $data[0]["Road"] . " " . $data[0]["addr"], "strType" => $data[0]["strType"], "scale" => "地上" . $scale1 . "層  地下" . $scale2 . "層", "type" => $data[0]["type"], "date" => $data[0]["date"], "ename" => $data[0]["ename"], "license" => $data[0]["license"]];
                 $html = $VTs->ContentReplace($dataArr, $html);
                 //print_r($html);
                 #主頁面量化資料欄位
                 $quantity_tr_path = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\oldhouse\\tr1.html";
                 $quantity_tr = $VTs->GetHtmlContent($quantity_tr_path);
                 $strSQL = "SELECT t1.uid,\n                            t10.`desc` as eng_str, t11.`desc` as problem, t1.`length`, t1.`width`, t1.`depth`, t1.`area`,\n                             t1.`remark`, t13.`imgfile`, t12.unit1 level\n                            FROM qc_item AS t1\n                             LEFT JOIN qc_info AS t2 ON t2.uid = t1.ifid\n                             LEFT JOIN qc_house AS t3 ON t3.uid = t2.huid\n                              LEFT JOIN house_type AS t4 ON t4.uid = t2.htid\n                             LEFT JOIN house_type_model AS t5 ON t5.uid = t2.htmid1 OR t5.uid = t2.htmid2\n                             LEFT JOIN house_type_structure AS t6 ON t6.uid = t2.htsid\n                             LEFT JOIN eng_engineer_city AS t7 ON t7.uid = t3.ecid\n                             LEFT JOIN eng_engineer AS t8 ON t8.uid = t7.eid\n                             LEFT JOIN ass_common AS t9 ON t9.uid = t8.cmid\n                             LEFT JOIN eng_str AS t10 ON t10.`uid` = t1.`strid`\n                             LEFT JOIN qc_checkitem AS t11 ON t11.uid = t1.ciid\n                             LEFT JOIN eng_unit AS t12 ON t12.uid = t1.val\n                             LEFT JOIN img_picture AS t13 ON t13.`uid` = t1.`imgids`\n                            WHERE t2.huid = " . $_GET["targetid"] . " AND (t1.`length` > 0 OR t1.width > 0 OR t1.depth > 0 OR t1.`area` > 0)\n                            ORDER BY t1.val DESC, t1.uid ASC";
                 $data = $VTs->QueryData($strSQL);
                 //$VTs->Debug($data[0]);
                 //print_r(count($data));
                 $quantity_html = "";
                 for ($i = 0; $i < count($data); $i++) {
                     //$VTs->Debug($data[$i]);
                     $tr = $quantity_tr;
                     if ($data[$i]["area"] != 0) {
                         $value = "面積:" . $data[$i]["area"];
                     } else {
                         $value = "長:" . $data[$i]["length"] . " 寬:" . $data[$i]["width"] . " 高:" . $data[$i]["depth"];
                     }
                     #讀圖檔
                     $filePath = "C:\\xampp\\htdocs\\AP-Service\\public\\old_house_img\\";
                     //$filePath = "D:\\php_dev\\AP-Service\\public\\old_house_img\\";
                     $filePath .= $data[$i]["imgfile"];
                     //print_r($filePath);
                     if (file_exists($filePath)) {
                         $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true);
                         //$VTs->debug($imgArr["img0"]);
                         // $img = "<img src='".$imgArr["img0"]."' width='60%' />
                         //         <img src='".$imgArr["img1"]."' width='60%' />
                         //         <img src='".$imgArr["img2"]."' width='60%' />";
                         $img = count($imgArr) . "張";
                     } else {
                         $img = "0張";
                     }
                     #替換@@
                     $dataArr = ["no" => $no++, "eng_str" => $data[$i]["eng_str"], "problem" => $data[$i]["problem"], "value" => $value, "remark" => $data[$i]["remark"], "photo" => $img, "level" => $data[$i]["level"]];
                     $tr = $VTs->ContentReplace($dataArr, $tr);
                     $quantity_html .= $tr;
                 }
                 #量化資料End
                 #質化資料
                 $quality_tr_path = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\oldhouse\\tr2.html";
                 $quality_tr = $VTs->GetHtmlContent($quality_tr_path);
                 $strSQL = "SELECT t1.uid,\n                                    t10.`desc` as eng_str, t11.`desc` as problem, t1.`length`, t1.`width`, t1.`depth`, t1.`area`,\n                                    t1.`remark`, t13.`imgfile`, t12.unit1 level\n                                FROM qc_item AS t1\n                                    LEFT JOIN qc_info AS t2 ON t2.uid = t1.ifid\n                                    LEFT JOIN qc_house AS t3 ON t3.uid = t2.huid\n                                    LEFT JOIN house_type AS t4 ON t4.uid = t2.htid\n                                    LEFT JOIN house_type_model AS t5 ON t5.uid = t2.htmid1 OR t5.uid = t2.htmid2\n                                    LEFT JOIN house_type_structure AS t6 ON t6.uid = t2.htsid\n                                    LEFT JOIN eng_engineer_city AS t7 ON t7.uid = t3.ecid\n                                    LEFT JOIN eng_engineer AS t8 ON t8.uid = t7.eid\n                                    LEFT JOIN ass_common AS t9 ON t9.uid = t8.cmid\n                                    LEFT JOIN eng_str AS t10 ON t10.`uid` = t1.`strid`\n                                    LEFT JOIN qc_checkitem AS t11 ON t11.uid = t1.ciid\n                                    LEFT JOIN eng_unit AS t12 ON t12.uid = t1.val\n                                    LEFT JOIN img_picture AS t13 ON t13.`uid` = t1.`imgids`\n                                WHERE t2.huid = " . $_GET["targetid"] . " AND (t1.`length` = 0 and t1.width = 0 and t1.depth = 0 and t1.`area` = 0)\n                                ORDER BY t1.val DESC, t1.uid ASC";
                 $data = $VTs->QueryData($strSQL);
                 //$VTs->Debug($data);
                 $quality_html = "";
                 for ($i = 0; $i < count($data); $i++) {
                     //$VTs->Debug($data[$i]);
                     $tr = $quality_tr;
                     #讀圖檔
                     $filePath = "C:\\xampp\\htdocs\\AP-Service\\public\\old_house_img\\";
                     //$filePath = "D:\\php_dev\\AP-Service\\public\\old_house_img\\";
                     $filePath .= $data[$i]["imgfile"];
                     //print_r($filePath);
                     if (file_exists($filePath)) {
                         $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true);
                         //$VTs->debug($imgArr["img0"]);
                         // $img = "<img src='".$imgArr["img0"]."' width='60%' />
                         //         <img src='".$imgArr["img1"]."' width='60%' />
                         //         <img src='".$imgArr["img2"]."' width='60%' />";
                         $img = count($imgArr) . "張";
                     } else {
                         $img = "0張";
                     }
                     $dataArr = ["no" => $no++, "eng_str" => $data[$i]["eng_str"], "problem" => $data[$i]["problem"], "value" => $value, "remark" => $data[$i]["remark"], "photo" => $img, "level" => $data[$i]["level"]];
                     $tr = $VTs->ContentReplace($dataArr, $tr);
                     $quality_html .= $tr;
                 }
                 #值化資料End
                 $dataArr = ["quantity" => $quantity_html, "quality" => $quality_html];
                 $html = $VTs->ContentReplace($dataArr, $html);
                 //print_r($html);
                 //$pageContent=$VTs->Data2Json($d);
                 $pageContent = $html;
                 break;
             case "img_page":
                 #圖片頁面
                 $img_html_path = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\oldhouse\\table-3.html";
                 $img_html = $VTs->GetHtmlContent($img_html_path);
                 $img_page_path = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\oldhouse\\img_page.html";
                 $img_page = $VTs->GetHtmlContent($img_page_path);
                 #表頭資料
                 $strSQL = "select t2.`hname`, t2.`htel`, t2.`hmobil`,\n                                       t2.`ZipCode`, t2.`City`, t2.`Area`, t2.`Vil`, t2.`Verge`, t2.`Road`, t2.`addr`,\n                                       t3.desc 'strType', t1.`htmid1`, t1.`htmid2`, t5.desc 'type', t1.date, t8.name 'ename', t7.`licenseid` 'license'\n                               from qc_info as t1\n                                    left join qc_house as t2 on t2.uid = t1.`huid`\n                                        left join house_type as t3 on t3.`uid` = t1.htid\n                                    left join house_type_structure as t5 on t5.uid = t1.htsid\n                                    left join `eng_engineer_city` as t6 on t6.uid = t2.`ecid`\n                                    left join `eng_engineer` as t7 on t7.uid = t6.`eid`\n                                        left join `ass_common` as t8 on t8.uid = t7.`cmid`\n                               where huid = " . $_GET["targetid"] . "\n                               limit 1";
                 $data = $VTs->QueryData($strSQL);
                 #圖片頁面header置換
                 $img_header_path = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\oldhouse\\img_header.html";
                 $img_header = $VTs->GetHtmlContent($img_header_path);
                 $dataArr = ["addr" => $data[0]["ZipCode"] . " " . $data[0]["City"] . " " . $data[0]["Area"] . " " . $data[0]["Vil"] . " " . $data[0]["Verge"] . " " . $data[0]["Road"] . " " . $data[0]["addr"], "date" => $data[0]["date"], "ename" => $data[0]["ename"], "license" => $data[0]["license"]];
                 $img_header = $VTs->ContentReplace($dataArr, $img_header);
                 //print_r($img_header);
                 #量化資料
                 #主頁面量化資料欄位
                 $img_content_path = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\pageSetting\\oldhouse\\img_content.html";
                 $img_content = $VTs->GetHtmlContent($img_content_path);
                 //print_r($img_content);
                 $strSQL = "SELECT t1.uid,\n                            t10.`desc` as eng_str, t11.`desc` as problem, t1.`length`, t1.`width`, t1.`depth`, t1.`area`,\n                             t1.`remark`, t13.`imgfile`, t12.unit1 level\n                            FROM qc_item AS t1\n                             LEFT JOIN qc_info AS t2 ON t2.uid = t1.ifid\n                             LEFT JOIN qc_house AS t3 ON t3.uid = t2.huid\n                              LEFT JOIN house_type AS t4 ON t4.uid = t2.htid\n                             LEFT JOIN house_type_model AS t5 ON t5.uid = t2.htmid1 OR t5.uid = t2.htmid2\n                             LEFT JOIN house_type_structure AS t6 ON t6.uid = t2.htsid\n                             LEFT JOIN eng_engineer_city AS t7 ON t7.uid = t3.ecid\n                             LEFT JOIN eng_engineer AS t8 ON t8.uid = t7.eid\n                             LEFT JOIN ass_common AS t9 ON t9.uid = t8.cmid\n                             LEFT JOIN eng_str AS t10 ON t10.`uid` = t1.`strid`\n                             LEFT JOIN qc_checkitem AS t11 ON t11.uid = t1.ciid\n                             LEFT JOIN eng_unit AS t12 ON t12.uid = t1.val\n                             LEFT JOIN img_picture AS t13 ON t13.`uid` = t1.`imgids`\n                            WHERE t2.huid = " . $_GET["targetid"] . " AND (t1.`length` > 0 OR t1.width > 0 OR t1.depth > 0 OR t1.`area` > 0)\n                            ORDER BY t1.val DESC, t1.uid ASC";
                 $data = $VTs->QueryData($strSQL);
                 //$VTs->Debug($data);
                 $quantity_page = "";
                 for ($i = 0; $i < count($data); $i++) {
                     //$VTs->Debug($data[$i]);
                     $content = $img_content;
                     //print_r($content);
                     if ($data[$i]["area"] != 0) {
                         $value = "面積:" . $data[$i]["area"];
                     } else {
                         $value = "長:" . $data[$i]["length"] . " 寬:" . $data[$i]["width"] . " 高:" . $data[$i]["depth"];
                     }
                     #讀圖檔
                     $filePath = "C:\\xampp\\htdocs\\AP-Service\\public\\old_house_img\\";
                     //$filePath = "D:\\php_dev\\AP-Service\\public\\old_house_img\\";
                     $filePath .= $data[$i]["imgfile"];
                     //print_r("量化圖檔:".$filePath);
                     if (file_exists($filePath)) {
                         $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true);
                         //$VTs->debug($imgArr["img0"]);
                         $img0 = $imgArr["img0"];
                         $img1 = $imgArr["img1"];
                         $img2 = $imgArr["img2"];
                     } else {
                         $img0 = "";
                         $img1 = "";
                         $img2 = "";
                     }
                     #替換@@
                     $dataArr = ["no" => $no++, "eng_str" => $data[$i]["eng_str"], "problem" => $data[$i]["problem"], "value" => $value, "remark" => $data[$i]["remark"], "level" => $data[$i]["level"], "img0" => $img0, "img1" => $img1, "img2" => $img2];
                     $content = $VTs->ContentReplace($dataArr, $content);
                     //print_r($content);
                     $quantity_page .= $img_header . $content;
                 }
                 //print_r($quantity_page);
                 #量化資料End
                 #質化資料
                 $strSQL = "SELECT t1.uid,\n                                    t10.`desc` as eng_str, t11.`desc` as problem, t1.`length`, t1.`width`, t1.`depth`, t1.`area`,\n                                    t1.`remark`, t13.`imgfile`, t12.unit1 level\n                                FROM qc_item AS t1\n                                    LEFT JOIN qc_info AS t2 ON t2.uid = t1.ifid\n                                    LEFT JOIN qc_house AS t3 ON t3.uid = t2.huid\n                                    LEFT JOIN house_type AS t4 ON t4.uid = t2.htid\n                                    LEFT JOIN house_type_model AS t5 ON t5.uid = t2.htmid1 OR t5.uid = t2.htmid2\n                                    LEFT JOIN house_type_structure AS t6 ON t6.uid = t2.htsid\n                                    LEFT JOIN eng_engineer_city AS t7 ON t7.uid = t3.ecid\n                                    LEFT JOIN eng_engineer AS t8 ON t8.uid = t7.eid\n                                    LEFT JOIN ass_common AS t9 ON t9.uid = t8.cmid\n                                    LEFT JOIN eng_str AS t10 ON t10.`uid` = t1.`strid`\n                                    LEFT JOIN qc_checkitem AS t11 ON t11.uid = t1.ciid\n                                    LEFT JOIN eng_unit AS t12 ON t12.uid = t1.val\n                                    LEFT JOIN img_picture AS t13 ON t13.`uid` = t1.`imgids`\n                                WHERE t2.huid = " . $_GET["targetid"] . " AND (t1.`length` = 0 and t1.width = 0 and t1.depth = 0 and t1.`area` = 0)\n                                ORDER BY t1.val DESC, t1.uid ASC";
                 $data = $VTs->QueryData($strSQL);
                 //$VTs->Debug($data);
                 $quality_page = "";
                 for ($i = 0; $i < count($data); $i++) {
                     //$VTs->Debug($data[$i]);
                     $content = $img_content;
                     #讀圖檔
                     $filePath = "C:\\xampp\\htdocs\\AP-Service\\public\\old_house_img\\";
                     //$filePath = "D:\\php_dev\\AP-Service\\public\\old_house_img\\";
                     $filePath .= $data[$i]["imgfile"];
                     //print_r("質化圖檔:".$filePath);
                     if (file_exists($filePath)) {
                         $imgArr = $VTs->GetINIInfo($filePath, "", "", "", true);
                         //$VTs->debug($imgArr["img0"]);
                         $img0 = $imgArr["img0"];
                         $img1 = $imgArr["img1"];
                         $img2 = $imgArr["img2"];
                     } else {
                         $img0 = "";
                         $img1 = "";
                         $img2 = "";
                     }
                     $dataArr = ["no" => $no++, "eng_str" => $data[$i]["eng_str"], "problem" => $data[$i]["problem"], "value" => $value, "remark" => $data[$i]["remark"], "photo" => $img, "level" => $data[$i]["level"], "img0" => $img0, "img1" => $img1, "img2" => $img2];
                     $content = $VTs->ContentReplace($dataArr, $content);
                     $quality_page .= $img_header . $content;
                 }
                 #值化資料End
                 // $dataArr = [
                 //     "img_header" => $img_header,
                 //     "img_content" => $img_content
                 // ];
                 // $img_page = $VTs->ContentReplace($dataArr,$img_page);
                 $dataArr = ["img_page" => $quantity_page . $quality_page];
                 $img_html = $VTs->ContentReplace($dataArr, $img_html);
                 $pageContent = $img_html;
                 break;
         }
         //-----BI結束-----
     } catch (Exception $error) {
         //依據Controller, Action補上對應位置, $error->getMessage()為固定部份
         $VTs->WriteLog("IndexController", "indexAction", $error->getMessage());
     }
     //關閉資料庫連線
     $VTs->DBClose();
     //釋放
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
コード例 #5
0
 public function getmobileitemlistAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization();
     //-----BI開始-----
     $action = array();
     $action["status"] = false;
     if (!empty($_POST["dataid"]) and !empty($_POST["dataDB"])) {
         $sDB = $_POST["dataDB"];
         $dataid = $_POST["dataid"];
         $data = null;
         switch ($sDB) {
             case "qc_checklist":
                 //開始做資料庫設定檔
                 $filePath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\qcListSet\\content.ini";
                 if (!file_exists($filePath)) {
                     $filePath = str_replace("\\", "/", $filePath);
                 }
                 $optionArr = $VTs->GetINIInfo($filePath, "", "", "", true, true);
                 //create Sample
                 $strSQL = "select @@selectOption@@ from qc_checklist t1 ";
                 $strSQL .= "@@content@@";
                 $strSQL .= "where t1.typeid=@@typeid@@ and t1.isok=0 and t1.imgid is null";
                 $tmpDataArr = null;
                 foreach ($optionArr as $key => $contents) {
                     $tmpStrSQL = $strSQL;
                     $tmpContentStr = '';
                     foreach ($contents as $contentkey => $dbContent) {
                         if ($contentkey != "selectOption") {
                             $tmpContentStr .= "left join " . $contentkey . " " . $dbContent . " ";
                         }
                     }
                     //將處理好的資料取代好
                     $tmpStrSQL = str_replace("@@selectOption@@", $contents["selectOption"], $tmpStrSQL);
                     $tmpStrSQL = str_replace("@@content@@", $tmpContentStr, $tmpStrSQL);
                     $tmpStrSQL = str_replace("@@typeid@@", str_replace("type", "", $key), $tmpStrSQL);
                     //開始取得資料
                     $data = $VTs->QueryData($tmpStrSQL);
                     if (!empty($data)) {
                         $tmpDataArr[$key] = $data;
                     }
                 }
                 $processArr = [];
                 //如果不為空則開始處理
                 if (!empty($tmpDataArr)) {
                     foreach ($tmpDataArr as $content) {
                         $processArr = array_merge($processArr, $content);
                     }
                 }
                 if (!empty($processArr)) {
                     $data = $processArr;
                 }
                 break;
         }
         if (!empty($data)) {
             $action["itemlist"] = $data;
         } else {
             $action["msg"] = '無審查資料';
         }
         $action["status"] = true;
     } else {
         if (empty($_POST["dataid"])) {
             $action["msg"] = 'dataid is Empty';
         } else {
             $action["msg"] = 'dataDB is Empty';
         }
     }
     $pageContent = $VTs->Data2Json($action);
     //-----BI結束-----
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }
コード例 #6
0
 public function pageAction()
 {
     $VTs = new clsSystem();
     $VTs->initialization();
     //-----BI開始-----
     $action = array();
     $action["status"] = false;
     if (!empty($_POST)) {
         switch ($_POST["type"]) {
             //取得語言
             case "getLan":
                 //如果未設定語系,先設定
                 if (!isset($_SESSION["lang"])) {
                     //先取得語系列表
                     $langListArr = $this->langList();
                     //取得伺服器本身的語言
                     $lang = strtolower(strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ','));
                     $lang = str_replace("zh-", "", $lang);
                     if (!empty($langListArr)) {
                         if (!in_array($lang, $langListArr["list"])) {
                             $lang = 'tw';
                         }
                     } else {
                         $lang = 'tw';
                     }
                 }
                 //取得語言設定檔
                 $langPath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\language\\";
                 $langPath .= !empty($_POST["selectLang"]) ? $_POST["selectLang"] : $lang;
                 $langPath .= ".ini";
                 if (!file_exists($langPath)) {
                     $langPath = str_replace("\\", "/", $langPath);
                 }
                 if (file_exists($langPath)) {
                     $action["langContent"] = $VTs->GetINIInfo($langPath, "", "", "", true);
                     $action["status"] = true;
                 } else {
                     $action["msg"] = 'Lang File is not Find';
                 }
                 $action["lang"] = $lang;
                 break;
                 //取得語言設定檔
             //取得語言設定檔
             case "getLanContent":
                 if (!empty($_POST["selectLang"])) {
                     $langPath = dirname(__DIR__) . "\\..\\..\\..\\..\\public\\include\\language\\" . $_POST["selectLang"] . ".ini";
                     if (!file_exists($langPath)) {
                         $langPath = str_replace("\\", "/", $langPath);
                     }
                     if (file_exists($langPath)) {
                         $action["langContent"] = $VTs->GetINIInfo($langPath, "", "", "", true);
                         $action["status"] = true;
                     } else {
                         $action["msg"] = 'Lang File is not Find';
                     }
                 } else {
                     $action["msg"] = 'Lang Select is Empty';
                 }
                 break;
         }
     }
     $pageContent = $VTs->Data2Json($action);
     //----BI結束----
     $VTs = null;
     $this->viewContnet['pageContent'] = $pageContent;
     return new ViewModel($this->viewContnet);
 }