|
1
|
|
|
<?php |
|
2
|
|
|
require_once('class.ProfilesPage.php'); |
|
3
|
|
|
require_once('class.FlipSession.php'); |
|
4
|
|
|
class ProfilesLeadPage extends FlipAdminPage |
|
5
|
|
|
{ |
|
6
|
|
|
private $is_lead; |
|
7
|
|
|
|
|
8
|
|
|
function __construct($title) |
|
|
|
|
|
|
9
|
|
|
{ |
|
10
|
|
|
parent::__construct($title); |
|
11
|
|
|
if($this->user == false) |
|
12
|
|
|
{ |
|
13
|
|
|
$this->is_lead = false; |
|
14
|
|
|
} |
|
15
|
|
|
else |
|
16
|
|
|
{ |
|
17
|
|
|
$this->is_lead = $this->user->isInGroupNamed('Leads'); |
|
18
|
|
|
if(!$this->is_lead) |
|
19
|
|
|
{ |
|
20
|
|
|
$this->is_lead = $this->user->isInGroupNamed('CC'); |
|
21
|
|
|
} |
|
22
|
|
|
} |
|
23
|
|
|
if($this->is_lead) |
|
24
|
|
|
{ |
|
25
|
|
|
$this->is_admin = $this->is_lead; |
|
26
|
|
|
} |
|
27
|
|
|
$this->add_leads_css(); |
|
28
|
|
|
$this->add_links(); |
|
29
|
|
|
$this->addWellKnownJS(JS_DATATABLE, false); |
|
30
|
|
|
$this->addWellKnownJS(JQUERY_VALIDATE); |
|
31
|
|
|
$this->addWellKnownJS(JS_METISMENU); |
|
32
|
|
|
$this->addJSByURI('../_admin/js/admin.js'); |
|
33
|
|
|
$this->addWellKnownJS(JS_LOGIN); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
function add_leads_css() |
|
|
|
|
|
|
37
|
|
|
{ |
|
38
|
|
|
$this->addWellKnownCSS(CSS_DATATABLE); |
|
39
|
|
|
$this->addCSSByURI('../css/profiles.css'); |
|
40
|
|
|
$this->addCSSByURI('css/lead.css'); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
function add_links() |
|
|
|
|
|
|
44
|
|
|
{ |
|
45
|
|
|
$dirMenu = array( |
|
46
|
|
|
'All' => 'directory.php', |
|
47
|
|
|
'AAR' => 'directory.php?filter=aar', |
|
48
|
|
|
'AFs' => 'directory.php?filter=af', |
|
49
|
|
|
'CC' => 'directory.php?filter=cc', |
|
50
|
|
|
'360/24/7 Department' => 'directory.php?filter=360', |
|
51
|
|
|
'Art' => 'directory.php?filter=Art', |
|
52
|
|
|
'City Planning' => 'directory.php?filter=CityPlanning', |
|
53
|
|
|
'Communications' => 'directory.php?filter=Comm', |
|
54
|
|
|
'Genesis' => 'directory.php?filter=Genesis', |
|
55
|
|
|
'Safety' => 'directory.php?filter=Safety', |
|
56
|
|
|
'Site-Ops' => 'directory.php?filter=site-ops', |
|
57
|
|
|
'Site Prep' => 'directory.php?filter=siteprep', |
|
58
|
|
|
'Site Sign-Off' => 'directory.php?filter=sign-off', |
|
59
|
|
|
'Volunteer Coordinator' => 'directory.php?filter=vc' |
|
60
|
|
|
); |
|
61
|
|
|
$this->addLink('<span class="fa fa-dashboard"></span> Dashboard', 'index.php'); |
|
62
|
|
|
$this->addLink('<span class="fa fa-th-list"></span> Directory', false, $dirMenu); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
function add_header() |
|
|
|
|
|
|
66
|
|
|
{ |
|
67
|
|
|
$sites = ''; |
|
68
|
|
|
$log = ''; |
|
|
|
|
|
|
69
|
|
|
foreach($this->sites as $link => $site_name) |
|
|
|
|
|
|
70
|
|
|
{ |
|
71
|
|
|
$sites .= '<li><a href="'.$site_name.'">'.$link.'</a></li>'; |
|
72
|
|
|
} |
|
73
|
|
|
if(!FlipSession::isLoggedIn()) |
|
74
|
|
|
{ |
|
75
|
|
|
$log = '<a href="../login.php?return='.$this->current_url().'"><span class="glyphicon glyphicon-log-in"></span></a>'; |
|
|
|
|
|
|
76
|
|
|
} |
|
77
|
|
|
else |
|
78
|
|
|
{ |
|
79
|
|
|
$log = '<a href="../logout.php"><span class="glyphicon glyphicon-log-out"></span></a>'; |
|
80
|
|
|
} |
|
81
|
|
|
$this->body = '<div id="wrapper"> |
|
82
|
|
|
<nav class="navbar navbar-default navbar-static-top" role=navigation" style="margin-bottom: 0"> |
|
83
|
|
|
<div class="navbar-header"> |
|
84
|
|
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse"> |
|
85
|
|
|
<span class="sr-only">Toggle Navigation</span> |
|
86
|
|
|
<span class="icon-bar"></span> |
|
87
|
|
|
<span class="icon-bar"></span> |
|
88
|
|
|
<span class="icon-bar"></span> |
|
89
|
|
|
</button> |
|
90
|
|
|
<a class="navbar-brand" href="index.php">Leads</a> |
|
91
|
|
|
</div> |
|
92
|
|
|
<ul class="nav navbar-top-links navbar-right links"> |
|
93
|
|
|
<a href="../"> |
|
94
|
|
|
<span class="glyphicon glyphicon-home"></span> |
|
95
|
|
|
</a> |
|
96
|
|
|
|
|
97
|
|
|
'.$log.' |
|
98
|
|
|
<li class="dropdown"> |
|
99
|
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> |
|
100
|
|
|
<span class="glyphicon glyphicon-link"></span> |
|
101
|
|
|
<b class="caret"></b> |
|
102
|
|
|
</a> |
|
103
|
|
|
<ul class="dropdown-menu dropdown-sites"> |
|
104
|
|
|
'.$sites.' |
|
105
|
|
|
</ul> |
|
106
|
|
|
</li> |
|
107
|
|
|
</ul> |
|
108
|
|
|
<div class="navbar-default sidebar" role="navigation"> |
|
109
|
|
|
<div class="sidebar-nav navbar-collapse" style="height: 1px;"> |
|
110
|
|
|
<ul class="nav" id="side-menu"> |
|
111
|
|
|
<li> |
|
112
|
|
|
<a href="index.php"><span class="glyphicon glyphicon-dashboard"></span> Dashboard</a> |
|
113
|
|
|
</li> |
|
114
|
|
|
<li> |
|
115
|
|
|
<a href="#"><span class="glyphicon glyphicon-th-list"></span> Directory</a> |
|
116
|
|
|
<ul class="nav nav-second-level collapse"> |
|
117
|
|
|
<li><a href="directory.php">All</a></li> |
|
118
|
|
|
<li><a href="directory.php?filter=aar">AAR</a></li> |
|
119
|
|
|
<li><a href="directory.php?filter=af">AFs</a></li> |
|
120
|
|
|
<li><a href="directory.php?filter=cc">CC</a></li> |
|
121
|
|
|
<li><a href="directory.php?filter=360">360/24/7 Department</a></li> |
|
122
|
|
|
<li><a href="directory.php?filter=Art">Art</a></li> |
|
123
|
|
|
<li><a href="directory.php?filter=CityPlanning">City Planning</a></li> |
|
124
|
|
|
<li><a href="directory.php?filter=Comm">Communications</a></li> |
|
125
|
|
|
<li><a href="directory.php?filter=Safety">Safety</a></li> |
|
126
|
|
|
<li><a href="directory.php?filter=site-ops">Site-Ops</a></li> |
|
127
|
|
|
<li><a href="directory.php?filter=siteprep">Site Prep</a></li> |
|
128
|
|
|
<li><a href="directory.php?filter=sign-off">Site Sign-Off</a></li> |
|
129
|
|
|
<li><a href="directory.php?filter=vc">Volunteer Coordinator</a></li> |
|
130
|
|
|
</ul> |
|
131
|
|
|
</li> |
|
132
|
|
|
</ul> |
|
133
|
|
|
</div> |
|
134
|
|
|
</div> |
|
135
|
|
|
</nav> |
|
136
|
|
|
<div id="page-wrapper" style="min-height: 538px;">'.$this->body.'</div></div>'; |
|
137
|
|
|
$this->add_login_form(); |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
function print_page($header = true) |
|
|
|
|
|
|
141
|
|
|
{ |
|
142
|
|
|
if($this->user == false) |
|
143
|
|
|
{ |
|
144
|
|
|
$this->body = ' |
|
145
|
|
|
<div class="row"> |
|
146
|
|
|
<div class="col-lg-12"> |
|
147
|
|
|
<h1 class="page-header">You must <a href="/login.php?return='.$this->currentURL().'">log in <span class="glyphicon glyphicon-log-in"></span></a> to access the Burning Flipside Profile Admin system!</h1> |
|
148
|
|
|
</div> |
|
149
|
|
|
</div>'; |
|
150
|
|
|
} |
|
151
|
|
|
else if($this->is_lead === false) |
|
152
|
|
|
{ |
|
153
|
|
|
$this->body = ' |
|
154
|
|
|
<div class="row"> |
|
155
|
|
|
<div class="col-lg-12"> |
|
156
|
|
|
<h1 class="page-header">You must be a lead to access this page!</h1> |
|
157
|
|
|
</div> |
|
158
|
|
|
</div>'; |
|
159
|
|
|
} |
|
160
|
|
|
parent::printPage(true); |
|
|
|
|
|
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
function add_login_form() |
|
|
|
|
|
|
164
|
|
|
{ |
|
165
|
|
|
$this->body .= '<div class="modal fade" role="dialog" id="login-dialog" title="Login" aria-hidden="true"> |
|
166
|
|
|
<div class="modal-dialog"> |
|
167
|
|
|
<div class="modal-content"> |
|
168
|
|
|
<div class="modal-header"> |
|
169
|
|
|
<button type="button" class="close" data-dismiss="modal"> |
|
170
|
|
|
<span aria-hidden="true">×</span> |
|
171
|
|
|
<span class="sr-only">Close</span> |
|
172
|
|
|
</button> |
|
173
|
|
|
<h4 class="modal-title">Login</h4> |
|
174
|
|
|
</div> |
|
175
|
|
|
<div class="modal-body"> |
|
176
|
|
|
<form id="login_dialog_form" role="form"> |
|
177
|
|
|
<input class="form-control" type="text" name="username" placeholder="Username or Email" required autofocus/> |
|
178
|
|
|
<input class="form-control" type="password" name="password" placeholder="Password" required/> |
|
179
|
|
|
<input type="hidden" name="return" value="'.$this->current_url().'"/> |
|
|
|
|
|
|
180
|
|
|
<button class="btn btn-lg btn-primary btn-block" type="submit">Login</button> |
|
181
|
|
|
</form> |
|
182
|
|
|
</div> |
|
183
|
|
|
</div> |
|
184
|
|
|
</div> |
|
185
|
|
|
</div>'; |
|
186
|
|
|
} |
|
187
|
|
|
} |
|
188
|
|
|
?> |
|
|
|
|
|
|
189
|
|
|
|
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.