예제 #1
0
 /**
  * Get associative array of available times and rowspans
  * This function computes and returns an associative array
  * containing a timezone adjusted time value and it's rowspan value as
  * $array[time] => rowspan
  * @param none
  * @return array of time value and it's associated rowspan value
  * @global $conf
  */
 function get_time_array()
 {
     global $conf;
     $startDay = $startingTime = $this->startDay;
     $endDay = $endingTime = $this->endDay;
     $interval = $this->timespan;
     $timeHash = array();
     // Compute the available times
     $prevTime = $startDay;
     if ($startDay % 60 != 0 && $interval < 60) {
         $time = Time::formatTime($startDay);
         $timeHash[$time] = intval((60 - $startDay % 60) / $interval);
         $prevTime += $interval * $timeHash[$time];
     }
     while ($prevTime < $endingTime) {
         if ($interval < 60) {
             $time = Time::formatTime($prevTime);
             $timeHash[$time] = intval(60 / $interval);
             $prevTime += 60;
             // Always increment by 1 hour
         } else {
             $colspan = 1;
             // Colspan is always 1
             $time = Time::formatTime($prevTime);
             $timeHash[$time] = $colspan;
             $prevTime += $interval;
         }
     }
     return $timeHash;
 }
예제 #2
0
 function _buildBody($reminder)
 {
     return translate_email('Reminder Body', $reminder->resource_name, Time::formatDate($reminder->start_date), Time::formatTime($reminder->start_time), Time::formatDate($reminder->end_date), Time::formatTime($reminder->end_time));
 }
예제 #3
0
 /**
  * Send an email informing the users they have been dropped from the reservation
  * @param array $emails array of email addresses
  * @param array $dates that have been dropped
  */
 function remove_users_email($emails, $dates)
 {
     global $conf;
     $mailer = new PHPMailer();
     $mailer->From = $this->user->get_email();
     $mailer->FromName = $this->user->get_name();
     $mailer->Subject = $conf['app']['title'] . ' ' . translate('Reservation Participation Change');
     $mailer->IsHTML(false);
     $url = CmnFns::getScriptURL();
     // Format dates
     $start_date = Time::formatDate($this->start_date);
     $end_date = Time::formatDate($this->end_date);
     $start = Time::formatTime($this->get_start());
     $end = Time::formatTime($this->get_end());
     $dates_text = '';
     for ($d = 1; $d < count($dates); $d++) {
         $dates_text .= Time::formatDate($dates) . ",";
     }
     foreach ($emails as $email) {
         $mailer->ClearAllRecipients();
         $mailer->AddAddress($email);
         $mailer->Body = translate_email('reservation_removal', $this->resource->properties['name'], $start_date, $start, $end_date, $end, $this->summary, $dates_text);
         $mailer->Send();
     }
 }
