• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP getTableForItemType函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getTableForItemType函数的典型用法代码示例。如果您正苦于以下问题:PHP getTableForItemType函数的具体用法?PHP getTableForItemType怎么用?PHP getTableForItemType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: uninstall

 public static function uninstall()
 {
     // Define DB tables
     $table_targets = getTableForItemType('NotificationTarget');
     $table_notification = getTableForItemType('Notification');
     $table_translations = getTableForItemType('NotificationTemplateTranslation');
     $table_templates = getTableForItemType('NotificationTemplate');
     // Delete translations
     $query = 'DELETE FROM `' . $table_translations . '`
             WHERE `notificationtemplates_id` IN (
               SELECT `id` FROM ' . $table_templates . ' WHERE `itemtype` = "PluginFormcreatorFormanswer")';
     $GLOBALS['DB']->query($query);
     // Delete notification templates
     $query = 'DELETE FROM `' . $table_templates . '`
             WHERE `itemtype` = "PluginFormcreatorFormanswer"';
     $GLOBALS['DB']->query($query);
     // Delete notification targets
     $query = 'DELETE FROM `' . $table_targets . '`
             WHERE `notifications_id` IN (
               SELECT `id` FROM ' . $table_notification . ' WHERE `itemtype` = "PluginFormcreatorFormanswer")';
     $GLOBALS['DB']->query($query);
     // Delete notifications
     $query = 'DELETE FROM `' . $table_notification . '`
             WHERE `itemtype` = "PluginFormcreatorFormanswer"';
     $GLOBALS['DB']->query($query);
 }
开发者ID:jcr0ch4,项目名称:formcreator,代码行数:26,代码来源:notificationtargetformanswer.class.php


