This repository has been archived by the owner on Aug 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
smartblogarchive.php
97 lines (88 loc) · 3.44 KB
/
smartblogarchive.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
<?php
if (!defined('_PS_VERSION_'))
exit;
require_once (_PS_MODULE_DIR_.'smartblog/classes/SmartBlogPost.php');
require_once (_PS_MODULE_DIR_.'smartblog/smartblog.php');
class smartblogarchive extends Module {
public function __construct() {
$this->name = 'smartblogarchive';
$this->tab = 'front_office_features';
$this->version = '2.0.1';
$this->bootstrap = true;
$this->author = 'SmartDataSoft';
$this->secure_key = Tools::encrypt($this->name);
parent::__construct();
$this->displayName = $this->l('Smart Blog Archive');
$this->description = $this->l('The Most Powerfull Presta shop Blog Archive Module\'s - by smartdatasoft');
$this->confirmUninstall = $this->l('Are you sure you want to delete your details ?');
}
public function install(){
$langs = Language::getLanguages();
$id_lang = (int) Configuration::get('PS_LANG_DEFAULT');
if (!parent::install() || !$this->registerHook('leftColumn') || !$this->registerHook('displaySmartBlogLeft')
|| !$this->registerHook('actionsbdeletepost')
|| !$this->registerHook('actionsbnewpost')
|| !$this->registerHook('actionsbupdatepost')
|| !$this->registerHook('actionsbtogglepost')
)
return false;
return true;
}
public function uninstall() {
$this->DeleteCache();
if (!parent::uninstall())
return false;
return true;
}
public function hookLeftColumn($params) {
if(Module::isInstalled('smartblog') != 1){
$this->smarty->assign( array(
'smartmodname' => $this->name
));
return $this->display(__FILE__, 'views/templates/front/install_required.tpl');
}
else
{
if (!$this->isCached('smartblogarchive.tpl', $this->getCacheId()))
{
$view_data = array();
$id_lang = $this->context->language->id;
$SmartBlogPost = new SmartBlogPost();
$archives = $SmartBlogPost->getArchive();
$this->smarty->assign( array(
'archives' => $archives
));
}
return $this->display(__FILE__, 'views/templates/front/smartblogarchive.tpl',$this->getCacheId());
}
}
public function hookRightColumn($params){
return $this->hookLeftColumn($params);
}
public function hookdisplaySmartBlogLeft($params){
return $this->hookLeftColumn($params);
}
public function DeleteCache()
{
return $this->_clearCache('smartblogarchive.tpl', $this->getCacheId());
}
public function hookactionsbdeletepost($params)
{
return $this->DeleteCache();
}
public function hookactionsbnewpost($params)
{
return $this->DeleteCache();
}
public function hookactionsbupdatepost($params)
{
return $this->DeleteCache();
}
public function hookactionsbtogglepost($params)
{
return $this->DeleteCache();
}
public function hookdisplaySmartBlogRight($params) {
return $this->hookLeftColumn($params);
}
}