-
Notifications
You must be signed in to change notification settings - Fork 2
/
details.php
174 lines (150 loc) · 3.46 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
<?php defined('BASEPATH') or exit('No direct script access allowed');
/**
* Links Module
*
* @package Links Module
* @author Mike Van Winkle
* @copyright Copyright (c) 2011, Mike Van Winkle
* @license http://www.mikevanwinkle.com
* @link http://www.mikevanwinkle.com
*/
class Module_Links extends Module {
public $version = '1.0.2';
function __construct()
{
//$ci =& get_instance();
//print_r($ci->router);
}
// --------------------------------------------------------------------------
public function info()
{
$info = array(
'name' => array(
'en' => 'Links',
),
'description' => array(
'en' => 'A simple links manager for your pyrocms blog',
),
'frontend' => TRUE,
'backend' => TRUE,
'author' => 'Mike Van Winkle',
'menu' => 'content',
'roles' => array('admin_links'),
'sections' => array(
'links' => array(
'name' => 'links_admin.title',
'uri' => 'admin/links',
'shortcuts' => array(
array(
'name' => 'links_admin.create_button',
'uri' => 'admin/links/create',
'class' => 'add'
)
)
),
'links_groups'=>array(
'name'=> 'links_admin.groups',
'uri' => 'admin/links/groups',
'shortcuts' => array(
array(
'name'=>'links_groups_admin.create_button',
'uri' =>'admin/links/groups/create',
'class'=>'add'
)
)
)
)
);
return $info;
}
public function install() {
$fields = array(
'id' => array(
'type' => 'INT',
'constraint' => '11',
'unsigned' => true,
'auto_increment'=> true
),
'link_name' => array(
'type' => 'VARCHAR',
'constraint' => '255',
'null' => TRUE
),
'link_url' => array(
'type' => 'VARCHAR',
'constraint' => '255',
'null' => TRUE
),
'link_description'=> array(
'type' => 'TEXT',
'null' => TRUE
),
'link_target' => array(
'type' => 'VARCHAR',
'constraint' => '255',
'null' => TRUE
),
'link_created' => array(
'type' => 'datetime',
),
'link_owner' => array(
'type' => 'INT',
'unsigned' => TRUE,
'constraint' => 11
),
'link_group' => array(
'type' =>'INT',
'unsigned' =>TRUE,
'constraint'=> 11
)
);
$groups_fields = array(
'id' => array(
'type' => 'INT',
'constraint' => 11,
'unsigned' => TRUE,
'auto_increment'=>TRUE
),
'name' => array(
'type'=>'text',
'constraint'=>'100'
),
'description'=> array(
'type' => 'TEXT',
'null' => TRUE
),
'slug' => array(
'type'=>'text',
'constraint'=>'100'
)
);
$this->dbforge->add_field($fields);
$this->dbforge->add_key('id',TRUE);
$this->dbforge->create_table('links',TRUE);
$this->dbforge->add_field($groups_fields);
$this->dbforge->add_key('id',TRUE);
$this->dbforge->create_table('links_groups',TRUE);
return TRUE;
}
public function uninstall() {
$links_tbl = $this->dbforge->drop_table('links');
$links_groups_tbl = $this->dbforge->drop_table('links_groups');
if($links_tbl && $links_groups_tbl)
{
return TRUE;
}
return FALSE;
}
public function upgrade($old_version) {
$update_fields = array(
'link_group' => array(
'type' =>'INT',
'unsigned' =>TRUE,
'constraint'=> 11
)
);
$this->dbforge->add_column('links',$update_fields);
return TRUE;
}
}
/* End of file details.php */