예제 #1
0
/**
* Interface to add or edit schedule information
* @param mixed $rs array of schedule data
* @param boolean $edit whether this is an edit or not
* @param object $pager Pager object
*/
function print_schedule_edit($rs, $edit, &$pager)
{
    global $conf;
    ?>
<form name="addSchedule" method="post" action="admin_update.php" <?php 
    echo $edit ? "" : "onsubmit=\"return checkAddSchedule();\"";
    ?>
>
<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 width="200" class="formNames"><?php 
    echo translate('Schedule Title');
    ?>
</td>
          <td class="cellColor"><input type="text" name="scheduletitle" class="textbox" value="<?php 
    echo isset($rs['scheduletitle']) ? $rs['scheduletitle'] : '';
    ?>
" />
          </td>
        </tr>
		<tr>
		  <td class="formNames"><?php 
    echo translate('Start Time');
    ?>
</td>
		  <td class="cellColor"><select name="daystart" class="textbox">
		  <?php 
    for ($time = 0; $time <= 1410; $time += 30) {
        echo '<option value="' . $time . '"' . (isset($rs['daystart']) && $rs['daystart'] == $time ? ' selected="selected"' : '') . '>' . Time::formatTime($time, false) . '</option>' . "\n";
    }
    ?>
		  </select>
		  </td>
		</tr>
		<tr>
		  <td class="formNames"><?php 
    echo translate('End Time');
    ?>
</td>
		  <td class="cellColor"><select name="dayend" class="textbox">
		  <?php 
    for ($time = 30; $time <= 1440; $time += 30) {
        echo '<option value="' . $time . '"' . (isset($rs['dayend']) && $rs['dayend'] == $time ? ' selected="selected"' : ($time == 1440 && !isset($rs['dayend']) ? ' selected="selected"' : '')) . '>' . Time::formatTime($time, false) . '</option>' . "\n";
    }
    ?>
		  </select>
		  </td>
		</tr>
        <tr>
          <td class="formNames"><?php 
    echo translate('Time Span');
    ?>
</td>
          <td class="cellColor"><select name="timespan" class="textbox">
		  <?php 
    $spans = array(30, 10, 15, 60, 120, 180, 240);
    for ($i = 0; $i < count($spans); $i++) {
        echo '<option value="' . $spans[$i] . '"' . (isset($rs['timespan']) && $rs['timespan'] == $spans[$i] ? ' selected="selected"' : '') . '>' . Time::minutes_to_hours($spans[$i]) . '</option>' . "\n";
    }
    ?>
		  </select>
		  </td>
        </tr>
        <tr>
          <td class="formNames"><?php 
    echo translate('Weekday Start');
    ?>
</td>
          <td class="cellColor"><select name="weekdaystart" class="textbox">
		  <?php 
    for ($i = 0; $i < 7; $i++) {
        echo '<option value="' . $i . '"' . (isset($rs['weekdaystart']) && $rs['weekdaystart'] == $i ? ' selected="selected"' : '') . '>' . CmnFns::get_day_name($i) . '</option>' . "\n";
    }
    ?>
		  </select>
		  </td>
        </tr>
        <tr>
          <td class="formNames"><?php 
    echo translate('Days to Show');
    ?>
</td>
          <td class="cellColor"><input type="text" name="viewdays" class="textbox" size="2" maxlength="2" value="<?php 
    echo isset($rs['viewdays']) ? $rs['viewdays'] : '7';
    ?>
" />
          </td>
        </tr>
		<tr>
		  <td class="formNames"><?php 
    echo translate('Hidden');
    ?>
</td>
		   <td class="cellColor"><select name="ishidden" class="textbox">
		  <?php 
    $yesNo = array(translate('No'), translate('Yes'));
    for ($i = 0; $i < 2; $i++) {
        echo '<option value="' . $i . '"' . (isset($rs['ishidden']) && $rs['ishidden'] == $i ? ' selected="selected"' : '') . '>' . $yesNo[$i] . '</option>' . "\n";
    }
    ?>
		  </select>
		  </td>
		</tr>
		<tr>
		  <td class="formNames"><?php 
    echo translate('Show Summary');
    ?>
</td>
		   <td class="cellColor"><select name="showsummary" class="textbox">
		  <?php 
    for ($i = 1; $i >= 0; $i--) {
        echo '<option value="' . $i . '"' . (isset($rs['showsummary']) && $rs['showsummary'] == $i ? ' selected="selected"' : '') . '>' . $yesNo[$i] . '</option>' . "\n";
    }
    ?>
		  </select>
		  </td>
		</tr>
		<tr>
          <td class="formNames"><?php 
    echo translate('Admin Email');
    ?>
</td>
          <td class="cellColor"><input type="text" name="adminemail" maxlength="75" class="textbox" value="<?php 
    echo isset($rs['adminemail']) ? $rs['adminemail'] : $conf['app']['adminEmail'];
    ?>
" />
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<br />
<?php 
    // Print out correct buttons
    if (!$edit) {
        echo submit_button(translate('Add Schedule'), 'scheduleid') . hidden_fn('addSchedule') . ' <input type="reset" name="reset" value="' . translate('Clear') . '" class="button" />' . "\n";
    } else {
        echo submit_button(translate('Edit Schedule'), 'scheduleid') . cancel_button($pager) . hidden_fn('editSchedule') . '<input type="hidden" name="scheduleid" value="' . $rs['scheduleid'] . '" />' . "\n";
        // Unset variables
        unset($rs);
    }
    echo "</form>\n";
}
예제 #2
0
 /**
  * Check to make sure that the reservation falls within the specified reservation length
  * @param int $min minimum reservation length
  * @param int $max maximum reservation length
  * @return if the time is valid
  */
 function check_min_max()
 {
     $min = $this->resource->get_property('minres');
     $max = $this->resource->get_property('maxRes');
     if ($this->start_date < $this->end_date) {
         return true;
     }
     // Cannot have a min/max for multi-day reservations
     $this_length = $this->end - $this->start;
     $is_valid = $this_length >= $min && $this_length <= $max;
     if (!$is_valid) {
         $this->add_error(translate('Reservation length does not fall within this resource\'s allowed length.') . '<br /><br >' . translate('Your reservation is') . ' ' . Time::minutes_to_hours($this_length) . '<br />' . translate('Minimum reservation length') . ' ' . Time::minutes_to_hours($min) . '<br />' . translate('Maximum reservation length') . ' ' . Time::minutes_to_hours($max));
     }
     return $is_valid;
 }
