add shift creator and editor
This commit is contained in:
parent
cac86ef509
commit
a7189482e9
|
@ -1,3 +1,16 @@
|
||||||
|
/* more shift infos */
|
||||||
|
ALTER TABLE `Shifts` ADD `created_by_user_id` INT NOT NULL ,
|
||||||
|
ADD `created_at_timestamp` INT NOT NULL ,
|
||||||
|
ADD `edited_by_user_id` INT NOT NULL ,
|
||||||
|
ADD `edited_at_timestamp` INT NOT NULL;
|
||||||
|
ALTER TABLE `Shifts` ADD INDEX ( `created_by_user_id` );
|
||||||
|
ALTER TABLE `Shifts` ADD INDEX ( `edited_by_user_id` );
|
||||||
|
ALTER TABLE `Shifts` CHANGE `created_by_user_id` `created_by_user_id` INT( 11 ) NULL ;
|
||||||
|
ALTER TABLE `Shifts` CHANGE `edited_by_user_id` `edited_by_user_id` INT( 11 ) NULL ;
|
||||||
|
update Shifts set created_by_user_id=null, edited_by_user_id=null;
|
||||||
|
ALTER TABLE `Shifts` ADD FOREIGN KEY ( `created_by_user_id` ) REFERENCES `engelsystem`.`User` (`UID`) ON DELETE SET NULL ON UPDATE CASCADE ;
|
||||||
|
ALTER TABLE `Shifts` ADD FOREIGN KEY ( `edited_by_user_id` ) REFERENCES `engelsystem`.`User` (`UID`) ON DELETE SET NULL ON UPDATE CASCADE ;
|
||||||
|
|
||||||
/* Introduce planned departure date */
|
/* Introduce planned departure date */
|
||||||
ALTER TABLE `User` ADD `planned_departure_date` INT NULL, ADD INDEX ( `planned_departure_date` );
|
ALTER TABLE `User` ADD `planned_departure_date` INT NULL, ADD INDEX ( `planned_departure_date` );
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,7 @@ function Shift_delete($shift_id) {
|
||||||
* Update a shift.
|
* Update a shift.
|
||||||
*/
|
*/
|
||||||
function Shift_update($shift) {
|
function Shift_update($shift) {
|
||||||
|
global $user;
|
||||||
$shift['name'] = ShiftType($shift['shifttype_id'])['name'];
|
$shift['name'] = ShiftType($shift['shifttype_id'])['name'];
|
||||||
mail_shift_change(Shift($shift['SID']), $shift);
|
mail_shift_change(Shift($shift['SID']), $shift);
|
||||||
|
|
||||||
|
@ -111,7 +112,9 @@ function Shift_update($shift) {
|
||||||
`RID`='" . sql_escape($shift['RID']) . "',
|
`RID`='" . sql_escape($shift['RID']) . "',
|
||||||
`title`=" . sql_null($shift['title']) . ",
|
`title`=" . sql_null($shift['title']) . ",
|
||||||
`URL`=" . sql_null($shift['URL']) . ",
|
`URL`=" . sql_null($shift['URL']) . ",
|
||||||
`PSID`=" . sql_null($shift['PSID']) . "
|
`PSID`=" . sql_null($shift['PSID']) . ",
|
||||||
|
`edited_by_user_id`='" . sql_escape($user['UID']) . "',
|
||||||
|
`edited_at_timestamp`=" . time() . "
|
||||||
WHERE `SID`='" . sql_escape($shift['SID']) . "'");
|
WHERE `SID`='" . sql_escape($shift['SID']) . "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,6 +137,7 @@ function Shift_update_by_psid($shift) {
|
||||||
* @return new shift id or false
|
* @return new shift id or false
|
||||||
*/
|
*/
|
||||||
function Shift_create($shift) {
|
function Shift_create($shift) {
|
||||||
|
global $user;
|
||||||
$result = sql_query("INSERT INTO `Shifts` SET
|
$result = sql_query("INSERT INTO `Shifts` SET
|
||||||
`shifttype_id`='" . sql_escape($shift['shifttype_id']) . "',
|
`shifttype_id`='" . sql_escape($shift['shifttype_id']) . "',
|
||||||
`start`='" . sql_escape($shift['start']) . "',
|
`start`='" . sql_escape($shift['start']) . "',
|
||||||
|
@ -141,7 +145,9 @@ function Shift_create($shift) {
|
||||||
`RID`='" . sql_escape($shift['RID']) . "',
|
`RID`='" . sql_escape($shift['RID']) . "',
|
||||||
`title`=" . sql_null($shift['title']) . ",
|
`title`=" . sql_null($shift['title']) . ",
|
||||||
`URL`=" . sql_null($shift['URL']) . ",
|
`URL`=" . sql_null($shift['URL']) . ",
|
||||||
`PSID`=" . sql_null($shift['PSID']));
|
`PSID`=" . sql_null($shift['PSID']) . ",
|
||||||
|
`created_by_user_id`='" . sql_escape($user['UID']) . "',
|
||||||
|
`created_at_timestamp`=" . time());
|
||||||
if ($result === false)
|
if ($result === false)
|
||||||
return false;
|
return false;
|
||||||
return sql_id();
|
return sql_id();
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
function Shift_editor_info_render($shift) {
|
||||||
|
$info = [];
|
||||||
|
if ($shift['created_by_user_id'] != null)
|
||||||
|
$info[] = sprintf(glyph('plus') . _("created at %s by %s"), date('Y-m-d H:i', $shift['created_at_timestamp']), User_Nick_render(User($shift['created_by_user_id'])));
|
||||||
|
if ($shift['edited_by_user_id'] != null)
|
||||||
|
$info[] = sprintf(glyph('pencil') . _("edited at %s by %s"), date('Y-m-d H:i', $shift['edited_at_timestamp']), User_Nick_render(User($shift['edited_by_user_id'])));
|
||||||
|
return join('<br />', $info);
|
||||||
|
}
|
||||||
|
|
||||||
function Shift_signup_button_render($shift, $angeltype, $user_angeltype = null, $user_shifts = null) {
|
function Shift_signup_button_render($shift, $angeltype, $user_angeltype = null, $user_shifts = null) {
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
|
@ -60,6 +69,7 @@ function Shift_view($shift, $shifttype, $room, $shift_admin, $angeltypes_source,
|
||||||
}
|
}
|
||||||
|
|
||||||
return page_with_title($shift['name'] . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>', [
|
return page_with_title($shift['name'] . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>', [
|
||||||
|
|
||||||
msg(),
|
msg(),
|
||||||
Shift_collides($shift, $user_shifts) ? info(_('This shift collides with one of your shifts.'), true) : '',
|
Shift_collides($shift, $user_shifts) ? info(_('This shift collides with one of your shifts.'), true) : '',
|
||||||
$signed_up ? info(_('You are signed up for this shift.'), true) : '',
|
$signed_up ? info(_('You are signed up for this shift.'), true) : '',
|
||||||
|
@ -104,7 +114,8 @@ function Shift_view($shift, $shifttype, $room, $shift_admin, $angeltypes_source,
|
||||||
'<h2>' . _('Description') . '</h2>',
|
'<h2>' . _('Description') . '</h2>',
|
||||||
$parsedown->parse($shifttype['description'])
|
$parsedown->parse($shifttype['description'])
|
||||||
])
|
])
|
||||||
])
|
]),
|
||||||
|
$shift_admin ? Shift_editor_info_render($shift) : ''
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -1,8 +1,8 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Engelsystem 2.0\n"
|
"Project-Id-Version: Engelsystem 2.0\n"
|
||||||
"POT-Creation-Date: 2015-08-15 14:53+0100\n"
|
"POT-Creation-Date: 2015-08-15 23:36+0100\n"
|
||||||
"PO-Revision-Date: 2015-08-15 14:54+0100\n"
|
"PO-Revision-Date: 2015-08-15 23:36+0100\n"
|
||||||
"Last-Translator: msquare <msquare@notrademark.de>\n"
|
"Last-Translator: msquare <msquare@notrademark.de>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"Language: de_DE\n"
|
"Language: de_DE\n"
|
||||||
|
@ -114,7 +114,7 @@ msgstr "ansehen"
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_groups.php:23
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_groups.php:23
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_rooms.php:18
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_rooms.php:18
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:84
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:84
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:67
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:77
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:52
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:52
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:63
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:63
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:156
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:156
|
||||||
|
@ -131,7 +131,7 @@ msgstr "bearbeiten"
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:86
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:86
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Questions_view.php:5
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Questions_view.php:5
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Questions_view.php:12
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Questions_view.php:12
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:68
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:78
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:15
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:15
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:53
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:53
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:64
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:64
|
||||||
|
@ -680,7 +680,6 @@ msgid "arrived"
|
||||||
msgstr "angekommen"
|
msgstr "angekommen"
|
||||||
|
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_arrive.php:109
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_arrive.php:109
|
||||||
#, fuzzy
|
|
||||||
msgid "Planned arrival"
|
msgid "Planned arrival"
|
||||||
msgstr "Geplanter Ankunftstag"
|
msgstr "Geplanter Ankunftstag"
|
||||||
|
|
||||||
|
@ -907,7 +906,7 @@ msgstr "Tag"
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_import.php:128
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_import.php:128
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_import.php:137
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_import.php:137
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:306
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:306
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:78
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:88
|
||||||
msgid "Start"
|
msgid "Start"
|
||||||
msgstr "Beginn"
|
msgstr "Beginn"
|
||||||
|
|
||||||
|
@ -915,7 +914,7 @@ msgstr "Beginn"
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_import.php:129
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_import.php:129
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_import.php:138
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_import.php:138
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:307
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:307
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:86
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:96
|
||||||
msgid "End"
|
msgid "End"
|
||||||
msgstr "Ende"
|
msgstr "Ende"
|
||||||
|
|
||||||
|
@ -930,7 +929,7 @@ msgstr "Schichttyp"
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_import.php:140
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_import.php:140
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:302
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:302
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:185
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:185
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:74
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:84
|
||||||
msgid "Title"
|
msgid "Title"
|
||||||
msgstr "Titel"
|
msgstr "Titel"
|
||||||
|
|
||||||
|
@ -1137,7 +1136,7 @@ msgstr "Typ und Titel"
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:255
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:255
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:316
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:316
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:189
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:189
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:100
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:110
|
||||||
msgid "Needed angels"
|
msgid "Needed angels"
|
||||||
msgstr "Benötigte Engel"
|
msgstr "Benötigte Engel"
|
||||||
|
|
||||||
|
@ -1715,7 +1714,7 @@ msgstr[0] "%d Helfer benötigt"
|
||||||
msgstr[1] "%d Helfer benötigt"
|
msgstr[1] "%d Helfer benötigt"
|
||||||
|
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:638
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:638
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:13
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:22
|
||||||
msgid "Sign up"
|
msgid "Sign up"
|
||||||
msgstr "Eintragen"
|
msgstr "Eintragen"
|
||||||
|
|
||||||
|
@ -1725,7 +1724,7 @@ msgstr "vorbei"
|
||||||
|
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:649
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:649
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:782
|
#: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:782
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:15
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:24
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid "Become %s"
|
msgid "Become %s"
|
||||||
msgstr "Werde ein %s"
|
msgstr "Werde ein %s"
|
||||||
|
@ -1846,7 +1845,7 @@ msgstr ""
|
||||||
|
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:63
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:63
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:93
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:93
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:104
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:114
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:35
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:35
|
||||||
msgid "Description"
|
msgid "Description"
|
||||||
msgstr "Beschreibung"
|
msgstr "Beschreibung"
|
||||||
|
@ -1972,15 +1971,25 @@ msgstr "Typ:"
|
||||||
msgid "Comment (for your eyes only):"
|
msgid "Comment (for your eyes only):"
|
||||||
msgstr "Kommentar (nur für Dich):"
|
msgstr "Kommentar (nur für Dich):"
|
||||||
|
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:64
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:6
|
||||||
|
#, php-format
|
||||||
|
msgid "created at %s by %s"
|
||||||
|
msgstr "erstellt am %s von %s"
|
||||||
|
|
||||||
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:8
|
||||||
|
#, php-format
|
||||||
|
msgid "edited at %s by %s"
|
||||||
|
msgstr "bearbeitet am %s von %s"
|
||||||
|
|
||||||
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:74
|
||||||
msgid "This shift collides with one of your shifts."
|
msgid "This shift collides with one of your shifts."
|
||||||
msgstr "Diese Schicht kollidiert mit deinen Schichten."
|
msgstr "Diese Schicht kollidiert mit deinen Schichten."
|
||||||
|
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:65
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:75
|
||||||
msgid "You are signed up for this shift."
|
msgid "You are signed up for this shift."
|
||||||
msgstr "Du bist für diese Schicht eingetragen."
|
msgstr "Du bist für diese Schicht eingetragen."
|
||||||
|
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:94
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:104
|
||||||
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:221
|
#: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:221
|
||||||
msgid "Location"
|
msgid "Location"
|
||||||
msgstr "Ort"
|
msgstr "Ort"
|
||||||
|
|
Loading…
Reference in New Issue