engelsystem/includes/view/UserWorkLog_view.php

103 lines
2.3 KiB
PHP
Raw Normal View History

2017-12-29 17:19:27 +01:00
<?php
/**
* Delete work log entry.
2018-01-14 18:09:34 +01:00
*
* @param array $user_source
* @param array $userWorkLog
* @return string
2017-12-29 17:19:27 +01:00
*/
function UserWorkLog_delete_view($user_source, $userWorkLog)
{
return page_with_title(UserWorkLog_delete_title(), [
2018-01-14 18:09:34 +01:00
info(sprintf(
_('Do you want to delete the worklog entry for %s?'),
User_Nick_render($user_source)
), true),
2017-12-29 17:19:27 +01:00
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.
2018-01-14 18:09:34 +01:00
*
* @param array $user_source
* @param array $userWorkLog
* @return string
2017-12-29 17:19:27 +01:00
*/
function UserWorkLog_edit_form($user_source, $userWorkLog)
{
return form([
form_info(_('User'), User_Nick_render($user_source)),
2017-12-29 18:57:11 +01:00
form_date('work_timestamp', _('Work date'), $userWorkLog['work_timestamp'], null, time()),
2017-12-29 17:19:27 +01:00
form_text('work_hours', _('Work hours'), $userWorkLog['work_hours']),
form_text('comment', _('Comment'), $userWorkLog['comment']),
2017-12-29 18:57:11 +01:00
form_submit('submit', _('Save'))
2017-12-29 17:19:27 +01:00
]);
}
/**
* Form for edit a user work log entry.
*
2018-01-14 18:09:34 +01:00
* @param array $user_source
* @param array $userWorkLog
* @return string
2017-12-29 17:19:27 +01:00
*/
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.
*
2018-01-14 18:09:34 +01:00
* @param array $user_source
* @param array $userWorkLog
* @return string
2017-12-29 17:19:27 +01:00
*/
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');
}