summaryrefslogtreecommitdiff
path: root/includes/view/UserWorkLog_view.php
diff options
context:
space:
mode:
authormarudor <marudor@marudor.de>2018-01-03 01:19:36 +0100
committermarudor <marudor@marudor.de>2018-01-03 01:19:36 +0100
commit7af09433def2fda9ec47b12823b16e3392b5f6cf (patch)
tree5ee8e0fdf80cd92609263d28e9ae6e6bc3efeea7 /includes/view/UserWorkLog_view.php
parent7f722314e4fc21419552ec27eb91e6f7e6347b71 (diff)
parentddadaada9dc1bd288c82da840a4c4f02767d3e43 (diff)
Merge branch 'master' of https://github.com/engelsystem/engelsystem
Diffstat (limited to 'includes/view/UserWorkLog_view.php')
-rw-r--r--includes/view/UserWorkLog_view.php96
1 files changed, 96 insertions, 0 deletions
diff --git a/includes/view/UserWorkLog_view.php b/includes/view/UserWorkLog_view.php
new file mode 100644
index 00000000..79c049b3
--- /dev/null
+++ b/includes/view/UserWorkLog_view.php
@@ -0,0 +1,96 @@
+<?php
+
+/**
+ * Delete work log entry.
+ * @param User $user_source
+ * @param UserWorkLog $userWorkLog
+ */
+function UserWorkLog_delete_view($user_source, $userWorkLog)
+{
+ return page_with_title(UserWorkLog_delete_title(), [
+ info(sprintf(_('Do you want to delete the worklog entry for %s?'), User_Nick_render($user_source)), true),
+ buttons([
+ button(user_link($user_source), glyph('remove') . _('cancel')),
+ button(user_worklog_delete_link($userWorkLog, [
+ 'confirmed' => 1
+ ]), glyph('ok') . _('delete'), 'btn-danger')
+ ])
+ ]);
+}
+
+/**
+ * Title for work log delete.
+ */
+function UserWorkLog_delete_title()
+{
+ return _('Delete work log entry');
+}
+
+/**
+ * Render edit table.
+ *
+ * @param User $user_source
+ * @param UserWorkLog $userWorkLog
+ */
+function UserWorkLog_edit_form($user_source, $userWorkLog)
+{
+ return form([
+ form_info(_('User'), User_Nick_render($user_source)),
+ form_date('work_timestamp', _('Work date'), $userWorkLog['work_timestamp'], null, time()),
+ form_text('work_hours', _('Work hours'), $userWorkLog['work_hours']),
+ form_text('comment', _('Comment'), $userWorkLog['comment']),
+ form_submit('submit', _('Save'))
+ ]);
+}
+
+/**
+ * Form for edit a user work log entry.
+ *
+ * @param User $user_source
+ * @param UserWorkLog $userWorkLog
+ */
+function UserWorkLog_edit_view($user_source, $userWorkLog)
+{
+ return page_with_title(UserWorkLog_edit_title(), [
+ buttons([
+ button(user_link($user_source), _('back'))
+ ]),
+ msg(),
+ UserWorkLog_edit_form($user_source, $userWorkLog)
+ ]);
+}
+
+/**
+ * Form for adding a user work log entry.
+ *
+ * @param User $user_source
+ * @param UserWorkLog $userWorkLog
+ */
+function UserWorkLog_add_view($user_source, $userWorkLog)
+{
+ return page_with_title(UserWorkLog_add_title(), [
+ buttons([
+ button(user_link($user_source), _('back'))
+ ]),
+ msg(),
+ UserWorkLog_edit_form($user_source, $userWorkLog)
+ ]);
+}
+
+/**
+ * Title text for editing work log entry.
+ */
+function UserWorkLog_edit_title()
+{
+ return _('Edit work log entry');
+}
+
+/**
+ * Title text for adding work log entry.
+ */
+function UserWorkLog_add_title()
+{
+ return _('Add work log entry');
+}
+
+?> \ No newline at end of file