Example #1
0
#---------- set the parameters that you want here -------

    }
}
else {
    if(isset($_GET['id'])) {
	require_once('../../includes/environment.php');
	$sid	 = $_GET['id'];
    }
    else {
	require_once('includes/environment.php');
	$sid	 = $argv[1];
    }

# get current inputs	
    $data	 = get_inputs($db);
    $variables	 = get_simple_results($db);

#---------- add your content here -----------------------

   $dbconn = pg_connect("host=dp.emo-it.com port=5432 dbname=rob_azsmart_level user=rob");

# actual analysis
//Distance to Closest Stream
    $res = pg_query ($dbconn, 'select surface_stream_flow.site_name, huc, site_type, status, total_mean*723.966 as total_mean_acreft, water_year, annual_dis*723.966 as annual_dis_acreft, distance(transform(surface_stream_flow.the_geom,32612),transform(ST_GeomFromText(\''.$data['Input Map'].'\',4326),32612))/1000 as stream_dist from surface_stream_flow order by stream_dist asc limit 1;');
        $result = pg_fetch_all($res);
        var_dump($result);

# writing the data into the table

        $res = pg_query ($dbconn, 'update result_simple_variables set value=(\''.$result[0]['site_name'].' ('.round ($result[0]['stream_dist'],2).'km)\' ) where id=12;');
Example #2
0
*/

#---------- set the parameters that you want here -------

#---------- end setting parameters ----------------------
	return($options);
    }
} else {
    if(isset($_GET['id'])) {
	require_once('../../includes/environment.php');
	$sid	 = $_GET['id'];
    } else {
	require_once('includes/environment.php');
	$sid	 = $argv[1];
    }

# get current options, inputs and simple results
    $data	 = get_inputs($db, $sid);
    $options     = $data['_OPTIONS'];
    $variables	 = get_simple_results($db);

#---------- add your content here -----------------------



# Make sure to write the data into a table 
#---------- end of userdefined content ------------------

    workflow_done($sid);
}