|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
You may not change or alter any portion of this comment or credits |
|
4
|
|
|
of supporting developers from this source code or any supporting source code |
|
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
6
|
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
|
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* oledrion |
|
14
|
|
|
* |
|
15
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
|
16
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
|
17
|
|
|
* @author Hervé Thouzard (http://www.herve-thouzard.com/) |
|
18
|
|
|
* @param $category |
|
19
|
|
|
* @param $item_id |
|
20
|
|
|
* @return mixed |
|
21
|
|
|
*/ |
|
22
|
|
|
function oledrion_notify_iteminfo($category, $item_id) |
|
23
|
|
|
{ |
|
24
|
|
|
global $xoopsModule, $xoopsModuleConfig; |
|
25
|
|
|
/** @var \XoopsDatabase $db */ |
|
26
|
|
|
$db = \XoopsDatabaseFactory::getDatabaseConnection(); |
|
27
|
|
|
$item_id = (int)$item_id; |
|
28
|
|
|
|
|
29
|
|
|
if (empty($xoopsModule) || 'oledrion' !== $xoopsModule->getVar('dirname')) { |
|
30
|
|
|
/** @var \XoopsModuleHandler $moduleHandler */ |
|
31
|
|
|
$moduleHandler = xoops_getHandler('module'); |
|
32
|
|
|
$module = $moduleHandler->getByDirname('oledrion'); |
|
33
|
|
|
/** @var \XoopsConfigHandler $configHandler */ |
|
34
|
|
|
$configHandler = xoops_getHandler('config'); |
|
35
|
|
|
$config = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
|
36
|
|
|
} else { |
|
37
|
|
|
$module = $xoopsModule; |
|
38
|
|
|
// TODO: Never used !!! |
|
39
|
|
|
$config = $xoopsModuleConfig; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
if ('global' === $category) { |
|
43
|
|
|
$item['name'] = ''; |
|
|
|
|
|
|
44
|
|
|
$item['url'] = ''; |
|
45
|
|
|
|
|
46
|
|
|
return $item; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
if ('new_category' === $category) { |
|
50
|
|
|
include OLEDRION_PATH . 'include/common.php'; |
|
51
|
|
|
$categoryHandler = new \XoopsModules\Oledrion\CategoryHandler($db); |
|
52
|
|
|
$category = $categoryHandler->get($item_id); |
|
53
|
|
|
if (is_object($category)) { |
|
54
|
|
|
$item['name'] = $category->getVar('cat_title'); |
|
55
|
|
|
$item['url'] = OLEDRION_URL . 'category.php?cat_cid=' . $item_id; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
return $item; |
|
|
|
|
|
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
if ('new_product' === $category) { |
|
62
|
|
|
include OLEDRION_PATH . 'include/common.php'; |
|
63
|
|
|
$productsHandler = new \XoopsModules\Oledrion\ProductsHandler($db); |
|
64
|
|
|
$product = $productsHandler->get($item_id); |
|
65
|
|
|
if (is_object($product)) { |
|
66
|
|
|
$item['name'] = $product->getVar('product_title'); |
|
67
|
|
|
$item['url'] = OLEDRION_URL . 'product.php?product_id=' . $item_id; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
return $item; |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|