예제 #1
0
 /**
  * Sets up initial variable values
  * @param string $userid id of the calendar user
  * @param int MyCalendarType type for this calendar
  * @param int $actualDate todays date
  */
 function MyCalendar($userid, $type = null, $actualDate = null, $load_reservations = true)
 {
     $this->userid = $userid == null ? Auth::getCurrentID() : $userid;
     $this->type = $type == null ? MYCALENDARTYPE_DAY : $type;
     $this->actualDate = $actualDate;
     $this->determine_first_date();
     $this->init_date_vars();
     if ($load_reservations) {
         $this->db = new MyCalendarDB();
         $this->load_reservations();
     }
 }
예제 #2
0
    /**
     * Print all XHTML headers
     * This function prints the HTML header code, CSS link, and JavaScript link
     *
     * DOCTYPE is XHTML 1.0 Transitional
     * @param none
     */
    function printHTMLHeader()
    {
        global $conf;
        global $languages;
        global $lang;
        global $charset;
        $path = $this->dir_path;
        echo "<?xml version=\"1.0\" encoding=\"{$charset}\"?" . ">\n";
        ?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
        echo $languages[$lang][2];
        ?>
" lang="<?php 
        echo $languages[$lang][2];
        ?>
">
	<head>
	<title> Room Reservation System
	
	</title>
	<meta http-equiv="Content-Type" content="text/html; charset=<?php 
        echo $charset;
        ?>
" />
	<?php 
        if ((bool) $conf['app']['allowRss'] && Auth::is_logged_in()) {
            echo '<link rel="alternate" type="application/rss+xml" title="phpScheduleIt" href=" ' . CmnFns::getScriptURL() . '/rss.php?id=' . Auth::getCurrentID() . "\"/>\n";
        }
        ?>
	<link rel="shortcut icon" href="favicon.ico"/>
	<link rel="icon" href="favicon.ico"/>

	<style type="text/css">
	@import url(<?php 
        echo $path;
        ?>
jscalendar/calendar-blue-custom.css);
	@import url(<?php 
        echo $path;
        ?>
css.css);
	</style>

	</head>
	<body>
	<?php 
    }
예제 #3
0
 /**
  * Sets up initial variable values
  * @param constant $scheduleType type of schedule to print out
  */
 function Schedule($scheduleid, $scheduleType = ALL)
 {
     $this->scheduleid = $scheduleid;
     $this->scheduleType = $scheduleType;
     // Set schedule type
     $this->db = new ScheduleDB($scheduleid, $scheduleType);
     // Set database class
     if ($scheduleid == null) {
         $this->scheduleid = $this->db->get_default_id();
         $this->db->scheduleid = $this->scheduleid;
     }
     $this->isValid = $this->db->check_scheduleid($this->scheduleid);
     //	echo $_POST['startTime'] . ' ' . $_POST['reservationHours']. ' RAZA' ;
     if ($this->isValid) {
         $data = $this->db->get_schedule_data($this->scheduleid);
         $this->viewdays = $data['viewdays'];
         $this->startDay = $_POST['startTime'] - 60;
         $this->endDay = $this->startDay + 60;
         $this->timespan = $data['timespan'];
         $this->weekdaystart = $data['weekdaystart'];
         $this->showsummary = $data['showsummary'];
         $this->title = $data['scheduletitle'];
         $this->admin = $data['adminemail'];
         //	    echo $this->viewdays . ' ' .  $this->startDay . ' ' .  $this->endDay . ' ' .  $this->timespan . ' ' . $this->weekdaystart;
         if ($scheduleType == READ_ONLY) {
             $this->user = new User();
         } else {
             $this->user = new User(Auth::getCurrentID());
             // Set User class
         }
         $this->_date = $this->get_date_vars();
         // Get all date info we need
         $this->machids = $this->db->get_mach_ids($this->scheduleid);
         // Get all resource info
         $machids = array();
         if ($this->machids !== false) {
             foreach ($this->machids as $mach) {
                 $machids[] = $mach['machid'];
             }
         }
         $this->res = $this->db->get_all_res($this->_date['firstDayTs'], $this->_date['lastDayTs'], $machids, $this->user->get_id());
     }
 }
