This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathminicskeleton.php
180 lines (157 loc) · 4.4 KB
/
minicskeleton.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
175
176
177
178
179
180
<?php
/*
* minicskeleton - a module template for Prestashop v1.5+
* Copyright (C) 2013 S.C. Minic Studio S.R.L.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!defined('_PS_VERSION_'))
exit;
class MinicSkeleton extends Module
{
// DB file
const INSTALL_SQL_FILE = 'install.sql';
public function __construct()
{
$this->name = 'minicskeleton';
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'minic studio';
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.5', 'max' => '1.6');
// $this->dependencies = array('blockcart');
parent::__construct();
$this->displayName = $this->l('Minic Skeleton');
$this->description = $this->l('A skeleton module for developers.');
$this->confirmUninstall = $this->l('Are you sure you want to uninstall?');
}
/**
* install
*/
public function install()
{
// Create DB tables - uncomment below to use the install.sql for database manipulation
/*
if (!file_exists(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE))
return false;
else if (!$sql = file_get_contents(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE))
return false;
$sql = str_replace(array('PREFIX_', 'ENGINE_TYPE'), array(_DB_PREFIX_, _MYSQL_ENGINE_), $sql);
// Insert default template data
$sql = str_replace('THE_FIRST_DEFAULT', serialize(array('width' => 1, 'height' => 1)), $sql);
$sql = str_replace('FLY_IN_DEFAULT', serialize(array('width' => 1, 'height' => 1)), $sql);
$sql = preg_split("/;\s*[\r\n]+/", trim($sql));
foreach ($sql as $query)
if (!Db::getInstance()->execute(trim($query)))
return false;
*/
if (!parent::install() ||
!$this->registerHook('displayHome') ||
!$this->registerHook('displayHeader') ||
!$this->registerHook('displayBackOfficeHeader') ||
!$this->registerHook('displayAdminHomeQuickLinks'))
return false;
return true;
}
/**
* uninstall
*/
public function uninstall()
{
if (!parent::uninstall())
return false;
return true;
}
/**
* admin page
*/
public function getContent()
{
return $this->display(__FILE__, 'views/templates/admin/minicskeleton.tpl');
}
// BACK OFFICE HOOKS
/**
* admin <head> Hook
*/
public function hookDisplayBackOfficeHeader()
{
// CSS
$this->context->controller->addCSS($this->_path.'views/css/elusive-icons/elusive-webfont.css');
// JS
// $this->context->controller->addJS($this->_path.'views/js/js_file_name.js');
}
/**
* Hook for back office dashboard
*/
public function hookDisplayAdminHomeQuickLinks()
{
$this->context->smarty->assign('minicskeleton', $this->name);
return $this->display(__FILE__, 'views/templates/hooks/quick_links.tpl');
}
// FRONT OFFICE HOOKS
/**
* <head> Hook
*/
public function hookDisplayHeader()
{
// CSS
$this->context->controller->addCSS($this->_path.'views/css/'.$this->name.'.css');
// JS
$this->context->controller->addJS($this->_path.'views/js/'.$this->name.'.js');
}
/**
* Top of pages hook
*/
public function hookDisplayTop($params)
{
return $this->hookDisplayHome($params);
}
/**
* Home page hook
*/
public function hookDisplayHome($params)
{
$this->context->smarty->assign('MinicSkeleton', array(
'some_smarty_var' => 'some_data',
'some_smarty_array' => array(
'some_smarty_var' => 'some_data',
'some_smarty_var' => 'some_data'
),
'some_smarty_var' => 'some_data'
));
return $this->display(__FILE__, 'views/templates/hooks/home.tpl');
}
/**
* Left Column Hook
*/
public function hookDisplayRightColumn($params)
{
return $this->hookDisplayHome($params);
}
/**
* Right Column Hook
*/
public function hookDisplayLeftColumn($params)
{
return $this->hookDisplayHome($params);
}
/**
* Footer hook
*/
public function hookDisplayFooter($params)
{
return $this->hookDisplayHome($params);
}
}
?>