예제 #4
0
/**
* Interface for managing reservations
* Provide a table to allow admin to modify or delete reservations
* @param Object $pager pager object
* @param mixed $res reservation data
* @param string $err last database error
*/
function print_manage_reservations(&$pager, $res, $err)
{
    global $link;
    $util = new Utility();
    ?>
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
  <tr>
    <td class="tableBorder">
      <table width="100%" border="0" cellspacing="1" cellpadding="0">
        <tr>
          <td colspan="9" class="tableTitle">&#8250; <?php 
    echo translate('User Reservations');
    ?>
</td>
        </tr>
		<?php 
    echo "\r\n        <tr class=\"rowHeaders\">\r\n          <td width=\"10%\">" . $link->getLink($_SERVER['PHP_SELF'] . $util->getSortingUrl($_SERVER['QUERY_STRING'], 'start_date'), translate('Start Date')) . "</td>\r\n\t\t  <td width=\"10%\">" . $link->getLink($_SERVER['PHP_SELF'] . $util->getSortingUrl($_SERVER['QUERY_STRING'], 'end_date'), translate('End Date')) . "</td>\r\n          <td width=\"20%\">" . $link->getLink($_SERVER['PHP_SELF'] . $util->getSortingUrl($_SERVER['QUERY_STRING'], 'lname'), translate('User')) . "</td>\r\n          <td width=\"19%\">" . $link->getLink($_SERVER['PHP_SELF'] . $util->getSortingUrl($_SERVER['QUERY_STRING'], 'name'), translate('Resource Name')) . "</td>\r\n          <td width=\"10%\">" . $link->getLink($_SERVER['PHP_SELF'] . $util->getSortingUrl($_SERVER['QUERY_STRING'], 'starttime'), translate('Start Time')) . "</td>\r\n          <td width=\"10%\">" . $link->getLink($_SERVER['PHP_SELF'] . $util->getSortingUrl($_SERVER['QUERY_STRING'], 'endtime'), translate('End Time')) . "</td>\r\n          <td width=\"7%\">" . translate('View') . "</td>\r\n          <td width=\"7%\">" . translate('Modify') . "</td>\r\n          <td width=\"7%\">" . translate('Delete') . "</td>\r\n        </tr>";
    // Write message if they have no reservations
    if (!$res) {
        echo '<tr class="cellColor"><td colspan="9" align="center">' . $err . '</td></tr>';
    }
    // For each reservation, clean up the date/time and print it
    for ($i = 0; is_array($res) && $i < count($res); $i++) {
        $cur = $res[$i];
        $fname = $cur['fname'];
        $lname = $cur['lname'];
        echo "<tr class=\"cellColor" . $i % 2 . "\" align=\"center\">\n" . '<td>' . Time::formatDate($cur['start_date']) . '</td>' . '<td>' . Time::formatDate($cur['end_date']) . '</td>' . '<td style="text-align:left">' . $link->getLink("javascript: viewUser('" . $cur['memberid'] . "');", $fname . ' ' . $lname, '', '', translate('View information about', array($fname, $lname))) . "</td>" . '<td style="text-align:left">' . $cur['name'] . "</td>" . '<td>' . Time::formatTime($cur['starttime']) . '</td>' . '<td>' . Time::formatTime($cur['endtime']) . '</td>' . '<td>' . $link->getLink("javascript: reserve('v','','','" . $cur['resid'] . "');", translate('View')) . '</td>' . '<td>' . $link->getlink("javascript: reserve('m','','','" . $cur['resid'] . "');", translate('Modify')) . '</td>' . '<td>' . $link->getLink("javascript: reserve('d','','','" . $cur['resid'] . "');", translate('Delete')) . '</td>' . "</tr>\n";
    }
    ?>
      </table>
    </td>
  </tr>
</table>
<br />
<?php 
}
예제 #5
0
/**
* Builds the reservation details div and makes sure it is clean data
* @param array $res array of resrevation data
* @return formatted HTML string for the content of the div
*/
function build_reservation_detail_div($res)
{
    $html = '';
    $html .= translate_date('general_date', $res['start_date']) . ' ' . Time::formatTime($res['starttime']) . ' -<br/>';
    $html .= translate_date('general_date', $res['end_date']) . ' ' . Time::formatTime($res['endtime']) . '<br/><br/>';
    $html .= $res['name'] . ' @ ' . $res['location'] . '<br/>';
    $html .= $res['fname'] . ' ' . $res['lname'] . '<br/>';
    if (!empty($res['summary'])) {
        $html .= '<br/><br/><i>' . preg_replace("/[\n\r]+/", '<br/>', addslashes($res['summary'])) . '</i>';
    }
    return $html;
}
예제 #6
0
파일: usage.php 프로젝트: razagilani/srrs
/**
* Perform search and print out results
* This function will perform the search for given
* criteria and print out formatted results.
* @param string $type output type
* @global $_POST['memberid'] array array of memberid's
* @global $_POST['piid'] array array of piID's
* @global $_POST['machid'] array array of machID's
* @global $_POST['startYear'] int starting year
* @global $_POST['startMonth'] int starting month
* @global $_POST['startDay'] int starting day
* @global $_POST['endYear'] int ending year
* @global $_POST['endMonth'] int ending month
* @global $_POST['endDay'] int ending day
* @global $_POST['starttime'] double starting time
* @global $_POST['endtime'] double ending time
*/
function search($type, $searchtype)
{
    global $db;
    global $link;
    $html = $type == 'html';
    // Store form vars for easy access
    $scheduleids = $_POST['scheduleid'];
    // Array of scheduleids
    $memberids = $_POST['memberid'];
    // Array of memberID's
    $machids = $_POST['machid'];
    // Array of machID's
    $startDateMin = mktime(0, 0, 0, intval($_POST['startMonthMin']), intval($_POST['startDayMin']), intval($_POST['startYearMin']));
    $startDateMax = mktime(0, 0, 0, intval($_POST['startMonthMax']), intval($_POST['startDayMax']), intval($_POST['startYearMax']));
    $endDateMin = mktime(0, 0, 0, intval($_POST['endMonthMin']), intval($_POST['endDayMin']), intval($_POST['endYearMin']));
    $endDateMax = mktime(0, 0, 0, intval($_POST['endMonthMax']), intval($_POST['endDayMax']), intval($_POST['endYearMax']));
    $starttimeMin = intval($_POST['starttimeMin']);
    $starttimeMax = intval($_POST['starttimeMax']);
    $endtimeMin = intval($_POST['endtimeMin']);
    $endtimeMax = intval($_POST['endtimeMax']);
    $percent = 0;
    $summarysearch = $_POST['summarysearch'];
    $summarytype = $_POST['summarytype'];
    //die($startDateMin . ' ' . $startDateMax . ' ' . $endDateMin . ' ' . $endDateMax);
    $res = $db->get_reservations($scheduleids, $memberids, $machids, $startDateMin, $startDateMax, $endDateMin, $endDateMax, $starttimeMin, $starttimeMax, $endtimeMin, $endtimeMax, $summarysearch, $summarytype);
    $rs_hours = $db->get_resource_times($machids);
    // Number of records returned
    $recs = count($res);
    // Print number of results found and a link to the text version
    echo '<h3 align="center">' . translate('Search Results found', array($recs)) . "</h3>\n" . '<h5 align="center">' . $link->getLink($_SERVER['PHP_SELF'], translate('Try a different search')) . "</h5>\n";
    print_change_output($_POST);
    echo "<hr noshade size=\"1\">\n";
    // If there were no results found, exit
    if ($recs <= 0) {
        return;
    }
    // Set up initial booleans
    $newUser = false;
    $newMach = false;
    $totalHours = 0;
    $resNo = 1;
    // Get first row
    $rs = $res[0];
    // Set up initial previous user/machine variables
    $prevUser = $rs['memberid'];
    $prevMach = $rs['machid'];
    /* Text file variables */
    // Create text output
    // Make global to share with other functions
    if ($type == 'text') {
        $GLOBALS['dblStr'] = str_repeat('=', 50) . "\n";
        $GLOBALS['sglStr'] = str_repeat('-', 50) . "\n";
    }
    if ($type != 'html') {
        // Plain-text view
        echo '<pre>';
        echo translate('Search Run On') . ' ' . date('M jS, Y - h:i:s a') . "\r\n\r\n";
    }
    // Print out first table with this information
    printUserInfo($rs['fname'], $rs['lname'], $rs['memberid'], $type);
    printTableHeader($rs['fname'], $rs['lname'], $rs['name'], $type, $rs['scheduletitle']);
    if ($type == 'csv') {
        // Print record id line for csv output
        print_csv_header();
    }
    // Repeat for each record
    for ($i = 0; $i < count($res); $i++) {
        $rs = $res[$i];
        // Current reservation
        // If we are at a new user, set them to prevUser
        if ($prevUser != $rs['memberid']) {
            $prevUser = $rs['memberid'];
            $newUser = true;
        }
        // If we are at a new resource, set it to prevMach
        if ($prevMach != $rs['machid']) {
            $prevMach = $rs['machid'];
            $newMach = true;
        }
        // If we are making a new table (by advancing to new user or resource)
        if ($newUser || $newMach) {
            // Write total hours row and close table
            // Write out total hours for this machine
            printTableFooter($totalHours, $type, $percent);
            $totalHours = 0;
            // Reset total hours
            $resNo = 1;
            // Reset total reservations
            // If it is a new user, write a comment, a extra break, and the user info
            if ($newUser) {
                // Write extra break to text output
                if ($type == 'text') {
                    echo "\r\n\r\n";
                }
                if ($html) {
                    echo '<p>&nbsp</p>';
                }
                printUserInfo($rs['fname'], $rs['lname'], $rs['memberid'], $type);
            }
            // Set both newUser and newResource to false
            $newUser = false;
            $newMach = false;
            // Write next table header
            printTableHeader($rs['fname'], $rs['lname'], $rs['name'], $type, $rs['scheduletitle']);
        }
        // Keep running total of hours on this machine
        $totalHours = $totalHours + ($rs['end_date'] / 60 + $rs['endtime'] - ($rs['start_date'] / 60 + $rs['starttime']));
        // Calculate what percentage that is of total machine time
        $percent = sprintf('%.02f', $totalHours / $rs_hours[$rs['machid']] * 100);
        // Store variables
        $start_date = Time::formatDate($rs['start_date'], null, false);
        $end_date = Time::formatDate($rs['end_date'], null, false);
        $created = Time::formatDateTime($rs['created'], null, false);
        $modified = !empty($rs['modified']) ? Time::formatDateTime($rs['modified'], null, false) : translate('N/A');
        $starttime = Time::formatTime($rs['starttime'], false);
        $endtime = Time::formatTime($rs['endtime'], false);
        $totTime = $rs['end_date'] / 60 + $rs['endtime'] - ($rs['start_date'] / 60 + $rs['starttime']);
        print_reservation_data($type, $link, $resNo++, $start_date, $end_date, $created, $modified, $starttime, $endtime, $totTime, $rs['resid'], $rs['fname'], $rs['lname'], $rs['name'], $rs['memberid'], $rs['scheduletitle']);
    }
    unset($rs);
    // On last record, print out total hours
    // Write out total hours for this machine
    printTableFooter($totalHours, $type, $percent);
    if (!$html) {
        echo '</pre>';
    }
}
예제 #7
0
/**
* Prints all reservations for a given day
* @param array $reservations array of all reservation data for this day
* @param int $datestamp the unix datestamp for the first day shown
* @param int $days number of days to print out
* @param int $start_time starting time of the day for this reservation's schedule
* @param int $end_time ending time of the day for this reservation's schedule
* @param int $time_span the time span interval for this reservation's schedule
* @param string $resource_name the name of this resource
* @param bool $is_private if we are in privacy mode and should hide user details
*/
function print_signup_sheet($reservations, $datestamp, $days, $start_time, $end_time, $time_span, $resource_name, $is_private = false)
{
    echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"background-color:#ffffff;\">\n<table border=\"1\" bordercolor=\"#000000\" width=\"100%\" cellspacing=\"1\" cellpadding=\"3\">\n";
    $date_vars = getdate($datestamp);
    $col_width = intval(100 / $days);
    $hour_line = array();
    $date_cells_taken = array();
    $datestamps = array();
    // This will store the datestamp for each date on the calendar
    // Print out a date header for each date in the calendar view
    echo '<tr><td>&nbsp;</td>';
    for ($day_count = 0; $day_count < $days; $day_count++) {
        $datestamps[$day_count] = mktime(0, 0, 0, $date_vars['mon'], $date_vars['mday'] + $day_count, $date_vars['year']);
        echo '<td width="' . $col_width . '%" align="center"><b>' . $resource_name . '</b><br/>' . translate_date('schedule_daily', $datestamps[$day_count]) . '</td>';
    }
    echo "</tr>\n";
    for ($i = 0; $i < count($reservations); $i++) {
        $reservations[$i]['starttime'] = Time::getAdjustedMinutes($reservations[$i]['starttime']);
        $reservations[$i]['endtime'] = Time::getAdjustedMinutes($reservations[$i]['endtime']);
        // If the reservation starts on a day other than the first day shown then just show it at the start time of the first day
        $day = $reservations[$i]['start_date'] >= $datestamp ? ($reservations[$i]['start_date'] - $datestamp) / SECONDS_IN_DAY : 0;
        // This will tell how many days ahead of the first day this reservation occurs
        // If the reseravtion ends on a day further from the last day shown, then make the endday equal to the last day
        $endday = $reservations[$i]['end_date'] <= $datestamps[$days - 1] ? ($reservations[$i]['end_date'] - $datestamp) / SECONDS_IN_DAY : $days - 1;
        // This will tell how many days ahead of the first day this reservation occurs
        // Get temporary start and end times for dates that are off the viewable days
        $starttime = $reservations[$i]['start_date'] >= $datestamp ? $reservations[$i]['starttime'] : $start_time;
        $endtime = $reservations[$i]['end_date'] <= $datestamps[$days - 1] ? $reservations[$i]['endtime'] : $end_time;
        $hour_line[$starttime][$day] =& $reservations[$i];
        // If this is a multi day reservation, make sure we populate the $hour_line of the last day/time for this reservation
        if ($day != $endday) {
            for ($d = $day + 1; $d <= $endday; $d++) {
                $hour_line[$start_time][$d] =& $reservations[$i];
            }
        }
        // Keep an array of the cells that are taken by the rowspan of another reservation
        if ($day != $endday) {
            // MULTIDAY
            for ($d = $day; $d <= $endday; $d++) {
                if ($d == $day) {
                    for ($time = $starttime; $time < $end_time; $time += $time_span) {
                        $date_cells_taken[$d][$time] = 1;
                    }
                } else {
                    if ($d == $endday) {
                        for ($time = $start_time; $time < $endtime; $time += $time_span) {
                            $date_cells_taken[$d][$time] = 1;
                        }
                    } else {
                        for ($time = $start_time; $time < $end_time; $time += $time_span) {
                            $date_cells_taken[$d][$time] = 1;
                        }
                    }
                }
            }
        } else {
            // SINGLE DAY
            for ($time = $starttime; $time < $endtime; $time += $time_span) {
                $date_cells_taken[$day][$time] = 1;
            }
        }
    }
    // The reservation data is stored in a 2D array of time (x axis) and date (y axis)
    // This simply loops through all time/date possibilities and prints out the reservation data for each cell
    for ($time = $start_time; $time < $end_time; $time += $time_span) {
        echo '<tr><td valign="top">' . Time::formatTime($time, false) . '</td>';
        for ($date = 0; $date < $days; $date++) {
            if (isset($hour_line[$time][$date])) {
                $res = $hour_line[$time][$date];
                if ($is_private) {
                    $res['fname'] = 'Private';
                    $res['lname'] = '';
                }
                $starttime = $res['starttime'];
                $endtime = $res['endtime'];
                // Set temporary start/end times for multiday reservations so that the rowspan is correct
                if ($res['start_date'] != $res['end_date']) {
                    if ($res['start_date'] == $datestamps[$date]) {
                        $endtime = $end_time;
                    } else {
                        $starttime = $start_time;
                    }
                }
                $rowspan = intval(($endtime - $starttime) / $time_span);
                echo "<td valign=\"top\" rowspan=\"{$rowspan}\" class=\"\">&#8226; ";
                echo "{$res['fname']} {$res['lname']}";
                if (!empty($res['parentid'])) {
                    echo ' <img src="img/recurring.gif" width="15" height="15" alt="' . translate('Recurring') . '" title="' . translate('Recurring') . '"/>';
                }
                if ($res['start_date'] != $res['end_date']) {
                    echo ' <img src="img/multiday.gif" width="8" height="9" alt="' . translate('Multiple Day') . '" title="' . translate('Multiple Day') . '"/>';
                }
                echo '</td>';
            } else {
                if (!isset($date_cells_taken[$date][$time])) {
                    echo '<td valign="top">&nbsp;</td>';
                    // There is no reservation for this time, print out an empty cell
                }
            }
        }
        echo "</tr>\n";
        // End the time row
    }
    echo "</table>\n</td></tr><table>\n";
}
예제 #8
0
 /**
  * Sets the stat mode
  * This will load specific labels and values
  *  to print out and will set any necessary
  *  values for this stat type
  * @param string $stat_type stat type to print
  * 			can be: MONTH, DAY_0F_WEEK, DAY_OF_MONTH, USER, RESOURCE, STARTTIME, ENDTIME
  */
 function set_stats($stat_type)
 {
     global $conf;
     $start = $this->sched['daystart'];
     $end = $this->sched['dayend'];
     $interval = $this->sched['timespan'];
     unset($this->labels);
     // Reinitialize variables
     $this->dynlabel = false;
     $this->type = $stat_type;
     switch ($stat_type) {
         case MONTH:
             $this->labels =& $this->month_names;
             $this->values =& $this->month;
             $this->total = $this->numRes;
             $this->graph_title = translate('Reservations by month');
             break;
         case DAY_OF_WEEK:
             $this->labels =& $this->day_names;
             $this->values =& $this->dayofweek;
             $this->total = $this->numRes;
             $this->graph_title = translate('Reservations by day of the week');
             break;
         case DAY_OF_MONTH:
             $this->set_label_handler('day_of_month_lbl');
             $this->values =& $this->dayofmonth;
             $this->index =& $this->month_names;
             $this->dyntot =& $this->month;
             $this->dyn_title = translate('Reservations per month');
             break;
         case USER:
             $this->labels =& $this->userids;
             $this->values =& $this->user;
             $this->total = $this->numRes;
             $this->index =& $this->machids;
             $this->dyntot =& $this->resource;
             $this->dyn_title = translate('Reservations per user');
             break;
         case RESOURCE:
             $this->labels =& $this->machids;
             $this->values =& $this->resource;
             $this->total = $this->numRes;
             $this->graph_title = translate('Reservations per resource');
             break;
         case STARTTIME:
             for ($i = $start; $i < $end; $i += $interval) {
                 $this->labels[$i] = Time::formatTime($i, false);
             }
             $this->values =& $this->starttime;
             $this->total = $this->numRes;
             $this->graph_title = translate('Reservations per start time');
             break;
         case ENDTIME:
             for ($i = $start + $interval; $i <= $end; $i += $interval) {
                 $this->labels[$i] = Time::formatTime($i, false);
             }
             $this->values =& $this->endtime;
             $this->total = $this->numRes;
             $this->graph_title = translate('Reservations per end time');
             break;
     }
 }
