-
Notifications
You must be signed in to change notification settings - Fork 3
/
Module.php
56 lines (47 loc) · 1.39 KB
/
Module.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
<?php
namespace election;
/**
* @license http://opensource.org/licenses/lgpl-3.0.html
* @author Matthew McNaney <mcnaney at gmail dot com>
*/
class Module extends \Canopy\Module implements \Canopy\SettingDefaults
{
public function __construct()
{
parent::__construct();
$this->setTitle('election');
$this->setProperName('Election');
}
public function getController(\Canopy\Request $request)
{
\Current_User::requireLogin();
$cmd = $request->shiftCommand();
if ($cmd == 'Admin' && \Current_User::allow('election')) {
$admin = new \election\Controller\Admin($this);
return $admin;
} else {
$user = new \election\Controller\User($this);
return $user;
}
}
public function getSettingDefaults()
{
}
public function init()
{
$define_file = PHPWS_SOURCE_DIR . 'mod/election/conf/defines.php';
if (!is_file($define_file)) {
exit('Election requires a copy of conf/defines.php to be created.');
}
require_once $define_file;
}
public function runTime(\Canopy\Request $request)
{
if (\Current_User::isLogged()) {
\election\Controller\User::loadNavBar();
}
if (\PHPWS_Core::atHome()) {
\election\Controller\User::welcomeScreen($this);
}
}
}