6bb28a5bad7f60fb02967a43ef8a047045dfa382.svn-base 5.08 KB
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/ApiBase.php" ;?>
<?
if (! class_exists("ApiStatic")){
	class ApiStatic extends ApiBase{
		
		function __construct($req)
		{
			parent::__construct($req);
		}
		
		//회사소개
		function getKCSpecialVehicleInfo(){
			$sql="
				SELECT *
				FROM tblKCSpecialVehicleInfo
				ORDER BY infoNo DESC
				LIMIT 1
			";
			$list = $this->getRow($sql);
			return $this->makeResultJson("1", "", $list);
		}
		
		//기관인증
		function getListOfOrganizationCert(){
			$sql="
				SELECT *
				FROM tblOrganizationCert
				WHERE status=1
				ORDER BY certNo DESC
			";
			$list=$this->getArray($sql);
			return $this->makeResultJson("1", "", $list);
		}
		
		function getInfoOfOrganizationCert(){
			$certNo=$this->req["certNo"];
			$sql="
				SELECT *
				FROM tblOrganizationCert
				WHERE certNo='{$certNo}'
				LIMIT 1
			";
			$list=$this->getRow($sql);
			return $this->makeResultJson("1", "", $list);
		}
		
		//메인 페이지 정보
		function getMain(){
			$sql="
				SELECT imgPathMainLogo, imgPathMain, phrase1, phrase2, imgPathBuiltIn, imgPathAxle, imgPathFreezerV, imgPathSpecial, imgPathPowerGate, imgPathWingBody, imgPathFreezerC
				FROM tblMain
				LIMIT 1
			";
			$result=$this->getRow($sql);
			return $this->makeResultJson("1", "", $result);
		}

		//메인페이지 공지사항
		function getLatestNotice(){
			$sql="
				SELECT title, regDate
				FROM tblNotice
				WHERE status=1
				ORDER BY noticeNo DESC
				LIMIT 1
			";
			$result=$this->getRow($sql);
			return $this->makeResultJson("1", "", $result);
		}
		
		//메인페이지 이벤트
		function getLatestEvent(){
			$sql="
				SELECT title, regDate
				FROM tblEvent
				WHERE status=1
				ORDER BY eventNo DESC
				LIMIT 1
			";
			$result=$this->getRow($sql);
			return $this->makeResultJson("1", "", $result);
		}
		
		//메인 페이지 회사정보 
		function getKCBriefInfo(){
			$sql="
				SELECT factoryName1, address1, telephone1, fax1, eMail1, factoryName2, address2, telephone2, fax2, eMail2
				FROM tblKCSpecialVehicleInfo
			";
			$result=$this->getRow($sql);
			return $this->makeResultJson("1", "", $result);
		}
		
		//전화연결시 본사 이름, 전화번호
		function getKCContract(){
			$sql="
				SELECT factoryName1, telephone1, factoryName2, telephone2
				FROM tblKCSpecialVehicleInfo
			";
			$result=$this->getRow($sql);
			return $this->makeResultJson("1", "", $result);
		}
		
		//탑차 분류별 리스트
		function getListOfVehicle(){
			$vehicleType=$this->req["vehicleType"];
			//$vehicleType="IS";
			$sql="
				SELECT vehicleNo, name, imgPathVehicle1, imgPathVehicle2, imgPathVehicle3, imgPathVehicle4, imgPathVehicle5
				FROM tblVehicle
				WHERE vehicleType='{$vehicleType}' AND status=1
				ORDER BY regDate DESC
			";
			$result=$this->getArray($sql);
			return $this->makeResultJson("1", "", $result);
		}
		
		//탑차 정보
		function getInfoOfVehicle(){
			$vehicleNo=$this->req["vehicleNo"];
			
			//echo $vehicleNo;
			$sql="
				SELECT *
				FROM tblVehicle
				WHERE vehicleNo='{$vehicleNo}'
			";
			$result=$this->getRow($sql);
			return $this->makeResultJson("1", "", $result);
		}
		
		//도 리스트
		function getListOfProvince(){
			$sql="
				SELECT `provinceNumber`, `desc`, `abbreviation`
				FROM tblZipProvince
				ORDER BY provinceNumber ASC
			";	
			$result=$this->getArray($sql);
			return $this->makeResultJson("1", "", $result);
		}
		
		function getListOfCompanyProductType(){
			$sql="
				SELECT *
				FROM tblCompanyProductType
				ORDER BY productNumber ASC
			";
			$result=$this->getArray($sql);
			return $this->makeResultJson("1", "", $result);
		}
		
		
		function getListOfEmergency(){
			$sql="
				SELECT *
				FROM tblASEmergency
				WHERE status=1
			";
			$result=$this->getArray($sql);
			return $this->makeResultJson("1", "", $result);
		}
		
		function getListOfManager(){
// 			$searchType=$this->req["searchType"];
			
			
			$sql="
				SELECT userNo, userName
				FROM tblUser
				WHERE userType=2 AND status=1
				ORDER BY userName ASC;
			";
			$list=$this->getArray($sql);
			if(sizeof($list)>0)
				return $this->makeResultJson("1", "", $list);
			else
				return $this->makeResultJson("-1000", "내역이 없습니다");
		}
		
		function getAgreements(){
			$filePath = $this->agreeInfoPath;
			$files = fopen($filePath, "r");
			
			while(!feof($files)){
				$agree.=fgets($files);
			}
			
			$filePath=$this->privacyInfoPath;
			$files=fopen($filePath, "r");
			
			while(!feof($files)){
				$privacy.=fgets($files);
			}
			
			$result["agreement"]=$agree;
			$result["privacyInfo"]=$privacy;
			
			return $this->makeResultJson(1, "", $result);
			
		}
		
		function getListOfSchedule(){
				
			$month = $this->req["month"];
			$year = $this->req["year"];
				
				
			$where = "WHERE isAvail != 0";
				
			if($month != "")
				$where.=" AND month = '{$month}'";
				if($year != "")
					$where.=" AND year = '{$year}'";
						
					$sql="
					SELECT *
					FROM tblSchedule
					{$where}
					ORDER BY targetDate DESC
					";
					$result=$this->getArray($sql);
						
						
					return $this->makeResultJson(1, "얍", $result);
		}
				

	}
}

?>