-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmoduleclass.stub.php
96 lines (88 loc) · 2.4 KB
/
moduleclass.stub.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
<?php
namespace FreePBX\modules;
use BMO;
use FreePBX;
/*
* Class stub for BMO Module class
* In _Construct you may remove the database line if you don't use it
* In getActionbar change "modulename" to the display value for the page
* In getActionbar change extdisplay to align with whatever variable you use to decide if the page is in edit mode.
*
*/
class Classname implements BMO
{
public function __construct(FreePBX $freepbx)
{
$this->FreePBX = $freepbx;
$this->db = $freepbx->Database;
}
public function install()
{
}
public function uninstall()
{
}
public function doConfigPageInit($page)
{
}
public function getActionBar($request)
{
$buttons = [];
switch ($_GET['display']) {
case 'modulename':
$buttons = [
'delete' => [
'name' => 'delete',
'id' => 'delete',
'value' => _('Delete')
],
'reset' => [
'name' => 'reset',
'id' => 'reset',
'value' => _('Reset')
],
'submit' => [
'name' => 'submit',
'id' => 'submit',
'value' => _('Submit')
],
];
if (empty($_GET['extdisplay'])) {
unset($buttons['delete']);
}
break;
}
return $buttons;
}
public function ajaxRequest($req, &$setting)
{
switch ($req) {
case 'getJSON':
return true;
default:
return false;
}
}
public function ajaxHandler()
{
switch ($_REQUEST['command']) {
case 'getJSON':
switch ($_GET['jdata']) {
case 'grid':
$ret = [];
/*code here to generate array*/
return $ret;
default:
return false;
}
default:
return false;
}
}
public function getRightNav($request)
{
//You should probably load_view() here
$html = 'your custom html';
return $html;
}
}