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: * Codex module
14: *
15: * @copyright XOOPS Project (http://xoops.org)
16: * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
17: * @package Codex
18: * @since 2.6.0
19: * @author Laurent JEN (Aka DuGris)
20: * @version $Id$
21: */
22:
23: class CodexSystemPlugin extends Xoops\Module\Plugin\PluginAbstract implements SystemPluginInterface
24: {
25: /**
26: * Used to synchronize a user number of posts
27: * Please return the number of posts the user as made in your module
28: *
29: * @param int $uid The uid of the user
30: *
31: * @return int Number of posts
32: */
33: public function userPosts($uid)
34: {
35: //$xoops = Xoops::getInstance();
36: //$count = count(XoopsLists::getFileListAsArray($xoops->path('modules/codex/')))-2;
37: return 0;
38: }
39:
40: /**
41: * Used to populate the Waiting Block
42: *
43: * Expects an array containing:
44: * count : Number of waiting items, ex: 3
45: * name : Name for the waiting items, ex: Pending approval
46: * link : Link for the waiting items, ex: Xoops::getInstance()->url('modules/comments/admin/main.php');
47: *
48: * @return array
49: */
50: public function waiting()
51: {
52: $xoops = Xoops::getInstance();
53: $ret['count'] = count(\Xoops\Core\Lists\File::getList($xoops->path('modules/codex/')))-2;
54: $ret['name'] = $xoops->getHandlerModule()->getByDirname('codex')->getVar('name');
55: $ret['link'] = $xoops->url('modules/codex/');
56: return array();
57: }
58:
59: /**
60: * Used to populate backend
61: *
62: * @param int $limit : Number of item for backend
63: *
64: * Expects an array containing:
65: * title : Title for the backend items
66: * link : Link for the backend items
67: * content : content for the backend items
68: * date : Date of the backend items
69: *
70: * @return array
71: */
72: public function backend($limit)
73: {
74: $xoops = Xoops::getInstance();
75: $i=0;
76: $ret=array();
77:
78: $files = \Xoops\Core\Lists\File::getList($xoops->path('modules/codex/'));
79: foreach ($files as $file) {
80: if (!in_array($file, array('xoops_version.php', 'index.php'))) {
81: $ret[$i]['title'] = ucfirst(str_replace('.php', '', $file));
82: $ret[$i]['link'] = $xoops->url('modules/codex/' . $file);
83: $ret[$i]['content'] = 'Codex module : ' . ucfirst(str_replace('.php', '', $file));
84: $ret[$i]['date'] = filemtime($xoops->path('modules/codex/' . $file));
85: ++$i;
86: }
87: }
88: return $ret;
89: }
90:
91: /**
92: * Used to populate the User Block
93: *
94: * Expects an array containing:
95: * name : Name for the Link
96: * link : Link relative to module
97: * image : Url of image to display, please use 16px*16px image
98: *
99: * @return array
100: */
101: public function userMenus()
102: {
103: /*$xoops = Xoops::getInstance();
104: $ret['name'] = Xoops::getInstance()->getHandlerModule()->getBydirname('codex')->getVar('name');
105: $ret['link'] = 'index.php';
106: $ret['image'] = $xoops->url('modules/codex/icons/logo_small.png');
107: return $ret;*/
108: }
109: }
110: