コード例 #1
0
ファイル: HtmlRenderer.php プロジェクト: kimai/kimai
 /**
  * @return string
  */
 public function getHtml()
 {
     $view = new Kimai_View();
     $view->setScriptPath($this->getTemplateDir() . $this->getTemplateFile());
     // DO NOT RELY ON THESE VARIABLES - they are only here for compatibility with the ODT layer
     $view->assign('CustomerODT', $this->prepareCustomerArray($this->getModel()->getCustomer()));
     $view->assign('project', implode(', ', array_map(function ($project) {
         return $project['name'];
     }, $this->getModel()->getProjects())));
     $data = $this->getModel()->toArray();
     foreach ($data as $key => $value) {
         $view->assign($key, $value);
     }
     // can be used to reference styles and images
     $view->assign('invoiceUrl', 'invoices/' . $this->getTemplateFile() . '/');
     return $view->render($this->getTemplateFilename());
 }
コード例 #2
0
ファイル: init.php プロジェクト: kimai/kimai
<?php

/**
* This file is part of
* Kimai - Open Source Time Tracking // http://www.kimai.org
* (c) Kimai-Development-Team since 2006
*
* Kimai is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; Version 3, 29 June 2007
*
* Kimai is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Kimai; If not, see <http://www.gnu.org/licenses/>.
*/
// Include Basics
include '../../includes/basics.php';
$user = checkUser();
$view = new Kimai_View();
$view->addBasePath(__DIR__ . '/templates/');
$view->assign('delete_logfile', $kga['delete_logfile']);
$view->assign('kga_sections', array('all' => '', 'plain' => 'plain', 'lang' => 'translations', 'user' => 'user', 'conf' => 'config'));
$view->assign('limitText', sprintf($view->translate('debug:lines'), $kga['logfile_lines']));
if ($kga['logfile_lines'] == "@") {
    $view->assign('limitText', "");
}
echo $view->render('index.php');
コード例 #3
0
ファイル: init.php プロジェクト: kimai/kimai
// ============================================
// = initialize currently displayed timeframe =
// ============================================
$timeframe = get_timeframe();
$in = $timeframe[0];
$out = $timeframe[1];
$view = new Kimai_View();
$view->addBasePath(__DIR__ . '/templates/');
// prevent IE from caching the response
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$timeformat = 'H:M';
$dateformat = $kga->getDateFormat(1);
$view->assign('timeformat', $timeformat);
$view->assign('dateformat', $dateformat);
echo $view->render('panel.php');
$view->assign('timeformat', preg_replace('/([A-Za-z])/', '%$1', $timeformat));
$users = null;
$customers = null;
if (isset($kga['customer'])) {
    $customers = array($kga['customer']['customerID']);
} else {
    $users = array($kga['user']['userID']);
}
// Get the total amount of time shown in the table.
$total = Kimai_Format::formatDuration($database->get_duration($in, $out, $users, $customers, null));
$view->assign('total', $total);
$view->assign('exportData', export_get_data($in, $out, $users, $customers));
// Get the annotations for the user sub list.
コード例 #4
0
ファイル: processor.php プロジェクト: kimai/kimai
         }
         $renderProjects[] = $project;
         // filter out activities that have no relevant/zero data to be plotted
         $plotData[$temp] = array();
         foreach ($arr_plotdata[$temp] as $id => $activity) {
             $isActivity = is_array($activity) && isset($activity['name']);
             if ($isActivity && array_search($id, $activitiesSelected) === false) {
                 continue;
             }
             if ($isActivity && $activity['total'] == 0 && $activity['budget'] == 0 && $activity['budget_total'] == 0 && $activity['approved'] == 0 && $activity['approved_total'] == 0) {
                 continue;
             }
             $plotData[$temp][$id] = $arr_plotdata[$temp][$id];
         }
     }
     $view->assign('plotdata', $plotData);
     $view->assign('projects', $renderProjects);
     $view->assign('activities', $activities);
 } else {
     $view->assign('projects', array());
 }
 $view->assign('projects_selected', $projectsSelected);
 $view->assign('activities_selected', $activitiesSelected);
 $chartColors = array('#efefef', '#4bb2c5', '#EAA228', '#c5b47f', '#579575', '#839557', '#958c12', '#953579', '#4b5de4', '#d8b83f', '#ff5800', '#0085cc');
 $view->assign('chartColors', json_encode($chartColors));
 // Create the keys which explain to the user which color means what for the project based charts
 $keys = array();
 $keys[] = array('color' => $chartColors[0], 'name' => $kga['lang']['ext_budget']['unusedBudget']);
 if ($expensesOccurred) {
     $keys[] = array('color' => $chartColors[1], 'name' => $kga['lang']['export_extension']['expenses']);
 }
コード例 #5
0
ファイル: init.php プロジェクト: kimai/kimai
 *
 * Kimai is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Kimai; If not, see <http://www.gnu.org/licenses/>.
 */
