Gazelle/sections/tools/managers/ajax_get_calendar_event.php

131 lines
3.1 KiB
PHP
Raw Normal View History

2013-08-28 23:08:41 +00:00
<?
if (!Calendar::can_view()) {
error(404);
}
if ($_GET['id']) {
$Event = Calendar::get_event($_GET['id']);
} else {
$Year = $_GET['year'];
$Month = $_GET['month'];
$Day = $_GET['day'];
2013-10-13 08:01:01 +00:00
if ($Month < 10) {
$Month = "0$Month";
2013-08-28 23:08:41 +00:00
}
2013-10-13 08:01:01 +00:00
if ($Day < 10) {
$Day = "0$Day";
2013-08-28 23:08:41 +00:00
}
2013-10-13 08:01:01 +00:00
$StartDate = $EndDate = "$Year-$Month-$Day";
2013-08-28 23:08:41 +00:00
}
?>
2013-10-13 08:01:01 +00:00
<form id="event_form" name="event_form" method="post" action="">
2013-08-28 23:08:41 +00:00
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<? if ($Event) { ?>
2013-10-13 08:01:01 +00:00
<input type="hidden" name="id" value="<?=$Event['ID']?>" />
2013-08-28 23:08:41 +00:00
<? } ?>
<input type="hidden" name="action" value="take_calendar_event" />
<table class="event_form_table">
<tr>
<tr>
2013-10-25 08:00:59 +00:00
<td class="label small_label">Title:</td>
2013-08-28 23:08:41 +00:00
<td>
2013-10-13 08:01:01 +00:00
<input type="text" id="title" name="title" class="required" value="<?=$Event['Title']?>" />
2013-08-28 23:08:41 +00:00
</td>
</tr>
<tr>
2013-10-25 08:00:59 +00:00
<td class="label small_label">Category:</td>
2013-08-28 23:08:41 +00:00
<td>
<select id="category" name="category" class="required">
2013-10-13 08:01:01 +00:00
<?
$Categories = Calendar::$Categories;
foreach ($Categories as $Key => $Value) {
?>
<option value="<?=$Key?>"<?=$Key == $Event['Category'] ? ' selected="selected"' : ''?>><?=$Value?></option>
<? } ?>
2013-08-28 23:08:41 +00:00
</select>
</td>
</tr>
<tr>
2013-10-25 08:00:59 +00:00
<td class="label small_label">Importance:</td>
2013-08-28 23:08:41 +00:00
<td>
<select id="importance" name="importance" class="required">
2013-10-13 08:01:01 +00:00
<?
$Importances = Calendar::$Importances;
foreach ($Importances as $Key => $Value) {
?>
<option value="<?=$Key?>"<?=$Key == $Event['Importance'] ? ' selected="selected"' : ''?>><?=$Value?></option>
<? } ?>
2013-08-28 23:08:41 +00:00
</select>
</td>
</tr>
<tr>
2013-10-25 08:00:59 +00:00
<td class="label small_label">Team:</td>
2013-08-28 23:08:41 +00:00
<td>
<select id="team" name="team" class="required">
2013-10-13 08:01:01 +00:00
<?
$Teams = Calendar::$Teams;
foreach ($Teams as $Key => $Value) {
?>
<option value="<?=$Key?>"<?=$Key == $Event['Team'] ? ' selected="selected"' : ''?>><?=$Value?></option>
<? } ?>
2013-08-28 23:08:41 +00:00
</select>
</td>
</tr>
<tr>
2013-10-25 08:00:59 +00:00
<td class="label small_label">Start date:</td>
2013-08-28 23:08:41 +00:00
<td>
<input type="date" id="start_date" name="start_date" class="required"
2013-10-13 08:01:01 +00:00
<? if ($Event) { ?>
value="<?=date('Y-m-d', strtotime($Event['StartDate']))?>" />
<? } else { ?>
value="<?=$StartDate?>" />
<? } ?>
2013-08-28 23:08:41 +00:00
</td>
</tr>
<tr>
2013-10-25 08:00:59 +00:00
<td class="label small_label">End date:</td>
2013-08-28 23:08:41 +00:00
<td>
<input type="date" id="end_date" name="end_date" class="required"
2013-10-13 08:01:01 +00:00
<? if ($Event) { ?>
value="<?=date('Y-m-d', strtotime($Event['EndDate']))?>" />
<? } else { ?>
value="<?=$EndDate?>" />
<? } ?>
2013-08-28 23:08:41 +00:00
</td>
</tr>
<tr>
2013-10-25 08:00:59 +00:00
<td class="label small_label">Created by:</td>
2013-08-28 23:08:41 +00:00
<td>
<?=$Event ? Users::format_username($Event['AddedBy']) : Users::format_username($LoggedUser['ID'])?>
</td>
</tr>
<tr>
<td colspan="2">
<textarea id="body" name="body" class="required"><?=$Event['Body']?></textarea>
</td>
</tr>
<tr>
2013-10-13 08:01:01 +00:00
<?
if (check_perms('users_mod')) {
if ($Event) {
?>
<td>
<input type="submit" id="update" name="update" value="Update" />
</td>
<td>
<input type="submit" id="delete" name="delete" value="Delete" />
</td>
<? } else { ?>
<td>
<input type="submit" id="create" name="create" value="Create" />
</td>
<?
}
}
?>
2013-08-28 23:08:41 +00:00
</tr>
</tr>
</table>
</form>