summaryrefslogtreecommitdiff
path: root/includes/controller/shifts_controller.php
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2016-11-25 13:38:16 +0100
committermsquare <msquare@notrademark.de>2016-11-25 13:38:16 +0100
commitbae3ede662426d362a3b9d33d9124253af7e847b (patch)
treee5ece21fc12968f5d40d2ff968fbf70766376e31 /includes/controller/shifts_controller.php
parenta8bcb19eaad798a6441a29e58f9c03ae84de4fc5 (diff)
fixes #279 fix exporting freeload comment in json export
Diffstat (limited to 'includes/controller/shifts_controller.php')
-rw-r--r--includes/controller/shifts_controller.php23
1 files changed, 6 insertions, 17 deletions
diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php
index 1500b449..1e04c5a8 100644
--- a/includes/controller/shifts_controller.php
+++ b/includes/controller/shifts_controller.php
@@ -1,6 +1,6 @@
<?php
-
use Engelsystem\ShiftSignupState;
+
function shift_link($shift) {
return page_link_to('shifts') . '&action=view&shift_id=' . $shift['SID'];
}
@@ -286,7 +286,7 @@ function shifts_json_export_all_controller() {
* (Like iCal Export or shifts view)
*/
function shifts_json_export_controller() {
- global $ical_shifts, $user;
+ global $user;
if (! isset($_REQUEST['key']) || ! preg_match("/^[0-9a-f]{32}$/", $_REQUEST['key'])) {
engelsystem_error("Missing key.");
@@ -295,9 +295,6 @@ function shifts_json_export_controller() {
$key = $_REQUEST['key'];
$user = User_by_api_key($key);
- if ($user === false) {
- engelsystem_error("Unable to find user.");
- }
if ($user == null) {
engelsystem_error("Key invalid.");
}
@@ -305,25 +302,17 @@ function shifts_json_export_controller() {
engelsystem_error("No privilege for shifts_json_export.");
}
- $ical_shifts = load_ical_shifts();
+ $shifts = load_ical_shifts();
header("Content-Type: application/json; charset=utf-8");
- raw_output(json_encode($ical_shifts));
+ raw_output(json_encode($shifts));
}
/**
- * Returns shifts to export.
- * Users shifts or user_shifts filter based shifts if export=user_shifts is given as param.
+ * Returns users shifts to export.
*/
function load_ical_shifts() {
- global $user, $ical_shifts;
-
- if (isset($_REQUEST['export']) && $_REQUEST['export'] == 'user_shifts') {
- require_once realpath(__DIR__ . '/user_shifts.php');
- view_user_shifts();
-
- return $ical_shifts;
- }
+ global $user;
return Shifts_by_user($user);
}