include '../../includes/basics.php';
$user = checkUser();
$view = new Kimai_View();
$view->addBasePath(__DIR__ . '/templates/');
// get list of projects for select box
if (isset($kga['customer'])) {
    $view->assign('customers', array($kga['customer']['customerID'] => $kga['customer']['name']));
} else {
    $view->assign('customers', makeSelectBox("customer", $kga['user']['groups']));
}
$tmpCustomers = array_keys($view->customers);
$projects = $database->get_projects_by_customer($tmpCustomers[0], $kga['user']['groups']);
$tmpProjects = array();
foreach ($projects as $project) {
    $tmpProjects[$project['projectID']] = $project['name'];
}
$view->assign('projects', $tmpProjects);
// Select values for Round Time option
$roundingOptions = array('0' => '', '1' => '0.1h', '2.5' => '0.25h', '5' => '0.5h', '10' => '1.0h');
$view->assign('roundingOptions', $roundingOptions);
// Extract all Invoice Templates in groups
$invoice_template_files = array();
コード例 #6
0
ファイル: init.php プロジェクト: kimai/kimai
 * You should have received a copy of the GNU General Public License
 * along with Kimai; If not, see <http://www.gnu.org/licenses/>.
 */
// Include Basics
include '../../includes/basics.php';
$user = checkUser();
$view = new Kimai_View();
$view->addBasePath(__DIR__ . '/templates/');
require 'functions.php';
$viewOtherGroupsAllowed = $database->global_role_allows($kga['user']['globalRoleID'], 'core-group-otherGroup-view');
// ========================
// = display groups table =
// ========================
$groupsData = getGroupsData($database, $kga['user'], $viewOtherGroupsAllowed);
foreach ($groupsData as $key => $value) {
    $view->assign($key, $value);
}
$view->tab_groups = $view->render("groups.php");
// ==========================
// = display customer table =
// ==========================
$customersData = getCustomersData($database, $kga['user'], $viewOtherGroupsAllowed);
foreach ($customersData as $key => $value) {
    $view->assign($key, $value);
}
$view->tab_customer = $view->render("customers.php");
// =========================
// = display project table =
// =========================
$projectsData = getProjectsData($database, $kga['user'], $viewOtherGroupsAllowed);
foreach ($projectsData as $key => $value) {
コード例 #7
0
ファイル: floaters.php プロジェクト: kimai/kimai
 */
// insert KSPI
$isCoreProcessor = 0;
$dir_templates = "templates";
require '../../includes/kspi.php';
$view = new Kimai_View();
$view->addBasePath(__DIR__ . '/templates/');
require 'functions.php';
switch ($axAction) {
    // =============================
    // = Builds edit-user dialogue =
    // =============================
    case "editUser":
        $userDetails = $database->user_get_data($id);
        $userDetails['rate'] = $database->get_rate($userDetails['userID'], NULL, NULL);
        $view->assign('globalRoles', array());
        foreach ($database->global_roles() as $role) {
            $view->globalRoles[$role['globalRoleID']] = $role['name'];
        }
        $view->assign('memberships', array());
        foreach ($database->getGroupMemberships($id) as $groupId) {
            $view->memberships[$groupId] = $database->user_get_membership_role($id, $groupId);
        }
        $groups = $database->get_groups();
        if ($database->global_role_allows($kga['user']['globalRoleID'], 'core-group-otherGroup-view')) {
            $view->assign('groups', $groups);
        } else {
            $view->assign('groups', array_filter($groups, function ($group) {
                global $kga;
                return array_search($group['groupID'], $kga['user']['groups']) !== false;
            }));
コード例 #8
0
ファイル: index.php プロジェクト: kimai/kimai
 */
/**
 * Show an login window or process the login request. On success the user
 * will be redirected to core/kimai.php.
 */
ob_start();
require_once 'includes/basics.php';
$view = new Kimai_View();
$authPlugin = Kimai_Registry::getAuthenticator();
// current database setup correct?
checkDBversion(".");
// ==========================
// = installation required? =
// ==========================
if (count($database->get_users()) == 0) {
    $view->assign('devtimespan', '2006-' . date('y'));
    if (isset($_REQUEST['disagreedGPL'])) {
        $view->assign('disagreedGPL', 1);
    } else {
        $view->assign('disagreedGPL', 0);
    }
    echo $view->render('install/welcome.php');
    ob_end_flush();
    exit;
}
if (!isset($_REQUEST['a'])) {
    $_REQUEST['a'] = '';
}
if (!isset($_POST['name']) || is_array($_POST['name'])) {
    $name = '';
} else {
コード例 #9
0
ファイル: init.php プロジェクト: kimai/kimai
<?php

/**
 * This file is part of
 * Kimai - Open Source Time Tracking // http://www.kimai.org
 * (c) Kimai-Development-Team since 2006
 *
 * Kimai is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; Version 3, 29 June 2007
 *
 * Kimai is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Kimai; If not, see <http://www.gnu.org/licenses/>.
 */
include '../../includes/basics.php';
$user = checkUser();
$view = new Kimai_View();
$view->addBasePath(__DIR__ . '/templates/');
// track which activities we want to see, so we can exclude them when we create the plot
$view->assign('kga', $kga);
echo $view->render('index.php');