Passed
Push — master ( f62223...75b16c )
by Michael
02:33
created

etablissement.php (3 issues)

Labels
Severity
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 http://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 XoopsModules\Extcal;
21
22
require_once  dirname(dirname(__DIR__)) . '/mainfile.php';
23
require_once __DIR__ . '/include/constantes.php';
24
$GLOBALS['xoopsOption']['template_main'] = 'extcal_location.tpl';
25
require_once __DIR__ . '/header.php';
26
27
$locationHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_LOCATION);
28
//require_once XOOPS_ROOT_PATH.'/header.php';
29
30
$location_id = \Xmf\Request::getInt('location_id', 0, 'REQUEST');
0 ignored issues
show
The type Xmf\Request was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
31
32
global $xoopsUser, $xoopsModuleConfig, $xoopsModule, $xoopsDB;
33
34
//On regarde si le lien existe
35
$criteria = new \CriteriaCompo();
36
$criteria->add(new \Criteria('id', $location_id, '='));
0 ignored issues
show
The type Criteria was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
37
$location_exist = $locationHandler->getCount($criteria);
38
39
if (0 == $location_exist) {
40
    redirect_header(XOOPS_URL . '/modules/extcal/index.php', 3, _NOPERM);
41
}
42
43
$view_location = $locationHandler->getLocation($location_id, true);
44
$location      = $locationHandler->objectToArray($view_location);
45
46
$isAdmin = false;
47
if (isset($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
48
    $isAdmin = true;
49
}
50
51
/* todo a deplacer dans le template JJD */
52
$uid = $xoopsUser ? $xoopsUser->getVar('uid') : 0;
53
global $xoopsModule;
54
$pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16);
55
56
$edit_delete = '';
57
if (is_object($xoopsUser) && $isAdmin) {
58
    $edit_delete = '<a href="'
59
                   . XOOPS_URL
60
                   . '/modules/extcal/admin/Location.php?op=edit_location&location_id='
61
                   . $location_id
62
                   . '"><img src="'
63
                   . $pathIcon16
64
                   . '/edit.png" width="16px" height="16px" border="0" title="'
65
                   . _MD_EXTCAL_LOCATION_EDIT
66
                   . '"></a><a href="'
67
                   . XOOPS_URL
68
                   . '/modules/extcal/admin/Location.php?op=delete_location&location_id='
69
                   . $location_id
70
                   . '"><img src="'
71
                   . $pathIcon16
72
                   . '/delete.png" width="16px" height="16px" border="0" title="'
73
                   . _MD_EXTCAL_LOCATION_DELETE
74
                   . '"></a>';
75
}
76
$xoopsTpl->assign('edit_delete', $edit_delete);
77
78
$xoopsTpl->assign('location', $location);
79
80
$date = mktime(0, 0, 0, date('m'), date('d'), date('y'));
81
82
$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 . "'");
83
while (false !== ($donnees = $xoopsDB->fetchArray($requete))) {
84
    if ($donnees['event_desc'] > 210) {
85
        $event_desc = $donnees['event_desc'];
86
    } else {
87
        $event_desc = substr($donnees['event_desc'], 0, 210) . '...';
88
    }
89
    $xoopsTpl->append('events', [
90
        'event_picture1' => $donnees['event_picture1'],
91
        'event_id'       => $donnees['event_id'],
92
        'event_title'    => $donnees['event_title'],
93
        'event_desc'     => $event_desc,
94
        'event_start'    => date('Y-m-d', $donnees['event_start']),
95
    ]);
96
}
97
/** @var xos_opal_Theme $xoTheme */
98
$xoTheme->addScript('browse.php?modules/extcal/assets/js/highslide.js');
99
$xoTheme->addStylesheet('browse.php?modules/extcal/assets/js/highslide.css');
100
require_once XOOPS_ROOT_PATH . '/footer.php';
0 ignored issues
show
The constant XOOPS_ROOT_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
101