예제 #4
0
파일: ical.php 프로젝트: razagilani/srrs
function getResults()
{
    $search = new ReservationSearch(new ReservationSearchDB());
    $results = array();
    if (isset($_GET['resid'])) {
        $results = $search->getReservation(htmlspecialchars($_GET['resid']));
    } else {
        $start = null;
        $end = null;
        $userid = Auth::getCurrentID();
        if (isset($_GET['start_date']) && !empty($_GET['start_date'])) {
            $start_date = htmlspecialchars($_GET['start_date']);
            $dates = explode(INTERNAL_DATE_SEPERATOR, $start_date);
            $start = mktime(0, 0, 0, $dates[0], $dates[1], $dates[2]);
        }
        if (isset($_GET['end_date']) && !empty($_GET['end_date'])) {
            $end_date = htmlspecialchars($_GET['end_date']);
            $dates = explode(INTERNAL_DATE_SEPERATOR, $end_date);
            $end = mktime(0, 0, 0, $dates[0], $dates[1], $dates[2]);
        }
        $results = $search->getReservations($userid, $start, $end);
    }
    return $results;
}
예제 #5
0
파일: ctrlpnl.php 프로젝트: razagilani/srrs
$t->printWelcome();
$t->startMain();
$user = new User(Auth::getCurrentID());
$is_group_admin = $user->is_group_admin();
$t->startNavLinkTable();
$t->showNavLinksTable(Auth::isAdmin());
$t->endNavLinkTable();
$t->splitTable();
$order = array('number');
$announcements = $db->get_announcements(mktime());
if ($announcements) {
    showAnnouncementTable($announcements, $db->get_err());
    printCpanelBr();
}
// Valid order values in reservation retreival
$order = array('start_date', 'name', 'starttime', 'endtime', 'created', 'modified');
$res = $db->get_user_reservations(Auth::getCurrentID(), CmnFns::get_value_order($order), CmnFns::get_vert_order());
showReservationTable($res, $db->get_err());
// Print out My Reservations
printCpanelBr();
// AK: Invitations are not used in our case.
//showInvitesTable($db->get_user_invitations(Auth::getCurrentID(), true), $db->get_err());
//printCpanelBr();
//showParticipatingTable($db->get_user_invitations(Auth::getCurrentID(), false), $db->get_err());
//printCpanelBr();
if ($conf['app']['use_perms']) {
    showTrainingTable($db->get_user_permissions(Auth::getCurrentID()), $db->get_err());
}
endDataDisplayCol();
$t->endMain();
$t->printHTMLFooter();
예제 #6
0
 /**
  * Prints out the reservation table
  * @param none
  */
 function print_res()
 {
     global $conf;
     $is_private = $conf['app']['privacyMode'] && !$this->adminMode;
     $day_has_passed = !$this->check_startdate();
     if (!$this->adminMode && !$this->is_blackout && $day_has_passed) {
         $this->type = RES_TYPE_VIEW;
     }
     if (Auth::getCurrentID() != $this->user->get_id() && !$this->adminMode) {
         $this->type = RES_TYPE_VIEW;
     }
     $rs = $this->resource->properties;
     if ($this->type == RES_TYPE_ADD && $rs['approval'] == 1 && !Auth::IsAdmin()) {
         $this->is_pending = true;
         // On the initial add, make sure that the is_pending flag is correct
     }
     $is_owner = ($this->user->get_id() == Auth::getCurrentID() || $this->adminMode) && $this->type != RES_TYPE_VIEW;
     print_title($rs['name']);
     begin_reserve_form($this->type == RES_TYPE_ADD, $this->is_blackout);
     begin_container();
     if (empty($this->start)) {
         $this->start = $this->sched['daystart'];
         $this->end = $this->start + $this->sched['timespan'];
     }
     print_basic_panel($this, $rs, $is_private && !$is_owner);
     // Contains resource/user info, time select, summary, repeat boxes
     if ($this->is_blackout || $is_private) {
         print_users_panel($this, array(), null, '', false, false);
         // No advanced for either case
     } else {
         $this->user->get_id();
         $all_users = $is_owner ? $this->db->get_non_participating_users($this->id, Auth::getCurrentID()) : array();
         print_users_panel($this, $all_users, $is_owner, $rs['max_participants'], true, $day_has_passed);
     }
     if ($this->is_blackout) {
         print_additional_tab($this, array(), false, false);
     } else {
         $all_resources = $is_owner ? $this->db->get_non_participating_resources($this->id) : array();
         print_additional_tab($this, $all_resources, $is_owner, true);
     }
     end_container();
     print_buttons_and_hidden($this);
     end_reserve_form();
     print_jscalendar_setup($this, $rs);
     if ((bool) $this->allow_anon_participation || (bool) $this->allow_participation) {
         print_join_form_tags();
     }
 }
