task_data.php
/**
 * Handle an update request.
 * Update requests contain information about a task and its latest report. Normally the data to which the report
 * applies is also communicated (ref_date). This is to handle tricky situations like a UI that was updated before midnight,
 * but an update that is sent after midnight.
 * @param unknown $arguments
 */
Handle an update request.
Update requests contain information about a task and its latest report. Normally the data to which the report
applies is also communicated (ref_date). This is to handle tricky situations like a UI that was updated before midnight,
but an update that is sent after midnight.
@param unknown $arguments
Handle an update request . Update requests contain information about a task and its latest report . Normally the data to which the report applies is also communicated ( ref_date ) . This is to handle tricky situations like a UI that was updated before midnight but an update that is sent after midnight . @param unknown $arguments
function handle_update( $arguments)
{
    global $database;
    $description = $database->escape(get_if_defined($arguments, 'description'));
    $task_id     = $database->escape(get_if_defined($arguments, 'id'));
    $ref_date    = $database->escape(get_if_defined($arguments, 'ref_date'));
    $estimate	 = $database->escape(get_if_defined($arguments, 'estimate', 8));
    $spent       = $database->escape(get_if_defined($arguments, 'spent', 8));
    $sprint_id 	 = $database->escape(get_if_defined($arguments, 'sprint_id'));
    $name		 = $database->escape(get_if_defined($arguments, 'member_name', ''));
    $placeholder = get_if_defined($arguments, 'placeholder', 0);
    $member_id = get_user_id( $database, $name);
    $database->exec("UPDATE task SET resource_id = $member_id, description = '$description' WHERE task_id = $task_id");
    if (isset($estimate) && isset( $spent))
    {
        if (!isset($ref_date))
        {
            $ref_date =  date('Y-m-d');
        }
        update_report( $task_id, $ref_date, $estimate, $spent);
    }
    $task_info = $database->get_single_result( get_task_query( 0, $task_id));
    $task_info['placeholder'] = $placeholder;
    print json_encode($task_info);
}
function handle_update ( $ arguments ) { global $ database ; $ description = $ database -> escape ( get_if_defined ( $ arguments , 'description' ) ) ; $ task_id = $ database -> escape ( get_if_defined ( $ arguments , 'id' ) ) ; $ ref_date = $ database -> escape ( get_if_defined ( $ arguments , 'ref_date' ) ) ; $ estimate = $ database -> escape ( get_if_defined ( $ arguments , 'estimate' , 8 ) ) ; $ spent = $ database -> escape ( get_if_defined ( $ arguments , 'spent' , 8 ) ) ; $ sprint_id = $ database -> escape ( get_if_defined ( $ arguments , 'sprint_id' ) ) ; $ name = $ database -> escape ( get_if_defined ( $ arguments , 'member_name' , '' ) ) ; $ placeholder = get_if_defined ( $ arguments , 'placeholder' , 0 ) ; $ member_id = get_user_id ( $ database , $ name ) ; $ database -> exec ( " UPDATE task SET resource_id =  $ member_id , description = ' $ description ' WHERE task_id =  $ task_id " ) ; if ( isset ( $ estimate ) && isset ( $ spent ) ) { if ( ! isset ( $ ref_date ) ) { $ ref_date = date ( 'Y-m-d' ) ; } update_report ( $ task_id , $ ref_date , $ estimate , $ spent ) ; } $ task_info = $ database -> get_single_result ( get_task_query ( 0 , $ task_id ) ) ; $ task_info [ 'placeholder' ] = $ placeholder ; print json_encode ( $ task_info ) ; }
Handle an update request.
Handle an update request .
// insert a task into the database. A task id will be created automatically, so we need to retrieve that.