Skip to content

Commit 61cc030

Browse files
committed
Now compatible with GLPI v11
1 parent f4b5bfd commit 61cc030

File tree

13 files changed

+230
-242
lines changed

13 files changed

+230
-242
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.vs

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# IT Remote Link (GLPI 10/11)
2+
3+
## Ce que fait le plugin
4+
Crée automatiquement un bouton nommé *IT Remote* avec un **Lien externe**,
5+
associé aux **Ordinateurs**, avec l’URL :
6+
`https://control.itremote.com/remote/openaccess?devicename={{ NAME }}` (balises Twig GLPI 11).
7+
8+
## Installation
9+
1) Copier le dossier `itremote` dans `<GLPI_ROOT>/plugins/`.
10+
2) Aller dans **Configuration > Plugins** puis **Installer** et **Activer**.
11+
3) Un bouton **IT Remote** est injecté dans la fiche du premier onglet Ordinateur.

front/itremote.form.php

Lines changed: 0 additions & 50 deletions
This file was deleted.

hook.php

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,4 @@
11
<?php
22

3-
/**
4-
* -------------------------------------------------------------------------
5-
* IT Remote plugin for GLPI
6-
* -------------------------------------------------------------------------
7-
*
8-
* LICENSE
9-
*
10-
* IT Remote plugin is free software; you can redistribute it and/or modify
11-
* it under the terms of the GNU General Public License as published by
12-
* the Free Software Foundation; either version 2 of the License, or
13-
* (at your option) any later version.
14-
*
15-
* IT Remote plugin is distributed in the hope that it will be useful,
16-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18-
* GNU General Public License for more details.
19-
*
20-
* You should have received a copy of the GNU General Public License
21-
* along with IT Remote. If not, see <http://www.gnu.org/licenses/>.
22-
* -------------------------------------------------------------------------
23-
* @copyright Copyright (C) 2023 by IT Remote plugin team.
24-
* @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html
25-
* @link https://itremote.com
26-
* -------------------------------------------------------------------------
27-
*/
28-
29-
// Required
30-
function plugin_itremote_install()
31-
{
32-
global $DB;
33-
return true;
34-
}
35-
36-
// Required
37-
function plugin_itremote_uninstall()
38-
{
39-
global $DB;
40-
return true;
41-
}
3+
function plugin_itremote_install() { return true; }
4+
function plugin_itremote_uninstall(){ return true; }

inc/itremotetab.class.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
// plugins/itremote/inc/itremotetab.class.php
3+
4+
class PluginItremoteItRemoteTab extends CommonGLPI {
5+
6+
public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
7+
if ($item instanceof Computer) {
8+
return __('<span class="d-flex align-items-center"><i class="ti ti-screen-share me-2"></i>IT Remote</span>', 'itremote');
9+
}
10+
return '';
11+
}
12+
13+
public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
14+
if (!($item instanceof Computer)) {
15+
return false;
16+
}
17+
18+
// Trace de debug (apparaît dans files/_log/php-errors.log)
19+
if (function_exists('error_log')) {
20+
error_log('[itremote] displayTabContentForItem for Computer id=' . (int)$item->getID());
21+
}
22+
23+
$name = $item->fields['name'] ?? '';
24+
$url = 'https://control.itremote.com/remote/openaccess?devicename=' . rawurlencode($name);
25+
26+
// Bouton d’ouverture
27+
echo Html::link(
28+
__('IT Remote', 'itremote'),
29+
$url,
30+
['class' => 'btn btn-primary', 'target' => '_blank', 'rel' => 'noopener']
31+
);
32+
33+
return true;
34+
}
35+
}

itremote.js

Lines changed: 0 additions & 58 deletions
This file was deleted.

misc/itremote.jpg

23.2 KB
Loading

misc/screenshots/glpi-button.png

-3 KB
Loading
File renamed without changes.

public/env.js.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
// plugins/itremote/public/env.js.php
3+
header('Content-Type: application/javascript; charset=UTF-8');
4+
5+
$ver = defined('GLPI_VERSION') ? GLPI_VERSION : '0.0.0';
6+
$parts = explode('.', $ver);
7+
$major = (int)($parts[0] ?? 0);
8+
9+
// Émet juste du JavaScript, pas de balises <script>
10+
echo 'window.GLPI_VERSION = ' . json_encode($ver) . ';';
11+
echo 'window.GLPI_MAJOR = ' . $major . ';';

0 commit comments

Comments
 (0)