-
Notifications
You must be signed in to change notification settings - Fork 0
/
details.php
188 lines (159 loc) · 4.08 KB
/
details.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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?php
use Pyro\Module\Addons\AbstractModule;
use Pyro\Module\Streams_core\StreamModel;
use Pyro\Module\Streams_core\FieldModel;
use Pyro\Module\Streams_core\SchemaUtility;
/**
* @package PyroCMS\Core\Modules\Routes
* @author Ryan Thompson - AI Web Systems, Inc.
* @copyright Copyright (c) 2008 - 2013, AI Web Systems, Inc.
* @license http://aiwebsystems.com/docs/license
* @link http://aiwebsystems.com/
*/
class Module_Routes extends AbstractModule
{
public $version = '1.1';
/**
* Return module information
* @return array
*/
public function info()
{
// Module information
$info = array(
'name' => array(
'en' => 'Routes'
),
'description' => array(
'en' => 'Manage custom routes.'
),
'skip_xss' => false,
'frontend' => false,
'backend' => true,
'menu' => 'structure',
'sections' => array()
/*'roles' => array(
'upload_file',
'download_file',
),*/
);
// Routes
$info['sections']['routes'] = array(
'name' => 'routes:section.routes',
'uri' => 'admin/routes',
'shortcuts' => array(
'add_route' => array(
'name' => 'global:add',
'uri' => 'admin/routes/create',
'class' => 'btn-sm btn-success'
),
),
);
return $info;
}
/**
* Install
*
* This function is run to install the module
*
* @return bool
*/
public function install($pdb, $schema)
{
// Clean house
self::uninstall($pdb, $schema);
/* Install Streams Data
----------------------------------------------------------------------------*/
// Add Contacts
StreamModel::addStream(
$slug = 'routes',
$namespace = 'routes',
$name = 'Routes',
$prefix = '',
$about = NULL,
$extra = array('title_column' => 'name')
);
// Build the fields
$fields = array(
array(
'name' => 'lang:routes:module',
'slug' => 'module',
'namespace' => 'routes',
'locked' => true,
'type' => 'text',
),
array(
'name' => 'lang:routes:name',
'slug' => 'name',
'namespace' => 'routes',
'locked' => true,
'type' => 'text',
),
array(
'name' => 'lang:routes:route_key',
'slug' => 'route_key',
'namespace' => 'routes',
'locked' => true,
'type' => 'text',
),
array(
'name' => 'lang:routes:route_value',
'slug' => 'route_value',
'namespace' => 'routes',
'locked' => true,
'type' => 'text',
),
);
// Add all the fields
FieldModel::addFields($fields, null, 'routes');
/* Routes assignments
-----------------------------------------------------------*/
FieldModel::assignField('routes', 'routes', 'module', array('instructions' => 'lang:routes:instructions.module'));
FieldModel::assignField('routes', 'routes', 'name', array('is_unique' => true, 'instructions' => 'lang:routes:instructions.name'));
FieldModel::assignField('routes', 'routes', 'route_key', array('is_required' => true, 'instructions' => 'lang:routes:instructions.route_key'));
FieldModel::assignField('routes', 'routes', 'route_value', array('is_required' => true, 'instructions' => 'lang:routes:instructions.route_value'));
// Good to go
return true;
}
/**
* Uninstall
*
* This function is run to uninstall the module
*
* @return bool
*/
public function uninstall($pdb, $schema)
{
// Remove namespace and kill everyone
SchemaUtility::destroyNamespace('routes');
return true;
}
/**
* Upgrade migrations
* @param string $old_version Decimal of the version type
* @return bool
*/
public function upgrade($old_version)
{
return true;
}
/**
* Admin menu hook
* @param array &$menu
* @return void
*/
public function admin_menu(&$menu)
{
// Do nothing!
}
/**
* Halp
* @return string
*/
public function help()
{
// Return a string containing help info
// You could include a file and return it here.
return 'http://docs.pyrocms.com/2.3/manual/modules/routes';
}
}