#6 prepare for shift entries

This commit is contained in:
Philip Häusler 2011-07-13 15:17:15 +02:00
parent 1bb1997e04
commit 4f220e30ce
3 changed files with 88 additions and 38 deletions

View File

@ -1,5 +1,8 @@
<?php <?php
function user_shifts() { function user_shifts() {
if (isset ($_REQUEST['shift_id'])) {
return template_render('../templates/user_shifts_add.html', array ());
} else {
$shifts = sql_select("SELECT * FROM `Shifts` ORDER BY `start`"); $shifts = sql_select("SELECT * FROM `Shifts` ORDER BY `start`");
$days = array (); $days = array ();
foreach ($shifts as $shift) foreach ($shifts as $shift)
@ -31,7 +34,7 @@ function user_shifts() {
$entries = sql_select("SELECT * FROM `ShiftEntry` JOIN `User` ON (`ShiftEntry`.`UID` = `User`.`UID`) WHERE `SID`=" . sql_escape($shift['SID']) . " AND `TID`=" . sql_escape($angeltype['TID']) . " ORDER BY `Nick`"); $entries = sql_select("SELECT * FROM `ShiftEntry` JOIN `User` ON (`ShiftEntry`.`UID` = `User`.`UID`) WHERE `SID`=" . sql_escape($shift['SID']) . " AND `TID`=" . sql_escape($angeltype['TID']) . " ORDER BY `Nick`");
$entry_list = array (); $entry_list = array ();
if ($angeltype['count'] - count($entries) > 0) if ($angeltype['count'] - count($entries) > 0)
$entry_list[] = '<a href="">'.($angeltype['count'] - count($entries)) . ' missing &raquo;</a>'; $entry_list[] = '<a href="' . page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['TID'] . '">' . ($angeltype['count'] - count($entries)) . ' missing &raquo;</a>';
$shifts_table .= join(", ", $entry_list); $shifts_table .= join(", ", $entry_list);
$shifts_table .= '<br />'; $shifts_table .= '<br />';
} }
@ -45,6 +48,7 @@ function user_shifts() {
'shifts_table' => $shifts_table 'shifts_table' => $shifts_table
)); ));
} }
}
function make_day_select($days, $day, $id) { function make_day_select($days, $day, $id) {
$html = array (); $html = array ();

View File

@ -113,6 +113,7 @@ fieldset table {
} }
fieldset p { fieldset p {
clear: both;
margin: 4px; margin: 4px;
} }

View File

@ -0,0 +1,45 @@
<form action="" method="post">
<fieldset>
<p>
<label>
Angel:
</label>
%angel%
</p>
<p>
<label>
Date/Duration:
</label>
%date%
</p>
<p>
<label>
Location:
</label>
%location%
</p>
<p>
<label>
Title:
</label>
%title%
</p>
<p>
<label>
Type:
</label>
%type%
</p>
<p>
<label>
Comment:
<br/>
(For your eyes only)
</label>
<textarea name="comment"></textarea>
</p>
<p>
<input type="submit" name="submit" value="Send" />
</p>
</fieldset>
</form>