Ejemplo n.º 1
0
	<div id="wrapper">
<?
	require "functions.php";
	require "includes.php";
	require "menu.php";
	
	/* setup variables */
	$action = GetVariable("action");
	$enrollmentid = GetVariable("enrollmentid");
	$experimentid = GetVariable("experimentid");
	$formid = GetVariable("formid");
	$val_strings = GetVariables("string");
	$val_numbers = GetVariables("number");
	$val_texts = GetVariables("text");
	$val_dates = GetVariables("date");
	$val_files = GetVariables("file");
	$experimentor = GetVariable("experimentor");
	$experimentdate = GetVariable("experimentdate");
	$label = GetVariable("label");
	$notes = GetVariable("notes");

	//print_r($val_text);
	
	/* determine action */
	switch ($action) {
		case 'create':
			CreateForm($enrollmentid, $formid, $username);
			break;
		case 'completed':
			SetAsComplete($experimentid);
			ViewForm($experimentid, "view");
Ejemplo n.º 2
0
 function RunService()
 {
     $ci =& get_instance();
     $wsdl_is_set = (isset($_REQUEST['wsdl']) or isset($_REQUEST['WSDL']));
     //if the POST request contains the SoapACTION parameter
     $action_is_set = isset($_SERVER['HTTP_SOAPACTION']);
     //if the query string contains ?op
     $op_is_set = isset($_REQUEST['op']);
     //when the SOAPAction is set, call the appropriate web method
     if ($action_is_set == 1) {
         $action_name = $_SERVER['HTTP_SOAPACTION'];
         $action_name2 = str_replace('"', "", $action_name);
         //removes quotes
         $action = substr($action_name2, strlen('http://www.cuahsi.org/his/1.1/ws/'));
         //read the input parameters
         $postdata = file_get_contents('php://input');
         $authtoken = wof_read_authtoken($postdata);
         //load authToken
         $validToken = $ci->config->item('auth_token');
         if ($validToken == "" || $validToken != "" && $validToken == $authtoken) {
             header('Content-Type: text/html; charset=utf-8');
             if ($action == 'GetSiteInfo') {
                 $site = wof_read_parameter($postdata, 'site');
                 GetSiteInfo($site);
                 exit;
             } elseif ($action == 'GetSiteInfoMultpleObject') {
                 $site = wof_read_array_parameter($postdata, 'site');
                 $siteArray = $site == "" ? array() : explode(",", $site);
                 GetSiteInfoMultpleObject($siteArray);
                 exit;
             } elseif ($action == 'GetSiteInfoObject') {
                 $site = wof_read_parameter($postdata, 'site');
                 GetSiteInfoObject($site);
                 exit;
             } elseif ($action == 'GetSites') {
                 $site = wof_read_array_parameter($postdata, 'site');
                 $siteArray = $site == "" ? array() : explode(",", $site);
                 GetSites($siteArray);
                 exit;
             } elseif ($action == 'GetSitesByBoxObject') {
                 $north = wof_read_parameter($postdata, 'north');
                 $south = wof_read_parameter($postdata, 'south');
                 $east = wof_read_parameter($postdata, 'east');
                 $west = wof_read_parameter($postdata, 'west');
                 $IncludeSeries = wof_read_parameter($postdata, 'includeseries');
                 GetSitesByBoxObject($north, $south, $east, $west, $IncludeSeries);
                 exit;
             } elseif ($action == 'GetSitesObject') {
                 $site = wof_read_array_parameter($postdata, 'site');
                 $siteArray = $site == "" ? array() : explode(",", $site);
                 GetSitesObject($siteArray);
                 exit;
             } elseif ($action == 'GetValues') {
                 $location = wof_read_parameter($postdata, 'location');
                 $variable = wof_read_parameter($postdata, 'variable');
                 $startDate = wof_read_parameter($postdata, 'startDate');
                 $endDate = wof_read_parameter($postdata, 'endDate');
                 GetValues($location, $variable, $startDate, $endDate);
                 exit;
             } elseif ($action == 'GetValuesForASiteObject') {
                 $site = wof_read_parameter($postdata, 'site');
                 $startDate = wof_read_parameter($postdata, 'startDate');
                 $endDate = wof_read_parameter($postdata, 'endDate');
                 GetValuesForASiteObject($site, $startDate, $endDate);
                 exit;
             } elseif ($action == 'GetValuesObject') {
                 $location = wof_read_parameter($postdata, 'location');
                 $variable = wof_read_parameter($postdata, 'variable');
                 $startDate = wof_read_parameter($postdata, 'startDate');
                 $endDate = wof_read_parameter($postdata, 'endDate');
                 GetValuesObject($location, $variable, $startDate, $endDate);
                 exit;
             } elseif ($action == 'GetVariableInfo') {
                 $variable = wof_read_parameter($postdata, 'variable');
                 GetVariableInfo($variable);
                 exit;
             } elseif ($action == 'GetVariableInfoObject') {
                 $variable = wof_read_parameter($postdata, 'variable');
                 GetVariableInfoObject($variable);
                 exit;
             } elseif ($action == 'GetVariables') {
                 GetVariables();
                 exit;
             } elseif ($action == 'GetVariablesObject') {
                 GetVariablesObject();
                 exit;
             } else {
                 echo "ACTION NOT FOUND!! " . $action;
                 exit;
             }
         } else {
             header("Status: 401 Unauthorized");
             header("Content-type: text/plain");
             echo "HTTP/1.0 401 Unauthorized";
         }
     } elseif ($op_is_set == 1) {
         //when the op parameter is set, return the web method test page
         $operation_name = $_REQUEST['op'];
         $name_file = APPPATH . 'views/operations/operation_' . $operation_name . '.html';
         $name = @implode('', @file(APPPATH . 'views/operations/operation_' . $operation_name . '.html'));
         // send the right headers
         $complete_uri = $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
         $absolute_uri = "http://" . substr($complete_uri, 0, strrpos($complete_uri, '/')) . "/cuahsi_1_1.asmx";
         $pattern = "/ABSOLUTEURI_TO_REPLACE/";
         $name2 = preg_replace($pattern, $absolute_uri, $name);
         header("Content-Type: text/html");
         header("Content-Length: " . filesize($name_file));
         echo $name2;
         exit;
     } elseif ($wsdl_is_set == 1) {
         //when the WSDL query string document is set, return the WSDL
         // Return the WSDL
         $wsdl = @implode('', @file(APPPATH . 'views/wateroneflow.wsdl'));
         if (strlen($wsdl) > 1) {
             //replace the absolute uri
             //$absolute_uri = "http://localhost:333/HIS/hydroserver/webservice/cuahsi_1_1.php";
             $complete_uri = $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
             $absolute_uri = "http://" . substr($complete_uri, 0, strrpos($complete_uri, '/')) . "/cuahsi_1_1.asmx";
             $pattern = "/ABSOLUTEURI_TO_REPLACE/";
             $wsdl2 = preg_replace($pattern, $absolute_uri, $wsdl);
             header("Content-type: text/xml");
             echo $wsdl2;
             exit;
         } else {
             header("Status: 500 Internal Server Error");
             header("Content-type: text/plain");
             echo "HTTP/1.0 500 Internal Server Error";
         }
     } else {
         header("Content-Type: text/html");
         $asmx_file_name = APPPATH . 'views/asmx_page.html';
         header("Content-Length: " . filesize($asmx_file_name));
         header("File-Name: " . $asmx_file_name);
         // display the file and stop this script
         readfile($asmx_file_name);
         exit;
     }
 }