summaryrefslogtreecommitdiff
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
parent7f722314e4fc21419552ec27eb91e6f7e6347b71 (diff)
parentddadaada9dc1bd288c82da840a4c4f02767d3e43 (diff)
Merge branch 'master' of https://github.com/engelsystem/engelsystem
-rw-r--r--db/update.sql8
-rw-r--r--includes/controller/user_worklog_controller.php195
-rw-r--r--includes/controller/users_controller.php6
-rw-r--r--includes/includes.php3
-rw-r--r--includes/model/UserWorkLog_model.php123
-rw-r--r--includes/model/User_model.php14
-rw-r--r--includes/pages/admin_active.php42
-rw-r--r--includes/pages/user_shifts.php16
-rw-r--r--includes/view/PublicDashboard_view.php2
-rw-r--r--includes/view/UserWorkLog_view.php96
-rw-r--r--includes/view/User_view.php67
-rw-r--r--locale/de_DE.UTF-8/LC_MESSAGES/default.mobin43833 -> 44974 bytes
-rw-r--r--locale/de_DE.UTF-8/LC_MESSAGES/default.po289
-rw-r--r--public/index.php4
14 files changed, 719 insertions, 146 deletions
diff --git a/db/update.sql b/db/update.sql
index 212cd97e..56663071 100644
--- a/db/update.sql
+++ b/db/update.sql
@@ -49,3 +49,11 @@ ALTER TABLE `Room` ADD `description` TEXT NULL AFTER `map_url`;
-- Dashboard
ALTER TABLE `AngelTypes` ADD `show_on_dashboard` BOOLEAN NOT NULL AFTER `contact_email`;
UPDATE `AngelTypes` SET `show_on_dashboard` = TRUE;
+
+-- Work Log
+CREATE TABLE `UserWorkLog` ( `id` INT NOT NULL AUTO_INCREMENT , `user_id` INT NOT NULL , `work_hours` DECIMAL NOT NULL , `comment` VARCHAR(200) NOT NULL , `created_user_id` INT NOT NULL , `created_timestamp` INT NOT NULL , PRIMARY KEY (`id`), INDEX (`user_id`), INDEX (`created_user_id`)) ENGINE = InnoDB;
+ALTER TABLE `UserWorkLog` ADD FOREIGN KEY (`created_user_id`) REFERENCES `User`(`UID`) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE `UserWorkLog` ADD FOREIGN KEY (`user_id`) REFERENCES `User`(`UID`) ON DELETE CASCADE ON UPDATE CASCADE;
+ALTER TABLE `UserWorkLog` ADD INDEX(`created_timestamp`);
+INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (NULL, 'admin_user_worklog', 'Manage user work log entries.');
+ALTER TABLE `UserWorkLog` CHANGE `work_hours` `work_hours` DECIMAL(10,2) NOT NULL;
+ALTER TABLE `UserWorkLog` ADD `work_timestamp` INT NOT NULL AFTER `user_id`;
diff --git a/includes/controller/user_worklog_controller.php b/includes/controller/user_worklog_controller.php
new file mode 100644
index 00000000..bd62c83c
--- /dev/null
+++ b/includes/controller/user_worklog_controller.php
@@ -0,0 +1,195 @@
+<?php
+
+/**
+ * Delete a work log entry.
+ */
+function user_worklog_delete_controller()
+{
+ global $user;
+
+ $request = request();
+ $userWorkLog = UserWorkLog($request->input('user_worklog_id'));
+ if (empty($userWorkLog)) {
+ redirect(user_link($user));
+ }
+ $user_source = User($userWorkLog['user_id']);
+
+ if ($request->has('confirmed')) {
+ UserWorkLog_delete($userWorkLog);
+
+ success(_('Work log entry deleted.'));
+ redirect(user_link($user_source));
+ }
+
+ return [
+ UserWorkLog_delete_title(),
+ UserWorkLog_delete_view($user_source, $userWorkLog)
+ ];
+}
+
+/**
+ * Edit work log for user.
+ */
+function user_worklog_edit_controller()
+{
+ global $user;
+
+ $request = request();
+ $userWorkLog = UserWorkLog($request->input('user_worklog_id'));
+ if (empty($userWorkLog)) {
+ redirect(user_link($user));
+ }
+ $user_source = User($userWorkLog['user_id']);
+
+ if ($request->has('submit')) {
+ list ($valid, $userWorkLog) = user_worklog_from_request($userWorkLog);
+
+ if ($valid) {
+ UserWorkLog_update($userWorkLog);
+
+ success(_('Work log entry updated.'));
+ redirect(user_link($user_source));
+ }
+ }
+
+ return [
+ UserWorkLog_edit_title(),
+ UserWorkLog_edit_view($user_source, $userWorkLog)
+ ];
+}
+
+/**
+ *
+ * @param UserWorkLog $userWorkLog
+ * @return [bool $valid, UserWorkLog $userWorkLog]
+ */
+function user_worklog_from_request($userWorkLog)
+{
+ $request = request();
+
+ $valid = true;
+
+ $userWorkLog['work_timestamp'] = parse_date('Y-m-d H:i', $request->input('work_timestamp') . ' 00:00');
+ if ($userWorkLog['work_timestamp'] == null) {
+ $valid = false;
+ error(_('Please enter work date.'));
+ }
+
+ $userWorkLog['work_hours'] = $request->input('work_hours');
+ if (! preg_match("/[0-9]+(\.[0-9]+)?/", $userWorkLog['work_hours'])) {
+ $valid = false;
+ error(_('Please enter work hours in format ##[.##].'));
+ }
+
+ $userWorkLog['comment'] = $request->input('comment');
+ if (empty($userWorkLog['comment'])) {
+ $valid = false;
+ error(_('Please enter a comment.'));
+ }
+
+ return [
+ $valid,
+ $userWorkLog
+ ];
+}
+
+/**
+ * Add work log entry to user.
+ */
+function user_worklog_add_controller()
+{
+ global $user;
+
+ $request = request();
+ $user_source = User($request->input('user_id'));
+ if (empty($user_source)) {
+ redirect(user_link($user));
+ }
+
+ $userWorkLog = UserWorkLog_new($user_source);
+
+ if ($request->has('submit')) {
+ list ($valid, $userWorkLog) = user_worklog_from_request($userWorkLog);
+
+ if ($valid) {
+ UserWorkLog_create($userWorkLog);
+
+ success(_('Work log entry created.'));
+ redirect(user_link($user_source));
+ }
+ }
+
+ return [
+ UserWorkLog_add_title(),
+ UserWorkLog_add_view($user_source, $userWorkLog)
+ ];
+}
+
+/**
+ * Link to work log entry add for given user.
+ *
+ * @param User $user
+ */
+function user_worklog_add_link($user)
+{
+ return page_link_to('user_worklog', [
+ 'action' => 'add',
+ 'user_id' => $user['UID']
+ ]);
+}
+
+/**
+ * Link to work log entry edit.
+ *
+ * @param UserWorkLog $userWorkLog
+ */
+function user_worklog_edit_link($userWorkLog)
+{
+ return page_link_to('user_worklog', [
+ 'action' => 'edit',
+ 'user_worklog_id' => $userWorkLog['id']
+ ]);
+}
+
+/**
+ * Link to work log entry delete.
+ *
+ * @param UserWorkLog $userWorkLog
+ * @param array[] $parameters
+ */
+function user_worklog_delete_link($userWorkLog, $parameters = [])
+{
+ return page_link_to('user_worklog', array_merge([
+ 'action' => 'delete',
+ 'user_worklog_id' => $userWorkLog['id']
+ ], $parameters));
+}
+
+/**
+ * Work log entry actions
+ */
+function user_worklogs_controller()
+{
+ global $user, $privileges;
+
+ if (! in_array('admin_user_worklog', $privileges)) {
+ redirect(user_link($user));
+ }
+
+ $request = request();
+ $action = $request->input('action');
+ if (! $request->has('action')) {
+ redirect(user_link($user));
+ }
+
+ switch ($action) {
+ case 'add':
+ return user_worklog_add_controller();
+ case 'edit':
+ return user_worklog_edit_controller();
+ case 'delete':
+ return user_worklog_delete_controller();
+ }
+}
+
+?> \ No newline at end of file
diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php
index a2a28410..8a325621 100644
--- a/includes/controller/users_controller.php
+++ b/includes/controller/users_controller.php
@@ -228,7 +228,7 @@ function user_controller()
if($user_source['force_active']) {
$tshirt_score = _('Enough');
} else {
- $tshirt_score = round(User_tshirt_score($user_source), 2) . ' h';
+ $tshirt_score = sprintf('%.2f', User_tshirt_score($user_source)) . '&nbsp;h';
}
return [
@@ -242,7 +242,9 @@ function user_controller()
$shifts,
$user['UID'] == $user_source['UID'],
$tshirt_score,
- in_array('admin_active', $privileges)
+ in_array('admin_active', $privileges),
+ in_array('admin_user_worklog', $privileges),
+ UserWorkLogsForUser($user_source)
)
];
}
diff --git a/includes/includes.php b/includes/includes.php
index e8e5ce29..e316e550 100644
--- a/includes/includes.php
+++ b/includes/includes.php
@@ -27,6 +27,7 @@ $includeFiles = [
__DIR__ . '/../includes/model/UserDriverLicenses_model.php',
__DIR__ . '/../includes/model/UserGroups_model.php',
__DIR__ . '/../includes/model/User_model.php',
+ __DIR__ . '/../includes/model/UserWorkLog_model.php',
__DIR__ . '/../includes/model/ValidationResult.php',
__DIR__ . '/../includes/view/AngelTypes_view.php',
@@ -45,6 +46,7 @@ $includeFiles = [
__DIR__ . '/../includes/view/UserDriverLicenses_view.php',
__DIR__ . '/../includes/view/UserHintsRenderer.php',
__DIR__ . '/../includes/view/User_view.php',
+ __DIR__ . '/../includes/view/UserWorkLog_view.php',
__DIR__ . '/../includes/controller/angeltypes_controller.php',
__DIR__ . '/../includes/controller/event_config_controller.php',
@@ -56,6 +58,7 @@ $includeFiles = [
__DIR__ . '/../includes/controller/users_controller.php',
__DIR__ . '/../includes/controller/user_angeltypes_controller.php',
__DIR__ . '/../includes/controller/user_driver_licenses_controller.php',
+ __DIR__ . '/../includes/controller/user_worklog_controller.php',
__DIR__ . '/../includes/helper/graph_helper.php',
__DIR__ . '/../includes/helper/internationalization_helper.php',
diff --git a/includes/model/UserWorkLog_model.php b/includes/model/UserWorkLog_model.php
new file mode 100644
index 00000000..36442943
--- /dev/null
+++ b/includes/model/UserWorkLog_model.php
@@ -0,0 +1,123 @@
+<?php
+use Engelsystem\Database\Db;
+
+/**
+ * Load a single work log entry.
+ *
+ * @param int $user_worklog_id
+ */
+function UserWorkLog($user_worklog_id)
+{
+ return Db::selectOne("SELECT * FROM `UserWorkLog` WHERE `id`=?", [
+ $user_worklog_id
+ ]);
+}
+
+/**
+ * Returns all work log entries for a user.
+ *
+ * @param User $user
+ */
+function UserWorkLogsForUser($user)
+{
+ return Db::select("SELECT * FROM `UserWorkLog` WHERE `user_id`=? ORDER BY `created_timestamp`", [
+ $user['UID']
+ ]);
+}
+
+/**
+ * Delete a work log entry.
+ *
+ * @param UserWorkLog $userWorkLog
+ */
+function UserWorkLog_delete($userWorkLog)
+{
+ $user_source = User($userWorkLog['user_id']);
+ $result = Db::delete("DELETE FROM `UserWorkLog` WHERE `id`=?", [
+ $userWorkLog['id']
+ ]);
+
+ engelsystem_log(sprintf('Delete work log for %s, %s hours, %s', User_Nick_render($user_source), $userWorkLog['work_hours'], $userWorkLog['comment']));
+
+ return $result;
+}
+
+/**
+ * Update work log entry (only work hours and comment)
+ *
+ * @param UserWorkLog $userWorkLog
+ */
+function UserWorkLog_update($userWorkLog)
+{
+ $user_source = User($userWorkLog['user_id']);
+
+ $result = Db::update("UPDATE `UserWorkLog` SET
+ `work_timestamp`=?,
+ `work_hours`=?,
+ `comment`=?
+ WHERE `id`=?", [
+ $userWorkLog['work_timestamp'],
+ $userWorkLog['work_hours'],
+ $userWorkLog['comment'],
+ $userWorkLog['id']
+ ]);
+
+ engelsystem_log(sprintf('Updated work log for %s, %s hours, %s', User_Nick_render($user_source), $userWorkLog['work_hours'], $userWorkLog['comment']));
+
+ return $result;
+}
+
+/**
+ * Create a new work log entry
+ *
+ * @param UserWorkLog $userWorkLog
+ */
+function UserWorkLog_create($userWorkLog)
+{
+ global $user;
+
+ $user_source = User($userWorkLog['user_id']);
+
+ $result = Db::insert("INSERT INTO `UserWorkLog` (
+ `user_id`,
+ `work_timestamp`,
+ `work_hours`,
+ `comment`,
+ `created_user_id`,
+ `created_timestamp`
+ )
+ VALUES (?, ?, ?, ?, ?, ?)", [
+ $userWorkLog['user_id'],
+ $userWorkLog['work_timestamp'],
+ $userWorkLog['work_hours'],
+ $userWorkLog['comment'],
+ $user['UID'],
+ time()
+ ]);
+
+ engelsystem_log(sprintf('Added work log entry for %s, %s hours, %s', User_Nick_render($user_source), $userWorkLog['work_hours'], $userWorkLog['comment']));
+
+ return $result;
+}
+
+/**
+ * New user work log entry
+ *
+ * @param array[] $user
+ */
+function UserWorkLog_new($user)
+{
+ $work_date = parse_date('Y-m-d H:i', date('Y-m-d 00:00', time()));
+ $event_config = EventConfig();
+ if (! empty($event_config['buildup_start_date'])) {
+ $work_date = parse_date('Y-m-d H:i', date('Y-m-d 00:00', $event_config['buildup_start_date']));
+ }
+ return [
+ 'user_id' => $user['UID'],
+ 'work_timestamp' => $work_date,
+ 'work_hours' => 0,
+ 'comment' => ''
+ ];
+}
+
+?> \ No newline at end of file
diff --git a/includes/model/User_model.php b/includes/model/User_model.php
index fa24aac1..5a31e7b8 100644
--- a/includes/model/User_model.php
+++ b/includes/model/User_model.php
@@ -26,7 +26,7 @@ function User_delete($user_id)
function User_tshirt_score($user) {
$shift_sum_formula = config('shift_sum_formula');
- $result = DB::selectOne('
+ $result_shifts = DB::selectOne('
SELECT ROUND((' . $shift_sum_formula . ') / 3600, 2) AS `tshirt_score`
FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID`
@@ -37,8 +37,18 @@ function User_tshirt_score($user) {
$user['UID'],
time()
]);
+ $result_worklog = DB::selectOne('
+ SELECT SUM(`work_hours`) AS `tshirt_score`
+ FROM `User`
+ LEFT JOIN `UserWorkLog` ON `User`.`UID` = `UserWorkLog`.`user_id`
+ WHERE `User`.`UID` = ?
+ AND `UserWorkLog`.`work_timestamp` < ?
+ ',[
+ $user['UID'],
+ time()
+ ]);
- return $result['tshirt_score'];
+ return $result_shifts['tshirt_score'] + $result_worklog['tshirt_score'];
}
/**
diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php
index 576cdc49..2616de6c 100644
--- a/includes/pages/admin_active.php
+++ b/includes/pages/admin_active.php
@@ -58,7 +58,10 @@ function admin_active()
SELECT
`User`.*,
COUNT(`ShiftEntry`.`id`) AS `shift_count`,
- %s AS `shift_length`
+ (%s + (
+ SELECT COALESCE(SUM(`work_hours`) * 3600, 0) FROM `UserWorkLog` WHERE `user_id`=`User`.`UID`
+ AND `work_timestamp` < %s
+ )) AS `shift_length`
FROM `User`
LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID`
@@ -69,6 +72,7 @@ function admin_active()
%s
',
$shift_sum_formula,
+ time(),
$limit
));
$user_nicks = [];
@@ -140,7 +144,10 @@ function admin_active()
SELECT
`User`.*,
COUNT(`ShiftEntry`.`id`) AS `shift_count`,
- %s AS `shift_length`
+ (%s + (
+ SELECT COALESCE(SUM(`work_hours`) * 3600, 0) FROM `UserWorkLog` WHERE `user_id`=`User`.`UID`
+ AND `work_timestamp` < %s
+ )) AS `shift_length`
FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` '
. ($show_all_shifts ? '' : 'AND (`Shifts`.`end` < ' . time() . " OR `Shifts`.`end` IS NULL)") . '
@@ -150,6 +157,7 @@ function admin_active()
%s
',
$shift_sum_formula,
+ time(),
$limit
));
$matched_users = [];
@@ -174,7 +182,7 @@ function admin_active()
$usr['nick'] = User_Nick_render($usr);
$usr['shirt_size'] = $tshirt_sizes[$usr['Size']];
$usr['work_time'] = round($usr['shift_length'] / 60)
- . ' min (' . round($usr['shift_length'] / 3600) . ' h)';
+ . ' min (' . sprintf('%.2f', $usr['shift_length'] / 3600) . '&nbsp;h)';
$usr['active'] = glyph_bool($usr['Aktiv'] == 1);
$usr['force_active'] = glyph_bool($usr['force_active'] == 1);
$usr['tshirt'] = glyph_bool($usr['Tshirt'] == 1);
@@ -192,22 +200,26 @@ function admin_active()
. _('set active')
. '</a>';
}
- if ($usr['Aktiv'] == 1 && $usr['Tshirt'] == 0) {
+ if ($usr['Aktiv'] == 1) {
$parametersRemove = [
'not_active' => $usr['UID'],
'search' => $search,
];
+ if ($show_all_shifts) {
+ $parametersRemove['show_all_shifts'] = 1;
+ }
+ $actions[] = '<a href="' . page_link_to('admin_active', $parametersRemove) . '">'
+ . _('remove active')
+ . '</a>';
+ }
+ if ($usr['Tshirt'] == 0) {
$parametersShirt = [
'tshirt' => $usr['UID'],
'search' => $search,
];
if ($show_all_shifts) {
- $parametersRemove['show_all_shifts'] = 1;
$parametersShirt['show_all_shifts'] = 1;
}
- $actions[] = '<a href="' . page_link_to('admin_active', $parametersRemove) . '">'
- . _('remove active')
- . '</a>';
$actions[] = '<a href="' . page_link_to('admin_active', $parametersShirt) . '">'
. _('got t-shirt')
. '</a>';
@@ -233,12 +245,6 @@ function admin_active()
$shirt_statistics = [];
foreach (array_keys($tshirt_sizes) as $size) {
if (!empty($size)) {
- $sc = DB::selectOne(
- 'SELECT count(*) FROM `User` WHERE `Size`=? AND `Gekommen`=1',
- [$size]
- );
- $sc = array_shift($sc);
-
$gc = DB::selectOne(
'SELECT count(*) FROM `User` WHERE `Size`=? AND `Tshirt`=1',
[$size]
@@ -247,19 +253,16 @@ function admin_active()
$shirt_statistics[] = [
'size' => $size,
- 'needed' => (int)$sc,
'given' => (int)$gc
];
}
}
- $shirtCount = DB::selectOne('SELECT count(*) FROM `User` WHERE `Tshirt`=1');
- $shirtCount = array_shift($shirtCount);
+ $shirtCount = User_tshirts_count();
$shirt_statistics[] = [
'size' => '<b>' . _('Sum') . '</b>',
- 'needed' => '<b>' . User_arrived_count() . '</b>',
- 'given' => '<b>' . (int)$shirtCount . '</b>'
+ 'given' => '<b>' . $shirtCount . '</b>'
];
return page_with_title(admin_active_title(), [
@@ -286,7 +289,6 @@ function admin_active()
'<h2>' . _('Shirt statistics') . '</h2>',
table([
'size' => _('Size'),
- 'needed' => _('Needed shirts'),
'given' => _('Given shirts')
], $shirt_statistics)
]);
diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php
index 0be4aa67..81b405b1 100644
--- a/includes/pages/user_shifts.php
+++ b/includes/pages/user_shifts.php
@@ -313,11 +313,19 @@ function get_ids_from_array($array)
*/
function make_select($items, $selected, $name, $title = null, $additionalButtons = [])
{
+ $html = '';
$htmlItems = [];
if (isset($title)) {
- $htmlItems[] = '<h4>' . $title . '</h4>' . "\n";
+ $html .= '<h4>' . $title . '</h4>' . "\n";
}
+ $buttons = [];
+ $buttons[] = button('javascript: checkAll(\'selection_' . $name . '\', true)', _('All'));
+ $buttons[] = button('javascript: checkAll(\'selection_' . $name . '\', false)', _('None'));
+ $buttons = array_merge($buttons, $additionalButtons);
+
+ $html .= buttons($buttons);
+
foreach ($items as $i) {
$htmlItems[] = '<div class="checkbox">'
. '<label><input type="checkbox" name="' . $name . '[]" value="' . $i['id'] . '" '
@@ -326,13 +334,9 @@ function make_select($items, $selected, $name, $title = null, $additionalButtons
. (!isset($i['enabled']) || $i['enabled'] ? '' : glyph('lock'))
. '</div><br />';
}
- $html = '<div id="selection_' . $name . '" class="selection ' . $name . '">' . "\n";
+ $html .= '<div id="selection_' . $name . '" class="selection ' . $name . '">' . "\n";
$html .= implode("\n", $htmlItems);
- $buttons = [];
- $buttons[] = button('javascript: checkAll(\'selection_' . $name . '\', true)', _('All'));
- $buttons[] = button('javascript: checkAll(\'selection_' . $name . '\', false)', _('None'));
- $buttons = array_merge($buttons, $additionalButtons);
$html .= buttons($buttons);
$html .= '</div>' . "\n";
diff --git a/includes/view/PublicDashboard_view.php b/includes/view/PublicDashboard_view.php
index 83cf0e5f..6fef8f54 100644
--- a/includes/view/PublicDashboard_view.php
+++ b/includes/view/PublicDashboard_view.php
@@ -68,7 +68,7 @@ function public_dashboard_view($stats, $free_shifts)
function public_dashboard_shift_render($shift)
{
$panel_body = glyph('time') . $shift['start'] . ' - ' . $shift['end'];
- $panel_body .= ' (' . $shift['duration'] . ' h)';
+ $panel_body .= ' (' . $shift['duration'] . '&nbsp;h)';
$panel_body .= '<br>' . glyph('tasks') . $shift['shifttype_name'];
if (!empty($shift['title'])) {
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
diff --git a/includes/view/User_view.php b/includes/view/User_view.php
index fff2952e..2f53e641 100644
--- a/includes/view/User_view.php
+++ b/includes/view/User_view.php
@@ -299,7 +299,7 @@ function User_shift_state_render($user)
if (time() < $halfway) {
return '<span class="text-danger moment-countdown" data-timestamp="' . $nextShift['start'] . '">'
- . _('Shift starts %c')
+ . _('Shift started %c')
. '</span>';
}
@@ -356,7 +356,7 @@ function User_view_myshift($shift, $user_source, $its_me)
. glyph('time') . date('H:i', $shift['start'])
. ' - '
. date('H:i', $shift['end']),
- 'duration' => round(($shift['end'] - $shift['start']) / 3600, 2) . ' h',
+ 'duration' => sprintf('%.2f', ($shift['end'] - $shift['start']) / 3600) . '&nbsp;h',
'room' => Room_name_render($shift),
'shift_info' => $shift_info,
'comment' => ''
@@ -368,7 +368,7 @@ function User_view_myshift($shift, $user_source, $its_me)
if ($shift['freeloaded']) {
$myshift['duration'] = '<p class="text-danger">'
- . round(-($shift['end'] - $shift['start']) / 3600 * 2, 2) . ' h'
+ . round(-($shift['end'] - $shift['start']) / 3600 * 2, 2) . '&nbsp;h'
. '</p>';
if (in_array('user_shifts_admin', $privileges)) {
$myshift['comment'] .= '<br />'
@@ -408,22 +408,30 @@ function User_view_myshift($shift, $user_source, $its_me)
* @param bool $its_me
* @return array
*/
-function User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshirt_admin)
+function User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshirt_admin, $user_worklogs, $admin_user_worklog_privilege)
{
$myshifts_table = [];
$timesum = 0;
foreach ($shifts as $shift) {
- $myshifts_table[] = User_view_myshift($shift, $user_source, $its_me);
+ $myshifts_table[$shift['start']] = User_view_myshift($shift, $user_source, $its_me);
if (!$shift['freeloaded']) {
$timesum += ($shift['end'] - $shift['start']);
}
}
+ if($its_me || $admin_user_worklog_privilege) {
+ foreach($user_worklogs as $worklog) {
+ $myshifts_table[$worklog['work_timestamp']] = User_view_worklog($worklog, $admin_user_worklog_privilege);
+ $timesum += $worklog['work_hours'] * 3600;
+ }
+ }
+
if (count($myshifts_table) > 0) {
+ ksort($myshifts_table);
$myshifts_table[] = [
'date' => '<b>' . _('Sum:') . '</b>',
- 'duration' => '<b>' . round($timesum / 3600, 2) . ' h</b>',
+ 'duration' => '<b>' . sprintf('%.2f', round($timesum / 3600, 2)) . '&nbsp;h</b>',
'room' => '',
'shift_info' => '',
'comment' => '',
@@ -444,6 +452,43 @@ function User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshi
}
/**
+ * Renders table entry for user work log
+ * @param UserWorkLog $worklog
+ * @param bool $admin_user_worklog_privilege
+ */
+function User_view_worklog($worklog, $admin_user_worklog_privilege) {
+ $actions = '';
+ if($admin_user_worklog_privilege) {
+ $actions = table_buttons([
+ button(
+ user_worklog_edit_link($worklog),
+ glyph('edit') . _('edit'),
+ 'btn-xs'
+ ),
+ button(
+ user_worklog_delete_link($worklog),
+ glyph('trash') . _('delete'),
+ 'btn-xs'
+ )
+ ]);
+ }
+
+ return [
+ 'date' => glyph('calendar') . date('Y-m-d', $worklog['work_timestamp']),
+ 'duration' => '<b>' . sprintf('%.2f', $worklog['work_hours']) . '</b>',
+ 'room' => '',
+ 'shift_info' => _('Work log entry'),
+ 'comment' => $worklog['comment'] . '<br>'
+ . sprintf(
+ _('Added by %s at %s'),
+ User_Nick_render(User($worklog['created_user_id'])),
+ date('Y-m-d H:i', $worklog['created_timestamp'])
+ ),
+ 'actions' => $actions
+ ];
+}
+
+/**
* Renders view for a single user
*
* @param array $user_source
@@ -466,12 +511,14 @@ function User_view(
$shifts,
$its_me,
$tshirt_score,
- $tshirt_admin
+ $tshirt_admin,
+ $admin_user_worklog_privilege,
+ $user_worklogs
) {
$user_name = htmlspecialchars($user_source['Vorname']) . ' ' . htmlspecialchars($user_source['Name']);
$myshifts_table = '';
if($its_me || $admin_user_privilege) {
- $my_shifts = User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshirt_admin);
+ $my_shifts = User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshirt_admin, $user_worklogs, $admin_user_worklog_privilege);
if(count($my_shifts) > 0) {
$myshifts_table = table([
'date' => _('Day &amp; time'),
@@ -514,6 +561,10 @@ function User_view(
),
glyph('cutlery') . _('Edit vouchers')
) : '',
+ $admin_user_worklog_privilege ? button(
+ user_worklog_add_link($user_source),
+ glyph('list') . _('Add work log')
+ ) : '',
$its_me ? button(
page_link_to('user_settings'),
glyph('list-alt') . _('Settings')
diff --git a/locale/de_DE.UTF-8/LC_MESSAGES/default.mo b/locale/de_DE.UTF-8/LC_MESSAGES/default.mo
index c4624b53..3939e870 100644
--- a/locale/de_DE.UTF-8/LC_MESSAGES/default.mo
+++ b/locale/de_DE.UTF-8/LC_MESSAGES/default.mo
Binary files differ
diff --git a/locale/de_DE.UTF-8/LC_MESSAGES/default.po b/locale/de_DE.UTF-8/LC_MESSAGES/default.po
index eb73f2b7..7187b32c 100644
--- a/locale/de_DE.UTF-8/LC_MESSAGES/default.po
+++ b/locale/de_DE.UTF-8/LC_MESSAGES/default.po
@@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: Engelsystem 2.0\n"
-"POT-Creation-Date: 2017-12-27 20:29+0100\n"
-"PO-Revision-Date: 2017-12-27 20:29+0100\n"
+"POT-Creation-Date: 2017-12-29 19:01+0100\n"
+"PO-Revision-Date: 2017-12-29 19:03+0100\n"
"Last-Translator: msquare <msquare@notrademark.de>\n"
"Language-Team: \n"
"Language: de_DE\n"
@@ -25,7 +25,7 @@ msgstr "Bitte auswählen..."
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:247
#: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:80
#: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:138
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:700
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:759
msgid "Angeltypes"
msgstr "Engeltypen"
@@ -78,7 +78,8 @@ msgstr "ansehen"
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:124
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:138
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:387
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:485
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:465
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:547
msgid "edit"
msgstr "bearbeiten"
@@ -98,6 +99,8 @@ msgstr "bearbeiten"
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:97
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:129
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:139
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserWorkLog_view.php:16
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:470
msgid "delete"
msgstr "löschen"
@@ -306,12 +309,13 @@ msgstr "Benötigte Engel"
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftEntry_view.php:199
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:65
#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserDriverLicenses_view.php:52
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserWorkLog_view.php:42
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:72
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:81
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:86
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:91
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:182
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:678
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:737
msgid "Save"
msgstr "Speichern"
@@ -425,7 +429,7 @@ msgstr "Du darfst diesen Benutzer nicht für diesen Engeltyp freischalten."
#: /Users/msquare/workspace/projects/engelsystem/includes/controller/user_angeltypes_controller.php:146
#: /Users/msquare/workspace/projects/engelsystem/includes/controller/user_angeltypes_controller.php:201
#: /Users/msquare/workspace/projects/engelsystem/includes/controller/user_angeltypes_controller.php:268
-#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:415
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:417
msgid "User doesn't exist."
msgstr "Benutzer existiert nicht."
@@ -540,6 +544,30 @@ msgstr "Deine Führerschein-Infos wurden gelöscht."
msgid "Edit %s driving license information"
msgstr "Bearbeite die Führerschein-Infos von %s"
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/user_worklog_controller.php:20
+msgid "Work log entry deleted."
+msgstr "Arbeitseinsatz gelöscht."
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/user_worklog_controller.php:50
+msgid "Work log entry updated."
+msgstr "Arbeitseinsatz geändert."
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/user_worklog_controller.php:75
+msgid "Please enter work date."
+msgstr "Bitte Einsatzdatum angeben."
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/user_worklog_controller.php:81
+msgid "Please enter work hours in format ##[.##]."
+msgstr "Bitte Stunden im Format ##[.##| eingeben."
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/user_worklog_controller.php:87
+msgid "Please enter a comment."
+msgstr "Bitte Kommentar angeben."
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/user_worklog_controller.php:117
+msgid "Work log entry created."
+msgstr "Arbeitseinsatz angelegt."
+
#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:61
msgid "You cannot delete yourself."
msgstr "Du kannst Dich nicht selber löschen."
@@ -581,55 +609,55 @@ msgstr "Benutzer nicht gefunden."
msgid "Enough"
msgstr "Genug"
-#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:275
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:277
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:232
msgid "All users"
msgstr "Alle Benutzer"
-#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:299
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:301
msgid "Token is not correct."
msgstr "Der Token ist nicht in Ordnung."
-#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:312
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:314
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:142
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_settings.php:116
msgid "Your passwords don't match."
msgstr "Deine Passwörter stimmen nicht überein."
-#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:316
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:318
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_settings.php:114
msgid "Your password is to short (please use at least 6 characters)."
msgstr "Dein Passwort ist zu kurz (Bitte mindestens 6 Zeichen nutzen)."
-#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:321
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:323
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_settings.php:119
msgid "Password saved."
msgstr "Passwort gespeichert."
-#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:346
-#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:350
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:348
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:352
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:107
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_settings.php:31
msgid "E-mail address is not correct."
msgstr "Die E-Mail Adresse ist nicht in Ordnung."
-#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:354
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:356
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:111
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_settings.php:35
msgid "Please enter your e-mail."
msgstr "Bitte gib Deine E-Mail-Adresse ein."
-#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:361
-#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:397
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:363
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:399
msgid "Password recovery"
msgstr "Passwort wiederherstellen"
-#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:363
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:365
#, php-format
msgid "Please visit %s to recover your password."
msgstr "Bitte besuche %s, um Dein Passwort zurückzusetzen"
-#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:367
+#: /Users/msquare/workspace/projects/engelsystem/includes/controller/users_controller.php:369
msgid "We sent an email containing your password recovery link."
msgstr ""
"Wir haben eine eMail mit einem Link zum Passwort-zurücksetzen geschickt."
@@ -742,65 +770,67 @@ msgid "Please enter a number of angels to be marked as active."
msgstr ""
"Bitte gib eine Anzahl an Engeln ein, die als Aktiv markiert werden sollen."
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:83
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:87
msgid "Marked angels."
msgstr "Engel wurden markiert."
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:86
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:90
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_rooms.php:155
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_rooms.php:191
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:300
#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserAngelTypes_view.php:164
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserWorkLog_view.php:56
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserWorkLog_view.php:73
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:149
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:173
msgid "back"
msgstr "zurück"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:92
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:96
msgid "apply"
msgstr "anwenden"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:103
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:107
msgid "Angel has been marked as active."
msgstr "Engel wurde als aktiv markiert."
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:105
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:115
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:135
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:109
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:119
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:139
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_arrive.php:40
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_arrive.php:56
msgid "Angel not found."
msgstr "Engel nicht gefunden."
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:113
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:117
msgid "Angel has been marked as not active."
msgstr "Engel wurde als nicht aktiv markiert."
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:123
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:127
msgid "Angel has got a t-shirt."
msgstr "Engel hat ein T-Shirt bekommen."
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:133
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:137
msgid "Angel has got no t-shirt."
msgstr "Engel hat kein T-Shirt bekommen."
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:192
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:200
msgid "set active"
msgstr "setze aktiv"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:209
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:217
msgid "remove active"
msgstr "entferne aktiv"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:212
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:220
msgid "got t-shirt"
msgstr "hat t-shirt"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:224
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:232
msgid "remove t-shirt"
msgstr "entferne t-shirt"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:260
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:268
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_arrive.php:195
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_arrive.php:210
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_arrive.php:225
@@ -810,15 +840,15 @@ msgstr "entferne t-shirt"
msgid "Sum"
msgstr "Summe"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:267
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:275
msgid "Search angel:"
msgstr "Suche Engel:"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:268
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:276
msgid "Show all shifts"
msgstr "Alle Schichten anzeigen"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:269
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:277
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_arrive.php:171
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_arrive.php:172
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_free.php:105
@@ -828,62 +858,62 @@ msgstr "Alle Schichten anzeigen"
msgid "Search"
msgstr "Suche"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:272
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:280
msgid "How much angels should be active?"
msgstr "Wie viele Engel sollten aktiv sein?"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:273
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:281
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:288
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:432
msgid "Preview"
msgstr "Vorschau"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:277
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:285
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_arrive.php:175
msgid "Nickname"
msgstr "Nick"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:278
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:288
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:286
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:296
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:248
msgid "Size"
msgstr "Größe"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:279
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:287
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:11
#: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:355
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Rooms_view.php:39
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:529
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:595
msgid "Shifts"
msgstr "Schichten"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:280
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:288
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:394
msgid "Length"
msgstr "Länge"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:281
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:289
msgid "Active?"
msgstr "Aktiv?"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:282
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:290
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:246
msgid "Forced"
msgstr "Gezwungen"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:283
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:291
msgid "T-shirt?"
msgstr "T-Shirt?"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:286
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:294
msgid "Shirt statistics"
msgstr "T-Shirt Statistik"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:289
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:297
msgid "Needed shirts"
msgstr "Benötigte T-Shirts"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:290
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_active.php:298
msgid "Given shirts"
msgstr "Ausgegebene T-Shirts"
@@ -916,7 +946,7 @@ msgstr "zurücksetzen"
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_arrive.php:186
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_arrive.php:201
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_arrive.php:216
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:493
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:555
msgid "arrived"
msgstr "angekommen"
@@ -1016,7 +1046,7 @@ msgstr "Jabber"
#: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:118
#: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:480
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:52
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:659
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:718
msgid "E-Mail"
msgstr "E-Mail"
@@ -1584,12 +1614,12 @@ msgstr "T-Shirt Größe"
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:342
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:478
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:119
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:676
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:735
msgid "Password"
msgstr "Passwort"
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:345
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:677
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:736
msgid "Confirm password"
msgstr "Passwort wiederholen"
@@ -1746,7 +1776,7 @@ msgid "Key changed."
msgstr "Key geändert."
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_myshifts.php:42
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:516
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:582
msgid "Reset API key"
msgstr "API-Key zurücksetzen"
@@ -1826,7 +1856,7 @@ msgid "No question found."
msgstr "Keine Frage gefunden."
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_settings.php:10
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:504
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:570
msgid "Settings"
msgstr "Einstellungen"
@@ -1936,12 +1966,12 @@ msgstr ""
"\">JSON Format</a> verfügbar (Link bitte geheimhalten, sonst <a href=\"%s"
"\">API-Key zurücksetzen</a>)."
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:333
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:323
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:49
msgid "All"
msgstr "Alle"
-#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:334
+#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:324
msgid "None"
msgstr "Keine"
@@ -1987,6 +2017,7 @@ msgstr "Möchtest Du den Engeltypen %s löschen?"
#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserAngelTypes_view.php:106
#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserAngelTypes_view.php:135
#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserAngelTypes_view.php:191
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserWorkLog_view.php:13
msgid "cancel"
msgstr "abbrechen"
@@ -2341,6 +2372,7 @@ msgstr "Möchtest du den folgenden User für die Schicht eintragen?"
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftEntry_view.php:91
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftEntry_view.php:116
#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserAngelTypes_view.php:170
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserWorkLog_view.php:38
msgid "User"
msgstr "Benutzer"
@@ -2420,7 +2452,7 @@ msgid "New shifttype"
msgstr "Neuer Schichttyp"
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:40
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:533
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:526
msgid "Location"
msgstr "Ort"
@@ -2514,6 +2546,36 @@ msgstr "7,5t LKW"
msgid "Truck 12,5t"
msgstr "12,5t LKW"
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserWorkLog_view.php:11
+#, php-format
+msgid "Do you want to delete the worklog entry for %s?"
+msgstr "Möchtest du den Arbeitseinsatz von %s wirklich löschen?"
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserWorkLog_view.php:26
+msgid "Delete work log entry"
+msgstr "Arbeitseinsatz gelöscht."
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserWorkLog_view.php:39
+msgid "Work date"
+msgstr "Einsatzdatum"
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserWorkLog_view.php:40
+msgid "Work hours"
+msgstr "Arbeitsstunden"
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserWorkLog_view.php:41
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:528
+msgid "Comment"
+msgstr "Kommentar"
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserWorkLog_view.php:85
+msgid "Edit work log entry"
+msgstr "Arbeitseinsatz bearbeiten"
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/UserWorkLog_view.php:93
+msgid "Add work log entry"
+msgstr "Arbeitseinsatz hinzufügen"
+
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:29
msgid "Here you can change your user details."
msgstr "Hier kannst Du Deine Details ändern."
@@ -2596,7 +2658,7 @@ msgid "Prename"
msgstr "Vorname"
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:242
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:588
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:647
msgid "Arrived"
msgstr "Angekommen"
@@ -2609,12 +2671,12 @@ msgid "Freeloads"
msgstr "Schwänzereien"
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:245
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:622
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:681
msgid "Active"
msgstr "Aktiv"
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:247
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:625
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:684
msgid "T-Shirt"
msgstr "T-Shirt"
@@ -2646,55 +2708,68 @@ msgstr "Schicht endet %c"
msgid "sign off"
msgstr "abmelden"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:425
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:433
msgid "Sum:"
msgstr "Summe:"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:434
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:442
msgid "Your t-shirt score"
msgstr "Dein T-Shirt Score"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:489
-msgid "driving license"
-msgstr "Führerschein"
-
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:500
-msgid "Edit vouchers"
-msgstr "Voucher bearbeiten"
-
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:508
-msgid "iCal Export"
-msgstr "iCal Export"
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:480
+msgid "Work log entry"
+msgstr "Arbeitseinsatz"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:512
-msgid "JSON Export"
-msgstr "JSON Export"
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:483
+#, php-format
+msgid "Added by %s at %s"
+msgstr "Erstellt von %s am %s"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:531
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:524
msgid "Day &amp; time"
msgstr "Day &amp; time"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:532
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:525
msgid "Duration"
msgstr "Dauer"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:534
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:527
msgid "Name &amp; workmates"
msgstr "Name &amp; Kollegen"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:535
-msgid "Comment"
-msgstr "Kommentar"
-
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:536
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:529
msgid "Action"
msgstr "Aktion"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:539
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:532
+msgid "You have done enough to get a t-shirt."
+msgstr "Du hast genug für ein T-Shirt gemacht."
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:551
+msgid "driving license"
+msgstr "Führerschein"
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:562
+msgid "Edit vouchers"
+msgstr "Voucher bearbeiten"
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:566
+msgid "Add work log"
+msgstr "Neuer Arbeitseinsatz"
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:574
+msgid "iCal Export"
+msgstr "iCal Export"
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:578
+msgid "JSON Export"
+msgstr "JSON Export"
+
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:598
msgid "Your night shifts between 2 and 8 am count twice."
msgstr "Deine Nachtschichten zwischen 2 und 8 Uhr zählen doppelt."
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:544
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:603
#, php-format
msgid ""
"Go to the <a href=\"%s\">shifts table</a> to sign yourself up for some "
@@ -2703,44 +2778,44 @@ msgstr ""
"Gehe zur <a href=\"%s\">Schicht-Tabelle</a>, um Dich für Schichten "
"einzutragen."
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:570
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:629
msgid "User state"
msgstr "Engelzustand"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:590
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:649
msgid "Not arrived"
msgstr "Nicht angekommen"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:609
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:668
msgid "Freeloader"
msgstr "Schwänzer"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:616
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:675
#, php-format
msgid "Arrived at %s"
msgstr "Angekommen am %s"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:620
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:679
msgid "Active (forced)"
msgstr "Aktiv (gezwungen)"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:629
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:688
#, php-format
msgid "Not arrived (Planned: %s)"
msgstr "Nicht angekommen (Geplant: %s)"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:637
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:696
#, php-format
msgid "Got %s voucher"
msgid_plural "Got %s vouchers"
msgstr[0] "Einen Voucher bekommen"
msgstr[1] "%s Voucher bekommen"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:642
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:701
msgid "Got no vouchers"
msgstr "Voucher nicht bekommen"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:657
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:716
msgid ""
"We will send you an e-mail with a password recovery link. Please use the "
"email address you used for registration."
@@ -2749,19 +2824,19 @@ msgstr ""
"zurücksetzen kannst. Bitte benutze die Mailadresse, die du bei der Anmeldung "
"verwendet hast."
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:660
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:719
msgid "Recover"
msgstr "Wiederherstellen"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:674
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:733
msgid "Please enter a new password."
msgstr "Gib bitte ein neues Passwort ein."
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:717
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:776
msgid "Rights"
msgstr "Rechte"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:766
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:825
msgid ""
"Please enter your planned date of departure on your settings page to give us "
"a feeling for teardown capacities."
@@ -2769,7 +2844,7 @@ msgstr ""
"Bitte gib Dein geplantes Abreisedatum an, damit wir ein Gefühl für die Abbau-"
"Planung bekommen."
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:782
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:841
#, php-format
msgid ""
"You freeloaded at least %s shifts. Shift signup is locked. Please go to "
@@ -2778,7 +2853,7 @@ msgstr ""
"Du hast mindestens %s Schichten geschwänzt. Schicht-Registrierung ist "
"gesperrt. Bitte gehe zum Himmelsschreibtisch um wieder entsperrt zu werden."
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:804
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:863
msgid ""
"You are not marked as arrived. Please go to heaven's desk, get your angel "
"badge and/or tell them that you arrived already."
@@ -2786,11 +2861,11 @@ msgstr ""
"Du bist nicht als angekommen markiert. Bitte gehe zur Himmelsverwaltung, "
"hole Dein Badge ab und/oder erkläre ihnen, dass Du bereits angekommen bist."
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:819
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:878
msgid "You need to specify a tshirt size in your settings!"
msgstr "Bitte eine T-Shirt-Größe auswählen"
-#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:834
+#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:893
msgid ""
"You need to specify a DECT phone number in your settings! If you don't have "
"a DECT phone, just enter '-'."
@@ -2798,11 +2873,11 @@ msgstr ""
"Bitte eine DECT-Telefonnummer in den Einstellungen eingeben. Wenn du noch "
"keine Nummer hast, bitte einfach \"-\" angeben."
-#: /Users/msquare/workspace/projects/engelsystem/public/index.php:214
+#: /Users/msquare/workspace/projects/engelsystem/public/index.php:218
msgid "No Access"
msgstr "Kein Zugriff"
-#: /Users/msquare/workspace/projects/engelsystem/public/index.php:215
+#: /Users/msquare/workspace/projects/engelsystem/public/index.php:219
msgid ""
"You don't have permission to view this page . You probably have to sign in "
"or register in order to gain access!"
diff --git a/public/index.php b/public/index.php
index af7318b1..adf22e71 100644
--- a/public/index.php
+++ b/public/index.php
@@ -22,6 +22,7 @@ $free_pages = [
'users',
'user_driver_licenses',
'user_password_recovery',
+ 'user_worklog'
];
// Gewünschte Seite/Funktion
@@ -130,6 +131,9 @@ if (
$title = shifts_title();
$content = user_shifts();
break;
+ case 'user_worklog':
+ list($title, $content) = user_worklogs_controller();
+ break;
case 'user_messages':
$title = messages_title();
$content = user_messages();