-
Notifications
You must be signed in to change notification settings - Fork 38
/
details.php
103 lines (91 loc) · 2.41 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
<?php defined('BASEPATH') or exit('No direct script access allowed');
class Module_Sample extends Module {
public $version = '2.1';
public function info()
{
return array(
'name' => array(
'en' => 'Sample'
),
'description' => array(
'en' => 'This is a PyroCMS module sample.'
),
'frontend' => TRUE,
'backend' => TRUE,
'menu' => 'content', // You can also place modules in their top level menu. For example try: 'menu' => 'Sample',
'sections' => array(
'items' => array(
'name' => 'sample:items', // These are translated from your language file
'uri' => 'admin/sample',
'shortcuts' => array(
'create' => array(
'name' => 'sample:create',
'uri' => 'admin/sample/create',
'class' => 'add'
)
)
)
)
);
}
public function install()
{
$this->dbforge->drop_table('sample');
$this->db->delete('settings', array('module' => 'sample'));
$sample = array(
'id' => array(
'type' => 'INT',
'constraint' => '11',
'auto_increment' => TRUE
),
'name' => array(
'type' => 'VARCHAR',
'constraint' => '100'
),
'slug' => array(
'type' => 'VARCHAR',
'constraint' => '100'
)
);
$sample_setting = array(
'slug' => 'sample_setting',
'title' => 'Sample Setting',
'description' => 'A Yes or No option for the Sample module',
'`default`' => '1',
'`value`' => '1',
'type' => 'select',
'`options`' => '1=Yes|0=No',
'is_required' => 1,
'is_gui' => 1,
'module' => 'sample'
);
$this->dbforge->add_field($sample);
$this->dbforge->add_key('id', TRUE);
if($this->dbforge->create_table('sample') AND
$this->db->insert('settings', $sample_setting) AND
is_dir($this->upload_path.'sample') OR @mkdir($this->upload_path.'sample',0777,TRUE))
{
return TRUE;
}
}
public function uninstall()
{
$this->dbforge->drop_table('sample');
$this->db->delete('settings', array('module' => 'sample'));
{
return TRUE;
}
}
public function upgrade($old_version)
{
// Your Upgrade Logic
return TRUE;
}
public function help()
{
// Return a string containing help info
// You could include a file and return it here.
return "No documentation has been added for this module.<br />Contact the module developer for assistance.";
}
}
/* End of file details.php */