task_data.php
/**
 * Handle an 'add' request.
 * 
 * This will insert a new task entry in the database and if an estimate was provided, a report of this will be inserted as well.
 * placeholder is a client-provided value that refers to some placeholder that the client will have used locally for a dummy task.
 * This placeholder will be returned verbatim to the cliend after inserting.
 * 
 * @param unknown_type $description
 * @param unknown_type $estimate
 * @param unknown_type $sprint_id
 * @param unknown_type $placeholder
 */
Handle an 'add' request.

This will insert a new task entry in the database and if an estimate was provided, a report of this will be inserted as well.
placeholder is a client-provided value that refers to some placeholder that the client will have used locally for a dummy task.
This placeholder will be returned verbatim to the cliend after inserting.


Handle an ' add ' request . This will insert a new task entry in the database and if an estimate was provided a report of this will be inserted as well . placeholder is a client - provided value that refers to some placeholder that the client will have used locally for a dummy task . This placeholder will be returned verbatim to the cliend after inserting .
function handle_add( $arguments)
{
	global $database;
	$description = $database->escape(get_if_defined($arguments, 'description'));
	$estimate	 = $database->escape(get_if_defined($arguments, 'estimate', 8));
	$burnt       = $database->escape(get_if_defined($arguments, 'burnt', 0));
	$sprint_id 	 = $database->escape(get_if_defined($arguments, 'sprint_id'));
	$name		 = $database->escape(get_if_defined($arguments, 'member_name', ''));
	$status      = $database->escape(get_if_defined($arguments, 'status', 'toDo'));
	$is_late	 = $database->escape(get_if_defined($arguments, 'is_late', true));
	$placeholder = get_if_defined($arguments, 'placeholder', 0);
	$member_id = get_user_id( $database, $name);
	$database->exec("INSERT INTO task(sprint_id, description, resource_id, status) VALUES ( $sprint_id, '$description', $member_id, '$status')");
	$id = $database->last_inserted_id();
	if ($is_late)
	{
		$date_expression = 'NOW()';
	}
	else 
	{
		$date_expression = "'1969-10-18'";	
	}
    $database->exec("INSERT INTO report( task_id, resource_id, burnt, estimate, date) VALUES( $id, 0, $burnt, $estimate, $date_expression)");
	$task_info = $database->get_single_result( get_task_query( 0, $id));
	$task_info['placeholder'] = $placeholder;
	print json_encode($task_info);
}
function handle_add ( $ arguments ) { global $ database ; $ description = $ database -> escape ( get_if_defined ( $ arguments , 'description' ) ) ; $ estimate = $ database -> escape ( get_if_defined ( $ arguments , 'estimate' , 8 ) ) ; $ burnt = $ database -> escape ( get_if_defined ( $ arguments , 'burnt' , 0 ) ) ; $ sprint_id = $ database -> escape ( get_if_defined ( $ arguments , 'sprint_id' ) ) ; $ name = $ database -> escape ( get_if_defined ( $ arguments , 'member_name' , '' ) ) ; $ status = $ database -> escape ( get_if_defined ( $ arguments , 'status' , 'toDo' ) ) ; $ is_late = $ database -> escape ( get_if_defined ( $ arguments , 'is_late' , true ) ) ; $ placeholder = get_if_defined ( $ arguments , 'placeholder' , 0 ) ; $ member_id = get_user_id ( $ database , $ name ) ; $ database -> exec ( " INSERT INTO task(sprint_id, description, resource_id, status) VALUES (  $ sprint_id , ' $ description ',  $ member_id , ' $ status ') " ) ; $ id = $ database -> last_inserted_id ( ) ; if ( $ is_late ) { $ date_expression = 'NOW()' ; } else { $ date_expression = " '1969-10-18' " ; } $ database -> exec ( " INSERT INTO report( task_id, resource_id, burnt, estimate, date) VALUES(  $ id , 0,  $ burnt ,  $ estimate ,  $ date_expression ) " ) ; $ task_info = $ database -> get_single_result ( get_task_query ( 0 , $ id ) ) ; $ task_info [ 'placeholder' ] = $ placeholder ; print json_encode ( $ task_info ) ; }
Handle an 'add' request.
Handle an ' add ' request .
// insert a task into the database. A task id will be created automatically, so we need to retrieve that. // find a random ( :) ) date that is earlier than the first sprint date.