Passed
Push — master ( 23721f...32f8a2 )
by Lio
03:12 queued 45s
created

event.php (3 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
*/
14
15
/**
16
 * Module: Countdown
17
 *
18
 * @category        Module
19
 * @package         countdown
20
 * @author          XOOPS Development Team <https://xoops.org>
21
 * @copyright       {@link https://xoops.org/ XOOPS Project}
22
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
23
 * @link            https://xoops.org/
24
 * @since           1.0.0
25
 */
26
27
use Xmf\Request;
28
use XoopsModules\Countdown;
29
30
$GLOBALS['xoopsOption']['template_main'] = 'countdown_event_view.tpl';
31
require_once __DIR__ . '/header.php';
32
$start = Request::getInt('start', 0);
33
// Define Stylesheet
34
$xoTheme->addStylesheet($stylesheet);
35
36
$db = \XoopsDatabaseFactory::getDatabaseConnection();
37
38
// Get Handler
39
/** @var \XoopsPersistableObjectHandler $eventsHandler */
40
$eventsHandler = new Countdown\EventsHandler($db);
41
42
$eventsPaginationLimit = $helper->getConfig('usereventperpage');
43
44
$criteria = new \CriteriaCompo();
45
46
$criteria->setOrder('DESC');
47
$criteria->setLimit($eventsPaginationLimit);
48
$criteria->setStart($start);
49
50
$eventsCount = $eventsHandler->getCount($criteria);
51
$eventsArray = $eventsHandler->getAll($criteria);
52
53
$moduleDirNameUpper = strtoupper($moduleDirName);
54
55
$id = Request::getInt('id', 0, 'GET');
56
57
//viewItem();
58
$eventsPaginationLimit = 1;
59
$myid                  = $id;
60
//id
61
$eventsObject = $eventsHandler->get($myid);
62
63
$criteria = new \CriteriaCompo();
64
$criteria->setSort('event_id');
65
$criteria->setOrder('DESC');
66
$criteria->setLimit($eventsPaginationLimit);
67
$criteria->setStart($start);
68
$events['id']           = $eventsObject->getVar('event_id');
69
$events['uid']          = $eventsObject->getVar('event_uid');
70
$events['submitter']    = \XoopsUser::getUnameFromId($eventsObject->getVar('event_uid'));
71
$events['name']         = $eventsObject->getVar('event_name');
72
$events['category']     = $eventsObject->getVar('event_categoryid');
73
$categoryHandler        = $helper->getHandler('category');
74
$categoryObj            = $categoryHandler->get($eventsObject->getVar('event_categoryid'));
75
$events['categoryname'] = $categoryObj->getVar('category_title');
76
$categoryname           = $categoryObj->getVar('category_title');
77
$events['logo']         = $eventsObject->getVar('event_logo');
78
$events['description']  = ($eventsObject->getVar('event_description'));
79
$events['usertime']     = formatTimeStamp(time(), 'mysql');
80
$events['date']         = date(_DATESTRING, strtotime($eventsObject->getVar('event_date')));
81
$events['dateiso']      = $eventsObject->getVar('event_date');
82
$events['date_created'] = formatTimestamp($eventsObject->getVar('date_created'));
83
$date_created           = formatTimestamp($eventsObject->getVar('date_created'));
84
$events['date_updated'] = formatTimestamp($eventsObject->getVar('date_updated'));
85
$date_updated           = formatTimestamp($eventsObject->getVar('date_updated'));
86
87
if ($date_created == $date_updated) {
88
    $events['info'] = sprintf(_MD_COUNTDOWN_POSTEDBY, \XoopsUser::getUnameFromId($eventsObject->getVar('event_uid')), formatTimestamp($eventsObject->getVar('date_created'), 'M d Y'), $categoryname);
89
} else {
90
    $events['info'] = sprintf(_MD_COUNTDOWN_POSTEDBY, \XoopsUser::getUnameFromId($eventsObject->getVar('event_uid')), formatTimestamp($eventsObject->getVar('date_updated'), 'M d Y'), $categoryname);
91
}
92
93
//       $GLOBALS['xoopsTpl']->append('events', $events);
94
$keywords[] = $eventsObject->getVar('event_id');
95
96
$GLOBALS['xoopsTpl']->assign('events', $events);
97
$start = $id;
98
99
// Display Navigation
100
if ($eventsCount > $eventsPaginationLimit) {
101
    $GLOBALS['xoopsTpl']->assign('event_url', COUNTDOWN_URL . '/event.php');
0 ignored issues
show
The constant COUNTDOWN_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
102
    require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
103
    $pagenav = new \XoopsPageNav($eventsCount, $eventsPaginationLimit, $start, 'id');
104
    $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
105
}
106
107
//keywords
108
if (isset($keywords)) {
109
    $utility::metaKeywords(xoops_getModuleOption('keywords', $moduleDirName) . ', ' . implode(', ', $keywords));
0 ignored issues
show
Deprecated Code introduced by
The function xoops_getModuleOption() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

109
    $utility::metaKeywords(/** @scrutinizer ignore-deprecated */ xoops_getModuleOption('keywords', $moduleDirName) . ', ' . implode(', ', $keywords));
Loading history...
110
}
111
//description
112
$utility::metaDescription(_MD_COUNTDOWN_EVENTS_DESC);
113
//
114
$GLOBALS['xoopsTpl']->assign('event_url', COUNTDOWN_URL . '/event.php');
115
$GLOBALS['xoopsTpl']->assign('countdown_url', COUNTDOWN_URL);
116
$GLOBALS['xoopsTpl']->assign('admin', COUNTDOWN_ADMIN);
0 ignored issues
show
The constant COUNTDOWN_ADMIN was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
117
$GLOBALS['xoopsTpl']->assign('copyright', $copyright);
118
119
require XOOPS_ROOT_PATH . '/include/comment_view.php';
120
require __DIR__ . '/footer.php';
121
require dirname(__DIR__, 2) . '/footer.php';
122