-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlugin.php
More file actions
180 lines (163 loc) · 4.69 KB
/
Plugin.php
File metadata and controls
180 lines (163 loc) · 4.69 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
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
<?php namespace Cargie\Booking;
use Backend\Facades\Backend;
use Illuminate\Support\Carbon;
use System\Classes\PluginBase;
use Illuminate\Support\Facades\Event;
/**
* Booking Plugin Information File
*/
class Plugin extends PluginBase
{
public $require = [
'Rainlab.User', 'Responsiv.Pay'
];
/**
* Returns information about this plugin.
*
* @return array
*/
public function pluginDetails()
{
return [
'name' => 'Booking',
'description' => 'Booking Solution for October CMS',
'author' => 'Cargie',
'icon' => 'icon-book',
];
}
/**
* Register method, called when the plugin is first registered.
*
* @return void
*/
public function register()
{
}
/**
* Boot method, called right before the request route.
*
* @return array
*/
public function boot()
{
Event::listen('backend.menu.extendItems', function ($manager) {
// $manager->removeMainMenuItem('Rainlab.User', 'user');
// $manager->addMainMenuItems('Rainlab.User', [
// 'user' => [
// 'label' => 'Customers',
// 'icon' => 'icon-user',
// 'url' => Backend::url('rainlab/user/users'),
// 'order' => 301,
// ],
// ]);
});
}
/**
* Registers any front-end components implemented in this plugin.
*
* @return array
*/
public function registerComponents()
{
return [
'Cargie\Booking\Components\Rooms' => 'rooms',
];
}
/**
* Registers any back-end permissions used by this plugin.
*
* @return array
*/
public function registerPermissions()
{
return []; // Remove this line to activate
return [
'cargie.booking.some_permission' => [
'tab' => 'Booking',
'label' => 'Some permission',
],
];
}
/**
* Registers back-end navigation items for this plugin.
*
* @return array
*/
public function registerNavigation()
{
// return [];
return [
'booking' => [
'label' => 'Booking',
'url' => Backend::url('cargie/booking/bookings'),
'icon' => 'icon-book',
'permissions' => ['cargie.booking.*'],
'order' => 300,
'sideMenu' => [
'bookings' => [
'label' => 'Bookings',
'url' => Backend::url('cargie/booking/bookings'),
'icon' => 'icon-book',
],
'calendar' => [
'label' => 'Calendar',
'url' => Backend::url('cargie/booking/calendar'),
'icon' => 'icon-calendar',
],
'rooms' => [
'label' => 'Rooms',
'url' => Backend::url('cargie/booking/rooms'),
'icon' => 'icon-building-o',
],
'costs' => [
'label' => 'Adv Costs',
'url' => Backend::url('cargie/booking/costs'),
'icon' => 'icon-money',
],
'seasons' => [
'label' => 'Season Filters',
'url' => Backend::url('cargie/booking/seasons'),
'icon' => 'icon-leaf',
],
],
],
];
}
public function registerFormWidgets()
{
return [
'Cargie\Booking\FormWidgets\DatesPicker' => [
'label' => 'Date Picker',
'code' => 'datespicker',
],
];
}
public function registerListColumnTypes()
{
return [
// A local method, i.e $this->evalUppercaseListColumn()
'uppercase' => [$this, 'evalUppercaseListColumn'],
// Using an inline closure
'loveit' => function ($value) {
return 'I love ' . $value;
},
'ucfirst' => function ($value) {
return ucfirst($value);
}
];
}
public function evalUppercaseListColumn($value, $column, $record)
{
return strtoupper($value);
}
public function registerMarkupTags()
{
return [
'functions' => [
'parse' => function ($value) {
return Carbon::parse($value);
}
]
];
}
}