Skip to content

Commit

Permalink
Added save result of input processing to another input function - tha…
Browse files Browse the repository at this point in the history
…nks to Amin for the idea
  • Loading branch information
Trystan committed Jan 4, 2012
1 parent a41c57d commit 42ee3b4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Models/process_model.php
Expand Up @@ -34,6 +34,7 @@ function get_process_list()
$list[11] = array( "+ input", 1, "add_input" );
$list[12] = array( "/ input" , 0, "divide" );
$list[13] = array( "phaseshift" , 0, "phaseshift" );
$list[14] = array( "save_to_input" , 3, "save_to_input" );

return $list;
}
Expand Down Expand Up @@ -282,5 +283,21 @@ function phaseshift($arg,$time,$value)
return cos($rad);
}

function save_to_input($arg,$time,$value)
{
$name = $arg;
$userid = $_SESSION['userid'];

$id = get_input_id($userid,$name); // If input does not exist this return's a zero
if ($id==0) {
create_input_timevalue($userid,$name,$time,$value); // Create input if it does not exist
} else {
$inputs[] = array($id,$time,$value);
set_input_timevalue($id,$time,$value); // Set time and value if it does
}


}

?>

0 comments on commit 42ee3b4

Please sign in to comment.