forked from boxwise/dropapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmobile.php
More file actions
101 lines (82 loc) · 3.2 KB
/
mobile.php
File metadata and controls
101 lines (82 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
// Check session
$mobile = true;
require_once 'library/core.php';
date_default_timezone_set('Europe/Athens');
db_query('SET time_zone = "+02:00"');
$tpl = new Zmarty();
if ('' != $_GET['logout']) {
logoutWithRedirect('/mobile.php');
}
// new: fill the camp selection menu --------------------------------------------
$tpl->assign('org', $_SESSION['organisation']);
$camplist = camplist();
$tpl->assign('camps', $camplist);
$tpl->assign('currentcamp', $_SESSION['camp']);
// end of the camp menu addition --------------------------------------------
if ($_GET['message']) {
$data['message'] = $_GET['message'];
}
if ($_GET['warning']) {
$data['warning'] = true;
}
if ($_GET['messageAnchorText']) {
$data['messageAnchorText'] = $_GET['messageAnchorText'];
}
if ($_GET['messageAnchorTarget']) {
$data['messageAnchorTarget'] = $_GET['messageAnchorTarget'];
}
if ($_GET['messageAnchorTargetValue']) {
$data['messageAnchorTargetValue'] = $_GET['messageAnchorTargetValue'];
}
if (!$_SESSION['camp']['id']) {
//No organisation selected for admin
if (!isset($_SESSION['organisation']['id']) && $_SESSION['user']['is_admin']) {
require_once 'mobile/selectorganisation.php';
} else {
throw new Exception('You don\'t have access to this base. Ask your coordinator to correct this!', 403);
//$data['message'] = 'You don\'t have access to this base. Ask your coordinator to correct this!';
}
} elseif (!db_value('SELECT id FROM locations WHERE locations.camp_id = '.intval($_SESSION['camp']['id']).' LIMIT 1 ')) {
redirect('/?action=start');
} else { // --------------- All routing happens here
// Boxlabel is scanned
if ('' != $_GET['barcode'] || '' != $_GET['boxid']) {
require_once 'mobile/barcode.php';
// Assign a QR code to existing box
} elseif ('' != $_GET['assignbox']) {
require_once 'mobile/assignbox.php';
// Save assignbox selection
} elseif ('' != $_GET['saveassignbox']) {
require_once 'mobile/saveassignbox.php';
// Make a new box with this QR code
} elseif ('' != $_GET['newbox']) {
require_once 'mobile/newbox.php';
// Edit the info for existing box
} elseif ('' != $_GET['editbox']) {
require_once 'mobile/editbox.php';
// Save a new box with this QR code
} elseif ('' != $_GET['savebox']) {
require_once 'mobile/savebox.php';
// Move this box to a new location
} elseif ('' != $_GET['move']) {
require_once 'mobile/move.php';
// Change the amount of items in this box
} elseif ('' != $_GET['changeamount']) {
require_once 'mobile/changeamount.php';
// Save the new amount of items in this box
} elseif ('' != $_GET['saveamount']) {
require_once 'mobile/saveamount.php';
// Save the new amount of items in this box
} elseif (isset($_GET['vieworders'])) {
require_once 'mobile/vieworders.php';
// Find a box by manually entered number
} elseif ('' != $_GET['findbox']) {
require_once 'mobile/findbox.php';
} else {
require_once 'mobile/start.php';
}
}
$tpl->assign('data', $data);
$tpl->assign('identifyUserToAnalytics', shouldIdentifyUserToAnalytics());
$tpl->display('mobile.tpl');