Repository navigation
Expand file tree
/
Copy pathdetails.php
More file actions
149 lines (134 loc) · 5.19 KB
/
Copy pathdetails.php
File metadata and controls
149 lines (134 loc) · 5.19 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
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Module_Portfolio extends Module {
/**
* @var string
*/
public $version = '1.0';
/**
* @return array
*/
public function info() {
return array(
'name' => array(
'en' => 'Portfolio',
),
'description' => array(
'en' => 'Manage your portfolio.',
),
'frontend' => TRUE,
'backend' => TRUE,
'skip_xss' => TRUE,
'menu' => 'content',
'roles' => array(
'put_live', 'edit_live', 'delete_live'
)
);
}
/**
* @todo Don't use separate client, have hierarchial categories.
* @return boolean
*/
public function install() {
$this->dbforge->drop_table('portfolio_clients');
$this->dbforge->drop_table('portfolio_categories');
$this->dbforge->drop_table('portfolio');
$this->dbforge->drop_table('portfolio_portfolio_categories');
$portfolio_clients = "
CREATE TABLE " . $this->db->dbprefix('portfolio_clients') . " (
`id` int(11) NOT NULL auto_increment,
`slug` varchar(20) collate utf8_unicode_ci NOT NULL default '',
`title` varchar(20) collate utf8_unicode_ci NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE KEY `slug - unique` (`slug`),
UNIQUE KEY `title - unique` (`title`),
KEY `slug - normal` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Portfolio Clients.';
";
$portfolio_categories = "
CREATE TABLE " . $this->db->dbprefix('portfolio_categories') . " (
`id` int(11) NOT NULL auto_increment,
`slug` varchar(20) collate utf8_unicode_ci NOT NULL default '',
`title` varchar(20) collate utf8_unicode_ci NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE KEY `slug - unique` (`slug`),
UNIQUE KEY `title - unique` (`title`),
KEY `slug - normal` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Portfolio Categories.';
";
$portfolio = "
CREATE TABLE " . $this->db->dbprefix('portfolio') . " (
`id` int(11) NOT NULL auto_increment,
`title` varchar(100) collate utf8_unicode_ci NOT NULL default '',
`slug` varchar(100) collate utf8_unicode_ci NOT NULL default '',
`client_id` int(11) NOT NULL,
`thumbnail_id` int(11) DEFAULT NULL,
`intro` text collate utf8_unicode_ci NOT NULL,
`body` text collate utf8_unicode_ci NOT NULL,
`author_id` int(11) NOT NULL default '0',
`created_on` int(11) NOT NULL,
`updated_on` int(11) NOT NULL default 0,
`status` enum('draft','live') collate utf8_unicode_ci NOT NULL default 'draft',
PRIMARY KEY (`id`),
UNIQUE KEY `title` (`title`),
KEY `client_id - normal` (`client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Portfolio items.';
";
$portfolio_portfolio_categories = "
CREATE TABLE " . $this->db->dbprefix('portfolio_portfolio_categories') . " (
`id` int(11) NOT NULL AUTO_INCREMENT,
`portfolio_id` int(11) NOT NULL,
`category_id` int(11) NOT NULL,
`order` int(11) DEFAULT '0',
PRIMARY KEY (`id`),
KEY `portfolio_id` (`portfolio_id`),
KEY `category_id` (`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
";
if ($this->db->query($portfolio_categories) &&
$this->db->query($portfolio) &&
$this->db->query($portfolio_clients) &&
$this->db->query($portfolio_portfolio_categories)) {
return TRUE;
}
}
/**
*
* @return boolean
*/
public function uninstall() {
if ($this->dbforge->drop_table($this->db->dbprefix('portfolio')) &&
$this->dbforge->drop_table($this->db->dbprefix('portfolio_categories')) &&
$this->dbforge->drop_table($this->db->dbprefix('portfolio_clients')) &&
$this->dbforge->drop_table($this->db->dbprefix('portfolio_portfolio_categories'))) {
return TRUE;
}
}
/**
* @todo this
* @param string $old_version
* @return boolean
*/
public function upgrade($old_version) {
// Your Upgrade Logic
return TRUE;
}
/**
* @todo this
* @return boolean
*/
public function help() {
/**
* Either return a string containing help info
* return "Some help info";
*
* Or add a language/help_lang.php file and
* return TRUE;
*
* help_lang.php contents
* $lang['help_body'] = "Some help info";
*/
return TRUE;
}
}
/* End of file details.php */