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


PHP getAllDatasFromTable函数代码示例

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


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

示例1: getList

 static function getList($agents_id = NULL)
 {
     global $PF_CONFIG;
     if (is_null($agents_id)) {
         return array();
     }
     $pfAgent = new PluginFusioninventoryAgent();
     $pfAgent->getFromDB($agents_id);
     $agent = $pfAgent->fields;
     $results = getAllDatasFromTable('glpi_plugin_fusioninventory_deploymirrors');
     if (!isset($agent) || !isset($agent['computers_id'])) {
         return array();
     }
     $computer = new Computer();
     $computer->getFromDB($agent['computers_id']);
     $mirrors = array();
     foreach ($results as $result) {
         if ($computer->fields['locations_id'] == $result['locations_id']) {
             $mirrors[] = $result['url'];
         }
     }
     //add default mirror (this server) if enabled in config
     $entities_id = 0;
     if (isset($agent['entities_id'])) {
         $entities_id = $agent['entities_id'];
     }
     if (isset($PF_CONFIG['server_as_mirror']) && (bool) $PF_CONFIG['server_as_mirror'] == TRUE) {
         $mirrors[] = PluginFusioninventoryAgentmodule::getUrlForModule('DEPLOY', $entities_id) . "?action=getFilePart&file=";
     }
     return $mirrors;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:31,代码来源:deploymirror.class.php

示例2: raiseEvent

 /**
  * Raise a notification event event
  *
  * @param $event the event raised for the itemtype
  * @param $item the object which raised the event
  * @param $options array options used
  * @param $label used for debugEvent()
  **/
 static function raiseEvent($event, $item, $options = array(), $label = '')
 {
     global $CFG_GLPI;
     //If notifications are enabled in GLPI's configuration
     if ($CFG_GLPI["use_mailing"]) {
         $email_processed = array();
         $email_notprocessed = array();
         //Get template's informations
         $template = new NotificationTemplate();
         $notificationtarget = NotificationTarget::getInstance($item, $event, $options);
         $entity = $notificationtarget->getEntity();
         //Foreach notification
         foreach (Notification::getNotificationsByEventAndType($event, $item->getType(), $entity) as $data) {
             $targets = getAllDatasFromTable('glpi_notificationtargets', 'notifications_id = ' . $data['id']);
             $notificationtarget->clearAddressesList();
             //Process more infos (for example for tickets)
             $notificationtarget->addAdditionnalInfosForTarget();
             $template->getFromDB($data['notificationtemplates_id']);
             $template->resetComputedTemplates();
             //Set notification's signature (the one which corresponds to the entity)
             $template->setSignature(Notification::getMailingSignature($entity));
             //Foreach notification targets
             foreach ($targets as $target) {
                 //Get all users affected by this notification
                 $notificationtarget->getAddressesByTarget($target, $options);
                 foreach ($notificationtarget->getTargets() as $user_email => $users_infos) {
                     if ($label || $notificationtarget->validateSendTo($users_infos)) {
                         //If the user have not yet been notified
                         if (!isset($email_processed[$users_infos['language']][$users_infos['email']])) {
                             //If ther user's language is the same as the template's one
                             if (isset($email_notprocessed[$users_infos['language']][$users_infos['email']])) {
                                 unset($email_notprocessed[$users_infos['language']][$users_infos['email']]);
                             }
                             if ($template->getTemplateByLanguage($notificationtarget, $users_infos, $event, $options)) {
                                 //Send notification to the user
                                 if ($label == '') {
                                     Notification::send($template->getDataToSend($notificationtarget, $users_infos, $options));
                                 } else {
                                     $notificationtarget->getFromDB($target['id']);
                                     echo "<tr class='tab_bg_2'><td>" . $label . "</td>";
                                     echo "<td>" . $notificationtarget->getNameID() . "</td>";
                                     echo "<td>" . $template->getName() . " (" . $users_infos['language'] . ")</td>";
                                     echo "<td>" . $users_infos['email'] . "</td>";
                                     echo "</tr>";
                                 }
                                 $email_processed[$users_infos['language']][$users_infos['email']] = $users_infos;
                             } else {
                                 $email_notprocessed[$users_infos['language']][$users_infos['email']] = $users_infos;
                             }
                         }
                     }
                 }
             }
         }
     }
     unset($email_processed);
     unset($email_notprocessed);
     $template = null;
     return true;
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:68,代码来源:notificationevent.class.php

示例3: 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

示例4: 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

示例5: checkIfReportsExist

 static function checkIfReportsExist($ID)
 {
     $restrict = "`plugin_resources_resources_id` = '" . $ID . "'";
     $reports = getAllDatasFromTable("glpi_plugin_resources_reportconfigs", $restrict);
     if (!empty($reports)) {
         foreach ($reports as $report) {
             return $report["id"];
         }
     } else {
         return false;
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:12,代码来源:reportconfig.class.php

示例6: plugin_genericobject_getDropdown

function plugin_genericobject_getDropdown()
{
    $dropdowns = array();
    $plugin = new Plugin();
    if ($plugin->isActivated("genericobject")) {
        foreach (getAllDatasFromTable(getTableForItemType('PluginGenericobjectType'), "`is_active`='1'") as $itemtype) {
            foreach (PluginGenericobjectType::getDropdownForItemtype($itemtype['itemtype']) as $table) {
                $dropdown_itemtype = getItemTypeForTable($table);
                $dropdowns[$dropdown_itemtype] = $dropdown_itemtype::getTypeName();
            }
        }
    }
    return $dropdowns;
}
开发者ID:rambeau,项目名称:genericobject,代码行数:14,代码来源:hook.php

示例7: pdfForComputer

 static function pdfForComputer(PluginPdfSimplePDF $pdf, Computer $item)
 {
     global $DB;
     $ID = $item->getField('id');
     // From ComputerVirtualMachine::showForComputer()
     $virtualmachines = getAllDatasFromTable('glpi_computervirtualmachines', "`computers_id` = '{$ID}'");
     $pdf->setColumnsSize(100);
     if (count($virtualmachines)) {
         $pdf->displayTitle("<b>" . __('List of virtual machines') . "</b>");
         $pdf->setColumnsSize(20, 8, 8, 8, 25, 8, 8, 15);
         $pdf->setColumnsAlign('left', 'center', 'center', 'center', 'left', 'right', 'right', 'left');
         $typ = explode(' ', __('Virtualization system'));
         $sys = explode(' ', __('Virtualization model'));
         $sta = explode(' ', __('State of the virtual machine'));
         $pdf->displayTitle(__('Name'), $typ[0], $sys[0], $sta[0], __('UUID'), __('CPU'), __('Mio'), __('Machine'));
         foreach ($virtualmachines as $virtualmachine) {
             $name = '';
             if ($link_computer = ComputerVirtualMachine::findVirtualMachine($virtualmachine)) {
                 $computer = new Computer();
                 if ($computer->getFromDB($link_computer)) {
                     $name = $computer->getName();
                 }
             }
             $pdf->displayLine($virtualmachine['name'], Html::clean(Dropdown::getDropdownName('glpi_virtualmachinetypes', $virtualmachine['virtualmachinetypes_id'])), Html::clean(Dropdown::getDropdownName('glpi_virtualmachinesystems', $virtualmachine['virtualmachinesystems_id'])), Html::clean(Dropdown::getDropdownName('glpi_virtualmachinestates', $virtualmachine['virtualmachinestates_id'])), $virtualmachine['uuid'], $virtualmachine['vcpu'], Html::clean(Html::formatNumber($virtualmachine['ram'], false, 0)), $name);
         }
     } else {
         $pdf->displayTitle("<b>" . __('No virtual machine associated with the computer') . "</b>");
     }
     // From ComputerVirtualMachine::showForVirtualMachine()
     if ($item->fields['uuid']) {
         $where = "`uuid`" . ComputerVirtualMachine::getUUIDRestrictRequest($item->fields['uuid']);
         $hosts = getAllDatasFromTable('glpi_computervirtualmachines', $where);
         if (count($hosts)) {
             $pdf->setColumnsSize(100);
             $pdf->displayTitle("<b>" . __('List of host machines') . "</b>");
             $pdf->setColumnsSize(26, 37, 37);
             $pdf->displayTitle(__('Name'), __('Operating system'), __('Entity'));
             $computer = new Computer();
             foreach ($hosts as $host) {
                 if ($computer->getFromDB($host['computers_id'])) {
                     $pdf->displayLine($computer->getName(), Html::clean(Dropdown::getDropdownName('glpi_operatingsystems', $computer->getField('operatingsystems_id'))), Html::clean(Dropdown::getDropdownName('glpi_entities', $computer->getEntityID())));
                 }
             }
         }
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:47,代码来源:computervirtualmachine.class.php

示例8: showForm

 function showForm($target)
 {
     global $CFG_GLPI;
     $categories = getAllDatasFromTable($this->getTable());
     if (!empty($categories)) {
         echo "<div align='center'>";
         $rand = mt_rand();
         echo "<form method='post' name='massiveaction_form_ticket{$rand}' \n                                    id='massiveaction_form_ticket{$rand}' action='" . $target . "'>";
         echo "<table class='tab_cadre_fixe' cellpadding='5'>";
         echo "<tr>";
         echo "<th></th><th>" . __('Category of created tickets', 'resources') . "</th>";
         echo "</tr>";
         foreach ($categories as $categorie) {
             $ID = $categorie["id"];
             echo "<tr class='tab_bg_1'>";
             echo "<td class='center' width='10'>";
             echo "<input type='hidden' name='id' value='{$ID}'>";
             echo "<input type='checkbox' name='item[{$ID}]' value='1'>";
             echo "</td>";
             echo "<td>" . Dropdown::getDropdownName("glpi_itilcategories", $categorie["ticketcategories_id"]) . "</td>";
             echo "</tr>";
         }
         Html::openArrowMassives("massiveaction_form_ticket{$rand}", true);
         Html::closeArrowMassives(array('delete_ticket' => __s('Delete permanently')));
         echo "</table>";
         Html::closeForm();
         echo "</div>";
     } else {
         echo "<div align='center'><form method='post'  action='" . $target . "'>";
         echo "<table class='tab_cadre_fixe' cellpadding='5'><tr ><th colspan='2'>";
         echo __('Category of created tickets', 'resources') . "</th></tr>";
         echo "<tr class='tab_bg_1'><td>";
         Dropdown::show('ITILCategory', array('name' => "ticketcategories_id"));
         echo "</td>";
         echo "<td>";
         echo "<div align='center'>";
         echo "<input type='submit' name='add_ticket' value=\"" . _sx('button', 'Add') . "\" \n                                                                                 class='submit'>";
         echo "</div></td></tr>";
         echo "</table>";
         Html::closeForm();
         echo "</div>";
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:43,代码来源:ticketcategory.class.php

示例9: update421to422

/**
 * Update from 4.2.1 to 4.2.2
 *
 * @return bool for success (will die for most error)
 * */
function update421to422()
{
    global $DB;
    $migration = new Migration('422');
    $query = "SELECT * FROM `glpi_plugin_positions_positions`";
    $result_query = $DB->query($query);
    while ($data = $DB->fetch_array($result_query)) {
        if (!($itemclass = getAllDatasFromTable(getTableForItemType($data['itemtype']), "`id` = " . $data['items_id']))) {
            $query = "DELETE FROM `glpi_plugin_positions_positions` WHERE `items_id` =" . $data['items_id'] . " AND `itemtype` = '" . $data['itemtype'] . "'";
            $DB->queryOrDie($query);
            continue;
        }
        $itemclass = reset($itemclass);
        $query = "UPDATE `glpi_plugin_positions_positions` SET `locations_id` = " . $itemclass['locations_id'] . " WHERE `items_id` =" . $data['items_id'] . " AND `itemtype` = '" . $data['itemtype'] . "'";
        $DB->queryOrDie($query, "ADD fields locations_ids for glpi_plugin_positions_positions");
    }
    $migration->executeMigration();
    return true;
}
开发者ID:nsautier,项目名称:positions,代码行数:24,代码来源:update_421_422.php

示例10: testAddSimpleNetworkPort

 /**
  * @covers NetworkPort::prepareInputForAdd
  * @covers NetworkPort::post_addItem
  */
 public function testAddSimpleNetworkPort()
 {
     $this->Login();
     $computer1 = getItemByTypeName('Computer', '_test_pc01');
     $ins = new NetworkPort();
     // Be sure added
     $nb_log = countElementsInTable('glpi_logs');
     $this->assertGreaterThan(0, $ins->add(['items_id' => $computer1->getID(), 'itemtype' => 'Computer', 'entities_id' => $computer1->fields['entities_id'], 'is_recursive' => 0, 'logical_number' => 1, 'mac' => '00:24:81:eb:c6:d0', 'instantiation_type' => 'NetworkPortEthernet', 'name' => 'eth1']));
     $this->assertGreaterThan($nb_log, countElementsInTable('glpi_logs'));
     // check data in db
     $networkports = end(getAllDatasFromTable('glpi_networkports', '', false, 'id'));
     unset($networkports['id']);
     unset($networkports['date_mod']);
     unset($networkports['date_creation']);
     $expected = ['items_id' => $computer1->getID(), 'itemtype' => 'Computer', 'entities_id' => $computer1->fields['entities_id'], 'is_recursive' => '0', 'logical_number' => '1', 'name' => 'eth1', 'instantiation_type' => 'NetworkPortEthernet', 'mac' => '00:24:81:eb:c6:d0', 'comment' => null, 'is_deleted' => '0', 'is_dynamic' => '0'];
     $this->assertEquals($expected, $networkports);
     // be sure added and have no logs
     $nb_log = countElementsInTable('glpi_logs');
     $this->assertGreaterThan(0, $ins->add(['items_id' => $computer1->getID(), 'itemtype' => 'Computer', 'entities_id' => $computer1->fields['entities_id'], 'logical_number' => 2, 'mac' => '00:24:81:eb:c6:d1', 'instantiation_type' => 'NetworkPortEthernet'], [], false));
     $this->assertEquals($nb_log, countElementsInTable('glpi_logs'));
 }
开发者ID:btry,项目名称:glpi,代码行数:25,代码来源:NetworkportTest.php

示例11: update120to130

function update120to130()
{
    global $DB;
    echo "<strong>Update 1.2.0 to 1.3.0</strong><br/>";
    // Put realtime in seconds
    if (FieldExists('glpi_plugin_projet_tasks', 'realtime')) {
        $query = "ALTER TABLE `glpi_plugin_projet_tasks`\n         ADD `actiontime` INT( 11 ) NOT NULL DEFAULT 0 ;";
        $DB->query($query) or die("0.83 ADD actiontime in glpi_plugin_projet_tasks" . "Error during the database update" . $DB->error());
        $query = "UPDATE `glpi_plugin_projet_tasks`\n                SET `actiontime` = ROUND(realtime * 3600)";
        $DB->query($query) or die("0.83 compute actiontime value in glpi_plugin_projet_tasks" . "Error during the database update" . $DB->error());
        $query = "ALTER TABLE `glpi_plugin_projet_tasks`\n         DROP `realtime` ;";
        $DB->query($query) or die("0.83 DROP realtime in glpi_plugin_projet_tasks" . "Error during the database update" . $DB->error());
    }
    $query = "CREATE TABLE  IF NOT EXISTS `glpi_plugin_projet_projets_projets` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `plugin_projet_projets_id_1` int(11) NOT NULL DEFAULT '0',\n              `plugin_projet_projets_id_2` int(11) NOT NULL DEFAULT '0',\n              `link` int(11) NOT NULL DEFAULT '1',\n              PRIMARY KEY (`id`),\n              KEY `unicity` (`plugin_projet_projets_id_1`,`plugin_projet_projets_id_2`)\n            ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
    $DB->query($query) or die("0.83 Create glpi_plugin_projet_projets_projets" . "Error during the database update" . $DB->error());
    $restrict = "`plugin_projet_projets_id` <> 0";
    $projets = getAllDatasFromTable("glpi_plugin_projet_projets", $restrict);
    if (!empty($projets)) {
        foreach ($projets as $projet) {
            $query = "INSERT INTO `glpi_plugin_projet_projets_projets` (\n                     `id` ,\n                     `plugin_projet_projets_id_1` ,\n                     `plugin_projet_projets_id_2` ,\n                     `link`\n                     )\n                     VALUES (\n                     NULL , '" . $projet["id"] . "', '" . $projet["plugin_projet_projets_id"] . "', '1'\n                     );";
            $DB->query($query) or die("0.83 compute values in glpi_plugin_projet_projets_projets" . "Error during the database update" . $DB->error());
        }
    }
    $query = "ALTER TABLE `glpi_plugin_projet_projets`\n      DROP `plugin_projet_projets_id` ;";
    $DB->query($query) or die("0.83 DROP plugin_projet_projets_id in glpi_plugin_projet_projets" . "Error during the database update" . $DB->error());
    $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_projet_tasks_tasks` (\n           `id` int(11) NOT NULL AUTO_INCREMENT,\n           `plugin_projet_tasks_id_1` int(11) NOT NULL DEFAULT '0',\n           `plugin_projet_tasks_id_2` int(11) NOT NULL DEFAULT '0',\n           `link` int(11) NOT NULL DEFAULT '1',\n           PRIMARY KEY (`id`),\n           KEY `unicity` (`plugin_projet_tasks_id_1`,`plugin_projet_tasks_id_2`)\n         ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
    $DB->query($query) or die("0.83 Create glpi_plugin_projet_tasks_tasks" . "Error during the database update" . $DB->error());
    $restrict = "`plugin_projet_tasks_id` <> 0";
    $tasks = getAllDatasFromTable("glpi_plugin_projet_tasks", $restrict);
    if (!empty($tasks)) {
        foreach ($tasks as $task) {
            $query = "INSERT INTO `glpi_plugin_projet_tasks_tasks` (\n                     `id` ,\n                     `plugin_projet_tasks_id_1` ,\n                     `plugin_projet_tasks_id_2` ,\n                     `link`\n                     )\n                     VALUES (\n                     NULL , '" . $task["id"] . "', '" . $task["plugin_projet_tasks_id"] . "', '1'\n                     );";
            $DB->query($query) or die("0.83 compute values in glpi_plugin_projet_tasks_tasks" . "Error during the database update" . $DB->error());
        }
    }
    $query = "ALTER TABLE `glpi_plugin_projet_tasks`\n      DROP `plugin_projet_tasks_id` ;";
    $DB->query($query) or die("0.83 DROP plugin_projet_tasks_id in glpi_plugin_projet_tasks" . "Error during the database update" . $DB->error());
}
开发者ID:geldarr,项目名称:hack-space,代码行数:38,代码来源:update_120_130.php

示例12: set

 /**
  *
  * @param $parm
  */
 function set($parm)
 {
     global $DB;
     $data = current(getAllDatasFromTable("glpi_plugin_fusioninventory_mappings", "`itemtype`='" . $parm['itemtype'] . "' AND `name`='" . $parm['name'] . "'"));
     if (empty($data)) {
         // Insert
         $query = '';
         if (isset($parm['shortlocale'])) {
             $query = "INSERT INTO `glpi_plugin_fusioninventory_mappings`\n                        (`itemtype`, `name`, `table`, `tablefield`, `locale`, `shortlocale`)\n                     VALUES ('" . $parm['itemtype'] . "', '" . $parm['name'] . "', '" . $parm['table'] . "',\n                             '" . $parm['tablefield'] . "', '" . $parm['locale'] . "',\n                                '" . $parm['shortlocale'] . "')";
         } else {
             $query = "INSERT INTO `glpi_plugin_fusioninventory_mappings`\n                        (`itemtype`, `name`, `table`, `tablefield`, `locale`)\n                     VALUES ('" . $parm['itemtype'] . "', '" . $parm['name'] . "', '" . $parm['table'] . "',\n                             '" . $parm['tablefield'] . "', '" . $parm['locale'] . "')";
         }
         $DB->query($query);
     } elseif ($data['table'] != $parm['table'] or $data['tablefield'] != $parm['tablefield'] or $data['locale'] != $parm['locale']) {
         $data['table'] = $parm['table'];
         $data['tablefield'] = $parm['tablefield'];
         $data['locale'] = $parm['locale'];
         if (isset($parm['shortlocale'])) {
             $data['shortlocale'] = $parm['shortlocale'];
         }
         $this->update($data);
     }
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:27,代码来源:mapping.class.php

示例13: PeripheralUniqueSerialimport

 /**
  * @test
  */
 public function PeripheralUniqueSerialimport()
 {
     global $DB;
     $DB->connect();
     self::restore_database();
     $_SESSION['glpiactive_entity'] = 0;
     $_SESSION["plugin_fusioninventory_entity"] = 0;
     $_SESSION["glpiname"] = 'Plugin_FusionInventory';
     $pfConfig = new PluginFusioninventoryConfig();
     $pfiComputerLib = new PluginFusioninventoryInventoryComputerLib();
     $computer = new Computer();
     $GLPIlog = new GLPIlogs();
     $pxml = @simplexml_load_string($this->a_computer1_XML, 'SimpleXMLElement', LIBXML_NOCDATA);
     $arrayinventory = PluginFusioninventoryFormatconvert::XMLtoArray($pxml);
     $agent = new PluginFusioninventoryAgent();
     $agents_id = $agent->importToken($arrayinventory);
     $_SESSION['plugin_fusioninventory_agents_id'] = $agents_id;
     $pfInventoryComputerInventory = new PluginFusioninventoryInventoryComputerInventory();
     $pfInventoryComputerInventory->import('deviceid', $arrayinventory['CONTENT'], $arrayinventory);
     $computer->getFromDB(1);
     $this->assertEquals('ggheb7ne7', $computer->fields['serial'], 'Computer not updated correctly');
     $a_ref = array(1 => array('name' => 'Périphérique USB composite', 'id' => '1', 'serial' => '10075973', 'peripheraltypes_id' => '0', 'peripheralmodels_id' => '0', 'manufacturers_id' => '2', 'is_global' => '0', 'is_deleted' => '0', 'is_template' => '0', 'is_dynamic' => '0'), 2 => array('name' => 'H5321 gw Mobile Broadband Device', 'id' => '2', 'serial' => '187A047919938CM0', 'peripheraltypes_id' => '0', 'peripheralmodels_id' => '0', 'manufacturers_id' => '7', 'is_global' => '0', 'is_deleted' => '0', 'is_template' => '0', 'is_dynamic' => '0'), 3 => array('name' => 'Périphérique d’entrée USB', 'id' => '3', 'serial' => 'STM32_EMOTION2', 'peripheraltypes_id' => '0', 'peripheralmodels_id' => '0', 'manufacturers_id' => '8', 'is_global' => '0', 'is_deleted' => '0', 'is_template' => '0', 'is_dynamic' => '0'));
     $a_db_peripherals = getAllDatasFromTable('glpi_peripherals');
     foreach ($a_db_peripherals as $id => $data) {
         $data_temp = array('name' => $data['name'], 'id' => $data['id'], 'serial' => $data['serial'], 'peripheraltypes_id' => $data['peripheraltypes_id'], 'peripheralmodels_id' => $data['peripheralmodels_id'], 'manufacturers_id' => $data['manufacturers_id'], 'is_global' => $data['is_global'], 'is_deleted' => $data['is_deleted'], 'is_template' => $data['is_template'], 'is_dynamic' => $data['is_dynamic']);
         $a_db_peripherals[$id] = $data_temp;
     }
     $this->assertEquals($a_ref, $a_db_peripherals, 'List of peripherals');
     // Update computer and may not have new values in glpi_logs
     $query = "SELECT * FROM `glpi_logs`\n         ORDER BY `id` DESC LIMIT 1";
     $result = $DB->query($query);
     $data = $DB->fetch_assoc($result);
     $last_id = $data['id'];
     $pfInventoryComputerInventory->import('deviceid', $arrayinventory['CONTENT'], $arrayinventory);
     $data = getAllDatasFromTable('glpi_logs', "`id`>'" . $last_id . "'");
     $this->assertEquals(array(), $data, 'On update peripherals, may not have new lines in glpi_logs');
 }
开发者ID:C-Duv,项目名称:fusioninventory-for-glpi,代码行数:40,代码来源:ComputerPeripheralTest.php

示例14: title

 function title()
 {
     global $CFG_GLPI;
     $buttons = array();
     if (countElementsInTable($this->getTable())) {
         $buttons["notimportedemail.php"] = __('List of not imported emails');
     }
     $errors = getAllDatasFromTable($this->getTable(), '`errors` > 0');
     $message = '';
     if (count($errors)) {
         $servers = array();
         foreach ($errors as $data) {
             $this->getFromDB($data['id']);
             $servers[] = $this->getLink();
         }
         $message = sprintf(__('Receivers in error: %s'), implode(" ", $servers));
     }
     if (count($buttons)) {
         Html::displayTitle($CFG_GLPI["root_doc"] . "/pics/users.png", _n('Receiver', 'Receivers', Session::getPluralNumber()), $message, $buttons);
     }
 }
开发者ID:remicollet,项目名称:glpi,代码行数:21,代码来源:mailcollector.class.php

示例15: addSpecificCriteriasToArray

 /**
  * Get all ldap rules criterias from the DB and add them into the RULES_CRITERIAS
  *
  * @param &$criterias
  **/
 function addSpecificCriteriasToArray(&$criterias)
 {
     $criterias['ldap'] = __('LDAP criteria');
     foreach (getAllDatasFromTable('glpi_rulerightparameters', '', true) as $datas) {
         $criterias[$datas["value"]]['name'] = $datas["name"];
         $criterias[$datas["value"]]['field'] = $datas["value"];
         $criterias[$datas["value"]]['linkfield'] = '';
         $criterias[$datas["value"]]['table'] = '';
     }
 }
开发者ID:stweil,项目名称:glpi,代码行数:15,代码来源:ruleright.class.php


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