-
Notifications
You must be signed in to change notification settings - Fork 1
/
RiProduct.php
46 lines (34 loc) · 1.49 KB
/
RiProduct.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
<?php
namespace plugins\riProduct;
use plugins\riCore\PluginCore;
use plugins\riPlugin\Plugin;
class RiProduct extends PluginCore{
public function install(){
global $db;
$settings = Plugin::get('settings')->load("riProduct");
$columns = Plugin::get('riCore.DatabasePatch')->getColumns(TABLE_PRODUCTS_DESCRIPTION);
foreach($settings['tabs'] as $key => $value ){
if(!in_array($key, $columns))
$db->Execute("ALTER TABLE " . TABLE_PRODUCTS_DESCRIPTION . " ADD " . $key ." " .$value['type']);
}
return true;
}
public function uninstall(){
global $db;
$settings = Plugin::get('settings')->load("riProduct");
$columns = Plugin::get('riCore.DatabasePatch')->getColumns(TABLE_PRODUCTS_DESCRIPTION);
foreach($settings['tabs'] as $key => $value ){
if(in_array($key, $columns))
$db->Execute("ALTER TABLE " . TABLE_PRODUCTS_DESCRIPTION . " DROP COLUMN " . $key);
}
return true;
}
public function init(){
//Plugin::get('templating.holder')->add("FORM_ADD_INFO_PRODUCT", Plugin::get('View')->render("riProduct::backend/_addform.php"));
if(IS_ADMIN_FLAG)
if(basename($_SERVER["SCRIPT_FILENAME"]) == 'product.php'){
global $autoLoadConfig;
$autoLoadConfig[200][] = array('autoType' => 'include', 'loadFile' => __DIR__ . '/lib/observers.php');
}
}
}