示例2: showAllItems

 function showAllItems($myname, $value_type = 0, $value = 0, $entity_restrict = -1)
 {
     global $DB, $CFG_GLPI;
     $types = array('Computer', 'NetworkEquipment', 'Peripheral', 'Phone', 'Printer');
     $rand = mt_rand();
     echo "<table border='0'><tr><td>\n";
     echo "<select name='type' id='item_type{$rand}'>\n";
     echo "<option value='0;0'>" . Dropdown::EMPTY_VALUE . "</option>\n";
     foreach ($types as $type => $label) {
         $item = new $label();
         echo "<option value='" . $label . ";" . getTableForItemType($label . "Type") . "'>" . $item->getTypeName() . "</option>\n";
     }
     echo "</select>";
     $params = array('typetable' => '__VALUE__', 'value' => $value, 'myname' => $myname, 'entity_restrict' => $entity_restrict);
     Ajax::updateItemOnSelectEvent("item_type{$rand}", "show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/archires/ajax/dropdownAllItems.php", $params);
     echo "</td><td>\n";
     echo "<span id='show_{$myname}{$rand}'>&nbsp;</span>\n";
     echo "</td></tr></table>\n";
     if ($value > 0) {
         echo "<script type='text/javascript' >\n";
         echo "document.getElementById('item_type{$rand}').value='" . $value_type . "';";
         echo "</script>\n";
         $params["typetable"] = $value_type;
         Ajax::updateItem("show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/archires/ajax/dropdownAllItems.php", $params);
     }
     return $rand;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:27,代码来源:archires.class.php


示例3: uninstall

 static function uninstall()
 {
     global $DB;
     $table = getTableForItemType(__CLASS__);
     $DB->query("DROP TABLE IF EXISTS`{$table}`");
     return true;
 }
开发者ID:pluginsGLPI,项目名称:itilcategorygroups,代码行数:7,代码来源:category_group.class.php


示例4: plugin_tag_getAddSearchOptions

function plugin_tag_getAddSearchOptions($itemtype)
{
    $sopt = array();
    if (!Session::haveRight("itilcategory", READ)) {
        return array();
    }
    if (strpos($itemtype, 'Plugin') !== false && strpos($itemtype, 'CronTask') !== false) {
        return array();
    }
    if ($itemtype === 'PluginTagTag' || $itemtype === 'TicketTemplate' || strpos($itemtype, 'PluginPrintercounters') !== false) {
        return array();
    }
    $rng1 = 10500;
    //$sopt[strtolower($itemtype)] = ''; //self::getTypeName(2);
    $sopt[$rng1]['table'] = getTableForItemType('PluginTagTag');
    $sopt[$rng1]['field'] = 'name';
    $sopt[$rng1]['name'] = _n('Tag', 'Tag', 2, 'tag');
    $sopt[$rng1]['datatype'] = 'string';
    $sopt[$rng1]['searchtype'] = "contains";
    $sopt[$rng1]['massiveaction'] = false;
    $sopt[$rng1]['forcegroupby'] = true;
    $sopt[$rng1]['usehaving'] = true;
    $sopt[$rng1]['joinparams'] = array('beforejoin' => array('table' => 'glpi_plugin_tag_tagitems', 'joinparams' => array('jointype' => "itemtype_item")));
    //array('jointype' => "itemtype_item");
    return $sopt;
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:26,代码来源:hook.php


示例5: getSqlSubRequest

function getSqlSubRequest($itemtype, $loc, $obj)
{
    $table = getTableForItemType($itemtype);
    $models_id = getForeignKeyFieldForTable(getTableForItemType($itemtype . 'Model'));
    $types_id = getForeignKeyFieldForTable(getTableForItemType($itemtype . 'Type'));
    $fields = array('name' => 'name', 'serial' => 'serial', 'otherserial' => 'otherserial', $models_id => 'models_id', $types_id => 'types_id');
    $query_where = "SELECT '{$itemtype}' AS itemtype,\n                          `{$table}`.`id` AS items_id,\n                          `{$table}`.`locations_id`";
    foreach ($fields as $field => $alias) {
        if ($obj->isField($field)) {
            $query_where .= ", `{$table}`.`{$field}` AS {$alias}";
        } else {
            $query_where .= ", '' AS {$alias}";
        }
    }
    $query_where .= " FROM `{$table}` ";
    if ($obj->isEntityAssign()) {
        $query_where .= getEntitiesRestrictRequest('WHERE', "{$table}");
    } else {
        $query_where .= 'WHERE 1';
    }
    if ($obj->maybeTemplate()) {
        $query_where .= " AND `is_template`='0'";
    }
    if ($obj->maybeDeleted()) {
        $query_where .= " AND `is_deleted`='0'";
    }
    $query_where .= $loc->getSqlCriteriasRestriction();
    return $query_where;
}
开发者ID:geldarr,项目名称:hack-space,代码行数:29,代码来源:listequipmentbylocation.php


示例6: uninstall

 static function uninstall()
 {
     global $DB;
     //Old table
     $DB->query("DROP TABLE IF EXISTS `glpi_dropdown_plugin_order_deliverystate`") or die($DB->error());
     //New table
     $DB->query("DROP TABLE IF EXISTS `" . getTableForItemType(__CLASS__) . "`") or die($DB->error());
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:8,代码来源:deliverystate.class.php


示例7: uninstall

 static function uninstall()
 {
     global $DB;
     $displayPreference = new DisplayPreference();
     $displayPreference->deleteByCriteria(array('itemtype' => __CLASS__));
     $table = getTableForItemType(__CLASS__);
     $DB->query("DROP TABLE IF EXISTS `{$table}`");
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:8,代码来源:simcardsize.class.php


示例8: update078to0781

/**
 * Update from 0.78 to 0.78.1
 *
 * @return bool for success (will die for most error)
 */
function update078to0781()
{
    global $DB, $migration;
    $updateresult = true;
    $migration->displayTitle(sprintf(__('Update to %s'), '0.78.1'));
    $migration->setVersion('0.78.1');
    //TRANS: %s is 'Clean reservation entity link'
    $migration->displayMessage(sprintf(__('Data migration - %s'), 'Clean reservation entity link'));
    // Updating schema
    $entities = getAllDatasFromTable('glpi_entities');
    $entities[0] = "Root";
    $query = "SELECT DISTINCT `itemtype` FROM `glpi_reservationitems`";
    if ($result = $DB->query($query)) {
        if ($DB->numrows($result) > 0) {
            while ($data = $DB->fetch_assoc($result)) {
                $itemtable = getTableForItemType($data['itemtype']);
                // ajout d'un contrôle pour voir si la table existe ( cas migration plugin non fait)
                if (!TableExists($itemtable)) {
                    $migration->displayWarning("*** Skip : no table {$itemtable} ***", true);
                    continue;
                }
                $do_recursive = false;
                if (FieldExists($itemtable, 'is_recursive', false)) {
                    $do_recursive = true;
                }
                foreach ($entities as $entID => $val) {
                    if ($do_recursive) {
                        // Non recursive ones
                        $query3 = "UPDATE `glpi_reservationitems`\n                           SET `entities_id`={$entID}, `is_recursive`=0\n                           WHERE `itemtype`='" . $data['itemtype'] . "'\n                              AND `items_id` IN (SELECT `id` FROM `{$itemtable}`\n                              WHERE `entities_id`={$entID} AND `is_recursive`=0)";
                        $DB->queryOrDie($query3, "0.78.1 update entities_id and is_recursive=0 in glpi_reservationitems for " . $data['itemtype']);
                        // Recursive ones
                        $query3 = "UPDATE `glpi_reservationitems`\n                           SET `entities_id`={$entID}, `is_recursive`=1\n                           WHERE `itemtype`='" . $data['itemtype'] . "'\n                              AND `items_id` IN (SELECT `id` FROM `{$itemtable}`\n                              WHERE `entities_id`={$entID} AND `is_recursive`=1)";
                        $DB->queryOrDie($query3, "0.78.1 update entities_id and is_recursive=1 in glpi_reservationitems for " . $data['itemtype']);
                    } else {
                        $query3 = "UPDATE `glpi_reservationitems`\n                           SET `entities_id`={$entID}\n                           WHERE `itemtype`='" . $data['itemtype'] . "'\n                              AND `items_id` IN (SELECT `id` FROM `{$itemtable}`\n                              WHERE `entities_id`={$entID})";
                        $DB->queryOrDie($query3, "0.78.1 update entities_id in glpi_reservationitems for " . $data['itemtype']);
                    }
                }
            }
        }
    }
    $query = "ALTER TABLE `glpi_tickets`\n             CHANGE `global_validation` `global_validation` VARCHAR(255) DEFAULT 'none'";
    $DB->query($query) or die("0.78.1 change ticket global_validation default state");
    $query = "UPDATE `glpi_tickets`\n             SET `global_validation`='none'\n             WHERE `id` NOT IN (SELECT DISTINCT `tickets_id`\n                                FROM `glpi_ticketvalidations`)";
    $DB->query($query) or die("0.78.1 update ticket global_validation state");
    if (!FieldExists('glpi_knowbaseitemcategories', 'entities_id', false)) {
        $query = "ALTER TABLE `glpi_knowbaseitemcategories`\n                    ADD `entities_id` INT NOT NULL DEFAULT '0' AFTER `id`,\n                    ADD `is_recursive` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `entities_id`,\n                    ADD INDEX `entities_id` (`entities_id`),ADD INDEX `is_recursive` (`is_recursive`)";
        $DB->queryOrDie($query, "0.78.1 add entities_id,is_recursive in glpi_knowbaseitemcategories");
        // Set existing categories recursive global
        $query = "UPDATE `glpi_knowbaseitemcategories` SET `is_recursive` = '1'";
        $DB->queryOrDie($query, "0.78.1 set value of is_recursive in glpi_knowbaseitemcategories");
        $query = "ALTER TABLE `glpi_knowbaseitemcategories` DROP INDEX `unicity` ,\n               ADD UNIQUE `unicity` ( `entities_id`, `knowbaseitemcategories_id` , `name` ) ";
        $DB->queryOrDie($query, "0.78.1 update unicity index on glpi_knowbaseitemcategories");
    }
    // must always be at the end (only for end message)
    $migration->executeMigration();
    return $updateresult;
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:63,代码来源:update_078_0781.php


示例9: getAnswer

 public function getAnswer()
 {
     $value = $this->getValue();
     if ($this->fields['values'] == 'User') {
         return getUserName($value);
     } else {
         return Dropdown::getDropdownName(getTableForItemType($this->fields['values']), $value);
     }
 }
开发者ID:jcr0ch4,项目名称:formcreator,代码行数:9,代码来源:dropdown-field.class.php


示例10: uninstall

 static function uninstall()
 {
     global $DB;
     $table = getTableForItemType(__CLASS__);
     if (TableExists($table)) {
         $query = "DROP TABLE IF EXISTS `{$table}`";
         $DB->query($query) or die($DB->error());
     }
 }
开发者ID:btry,项目名称:genericobject,代码行数:9,代码来源:typefamily.class.php


示例11: getInstance

 /**
  * Singleton to store DB fields definition
  * 
  * @since 2.1.0
  * @param itemtype itemtype to query
  * @param reload reload db fields configuration from DB
  * 
  * @return an array which contains DB fields definition 
  */
 public static function getInstance($itemtype, $reload = false)
 {
     global $DB;
     if (!isset(self::$_dbfields[$itemtype]) || $reload) {
         self::$_dbfields[$itemtype] = $DB->list_fields(getTableForItemType($itemtype));
     } else {
     }
     return self::$_dbfields[$itemtype];
 }
开发者ID:rambeau,项目名称:genericobject,代码行数:18,代码来源:singletonobjectfield.class.php


示例12: checkPreferenceValue

 /**
  *
  * Get a preference for an user
  * @param unknown_type preference field to get
  * @param unknown_type user ID
  * @return preference value or 0
  */
 static function checkPreferenceValue($field, $users_id = 0)
 {
     $data = getAllDatasFromTable(getTableForItemType(__CLASS__), "`users_id`='{$users_id}'");
     if (!empty($data)) {
         $first = array_pop($data);
         return $first[$field];
     } else {
         return 0;
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:17,代码来源:preference.class.php


示例13: updatePrinter

 /**
  * Function to update Printer
  *
  * @param array $a_inventory data fron agent inventory
  * @param id $items_id id of the printer
  *
  * @return nothing
  */
 function updatePrinter($a_inventory, $items_id)
 {
     global $DB;
     $printer = new Printer();
     $pfPrinter = new PluginFusioninventoryPrinter();
     $printer->getFromDB($items_id);
     if (!isset($_SESSION['glpiactiveentities_string'])) {
         $_SESSION['glpiactiveentities_string'] = $printer->fields['entities_id'];
     }
     if (!isset($_SESSION['glpiactiveentities'])) {
         $_SESSION['glpiactiveentities'] = array($printer->fields['entities_id']);
     }
     if (!isset($_SESSION['glpiactive_entity'])) {
         $_SESSION['glpiactive_entity'] = $printer->fields['entities_id'];
     }
     // * Printer
     $db_printer = $printer->fields;
     $a_lockable = PluginFusioninventoryLock::getLockFields('glpi_printers', $items_id);
     $a_ret = PluginFusioninventoryToolbox::checkLock($a_inventory['Printer'], $db_printer, $a_lockable);
     $a_inventory['Printer'] = $a_ret[0];
     $input = $a_inventory['Printer'];
     $input['id'] = $items_id;
     $printer->update($input);
     // * Printer fusion (ext)
     $db_printer = array();
     $query = "SELECT *\n            FROM `" . getTableForItemType("PluginFusioninventoryPrinter") . "`\n            WHERE `printers_id` = '{$items_id}'";
     $result = $DB->query($query);
     while ($data = $DB->fetch_assoc($result)) {
         foreach ($data as $key => $value) {
             $db_printer[$key] = Toolbox::addslashes_deep($value);
         }
     }
     if (count($db_printer) == '0') {
         // Add
         $a_inventory['PluginFusioninventoryPrinter']['printers_id'] = $items_id;
         $pfPrinter->add($a_inventory['PluginFusioninventoryPrinter']);
     } else {
         // Update
         $idtmp = $db_printer['id'];
         unset($db_printer['id']);
         unset($db_printer['printers_id']);
         unset($db_printer['plugin_fusioninventory_configsecurities_id']);
         $a_ret = PluginFusioninventoryToolbox::checkLock($a_inventory['PluginFusioninventoryPrinter'], $db_printer);
         $a_inventory['PluginFusioninventoryPrinter'] = $a_ret[0];
         $input = $a_inventory['PluginFusioninventoryPrinter'];
         $input['id'] = $idtmp;
         $pfPrinter->update($input);
     }
     // * Ports
     $this->importPorts($a_inventory, $items_id);
     // Page counters
     $this->importPageCounters($a_inventory['pagecounters'], $items_id);
     // Cartridges
     $this->importCartridges($a_inventory['cartridge'], $items_id);
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:63,代码来源:inventoryprinterlib.class.php


示例14: uninstall

 public static function uninstall()
 {
     $query = "DELETE FROM glpi_logs WHERE itemtype_link='" . __CLASS__ . "'";
     $GLOBALS['DB']->query($query);
     $query = "DELETE FROM glpi_bookmarks WHERE itemtype='" . __CLASS__ . "'";
     $GLOBALS['DB']->query($query);
     $query = "DELETE FROM glpi_displaypreferences WHERE itemtype='" . __CLASS__ . "' OR num=10500";
     $GLOBALS['DB']->query($query);
     $query = "DROP TABLE IF EXISTS `" . getTableForItemType(__CLASS__) . "`";
     return $GLOBALS['DB']->query($query) or die($GLOBALS['DB']->error());
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:11,代码来源:tag.class.php


示例15: plugin_init_formcreator

/**
 * Initialize all classes and generic variables of the plugin
 */
function plugin_init_formcreator()
{
    global $PLUGIN_HOOKS;
    // Set the plugin CSRF compliance (required since GLPI 0.84)
    $PLUGIN_HOOKS['csrf_compliant']['formcreator'] = true;
    $plugin = new Plugin();
    if (isset($_SESSION['glpiID']) && $plugin->isInstalled('formcreator') && $plugin->isActivated('formcreator')) {
        // Massive Action definition
        $PLUGIN_HOOKS['use_massive_action']['formcreator'] = 1;
        // If user have acces to one form or more, add link
        $form_table = getTableForItemType('PluginFormcreatorForm');
        $table_fp = getTableForItemType('PluginFormcreatorFormprofiles');
        $where = getEntitiesRestrictRequest("", $form_table, "", "", true, false);
        $query = "SELECT COUNT({$form_table}.id)\n                     FROM {$form_table}\n                     WHERE {$form_table}.`is_active` = 1\n                     AND {$form_table}.`is_deleted` = 0\n                     AND {$form_table}.`helpdesk_home` = 1\n                     AND ({$form_table}.`language` = '{$_SESSION['glpilanguage']}' OR {$form_table}.`language` = '')\n                     AND {$where}\n                     AND ({$form_table}.`access_rights` != " . PluginFormcreatorForm::ACCESS_RESTRICTED . " OR {$form_table}.`id` IN (\n                        SELECT plugin_formcreator_forms_id\n                        FROM {$table_fp}\n                        WHERE plugin_formcreator_profiles_id = " . (int) $_SESSION['glpiactiveprofile']['id'] . "))";
        $result = $GLOBALS['DB']->query($query);
        list($nb) = $GLOBALS['DB']->fetch_array($result);
        if ($nb > 0) {
            $PLUGIN_HOOKS['menu_toadd']['formcreator']['helpdesk'] = 'PluginFormcreatorFormlist';
        }
        if (strpos($_SERVER['REQUEST_URI'], "plugins/formcreator") !== false || strpos($_SERVER['REQUEST_URI'], "central.php") !== false || isset($_SESSION['glpiactiveprofile']) && $_SESSION['glpiactiveprofile']['interface'] == 'helpdesk') {
            // Add specific CSS
            $PLUGIN_HOOKS['add_css']['formcreator'][] = "css/styles.css";
            $PLUGIN_HOOKS['add_css']['formcreator'][] = 'lib/pqselect/pqselect.min.css';
            $PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'lib/pqselect/pqselect.min.js';
            // Add specific JavaScript
            $PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'scripts/forms-validation.js.php';
            $PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'scripts/scripts.js.php';
        }
        // Add a link in the main menu plugins for technician and admin panel
        $PLUGIN_HOOKS['menu_entry']['formcreator'] = 'front/formlist.php';
        // Config page
        $plugin = new Plugin();
        $links = array();
        if (Session::haveRight('entity', UPDATE)) {
            $PLUGIN_HOOKS['config_page']['formcreator'] = 'front/form.php';
            $PLUGIN_HOOKS['menu_toadd']['formcreator']['admin'] = 'PluginFormcreatorForm';
            $links['config'] = '/plugins/formcreator/front/form.php';
            $links['add'] = '/plugins/formcreator/front/form.form.php';
        }
        $img = '<img  src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/check.png"
                  title="' . __('Forms waiting for validation', 'formcreator') . '" alt="Waiting forms list" />';
        $links[$img] = '/plugins/formcreator/front/formanswer.php';
        // Set options for pages (title, links, buttons...)
        $links['search'] = '/plugins/formcreator/front/formlist.php';
        $PLUGIN_HOOKS['submenu_entry']['formcreator']['options'] = array('config' => array('title' => __('Setup'), 'page' => '/plugins/formcreator/front/form.php', 'links' => $links), 'options' => array('title' => _n('Form', 'Forms', 2, 'formcreator'), 'links' => $links));
        // Load field class and all its method to manage fields
        Plugin::registerClass('PluginFormcreatorFields');
        // Notification
        Plugin::registerClass('PluginFormcreatorFormanswer', array('notificationtemplates_types' => true));
        if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE && isset($_SESSION['glpimenu'])) {
            unset($_SESSION['glpimenu']);
        }
    }
}
开发者ID:jcr0ch4,项目名称:formcreator,代码行数:57,代码来源:setup.php


示例16: updateNetworkEquipment

 /**
  * Function to update NetworkEquipment
  *
  * @param array $a_inventory data fron agent inventory
  * @param id $items_id id of the networkequipment
  *
  * @return nothing
  */
 function updateNetworkEquipment($a_inventory, $items_id)
 {
     global $DB;
     $networkEquipment = new NetworkEquipment();
     $pfNetworkEquipment = new PluginFusioninventoryNetworkEquipment();
     $networkEquipment->getFromDB($items_id);
     if (!isset($_SESSION['glpiactiveentities_string'])) {
         $_SESSION['glpiactiveentities_string'] = $networkEquipment->fields['entities_id'];
     }
     if (!isset($_SESSION['glpiactiveentities'])) {
         $_SESSION['glpiactiveentities'] = array($networkEquipment->fields['entities_id']);
     }
     if (!isset($_SESSION['glpiactive_entity'])) {
         $_SESSION['glpiactive_entity'] = $networkEquipment->fields['entities_id'];
     }
     // * NetworkEquipment
     $db_networkequipment = $networkEquipment->fields;
     $a_lockable = PluginFusioninventoryLock::getLockFields('glpi_networkequipments', $items_id);
     $a_ret = PluginFusioninventoryToolbox::checkLock($a_inventory['NetworkEquipment'], $db_networkequipment, $a_lockable);
     $a_inventory['NetworkEquipment'] = $a_ret[0];
     $mac = $a_inventory['NetworkEquipment']['mac'];
     unset($a_inventory['NetworkEquipment']['mac']);
     $input = $a_inventory['NetworkEquipment'];
     $input['id'] = $items_id;
     $networkEquipment->update($input);
     $this->internalPorts($a_inventory['internalport'], $items_id, $mac, 'Internal');
     // * NetworkEquipment fusion (ext)
     $db_networkequipment = array();
     $query = "SELECT *\n            FROM `" . getTableForItemType("PluginFusioninventoryNetworkEquipment") . "`\n            WHERE `networkequipments_id` = '{$items_id}'";
     $result = $DB->query($query);
     while ($data = $DB->fetch_assoc($result)) {
         foreach ($data as $key => $value) {
             $db_networkequipment[$key] = Toolbox::addslashes_deep($value);
         }
     }
     if (count($db_networkequipment) == '0') {
         // Add
         $a_inventory['PluginFusioninventoryNetworkEquipment']['networkequipments_id'] = $items_id;
         $pfNetworkEquipment->add($a_inventory['PluginFusioninventoryNetworkEquipment']);
     } else {
         // Update
         $idtmp = $db_networkequipment['id'];
         unset($db_networkequipment['id']);
         unset($db_networkequipment['networkequipments_id']);
         unset($db_networkequipment['plugin_fusioninventory_configsecurities_id']);
         $a_ret = PluginFusioninventoryToolbox::checkLock($a_inventory['PluginFusioninventoryNetworkEquipment'], $db_networkequipment);
         $a_inventory['PluginFusioninventoryNetworkEquipment'] = $a_ret[0];
         $input = $a_inventory['PluginFusioninventoryNetworkEquipment'];
         $input['id'] = $idtmp;
         $pfNetworkEquipment->update($input);
     }
     // * Ports
     $this->importPorts($a_inventory, $items_id);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:62,代码来源:inventorynetworkequipmentlib.class.php


示例17: uninstall

 static function uninstall()
 {
     global $DB;
     $displayPreference = new DisplayPreference();
     $displayPreference->deleteByCriteria(array('itemtype' => __CLASS__));
     // Remove dropdowns localization
     $dropdownTranslation = new DropdownTranslation();
     $dropdownTranslation->deleteByCriteria(array("itemtype = 'PluginSimcardSimcardSize'"), 1);
     $table = getTableForItemType(__CLASS__);
     $DB->query("DROP TABLE IF EXISTS `{$table}`");
 }
开发者ID:NandyJoshu,项目名称:simcard,代码行数:11,代码来源:simcardsize.class.php


示例18: pdfDevice

 static function pdfDevice(PluginPdfSimplePDF $pdf, Computer $computer)
 {
     global $DB;
     $devtypes = Item_Devices::getDeviceTypes();
     $ID = $computer->getField('id');
     if (!$computer->can($ID, 'r')) {
         return false;
     }
     $pdf->setColumnsSize(100);
     $pdf->displayTitle('<b>' . Toolbox::ucfirst(_n('Component', 'Components', 2)) . '</b>');
     $pdf->setColumnsSize(3, 14, 42, 41);
     foreach ($devtypes as $itemtype) {
         $devicetypes = new $itemtype();
         $specificities = $devicetypes->getSpecificities();
         $specif_fields = array_keys($specificities);
         $specif_text = implode(',', $specif_fields);
         if (!empty($specif_text)) {
             $specif_text = " ," . $specif_text . " ";
         }
         $associated_type = str_replace('Item_', '', $itemtype);
         $linktable = getTableForItemType($itemtype);
         $fk = getForeignKeyFieldForTable(getTableForItemType($associated_type));
         $query = "SELECT count(*) AS NB, `id`, `" . $fk . "`" . $specif_text . "\n                   FROM `" . $linktable . "`\n                   WHERE `items_id` = '" . $ID . "'\n                   AND `itemtype` = 'Computer'\n                   GROUP BY `" . $fk . "`" . $specif_text;
         $device = new $associated_type();
         foreach ($DB->request($query) as $data) {
             if ($device->getFromDB($data[$fk])) {
                 $spec = $device->getAdditionalFields();
                 $col4 = '';
                 if (count($spec)) {
                     $colspan = 60 / count($spec);
                     foreach ($spec as $i => $label) {
                         if (isset($device->fields[$label["name"]]) && !empty($device->fields[$label["name"]])) {
                             if ($label["type"] == "dropdownValue" && $device->fields[$label["name"]] != 0) {
                                 $table = getTableNameForForeignKeyField($label["name"]);
                                 $value = Dropdown::getDropdownName($table, $device->fields[$label["name"]]);
                                 $col4 .= '<b><i>' . sprintf(__('%1$s: %2$s'), $label["label"] . '</i></b>', Html::clean($value) . " ");
                             } else {
                                 $value = $device->fields[$label["name"]];
                                 $col4 .= '<b><i>' . sprintf(__('%1$s: %2$s'), $label["label"] . '</i></b>', $value . " ");
                             }
                         } else {
                             if (isset($device->fields[$label["name"] . "_default"]) && !empty($device->fields[$label["name"] . "_default"])) {
                                 $col4 .= '<b><i>' . sprintf(__('%1$s: %2$s'), $label["label"] . '</i></b>', $device->fields[$label["name"] . "_default"] . " ");
                             }
                         }
                     }
                 }
                 $pdf->displayLine($data['NB'], $device->getTypeName(), $device->getName(), $col4);
             }
         }
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:53,代码来源:computer.class.php


示例19: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->getType() == 'Computer') {
         if (Session::haveRight('computer', READ)) {
             $a_nb = countElementsInTable(getTableForItemType("PluginFusioninventoryInventoryComputerStorage"), "`computers_id`='" . $item->getID() . "'");
             if (count($a_nb) > 0) {
                 //               return self::createTabEntry(__('Storage', 'fusioninventory'));
             }
         }
     }
     return '';
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:12,代码来源:inventorycomputerstorage.class.php


示例20: uninstall

 static function uninstall()
 {
     global $DB;
     foreach (array('DisplayPreference', 'Bookmark') as $itemtype) {
         $item = new $itemtype();
         $item->deleteByCriteria(array('itemtype' => __CLASS__));
     }
     // Remove dropdowns localization
     $dropdownTranslation = new DropdownTranslation();
     $dropdownTranslation->deleteByCriteria(array("itemtype = 'PluginSimcardSimcardType'"), 1);
     $table = getTableForItemType(__CLASS__);
     $DB->query("DROP TABLE IF EXISTS `{$table}`");
 }
开发者ID:picaro04,项目名称:simcard,代码行数:13,代码来源:simcardtype.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getTableForItemtype函数代码示例发布时间:2022-05-15
下一篇:
PHP getTable函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap