Esempio n. 1
0
/**
 * Get annotations for the user sub list. Currently it's just the time, like
 * in the timesheet extension.
 *
 * @param int $start Time from which to take entries into account.
 * @param int $end Time until which to take entries into account.
 * @param array $users Array of user IDs to filter by.
 * @param array $customers Array of customer IDs to filter by.
 * @param array $projects Array of project IDs to filter by.
 * @param array $activities Array of activity IDs to filter by.
 * @return array Array which assigns every user (via his ID) the data to show.
 */
function export_get_user_annotations($start, $end, $users = null, $customers = null, $projects = null, $activities = null)
{
    global $expense_ext_available, $database;
    $arr = $database->get_time_users($start, $end, $users, $customers, $projects, $activities);
    if ($expense_ext_available) {
        $expenses = expenses_by_user($start, $end, $users, $customers, $projects);
        merge_annotations($arr, $expenses);
    }
    return $arr;
}
Esempio n. 2
0
 }, $database->get_projects($kga['user']['groups']));
 if (!empty($filters[2])) {
     $filterProjects = array_intersect($filterProjects, explode(':', $filters[2]));
 }
 // if no userfilter is set, set it to current user
 if (isset($kga['user']) && count($filterUsers) == 0) {
     array_push($filterUsers, $kga['user']['userID']);
 }
 if (isset($kga['customer'])) {
     $filterCustomers = array($kga['customer']['customerID']);
 }
 $view->assign('expenses', get_expenses($in, $out, $filterUsers, $filterCustomers, $filterProjects, 1));
 $view->assign('total', Kimai_Format::formatCurrency(array_reduce($view->expenses, function ($sum, $expense) {
     return $sum + $expense['multiplier'] * $expense['value'];
 }, 0)));
 $ann = expenses_by_user($in, $out, $filterUsers, $filterCustomers, $filterProjects);
 $ann = Kimai_Format::formatCurrency($ann);
 $view->assign('user_annotations', $ann);
 // TODO: function for loops or convert it in template with new function
 $ann = expenses_by_customer($in, $out, $filterUsers, $filterCustomers, $filterProjects);
 $ann = Kimai_Format::formatCurrency($ann);
 $view->assign('customer_annotations', $ann);
 $ann = expenses_by_project($in, $out, $filterUsers, $filterCustomers, $filterProjects);
 $ann = Kimai_Format::formatCurrency($ann);
 $view->assign('project_annotations', $ann);
 $view->assign('activity_annotations', array());
 if (isset($kga['user'])) {
     $view->assign('hideComments', !$kga->getSettings()->isShowComments());
 } else {
     $view->assign('hideComments', true);
 }
Esempio n. 3
0
File: init.php Progetto: cljk/kimai
if (isset($kga['user'])) {
    // user logged in
    $view->expenses = get_expenses($in, $out, array($kga['user']['userID']), null, null, 1);
} else {
    // customer logged in
    $view->expenses = get_expenses($in, $out, null, array($kga['customer']['customerID']), null, 1);
}
$view->total = Format::formatCurrency(array_reduce($view->expenses, function ($sum, $expense) {
    return $sum + $expense['multiplier'] * $expense['value'];
}, 0));
if (isset($kga['user'])) {
    // user logged in
    $ann = expenses_by_user($in, $out, array($kga['user']['userID']));
} else {
    // customer logged in
    $ann = expenses_by_user($in, $out, null, array($kga['customer']['customerID']));
}
$ann = Format::formatCurrency($ann);
$view->user_annotations = $ann;
// TODO: function for loops or convert it in template with new function
if (isset($kga['user'])) {
    // user logged in
    $ann = expenses_by_customer($in, $out, array($kga['user']['userID']));
} else {
    // customer logged in
    $ann = expenses_by_customer($in, $out, null, array($kga['customer']['customerID']));
}
$ann = Format::formatCurrency($ann);
$view->customer_annotations = $ann;
if (isset($kga['user'])) {
    // user logged in