コード例 #1
0
function stopRecorder()
{
    ## stop running recording |
    global $kga, $conn;
    $table = $kga['server_prefix'] . "zef";
    $last_task = get_event_last();
    // aktuelle vorgangs-ID auslesen
    $filter['zef_ID'] = $last_task['zef_ID'];
    $rounded = roundTimespan($last_task['zef_in'], time(), $kga['conf']['roundPrecision']);
    $values['zef_in'] = $rounded['start'];
    $values['zef_out'] = $rounded['end'];
    $values['zef_time'] = $values['zef_out'] - $values['zef_in'];
    $query = MySQL::BuildSQLUpdate($table, $values, $filter);
    logfile($query);
    return $conn->Query($query);
}
コード例 #2
0
/**
 * performed when the stop buzzer is hit.
 * Checks which record is currently recording and
 * writes the end time into that entry.
 * if the measured timevalue is longer than one calendar day
 * it is split up and stored in the DB by days
 *
 * @global array $kga kimai-global-array
 * @param integer $user ID of user
 * @author th 
 *
 */
function stopRecorder()
{
    ## stop running recording
    global $kga, $pdo_conn;
    $p = $kga['server_prefix'];
    $last_task = get_event_last();
    // aktuelle vorgangs-ID auslesen
    $zef_ID = $last_task['zef_ID'];
    $rounded = roundTimespan($last_task['zef_in'], time(), $kga['conf']['roundPrecision']);
    $difference = $rounded['end'] - $rounded['start'];
    $pdo_query = $pdo_conn->prepare("UPDATE {$p}zef SET zef_in = ?, zef_out = ?, zef_time = ? WHERE zef_ID = ?;");
    $pdo_query->execute(array($rounded['start'], $rounded['end'], $difference, $zef_ID));
}