Ejemplo n.º 1
0
function book_days_when_free($name, $description, $user, $startdate, $days, $doit)
{
    global $CONFIG;
    $daysarray = array();
    for ($i = 0; $i < $days; $i++) {
        while (!in_array(date('w', $startdate), $CONFIG['working_days']) || count(get_users_appointments($user, $startdate, $startdate + 86400)) != 0) {
            $startdate += 86400;
        }
        if ($doit) {
            book_appointment($name, $description, $user, $startdate + $CONFIG['start_working_day'], $startdate + $CONFIG['end_working_day']);
        }
        $daysarray[] = array('name' => $name, 'description' => $description, 'user' => $user, 'startdate' => $startdate);
        $startdate += 86400;
    }
    return $daysarray;
}
// planner_schedule_getitems.php - read event tasks and output XML
//
// SiT (Support Incident Tracker) - Support call tracking system
// Copyright (C) 2000-2009 Salford Software Ltd. and Contributors
//
// This software may be used and distributed according to the terms
// of the GNU General Public License, incorporated herein by reference.
//
// Author: Tom Gerrard <tom.gerrard[at]salfordsoftware.co.uk>
$permission = 27;
// View your calendar FIXME
require '..' . DIRECTORY_SEPARATOR . 'core.php';
require APPLICATION_LIBPATH . 'functions.inc.php';
require APPLICATION_LIBPATH . 'auth.inc.php';
include 'calendar.inc.php';
foreach (array('year', 'month', 'day', 'user') as $var) {
    eval("\${$var}=cleanvar(\$_REQUEST['{$var}']);");
}
header('Content-Type: text/xml');
echo '<?xml version="1.0" ?>' . "\n";
$items = array();
$startOfWeek = mktime(0, 0, 0, $month, $day, $year);
$endOfWeek = $startOfWeek + 86400 * 7;
$items = get_users_appointments($user, $startOfWeek, $endOfWeek);
foreach ($items as $item) {
    echo "<item>\n";
    foreach ($item as $key => $value) {
        echo "  <{$key}>{$value}</{$key}>\n";
    }
    echo "</item>\n";
}
Ejemplo n.º 3
0
    include APPLICATION_INCPATH . 'htmlfooter.inc.php';
} else {
    if ($approve == '') {
        include 'calendar.inc.php';
        include APPLICATION_INCPATH . 'htmlheader.inc.php';
        echo "<h2>{$strTimesheet} - " . user_realname($user) . "</h2>";
        echo "<p align='center'>" . date($CONFIG['dateformat_date'], $date) . " - " . date($CONFIG['dateformat_date'], $date + 86400 * 6) . "</p>";
        echo "<table align='center'>";
        echo "<tr>";
        echo "<th>{$strDate}</th>";
        echo "<th>{$strActivity}</th>";
        echo "<th>{$strTotal}</th>";
        echo "</tr>";
        foreach (array($strMonday, $strTuesday, $strWednesday, $strThursday, $strFriday, $strSaturday, $strSunday) as $day) {
            $daytime = 0;
            $items = get_users_appointments($user, $date, $date + 86400);
            echo "<tr class='shade2'><th>{$day}</th>";
            echo "<td style='width: 250px;'>";
            $times = array();
            foreach ($items as $item) {
                $timediff = strtotime($item['eventEndDate']) - strtotime($item['eventStartDate']);
                $times[$item['description']] += $timediff;
                $daytime += $timediff;
            }
            ksort($times);
            $html = array();
            foreach ($times as $description => $time) {
                $html[] = "<strong>{$description}</strong>: " . format_seconds($time);
            }
            echo implode('<br />', $html);
            echo "</td>";