예제 #7
0
/**
* Provides interface for making all administrative database changes
* @author Nick Korbel <*****@*****.**>
* @author David Poole <*****@*****.**>
* @version 05-07-06
* @package Admin
*
* Copyright (C) 2003 - 2007 phpScheduleIt
* License: GPL, see LICENSE
*/
include_once 'lib/Template.class.php';
include_once 'lib/Admin.class.php';
include_once 'lib/User.class.php';
$fn = isset($_POST['fn']) ? $_POST['fn'] : (isset($_GET['fn']) ? $_GET['fn'] : '');
// Set function
$user = new User(Auth::getCurrentID());
if (!validate_function($user, $fn)) {
    CmnFns::do_error_box(translate('This is only accessable to the administrator') . '<br />' . '<a href="ctrlpnl.php">' . translate('Back to My Control Panel') . '</a>');
}
$db = new AdminDB();
$tools = array('deleteUsers' => 'del_users', 'addResource' => 'add_resource', 'editResource' => 'edit_resource', 'delResource' => 'del_resource', 'togResource' => 'tog_resource', 'editPerms' => 'edit_perms', 'resetPass' => 'reset_password', 'addSchedule' => 'add_schedule', 'editSchedule' => 'edit_schedule', 'delSchedule' => 'del_schedule', 'dfltSchedule' => 'set_default_schedule', 'addAnnouncement' => 'add_announcement', 'editAnnouncement' => 'edit_announcement', 'delAnnouncement' => 'del_announcement', 'delFloorPlan' => 'del_floorplan', 'adminToggle' => 'toggle_admin', 'lockToggle' => 'toggle_lock', 'addAdditionalResource' => 'add_additional_resource', 'editAdditionalResource' => 'edit_additional_resource', 'delAddResource' => 'del_additional_resource', 'addGroup' => 'add_group', 'editGroup' => 'edit_group', 'delGroup' => 'del_group');
if (!isset($tools[$fn]) && !isset($tools[$fn])) {
    // Validate tool
    CmnFns::do_error_box(translate('Could not determine tool') . '<br/><a href="ctrlpnl.php">' . translate('Back to My Control Panel') . '</a>');
    die;
} else {
    if (isset($tools[$fn])) {
        eval($tools[$fn] . '();');
    }
}
/**
예제 #8
0
include_once 'lib/ResCalendar.class.php';
// Check that the user is logged in
if (!Auth::is_logged_in()) {
    Auth::print_login_msg();
}
$t = new Template(translate('Resource Calendar'));
// Print HTML headers
$t->printHTMLHeader();
// Print welcome box
$t->printWelcome();
// Begin main table
$t->startMain();
$type = isset($_GET['view']) ? $_GET['view'] : MYCALENDARTYPE_DAY;
$machid = isset($_GET['machid']) ? $_GET['machid'] : null;
$scheduleid = isset($_GET['scheduleid']) ? $_GET['scheduleid'] : null;
$calendar = new ResCalendar(Auth::getCurrentID(), $type, get_calendar_actual_date(), $machid, $scheduleid);
$calendar->print_calendar();
// End main table
$t->endMain();
list($e_sec, $e_msec) = explode(' ', microtime());
// End execution timer
$tot = (double) $e_sec + (double) $e_msec - ((double) $s_sec + (double) $s_msec);
echo '<!--Schedule printout time: ' . sprintf('%.16f', $tot) . ' seconds-->';
// Print HTML footer
$t->printHTMLFooter();
/**
* Sets the 'actualDate' field of the MyCalendar object
* @param none
* @return datestamp of the viewed date
*/
function get_calendar_actual_date()
예제 #9
0
if (!Auth::is_logged_in()) {
    Auth::print_login_msg();
}
$t = new Template(translate('My Calendar'));
// Print HTML headers
$t->printHTMLHeader();
// Print welcome box
$t->printWelcome();
// Begin main table
$t->startMain();
$t->startNavLinkTable();
$t->showNavLinksTable(Auth::isAdmin());
$t->endNavLinkTable();
$t->splitTable();
$type = isset($_GET['view']) ? $_GET['view'] : MYCALENDARTYPE_DAY;
$calendar = new MyCalendar(Auth::getCurrentID(), $type, get_calendar_actual_date());
$calendar->print_calendar();
// End main table
$t->endMain();
$timer->stop();
$timer->print_comment();
// Print HTML footer
$t->printHTMLFooter();
/**
* Sets the 'actualDate' field of the MyCalendar object
* @param none
* @return datestamp of the viewed date
*/
function get_calendar_actual_date()
{
    if (isset($_GET['date'])) {
예제 #10
0
/**
* Prints out reservation info depending on what parameters
*  were passed in through the query string
* @param none
*/
function present_reservation($resid)
{
    global $Class;
    // Get info about this reservation
    $res = new $Class($resid, false, false, $_GET['scheduleid']);
    // Load the properties
    if ($resid == null) {
        $res->resource = new Resource($_GET['machid']);
        $res->start_date = $_GET['start_date'];
        $res->end_date = $_GET['start_date'];
        $res->user = new User(Auth::getCurrentID());
        $res->is_pending = $_GET['pending'];
        $res->start = $_GET['starttime'];
        $res->end = $_GET['endtime'];
    }
    $cur_user = new User(Auth::getCurrentID());
    $res->adminMode = Auth::isAdmin() || $cur_user->get_isadmin() || $cur_user->is_group_admin($res->user->get_groupids());
    if (Auth::isAdmin() || $cur_user->get_isadmin()) {
        $res->is_pending = false;
    }
    $res->set_type($_GET['type']);
    $res->print_res();
}
예제 #11
0
파일: admin.php 프로젝트: razagilani/srrs
<?php

/**
* This file provides the interface for all administrative tasks
* No data manipulation is done in this file
* @author Nick Korbel <*****@*****.**>
* @version 02-23-06
* @package Admin
*
* Copyright (C) 2003 - 2007 phpScheduleIt
* License: GPL, see LICENSE
*/
include_once 'lib/Template.class.php';
include_once 'lib/Admin.class.php';
$admin = new Admin(trim($_GET['tool']));
$admin->user = new User(Auth::getCurrentID());
if (!$admin->user->get_isadmin()) {
    $admin->user->is_admin = Auth::isAdmin();
}
$t = new Template(translate('System Administration'));
$t->printHTMLHeader();
// Make sure this is the admin
if (!$admin->isUserAllowed()) {
    CmnFns::do_error_box(translate('This is only accessable to the administrator') . '<br />' . '<a href="ctrlpnl.php">' . translate('Back to My Control Panel') . '</a>');
}
$t->printWelcome();
$t->startMain();
$t->startNavLinkTable();
$t->showNavLinksTable(Auth::isAdmin());
$t->endNavLinkTable();
$t->splitTable();
예제 #12
0
*
* Copyright (C) 2003 - 2007 phpScheduleIt
* License: GPL, see LICENSE
*/
include_once 'lib/Template.class.php';
include_once 'lib/Group.class.php';
include_once 'lib/User.class.php';
include_once 'lib/Utility.class.php';
include_once 'templates/usergroup.template.php';
$t = new Template(translate('Manage Groups'));
$t->printHTMLHeader();
$t->startMain();
if (!isset($_POST['submit'])) {
    $user = new User($_GET['memberid']);
    $cur_user = new User();
    $cur_user->userid = Auth::getCurrentID();
    if (!Auth::isAdmin() && !$cur_user->is_group_admin($user->get_groupids())) {
        CmnFns::do_error_box(translate('This is only accessable to the administrator'));
        die;
    }
    print_edit((bool) $_GET['edit'] && Auth::isAdmin(), $user);
} else {
    if (!Auth::isAdmin()) {
        CmnFns::do_error_box(translate('This is only accessable to the administrator'));
        die;
    }
    $to_add = isset($_POST['add_groups']) ? $_POST['add_groups'] : array();
    update_groups($_POST['memberid'], $to_add);
}
$t->endMain();
$t->printHTMLFooter();
예제 #13
0
/**
* Prints all the buttons and hidden fields
* @param object $res Reservation object to work with
*/
function print_buttons_and_hidden(&$res)
{
    ?>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr>
    <td>
<?php 
    $is_owner = $res->user->get_id() == Auth::getCurrentID();
    $type = $res->get_type();
    // Print buttons depending on type
    echo '<p>';
    switch ($type) {
        case RES_TYPE_MODIFY:
            echo '<input type="submit" name="btnSubmit" value="' . translate('Save') . '" class="button" onclick="selectAllOptions(this);"/>' . '<input type="hidden" name="fn" value="modify" />';
            break;
        case RES_TYPE_DELETE:
            echo '<input type="submit" name="btnSubmit" value="' . translate('Delete') . '" class="button" />' . '<input type="hidden" name="fn" value="delete" />';
            break;
        case RES_TYPE_VIEW:
            echo '<input type="button" name="close" value="' . translate('Close Window') . '" class="button" onclick="window.close();" />';
            break;
        case RES_TYPE_ADD:
            echo '<input type="submit" name="btnSubmit" value="' . translate('Save') . '" class="button" onclick="selectAllOptions(this);"/>' . '<input type="hidden" name="fn" value="create" />';
            break;
        case RES_TYPE_APPROVE:
            echo '<input type="submit" name="btnSubmit" value="' . translate('Approve') . '" class="button"/>' . '<input type="hidden" name="fn" value="approve" />';
    }
    // Print cancel button as long as type is not "view"
    if ($type != RES_TYPE_VIEW) {
        echo '&nbsp;&nbsp;&nbsp;<input type="button" name="close" value="' . translate('Cancel') . '" class="button" onclick="window.close();" />';
    }
    if ($type != RES_TYPE_ADD && $is_owner) {
        // echo '&nbsp;&nbsp;';
        // print_export_button($res->id);
    }
    echo '</p>';
    if ($type == RES_TYPE_ADD || $type == RES_TYPE_MODIFY) {
        echo '</td><td align="right"><button type="button" name="check" value="' . translate('Check Availability') . '" class="button" onclick="checkReservation(\'check.php\', \'reserve\', \'' . translate('Checking') . '\');">' . translate('Check Availability') . '</button></td><td>';
    }
    // print hidden fields
    if ($res->get_type() == RES_TYPE_ADD) {
        echo '<input type="hidden" name="machid" value="' . $res->get_machid() . '" />' . "\n" . '<input type="hidden" name="scheduleid" value="' . $res->sched['scheduleid'] . '" />' . "\n" . '<input type="hidden" name="pending" value="' . $res->get_pending() . '" />' . "\n" . '<input type="hidden" name="memberid" value="' . Auth::getCurrentID() . '" />' . "\n";
    } else {
        echo '<input type="hidden" name="resid" id="resid" value="' . $res->get_id() . '" />' . "\n" . '<input type="hidden" name="memberid" value="' . $res->get_memberid() . '" />' . "\n";
    }
    ?>
    </td>
  </tr>
  <?php 
    if ($type == RES_TYPE_ADD || $type == RES_TYPE_MODIFY) {
        echo '<tr><td colspan="2"><div id="checkDiv" style="display:none;width:100%;padding-top:15px;"></div></td></tr>';
    }
    ?>
</table>
<?php 
}