fix bad html at user_shifts

main
Philip Häusler 12 years ago
parent 7fa2353c38
commit 1cf84a87be

@ -483,19 +483,24 @@ function view_user_shifts() {
} }
$shifts_table.="</table>"; $shifts_table.="</table>";
// qqq // qqq
} else foreach ($shifts as $shift) { } else {
$shifts_table = array();
foreach ($shifts as $shift) {
$info = array (); $info = array ();
if (count($_SESSION['user_shifts']['days']) > 1) if (count($_SESSION['user_shifts']['days']) > 1)
$info[] = date("Y-m-d", $shift['start']); $info[] = date("Y-m-d", $shift['start']);
$info[] = date("H:i", $shift['start']) . ' - ' . date("H:i", $shift['end']); $info[] = date("H:i", $shift['start']) . ' - ' . date("H:i", $shift['end']);
if (count($_SESSION['user_shifts']['rooms']) > 1) if (count($_SESSION['user_shifts']['rooms']) > 1)
$info[] = $shift['room_name']; $info[] = $shift['room_name'];
$shift_row = '<tr><td>' . join('<br />', $info) . '</td>';
$shift_row .= '<td>' . $shift['name']; $shift_row = array(
'info' => join('<br />', $info),
'entries' => $shift['name']
);
if (in_array('admin_shifts', $privileges)) if (in_array('admin_shifts', $privileges))
$shift_row .= ' <a href="?p=user_shifts&edit_shift=' . $shift['SID'] . '">[edit]</a> <a href="?p=user_shifts&delete_shift=' . $shift['SID'] . '">[x]</a>'; $shift_row['entries'] .= ' <a href="?p=user_shifts&edit_shift=' . $shift['SID'] . '">[edit]</a> <a href="?p=user_shifts&delete_shift=' . $shift['SID'] . '">[x]</a>';
$shift_row .= '<br />'; $shift_row['entries'] .= '<br />';
$is_free = false; $is_free = false;
$shift_has_special_needs = 0 < sql_num_query("SELECT `id` FROM `NeededAngelTypes` WHERE `shift_id` = " . $shift['SID']); $shift_has_special_needs = 0 < sql_num_query("SELECT `id` FROM `NeededAngelTypes` WHERE `shift_id` = " . $shift['SID']);
$query = "SELECT * $query = "SELECT *
@ -536,20 +541,25 @@ function view_user_shifts() {
$is_free = true; $is_free = true;
} }
$shift_row .= '<b>' . $angeltype['name'] . ':</b> '; $shift_row['entries'] .= '<b>' . $angeltype['name'] . ':</b> ';
$shift_row .= join(", ", $entry_list); $shift_row['entries'] .= join(", ", $entry_list);
$shift_row .= '<br />'; $shift_row['entries'] .= '<br />';
} }
if (in_array('user_shifts_admin', $privileges)) { if (in_array('user_shifts_admin', $privileges)) {
$shift_row .= '<a href="' . page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'] . '">Weitere Helfer eintragen &raquo;</a>'; $shift_row['entries'] .= '<a href="' . page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'] . '">Weitere Helfer eintragen &raquo;</a>';
} }
if (($is_free && in_array(0, $_SESSION['user_shifts']['filled'])) || (!$is_free && in_array(1, $_SESSION['user_shifts']['filled']))) { if (($is_free && in_array(0, $_SESSION['user_shifts']['filled'])) || (!$is_free && in_array(1, $_SESSION['user_shifts']['filled']))) {
$shifts_table .= $shift_row . '</td></tr>'; $shifts_table[] = $shift_row;
$row_count++; $row_count++;
$ical_shifts[] = $shift; $ical_shifts[] = $shift;
} }
} }
} }
$shifts_table = table(array(
'info' => ucfirst(Get_Text("time")) . "/" . ucfirst(Get_Text("room")),
'entries' => ucfirst(Get_Text("entries"))
), $shifts_table);
}
if ($user['ical_key'] == "") if ($user['ical_key'] == "")
user_reset_ical_key($user); user_reset_ical_key($user);
@ -562,8 +572,6 @@ function view_user_shifts() {
'task_notice' => '<sup>1</sup>' . Get_Text("pub_schichtplan_tasks_notice"), 'task_notice' => '<sup>1</sup>' . Get_Text("pub_schichtplan_tasks_notice"),
'shifts_table' => $shifts_table, 'shifts_table' => $shifts_table,
'ical_text' => sprintf(Get_Text('inc_schicht_ical_text'), make_user_shifts_ical_link($user['ical_key']), page_link_to('user_myshifts') . '&reset'), 'ical_text' => sprintf(Get_Text('inc_schicht_ical_text'), make_user_shifts_ical_link($user['ical_key']), page_link_to('user_myshifts') . '&reset'),
'header1' => ucfirst(Get_Text("time")) . "/" . ucfirst(Get_Text("room")),
'header2' => ucfirst(Get_Text("entries")),
'filter' => ucfirst(Get_Text("to_filter")), 'filter' => ucfirst(Get_Text("to_filter")),
)); ));
} }

@ -10,21 +10,8 @@
</fieldset> </fieldset>
</form> </form>
<table> %shifts_table%
<thead>
<tr>
<th>
%header1%
</th>
<th>
%header2%
</th>
</tr>
</thead>
<tbody>
%shifts_table%
</tbody>
</table>
<h2>iCal Export</h2> <h2>iCal Export</h2>
<p> <p>
%ical_text% %ical_text%

Loading…
Cancel
Save