Add php-cs-fixer

This commit is contained in:
Rom1-B
2025-06-27 08:22:27 +02:00
parent e283c254cd
commit c5e110fc73
32 changed files with 3774 additions and 1864 deletions

View File

@@ -29,6 +29,7 @@
*/
namespace GlpiPlugin\Example;
use CommonDBTM;
use CommonGLPI;
use Config as GlpiConfig;
@@ -37,60 +38,63 @@ use Html;
use Session;
use Toolbox;
class Config extends CommonDBTM {
class Config extends CommonDBTM
{
protected static $notable = true;
static protected $notable = true;
public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
if (!$withtemplate) {
if ($item->getType() == 'Config') {
return __('Example plugin');
}
}
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
return '';
}
if (!$withtemplate) {
if ($item->getType() == 'Config') {
return __('Example plugin');
}
}
return '';
}
public static function configUpdate($input)
{
$input['configuration'] = 1 - $input['configuration'];
static function configUpdate($input) {
$input['configuration'] = 1 - $input['configuration'];
return $input;
}
return $input;
}
function showFormExample() {
global $CFG_GLPI;
public function showFormExample()
{
global $CFG_GLPI;
if (!Session::haveRight("config", UPDATE)) {
return false;
}
if (!Session::haveRight('config', UPDATE)) {
return false;
}
$my_config = GlpiConfig::getConfigurationValues('plugin:Example');
$my_config = GlpiConfig::getConfigurationValues('plugin:Example');
echo "<form name='form' action=\"".Toolbox::getItemTypeFormURL('Config')."\" method='post'>";
echo "<div class='center' id='tabsbody'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='4'>" . __('Example setup') . "</th></tr>";
echo "<td >" . __('My boolean choice :') . "</td>";
echo "<td colspan='3'>";
echo "<input type='hidden' name='config_class' value='".__CLASS__."'>";
echo "<input type='hidden' name='config_context' value='plugin:Example'>";
Dropdown::showYesNo("configuration", $my_config['configuration']);
echo "</td></tr>";
echo "<form name='form' action=\"" . Toolbox::getItemTypeFormURL('Config') . "\" method='post'>";
echo "<div class='center' id='tabsbody'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='4'>" . __('Example setup') . '</th></tr>';
echo '<td >' . __('My boolean choice :') . '</td>';
echo "<td colspan='3'>";
echo "<input type='hidden' name='config_class' value='" . __CLASS__ . "'>";
echo "<input type='hidden' name='config_context' value='plugin:Example'>";
Dropdown::showYesNo('configuration', $my_config['configuration']);
echo '</td></tr>';
echo "<tr class='tab_bg_2'>";
echo "<td colspan='4' class='center'>";
echo "<input type='submit' name='update' class='submit' value=\""._sx('button', 'Save')."\">";
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td colspan='4' class='center'>";
echo "<input type='submit' name='update' class='submit' value=\"" . _sx('button', 'Save') . '">';
echo '</td></tr>';
echo "</table></div>";
Html::closeForm();
}
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
if ($item->getType() == 'Config') {
$config = new self();
$config->showFormExample();
}
}
echo '</table></div>';
Html::closeForm();
}
public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
{
if ($item->getType() == 'Config') {
$config = new self();
$config->showFormExample();
}
}
}