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


PHP self::getTable方法代码示例

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


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

示例1: uninstall

 static function uninstall()
 {
     global $DB;
     $obj = new self();
     $DB->query("DROP TABLE IF EXISTS `" . $obj->getTable() . "`");
     return true;
 }
开发者ID:publik1974,项目名称:fields,代码行数:7,代码来源:field.class.php

示例2: cloneProfile

 /**
  * if profile cloned
  *
  * @param $prof   Profile  object
  **/
 static function cloneProfile(Profile $prof)
 {
     global $DB;
     $plugprof = new self();
     $crit = array('profiles_id' => $prof->input['_old_id']);
     foreach ($DB->request($plugprof->getTable(), $crit) as $data) {
         $input = ToolBox::addslashes_deep($data);
         unset($input['id']);
         $input['profiles_id'] = $prof->getID();
         $plugprof->add($input);
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:17,代码来源:profile.class.php

示例3: addHost

 /**
  * If host not exist add it 
  * 
  * 
  */
 static function addHost($item)
 {
     global $DB;
     $pmHost = new self();
     $query = "SELECT * FROM `" . $pmHost->getTable() . "`\n         WHERE `itemtype`='" . $item->fields['itemtype'] . "'\n           AND `items_id`='" . $item->fields['items_id'] . "'\n         LIMIT 1";
     $result = $DB->query($query);
     if ($DB->numrows($result) == '0') {
         $input = array();
         $input['itemtype'] = $item->fields['itemtype'];
         $input['items_id'] = $item->fields['items_id'];
         $pmHost->add($input);
     }
 }
开发者ID:RubichonL,项目名称:glpi_monitoring,代码行数:18,代码来源:host.class.php

示例4: transfer

 static function transfer($ID, $entity)
 {
     global $DB;
     $temp = new self();
     if ($ID <= 0 || !$temp->getFromDB($ID)) {
         return 0;
     }
     $query = "SELECT `id`\n                FROM `" . $temp->getTable() . "`\n                WHERE `entities_id` = '" . $entity . "'\n                      AND `name` = '" . addslashes($temp->fields['name']) . "'";
     foreach ($DB->request($query) as $data) {
         return $data['id'];
     }
     $input = $temp->fields;
     $input['entities_id'] = $entity;
     unset($input['id']);
     return $temp->add($input);
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:16,代码来源:appliancetype.class.php

示例5: uninstall

 static function uninstall()
 {
     global $DB;
     //uninstall container table and class
     $obj = new self();
     $containers = $obj->find();
     foreach ($containers as $containers_id => $container) {
         $obj->delete(array('id' => $containers_id));
     }
     //drop global container table
     $obj = new self();
     $DB->query("DROP TABLE IF EXISTS `" . $obj->getTable() . "`");
     //delete display preferences for this item
     $DB->query("DELETE FROM glpi_displaypreferences WHERE `itemtype` = '" . __CLASS__ . "'");
     return true;
 }
开发者ID:publik1974,项目名称:fields,代码行数:16,代码来源:container.class.php

示例6: linkIPAddressFromIPNetwork

 /**
  * Update IPNetwork's dependency
  *
  * @param $network IPNetwork object
  **/
 static function linkIPAddressFromIPNetwork(IPNetwork $network)
 {
     global $DB;
     $linkObject = new self();
     $linkTable = $linkObject->getTable();
     $ipnetworks_id = $network->getID();
     // First, remove all links of the current Network
     $query = "SELECT `id`\n                FROM `{$linkTable}`\n                WHERE `ipnetworks_id` = '{$ipnetworks_id}'";
     foreach ($DB->request($query) as $link) {
         $linkObject->delete(array('id' => $link['id']));
     }
     // Then, look each IP address contained inside current Network
     $query = "SELECT '" . $ipnetworks_id . "' AS ipnetworks_id,\n                       `id` AS ipaddresses_id\n                FROM `glpi_ipaddresses`\n                WHERE " . $network->getWHEREForMatchingElement('glpi_ipaddresses', 'binary', 'version') . "\n                GROUP BY `id`";
     foreach ($DB->request($query) as $link) {
         $linkObject->add($link);
     }
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:22,代码来源:ipaddress_ipnetwork.class.php

示例7: transfer

 static function transfer($ID, $entity)
 {
     global $DB;
     $simcardSize = new self();
     if ($ID > 0) {
         // Not already transfer
         // Search init item
         $query = "SELECT *\n                   FROM `" . $simcardSize->getTable() . "`\n                   WHERE `id` = '{$ID}'";
         if ($result = $DB->query($query)) {
             if ($DB->numrows($result)) {
                 $data = $DB->fetch_assoc($result);
                 $data = Toolbox::addslashes_deep($data);
                 $input['name'] = $data['name'];
                 $input['entities_id'] = $entity;
                 $newID = $simcardSize->getID($input);
                 if ($newID < 0) {
                     $newID = $simcardSize->import($input);
                 }
                 return $newID;
             }
         }
     }
     return 0;
 }
开发者ID:NandyJoshu,项目名称:simcard,代码行数:24,代码来源:simcardsize.class.php

示例8: showForFQDN

 /**
  * Show the aliases contained by the alias
  *
  * @param $item                     the FQDN owning the aliases
  * @param $withtemplate  integer    withtemplate param
  **/
 static function showForFQDN(CommonGLPI $item, $withtemplate)
 {
     global $DB;
     $alias = new self();
     $address = new NetworkName();
     $item->check($item->getID(), 'r');
     $canedit = $item->can($item->getID(), 'w');
     if (isset($_POST["start"])) {
         $start = $_POST["start"];
     } else {
         $start = 0;
     }
     if (!empty($_POST["order"])) {
         $order = $_POST["order"];
     } else {
         $order = "alias";
     }
     $number = countElementsInTable($alias->getTable(), "`fqdns_id`='" . $item->getID() . "'");
     echo "<br><div class='center'>";
     if ($number < 1) {
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr><th>" . self::getTypeName(1) . "</th><th>" . __('No item found') . "</th></tr>";
         echo "</table>\n";
     } else {
         Html::printAjaxPager(self::getTypeName($number), $start, $number);
         echo "<table class='tab_cadre_fixe'><tr>";
         echo "<th><a href='javascript:reloadTab(\"order=alias\");'>" . self::getTypeName(1) . "</a></th>";
         // Alias
         echo "<th><a href='javascript:reloadTab(\"order=realname\");'>" . __("Computer's name") . "</a></th>";
         echo "<th>" . __('Comments') . "</th>";
         echo "</tr>\n";
         Session::initNavigateListItems($item->getType(), sprintf(__('%1$s = %2$s'), self::getTypeName(1), $item->fields['name']));
         $query = "SELECT `glpi_networkaliases`.`id` AS alias_id,\n                          `glpi_networkaliases`.`name` AS alias,\n                          `glpi_networknames`.`id` AS address_id,\n                          `glpi_networkaliases`.`comment` AS comment\n                   FROM `glpi_networkaliases`, `glpi_networknames`\n                   WHERE `glpi_networkaliases`.`fqdns_id` = '" . $item->getID() . "'\n                         AND  `glpi_networknames`.`id` = `glpi_networkaliases`.`networknames_id`\n                   ORDER BY `{$order}`\n                   LIMIT " . $_SESSION['glpilist_limit'] . "\n                   OFFSET {$start}";
         foreach ($DB->request($query) as $data) {
             Session::addToNavigateListItems($alias->getType(), $data["alias_id"]);
             if ($address->getFromDB($data["address_id"])) {
                 echo "<tr class='tab_bg_1'>";
                 echo "<td><a href='" . $alias->getFormURL() . '?id=' . $data['alias_id'] . "'>" . $data['alias'] . "</a></td>";
                 echo "<td><a href='" . $address->getLinkURL() . "'>" . $address->getInternetName() . "</a></td>";
                 echo "<td>" . $data['comment'] . "</td>";
                 echo "</tr>\n";
             }
         }
         echo "</table>\n";
         Html::printAjaxPager(self::getTypeName($number), $start, $number);
     }
     echo "</div>\n";
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:54,代码来源:networkalias.class.php

示例9: uninstall

 /**
  * Database table uninstallation for the item type
  *
  * @return boolean True on success
  */
 public static function uninstall()
 {
     $obj = new self();
     $GLOBALS['DB']->query('DROP TABLE IF EXISTS `' . $obj->getTable() . '`');
     // Delete logs of the plugin
     $GLOBALS['DB']->query('DELETE FROM `glpi_logs` WHERE itemtype = "' . __CLASS__ . '"');
     return true;
 }
开发者ID:jcr0ch4,项目名称:formcreator,代码行数:13,代码来源:formanswer.class.php

示例10: showFormForNetworkPort

 /**
  * @param $networkPortID
  **/
 static function showFormForNetworkPort($networkPortID)
 {
     global $DB, $CFG_GLPI;
     $name = new self();
     $number_names = 0;
     if ($networkPortID > 0) {
         $query = "SELECT `id`\n                   FROM `" . $name->getTable() . "`\n                   WHERE `itemtype` = 'NetworkPort'\n                   AND `items_id` = '{$networkPortID}'\n                   AND `is_deleted` = '0'";
         $result = $DB->query($query);
         if ($DB->numrows($result) > 1) {
             echo "<tr class='tab_bg_1'><th colspan='4'>" . __("Several network names available! Go to the tab 'Network Name' to manage them.") . "</th></tr>\n";
             return;
         }
         switch ($DB->numrows($result)) {
             case 1:
                 $nameID = $DB->fetch_assoc($result);
                 $name->getFromDB($nameID['id']);
                 break;
             case 0:
                 $name->getEmpty();
                 break;
         }
     } else {
         $name->getEmpty();
     }
     echo "<tr class='tab_bg_1'><th colspan='4'>";
     // If the networkname is defined, we must be able to edit it. So we make a link
     if ($name->getID() > 0) {
         echo "<a href='" . $name->getLinkURL() . "'>" . self::getTypeName(1) . "</a>";
         echo "<input type='hidden' name='NetworkName_id' value='" . $name->getID() . "'>&nbsp;\n";
         Html::showSimpleForm($name->getFormURL(), 'unaffect', _sx('button', 'Dissociate'), array('id' => $name->getID()), $CFG_GLPI["root_doc"] . '/pics/sub_dropdown.png');
     } else {
         echo self::getTypeName(1);
     }
     echo "</th>\n";
     echo "</tr><tr class='tab_bg_1'>";
     echo "<td>" . self::getTypeName(1) . "</td><td>\n";
     Html::autocompletionTextField($name, "name", array('name' => 'NetworkName_name'));
     echo "</td>\n";
     echo "<td>" . FQDN::getTypeName(1) . "</td><td>";
     Dropdown::show(getItemTypeForTable(getTableNameForForeignKeyField("fqdns_id")), array('value' => $name->fields["fqdns_id"], 'name' => 'NetworkName_fqdns_id', 'entity' => $name->getEntityID(), 'displaywith' => array('view')));
     echo "</td>\n";
     echo "</tr><tr class='tab_bg_1'>\n";
     echo "<td>" . IPAddress::getTypeName(Session::getPluralNumber());
     IPAddress::showAddChildButtonForItemForm($name, 'NetworkName__ipaddresses');
     echo "</td>";
     echo "<td>";
     IPAddress::showChildsForItemForm($name, 'NetworkName__ipaddresses');
     echo "</td>";
     // MoYo : really need to display it here ?
     // make confure because not updatable
     //       echo "<td>".IPNetwork::getTypeName(Session::getPluralNumber())."&nbsp;";
     //       Html::showToolTip(__('IP network is not included in the database. However, you can see current available networks.'));
     //       echo "</td><td>";
     //       IPNetwork::showIPNetworkProperties($name->getEntityID());
     //       echo "</td>\n";
     echo "<td colspan='2'>&nbsp;</td>";
     echo "</tr>\n";
 }
开发者ID:kipman,项目名称:glpi,代码行数:61,代码来源:networkname.class.php

示例11: showMinimalList

 static function showMinimalList($params = array())
 {
     global $DB, $CFG_GLPI;
     $item = new self();
     $itemtype = $item->getType();
     $itemtable = $item->getTable();
     // Default values of parameters
     $p['link'] = array();
     //
     $p['field'] = array();
     //
     $p['contains'] = array();
     //
     $p['searchtype'] = array();
     //
     $p['sort'] = '1';
     //
     $p['order'] = 'ASC';
     //
     $p['start'] = 0;
     //
     $p['is_deleted'] = 0;
     $p['id'] = 0;
     $p['export_all'] = 0;
     $p['link2'] = '';
     //
     $p['contains2'] = '';
     //
     $p['field2'] = '';
     //
     $p['itemtype2'] = '';
     $p['searchtype2'] = '';
     $p['withtemplate'] = 0;
     foreach ($params as $key => $val) {
         $p[$key] = $val;
     }
     $PluginResourcesResource = new PluginResourcesResource();
     $PluginResourcesResource->getFromDB($p['id']);
     $canedit = $PluginResourcesResource->can($p['id'], 'w');
     if (isset($_POST["start"])) {
         $p['start'] = $_POST["start"];
     } else {
         $p['start'] = 0;
     }
     if (isset($_POST["sort"])) {
         $p['sort'] = $_POST["sort"];
     } else {
         $p['sort'] = 1;
     }
     if (isset($_POST["order"]) && $_POST["order"] == "DESC") {
         $p['order'] = "DESC";
     } else {
         $p['order'] = "ASC";
     }
     // Manage defautll seachtype value : for bookmark compatibility
     if (count($p['contains'])) {
         foreach ($p['contains'] as $key => $val) {
             if (!isset($p['searchtype'][$key])) {
                 $p['searchtype'][$key] = 'contains';
             }
         }
     }
     if (is_array($p['contains2']) && count($p['contains2'])) {
         foreach ($p['contains2'] as $key => $val) {
             if (!isset($p['searchtype2'][$key])) {
                 $p['searchtype2'][$key] = 'contains';
             }
         }
     }
     $target = Toolbox::getItemTypeSearchURL($itemtype);
     $limitsearchopt = Search::getCleanedOptions($itemtype);
     $LIST_LIMIT = $_SESSION['glpilist_limit'];
     // Set display type for export if define
     $output_type = Search::HTML_OUTPUT;
     if (isset($_GET['display_type'])) {
         $output_type = $_GET['display_type'];
         // Limit to 10 element
         if ($_GET['display_type'] == Search::GLOBAL_SEARCH) {
             $LIST_LIMIT = Search::GLOBAL_DISPLAY_COUNT;
         }
     }
     $entity_restrict = $item->isEntityAssign();
     // Get the items to display
     $toview = Search::addDefaultToView($itemtype);
     // Add items to display depending of personal prefs
     $displaypref = DisplayPreference::getForTypeUser($itemtype, Session::getLoginUserID());
     if (count($displaypref)) {
         foreach ($displaypref as $val) {
             array_push($toview, $val);
         }
     }
     // Add searched items
     if (count($p['field']) > 0) {
         foreach ($p['field'] as $key => $val) {
             if (!in_array($val, $toview) && $val != 'all' && $val != 'view') {
                 array_push($toview, $val);
             }
         }
     }
     // Add order item
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:task.class.php

示例12: launch

 /**
  * Launch the need cron tasks
  *
  * @param $mode   (internal/external, <0 to force)
  * @param $max    number of task to launch (default 1)
  * @param $name   of task to run (default '')
  *
  * @return the name of last task launched
  **/
 public static function launch($mode, $max = 1, $name = '')
 {
     global $CFG_GLPI;
     // No cron in maintenance mode
     if (isset($CFG_GLPI['maintenance_mode']) && $CFG_GLPI['maintenance_mode']) {
         return false;
     }
     $crontask = new self();
     $taskname = '';
     if (abs($mode) == self::MODE_EXTERNAL) {
         // If cron is launched in command line, and if memory is insufficient,
         // display a warning in the logs
         if (Toolbox::checkMemoryLimit() == 2) {
             Toolbox::logInFile('cron', __('A minimum of 64 Mio is commonly required for GLPI.') . "\n");
         }
         // If no task in CLI mode, call cron.php from command line is not really usefull ;)
         if (!countElementsInTable($crontask->getTable(), ['mode' => abs($mode)])) {
             Toolbox::logInFile('cron', __('No task with Run mode = CLI, fix your tasks configuration') . "\n");
         }
     }
     if (self::get_lock()) {
         for ($i = 1; $i <= $max; $i++) {
             $prefix = abs($mode) == self::MODE_EXTERNAL ? __('External') : __('Internal');
             if ($crontask->getNeedToRun($mode, $name)) {
                 $_SESSION["glpicronuserrunning"] = "cron_" . $crontask->fields['name'];
                 if ($plug = isPluginItemType($crontask->fields['itemtype'])) {
                     Plugin::load($plug['plugin'], true);
                 }
                 $fonction = array($crontask->fields['itemtype'], 'cron' . $crontask->fields['name']);
                 if (is_callable($fonction)) {
                     if ($crontask->start()) {
                         // Lock in DB + log start
                         $taskname = $crontask->fields['name'];
                         //TRANS: %1$s is mode (external or internal), %2$s is an order number,
                         $msgcron = sprintf(__('%1$s #%2$s'), $prefix, $i);
                         $msgcron = sprintf(__('%1$s: %2$s'), $msgcron, sprintf(__('%1$s %2$s') . "\n", __('Launch'), $crontask->fields['name']));
                         Toolbox::logInFile('cron', $msgcron);
                         $retcode = call_user_func($fonction, $crontask);
                         $crontask->end($retcode);
                         // Unlock in DB + log end
                     } else {
                         $msgcron = sprintf(__('%1$s #%2$s'), $prefix, $i);
                         $msgcron = sprintf(__('%1$s: %2$s'), $msgcron, sprintf(__('%1$s %2$s') . "\n", __("Can't start"), $crontask->fields['name']));
                         Toolbox::logInFile('cron', $msgcron);
                     }
                 } else {
                     if (is_array($fonction)) {
                         $fonction = implode('::', $fonction);
                     }
                     Toolbox::logInFile('php-errors', sprintf(__('Undefined function %s (for cron)') . "\n", $fonction));
                     $msgcron = sprintf(__('%1$s #%2$s'), $prefix, $i);
                     $msgcron = sprintf(__('%1$s: %2$s'), $msgcron, sprintf(__('%1$s %2$s') . "\n", __("Can't start"), $crontask->fields['name']));
                     Toolbox::logInFile('cron', $msgcron . "\n" . sprintf(__('Undefined function %s (for cron)') . "\n", $fonction));
                 }
             } else {
                 if ($i == 1) {
                     $msgcron = sprintf(__('%1$s #%2$s'), $prefix, $i);
                     $msgcron = sprintf(__('%1$s: %2$s'), $msgcron, __('Nothing to launch'));
                     Toolbox::logInFile('cron', $msgcron . "\n");
                 }
             }
         }
         // end for
         $_SESSION["glpicronuserrunning"] = '';
         self::release_lock();
     } else {
         Toolbox::logInFile('cron', __("Can't get DB lock") . "\n");
     }
     return $taskname;
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:79,代码来源:crontask.class.php

示例13: addHost

   /**
    * If host does not exist add it
    *
    */
   static function addHost($item) {
      global $DB;

      $pmHost = new self();

      $query = "SELECT * FROM `".$pmHost->getTable()."`
         WHERE `itemtype`='".$item->fields['itemtype']."'
           AND `items_id`='".$item->fields['items_id']."'
         LIMIT 1";
      $result = $DB->query($query);
      if ($DB->numrows($result) == '0') {
         $input = array();
         $input['itemtype'] = $item->fields['itemtype'];
         $input['items_id'] = $item->fields['items_id'];
         $item2 = new $item->fields['itemtype'];
         $item2->getFromDB($item->fields['items_id']);
         // Try to fix entities_id = 0
         $input['entities_id'] = $item2->fields['entities_id'];
         $pmHost->add($input);
      }
   }
开发者ID:euqip,项目名称:glpi-smartcities,代码行数:25,代码来源:host.class.php

示例14: isThisItemCheckRuleNetworkport

 static function isThisItemCheckRuleNetworkport($parm)
 {
     global $DB;
     $pmComponentscatalog_rule = new self();
     $pmService = new PluginMonitoringService();
     $pmSearch = new PluginMonitoringSearch();
     $a_networkports_id = array();
     if (get_class($parm) == 'PluginMonitoringNetworkport') {
         $a_networkports_id[$parm->fields['networkports_id']] = $parm->fields['items_id'];
     } else {
         if (get_class($parm) == 'NetworkEquipment') {
             $query = "SELECT * FROM `glpi_plugin_monitoring_networkports`\n            WHERE `items_id`='" . $parm->fields['id'] . "'";
             $result = $DB->query($query);
             while ($data = $DB->fetch_array($result)) {
                 $a_networkports_id[$data['networkports_id']] = $parm->fields['id'];
             }
         }
     }
     foreach ($a_networkports_id as $networkports_id => $networkequipments_id) {
         $a_find = array();
         $query = "SELECT * FROM `" . $pmComponentscatalog_rule->getTable() . "`\n            WHERE `itemtype`='PluginMonitoringNetworkport'";
         $result = $DB->query($query);
         $get_tmp = array();
         if (isset($_GET)) {
             $get_tmp = $_GET;
         }
         while ($data = $DB->fetch_array($result)) {
             if (isset($_SESSION["glpisearchcount"][$data['itemtype']])) {
                 unset($_SESSION["glpisearchcount"][$data['itemtype']]);
             }
             if (isset($_SESSION["glpisearchcount2"][$data['itemtype']])) {
                 unset($_SESSION["glpisearchcount2"][$data['itemtype']]);
             }
             $_GET = importArrayFromDB($data['condition']);
             $_GET["glpisearchcount"] = count($_GET['field']);
             if (isset($_GET['field2'])) {
                 $_GET["glpisearchcount2"] = count($_GET['field2']);
             }
             if (!isset($_SESSION['glpiactiveentities_string'])) {
                 $_SESSION['glpiactiveentities_string'] = $parm->fields['entities_id'];
             }
             Search::manageGetValues($data['itemtype']);
             $resultr = $pmSearch->constructSQL("PluginMonitoringNetworkport", $_GET, $networkports_id);
             if ($DB->numrows($resultr) > 0) {
                 $a_find[$data['plugin_monitoring_componentscalalog_id']][$networkports_id] = 1;
             } else {
                 if (!isset($a_find[$data['plugin_monitoring_componentscalalog_id']][$networkports_id])) {
                     $a_find[$data['plugin_monitoring_componentscalalog_id']][$networkports_id] = 0;
                 }
             }
         }
         if (count($get_tmp) > 0) {
             $_GET = $get_tmp;
         }
         $pmComponentscatalog_Host = new PluginMonitoringComponentscatalog_Host();
         foreach ($a_find as $componentscalalog_id => $datan) {
             foreach ($datan as $networkports_id => $is_present) {
                 // Get all networports in this rule
                 if ($is_present == '0') {
                     // * Remove from dynamic if present
                     $query = "SELECT `glpi_plugin_monitoring_services`.`id`,\n                        `glpi_plugin_monitoring_componentscatalogs_hosts`.`id` as hid\n                        FROM `glpi_plugin_monitoring_services`\n                     LEFT JOIN `glpi_plugin_monitoring_componentscatalogs_hosts` ON\n                        `plugin_monitoring_componentscatalogs_hosts_id` = `glpi_plugin_monitoring_componentscatalogs_hosts`.`id`\n                     WHERE `plugin_monitoring_componentscalalog_id`='" . $componentscalalog_id . "'\n                        AND `itemtype`='NetworkEquipment'\n                        AND `items_id`='" . $networkequipments_id . "'\n                        AND `is_static`='0'\n                        AND `networkports_id`='" . $networkports_id . "'";
                     $result = $DB->query($query);
                     while ($data = $DB->fetch_array($result)) {
                         $pmComponentscatalog_Host->getFromDB($data['hid']);
                         $_SESSION['plugin_monitoring_hosts'] = $pmComponentscatalog_Host->fields;
                         $pmService->delete(array('id' => $data['id']));
                     }
                 } else {
                     //  add if not present
                     // * Add componentscatalogs_hosts if not exist
                     $componentscatalogs_hosts_id = 0;
                     $query = "SELECT * FROM `glpi_plugin_monitoring_componentscatalogs_hosts`\n                     WHERE `plugin_monitoring_componentscalalog_id`='" . $componentscalalog_id . "'\n                        AND `itemtype`='NetworkEquipment'\n                        AND `items_id`='" . $networkequipments_id . "'\n                           LIMIT 1";
                     $result = $DB->query($query);
                     if ($DB->numrows($result) == '0') {
                         $input = array();
                         $input['plugin_monitoring_componentscalalog_id'] = $componentscalalog_id;
                         $input['is_static'] = '0';
                         $input['itemtype'] = "NetworkEquipment";
                         $input['items_id'] = $networkequipments_id;
                         $componentscatalogs_hosts_id = $pmComponentscatalog_Host->add($input);
                     } else {
                         $a_componentscatalogs_hosts = $DB->fetch_assoc($result);
                         $componentscatalogs_hosts_id = $a_componentscatalogs_hosts['id'];
                     }
                     // * Add service if not exist
                     $pmComponentscatalog_Host->linkComponentsToItem($componentscalalog_id, $componentscatalogs_hosts_id, $networkports_id);
                 }
             }
         }
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:91,代码来源:componentscatalog_rule.class.php

示例15: selectGroupOnAdd

 static function selectGroupOnAdd($item)
 {
     global $CFG_GLPI, $DB;
     if (isset($item->input['_auto_import']) || isset($item->input['bypassgrouponadd'])) {
         return;
     }
     $peGroup_group = new self();
     if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
         $peConfig = new PluginEscalationConfig();
         if ($peConfig->getValue('workflow', $item->fields['entities_id']) == '1') {
             if (isset($_POST['_groups_id_assign']) && $_POST['_groups_id_assign'] > 0) {
                 if (isset($_SESSION['plugin_escalation_files'])) {
                     $_FILES = $_SESSION['plugin_escalation_files'];
                 }
                 return;
             } else {
                 $group = new Group();
                 Html::header(__('Administration'), '', "maintain", "ticket");
                 if (isset($_POST['dropdown__groups_id_requester']) && $_POST['dropdown__groups_id_requester'] > 0) {
                     $_SESSION['plugin_escalation_groups_id_requester'] = $_POST['dropdown__groups_id_requester'];
                 }
                 if (isset($_FILES)) {
                     foreach ($_FILES['filename']['tmp_name'] as $numfile => $datafile) {
                         if ($datafile != '') {
                             $split = explode("/", $datafile);
                             Document::renameForce($datafile, GLPI_DOC_DIR . "/_tmp/" . end($split));
                             $_FILES['filename']['tmp_name'][$numfile] = GLPI_DOC_DIR . "/_tmp/" . end($split);
                         }
                     }
                     $_SESSION['plugin_escalation_files'] = $_FILES;
                 }
                 echo '<form action="' . $CFG_GLPI['root_doc'] . '/front/ticket.form.php"
               enctype="multipart/form-data" name="form_ticket" method="post">';
                 echo "<table class='tab_cadre_fixe'>";
                 echo "<tr class='tab_bg_1'>";
                 echo "<th colspan='2'>Sélection du groupe de techniciens</th>";
                 echo "</tr>";
                 echo "<tr class='tab_bg_1'>";
                 echo "<td>";
                 echo __('Group in charge of the ticket') . "&nbsp;:";
                 echo "</td>";
                 echo "<td>";
                 $a_groups = array();
                 foreach ($_SESSION['glpigroups'] as $groups_id) {
                     $group->getFromDB($groups_id);
                     $a_groups[$groups_id] = $group->getName();
                     $queryg = "SELECT * FROM `" . $peGroup_group->getTable() . "`\n                     WHERE `groups_id_source` = '" . $groups_id . "' ";
                     $resultg = $DB->query($queryg);
                     while ($datag = $DB->fetch_array($resultg)) {
                         $group->getFromDB($datag['groups_id_destination']);
                         $a_groups[$groups_id . "_" . $datag['groups_id_destination']] = "&nbsp;&nbsp;&nbsp;> " . $group->getName();
                     }
                 }
                 $rand = Dropdown::showFromArray("_groups_id_assign_escalation", $a_groups);
                 $params = array('groups_id' => '__VALUE__', 'entity' => $_POST['entities_id'], 'rand' => $rand);
                 Ajax::updateItemOnSelectEvent("dropdown__groups_id_assign" . $rand, "show_assignuser{$rand}", $CFG_GLPI["root_doc"] . "/plugins/escalation/ajax/dropdownUserassign.php", $params);
                 echo "</tr>";
                 echo "<tr class='tab_bg_1'>";
                 echo "<td colspan='2'>";
                 foreach ($_POST as $key => $value) {
                     if (is_array($value)) {
                         foreach ($value as $keyy => $valuee) {
                             echo '<input type="hidden" name="' . $key . '[' . $keyy . ']" value="' . $valuee . '" />';
                         }
                     } else {
                         if ($key == 'content') {
                             $value = Html::cleanPostForTextArea(Toolbox::clean_cross_side_scripting_deep($value));
                             echo '<textarea name="' . $key . '" style="display:none;">' . $value . '</textarea>';
                         } else {
                             if ($key == 'dropdown__groups_id_requester') {
                                 echo '<input type="hidden" name="_groups_id_requester" value="' . $value . '" />';
                             } else {
                                 $value = Html::cleanInputText(Toolbox::clean_cross_side_scripting_deep(stripslashes($value)));
                                 echo '<input type="hidden" name="' . $key . '" value="' . $value . '" />';
                             }
                         }
                     }
                 }
                 if (!isset($_POST['_users_id_assign']) or $_POST['_users_id_assign'] == '0') {
                     echo "<span id='show_assignuser{$rand}'></span>";
                 }
                 echo "</td>";
                 echo "</tr>";
                 echo "<tr class='tab_bg_1'>";
                 echo "<td colspan='2' align='center'>";
                 echo "<input type='submit' name='add' value=\"" . __('Add') . "\" class='submit'>";
                 echo "</td>";
                 echo "</tr>";
                 echo "</table>";
                 Html::closeForm();
                 Html::footer();
                 exit;
             }
         }
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:96,代码来源:group_group.class.php


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