예제 #9
0
/**
* This function prints a table of all upcoming
* reservations that the current user has been invited to but not yet responded to.
* It also provides a way for them to accept/decline invitations
* @param mixed $res array of reservation data
* @param string $err last error message from database
*/
function showParticipatingTable($res, $err)
{
    global $link;
    ?>
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
  <tr>
    <td class="tableBorder">
      <table width="100%" border="0" cellspacing="1" cellpadding="0">
        <tr>
          <td colspan="7" class="tableTitle">
		    <a href="javascript: void(0);" onclick="showHideCpanelTable('accepted');">&#8250; <?php 
    echo translate('My Reservation Participation');
    ?>
</a>
		  </td>
          <td class="tableTitle">
            <div align="right">
              <?php 
    $link->doLink('javascript: help(\'my_participation\');', '?', '', 'color: #FFFFFF;', translate('Help') . ' - ' . translate('My Reservation Participation'));
    ?>
            </div>
          </td>
        </tr>
      </table>
      <div id="accepted" style="display: <?php 
    echo getShowHide('accepted');
    ?>
">
      <table width="100%" border="0" cellspacing="1" cellpadding="0">
        <tr class="rowHeaders">
          <td width="10%"><?php 
    echo translate('Start Date');
    ?>
</td>
		  <td width="10%"><?php 
    echo translate('End Date');
    ?>
</td>
          <td width="23%"><?php 
    echo translate('Resource');
    ?>
</td>
          <td width="10%"><?php 
    echo translate('Start Time');
    ?>
</td>
          <td width="10%"><?php 
    echo translate('End Time');
    ?>
</td>
          <td width="20%"><?php 
    echo translate('Owner');
    ?>
</td>
          <td width="16%"><?php 
    echo translate('End Participation');
    ?>
</td>
		</tr>
     <?php 
    // Write message if they have no reservations
    if (!$res) {
        echo '        <tr class="cellColor"><td colspan="7" align="center">' . $err . '</td></tr>';
    }
    // For each reservation, clean up the date/time and print it
    for ($i = 0; is_array($res) && $i < count($res); $i++) {
        $rs = $res[$i];
        $class = 'cellColor' . $i % 2;
        echo "        <tr class=\"{$class}\" align=\"center\">" . '          <td>' . $link->getLink("javascript: reserve('v','','','" . $rs['resid'] . "');", Time::formatReservationDate($rs['start_date'], $rs['starttime']), '', '', translate('View this reservation')) . '</td>' . '          <td>' . $link->getLink("javascript: reserve('v','','','" . $rs['resid'] . "');", Time::formatReservationDate($rs['end_date'], $rs['endtime']), '', '', translate('View this reservation')) . '</td>' . '          <td style="text-align:left;">' . $rs['name'] . '</td>' . '          <td>' . Time::formatTime($rs['starttime']) . '</td>' . '          <td>' . Time::formatTime($rs['endtime']) . '</td>' . '          <td style="text-align:left;">' . $rs['fname'] . ' ' . $rs['lname'] . '</td>' . '          <td>' . $link->getLink("manage_invites.php?id={$rs['resid']}&amp;memberid={$rs['memberid']}&amp;accept_code={$rs['accept_code']}&amp;action=" . INVITE_DECLINE, translate('End Participation'), '', '', translate('End Participation')) . '</td>' . "        </tr>\n";
    }
    unset($res);
    ?>
      </table>
	  </div>
    </td>
  </tr>
</table>
<?php 
}
예제 #10
0
파일: rss.php 프로젝트: razagilani/srrs
* @package phpScheduleIt
*
* Copyright (C) 2003 - 2007 phpScheduleIt
* License: GPL, see LICENSE
*/
include_once 'lib/DBEngine.class.php';
if (!(bool) $conf['app']['allowRss'] || (bool) $conf['app']['allowRss'] && !isset($_GET['id'])) {
    die;
}
$db = new DBEngine();
$res = $db->get_user_reservations($_GET['id'], 'res.start_date', 'DESC', true);
global $charset;
header('Content-Type: text/xml');
echo "<?xml version=\"1.0\" encoding=\"{$charset}\"?" . ">\n<rss version=\"2.0\">\n";
echo "<channel>\n<title>{$conf['app']['title']} Reservations</title>\n";
if (!$res) {
    echo "<item>\n";
    echo '<title>' . $db->err_msg . "</title>\n";
    echo '<link>' . CmnFns::getScriptURL() . "</link>\n";
    echo '<description>' . $db->err_msg . "</description>\n";
    echo "</item>\n";
}
for ($i = 0; $i < count($res) && $res != false; $i++) {
    $cur = $res[$i];
    echo "<item>\n";
    echo '<title>' . $cur['name'] . ' [' . Time::formatDate($cur['start_date']) . ' @ ' . Time::formatTime($cur['starttime']) . "]</title>\n";
    echo '<link>' . CmnFns::getScriptURL() . "/reserve.php?type=m&amp;resid={$cur['resid']}&amp;scheduleid={$cur['scheduleid']}" . "</link>\n";
    echo '<description>' . "</description>\n";
    echo "</item>\n";
}
echo "</channel>\n</rss>";
예제 #11
0
/**
* Print out available times or current reservation's time
* This function will print out all available times to make
*  a reservation or will print out the selected reservation's time
*  (if this is a view).
* @param array $res resource data array
* @param object $rs reservation object
* @param bool $print_min_max bool whether to print the min_max cells
* @param bool $allow_multi bool if multiple day reseravtions are allowed
* @global $conf
*/
function print_time_info($res, $rs, $print_min_max = true, $allow_multi = false)
{
    global $conf;
    $type = $res->get_type();
    $interval = $res->sched['timespan'];
    $startDay = $res->sched['daystart'];
    $endDay = $res->sched['dayend'];
    ?>
    <table width="100%" border="0" cellspacing="0" cellpadding="1">
     <tr class="tableBorder">
      <td>
       <table width="100%" border="0" cellspacing="1" cellpadding="0">
        <tr>
         <td colspan="2" class="cellColor">
         <h5 align='left'>
<?php 
    // Print message depending on viewing type
    switch ($type) {
        case RES_TYPE_ADD:
            $msg = translate('Please select the starting and ending times');
            break;
        case RES_TYPE_MODIFY:
            $msg = translate('Please change the starting and ending times');
            break;
        default:
            $msg = translate('Reserved time');
            break;
    }
    if ((bool) $res->get_pending()) {
        $msg .= ' (' . translate('Pending Approval') . ')';
    }
    echo $msg;
    ?>
        </h5>
        </td>
       </tr>
	   <tr>
	   <td class="formNames"><?php 
    echo translate('Start');
    ?>
</td>
	   <td class="formNames"><?php 
    echo translate('End');
    ?>
</td>
	   </tr>
      <tr>
<?php 
    $start_date = $res->get_start_date();
    $end_date = $res->get_end_date();
    $display_start_date = Time::getAdjustedDate($res->get_start_date(), $res->get_start());
    $display_end_date = Time::getAdjustedDate($res->get_end_date(), $res->get_end());
    // Show reserved time or select boxes depending on type
    if ($type == RES_TYPE_ADD || $type == RES_TYPE_MODIFY || $type == RES_TYPE_APPROVE) {
        // Start time select box
        echo '<td class="formNames" width="50%"><div id="div_start_date" style="float:left;width:86px;">' . Time::formatDate($display_start_date, '', false) . '</div><input type="hidden" id="hdn_start_date" name="start_date" value="' . date('m' . INTERNAL_DATE_SEPERATOR . 'd' . INTERNAL_DATE_SEPERATOR . 'Y', $start_date) . '" onchange="checkCalendarDates();"/>';
        if ($allow_multi) {
            echo '<a href="javascript:void(0);"><img src="img/calendar.gif" border="0" id="img_start_date" alt="' . translate('Start') . '"/></a>' . '<br/><br/>';
        }
        echo "<select name=\"starttime\" class=\"textbox\">\n";
        // Start at startDay time, end 30 min before endDay
        for ($i = $startDay; $i < $endDay + $interval; $i += $interval) {
            echo '<option value="' . $i . '"';
            // If this is a modification, select corrent time
            if ($res->get_start() == $i) {
                echo ' selected="selected" ';
            }
            echo '>' . Time::formatTime($i) . '</option>';
        }
        echo "</select>\n</td>\n";
        // End time select box
        echo '<td class="formNames"><div id="div_end_date" style="float:left;width:86px;">' . Time::formatDate($display_end_date, '', false) . '</div><input type="hidden" id="hdn_end_date" name="end_date" value="' . date('m' . INTERNAL_DATE_SEPERATOR . 'd' . INTERNAL_DATE_SEPERATOR . 'Y', $end_date) . '" onchange="checkCalendarDates();"/>';
        if ($allow_multi) {
            echo '<a href="javascript:void(0);"><img src="img/calendar.gif" border="0" id="img_end_date" alt="' . translate('End') . '"/></a>' . '<br/><br/>';
        }
        echo "<select name=\"endtime\" class=\"textbox\">\n";
        // Start at 30 after startDay time, end 30 at endDay time
        for ($i = $startDay; $i < $endDay + $interval; $i += $interval) {
            echo "<option value=\"{$i}\"";
            // If this is a modification, select corrent time
            if ($res->get_end() == $i) {
                echo ' selected="selected" ';
            }
            echo '>' . Time::formatTime($i) . "</option>\n";
        }
        echo "</select>\n</td>\n";
        if ($print_min_max & !$allow_multi) {
            echo '</tr><tr class="noshow">' . '<td colspan="2">' . translate('Minimum Reservation Length') . ' ' . Time::minutes_to_hours($rs['minres']) . '</td></tr>' . '<tr class="noshow">' . '<td colspan="2">' . translate('Maximum Reservation Length') . ' ' . Time::minutes_to_hours($rs['maxres']) . '</td>';
        }
    } else {
        echo '<td class="formNames" width="50%"><div id="div_start_date" style="float:left;width:86px;">' . Time::formatDate($start_date, '', false) . '</div>' . Time::formatTime($res->get_start()) . "</td>\n" . '<td class="formNames"><div id="div_end_date" style="float:left;width:86px;">' . Time::formatDate($end_date, '', false) . '</div>' . Time::formatTime($res->get_end()) . "</td>\n";
    }
    // Close off table
    echo "</tr>\n</table>\n</td>\n</tr>\n</table>\n<p>&nbsp;</p>\n";
}
예제 #12
0
/**
* Print out a form for searching.
* This function prints out a form for the administrator
*  to enter search criteria.  Start date will default
*  to first reservation's date, end date will default
*  to last reservation's date.  Start time will default
*  to $conf['app']['starttime'], end time will default to
*  $conf['app']['endtime'].
* @param array $min_max array of min and max reservation date values
* @param array $users array of user data
* @param array $machs array of resource data
* @global $conf
*/
function showForm($min_max, $users, $machs, $schedules)
{
    global $conf;
    global $months_full;
    $startDay = 0;
    $endDay = 1440;
    $interval = 30;
    // Set up array for month names
    $month = $months_full;
    ?>
    <form name="searchForm" method="post" action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
">
      <table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
		<tr>
		<td class="tableBorder">
		<table width="100%" border="0" cellspacing="1" cellpadding="0">
          <tr>
            <td colspan="2" class="tableTitle">&#8250; <?php 
    echo translate('Select Search Criteria');
    ?>
</td>
          </tr>
		  <tr class="cellColor">
            <td width="15%" class="formNames"><?php 
    echo translate('Schedules');
    ?>
</td>
            <td>
              <select name="scheduleid[]" size="4" multiple="multiple" class="textbox">
                <option selected="selected" value="all"><?php 
    echo translate('All Schedules');
    ?>
</option>
                <?php 
    // Write out all users
    foreach ($schedules as $schedule) {
        echo '<option value="' . $schedule['scheduleid'] . '">' . $schedule['scheduletitle'] . "</option>\n";
    }
    ?>
              </select>
              <br /><?php 
    echo translate('Hold CTRL to select multiple');
    ?>
            </td>
          </tr>
          <tr class="cellColor">
            <td width="15%" class="formNames"><?php 
    echo translate('Users');
    ?>
</td>
            <td>
              <select name="memberid[]" size="4" multiple="multiple" class="textbox">
                <option selected="selected" value="all"><?php 
    echo translate('All Users');
    ?>
</option>
                <?php 
    // Write out all users
    foreach ($users as $user) {
        echo '<option value="' . $user['memberid'] . '">' . $user['lname'] . ', ' . $user['fname'] . "</option>\n";
    }
    ?>
              </select>
              <br /><?php 
    echo translate('Hold CTRL to select multiple');
    ?>
            </td>
          </tr>
          <tr class="cellColor">
            <td class="formNames"><?php 
    echo translate('Resources');
    ?>
:</td>
            <td>
              <select name="machid[]" size="4" multiple="multiple" class="textbox">
			    <option selected="selected" value="all"><?php 
    echo translate('All Resources');
    ?>
</option>
                <?php 
    // Write out all resources
    foreach ($machs as $mach) {
        echo '<option value="' . $mach['machid'] . '">' . $mach['name'] . "</option>\n";
    }
    ?>
              </select>
              <br /><?php 
    echo translate('Hold CTRL to select multiple');
    ?>
            </td>
          </tr>
          <tr class="cellColor">
            <td class="formNames"><?php 
    echo translate('Starting Date');
    ?>
</td>
            <td>
			  <?php 
    echo translate('Minimum');
    ?>
              <select name="startMonthMin" class="textbox">
              <?php 
    for ($i = 1; $i < 13; $i++) {
        echo "<option value=\"{$i}\"";
        if ($i == $min_max['startmin']['mon']) {
            echo ' selected="selected"';
        }
        echo '>' . $month[$i - 1] . "</option>\n";
    }
    ?>
              </select>
              <select name="startDayMin" class="textbox">
              <?php 
    for ($i = 1; $i < 32; $i++) {
        echo "<option value=\"{$i}\"";
        if ($i == $min_max['startmin']['day']) {
            echo ' selected="selected"';
        }
        echo ">{$i}</option>\n";
    }
    ?>
              </select>
              ,
              <select name="startYearMin" class="textbox">
              <?php 
    for ($i = $min_max['startmin']['year']; $i < $min_max['startmax']['year'] + 1; $i++) {
        echo "<option value=\"{$i}\"";
        if ($i == $min_max['startmin']['year']) {
            echo ' selected="selected"';
        }
        echo ">{$i}</option>\n";
    }
    ?>
              </select>
			  <span style="width:30px;">&nbsp;</span>
			  <?php 
    echo translate('Maximum');
    ?>
              <select name="startMonthMax" class="textbox">
              <?php 
    for ($i = 1; $i < 13; $i++) {
        echo "<option value=\"{$i}\"";
        if ($i == $min_max['startmax']['mon']) {
            echo ' selected="selected"';
        }
        echo '>' . $month[$i - 1] . "</option>\n";
    }
    ?>
              </select>
              <select name="startDayMax" class="textbox">
              <?php 
    for ($i = 1; $i < 32; $i++) {
        echo "<option value=\"{$i}\"";
        if ($i == $min_max['startmax']['day']) {
            echo ' selected="selected"';
        }
        echo ">{$i}</option>\n";
    }
    ?>
              </select>
              ,
              <select name="startYearMax" class="textbox">
              <?php 
    for ($i = $min_max['startmin']['year']; $i < $min_max['startmax']['year'] + 1; $i++) {
        echo "<option value=\"{$i}\"";
        if ($i == $min_max['startmax']['year']) {
            echo ' selected="selected"';
        }
        echo ">{$i}</option>\n";
    }
    ?>
              </select>
            </td>
          </tr>
          <tr class="cellColor">
            <td class="formNames"><?php 
    echo translate('Ending Date');
    ?>
</td>
            <td>
			  <?php 
    echo translate('Minimum');
    ?>
              <select name="endMonthMin" class="textbox">
              <?php 
    for ($i = 0; $i < 12; $i++) {
        echo '<option value="' . ($i + 1) . '"';
        if ($i + 1 == $min_max['endmin']['mon']) {
            echo ' selected="selected"';
        }
        echo ">{$month[$i]}</option>\n";
    }
    ?>
              </select>
              <select name="endDayMin" class="textbox">
              <?php 
    for ($i = 1; $i < 32; $i++) {
        echo "<option value=\"{$i}\"";
        if ($i == $min_max['endmin']['day']) {
            echo ' selected="selected"';
        }
        echo ">{$i}</option>\n";
    }
    ?>
              </select>
              ,
              <select name="endYearMin" class="textbox">
              <?php 
    for ($i = $min_max['endmin']['year']; $i < $min_max['endmax']['year'] + 1; $i++) {
        echo "<option value=\"{$i}\"";
        if ($i == $min_max['endmin']['year']) {
            echo ' selected="selected"';
        }
        echo ">{$i}</option>\n";
    }
    ?>
              </select>
			  <span style="width:30px;">&nbsp;</span>
			  <?php 
    echo translate('Maximum');
    ?>
              <select name="endMonthMax" class="textbox">
              <?php 
    for ($i = 0; $i < 12; $i++) {
        echo '<option value="' . ($i + 1) . '"';
        if ($i + 1 == $min_max['endmax']['mon']) {
            echo ' selected="selected"';
        }
        echo ">{$month[$i]}</option>\n";
    }
    ?>
              </select>
              <select name="endDayMax" class="textbox">
              <?php 
    for ($i = 1; $i < 32; $i++) {
        echo "<option value=\"{$i}\"";
        if ($i == $min_max['endmax']['day']) {
            echo ' selected="selected"';
        }
        echo ">{$i}</option>\n";
    }
    ?>
              </select>
              ,
              <select name="endYearMax" class="textbox">
              <?php 
    for ($i = $min_max['endmin']['year']; $i < $min_max['endmax']['year'] + 1; $i++) {
        echo "<option value=\"{$i}\"";
        if ($i == $min_max['endmax']['year']) {
            echo ' selected="selected"';
        }
        echo ">{$i}</option>\n";
    }
    ?>
              </select>
            </td>
          </tr>
          <tr class="cellColor">
            <td class="formNames"><?php 
    echo translate('Starting Time');
    ?>
</td>
            <td>
			  <?php 
    echo translate('Minimum');
    ?>
              <select name="starttimeMin" class="textbox">
              <?php 
    // Print out first time and select it
    echo "<option value=\"{$startDay}\" selected=\"selected\">" . Time::formatTime($startDay, false) . "</option>\n";
    // Print out rest of times
    for ($i = $startDay + $interval; $i < $endDay; $i += $interval) {
        echo "<option value=\"{$i}\">" . Time::formatTime($i, false) . "</option>\n";
    }
    ?>
              </select>
			  <span style="width:30px;">&nbsp;</span>
			  <?php 
    echo translate('Maximum');
    ?>
              <select name="starttimeMax" class="textbox">
              <?php 
    // Print out all times except last
    for ($i = $startDay + $interval; $i < $endDay; $i += $interval) {
        echo "<option value=\"{$i}\">" . Time::formatTime($i, false) . "</option>\n";
    }
    // Print out last time and select it
    echo "<option value=\"{$endDay}\" selected=\"selected\">" . Time::formatTime($endDay, false) . "</option>\n";
    ?>
              </select>
            </td>
          </tr>
          <tr class="cellColor">
            <td class="formNames"><?php 
    echo translate('Ending Time');
    ?>
</td>
             <td>
			  <?php 
    echo translate('Minimum');
    ?>
              <select name="endtimeMin" class="textbox">
              <?php 
    // Print out first time and select it
    echo "<option value=\"{$startDay}\" selected=\"selected\">" . Time::formatTime($startDay, false) . "</option>\n";
    // Print out rest of times
    for ($i = $startDay + $interval; $i < $endDay; $i += $interval) {
        echo "<option value=\"{$i}\">" . Time::formatTime($i, false) . "</option>\n";
    }
    ?>
              </select>
			  <span style="width:30px;">&nbsp;</span>
			  <?php 
    echo translate('Maximum');
    ?>
              <select name="endtimeMax" class="textbox">
              <?php 
    // Print out all times except last
    for ($i = $startDay + $interval; $i < $endDay; $i += $interval) {
        echo "<option value=\"{$i}\">" . Time::formatTime($i, false) . "</option>\n";
    }
    // Print out last time and select it
    echo "<option value=\"{$endDay}\" selected=\"selected\">" . Time::formatTime($endDay, false) . "</option>\n";
    ?>
              </select>
            </td>
          </tr>
		  <tr class="cellColor">
			<td class="formNames"><?php 
    echo translate('Summary');
    ?>
:</td>
			<td>
				<input type="radio" name="summarytype" value="anywhere" checked="checked" /><?php 
    echo translate('Contains');
    ?>
				<input type="radio" name="summarytype" value="beginning" /><?php 
    echo translate('Begins with');
    ?>
				<input type="text" name="summarysearch" class="textbox" />
			</td>
		</tr>
		  <tr class="cellColor">
		    <td class="formNames"><?php 
    echo translate('Output Type');
    ?>
</td>
			<td>
			<input type="radio" name="outputtype" value="html" checked="checked" /><?php 
    echo translate('HTML');
    ?>
			<input type="radio" name="outputtype" value="text" /><?php 
    echo translate('Plain text');
    ?>
			<input type="radio" name="outputtype" value="xml" /><?php 
    echo translate('XML');
    ?>
			<input type="radio" name="outputtype" value="csv" /><?php 
    echo translate('CSV');
    ?>
			</td>
		  </tr>
        </table>
 </td>
 </tr>
</table>
<p>&nbsp;</p>
  <input type="submit" name="search" value="<?php 
    echo translate('Search');
    ?>
" class="button" />
  <input type="reset" name="Reset" value="<?php 
    echo translate('Clear');
    ?>
" class="button" />
</form>
<?php 
}
예제 #13
0
/**
* Prints out information from the config file
* @param object $stats stats object with all properties set
*/
function print_system_stats(&$stats)
{
    global $conf;
    $color = 0;
    ?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td class="tableTitle" colspan="2"><?php 
    echo translate('System Stats');
    ?>
</td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td width="175"><?php 
    echo translate('phpScheduleIt version');
    ?>
</td>
    <td><?php 
    echo $conf['app']['version'];
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Database backend');
    ?>
</td>
    <td><?php 
    echo $conf['db']['dbType'];
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Database name');
    ?>
</td>
    <td><?php 
    echo $conf['db']['dbName'];
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('PHP version');
    ?>
</td>
    <td><?php 
    echo phpversion();
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Server OS');
    ?>
</td>
    <td><?php 
    echo $_SERVER['SERVER_SOFTWARE'];
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Server name');
    ?>
</td>
    <td><?php 
    echo $_SERVER['SERVER_NAME'];
    ?>
    </td>
  </tr>
  <tr><td height="1" bgcolor="#666666" colspan="2"></td></tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('phpScheduleIt root directory');
    ?>
</td>
    <td><?php 
    echo $conf['app']['weburi'];
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Using permissions');
    ?>
</td>
    <td><?php 
    echo $conf['app']['use_perms'] ? translate('Yes') : translate('No');
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Using logging');
    ?>
</td>
    <td><?php 
    echo $conf['app']['use_log'] ? translate('Yes') : translate('No');
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Log file');
    ?>
</td>
    <td><?php 
    echo $conf['app']['logfile'];
    ?>
    </td>
  </tr>
  <tr><td height="1" bgcolor="#666666" colspan="2"></td></tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Admin email address');
    ?>
</td>
    <td><?php 
    echo $conf['app']['adminEmail'];
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Tech email address');
    ?>
</td>
    <td><?php 
    echo $conf['app']['techEmail'];
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('CC email addresses');
    ?>
</td>
    <td><?php 
    echo $conf['app']['ccEmail'];
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Reservation start time');
    ?>
</td>
    <td><?php 
    echo Time::formatTime($stats->startDay);
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Reservation end time');
    ?>
</td>
    <td><?php 
    echo Time::formatTime($stats->endDay);
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Days shown at a time');
    ?>
</td>
    <td><?php 
    echo $stats->sched['viewdays'];
    ?>
    </td>
  </tr>
</table>
<?php 
}