-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclass.TicketPage.php
65 lines (62 loc) · 2.19 KB
/
class.TicketPage.php
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
<?php
require_once('../class.SecureLoginRequiredPage.php');
require_once('class.FlipSession.php');
require_once('app/TicketAutoload.php');
class TicketPage extends SecureLoginRequiredPage
{
private $is_admin;
private $is_data;
public $ticket_root;
public $ticketSettings;
function __construct($title)
{
parent::__construct($title);
$root = $_SERVER['DOCUMENT_ROOT'];
$script_dir = dirname(__FILE__);
$this->ticket_root = substr($script_dir, strlen($root));
if($this->user !== false && $this->user !== null)
{
$this->is_admin = $this->user->isInGroupNamed('TicketAdmins');
$this->is_data = $this->user->isInGroupNamed('TicketTeam');
}
else
{
$this->is_admin = false;
$this->is_data = false;
}
$this->add_tickets_css();
$this->ticketSettings = \Tickets\DB\TicketSystemSettings::getInstance();
if($this->ticketSettings->isTestMode())
{
if($this->is_admin)
{
$this->addNotification('The ticket system is operating in test mode. Any entries made will be deleted before ticketing starts. To change modes turn off Test Mode on <a href="/tickets/_admin/vars.php" class="alert-link">this page</a>.',
self::NOTIFICATION_WARNING);
}
else
{
$this->addNotification('The ticket system is operating in test mode. Any entries made will be deleted before ticketing starts.',
self::NOTIFICATION_WARNING);
}
}
$this->addJS($this->ticket_root.'/js/tickets.js', false);
$this->addJS($this->ticket_root.'/js/TicketSystem.js', false);
}
function add_links()
{
if($this->is_admin)
{
$this->addLink('Admin', $this->ticket_root.'/_admin/');
}
if($this->is_data)
{
$this->addLink('Data Entry', $this->ticket_root.'/_admin/data.php');
}
parent::add_links();
}
function add_tickets_css()
{
$this->addCSS($this->ticket_root.'/css/tickets.css');
}
}
?>