Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function aol_get_dateplot( $node_id, $date, &$node = null ) {
- if ( ! is_numeric($node_id) || intval($node_id) != $node_id || $node_id < 0) {
- drupal_set_message( t('Could not generate plot because node id is invalid.', 'warning') );
- return;
- }
- if( $node === null ) {
- $node = node_load( $node_id );
- }
- if( ! $node || $node->type != 'lake' ) {
- drupal_set_message( t('Could not generate plot because node is invalid or incorrect type.', 'warning') );
- return;
- }
- $lake_id = $node->field_lake_id[0]['value'];
- $conn = pg_connect ( "host=xxx port=5432 dbname=xxx user=xxx password=xxx" );
- import_request_variables ( 'gp', 'var_' );
- //$result = pg_query ( $conn, "select plr_get_raw(r_secchi_boxplot(44,'Lake Billy Chinook','Secchi Transparency')) as graph" );
- $result = pg_query( $conn, "select plr_get_raw(r_profile_plot(" . $lake_id . ",'" . $node->title . "','" . $date . "')) as graph" );
- if( $result === false) return null;
- $row = pg_fetch_object ( $result );
- header("Content-Type: image/png");
- echo pg_unescape_bytea ( $row->graph );
- }
Add Comment
Please, Sign In to add comment