Current File : /home/escuelai/public_html/it/src/Cluster.php |
<?php
/**
* ---------------------------------------------------------------------
*
* GLPI - Gestionnaire Libre de Parc Informatique
*
* http://glpi-project.org
*
* @copyright 2015-2022 Teclib' and contributors.
* @copyright 2003-2014 by the INDEPNET Development Team.
* @licence https://www.gnu.org/licenses/gpl-3.0.html
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* ---------------------------------------------------------------------
*/
/**
* Cluster Class
**/
class Cluster extends CommonDBTM
{
use Glpi\Features\Clonable;
// From CommonDBTM
public $dohistory = true;
public static $rightname = 'cluster';
public function getCloneRelations(): array
{
return [
NetworkPort::class
];
}
public static function getTypeName($nb = 0)
{
return _n('Cluster', 'Clusters', $nb);
}
public function defineTabs($options = [])
{
$ong = [];
$this->addDefaultFormTab($ong)
->addImpactTab($ong, $options)
->addStandardTab('Item_Cluster', $ong, $options)
->addStandardTab('NetworkPort', $ong, $options)
->addStandardTab('Contract_Item', $ong, $options)
->addStandardTab('Document_Item', $ong, $options)
->addStandardTab('Ticket', $ong, $options)
->addStandardTab('Item_Problem', $ong, $options)
->addStandardTab('Change_Item', $ong, $options)
->addStandardTab('Appliance_Item', $ong, $options)
->addStandardTab('Log', $ong, $options);
return $ong;
}
public function rawSearchOptions()
{
$tab = parent::rawSearchOptions();
$tab[] = [
'id' => '31',
'table' => 'glpi_states',
'field' => 'completename',
'name' => __('Status'),
'datatype' => 'dropdown',
'condition' => ['is_visible_cluster' => 1]
];
$tab[] = [
'id' => '5',
'table' => $this->getTable(),
'field' => 'uuid',
'name' => __('UUID'),
'datatype' => 'string'
];
$tab[] = [
'id' => '16',
'table' => $this->getTable(),
'field' => 'comment',
'name' => __('Comments'),
'datatype' => 'text'
];
$tab[] = [
'id' => '19',
'table' => $this->getTable(),
'field' => 'date_mod',
'name' => __('Last update'),
'datatype' => 'datetime',
'massiveaction' => false
];
$tab[] = [
'id' => '121',
'table' => $this->getTable(),
'field' => 'date_creation',
'name' => __('Creation date'),
'datatype' => 'datetime',
'massiveaction' => false
];
$tab[] = [
'id' => '24',
'table' => 'glpi_users',
'field' => 'name',
'linkfield' => 'users_id_tech',
'name' => __('Technician in charge of the hardware'),
'datatype' => 'dropdown',
'right' => 'own_ticket'
];
$tab[] = [
'id' => '49',
'table' => 'glpi_groups',
'field' => 'completename',
'linkfield' => 'groups_id_tech',
'name' => __('Group in charge of the hardware'),
'condition' => ['is_assign' => 1],
'datatype' => 'dropdown'
];
$tab = array_merge($tab, Notepad::rawSearchOptionsToAdd());
return $tab;
}
public function cleanDBonPurge()
{
$this->deleteChildrenAndRelationsFromDb(
[
Item_Cluster::class,
]
);
}
public static function getIcon()
{
return "ti ti-hierarchy-2";
}
}