Adding Notifications, Volunteer Shifts and DB Export in Engelsystem
Admin can change the display message in registration form The present system doesn't allow to change the display message in register form. When the system is used for different events it would be useful if the admin is able to change the display message in registration form . I have added feature were admin can change the display message By changing the message in the message box admin can change the display message.Now the message looks like this. Implementation of changing display message. Adding display_msg field to User Table so that the display_msg can be accessed through the database any where through the code and can be changed easily ALTER TABLE `User` ADD `display_msg` varchar(255) DEFAULT "By completing this form you're registering as a Chaos-Angel. This script will create you an account in the angel task scheduler."; Next step is to update the field whenever it is changed by admin sql_query("UPDATE `User` SET `display_msg`='" . sql_escape($display_message) . "' WHERE `UID`='" . sql_escape($user['UID']) . "'"); Copy/ Duplicate function for creating new shifts from existing shifts The present system doesn't allow admin to edit an existing shift and create a new shift from the existing data of already created shifts . I have created a copy shift option where admin can edit the shift and create a new shift In this page admin can create new shift or update the existing shift . Admin can change the date , time , no of angels etc as admin used to create shifts. Implementation of copy shifts function Once the admin selects create new shifts button , we need to use the same data so we need to store the values in variables. once admin selects the option we need to do all the error handling and create new shifts . if (isset($_REQUEST['shifttype_id'])) { $shifttype = ShiftType($_REQUEST['shifttype_id']); if ($shifttype === false) engelsystem_error('Unable to load shift type.'); if ($shifttype == null) { $ok = false; error(_('Please select a shift type.')); } else $shifttype_id = $_REQUEST['shifttype_id']; } else { $ok = false; error(_('Please select a shift type.')); } $title = strip_request_item('title'); // check for errors if (isset($_REQUEST['rid']) && preg_match("/^[0-9]+$/", $_REQUEST['rid']) && isset($room_array[$_REQUEST['rid']])) $rid = $_REQUEST['rid']; else { $ok = false; $rid = $rooms[0]['RID']; error(_('Please select a location.')); } if (isset($_REQUEST['start']) && $tmp = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['start']))) $start = $tmp->getTimestamp(); else { $ok = false; error(_('Please select a start date.')); } if (isset($_REQUEST['end']) && $tmp = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['end']))) $end = $tmp->getTimestamp(); else { $ok = false; error(_('Please select an end date.')); } if (isset($_REQUEST['start_time']) && $tmp = DateTime::createFromFormat("H:i", trim($_REQUEST['start_time']))) $start_time = $tmp->getTimestamp(); else { $ok = false; error(_('Please select an start time.')); } if (isset($_REQUEST['end_time']) && $tmp = DateTime::createFromFormat("H:i", trim($_REQUEST['end_time']))) $end_time = $tmp->getTimestamp(); else { $ok = false; error(_('Please select an end time.')); } if (strtotime($_REQUEST['start']) > strtotime($_REQUEST['end'])) { $ok = false; error(_('The shifts end has to be after its start.')); } if (strtotime($_REQUEST['start']) == strtotime($_REQUEST['end'])) { if (strtotime($_REQUEST['start_time']) > strtotime($_REQUEST['end_time'])) { $ok = false; error(_('The shifts end time has to be after its start time.')); } }…
