@@ -46,6 +46,9 @@ static function getTypeName($nb = 0) {
4646 return _n ('IP Adressing ' , 'IP Adressing ' , $ nb , 'addressing ' );
4747 }
4848
49+ static function getIcon () {
50+ return "ti ti-map-pin " ;
51+ }
4952
5053 /**
5154 * Actions done when item is deleted from the database
@@ -177,22 +180,22 @@ function getTitle() {
177180 /**
178181 * @param $entity
179182 */
180- // function dropdownSubnet($entity) {
181- // global $DB;
182- //
183- // $dbu = new DbUtils();
184- // $sql = "SELECT DISTINCT `completename`
185- // FROM `glpi_ipnetworks`" .
186- // $dbu->getEntitiesRestrictRequest(" WHERE ", "glpi_ipnetworks", "entities_id", $entity);
187- // $networkList = [0 => Dropdown::EMPTY_VALUE];
188- // foreach ($DB->request($sql) as $network) {
189- // $networkList += [$network["completename"] => $network["completename"]];
190- // }
191- // $rand = mt_rand();
192- // $name = "_subnet";
193- // Dropdown::ShowFromArray($name, $networkList, ['rand' => $rand,
194- // 'on_change' => 'plugaddr_ChangeList("dropdown_' . $name . $rand . '");']);
195- // }
183+ // function dropdownSubnet($entity) {
184+ // global $DB;
185+ //
186+ // $dbu = new DbUtils();
187+ // $sql = "SELECT DISTINCT `completename`
188+ // FROM `glpi_ipnetworks`" .
189+ // $dbu->getEntitiesRestrictRequest(" WHERE ", "glpi_ipnetworks", "entities_id", $entity);
190+ // $networkList = [0 => Dropdown::EMPTY_VALUE];
191+ // foreach ($DB->request($sql) as $network) {
192+ // $networkList += [$network["completename"] => $network["completename"]];
193+ // }
194+ // $rand = mt_rand();
195+ // $name = "_subnet";
196+ // Dropdown::ShowFromArray($name, $networkList, ['rand' => $rand,
197+ // 'on_change' => 'plugaddr_ChangeList("dropdown_' . $name . $rand . '");']);
198+ // }
196199
197200
198201 function post_getEmpty () {
@@ -399,8 +402,8 @@ function test(id) {
399402 echo "<td class='center' colspan='3'> " ;
400403 Html::textarea (['name ' => 'comment ' ,
401404 'value ' => $ this ->fields ["comment " ],
402- 'cols ' => 125 ,
403- 'rows ' => 3 ,
405+ 'cols ' => 125 ,
406+ 'rows ' => 3 ,
404407 'enable_richtext ' => false ]);
405408 echo "</td></tr> " ;
406409
@@ -547,7 +550,7 @@ function compute($start, $params = []) {
547550
548551 if ($ type == 'PluginFusioninventoryUnknownDevice '
549552 || $ type == 'Enclosure '
550- || $ type == 'PDU '
553+ || $ type == 'PDU '
551554 || $ type == 'Cluster '
552555 || $ type == 'Unmanaged ' ) {
553556 $ sql .= " ,0 AS `users_id` " ;
@@ -777,7 +780,7 @@ function showReport($params) {
777780 echo "</td> " ;
778781
779782 echo "<td class='center' colspan='4'> " ;
780- echo "<button form='' type='submit' id='updatePingInfo' class='btn btn-primary me-2 center' name='updatePingInfo' title=' " . _sx ('button ' , 'Manual launch of ping ' , 'addressing ' ) . "'> " ;
783+ echo "<button form='' type='submit' id='updatePingInfo' class='submit btn btn-primary me-2 center' name='updatePingInfo' title=' " . _sx ('button ' , 'Manual launch of ping ' , 'addressing ' ) . "'> " ;
781784 echo "<i class='fas fa-spinner' data-hasqtip='0' aria-hidden='true'></i> " ;
782785 echo _sx ('button ' , 'Manual launch of ping ' , 'addressing ' );
783786 echo "</button> " ;
@@ -1018,5 +1021,45 @@ static function showSwitchField($name, $value) {
10181021 echo "<a class= \"button \"><i class= \"$ name fa-fw fas fa-2x fa-toggle-off disabled \"></i></a> " ;
10191022 }
10201023 }
1024+
1025+ static function getMenuContent () {
1026+
1027+ $ menu = [];
1028+ $ menu ['title ' ] = self ::getMenuName ();
1029+ $ menu ['title ' ] = self ::getTypeName (2 );
1030+ $ menu ['page ' ] = self ::getSearchURL (false );
1031+ $ menu ['links ' ]['search ' ] = self ::getSearchURL (false );
1032+ $ menu ['links ' ]['lists ' ] = "" ;
1033+ if (Session::haveRight ('plugin_addressing ' , UPDATE )) {
1034+ $ menu ['links ' ]['add ' ] = self ::getFormURL (false );
1035+ }
1036+
1037+ if (Session::haveRight (static ::$ rightname , UPDATE )
1038+ || Session::haveRight ("config " , UPDATE )) {
1039+ //Entry icon in breadcrumb
1040+ $ menu ['links ' ]['config ' ] = PluginAddressingConfig::getSearchURL (false );
1041+ //Link to config page in admin plugins list
1042+ $ menu ['config_page ' ] = PluginAddressingConfig::getSearchURL (false );
1043+
1044+ //Add a fourth level in breadcrumb for configuration page
1045+ $ menu ['options ' ]['config ' ]['title ' ] = __ ('Setup ' );
1046+ $ menu ['options ' ]['config ' ]['page ' ] = PluginAddressingConfig::getSearchURL (false );
1047+ $ menu ['options ' ]['config ' ]['links ' ]['search ' ] = self ::getSearchURL (false );
1048+ $ menu ['options ' ]['config ' ]['links ' ]['add ' ] = self ::getFormURL (false );
1049+ }
1050+
1051+ $ menu ['icon ' ] = self ::getIcon ();
1052+
1053+ return $ menu ;
1054+ }
1055+
1056+ static function removeRightsFromSession () {
1057+ if (isset ($ _SESSION ['glpimenu ' ]['tools ' ]['types ' ]['PluginAddressingAddressing ' ])) {
1058+ unset($ _SESSION ['glpimenu ' ]['tools ' ]['types ' ]['PluginAddressingAddressing ' ]);
1059+ }
1060+ if (isset ($ _SESSION ['glpimenu ' ]['tools ' ]['content ' ]['pluginaddressingaddressing ' ])) {
1061+ unset($ _SESSION ['glpimenu ' ]['tools ' ]['content ' ]['pluginaddressingaddressing ' ]);
1062+ }
1063+ }
10211064}
10221065
0 commit comments