You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
engelsystem/includes/view/UserWorkLog_view.php

105 lines
2.4 KiB
PHTML

<?php
use Engelsystem\Models\User\User;
use Engelsystem\Models\Worklog;
/**
* Delete work log entry.
7 years ago
*
* @param User $user_source
7 years ago
* @return string
*/
function UserWorkLog_delete_view($user_source)
{
return page_with_title(UserWorkLog_delete_title(), [
7 years ago
info(sprintf(
__('Do you want to delete the worklog entry for %s?'),
7 years ago
User_Nick_render($user_source)
), true),
form([
buttons([
button(user_link($user_source->id), glyph('remove') . __('cancel')),
form_submit('submit', glyph('ok') . __('delete'), 'btn-danger', false),
]),
]),
]);
}
/**
* Title for work log delete.
*/
function UserWorkLog_delete_title()
{
return __('Delete work log entry');
}
/**
* Render edit table.
7 years ago
*
* @param User $user_source
* @param Worklog $userWorkLog
7 years ago
* @return string
*/
function UserWorkLog_edit_form($user_source, Worklog $userWorkLog)
{
return form([
form_info(__('User'), User_Nick_render($user_source)),
form_date('work_timestamp', __('Work date'), $userWorkLog->worked_at->timestamp, null, time()),
form_text('work_hours', __('Work hours'), $userWorkLog->hours),
form_text('comment', __('Comment'), $userWorkLog->comment, false, 200),
form_submit('submit', __('Save'))
]);
}
/**
* Form for edit a user work log entry.
*
* @param User $user_source
* @param Worklog $userWorkLog
7 years ago
* @return string
*/
function UserWorkLog_edit_view($user_source, Worklog $userWorkLog)
{
return page_with_title(UserWorkLog_edit_title(), [
buttons([
button(user_link($user_source->id), __('back'))
]),
msg(),
UserWorkLog_edit_form($user_source, $userWorkLog)
]);
}
/**
* Form for adding a user work log entry.
*
* @param User $user_source
* @param Worklog $userWorkLog
7 years ago
* @return string
*/
function UserWorkLog_add_view($user_source, Worklog $userWorkLog)
{
return page_with_title(UserWorkLog_add_title(), [
buttons([
button(user_link($user_source->id), __('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');
}