コード例 #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
ファイル: processor.php プロジェクト: kimai/kimai
                    $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']);
        }
        // the activity based charts only need numbers
        $view->assign('arr_keys', $keys);
        echo $view->render('charts.php');
        break;
}
コード例 #3
0
ファイル: init.php プロジェクト: kimai/kimai
/**
* 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');
コード例 #4
0
ファイル: init.php プロジェクト: kimai/kimai
// ============================================
$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.
$userAnnotations = export_get_user_annotations($in, $out, $users, $customers);
Kimai_Format::formatAnnotations($userAnnotations);
コード例 #5
0
ファイル: init.php プロジェクト: kimai/kimai
    $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();
$allInvoices = glob('invoices/*');
foreach ($allInvoices as $tplFile) {
    $extension = 'HTML';
    $tplInfo = pathinfo($tplFile);
    if (!is_dir($tplFile)) {
        $extension = strtoupper($tplInfo['extension']);
    }
    $filename = str_replace('_', ' ', $tplInfo['filename']);
    $invoice_template_files[$extension][$tplInfo['basename']] = ucfirst($filename);
}
$view->assign('invoice_templates', $invoice_template_files);
// Retrieve start & stop times
$timeframe = get_timeframe();
$view->assign('start_day', date($kga->getDateFormat(3), $timeframe[0]));
$view->assign('end_day', date($kga->getDateFormat(3), $timeframe[1]));
echo $view->render('main.php');
コード例 #6
0
ファイル: init.php プロジェクト: kimai/kimai
 */
// 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) {
    $view->assign($key, $value);
}
コード例 #7
0
ファイル: floaters.php プロジェクト: kimai/kimai
     }
     $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;
         }));
     }
     $view->assign('membershipRoles', array());
     foreach ($database->membership_roles() as $role) {
         $view->membershipRoles[$role['membershipRoleID']] = $role['name'];
     }
     $view->assign('user_details', $userDetails);
     echo $view->render("floaters/edituser.php");
     break;
     // =============================
     // = Builds edit-group dialogue =
     // =============================
 // =============================
 // = Builds edit-group dialogue =
 // =============================
 case "editGroup":
     $groupDetails = $database->group_get_data($_REQUEST['id']);
     $view->assign('users', makeSelectBox('sameGroupUser', null, null, true));
     $view->assign('group_details', $groupDetails);
     echo $view->render("floaters/editgroup.php");
     break;
     // =============================
     // = Builds edit-status dialogue =
コード例 #8
0
ファイル: index.php プロジェクト: kimai/kimai
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 {
    $name = $_POST['name'];
}
if (!isset($_POST['password']) || is_array($_POST['password'])) {
    $password = '';
} else {
    $password = $_POST['password'];