Ejemplo n.º 1
0
<?php

$array = array();
$time = new TimeTracker();
$time->setModuleName($options['module_name']);
$time->setModuleID($options['module_id']);
$checktime = $time->getOpenEntryId($time->getTimeEntries());
if ($checktime) {
    $array['time_tracker_id'] = $checktime;
} else {
    $id = $time->newTimeEntry($_SESSION['user_id'], $options['module_name'], $options['module_id'], date('Y-m-d H:i:s'));
    $array['time_tracker_id'] = $id;
}
<?php

require_once "includes/engine.php";
require_once "includes/models/index.php";
require_once "includes/functions/index.php";
// instantiate classes
$localvars = localvars::getInstance();
$validate = new validate();
$tracker = new TimeTracker();
// set template vars
$localvars->set('pageName', ucfirst($this->data['model']));
// see what we are trying to view
$model = $this->data['model'];
$action = $this->data['action'];
$item = $this->data['item'];
$localvars->set('pageContent', $tracker->setupForm());
?>

<div class="wrapper">
    <div class="container">
        <h2> {local var="pageName"} </h2>
        <p> Track your time. </p>

        <h3> Pick a Customer </h3>
        <select class="customerSelect"> </select>

        <div class="projectContainer hidden">
            <h3> Pick a Project </h3>
            <select class="projectSelect"> </select>
        </div>
Ejemplo n.º 3
0
function prepareTaskRow($r)
{
    $lang = Lang::instance();
    $dueA = prepare_duedate($r['duedate']);
    $formatCreatedInline = $formatCompletedInline = Config::get('dateformatshort');
    if (date('Y') != date('Y', $r['d_created'])) {
        $formatCreatedInline = Config::get('dateformat2');
    }
    if ($r['d_completed'] && date('Y') != date('Y', $r['d_completed'])) {
        $formatCompletedInline = Config::get('dateformat2');
    }
    $dCreated = timestampToDatetime($r['d_created']);
    $dCompleted = $r['d_completed'] ? timestampToDatetime($r['d_completed']) : '';
    $db = DBConnection::instance();
    $current_user_id = (int) $_SESSION['userid'];
    $notification_id = (int) $db->sq("SELECT id FROM {$db->prefix}notification_listeners WHERE type = 'list' AND value = " . $r['id'] . " AND user_id=" . $current_user_id);
    $progress = '';
    $progress_current = '';
    $progress_total = '';
    if (!empty($r['duration'])) {
        $progress = ceil(TimeTracker::getTaskTotal($r['id']) * 100 / ($r['duration'] * 60));
        $progress_current = TimeTracker::getTaskTotal($r['id']) / 60;
        $progress_total = $r['duration'];
    }
    return array('id' => $r['id'], 'title' => escapeTags($r['title']), 'listId' => $r['list_id'], 'date' => htmlarray($dCreated), 'dateInt' => (int) $r['d_created'], 'dateInline' => htmlarray(formatTime($formatCreatedInline, $r['d_created'])), 'dateInlineTitle' => htmlarray(sprintf($lang->get('taskdate_inline_created'), $dCreated)), 'dateEditedInt' => (int) $r['d_edited'], 'dateCompleted' => htmlarray($dCompleted), 'dateCompletedInline' => $r['d_completed'] ? htmlarray(formatTime($formatCompletedInline, $r['d_completed'])) : '', 'dateCompletedInlineTitle' => htmlarray(sprintf($lang->get('taskdate_inline_completed'), $dCompleted)), 'compl' => (int) $r['compl'], 'notification' => $notification_id > 0 ? 1 : 0, 'prio' => $r['prio'], 'note' => nl2br(escapeTags($r['note'])), 'noteText' => (string) $r['note'], 'ow' => (int) $r['ow'], 'tags' => htmlarray($r['tags']), 'tags_ids' => htmlarray($r['tags_ids']), 'duedate' => $dueA['formatted'], 'dueClass' => $dueA['class'], 'dueStr' => htmlarray($r['compl'] && $dueA['timestamp'] ? formatTime($formatCompletedInline, $dueA['timestamp']) : $dueA['str']), 'dueInt' => date2int($r['duedate']), 'dueTitle' => htmlarray(sprintf($lang->get('taskdate_inline_duedate'), $dueA['formatted'])), 'duration' => empty($r['duration']) ? '' : $r['duration'], 'progress' => $progress, 'progress_current' => $progress_current, 'progress_total' => $progress_total, 'comments' => getTaskComments($r['id']));
}
Ejemplo n.º 4
0
<?php

$array = array();
$time = new TimeTracker();
$time->setModuleName($options['module_name']);
$time->setModuleID($options['module_id']);
$array = array('success' => $time->setTimeEnd($options['module_name'], $options['module_id'], date('Y-m-d H:i:s')));
Ejemplo n.º 5
0
<?php

$array = array();
$time = new TimeTracker();
$time->setModuleName($options['module_name']);
$time->setModuleID($options['module_id']);
$array['entries'] = $time->getTimeEntries();
$array['open'] = $time->getOpenEntryId($array['entries']);
$array['module_name'] = $options['module_name'];
$array['module_id'] = $options['module_id'];
Ejemplo n.º 6
0
<?php

//error_reporting(E_ALL);
//ini_set('display_errors', '1');
require_once 'app_code/global.config.php';
require_once 'class/config.inc.php';
require_once 'class/class.timeTracker.php';
$timetracker = new TimeTracker();
switch ($_GET['action']) {
    case 'newTimeEntry':
        $cur_ts = time();
        $cur_time = date('Y-m-d H:i:s', $cur_ts);
        $tt_id = $timetracker->newTimeEntry($_REQUEST['user_id'], $_REQUEST['module_name'], $_REQUEST['module_id'], $cur_time);
        if ($tt_id) {
            $start_time = date('g:i', $cur_ts);
            $start_date = date('n/j', $cur_ts);
            ?>
            <tr data-id="<?php 
            echo $tt_id;
            ?>
">
                <td><?php 
            echo $start_time;
            ?>
</td>
                <td><?php 
            echo $start_date;
            ?>
</td>
                <td>--</td>
                <td><img src="images/trash_can.png" alt="delete" onclick="tt.delTimeEntry(<?php