Skip to content

Commit

Permalink
getConfigForCommunity
Browse files Browse the repository at this point in the history
  • Loading branch information
Phpvarious authored Oct 26, 2024
1 parent 973d18e commit db7ead1
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions core/class/mobile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() . '<br/>';
$res .= '<br/><br/>';
$res .= '[details="Equipement(s)"]<br/>';
$res .= '|Id | LogicalId | Type | App | defaultIdMobile | Profil | hideMenuGeoloc | hideMenuCustom|<br>';
$res .= '|--- | --- | --- | --- | --- | --- | --- | ---|<br>';
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) .'|<br>';
}
$res .= '[/details]';
return $res;
}

/**
* find eq based on iq
*
Expand Down

0 comments on commit db7ead1

Please sign in to comment.