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
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
14
|
|
|
* @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
15
|
|
|
* @package extcal |
16
|
|
|
* @since |
17
|
|
|
* @author XOOPS Development Team, |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
use Xmf\Module\Admin; |
21
|
|
|
use Xmf\Request; |
22
|
|
|
use XoopsModules\Extcal\{Helper, |
23
|
|
|
LocationHandler |
24
|
|
|
}; |
25
|
|
|
|
26
|
|
|
require_once __DIR__ . '/include/constantes.php'; |
27
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'extcal_location.tpl'; |
28
|
|
|
require_once __DIR__ . '/header.php'; |
29
|
|
|
|
30
|
|
|
global $xoopsTpl; |
31
|
|
|
|
32
|
|
|
$helper = Helper::getInstance(); |
33
|
|
|
$locationHandler = $helper->getHandler(_EXTCAL_CLN_LOCATION); |
34
|
|
|
//require_once XOOPS_ROOT_PATH.'/header.php'; |
35
|
|
|
|
36
|
|
|
$location_id = Request::getInt('location_id', 0, 'REQUEST'); |
37
|
|
|
|
38
|
|
|
global $xoopsUser, $xoopsModuleConfig, $xoopsModule, $xoopsDB; |
39
|
|
|
|
40
|
|
|
//On regarde si le lien existe |
41
|
|
|
$criteria = new \CriteriaCompo(); |
42
|
|
|
$criteria->add(new \Criteria('id', $location_id, '=')); |
43
|
|
|
$location_exist = $locationHandler->getCount($criteria); |
|
|
|
|
44
|
|
|
|
45
|
|
|
if (0 == $location_exist) { |
46
|
|
|
redirect_header(XOOPS_URL . '/modules/extcal/index.php', 3, _NOPERM); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
$view_location = $locationHandler->getLocation($location_id, true); |
|
|
|
|
50
|
|
|
$location = $locationHandler->objectToArray($view_location); |
|
|
|
|
51
|
|
|
|
52
|
|
|
$isAdmin = false; |
53
|
|
|
if (isset($xoopsUser) && $xoopsUser->isAdmin($helper->getModule()->getVar('mid'))) { |
54
|
|
|
$isAdmin = true; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/* todo a deplacer dans le template JJD */ |
58
|
|
|
$uid = $xoopsUser ? $xoopsUser->getVar('uid') : 0; |
59
|
|
|
global $xoopsModule; |
60
|
|
|
$pathIcon16 = Admin::iconUrl('', 16); |
61
|
|
|
|
62
|
|
|
$edit_delete = ''; |
63
|
|
|
if (is_object($xoopsUser) && $isAdmin) { |
64
|
|
|
$edit_delete = '<a href="' |
65
|
|
|
. XOOPS_URL |
66
|
|
|
. '/modules/extcal/admin/location.php?op=edit_location&location_id=' |
67
|
|
|
. $location_id |
68
|
|
|
. '"><img src="' |
69
|
|
|
. $pathIcon16 |
70
|
|
|
. '/edit.png" width="16px" height="16px" border="0" title="' |
71
|
|
|
. _MD_EXTCAL_LOCATION_EDIT |
72
|
|
|
. '"></a><a href="' |
73
|
|
|
. XOOPS_URL |
74
|
|
|
. '/modules/extcal/admin/location.php?op=delete_location&location_id=' |
75
|
|
|
. $location_id |
76
|
|
|
. '"><img src="' |
77
|
|
|
. $pathIcon16 |
78
|
|
|
. '/delete.png" width="16px" height="16px" border="0" title="' |
79
|
|
|
. _MD_EXTCAL_LOCATION_DELETE |
80
|
|
|
. '"></a>'; |
81
|
|
|
} |
82
|
|
|
$xoopsTpl->assign('edit_delete', $edit_delete); |
83
|
|
|
|
84
|
|
|
$xoopsTpl->assign('location', $location); |
85
|
|
|
|
86
|
|
|
$date = mktime(0, 0, 0, date('m'), date('d'), date('y')); |
|
|
|
|
87
|
|
|
|
88
|
|
|
$requete = $xoopsDB->query('SELECT event_id, event_title, event_desc, event_picture1, event_start FROM ' . $xoopsDB->prefix('extcal_event') . " WHERE event_location='" . $location_id . "' AND event_start >='" . $date . "'"); |
89
|
|
|
while (false !== ($donnees = $xoopsDB->fetchArray($requete))) { |
90
|
|
|
if ($donnees['event_desc'] > 210) { |
91
|
|
|
$event_desc = $donnees['event_desc']; |
92
|
|
|
} else { |
93
|
|
|
$event_desc = mb_substr($donnees['event_desc'], 0, 210) . '...'; |
94
|
|
|
} |
95
|
|
|
$xoopsTpl->append( |
96
|
|
|
'events', |
97
|
|
|
[ |
98
|
|
|
'event_picture1' => $donnees['event_picture1'], |
99
|
|
|
'event_id' => $donnees['event_id'], |
100
|
|
|
'event_title' => $donnees['event_title'], |
101
|
|
|
'event_desc' => $event_desc, |
102
|
|
|
'event_start' => date('Y-m-d', $donnees['event_start']), |
103
|
|
|
] |
104
|
|
|
); |
105
|
|
|
} |
106
|
|
|
/** @var xos_opal_Theme $xoTheme */ |
107
|
|
|
$xoTheme->addScript('browse.php?modules/extcal/assets/js/highslide.js'); |
108
|
|
|
$xoTheme->addStylesheet('browse.php?modules/extcal/assets/js/highslide.css'); |
109
|
|
|
require_once XOOPS_ROOT_PATH . '/footer.php'; |
110
|
|
|
|