From db7ead162a77afed426bbf20718ceb3cab618db8 Mon Sep 17 00:00:00 2001
From: David <79108364+Phpvarious@users.noreply.github.com>
Date: Sat, 26 Oct 2024 14:28:10 +0200
Subject: [PATCH] getConfigForCommunity
---
core/class/mobile.class.php | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/core/class/mobile.class.php b/core/class/mobile.class.php
index 731aa540..cc84b346 100755
--- a/core/class/mobile.class.php
+++ b/core/class/mobile.class.php
@@ -33,6 +33,35 @@ public static function cronDaily()
}
}
+ /**
+ * Core callback to provide additional information for a new Community post
+ *
+ * @return string
+ */
+ public static function getConfigForCommunity() {
+ $hw = jeedom::getHardwareName();
+ if ($hw == 'diy') $hw = trim(shell_exec('systemd-detect-virt'));
+ if ($hw == 'none') $hw = 'diy';
+ $distrib = trim(shell_exec('. /etc/*-release && echo $ID $VERSION_ID'));
+ $res = 'OS: ' . $distrib . ' on ' . $hw;
+ $res .= ' ; PHP: ' . phpversion() . '
';
+ $res .= '
';
+ $res .= '[details="Equipement(s)"]
';
+ $res .= '|Id | LogicalId | Type | App | defaultIdMobile | Profil | hideMenuGeoloc | hideMenuCustom|
';
+ $res .= '|--- | --- | --- | --- | --- | --- | --- | ---|
';
+ foreach (eqLogic::byType('mobile') as $mobile) {
+ $userId = $mobile->getConfiguration('affect_user');
+ $userType = user::byId($userId);
+ $profil = 'Inconnu';
+ if (is_object($userType)) {
+ $profil = $userType->getProfils();
+ }
+ $res .= '|' . $mobile->getId() . ' | ' . $mobile->getLogicalId() . ' | ' . $mobile->getConfiguration('type_mobile') . ' | v' . $mobile->getConfiguration('appVersion', 1) . ' | ' . $mobile->getConfiguration('defaultIdMobile', 'none') . ' | ' . $profil . ' | ' . $mobile->getConfiguration('hideMenuGeoloc', 0) . ' | ' . $mobile->getConfiguration('hideMenuCustom', 0) .'|
';
+ }
+ $res .= '[/details]';
+ return $res;
+ }
+
/**
* find eq based on iq
*