-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathModule.php
More file actions
119 lines (101 loc) · 3.34 KB
/
Module.php
File metadata and controls
119 lines (101 loc) · 3.34 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
/**
* @author Matthew McNaney <mcnaney at gmail dot com>
*/
namespace contact;
/**
*
* @author Matthew McNaney <mcnaney at gmail dot com>
* @license http://opensource.org/licenses/lgpl-3.0.html
*/
class Module extends \Canopy\Module implements \Canopy\SettingDefaults
{
public function __construct()
{
parent::__construct();
$this->setTitle('contact');
$this->setProperName('Contact');
}
public function getController(\Canopy\Request $request)
{
$cmd = $request->shiftCommand();
if ($cmd == 'admin') {
if (\Current_User::allow('contact')) {
$controller = $request->shiftCommand();
switch ($controller) {
case 'map':
$map = new \contact\Controller\Map($this);
return $map;
case 'social':
$social = new \contact\Controller\Social($this);
return $social;
case 'email':
$email = new \contact\Controller\Email($this);
return $email;
case 'contactinfo':
default:
$contact_info = new \contact\Controller\ContactInfo($this);
return $contact_info;
}
} else {
\Current_User::requireLogin();
}
} else {
$controller = new \contact\Controller\User($this);
return $controller;
}
}
public function runTime(\Canopy\Request $request)
{
if (\phpws2\Settings::get('contact', 'linkSupport')) {
Factory\ContactInfo::emailChoice();
}
Factory\ContactInfo::showSiteContact();
$frontOnly = \phpws2\Settings::get('contact', 'front_only');
if ($frontOnly && !\phpws\PHPWS_Core::atHome()) {
return;
}
$module = $request->getModule();
if ($module !== 'contact') {
$content = Factory\ContactInfo::display();
if (!empty($content)) {
\Layout::add($content, 'contact', 'box');
}
}
}
public function getSettingDefaults()
{
// ContactInfo
$settings['building'] = null;
$settings['room_number'] = null;
$settings['phone_number'] = null;
$settings['fax_number'] = null;
$settings['email'] = null;
$settings['site_contact_name'] = null;
$settings['site_contact_email'] = null;
$settings['other_information'] = null;
// Physical Address
$settings['street'] = null;
$settings['post_box'] = null;
$settings['city'] = null;
$settings['state'] = 'NC';
$settings['zip'] = null;
// Offsite
$settings['social'] = null;
// Map
$settings['accessToken'] = null;
$settings['thumbnail_map'] = null;
$settings['latitude'] = null;
$settings['longitude'] = null;
$settings['full_map_link'] = null;
$settings['pitch'] = 60;
$settings['zoom'] = 18;
$settings['dimension_x'] = '300';
$settings['dimension_y'] = '200';
// Email
$settings['linkSupport'] = false;
// Display
$settings['front_only'] = false;
return $settings;
}
}