From 6ed85cd366addb99b3f1a0d24ca62f18b7baaa69 Mon Sep 17 00:00:00 2001 From: Unknoweb <128051761+Unknoweb@users.noreply.github.com> Date: Tue, 4 Apr 2023 14:48:38 +0200 Subject: [PATCH] feat: reminders --- front/wizardreminders.php | 60 +++++++++++++++++++++++++++++++++++++++ inc/common.class.php | 20 +++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 front/wizardreminders.php diff --git a/front/wizardreminders.php b/front/wizardreminders.php new file mode 100644 index 000000000..895aebec4 --- /dev/null +++ b/front/wizardreminders.php @@ -0,0 +1,60 @@ +. + * --------------------------------------------------------------------- + * @copyright Copyright © 2011 - 2021 Teclib' + * @license http://www.gnu.org/licenses/gpl.txt GPLv3+ + * @link https://github.com/pluginsGLPI/formcreator/ + * @link https://pluginsglpi.github.io/formcreator/ + * @link http://plugins.glpi-project.org/#/plugin/formcreator + * --------------------------------------------------------------------- + */ + +global $CFG_GLPI; +include ("../../../inc/includes.php"); + +// Check if plugin is activated... +if (!(new Plugin())->isActivated('formcreator')) { + Html::displayNotFoundError(); +} + +if (! plugin_formcreator_replaceHelpdesk()) { + Html::redirect($CFG_GLPI['root_doc']."/front/helpdesk.public.php"); +} + +if (!Reminder::canView()) { + Html::displayRightError(); +} + +if (Session::getCurrentInterface() == "helpdesk") { + Html::helpHeader(__('Service catalog', 'formcreator')); +} else { + Html::header(__('Service catalog', 'formcreator')); +} + +Reminder::showListForCentral(false); + +if (Session::getCurrentInterface() == "helpdesk") { + Html::helpFooter(); +} else { + Html::footer(); +} diff --git a/inc/common.class.php b/inc/common.class.php index e45aa480b..5bdda08ad 100644 --- a/inc/common.class.php +++ b/inc/common.class.php @@ -811,6 +811,26 @@ public static function hookRedefineMenu($menus) { $newMenu['reservation'] = $menus['reservation']; } } + $reminderTable = Reminder::getTable(); + $criteria = [ + 'SELECT' => "$reminderTable.*", + 'DISTINCT' => true, + 'FROM' => $reminderTable, + 'ORDER' => "$reminderTable.name" + ]; + $criteria = $criteria + Reminder::getVisibilityCriteria(); + $criteria['WHERE']["$reminderTable.users_id"] = ['<>', Session::getLoginUserID()]; + $iterator = $DB->request($criteria); + $hasReminder = $iterator->count() > 0; + + if (Reminder::canView() && $hasReminder) { + $newMenu['reminders'] = [ + 'default' => Plugin::getWebDir('formcreator', false) . '/front/wizardreminders.php', + 'title' => __('Consult reminders', 'formcreator'), + 'icon' => 'fa fa-sticky-note', + ]; + } + $rssFeedTable = RSSFeed::getTable(); $criteria = [ 'SELECT' => "$rssFeedTable.*",