예제 #3
0
/**
* This function prints out the bulk of the reservation data for text and html output
*  and all of the data for xml and csv output types.
* This data is properly formatted for each output type
* @param string $type output type
* @param object $link Link object
* @param int $resNo reservation count number (not reservation id)
* @param string $start_date formatted reservation starting date string
* @param string $end_date formatted reservation ending date string
* @param string $created formatted reservation created datetime string
* @param string $modified formatted reservation modified datetime string
* @param string $starttime formatted reservation start time
* @param string $endtime formatted reservation end time
* @param float $totTime total reservation time
* @param string $resid reservation id
* @param string $fname user first name
* @param string $lname user last name
* @param string $name resource name
* @param string $memberid member id
* @param string $schedule schedule title
*/
function print_reservation_data($type, &$link, $resNo, $start_date, $end_date, $created, $modified, $starttime, $endtime, $totTime, $resid, $fname, $lname, $name, $memberid, $schedule)
{
    global $conf;
    $totTime = Time::minutes_to_hours($totTime);
    switch ($type) {
        case 'html':
            // Write out reservation info
            echo '<tr class="cellColor" align="center" style="font-weight: normal;">' . '<td>' . $resNo . "</td>\n" . '<td>' . $start_date . "</td>\n" . '<td>' . $end_date . "</td>\n" . '<td>' . $created . "</td>\n" . '<td>' . $modified . "</td>\n" . '<td>' . $starttime . "</td>\n" . '<td>' . $endtime . "</td>\n" . '<td>' . $link->getLink("javascript: reserve('m','','','" . $resid . "');", translate('Edit'), '', '', translate('Edit this reservation')) . "</td>\n" . '<td>' . $totTime . "</td>\n</tr>\n";
            break;
        case 'text':
            // Format modifed time so it tabs correctly
            if ($modified == translate('N/A')) {
                $modified = str_repeat('-', 23);
                if ($conf['app']['timeFormat'] != 24) {
                    $modified .= '-';
                }
            }
            $extraTab = $conf['app']['timeFormat'] == 24 ? "\t" : '';
            echo $resNo . "\t" . $start_date . "\t" . $end_date . "\t" . $created . "\t" . $extraTab . $modified . "\t" . $extraTab . $starttime . "\t\t" . $endtime . "\t\t" . $totTime . "\n";
            break;
        case 'xml':
            echo "&lt;reservation id=\"{$resid}\"&gt;\r\n" . "\t&lt;memberid&gt;{$memberid}&lt;/memberid&gt;\r\n" . "\t&lt;scheduletitle&gt;{$schedule}&lt;/scheduletitle&gt;\r\n" . "\t&lt;fname&gt;{$fname}&lt;/fname&gt;\r\n" . "\t&lt;lname&gt;{$lname}&lt;/lname&gt;\r\n" . "\t&lt;resourcename&gt;{$name}&lt;/resourcename&gt;\r\n" . "\t&lt;start_date&gt;{$start_date}&lt;/start_date&gt;\r\n" . "\t&lt;end_date&gt;{$end_date}&lt;/end_date&gt;\r\n" . "\t&lt;created&gt;{$created}&lt;/created&gt;\r\n" . "\t&lt;modified&gt;{$modified}&lt;/modified&gt;\r\n" . "\t&lt;starttime&gt;{$starttime}&lt;/starttime&gt;\r\n" . "\t&lt;endtime&gt;{$endtime}&lt;/endtime&gt;\r\n" . "\t&lt;totTime&gt;{$totTime}&lt;/totTime&gt;\r\n" . "&lt;/reservation&gt;\r\n";
            break;
        case 'csv':
            echo "\"{$resid}\"," . "\"{$memberid}\"," . '"' . addslashes($schedule) . '",' . '"' . addslashes($fname) . '",' . '"' . addslashes($lname) . '",' . '"' . addslashes($name) . '",' . "\"{$start_date}\"," . "\"{$end_date}\"," . "\"{$created}\"," . "\"{$modified}\"," . "\"{$starttime}\"," . "\"{$endtime}\"," . "\"{$totTime}\"\r\n";
            break;
    }
}
예제 #4
0
/**
* Prints out the box where users can select when to get a reminder
* @param array $reminder_times the minutes that are shown in the selection box
* @param int $selected_minutes the currently selected minutes
* @param string $reminderid id of the reminder to modify
*/
function print_reminder_box($reminder_times, $selected_minutes, $reminderid)
{
    if (empty($reminder_times)) {
        return;
    }
    ?>
<table width="200" border="0" cellspacing="0" cellpadding="0" class="recur_box" id="repeat_table" style="margin-top:5px;">
  <tr>
    <td style="padding: 5px;">
	 <?php 
    echo '<input type="hidden" name="reminderid" id="reminderid" value="' . $reminderid . '"/>';
    echo translate('Reminder') . ' ';
    echo '<select name="reminder_minutes_prior" id="reminder_minutes_prior" class="textbox">';
    echo '<option value="0">' . translate('Never') . '</option>';
    for ($i = 0; $i < count($reminder_times); $i++) {
        echo "<option value=\"{$reminder_times[$i]} " . ($selected_minutes == $reminder_times[$i] ? 'selected="selected"' : '') . "\">" . Time::minutes_to_hours($reminder_times[$i]) . "</option>\n";
    }
    echo '</select><br/>';
    echo translate('before reservation');
    ?>
	</td>
  </tr>
</table>
<?php 
}
예제 #5
0
/**
* Prints out a quick summary of statistical information about the
*  application and system
* @param object $stats stats object with all properties set
*/
function print_quick_stats(&$stats)
{
    $color = 0;
    ?>
<a name="top"></a>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td class="tableTitle" colspan="2"><?php 
    echo translate('At A Glance');
    ?>
</td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td width="175"><?php 
    echo translate('Total Users');
    ?>
</td>
    <td><?php 
    echo $stats->get_num_users();
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Total Resources');
    ?>
</td>
    <td><?php 
    echo $stats->get_num_rs();
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Total Reservations');
    ?>
</td>
    <td><?php 
    echo $stats->get_num_res();
    ?>
    </td>
  </tr>
  <tr><td height="1" bgcolor="#666666" colspan="2"></td></tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Max Reservation');
    ?>
</td>
    <td><?php 
    echo Time::minutes_to_hours($stats->longest);
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Min Reservation');
    ?>
</td>
    <td><?php 
    echo Time::minutes_to_hours($stats->shortest);
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Avg Reservation');
    ?>
</td>
    <td><?php 
    echo @Time::minutes_to_hours($stats->get_total_time() / $stats->get_num_res());
    ?>
    </td>
  </tr>
  <tr><td height="1" bgcolor="#666666" colspan="2"></td></tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Most Active Resource');
    ?>
</td>
    <td><?php 
    echo $stats->active_resource['name'] . ' : ' . $stats->active_resource['num'] . ' ' . translate('Reservations');
    ?>
    </td>
  </tr>
  <tr class="cellColor<?php 
    echo $color++ % 2;
    ?>
">
    <td><?php 
    echo translate('Most Active User');
    ?>
</td>
    <td><?php 
    echo $stats->active_user['name'] . ' : ' . $stats->active_user['num'] . ' ' . translate('Reservations');
    ?>
    </td>
  </tr>
</table>
<?php 
}