.
* ---------------------------------------------------------------------
*/
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access this file directly");
}
/**
* Cluster Class
**/
class Cluster extends CommonDBTM {
use Glpi\Features\Clonable;
// From CommonDBTM
public $dohistory = true;
static $rightname = 'cluster';
public function getCloneRelations() :array {
return [
NetworkPort::class
];
}
static function getTypeName($nb = 0) {
return _n('Cluster', 'Clusters', $nb);
}
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;
}
function showForm($ID, $options = []) {
$rand = mt_rand();
$this->initForm($ID, $options);
$this->showFormHeader($options);
echo "
";
echo " | ";
echo "";
$objectName = autoName(
$this->fields["name"],
"name",
(isset($options['withtemplate']) && ( $options['withtemplate']== 2)),
$this->getType(),
$this->fields["entities_id"]
);
Html::autocompletionTextField(
$this,
'name',
[
'value' => $objectName,
'rand' => $rand
]
);
echo " | ";
echo " | ";
echo "";
State::dropdown([
'value' => $this->fields["states_id"],
'entity' => $this->fields["entities_id"],
'condition' => ['is_visible_cluster' => 1],
'rand' => $rand
]);
echo " |
\n";
echo "";
echo " | ";
echo "";
Html::autocompletionTextField($this, 'uuid', ['rand' => $rand]);
echo " | | ";
echo "";
Html::autocompletionTextField($this, 'version', ['rand' => $rand]);
echo " |
\n";
echo "";
echo " | ";
echo "";
ClusterType::dropdown([
'value' => $this->fields["clustertypes_id"],
'entity' => $this->fields["entities_id"],
'rand' => $rand
]);
echo " | ";
echo " | ";
echo "";
AutoUpdateSystem::dropdown(['value' => $this->fields["autoupdatesystems_id"], 'rand' => $rand]);
echo " |
";
echo "\n";
echo "";
echo " | ";
echo "";
User::dropdown([
'name' => 'users_id_tech',
'value' => $this->fields["users_id_tech"],
'right' => 'own_ticket',
'entity' => $this->fields["entities_id"],
'rand' => $rand
]);
echo " | ";
echo " | ";
echo "";
Group::dropdown([
'name' => 'groups_id_tech',
'value' => $this->fields['groups_id_tech'],
'entity' => $this->fields['entities_id'],
'condition' => ['is_assign' => 1],
'rand' => $rand
]);
echo " |
\n";
echo "";
echo " | ";
echo "";
echo " |
";
echo "\n";
$this->showFormButtons($options);
return true;
}
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;
}
function cleanDBonPurge() {
$this->deleteChildrenAndRelationsFromDb(
[
Item_Cluster::class,
]
);
}
static function getIcon() {
return "fas fa-project-diagram";
}
}