getTypeName() static public method

Name of the type
static public getTypeName ( $nb )
$nb integer number of item in the type (default 0)
 static function dropdownService($ID, $options = array())
 {
     global $CFG_GLPI;
     $p = array();
     $p['name'] = 'networkports_id';
     $p['comments'] = 1;
     $p['entity'] = -1;
     $p['entity_sons'] = false;
     if (is_array($options) && count($options)) {
         foreach ($options as $key => $val) {
             $p[$key] = $val;
         }
     }
     // Manage entity_sons
     if (!($p['entity'] < 0) && $p['entity_sons']) {
         if (is_array($p['entity'])) {
             echo "entity_sons options is not available with array of entity";
         } else {
             $p['entity'] = getSonsOf('glpi_entities', $p['entity']);
         }
     }
     $rand = mt_rand();
     echo "<select name='itemtype[{$ID}]' id='itemtype{$rand}'>";
     echo "<option value='0'>" . DROPDOWN_EMPTY_VALUE . "</option>";
     //      $a_types =array();
     echo "<option value='Computer'>" . Computer::getTypeName() . "</option>";
     echo "<option value='NetworkEquipment'>" . NetworkEquipment::getTypeName() . "</option>";
     echo "</select>";
     $params = array('itemtype' => '__VALUE__', 'entity_restrict' => $p['entity'], 'current' => $ID, 'comments' => $p['comments'], 'myname' => $p['name'], 'rand' => $rand);
     ajaxUpdateItemOnSelectEvent("itemtype{$rand}", "show_" . $p['name'] . "{$rand}", $CFG_GLPI["root_doc"] . "/plugins/monitoring/ajax/dropdownServiceHostType.php", $params);
     echo "<span id='show_" . $p['name'] . "{$rand}'><input type='hidden' name='services_id[]' value='0'/></span>\n";
     return $rand;
 }
