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 The XOOPS Project http://sourceforge.net/projects/xoops/ |
16
|
|
|
* @license http://www.fsf.org/copyleft/gpl.html GNU public license |
17
|
|
|
* @author Hervé Thouzard (http://www.herve-thouzard.com/) |
18
|
|
|
* @version $Id: notification.inc.php 12290 2014-02-07 11:05:17Z beckmi $ |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
function oledrion_notify_iteminfo($category, $item_id) |
22
|
|
|
{ |
23
|
|
|
global $xoopsModule, $xoopsModuleConfig; |
|
|
|
|
24
|
|
|
$item_id = intval($item_id); |
25
|
|
|
|
26
|
|
|
if (empty($xoopsModule) || $xoopsModule->getVar('dirname') != 'oledrion') { |
27
|
|
|
$module_handler = xoops_gethandler('module'); |
28
|
|
|
$module = $module_handler->getByDirname('oledrion'); |
29
|
|
|
$config_handler = xoops_gethandler('config'); |
30
|
|
|
$config = $config_handler->getConfigsByCat(0, $module->getVar('mid')); |
31
|
|
|
} else { |
32
|
|
|
$module = $xoopsModule; |
33
|
|
|
// TODO: Jamais utilisé !!! |
34
|
|
|
$config = $xoopsModuleConfig; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
if ($category == 'global') { |
38
|
|
|
$item['name'] = ''; |
|
|
|
|
39
|
|
|
$item['url'] = ''; |
40
|
|
|
|
41
|
|
|
return $item; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
View Code Duplication |
if ($category == 'new_category') { |
|
|
|
|
45
|
|
|
include OLEDRION_PATH . 'include/common.php'; |
46
|
|
|
$category = null; |
|
|
|
|
47
|
|
|
$category = $h_oledrion_cat->get($item_id); |
|
|
|
|
48
|
|
|
if (is_object($category)) { |
49
|
|
|
$item['name'] = $category->getVar('cat_title'); |
|
|
|
|
50
|
|
|
$item['url'] = OLEDRION_URL . 'category.php?cat_cid=' . $item_id; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
return $item; |
|
|
|
|
54
|
|
|
} |
55
|
|
|
|
56
|
|
View Code Duplication |
if ($category == 'new_product') { |
|
|
|
|
57
|
|
|
include OLEDRION_PATH . 'include/common.php'; |
58
|
|
|
$product = null; |
|
|
|
|
59
|
|
|
$product = $h_oledrion_products->get($item_id); |
|
|
|
|
60
|
|
|
if (is_object($product)) { |
61
|
|
|
$item['name'] = $product->getVar('product_title'); |
62
|
|
|
$item['url'] = OLEDRION_URL . 'product.php?product_id=' . $item_id; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
return $item; |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state