|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Xooghost module |
|
4
|
|
|
* |
|
5
|
|
|
* You may not change or alter any portion of this comment or credits |
|
6
|
|
|
* of supporting developers from this source code or any supporting source code |
|
7
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
|
8
|
|
|
* This program is distributed in the hope that it will be useful, |
|
9
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
11
|
|
|
* |
|
12
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
|
13
|
|
|
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
|
14
|
|
|
* @package Xooghost |
|
15
|
|
|
* @since 2.6.0 |
|
16
|
|
|
* @author Laurent JEN (Aka DuGris) |
|
17
|
|
|
* |
|
18
|
|
|
* @param $options |
|
19
|
|
|
* |
|
20
|
|
|
* @return mixed |
|
21
|
|
|
*/ |
|
22
|
|
|
function xooghost_show($options) |
|
23
|
|
|
{ |
|
24
|
|
|
$helper = \XoopsModules\Xooghost\Helper::getInstance(); |
|
25
|
|
|
$ghostConfig = $helper->loadConfig(); |
|
|
|
|
|
|
26
|
|
|
$pageHandler = $helper->getHandler('Page'); |
|
27
|
|
|
|
|
28
|
|
|
$helper->xoops()->theme()->addStylesheet('modules/xooghost/assets/css/module.css'); |
|
29
|
|
|
$helper->xoops()->theme()->addStylesheet('modules/xooghost/assets/css/block.css'); |
|
30
|
|
|
|
|
31
|
|
|
$block['template'] = $options[0]; |
|
|
|
|
|
|
32
|
|
|
$block['pages'] = $pageHandler->getPublished($options[1], $options[2], 0, $options[3]); |
|
|
|
|
|
|
33
|
|
|
|
|
34
|
|
|
return $block; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @param $options |
|
39
|
|
|
* |
|
40
|
|
|
* @return string |
|
41
|
|
|
*/ |
|
42
|
|
|
function xooghost_edit($options) |
|
43
|
|
|
{ |
|
44
|
|
|
$helper = \XoopsModules\Xooghost\Helper::getInstance(); |
|
45
|
|
|
$ghostConfig = $helper->loadConfig(); |
|
46
|
|
|
|
|
47
|
|
|
$block_form = new \XoopsBlockForm(); |
|
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
$display_mode = new \Xoops\Form\Select(_MB_XOO_GHOST_MODE . ' : ', 'options[0]', $options[0]); |
|
50
|
|
|
$display_mode->addOption('list', _MB_XOO_GHOST_MODE_LIST); |
|
51
|
|
|
$display_mode->addOption('table', _MB_XOO_GHOST_MODE_TABLE); |
|
52
|
|
|
$display_mode->addOption('select', _MB_XOO_GHOST_MODE_SELECT); |
|
53
|
|
|
$block_form->addElement($display_mode); |
|
54
|
|
|
|
|
55
|
|
|
$sort_mode = new \Xoops\Form\Select(_MB_XOO_GHOST_SORT . ' : ', 'options[1]', $options[1]); |
|
56
|
|
|
$sort_mode->addOption('id', _MB_XOO_GHOST_SORT_ID); |
|
57
|
|
|
$sort_mode->addOption('published', _MB_XOO_GHOST_SORT_RECENTS); |
|
58
|
|
|
$sort_mode->addOption('hits', _MB_XOO_GHOST_SORT_HITS); |
|
59
|
|
|
|
|
60
|
|
|
if ('none' !== $ghostConfig['xooghost_rld']['rld_mode']) { |
|
61
|
|
|
if ('rate' === $ghostConfig['xooghost_rld']['rld_mode']) { |
|
62
|
|
|
$sort_mode->addOption('rates', _MB_XOO_GHOST_SORT_RATES); |
|
63
|
|
|
} else { |
|
64
|
|
|
$sort_mode->addOption('like', _MB_XOO_GHOST_SORT_LIKE); |
|
65
|
|
|
$sort_mode->addOption('dislike', _MB_XOO_GHOST_SORT_DISLIKE); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
$sort_mode->addOption('random', _MB_XOO_GHOST_SORT_RANDOM); |
|
69
|
|
|
$block_form->addElement($sort_mode); |
|
70
|
|
|
|
|
71
|
|
|
$order_mode = new \Xoops\Form\Select(_MB_XOO_GHOST_ORDER . ' : ', 'options[2]', $options[2]); |
|
72
|
|
|
$order_mode->addOption('asc', _MB_XOO_GHOST_ORDER_ASC); |
|
73
|
|
|
$order_mode->addOption('desc', _MB_XOO_GHOST_ORDER_DESC); |
|
74
|
|
|
$block_form->addElement($order_mode); |
|
75
|
|
|
|
|
76
|
|
|
$block_form->addElement(new \Xoops\Form\Text(_MB_XOO_GHOST_LIMIT, 'options[3]', 1, 2, $options[3])); |
|
77
|
|
|
|
|
78
|
|
|
return $block_form->render(); |
|
79
|
|
|
} |
|
80
|
|
|
|