示例#2
0
        $netdevice->check($_POST["id"], DELETE);
        $netdevice->delete($_POST);
        Event::log($_POST["id"], "networkequipment", 4, "inventory", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
        $netdevice->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $netdevice->check($_POST["id"], DELETE);
            $netdevice->restore($_POST);
            Event::log($_POST["id"], "networkequipment", 4, "inventory", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
            $netdevice->redirectToList();
        } else {
            if (isset($_POST["purge"])) {
                $netdevice->check($_POST["id"], PURGE);
                $netdevice->delete($_POST, 1);
                Event::log($_POST["id"], "networkequipment", 4, "inventory", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
                $netdevice->redirectToList();
            } else {
                if (isset($_POST["update"])) {
                    $netdevice->check($_POST["id"], UPDATE);
                    $netdevice->update($_POST);
                    Event::log($_POST["id"], "networkequipment", 4, "inventory", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
                    Html::back();
                } else {
                    Html::header(NetworkEquipment::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "assets", "networkequipment");
                    $netdevice->display(array('id' => $_GET["id"], 'withtemplate' => $_GET["withtemplate"]));
                    Html::footer();
                }
            }
        }
    }
}
示例#3
0
Copyright (C) 2003-2013 by the INDEPNET Development Team.

http://indepnet.net/   http://glpi-project.org
-------------------------------------------------------------------------

LICENSE

This file is part of GLPI.

GLPI 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 2 of the License, or
(at your option) any later version.

GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkRight("networking", "r");
Html::header(NetworkEquipment::getTypeName(2), $_SERVER['PHP_SELF'], "inventory", "networking");
Search::show('NetworkEquipment');
Html::footer();
      break;

   case 'PluginMonitoringComponentscatalog':
      Dropdown::show('PluginMonitoringComponentscatalog', array('name'=>'items_id'));
      echo "<br/>".__('Display minemap', 'monitoring')." : ";
      Dropdown::showYesNo('is_minemap');
      break;

   case 'PluginMonitoringService':
      $rand = mt_rand();
      echo "<select name='itemtype' id='itemtype$rand'>";
      echo "<option value='0'>".Dropdown::EMPTY_VALUE."</option>";

//      $a_types =array();
      echo "<option value='Computer'>".Computer::getTypeName()."</option>";
      echo "<option value='NetworkEquipment'>".NetworkEquipment::getTypeName()."</option>";
      echo "</select>";

      $params = array('itemtype'        => '__VALUE__',
                      'entity_restrict' => $_POST['a_entities'],
                      'selectgraph'     => '1',
                      'rand'            => $rand);

      Ajax::updateItemOnSelectEvent("itemtype$rand", "show_itemtype$rand",
                                  $CFG_GLPI["root_doc"]."/plugins/monitoring/ajax/dropdownServiceHostType.php",
                                  $params);

      echo "<span id='show_itemtype$rand'><input type='hidden' name='services_id[]' value='0'/></span>\n";
      break;

   case 'PluginMonitoringWeathermap':
示例#5
0
 /**
  * Get search function for the class
  *
  * @since version 0.85
  *
  * @return array of search option
  **/
 function getSearchOptions()
 {
     $tab = parent::getSearchOptions();
     $tab[21]['table'] = $this->getTable();
     $tab[21]['field'] = 'is_visible_computer';
     $tab[21]['name'] = sprintf(__('%1$s - %2$s'), __('Visibility'), Computer::getTypeName(Session::getPluralNumber()));
     $tab[21]['datatype'] = 'bool';
     $tab[22]['table'] = $this->getTable();
     $tab[22]['field'] = 'is_visible_softwareversion';
     $tab[22]['name'] = sprintf(__('%1$s - %2$s'), __('Visibility'), SoftwareVersion::getTypeName(Session::getPluralNumber()));
     $tab[22]['datatype'] = 'bool';
     $tab[23]['table'] = $this->getTable();
     $tab[23]['field'] = 'is_visible_monitor';
     $tab[23]['name'] = sprintf(__('%1$s - %2$s'), __('Visibility'), Monitor::getTypeName(Session::getPluralNumber()));
     $tab[23]['datatype'] = 'bool';
     $tab[24]['table'] = $this->getTable();
     $tab[24]['field'] = 'is_visible_printer';
     $tab[24]['name'] = sprintf(__('%1$s - %2$s'), __('Visibility'), Printer::getTypeName(Session::getPluralNumber()));
     $tab[24]['datatype'] = 'bool';
     $tab[25]['table'] = $this->getTable();
     $tab[25]['field'] = 'is_visible_peripheral';
     $tab[25]['name'] = sprintf(__('%1$s - %2$s'), __('Visibility'), Peripheral::getTypeName(Session::getPluralNumber()));
     $tab[25]['datatype'] = 'bool';
     $tab[26]['table'] = $this->getTable();
     $tab[26]['field'] = 'is_visible_phone';
     $tab[26]['name'] = sprintf(__('%1$s - %2$s'), __('Visibility'), Phone::getTypeName(Session::getPluralNumber()));
     $tab[26]['datatype'] = 'bool';
     $tab[27]['table'] = $this->getTable();
     $tab[27]['field'] = 'is_visible_networkequipment';
     $tab[27]['name'] = sprintf(__('%1$s - %2$s'), __('Visibility'), NetworkEquipment::getTypeName(Session::getPluralNumber()));
     $tab[27]['datatype'] = 'bool';
     return $tab;
 }
include "../../../inc/includes.php";
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
Session::checkLoginUser();
switch ($_POST['itemtype']) {
    case 'PluginMonitoringServicescatalog':
        Dropdown::show('PluginMonitoringServicescatalog', array('name' => 'items_id'));
        break;
    case 'PluginMonitoringComponentscatalog':
        Dropdown::show('PluginMonitoringComponentscatalog', array('name' => 'items_id'));
        echo "<br/>" . __('Display minemap', 'monitoring') . " : ";
        Dropdown::showYesNo('is_minemap');
        break;
    case 'PluginMonitoringService':
        $rand = mt_rand();
        $elements = array('0' => Dropdown::EMPTY_VALUE, 'Computer' => Computer::getTypeName(), 'NetworkEquipment' => NetworkEquipment::getTypeName());
        Dropdown::showFromArray('itemtype', $elements, array('rand' => $rand, 'emptylabel' => true, 'display_emptychoice' => true));
        $params = array('itemtype' => '__VALUE__', 'entity_restrict' => $_POST['a_entities'], 'selectgraph' => '1', 'rand' => $rand);
        Ajax::updateItemOnSelectEvent("dropdown_itemtype{$rand}", "show_itemtype{$rand}", $CFG_GLPI["root_doc"] . "/plugins/monitoring/ajax/dropdownServiceHostType.php", $params);
        echo "<span id='show_itemtype{$rand}'><input type='hidden' name='services_id[]' value='0'/></span>\n";
        break;
    case 'PluginMonitoringWeathermap':
        $toadd = array('-1' => "[" . __('Legend', 'monitoring') . "]");
        Dropdown::show('PluginMonitoringWeathermap', array('name' => 'items_id', 'toadd' => $toadd));
        echo "<br/>" . __('% of the width of the frame', 'monitoring') . "&nbsp: ";
        Dropdown::showNumber("extra_infos", array('value' => 100, 'min' => 0, 'max' => 100, 'step' => 5));
        break;
    case 'PluginMonitoringDisplayview':
        if (isset($_POST['sliders_id'])) {
            Dropdown::show('PluginMonitoringDisplayview', array('name' => 'items_id'));
        } else {
 static function task_definitiontype_networkinventory($a_itemtype)
 {
     $a_itemtype['PluginFusioninventoryIPRange'] = __('IP Ranges', 'fusioninventory');
     $a_itemtype['NetworkEquipment'] = NetworkEquipment::getTypeName();
     $a_itemtype['Printer'] = Printer::getTypeName();
     return $a_itemtype;
 }