예제 #1
0
 function processRequests()
 {
     if (!empty($_GET['vlDCjs'])) {
         header("Content-type: text/javascript");
         print $this->generateJavascript();
         exit;
         return;
     }
     $requestMode = -1;
     $sFunctionName = "";
     $aArgs = array();
     $sResponse = "";
     if (!empty($_GET["vlDC"])) {
         $requestMode = GET;
     }
     if (!empty($_POST["vlDC"])) {
         $requestMode = POST;
     }
     if ($requestMode == -1) {
         return;
     }
     if ($requestMode == POST) {
         $sFunctionName = $_POST["vlDC"];
         if (!empty($_POST["vlDCargs"])) {
             $aArgs = $_POST["vlDCargs"];
         }
     } else {
         header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
         header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
         header("Cache-Control: no-cache, must-revalidate");
         header("Pragma: no-cache");
         header("Content-type: text/xml");
         $sFunctionName = $_GET["vlDC"];
         if (!empty($_GET["vlDCargs"])) {
             $aArgs = $_GET["vlDCargs"];
         }
     }
     if (!in_array($sFunctionName, $this->aFunctions)) {
         $objResponse = new vlDCResponse();
         $objResponse->addAlert("Unknown Function {$sFunctionName}.");
         $sResponse = $objResponse->getXML();
     } else {
         if ($this->aFunctionRequestTypes[$sFunctionName] != $requestMode) {
             $objResponse = new vlDCResponse();
             $objResponse->addAlert("Incorrect Request Type.");
             $sResponse = $objResponse->getXML();
         } else {
             for ($i = 0; $i < sizeof($aArgs); $i++) {
                 if (stristr($aArgs[$i], "<xjxobj>") != false) {
                     $aArgs[$i] = $this->xmlToArray("xjxobj", $aArgs[$i]);
                 } else {
                     if (stristr($aArgs[$i], "<xjxquery>") != false) {
                         $aArgs[$i] = $this->xmlToArray("xjxquery", $aArgs[$i]);
                     }
                 }
             }
             $sResponse = call_user_func_array($sFunctionName, $aArgs);
         }
     }
     header("Content-type: text/xml; charset=utf-8");
     print $sResponse;
     exit;
 }
예제 #2
0
/**
* update application number
*/
function XloadFacilityFromFormName($formnumber,$formName,$fieldID,$facilityIDField) {
	//validate
	$formnumber=validate($formnumber);
	$formName=validate($formName);
	$fieldID=validate($fieldID);
	$facilityIDField=validate($facilityIDField);
	$objResponse = new vlDCResponse();
	//reference number
	$refNumber=0;
	$refNumber=getDetailedTableInfo2("vl_forms_clinicalrequest","formNumber='$formnumber' limit 1","refNumber");
	//facility ID
	$facilityID=0;
	$facilityID=getDetailedTableInfo2("vl_forms_clinicalrequest_dispatch","refNumber='$refNumber' limit 1","facilityID");
	if($facilityID) {
		//load facilities
		$facilities=0;
		$facilities="<select name=\"$fieldID\" id=\"$fieldID\" class=\"search\" onchange=\"getHubDistrict(),checkForHubDistrict(), loadArtHistory(document.$formName.artNumber,document.$formName.facilityID.value)\">";
		$query=0;
		$query=mysqlquery("select * from vl_facilities where facility!='' order by facility");
		$facilities.="<option value=\"$facilityID\" selected=\"selected\">".getDetailedTableInfo2("vl_facilities","id='$facilityID' limit 1","facility")."</option>";
		if(mysqlnumrows($query)) {
			while($q=mysqlfetcharray($query)) {
				$facilities.="<option value=\"$q[id]\">$q[facility]</option>";
			}
		}
		$facilities.="</select>";
		//load responses
		$objResponse->addAssign("$facilityIDField","innerHTML",$facilities);
		$objResponse->addScript("checkForHubDistrict()");
		$objResponse->addScript("loadArtHistory(document.$formName.artNumber,'$facilityID')");
	}
	return $objResponse->getXML();
}