/** * Interface to add or edit announcement 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_announce_edit($rs, $edit, &$pager) { global $conf; $start_date_ok = isset($rs['start_datetime']) && !empty($rs['start_datetime']); $end_date_ok = isset($rs['end_datetime']) && !empty($rs['end_datetime']); $start_date = $start_date_ok ? $rs['start_datetime'] : mktime(); $end_date = $end_date_ok ? $rs['end_datetime'] : mktime(); ?> <form name="addAnnouncement" method="post" action="admin_update.php" <?php echo $edit ? "" : "onsubmit=\"return checkAddAnnouncement();\""; ?> > <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 class="formNames"><?php echo translate('Announcement'); ?> </td> <td class="cellColor"><input type="text" name="announcement" class="textbox" size="50" maxlength="300" value="<?php echo isset($rs['announcement']) ? htmlspecialchars($rs['announcement']) : ''; ?> " /> </td> </tr> <tr> <td width="200" class="formNames"><?php echo translate('Number'); ?> </td> <td class="cellColor"><input type="text" name="number" class="textbox" size="3" maxlength="3" value="<?php echo isset($rs['number']) ? $rs['number'] : ''; ?> " /> </td> </tr> <tr> <td class="formNames"><?php echo translate('Start Date'); ?> </td> <td class="cellColor"> <?php echo '<div id="div_start_date" style="float:left;width:70px;">' . Time::formatDate($start_date) . '</div><input type="hidden" id="hdn_start_date" name="start_date" value="' . date('m' . INTERNAL_DATE_SEPERATOR . 'd' . INTERNAL_DATE_SEPERATOR . 'Y', $start_date) . '"/> <a href="javascript:void(0);"><img src="img/calendar.gif" border="0" id="img_start_date" alt="' . translate('Start') . '"/></a>'; $s_hour = $start_date_ok ? date('h', $rs['start_datetime']) : ''; $s_min = $start_date_ok ? date('i', $rs['start_datetime']) : ''; $s_pm = $start_date_ok ? intval(date('H', $rs['start_datetime'])) >= 12 : false; echo ' @ <input type="text" maxlength="2" size="2" class="textbox" name="start_hour" value="' . $s_hour . '"/> : <input type="text" maxlength="2" size="2" class="textbox" name="start_min" value="' . $s_min . '"/>'; echo ' <select name="start_ampm" class="textbox"><option value="am">' . translate('am') . '</option><option value="pm"' . ($s_pm ? ' selected="selected"' : '') . '>' . translate('pm') . '</option></select>'; echo ' <input type="checkbox" name="use_start_time"' . ($start_date_ok ? ' checked="checked"' : '') . '/> ' . translate('Use start date/time?'); ?> </td> </tr> <tr> <td class="formNames"><?php echo translate('End Date'); ?> </td> <td class="cellColor"> <?php echo '<div id="div_end_date" style="float:left;width:70px;">' . Time::formatDate($end_date) . '</div><input type="hidden" id="hdn_end_date" name="end_date" value="' . date('m' . INTERNAL_DATE_SEPERATOR . 'd' . INTERNAL_DATE_SEPERATOR . 'Y', $end_date) . '"/> <a href="javascript:void(0);"><img src="img/calendar.gif" border="0" id="img_end_date" alt="' . translate('End') . '"/></a>'; $s_hour = $end_date_ok ? date('h', $rs['end_datetime']) : ''; $s_min = $end_date_ok ? date('i', $rs['end_datetime']) : ''; $s_pm = $end_date_ok ? intval(date('H', $rs['end_datetime'])) >= 12 : false; echo ' @ <input type="text" maxlength="2" size="2" class="textbox" name="end_hour" value="' . $s_hour . '"/> : <input type="text" maxlength="2" size="2" class="textbox" name="end_min" value="' . $s_min . '"/>'; echo ' <select name="end_ampm" class="textbox"><option value="am">' . translate('am') . '</option><option value="pm"' . ($s_pm ? ' selected="selected"' : '') . '>' . translate('pm') . '</option></select>'; echo ' <input type="checkbox" name="use_end_time"' . ($end_date_ok ? ' checked="checked"' : '') . '/> ' . translate('Use end date/time?'); ?> </td> </tr> </table> </td> </tr> </table> <br /> <?php // Print out correct buttons if (!$edit) { echo submit_button(translate('Add Announcement'), 'announcementid') . hidden_fn('addAnnouncement') . ' <input type="reset" name="reset" value="' . translate('Clear') . '" class="button" />' . "\n"; } else { echo submit_button(translate('Edit Announcement'), 'announcementid') . cancel_button($pager) . hidden_fn('editAnnouncement') . '<input type="hidden" name="announcementid" value="' . $rs['announcementid'] . '" />' . "\n"; } echo "</form>\n"; print_jscalendar_setup($start_date_ok ? $rs['start_datetime'] : null, $end_date_ok ? $rs['end_datetime'] : null); // Set up the javascript calendars // Unset variables unset($rs); }
/** * 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(); } }