当前位置: 首页>>代码示例>>PHP>>正文


PHP Dropdown::showItemType方法代码示例

本文整理汇总了PHP中Dropdown::showItemType方法的典型用法代码示例。如果您正苦于以下问题:PHP Dropdown::showItemType方法的具体用法?PHP Dropdown::showItemType怎么用?PHP Dropdown::showItemType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dropdown的用法示例。


在下文中一共展示了Dropdown::showItemType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preaddRule

 function preaddRule($componentscatalogs_id)
 {
     global $CFG_GLPI, $DB;
     $networkport_types = $CFG_GLPI['networkport_types'];
     $networkport_types[] = "PluginMonitoringNetworkport";
     $a_usedItemtypes = array();
     $query = "SELECT * FROM `" . $this->getTable() . "`\n         WHERE `plugin_monitoring_componentscalalog_id`='" . $componentscatalogs_id . "'";
     $result = $DB->query($query);
     while ($data = $DB->fetch_array($result)) {
         $key = array_search($data['itemtype'], $networkport_types);
         if (isset($key)) {
             unset($networkport_types[$key]);
         }
     }
     if (count($a_usedItemtypes) == count($networkport_types)) {
         return;
     }
     $this->getEmpty();
     $this->showFormHeader();
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     echo __('Name') . "&nbsp;:";
     echo "</td>";
     echo "<td>";
     echo "<input type='text' name='name' value=''/>";
     echo "</td>";
     echo "<td>";
     echo __('Item type') . "&nbsp;:";
     echo "</td>";
     echo "<td>";
     Dropdown::showItemType($networkport_types);
     echo "<input type='hidden' name='plugin_monitoring_componentscalalog_id' value='" . $componentscatalogs_id . "' >";
     echo "</td>";
     echo "</tr>";
     $this->showFormButtons();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:36,代码来源:componentscatalog_rule.class.php

示例2: showItems

 /**
  * Show items for the group
  *
  * @param $tech   boolean  false search groups_id, true, search groups_id_tech
  **/
 function showItems($tech)
 {
     global $DB, $CFG_GLPI;
     $rand = mt_rand();
     $ID = $this->fields['id'];
     if ($tech) {
         $types = $CFG_GLPI['linkgroup_tech_types'];
         $field = 'groups_id_tech';
         $title = __('Managed items');
     } else {
         $types = $CFG_GLPI['linkgroup_types'];
         $field = 'groups_id';
         $title = __('Used items');
     }
     $tree = Session::getSavedOption(__CLASS__, 'tree', 0);
     $user = Session::getSavedOption(__CLASS__, 'user', 0);
     $type = Session::getSavedOption(__CLASS__, 'onlytype', '');
     if (!in_array($type, $types)) {
         $type = '';
     }
     echo "<div class='spaced'>";
     // Mini Search engine
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'><th colspan='3'>{$title}</tr>";
     echo "<tr class='tab_bg_1'><td class='center'>";
     echo __('Type') . "&nbsp;";
     Dropdown::showItemType($types, array('value' => $type, 'name' => 'onlytype', 'plural' => true, 'on_change' => 'reloadTab("start=0&onlytype="+this.value)', 'checkright' => true));
     if ($this->haveChildren()) {
         echo "</td><td class='center'>" . __('Child groups') . "&nbsp;";
         Dropdown::showYesNo('tree', $tree, -1, array('on_change' => 'reloadTab("start=0&tree="+this.value)'));
     } else {
         $tree = 0;
     }
     if ($this->getField('is_usergroup')) {
         echo "</td><td class='center'>" . User::getTypeName(Session::getPluralNumber()) . "&nbsp;";
         Dropdown::showYesNo('user', $user, -1, array('on_change' => 'reloadTab("start=0&user="+this.value)'));
     } else {
         $user = 0;
     }
     echo "</td></tr></table>";
     $datas = array();
     if ($type) {
         $types = array($type);
     }
     $start = isset($_GET['start']) ? intval($_GET['start']) : 0;
     $nb = $this->getDataItems($types, $field, $tree, $user, $start, $datas);
     $nbcan = 0;
     if ($nb) {
         Html::printAjaxPager('', $start, $nb);
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         echo Html::hidden('field', array('value' => $field, 'data-glpicore-ma-tags' => 'common'));
         $massiveactionparams = array('num_displayed' => $nb, 'check_itemtype' => 'Group', 'check_items_id' => $ID, 'container' => 'mass' . __CLASS__ . $rand, 'extraparams' => array('is_tech' => $tech, 'massive_action_fields' => array('field')), 'specific_actions' => array(__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'changegroup' => __('Move')));
         Html::showMassiveActions($massiveactionparams);
         echo "<table class='tab_cadre_fixehov'>";
         $header_begin = "<tr><th width='10'>";
         $header_top = Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
         $header_bottom = Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
         $header_end = '</th>';
         $header_end .= "<th>" . __('Type') . "</th><th>" . __('Name') . "</th><th>" . __('Entity') . "</th>";
         if ($tree || $user) {
             $header_end .= "<th>" . sprintf(__('%1$s / %2$s'), self::getTypeName(1), User::getTypeName(1)) . "</th>";
         }
         $header_end .= "</tr>";
         echo $header_begin . $header_top . $header_end;
         $tuser = new User();
         $group = new Group();
         foreach ($datas as $data) {
             if (!($item = getItemForItemtype($data['itemtype']))) {
                 continue;
             }
             echo "<tr class='tab_bg_1'><td>";
             if ($item->canEdit($data['items_id'])) {
                 Html::showMassiveActionCheckBox($data['itemtype'], $data['items_id']);
             }
             echo "</td><td>" . $item->getTypeName(1);
             echo "</td><td>" . $item->getLink(array('comments' => true));
             echo "</td><td>" . Dropdown::getDropdownName("glpi_entities", $item->getEntityID());
             if ($tree || $user) {
                 echo "</td><td>";
                 if ($grp = $item->getField($field)) {
                     if ($group->getFromDB($grp)) {
                         echo $group->getLink(array('comments' => true));
                     }
                 } else {
                     if ($usr = $item->getField(str_replace('groups', 'users', $field))) {
                         if ($tuser->getFromDB($usr)) {
                             echo $tuser->getLink(array('comments' => true));
                         }
                     }
                 }
             }
             echo "</td></tr>";
         }
         echo $header_begin . $header_bottom . $header_end;
         echo "</table>";
//.........这里部分代码省略.........
开发者ID:korial29,项目名称:glpi,代码行数:101,代码来源:group.class.php

示例3: dropdownAllConnect

 /**
  * Make a select box for connections
  *
  * @since version 0.84
  *
  * @param $fromtype               from where the connection is
  * @param $myname                 select name
  * @param $entity_restrict        Restrict to a defined entity (default = -1)
  * @param $onlyglobal             display only global devices (used for templates) (default 0)
  * @param $used             array Already used items ID: not to display in dropdown
  *
  * @return nothing (print out an HTML select box)
  */
 static function dropdownAllConnect($fromtype, $myname, $entity_restrict = -1, $onlyglobal = 0, $used = array())
 {
     global $CFG_GLPI;
     $rand = mt_rand();
     $options = array();
     $options['checkright'] = true;
     $options['name'] = 'itemtype';
     $rand = Dropdown::showItemType($CFG_GLPI['directconnect_types'], $options);
     if ($rand) {
         $params = array('itemtype' => '__VALUE__', 'fromtype' => $fromtype, 'value' => 0, 'myname' => $myname, 'onlyglobal' => $onlyglobal, 'entity_restrict' => $entity_restrict, 'used' => $used);
         if ($onlyglobal) {
             $params['condition'] = "`is_global` = '1'";
         }
         Ajax::updateItemOnSelectEvent("dropdown_itemtype{$rand}", "show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/ajax/dropdownConnect.php", $params);
         echo "<br><div id='show_{$myname}{$rand}'>&nbsp;</div>\n";
     }
     return $rand;
 }
开发者ID:stweil,项目名称:glpi,代码行数:31,代码来源:computer_item.class.php

示例4: showItems

 /**
  * Print the HTML array of items for a location
  *
  * @since version 0.85
  *
  * @return Nothing (display)
  **/
 function showItems()
 {
     global $DB, $CFG_GLPI;
     $locations_id = $this->fields['id'];
     $crit = Session::getSavedOption(__CLASS__, 'criterion', '');
     if (!$this->can($locations_id, READ)) {
         return false;
     }
     $first = 1;
     $query = '';
     if ($crit) {
         $table = getTableForItemType($crit);
         $query = "SELECT `{$table}`.`id`, '{$crit}' AS type\n                   FROM `{$table}`\n                   WHERE `{$table}`.`locations_id` = '{$locations_id}' " . getEntitiesRestrictRequest(" AND", $table, "entities_id");
     } else {
         foreach ($CFG_GLPI['location_types'] as $type) {
             $table = getTableForItemType($type);
             $query .= ($first ? "SELECT " : " UNION SELECT  ") . "`id`, '{$type}' AS type\n                      FROM `{$table}`\n                      WHERE `{$table}`.`locations_id` = '{$locations_id}' " . getEntitiesRestrictRequest(" AND", $table, "entities_id");
             $first = 0;
         }
     }
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $start = isset($_REQUEST['start']) ? intval($_REQUEST['start']) : 0;
     if ($start >= $number) {
         $start = 0;
     }
     // Mini Search engine
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'><th colspan='2'>" . __('Type') . "</th></tr>";
     echo "<tr class='tab_bg_1'><td class='center'>";
     echo __('Type') . "&nbsp;";
     Dropdown::showItemType($CFG_GLPI['location_types'], array('value' => $crit, 'on_change' => 'reloadTab("start=0&criterion="+this.value)'));
     echo "</td></tr></table>";
     if ($number) {
         echo "<div class='spaced'>";
         Html::printAjaxPager('', $start, $number);
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr><th>" . __('Type') . "</th>";
         echo "<th>" . __('Entity') . "</th>";
         echo "<th>" . __('Name') . "</th>";
         echo "<th>" . __('Serial number') . "</th>";
         echo "<th>" . __('Inventory number') . "</th>";
         echo "</tr>";
         $DB->data_seek($result, $start);
         for ($row = 0; ($data = $DB->fetch_assoc($result)) && $row < $_SESSION['glpilist_limit']; $row++) {
             $item = getItemForItemtype($data['type']);
             $item->getFromDB($data['id']);
             echo "<tr class='tab_bg_1'><td class='center top'>" . $item->getTypeName() . "</td>";
             echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $item->getEntityID());
             echo "</td><td class='center'>" . $item->getLink() . "</td>";
             echo "<td class='center'>" . (isset($item->fields["serial"]) ? "" . $item->fields["serial"] . "" : "-");
             echo "</td>";
             echo "<td class='center'>" . (isset($item->fields["otherserial"]) ? "" . $item->fields["otherserial"] . "" : "-");
             echo "</td></tr>";
         }
     } else {
         echo "<p class='center b'>" . __('No item found') . "</p>";
     }
     echo "</table></div>";
 }
开发者ID:stweil,项目名称:glpi,代码行数:67,代码来源:location.class.php

示例5: dropdownAllConnect

 /**
  * Make a select box for connections
  *
  * @since version 0.84
  *
  * @param $fromtype               from where the connection is
  * @param $myname                 select name
  * @param $entity_restrict        Restrict to a defined entity (default = -1)
  * @param $onlyglobal             display only global devices (used for templates) (default 0)
  * @param $used             array Already used items ID: not to display in dropdown
  *
  * @return nothing (print out an HTML select box)
  */
 static function dropdownAllConnect($fromtype, $myname, $entity_restrict = -1, $onlyglobal = 0, $used = array())
 {
     global $CFG_GLPI;
     $rand = mt_rand();
     //       $use_ajax = false;
     //       if ($CFG_GLPI["use_ajax"]) {
     //          $nb = 0;
     //          if ($entity_restrict >= 0) {
     //             $nb = countElementsInTableForEntity(getTableForItemType($itemtype), $entity_restrict);
     //          } else {
     //             $nb = countElementsInTableForMyEntities(getTableForItemType($itemtype));
     //          }
     //          if ($nb > $CFG_GLPI["ajax_limit_count"]) {
     //             $use_ajax = true;
     //          }
     //       }
     $options = array();
     $options['checkright'] = true;
     $options['name'] = 'itemtype';
     $rand = Dropdown::showItemType($CFG_GLPI['directconnect_types'], $options);
     if ($rand) {
         $params = array('itemtype' => '__VALUE__', 'fromtype' => $fromtype, 'value' => 0, 'myname' => $myname, 'onlyglobal' => $onlyglobal, 'entity_restrict' => $entity_restrict, 'used' => $used);
         if ($onlyglobal) {
             $params['condition'] = "`is_global` = '1'";
         }
         Ajax::updateItemOnSelectEvent("itemtype{$rand}", "show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/ajax/dropdownConnect.php", $params);
         echo "<br><span id='show_{$myname}{$rand}'>&nbsp;</span>\n";
     }
     return $rand;
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:43,代码来源:computer_item.class.php

示例6: showSelectItemFromItemtypes

 /**
  * Make a select box for all items
  *
  * @since version 0.85
  *
  * @param $options array:
  *   - itemtype_name        : the name of the field containing the itemtype (default 'itemtype')
  *   - items_id_name        : the name of the field containing the id of the selected item
  *                            (default 'items_id')
  *   - itemtypes            : all possible types to search for (default: $CFG_GLPI["state_types"])
  *   - default_itemtype     : the default itemtype to select (don't define if you don't
  *                            need a default) (defaut 0)
  *    - entity_restrict     : restrict entity in searching items (default -1)
  *    - onlyglobal          : don't match item that don't have `is_global` == 1 (false by default)
  *    - checkright          : check to see if we can "view" the itemtype (false by default)
  *    - showItemSpecificity : given an item, the AJAX file to open if there is special
  *                            treatment. For instance, select a Item_Device* for CommonDevice
  *    - emptylabel          : Empty choice's label (default self::EMPTY_VALUE)
  *
  * @return randomized value used to generate HTML IDs
  **/
 static function showSelectItemFromItemtypes(array $options = array())
 {
     global $CFG_GLPI;
     $params = array();
     $params['itemtype_name'] = 'itemtype';
     $params['items_id_name'] = 'items_id';
     $params['itemtypes'] = '';
     $params['default_itemtype'] = 0;
     $params['entity_restrict'] = -1;
     $params['onlyglobal'] = false;
     $params['checkright'] = false;
     $params['showItemSpecificity'] = '';
     $params['condition'] = '';
     $params['emptylabel'] = Dropdown::EMPTY_VALUE;
     if (is_array($options) && count($options)) {
         foreach ($options as $key => $val) {
             $params[$key] = $val;
         }
     }
     $rand = Dropdown::showItemType($params['itemtypes'], array('checkright' => $params['checkright'], 'name' => $params['itemtype_name'], 'emptylabel' => $params['emptylabel']));
     if ($rand) {
         $p = array('idtable' => '__VALUE__', 'name' => $params['items_id_name'], 'entity_restrict' => $params['entity_restrict'], 'showItemSpecificity' => $params['showItemSpecificity']);
         $field_id = Html::cleanId("dropdown_" . $params['itemtype_name'] . $rand);
         $show_id = Html::cleanId("show_" . $params['items_id_name'] . $rand);
         Ajax::updateItemOnSelectEvent($field_id, $show_id, $CFG_GLPI["root_doc"] . "/plugins/consumables/ajax/dropdownAllItems.php", $p);
         echo "<br><span id='{$show_id}'>&nbsp;</span>\n";
         // We check $options as the caller will set $options['default_itemtype'] only if it needs a
         // default itemtype and the default value can be '' thus empty won't be valid !
         if (array_key_exists('default_itemtype', $options)) {
             echo "<script type='text/javascript' >\n";
             echo Html::jsSetDropdownValue($field_id, $params['default_itemtype']);
             echo "</script>\n";
             $p["idtable"] = $params['default_itemtype'];
             Ajax::updateItem($show_id, $CFG_GLPI["root_doc"] . "/ajax/dropdownAllItems.php", $p);
         }
     }
     return $rand;
 }
开发者ID:AircraftRu,项目名称:consumables,代码行数:59,代码来源:request.class.php

示例7: dropdown

 public static function dropdown($options = array())
 {
     global $DB, $CFG_GLPI;
     $params['itemtype_name'] = 'itemtype';
     $params['items_id_name'] = 'items_id';
     $params['itemtypes'] = array();
     $params['default_itemtype'] = 0;
     $params['entity_restrict'] = -1;
     $params['onlyglobal'] = false;
     $params['checkright'] = false;
     $params['showItemSpecificity'] = '';
     $params['emptylabel'] = '';
     //$p['entity'] = '';
     if (is_array($options) && count($options)) {
         foreach ($options as $key => $val) {
             $p[$key] = $val;
         }
     }
     $rand = mt_rand();
     $query = "select id, name from glpi_plugin_relation_typerelations order by 1";
     $result = $DB->query($query);
     $type_relations = "type_relations" . $p['name'];
     //Desplegable tipos de relaciones
     echo "<select name='_nombresrelaciones' id='nombresrelaciones'>\n";
     if ($DB->numrows($result)) {
         while ($data = $DB->fetch_array($result)) {
             echo "<option value='" . $data[0] . "'>" . $data[1] . "</option>\n";
         }
     }
     echo "</select>\n";
     //Desplegable de las clases
     $query = "select rc.id, rc.classlist, c.viewname FROM glpi_plugin_relation_relationclases rc, glpi_plugin_relation_clases c where rc.classlist=c.name and classname='" . $p['itemtype'] . "' order by 1";
     //echo $query;
     $result = $DB->query($query);
     $arraySelect = array();
     if ($DB->numrows($result)) {
         while ($data = $DB->fetch_array($result)) {
             $arraySelect[] = $data[1];
         }
         $params['itemtypes'] = $arraySelect;
     }
     $rand = Dropdown::showItemType($params['itemtypes'], array('checkright' => $params['checkright'], 'name' => $params['itemtype_name'], 'emptylabel' => $params['emptylabel']));
     if ($rand) {
         $p = array('idtable' => '__VALUE__', 'name' => $params['items_id_name'], 'entity_restrict' => $params['entity_restrict'], 'width' => '120', 'display_emptychoice' => true, 'showItemSpecificity' => $params['showItemSpecificity']);
         if ($params['onlyglobal']) {
             $p['condition'] = "`is_global` = 1";
         }
         $field_id = Html::cleanId("dropdown_" . $params['itemtype_name'] . $rand);
         $show_id = Html::cleanId("show_" . $params['items_id_name'] . $rand);
         Ajax::updateItemOnSelectEvent($field_id, $show_id, $CFG_GLPI["root_doc"] . "/plugins/relation/ajax/dropdownAllItems.php", $p);
         echo "<br><span id='{$show_id}'>&nbsp;</span>\n";
         // We check $options as the caller will set $options['default_itemtype'] only if it needs a
         // default itemtype and the default value can be '' thus empty won't be valid !
         if (array_key_exists('default_itemtype', $options)) {
             echo "<script type='text/javascript' >\n";
             echo Html::jsSetDropdownValue($field_id, $params['default_itemtype']);
             echo "</script>\n";
             $p["idtable"] = $params['default_itemtype'];
             Ajax::updateItem($show_id, $CFG_GLPI["root_doc"] . "/plugins/relation/ajax/dropdownAllItems.php", $p);
         }
     }
     return $rand;
 }
开发者ID:OscarLoayzaB,项目名称:relation,代码行数:63,代码来源:relation.class.php


注:本文中的Dropdown::showItemType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。