summaryrefslogtreecommitdiff
path: root/includes/view
diff options
context:
space:
mode:
authorBot <bot@myigel.name>2017-01-03 03:22:48 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2017-01-03 03:22:48 +0100
commit356b2582f3e6a43ecf2607acad4a7fe0b37f659a (patch)
treee02c9214b23a0b9ec33aa725db962d565bd30a82 /includes/view
parentd71e7bbfad2f07f82df0c515608996d250fd4182 (diff)
PPHDoc, formatting, fixes, cleanup
Diffstat (limited to 'includes/view')
-rw-r--r--includes/view/AngelTypes_view.php55
-rw-r--r--includes/view/EventConfig_view.php21
-rw-r--r--includes/view/Questions_view.php6
-rw-r--r--includes/view/Rooms_view.php10
-rw-r--r--includes/view/ShiftCalendarLane.php25
-rw-r--r--includes/view/ShiftCalendarRenderer.php77
-rw-r--r--includes/view/ShiftCalendarShiftRenderer.php41
-rw-r--r--includes/view/ShiftEntry_view.php4
-rw-r--r--includes/view/ShiftTypes_view.php25
-rw-r--r--includes/view/ShiftsFilterRenderer.php13
-rw-r--r--includes/view/Shifts_view.php36
-rw-r--r--includes/view/UserAngelTypes_view.php38
-rw-r--r--includes/view/UserDriverLicenses_view.php16
-rw-r--r--includes/view/UserHintsRenderer.php13
-rw-r--r--includes/view/User_view.php128
15 files changed, 415 insertions, 93 deletions
diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php
index 0458a5db..0a97488d 100644
--- a/includes/view/AngelTypes_view.php
+++ b/includes/view/AngelTypes_view.php
@@ -7,7 +7,8 @@
/**
* Renders the angeltypes name as link.
*
- * @param AngelType $angeltype
+ * @param array $angeltype
+ * @return string
*/
function AngelType_name_render($angeltype)
{
@@ -17,8 +18,7 @@ function AngelType_name_render($angeltype)
/**
* Render angeltype membership state
*
- * @param UserAngelType $user_angeltype
- * UserAngelType and AngelType
+ * @param array $user_angeltype UserAngelType and AngelType
* @return string
*/
function AngelType_render_membership($user_angeltype)
@@ -39,6 +39,10 @@ function AngelType_render_membership($user_angeltype)
return glyph_bool(false);
}
+/**
+ * @param array $angeltype
+ * @return string
+ */
function AngelType_delete_view($angeltype)
{
return page_with_title(sprintf(_("Delete angeltype %s"), $angeltype['name']), [
@@ -57,10 +61,9 @@ function AngelType_delete_view($angeltype)
/**
* Render angeltype edit form.
*
- * @param Angeltype $angeltype
- * The angeltype to edit
- * @param boolean $supporter_mode
- * Is the user a supporter of this angeltype?
+ * @param array $angeltype The angeltype to edit
+ * @param boolean $supporter_mode Is the user a supporter of this angeltype?
+ * @return string
*/
function AngelType_edit_view($angeltype, $supporter_mode)
{
@@ -103,6 +106,14 @@ function AngelType_edit_view($angeltype, $supporter_mode)
/**
* Renders the buttons for the angeltype view.
+ *
+ * @param array $angeltype
+ * @param array|null $user_angeltype
+ * @param bool $admin_angeltypes
+ * @param bool $supporter
+ * @param array|null $user_driver_license
+ * @param array|null $user
+ * @return string
*/
function AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $user_driver_license, $user)
{
@@ -156,7 +167,11 @@ function AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes,
/**
* Renders and sorts the members of an angeltype into supporters, members and unconfirmed members.
*
- * @return [supporters, members, unconfirmed members]
+ * @param array $angeltype
+ * @param array $members
+ * @param bool $admin_user_angeltypes
+ * @param bool $admin_angeltypes
+ * @return array [supporters, members, unconfirmed members]
*/
function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $admin_angeltypes)
{
@@ -230,6 +245,11 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a
/**
* Creates the needed member table headers according to given rights and settings from the angeltype.
+ *
+ * @param array $angeltype
+ * @param bool $supporter
+ * @param bool $admin_angeltypes
+ * @return array
*/
function AngelType_view_table_headers($angeltype, $supporter, $admin_angeltypes)
{
@@ -256,6 +276,16 @@ function AngelType_view_table_headers($angeltype, $supporter, $admin_angeltypes)
/**
* Render an angeltype page containing the member lists.
+ *
+ * @param array $angeltype
+ * @param array[] $members
+ * @param array $user_angeltype
+ * @param bool $admin_user_angeltypes
+ * @param bool $admin_angeltypes
+ * @param bool $supporter
+ * @param array $user_driver_license
+ * @param array $user
+ * @return string
*/
function AngelType_view(
$angeltype,
@@ -339,6 +369,8 @@ function AngelType_view(
* Display the list of angeltypes.
*
* @param array $angeltypes
+ * @param bool $admin_angeltypes
+ * @return string
*/
function AngelTypes_list_view($angeltypes, $admin_angeltypes)
{
@@ -360,6 +392,9 @@ function AngelTypes_list_view($angeltypes, $admin_angeltypes)
/**
* Renders the about info for an angeltype.
+ *
+ * @param array $angeltype
+ * @return string
*/
function AngelTypes_about_view_angeltype($angeltype)
{
@@ -401,6 +436,10 @@ function AngelTypes_about_view_angeltype($angeltype)
/**
* Renders a site that contains every angeltype and its description, basically as an overview of the needed help types.
+ *
+ * @param array[] $angeltypes
+ * @param bool $user_logged_in
+ * @return string
*/
function AngelTypes_about_view($angeltypes, $user_logged_in)
{
diff --git a/includes/view/EventConfig_view.php b/includes/view/EventConfig_view.php
index 9f24f9c9..3cb85e0b 100644
--- a/includes/view/EventConfig_view.php
+++ b/includes/view/EventConfig_view.php
@@ -3,7 +3,8 @@
/**
* Shows basic event infos and countdowns.
*
- * @param EventConfig $event_config The event configuration
+ * @param array $event_config The event configuration
+ * @return string
*/
function EventConfig_countdown_page($event_config)
{
@@ -61,6 +62,9 @@ function EventConfig_countdown_page($event_config)
/**
* Converts event name and start+end date into a line of text.
+ *
+ * @param array $event_config
+ * @return string
*/
function EventConfig_info($event_config)
{
@@ -106,14 +110,13 @@ function EventConfig_info($event_config)
/**
* Render edit page for event config.
*
- * @param string $event_name
- * The event name
- * @param string $event_welcome_msg
- * The welcome message
- * @param date $buildup_start_date
- * @param date $event_start_date
- * @param date $event_end_date
- * @param date $teardown_end_date
+ * @param string $event_name The event name
+ * @param string $event_welcome_msg The welcome message
+ * @param int $buildup_start_date unix time stamp
+ * @param int $event_start_date unix time stamp
+ * @param int $event_end_date unix time stamp
+ * @param int $teardown_end_date unix time stamp
+ * @return string
*/
function EventConfig_edit_view(
$event_name,
diff --git a/includes/view/Questions_view.php b/includes/view/Questions_view.php
index 0716780c..3276baf6 100644
--- a/includes/view/Questions_view.php
+++ b/includes/view/Questions_view.php
@@ -1,5 +1,11 @@
<?php
+/**
+ * @param array[] $open_questions
+ * @param array[] $answered_questions
+ * @param string $ask_action
+ * @return string
+ */
function Questions_view($open_questions, $answered_questions, $ask_action)
{
foreach ($open_questions as &$question) {
diff --git a/includes/view/Rooms_view.php b/includes/view/Rooms_view.php
index db883fa9..802b4c8e 100644
--- a/includes/view/Rooms_view.php
+++ b/includes/view/Rooms_view.php
@@ -2,6 +2,12 @@
use Engelsystem\ShiftCalendarRenderer;
use Engelsystem\ShiftsFilterRenderer;
+/**
+ * @param array $room
+ * @param ShiftsFilterRenderer $shiftsFilterRenderer
+ * @param ShiftCalendarRenderer $shiftCalendarRenderer
+ * @return string
+ */
function Room_view($room, ShiftsFilterRenderer $shiftsFilterRenderer, ShiftCalendarRenderer $shiftCalendarRenderer)
{
return page_with_title(glyph('map-marker') . $room['Name'], [
@@ -10,6 +16,10 @@ function Room_view($room, ShiftsFilterRenderer $shiftsFilterRenderer, ShiftCalen
]);
}
+/**
+ * @param array $room
+ * @return string
+ */
function Room_name_render($room)
{
global $privileges;
diff --git a/includes/view/ShiftCalendarLane.php b/includes/view/ShiftCalendarLane.php
index 529b6a74..774683bd 100644
--- a/includes/view/ShiftCalendarLane.php
+++ b/includes/view/ShiftCalendarLane.php
@@ -7,14 +7,25 @@ namespace Engelsystem;
*/
class ShiftCalendarLane
{
+ /** @var int */
private $firstBlockStartTime;
+ /** @var int */
private $blockCount;
+ /** @var string */
private $header;
+ /** @var array[] */
private $shifts = [];
+ /**
+ * ShiftCalendarLane constructor.
+ *
+ * @param string $header
+ * @param int $firstBlockStartTime Unix timestamp
+ * @param int $blockCount
+ */
public function __construct($header, $firstBlockStartTime, $blockCount)
{
$this->header = $header;
@@ -26,8 +37,7 @@ class ShiftCalendarLane
* Adds a shift to the lane, but only if it fits.
* Returns true on success.
*
- * @param Shift $shift
- * The shift to add
+ * @param array $shift The shift to add
* @return boolean true on success
*/
public function addShift($shift)
@@ -42,8 +52,9 @@ class ShiftCalendarLane
/**
* Returns true if given shift fits into this lane.
*
- * @param Shift $shift
- * The shift to fit into this lane
+ * @param array $newShift
+ * @return bool
+ * @internal param array $shift The shift to fit into this lane
*/
public function shiftFits($newShift)
{
@@ -55,11 +66,17 @@ class ShiftCalendarLane
return true;
}
+ /**
+ * @return string
+ */
public function getHeader()
{
return $this->header;
}
+ /**
+ * @return array[]
+ */
public function getShifts()
{
return $this->shifts;
diff --git a/includes/view/ShiftCalendarRenderer.php b/includes/view/ShiftCalendarRenderer.php
index c875af39..e2a574e6 100644
--- a/includes/view/ShiftCalendarRenderer.php
+++ b/includes/view/ShiftCalendarRenderer.php
@@ -26,20 +26,35 @@ class ShiftCalendarRenderer
*/
const TIME_MARGIN = 1800;
+ /** @var array */
private $lanes;
+ /** @var ShiftsFilter */
private $shiftsFilter;
- private $firstBlockStartTime = null;
+ /** @var int */
+ private $firstBlockStartTime = 0;
- private $lastBlockEndTime = null;
+ /** @var int */
+ private $lastBlockEndTime = 0;
+ /** @var int */
private $blocksPerSlot = null;
- private $needed_angeltypes = null;
+ /** @var array[] */
+ private $needed_angeltypes = [];
- private $shift_entries = null;
+ /** @var array[] */
+ private $shift_entries = [];
+ /**
+ * ShiftCalendarRenderer constructor.
+ *
+ * @param array[] $shifts
+ * @param array[] $needed_angeltypes
+ * @param array[] $shift_entries
+ * @param ShiftsFilter $shiftsFilter
+ */
public function __construct($shifts, $needed_angeltypes, $shift_entries, ShiftsFilter $shiftsFilter)
{
$this->shiftsFilter = $shiftsFilter;
@@ -53,10 +68,9 @@ class ShiftCalendarRenderer
/**
* Assigns the shifts to different lanes per room if they collide
*
- * @param Shift[] $shifts
- * The shifts to assign
+ * @param array[] $shifts The shifts to assign
*
- * @return Returns an array that assigns a room_id to an array of ShiftCalendarLane containing the shifts
+ * @return array Returns an array that assigns a room_id to an array of ShiftCalendarLane containing the shifts
*/
private function assignShiftsToLanes($shifts)
{
@@ -78,6 +92,7 @@ class ShiftCalendarRenderer
// Try to add the shift to the existing lanes for this room
$shift_added = false;
foreach ($lanes[$room_id] as $lane) {
+ /** @var ShiftCalendarLane $lane */
$shift_added = $lane->addShift($shift);
if ($shift_added == true) {
break;
@@ -96,16 +111,25 @@ class ShiftCalendarRenderer
return $lanes;
}
+ /**
+ * @return int
+ */
public function getFirstBlockStartTime()
{
return $this->firstBlockStartTime;
}
+ /**
+ * @return int
+ */
public function getLastBlockEndTime()
{
return $this->lastBlockEndTime;
}
+ /**
+ * @return float
+ */
public function getBlocksPerSlot()
{
if ($this->blocksPerSlot == null) {
@@ -117,7 +141,7 @@ class ShiftCalendarRenderer
/**
* Renders the whole calendar
*
- * @return the generated html
+ * @return string the generated html
*/
public function render()
{
@@ -132,6 +156,8 @@ class ShiftCalendarRenderer
/**
* Renders the lanes containing the shifts
+ *
+ * @return string
*/
private function renderShiftLanes()
{
@@ -148,8 +174,8 @@ class ShiftCalendarRenderer
/**
* Renders a single lane
*
- * @param ShiftCalendarLane $lane
- * The lane to render
+ * @param ShiftCalendarLane $lane The lane to render
+ * @return string
*/
private function renderLane(ShiftCalendarLane $lane)
{
@@ -165,8 +191,12 @@ class ShiftCalendarRenderer
$rendered_until += ShiftCalendarRenderer::SECONDS_PER_ROW;
}
- list($shift_height, $shift_html) = $shift_renderer->render($shift, $this->needed_angeltypes[$shift['SID']],
- $this->shift_entries[$shift['SID']], $user);
+ list($shift_height, $shift_html) = $shift_renderer->render(
+ $shift,
+ $this->needed_angeltypes[$shift['SID']],
+ $this->shift_entries[$shift['SID']],
+ $user
+ );
$html .= $shift_html;
$rendered_until += $shift_height * ShiftCalendarRenderer::SECONDS_PER_ROW;
}
@@ -185,11 +215,9 @@ class ShiftCalendarRenderer
/**
* Renders a tick/block for given time
*
- * @param int $time
- * unix timestamp
- * @param boolean $label
- * Should time labels be generated?
- * @return rendered tick html
+ * @param int $time unix timestamp
+ * @param boolean $label Should time labels be generated?
+ * @return string rendered tick html
*/
private function renderTick($time, $label = false)
{
@@ -213,6 +241,8 @@ class ShiftCalendarRenderer
/**
* Renders the left time lane including hour/day ticks
+ *
+ * @return string
*/
private function renderTimeLane()
{
@@ -228,6 +258,10 @@ class ShiftCalendarRenderer
return div('lane time', $time_slot);
}
+ /**
+ * @param array[] $shifts
+ * @return int
+ */
private function calcFirstBlockStartTime($shifts)
{
$start_time = $this->shiftsFilter->getEndTime();
@@ -239,6 +273,10 @@ class ShiftCalendarRenderer
return ShiftCalendarRenderer::SECONDS_PER_ROW * floor(($start_time - ShiftCalendarRenderer::TIME_MARGIN) / ShiftCalendarRenderer::SECONDS_PER_ROW);
}
+ /**
+ * @param array[] $shifts
+ * @return int
+ */
private function calcLastBlockEndTime($shifts)
{
$end_time = $this->shiftsFilter->getStartTime();
@@ -250,6 +288,9 @@ class ShiftCalendarRenderer
return ShiftCalendarRenderer::SECONDS_PER_ROW * ceil(($end_time + ShiftCalendarRenderer::TIME_MARGIN) / ShiftCalendarRenderer::SECONDS_PER_ROW);
}
+ /**
+ * @return int
+ */
private function calcBlocksPerSlot()
{
return ceil(($this->getLastBlockEndTime() - $this->getFirstBlockStartTime()) / ShiftCalendarRenderer::SECONDS_PER_ROW);
@@ -257,6 +298,8 @@ class ShiftCalendarRenderer
/**
* Renders a legend explaining the shift coloring
+ *
+ * @return string
*/
private function renderLegend()
{
diff --git a/includes/view/ShiftCalendarShiftRenderer.php b/includes/view/ShiftCalendarShiftRenderer.php
index 64421637..1f6ceef8 100644
--- a/includes/view/ShiftCalendarShiftRenderer.php
+++ b/includes/view/ShiftCalendarShiftRenderer.php
@@ -7,14 +7,14 @@ namespace Engelsystem;
*/
class ShiftCalendarShiftRenderer
{
-
/**
* Renders a shift
*
- * @param Shift $shift
- * The shift to render
- * @param User $user
- * The user who is viewing the shift calendar
+ * @param array $shift The shift to render
+ * @param array $needed_angeltypes
+ * @param array $shift_entries
+ * @param array $user The user who is viewing the shift calendar
+ * @return array
*/
public function render($shift, $needed_angeltypes, $shift_entries, $user)
{
@@ -53,6 +53,10 @@ class ShiftCalendarShiftRenderer
];
}
+ /**
+ * @param ShiftSignupState $shiftSignupState
+ * @return string
+ */
private function classForSignupState(ShiftSignupState $shiftSignupState)
{
switch ($shiftSignupState->getState()) {
@@ -72,9 +76,18 @@ class ShiftCalendarShiftRenderer
case ShiftSignupState::FREE:
return 'danger';
+ default:
+ return '';
}
}
+ /**
+ * @param array $shift
+ * @param array[] $needed_angeltypes
+ * @param array[] $shift_entries
+ * @param array $user
+ * @return array
+ */
private function renderShiftNeededAngeltypes($shift, $needed_angeltypes, $shift_entries, $user)
{
global $privileges;
@@ -88,6 +101,7 @@ class ShiftCalendarShiftRenderer
}
$html = "";
+ /** @var ShiftSignupState $shift_signup_state */
$shift_signup_state = null;
foreach ($needed_angeltypes as $angeltype) {
if ($angeltype['count'] > 0 || count($shift_entries_filtered[$angeltype['id']]) > 0) {
@@ -131,12 +145,12 @@ class ShiftCalendarShiftRenderer
/**
* Renders a list entry containing the needed angels for an angeltype
*
- * @param Shift $shift
- * The shift which is rendered
- * @param Angeltype $angeltype
- * The angeltype, containing informations about needed angeltypes and already signed up angels
- * @param User $user
- * The user who is viewing the shift calendar
+ * @param array $shift The shift which is rendered
+ * @param array[] $shift_entries
+ * @param array[] $angeltype The angeltype, containing informations about needed angeltypes
+ * and already signed up angels
+ * @param array $user The user who is viewing the shift calendar
+ * @return array
*/
private function renderShiftNeededAngeltype($shift, $shift_entries, $angeltype, $user)
{
@@ -150,6 +164,7 @@ class ShiftCalendarShiftRenderer
ngettext("%d helper needed", "%d helpers needed", $shift_signup_state->getFreeEntries()),
$shift_signup_state->getFreeEntries()
);
+
switch ($shift_signup_state->getState()) {
case ShiftSignupState::ADMIN:
case ShiftSignupState::FREE:
@@ -207,8 +222,8 @@ class ShiftCalendarShiftRenderer
/**
* Renders the shift header
*
- * @param Shift $shift
- * The shift
+ * @param array $shift The shift
+ * @return string
*/
private function renderShiftHead($shift)
{
diff --git a/includes/view/ShiftEntry_view.php b/includes/view/ShiftEntry_view.php
index 592dc99c..92fb1528 100644
--- a/includes/view/ShiftEntry_view.php
+++ b/includes/view/ShiftEntry_view.php
@@ -9,7 +9,9 @@
* @param string $title
* @param string $type
* @param string $comment
- *
+ * @param bool $freeloaded
+ * @param string $freeload_comment
+ * @param bool $user_admin_shifts
* @return string
*/
function ShiftEntry_edit_view(
diff --git a/includes/view/ShiftTypes_view.php b/includes/view/ShiftTypes_view.php
index 827eec4d..e5064388 100644
--- a/includes/view/ShiftTypes_view.php
+++ b/includes/view/ShiftTypes_view.php
@@ -1,5 +1,9 @@
<?php
+/**
+ * @param array $shifttype
+ * @return string
+ */
function ShiftType_name_render($shifttype)
{
global $privileges;
@@ -9,6 +13,10 @@ function ShiftType_name_render($shifttype)
return $shifttype['name'];
}
+/**
+ * @param array $shifttype
+ * @return string
+ */
function ShiftType_delete_view($shifttype)
{
return page_with_title(sprintf(_("Delete shifttype %s"), $shifttype['name']), [
@@ -24,6 +32,14 @@ function ShiftType_delete_view($shifttype)
]);
}
+/**
+ * @param string $name
+ * @param int $angeltype_id
+ * @param array[] $angeltypes
+ * @param string $description
+ * @param int|bool $shifttype_id
+ * @return string
+ */
function ShiftType_edit_view($name, $angeltype_id, $angeltypes, $description, $shifttype_id)
{
$angeltypes_select = [
@@ -48,6 +64,11 @@ function ShiftType_edit_view($name, $angeltype_id, $angeltypes, $description, $s
]);
}
+/**
+ * @param array $shifttype
+ * @param array $angeltype
+ * @return string
+ */
function ShiftType_view($shifttype, $angeltype)
{
$parsedown = new Parsedown();
@@ -75,6 +96,10 @@ function ShiftType_view($shifttype, $angeltype)
]);
}
+/**
+ * @param array[] $shifttypes
+ * @return string
+ */
function ShiftTypes_list_view($shifttypes)
{
foreach ($shifttypes as &$shifttype) {
diff --git a/includes/view/ShiftsFilterRenderer.php b/includes/view/ShiftsFilterRenderer.php
index 81c75e55..051843c2 100644
--- a/includes/view/ShiftsFilterRenderer.php
+++ b/includes/view/ShiftsFilterRenderer.php
@@ -4,7 +4,6 @@ namespace Engelsystem;
class ShiftsFilterRenderer
{
-
/**
* The shiftFilter to render.
*
@@ -27,6 +26,11 @@ class ShiftsFilterRenderer
*/
private $days = [];
+ /**
+ * ShiftsFilterRenderer constructor.
+ *
+ * @param ShiftsFilter $shiftsFilter
+ */
public function __construct(ShiftsFilter $shiftsFilter)
{
$this->shiftsFilter = $shiftsFilter;
@@ -35,7 +39,8 @@ class ShiftsFilterRenderer
/**
* Renders the filter.
*
- * @return Generated HTML
+ * @param string $link_base
+ * @return string Generated HTML
*/
public function render($link_base)
{
@@ -55,6 +60,8 @@ class ShiftsFilterRenderer
/**
* Should the filter display a day selection.
+ *
+ * @param string[] $days
*/
public function enableDaySelection($days)
{
@@ -64,6 +71,8 @@ class ShiftsFilterRenderer
/**
* Should the filter display a day selection.
+ *
+ * @return bool
*/
public function isDaySelectionEnabled()
{
diff --git a/includes/view/Shifts_view.php b/includes/view/Shifts_view.php
index f091829f..41fde1e6 100644
--- a/includes/view/Shifts_view.php
+++ b/includes/view/Shifts_view.php
@@ -1,6 +1,10 @@
<?php
use Engelsystem\ShiftSignupState;
+/**
+ * @param array $shift
+ * @return string
+ */
function Shift_editor_info_render($shift)
{
$info = [];
@@ -21,6 +25,12 @@ function Shift_editor_info_render($shift)
return join('<br />', $info);
}
+/**
+ * @param array $shift
+ * @param array $angeltype
+ * @param array $user_angeltype
+ * @return string
+ */
function Shift_signup_button_render($shift, $angeltype, $user_angeltype = null)
{
global $user;
@@ -44,6 +54,14 @@ function Shift_signup_button_render($shift, $angeltype, $user_angeltype = null)
return '';
}
+/**
+ * @param array $shift
+ * @param array $shifttype
+ * @param array $room
+ * @param array[] $angeltypes_source
+ * @param ShiftSignupState $shift_signup_state
+ * @return string
+ */
function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupState $shift_signup_state)
{
global $privileges;
@@ -122,6 +140,13 @@ function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupSt
);
}
+/**
+ * @param array $needed_angeltype
+ * @param array $angeltypes
+ * @param array[] $shift
+ * @param bool $user_shift_admin
+ * @return string
+ */
function Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shift, $user_shift_admin)
{
global $user;
@@ -166,11 +191,17 @@ function Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shi
return $needed_angels;
}
+/**
+ * @param array $shift_entry
+ * @param bool $user_shift_admin
+ * @param bool $angeltype_supporter
+ * @return string
+ */
function Shift_view_render_shift_entry($shift_entry, $user_shift_admin, $angeltype_supporter)
{
$entry = User_Nick_render(User($shift_entry['UID']));
if ($shift_entry['freeloaded']) {
- $entry = '<strike>' . $entry . '</strike>';
+ $entry = '<del>' . $entry . '</del>';
}
if ($user_shift_admin || $angeltype_supporter) {
$entry .= ' <div class="btn-group">';
@@ -190,7 +221,8 @@ function Shift_view_render_shift_entry($shift_entry, $user_shift_admin, $angelty
/**
* Calc shift length in format 12:23h.
*
- * @param Shift $shift
+ * @param array $shift
+ * @return string
*/
function shift_length($shift)
{
diff --git a/includes/view/UserAngelTypes_view.php b/includes/view/UserAngelTypes_view.php
index bef07720..9f978bc7 100644
--- a/includes/view/UserAngelTypes_view.php
+++ b/includes/view/UserAngelTypes_view.php
@@ -1,5 +1,12 @@
<?php
+/**
+ * @param array $user_angeltype
+ * @param array $user
+ * @param array $angeltype
+ * @param bool $supporter
+ * @return string
+ */
function UserAngelType_update_view($user_angeltype, $user, $angeltype, $supporter)
{
return page_with_title($supporter ? _("Add supporter rights") : _("Remove supporter rights"), [
@@ -25,6 +32,10 @@ function UserAngelType_update_view($user_angeltype, $user, $angeltype, $supporte
]);
}
+/**
+ * @param array $angeltype
+ * @return string
+ */
function UserAngelTypes_delete_all_view($angeltype)
{
return page_with_title(_("Deny all users"), [
@@ -41,6 +52,10 @@ function UserAngelTypes_delete_all_view($angeltype)
]);
}
+/**
+ * @param array $angeltype
+ * @return string
+ */
function UserAngelTypes_confirm_all_view($angeltype)
{
return page_with_title(_("Confirm all users"), [
@@ -57,6 +72,12 @@ function UserAngelTypes_confirm_all_view($angeltype)
]);
}
+/**
+ * @param array $user_angeltype
+ * @param array $user
+ * @param array $angeltype
+ * @return string
+ */
function UserAngelType_confirm_view($user_angeltype, $user, $angeltype)
{
return page_with_title(_("Confirm angeltype for user"), [
@@ -73,6 +94,12 @@ function UserAngelType_confirm_view($user_angeltype, $user, $angeltype)
]);
}
+/**
+ * @param array $user_angeltype
+ * @param array $user
+ * @param array $angeltype
+ * @return string
+ */
function UserAngelType_delete_view($user_angeltype, $user, $angeltype)
{
return page_with_title(_("Remove angeltype"), [
@@ -89,6 +116,12 @@ function UserAngelType_delete_view($user_angeltype, $user, $angeltype)
]);
}
+/**
+ * @param array $angeltype
+ * @param array[] $users_source
+ * @param int $user_id
+ * @return string
+ */
function UserAngelType_add_view($angeltype, $users_source, $user_id)
{
$users = [];
@@ -109,6 +142,11 @@ function UserAngelType_add_view($angeltype, $users_source, $user_id)
]);
}
+/**
+ * @param array $user
+ * @param array $angeltype
+ * @return string
+ */
function UserAngelType_join_view($user, $angeltype)
{
return page_with_title(sprintf(_("Become a %s"), $angeltype['name']), [
diff --git a/includes/view/UserDriverLicenses_view.php b/includes/view/UserDriverLicenses_view.php
index 5b203c9c..3241ade5 100644
--- a/includes/view/UserDriverLicenses_view.php
+++ b/includes/view/UserDriverLicenses_view.php
@@ -3,12 +3,9 @@
/**
* Edit a user's driving license information.
*
- * @param User $user_source
- * The user
- * @param bool $wants_to_drive
- * true, if the user wants to drive
- * @param UserDriverLicense $user_driver_license
- * The user driver license
+ * @param array $user_source The user
+ * @param bool $wants_to_drive true, if the user wants to drive
+ * @param array $user_driver_license The user driver license
* @return string
*/
function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver_license)
@@ -52,13 +49,14 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
]),
'<script type="text/javascript">
$(function() {
- if($("#wants_to_drive").is(":checked"))
+ var checkbox = $("#wants_to_drive");
+ if(checkbox.is(":checked"))
$("#driving_license").show();
else
$("#driving_license").hide();
- $("#wants_to_drive").click(
- function(e) {
+ checkbox.click(
+ function() {
if($("#wants_to_drive").is(":checked"))
$("#driving_license").show();
else
diff --git a/includes/view/UserHintsRenderer.php b/includes/view/UserHintsRenderer.php
index cd0f568a..aac8ecfd 100644
--- a/includes/view/UserHintsRenderer.php
+++ b/includes/view/UserHintsRenderer.php
@@ -4,12 +4,15 @@ namespace Engelsystem;
class UserHintsRenderer
{
+ /** @var string[] */
private $hints = [];
private $important = false;
/**
* Render the added hints to a popover for the toolbar.
+ *
+ * @return string
*/
public function render()
{
@@ -26,10 +29,8 @@ class UserHintsRenderer
/**
* Add a hint to the list, if its not null and a not empty string.
*
- * @param string $hint
- * The hint
- * @param boolean $important
- * Is the hint important?
+ * @param string $hint The hint
+ * @param boolean $important Is the hint important?
*/
public function addHint($hint, $important = false)
{
@@ -45,6 +46,8 @@ class UserHintsRenderer
/**
* Get all hints.
+ *
+ * @return string[]
*/
public function getHints()
{
@@ -53,6 +56,8 @@ class UserHintsRenderer
/**
* Are there important hints? This leads to a more intensive icon.
+ *
+ * @return bool
*/
public function isImportant()
{
diff --git a/includes/view/User_view.php b/includes/view/User_view.php
index 984ff535..5457e573 100644
--- a/includes/view/User_view.php
+++ b/includes/view/User_view.php
@@ -22,12 +22,14 @@ $tshirt_sizes = [
/**
* Renders user settings page
*
- * @param User $user_source
- * The user
- * @param array <String> $locales
- * Available languages
- * @param array <String> $themes
- * Available themes
+ * @param array $user_source The user
+ * @param array $locales Available languages
+ * @param array $themes Available themes
+ * @param int $buildup_start_date Unix timestamp
+ * @param int $teardown_end_date Unix timestamp
+ * @param bool $enable_tshirt_size
+ * @param array $tshirt_sizes
+ * @return string
*/
function User_settings_view(
$user_source,
@@ -52,7 +54,8 @@ function User_settings_view(
'planned_arrival_date',
_("Planned date of arrival") . ' ' . entry_required(),
$user_source['planned_arrival_date'],
- $buildup_start_date, $teardown_end_date
+ $buildup_start_date,
+ $teardown_end_date
),
form_date(
'planned_departure_date',
@@ -113,6 +116,9 @@ function User_settings_view(
/**
* Displays the welcome message to the user and shows a login form.
+ *
+ * @param string $event_welcome_message
+ * @return string
*/
function User_registration_success_view($event_welcome_message)
{
@@ -149,6 +155,9 @@ function User_registration_success_view($event_welcome_message)
/**
* Gui for deleting user with password field.
+ *
+ * @param array $user
+ * @return string
*/
function User_delete_view($user)
{
@@ -170,6 +179,9 @@ function User_delete_view($user)
/**
* View for editing the number of given vouchers
+ *
+ * @param array $user
+ * @return string
*/
function User_edit_vouchers_view($user)
{
@@ -186,6 +198,17 @@ function User_edit_vouchers_view($user)
]);
}
+/**
+ * @param array[] $users
+ * @param string $order_by
+ * @param int $arrived_count
+ * @param int $active_count
+ * @param int $force_active_count
+ * @param int $freeloads_count
+ * @param int $tshirts_count
+ * @param int $voucher_count
+ * @return string
+ */
function Users_view(
$users,
$order_by,
@@ -199,7 +222,6 @@ function Users_view(
foreach ($users as &$user) {
$user['Nick'] = User_Nick_render($user);
$user['Gekommen'] = glyph_bool($user['Gekommen']);
- $user['got_voucher'] = $user['got_voucher'];
$user['Aktiv'] = glyph_bool($user['Aktiv']);
$user['force_active'] = glyph_bool($user['force_active']);
$user['Tshirt'] = glyph_bool($user['Tshirt']);
@@ -242,11 +264,21 @@ function Users_view(
]);
}
+/**
+ * @param string $column
+ * @param string $label
+ * @param string $order_by
+ * @return string
+ */
function Users_table_header_link($column, $label, $order_by)
{
return '<a href="' . page_link_to('users') . '&OrderBy=' . $column . '">' . $label . ($order_by == $column ? ' <span class="caret"></span>' : '') . '</a>';
}
+/**
+ * @param array $user
+ * @return string|false
+ */
function User_shift_state_render($user)
{
$upcoming_shifts = ShiftEntries_upcoming_for_user($user);
@@ -272,6 +304,10 @@ function User_shift_state_render($user)
return '<span class="text-danger moment-countdown" data-timestamp="' . $upcoming_shifts[0]['end'] . '">' . _("Shift ends %c") . '</span>';
}
+/**
+ * @param array $needed_angel_type
+ * @return string
+ */
function User_view_shiftentries($needed_angel_type)
{
$shift_info = '<br><b>' . $needed_angel_type['name'] . ':</b> ';
@@ -280,7 +316,7 @@ function User_view_shiftentries($needed_angel_type)
foreach ($needed_angel_type['users'] as $user_shift) {
$member = User_Nick_render($user_shift);
if ($user_shift['freeloaded']) {
- $member = '<strike>' . $member . '</strike>';
+ $member = '<del>' . $member . '</del>';
}
$shift_entries[] = $member;
@@ -292,10 +328,15 @@ function User_view_shiftentries($needed_angel_type)
/**
* Helper that renders a shift line for user view
+ *
+ * @param array $shift
+ * @param array $user_source
+ * @param bool $its_me
+ * @return array
*/
function User_view_myshift($shift, $user_source, $its_me)
{
- global $LETZTES_AUSTRAGEN, $privileges;
+ global $last_unsubscribe, $privileges;
$shift_info = '<a href="' . shift_link($shift) . '">' . $shift['name'] . '</a>';
if ($shift['title']) {
@@ -331,7 +372,7 @@ function User_view_myshift($shift, $user_source, $its_me)
'btn-xs'
);
}
- if (($shift['start'] > time() + $LETZTES_AUSTRAGEN * 3600) || in_array('user_shifts_admin', $privileges)) {
+ if (($shift['start'] > time() + $last_unsubscribe * 3600) || in_array('user_shifts_admin', $privileges)) {
$myshift['actions'][] = button(
page_link_to('user_myshifts') . ((!$its_me) ? '&id=' . $user_source['UID'] : '') . '&cancel=' . $shift['id'],
glyph('trash') . _('sign off'),
@@ -345,6 +386,11 @@ function User_view_myshift($shift, $user_source, $its_me)
/**
* Helper that prepares the shift table for user view
+ *
+ * @param array[] $shifts
+ * @param array $user_source
+ * @param bool $its_me
+ * @return array
*/
function User_view_myshifts($shifts, $user_source, $its_me)
{
@@ -375,6 +421,15 @@ function User_view_myshifts($shifts, $user_source, $its_me)
/**
* Renders view for a single user
+ *
+ * @param array $user_source
+ * @param bool $admin_user_privilege
+ * @param bool $freeloader
+ * @param array[] $user_angeltypes
+ * @param array[] $user_groups
+ * @param array[] $shifts
+ * @param bool $its_me
+ * @return string
*/
function User_view($user_source, $admin_user_privilege, $freeloader, $user_angeltypes, $user_groups, $shifts, $its_me)
{
@@ -489,11 +544,14 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
page_link_to('user_shifts')
), true)
: ''
- ]);
+ ]
+ );
}
/**
* View for password recovery step 1: E-Mail
+ *
+ * @return string
*/
function User_password_recovery_view()
{
@@ -509,6 +567,8 @@ function User_password_recovery_view()
/**
* View for password recovery step 2: New password
+ *
+ * @return string
*/
function User_password_set_view()
{
@@ -523,25 +583,27 @@ function User_password_set_view()
]);
}
+/**
+ * @param array[] $user_angeltypes
+ * @return string
+ */
function User_angeltypes_render($user_angeltypes)
{
$output = [];
foreach ($user_angeltypes as $angeltype) {
- $class = "";
- if ($angeltype['restricted'] == 1) {
- if ($angeltype['confirm_user_id'] != null) {
- $class = 'text-success';
- } else {
- $class = 'text-warning';
- }
- } else {
- $class = 'text-success';
+ $class = 'text-success';
+ if ($angeltype['restricted'] == 1 && $angeltype['confirm_user_id'] == null) {
+ $class = 'text-warning';
}
$output[] = '<a href="' . angeltype_link($angeltype['id']) . '" class="' . $class . '">' . ($angeltype['supporter'] ? glyph('education') : '') . $angeltype['name'] . '</a>';
}
return join('<br />', $output);
}
+/**
+ * @param array[] $user_groups
+ * @return string
+ */
function User_groups_render($user_groups)
{
$output = [];
@@ -554,14 +616,19 @@ function User_groups_render($user_groups)
/**
* Render a user nickname.
*
- * @param User $user_source
+ * @param array $user_source
* @return string
*/
function User_Nick_render($user_source)
{
- return '<a class="' . ($user_source['Gekommen'] ? '' : 'text-muted') . '" href="' . page_link_to('users') . '&amp;action=view&amp;user_id=' . $user_source['UID'] . '"><span class="icon-icon_angel"></span> ' . htmlspecialchars($user_source['Nick']) . '</a>';
+ return '<a class="' . ($user_source['Gekommen'] ? '' : 'text-muted') . '" href="'
+ . page_link_to('users') . '&amp;action=view&amp;user_id=' . $user_source['UID']
+ . '"><span class="icon-icon_angel"></span> ' . htmlspecialchars($user_source['Nick']) . '</a>';
}
+/**
+ * @return string|null
+ */
function render_user_departure_date_hint()
{
global $user;
@@ -573,6 +640,9 @@ function render_user_departure_date_hint()
return null;
}
+/**
+ * @return string|null
+ */
function render_user_freeloader_hint()
{
global $user, $max_freeloadable_shifts;
@@ -587,7 +657,11 @@ function render_user_freeloader_hint()
return null;
}
-// Hinweis für Engel, die noch nicht angekommen sind
+/**
+ * Hinweis für Engel, die noch nicht angekommen sind
+ *
+ * @return string|null
+ */
function render_user_arrived_hint()
{
global $user;
@@ -599,6 +673,9 @@ function render_user_arrived_hint()
return null;
}
+/**
+ * @return string|null
+ */
function render_user_tshirt_hint()
{
global $enable_tshirt_size, $user;
@@ -610,6 +687,9 @@ function render_user_tshirt_hint()
return null;
}
+/**
+ * @return string|null
+ */
function render_user_dect_hint()
{
global $user;