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


PHP importArrayFromDB函数代码示例

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


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

示例1: getAllDatas

 function getAllDatas($params)
 {
     global $DB;
     $tasks_id = $params['tasks_id'];
     $sql = " SELECT *\n               FROM `" . $this->getTable() . "`\n               WHERE `plugin_fusioninventory_deploytasks_id` = '{$tasks_id}'\n               AND (method = 'deployinstall' OR method = 'deployuninstall')";
     $res = $DB->query($sql);
     $json = array();
     $temp_tasks = array();
     while ($row = $DB->fetch_assoc($res)) {
         $row['packages'] = importArrayFromDB($row['definition']);
         $row['actions'] = importArrayFromDB($row['action']);
         $temp_tasks[] = $row;
     }
     $i = 0;
     foreach ($temp_tasks as $task) {
         foreach ($task['actions'] as $action) {
             foreach ($task['packages'] as $package) {
                 $tmp = array_keys($action);
                 $action_type = $tmp[0];
                 $json['tasks'][$i]['package_id'] = $package['PluginFusioninventoryDeployPackage'];
                 $json['tasks'][$i]['method'] = $task['method'];
                 $json['tasks'][$i]['comment'] = $task['comment'];
                 $json['tasks'][$i]['retry_nb'] = $task['retry_nb'];
                 $json['tasks'][$i]['retry_time'] = $task['retry_time'];
                 $json['tasks'][$i]['action_type'] = $action_type;
                 $json['tasks'][$i]['action_selection'] = $action[$action_type];
                 $obj_action = new $action_type();
                 $obj_action->getFromDB($action[$action_type]);
                 $json['tasks'][$i]['action_name'] = $obj_action->getField('name');
                 $i++;
             }
         }
     }
     return json_encode($json);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:35,代码来源:deploytaskjob.class.php

示例2: preClone

 static function preClone(Profile $srce, array $input)
 {
     // decode array
     if (isset($input['helpdesk_item_type']) && !is_array($input['helpdesk_item_type'])) {
         $input['helpdesk_item_type'] = importArrayFromDB($input['helpdesk_item_type']);
     }
     // Empty/NULL case
     if (!isset($input['helpdesk_item_type']) || !is_array($input['helpdesk_item_type'])) {
         $input['helpdesk_item_type'] = array();
     }
     return $input;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:12,代码来源:profile.class.php

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

示例4: glpi_header

    glpi_header($_SERVER['HTTP_REFERER']);
} else {
    if (isset($_POST['timezones_add'])) {
        $input = array();
        $pmConfig->getFromDB($_POST['id']);
        $input['id'] = $_POST['id'];
        $a_timezones = importArrayFromDB($pmConfig->fields['timezones']);
        foreach ($_POST['timezones_to_add'] as $timezone) {
            $a_timezones[] = $timezone;
        }
        $input['timezones'] = exportArrayToDB($a_timezones);
        $pmConfig->update($input);
        glpi_header($_SERVER['HTTP_REFERER']);
    } else {
        if (isset($_POST['timezones_delete'])) {
            $input = array();
            $pmConfig->getFromDB($_POST['id']);
            $input['id'] = $_POST['id'];
            $a_timezones = importArrayFromDB($pmConfig->fields['timezones']);
            foreach ($_POST['timezones_to_delete'] as $timezone) {
                $key = array_search($timezone, $a_timezones);
                unset($a_timezones[$key]);
            }
            $input['timezones'] = exportArrayToDB($a_timezones);
            $pmConfig->update($input);
            glpi_header($_SERVER['HTTP_REFERER']);
        }
    }
}
$pmConfig->showForm(0);
commonFooter();
开发者ID:RubichonL,项目名称:glpi_monitoring,代码行数:31,代码来源:config.form.php

示例5: getInstantiationHTMLTable

 /**
  * @see NetworkPortInstantiation::getInstantiationHTMLTable()
  **/
 function getInstantiationHTMLTable(NetworkPort $netport, HTMLTableRow $row, HTMLTableCell $father = NULL, array $options = array())
 {
     if (isset($this->fields['networkports_id_list']) && is_string($this->fields['networkports_id_list'])) {
         $this->fields['networkports_id_list'] = importArrayFromDB($this->fields['networkports_id_list']);
     }
     $row->addCell($row->getHeaderByName('Instantiation', 'Origin'), $this->getInstantiationNetworkPortHTMLTable());
     parent::getInstantiationHTMLTable($netport, $row, $father, $options);
     return NULL;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:12,代码来源:networkportaggregate.class.php

示例6: generateServicesCfg


//.........这里部分代码省略.........
               if (isset(self::$shinkenParameters['glpi']['itemType'])) {
                  $a_services[$i][self::$shinkenParameters['glpi']['itemType']] =
                     'Service';
               }
               if (isset(self::$shinkenParameters['glpi']['itemId'])) {
                  $a_services[$i][self::$shinkenParameters['glpi']['itemId']] =
                     $data['id'];
               }

               // Manage freshness
               if ($a_component['freshness_count'] == 0) {
                  $a_services[$i]['check_freshness'] = '0';
                  $a_services[$i]['freshness_threshold'] = '3600';
               } else {
                  $multiple = 1;
                  if ($a_component['freshness_type'] == 'seconds') {
                     $multiple = 1;
                  } else if ($a_component['freshness_type'] == 'minutes') {
                     $multiple = 60;
                  } else if ($a_component['freshness_type'] == 'hours') {
                     $multiple = 3600;
                  } else if ($a_component['freshness_type'] == 'days') {
                     $multiple = 86400;
                  }
                  $a_services[$i]['check_freshness'] = '1';
                  $a_services[$i]['freshness_threshold'] = (string)($a_component['freshness_count'] * $multiple);
               }

               $pMonitoringCommand->getFromDB($a_component['plugin_monitoring_commands_id']);
               // Manage arguments
               $array = array();
               preg_match_all("/\\$(ARG\d+)\\$/", $pMonitoringCommand->fields['command_line'], $array);
               sort($array[0]);
               $a_arguments = importArrayFromDB($a_component['arguments']);
               $a_argumentscustom = importArrayFromDB($data['arguments']);
               foreach ($a_argumentscustom as $key=>$value) {
                  $a_arguments[$key] = $value;
               }
               foreach ($a_arguments as $key=>$value) {
                  $a_arguments[$key] = str_replace('!', '\!', html_entity_decode($value));
               }
               $args = '';
               foreach ($array[0] as $arg) {
                  if ($arg != '$PLUGINSDIR$'
                          AND $arg != '$NAGIOSPLUGINSDIR$'
                          AND $arg != '$HOSTADDRESS$'
                          AND $arg != '$MYSQLUSER$'
                          AND $arg != '$MYSQLPASSWORD$') {
                     $arg = str_replace('$', '', $arg);
                     if (!isset($a_arguments[$arg])) {
                        $args .= '!';
                     } else {
                        if (strstr($a_arguments[$arg], "[[HOSTNAME]]")) {
                           $a_arguments[$arg] = str_replace("[[HOSTNAME]]", $hostname, $a_arguments[$arg]);
                        } elseif (strstr($a_arguments[$arg], "[[NETWORKPORTDESCR]]")){
                           if (class_exists("PluginFusioninventoryNetworkPort")) {
                              $pfNetworkPort = new PluginFusioninventoryNetworkPort();
                              $pfNetworkPort->loadNetworkport($data['networkports_id']);
                              $descr = $pfNetworkPort->getValue("ifdescr");
                              $a_arguments[$arg] = str_replace("[[NETWORKPORTDESCR]]", $descr, $a_arguments[$arg]);
                           }
                        } elseif (strstr($a_arguments[$arg], "[[NETWORKPORTNUM]]")){
                           $networkPort = new NetworkPort();
                           $networkPort->getFromDB($data['networkports_id']);
                           $logicalnum = $pfNetworkPort->fields['logical_number'];
                           $a_arguments[$arg] = str_replace("[[NETWORKPORTNUM]]", $logicalnum, $a_arguments[$arg]);
开发者ID:euqip,项目名称:glpi-smartcities,代码行数:67,代码来源:shinken.class.php

示例7: importArrayFromDB

     $a_agentList = importArrayFromDB($agentmodule->fields['exceptions']);
     foreach ($a_agentList as $key => $value) {
         if ($value == $_POST['agent_to_delete'][0]) {
             unset($a_agentList[$key]);
         }
     }
     $input = array();
     $input['exceptions'] = exportArrayToDB($a_agentList);
     $input['id'] = $_POST['id'];
     $agentmodule->update($input);
     Html::back();
 } else {
     if (isset($_POST["updateexceptions"])) {
         $a_modules = $agentmodule->find();
         foreach ($a_modules as $data) {
             $a_agentList = importArrayFromDB($data['exceptions']);
             $agentModule = 0;
             if (isset($_POST['activation-' . $data['modulename']])) {
                 $agentModule = 1;
             }
             $agentModuleBase = 0;
             if (in_array($_POST['id'], $a_agentList)) {
                 $agentModuleBase = 1;
             }
             if ($data['is_active'] == 0) {
                 if ($agentModule == 1 and $agentModuleBase == 1) {
                     // OK
                 } else {
                     if ($agentModule == 1 and $agentModuleBase == 0) {
                         $a_agentList[] = $_POST['id'];
                     } else {
开发者ID:ameurou,项目名称:fusioninventory-for-glpi,代码行数:31,代码来源:agentmodule.form.php

示例8: makeDropdown

 /**
  * Construit le code HTML pour un champ de saisie via dropdown
  *
  * @param integer/string $id
  *           id de la règle dont fait partie le dropdown (integer ou tag de nouvel id)
  * @param string $param
  *           nom du paramètre à afficher (champ name du select)
  * @param array $desc
  *           description du paramètre à afficher
  * @param string $values
  *           valeur(s) à pré-sélectionner (sous forme de tableau json si la sélection multiple est possible)
  * @param boolean $can_write
  *           vrai ssi on doit afficher un menu sélectionnable, sinon on affiche juste le texte.
  * @return string code html à afficher
  */
 private static final function makeDropdown($id, $param, $desc, $values, $can_write)
 {
     $options = array('multiple' => isset($desc['multiple']) && $desc['multiple'], 'width' => isset($desc['width']) ? $desc['width'] : '100%');
     $result = '';
     $options['display'] = false;
     if ($options['multiple']) {
         $options['values'] = importArrayFromDB($values);
     } else {
         $options['values'] = array($values);
     }
     if ($can_write) {
         $result .= Dropdown::showFromArray("rules[{$id}][{$param}]", $desc['values'], $options);
     } else {
         foreach ($options['values'] as $value) {
             if (isset($desc['values'][$value])) {
                 // test certes contre-intuitif, mais nécessaire pour gérer le fait que la liste de choix puisse être variable selon les droits de l'utilisateur.
                 $result .= $desc['values'][$value] . '</br>';
             }
         }
     }
     return $result;
 }
开发者ID:Etiennef,项目名称:configmanager,代码行数:37,代码来源:rule.class.php

示例9: update0831to084


//.........这里部分代码省略.........
                    $html = str_replace("ticket.storestatus={$old}", "ticket.storestatus={$new}", $html);
                    $subject = str_replace("problem.storestatus={$old}", "problem.storestatus={$new}", $subject);
                    $text = str_replace("problem.storestatus={$old}", "problem.storestatus={$new}", $text);
                    $html = str_replace("problem.storestatus={$old}", "problem.storestatus={$new}", $html);
                }
                $query = "UPDATE `glpi_notificationtemplatetranslations`\n                      SET `subject` = '" . addslashes($subject) . "',\n                          `content_text` = '" . addslashes($text) . "',\n                          `content_html` = '" . addslashes($html) . "'\n                      WHERE `id` = " . $data['id'] . "";
                $DB->queryOrDie($query, "0.84 fix tags usage for storestatus");
            }
        }
    }
    // Update Rules
    $changes = array();
    $changes['RuleTicket'] = 'status';
    $DB->query("SET SESSION group_concat_max_len = 4194304;");
    foreach ($changes as $ruletype => $field) {
        // Get rules
        $query = "SELECT GROUP_CONCAT(`id`)\n                FROM `glpi_rules`\n                WHERE `sub_type` = '" . $ruletype . "'\n                GROUP BY `sub_type`";
        if ($result = $DB->query($query)) {
            if ($DB->numrows($result) > 0) {
                // Get rule string
                $rules = $DB->result($result, 0, 0);
                // Update actions
                foreach ($status as $old => $new) {
                    $query = "UPDATE `glpi_ruleactions`\n                         SET `value` = '{$new}'\n                         WHERE `field` = '{$field}'\n                               AND `value` = '{$old}'\n                               AND `rules_id` IN ({$rules})";
                    $DB->queryOrDie($query, "0.84 update datas for rules actions");
                }
            }
        }
    }
    // Update glpi_profiles : ticket_status
    foreach ($DB->request('glpi_profiles') as $data) {
        $fields_to_decode = array('ticket_status', 'problem_status');
        foreach ($fields_to_decode as $field) {
            $tab = importArrayFromDB($data[$field]);
            if (is_array($tab)) {
                $newtab = array();
                foreach ($tab as $key => $values) {
                    foreach ($values as $key2 => $val2) {
                        $newtab[$status[$key]][$status[$key2]] = $val2;
                    }
                }
                $query = "UPDATE `glpi_profiles`\n                       SET `{$field}` = '" . addslashes(exportArrayToDB($newtab)) . "'\n                       WHERE `id` = '" . $data['id'] . "'";
                $DB->queryOrDie($query, "0.84 migrate {$field} of glpi_profiles");
            }
        }
    }
    $migration->displayMessage(sprintf(__('Change of the database layout - %s'), 'Merge entity and entitydatas'));
    if (TableExists('glpi_entitydatas')) {
        $migration->changeField('glpi_entities', 'id', 'id', 'integer');
        $migration->migrationOneTable('glpi_entities');
        // pour que la procedure soit re-entrante
        if (countElementsInTable("glpi_entities", "id=0") < 1) {
            // Create root entity
            $query = "INSERT INTO `glpi_entities`\n                          (`id`, `name`, `completename`, `entities_id`, `level`)\n                   VALUES (0,'" . addslashes(__('Root entity')) . "',\n                           '" . addslashes(__('Root entity')) . "', '-1', '1');";
            $DB->queryOrDie($query, '0.84 insert root entity into glpi_entities');
        }
        //       $newID = $DB->insert_id();
        //       $query = "UPDATE `glpi_entities`
        //                 SET `id` = '0'
        //                 WHERE `id` = '$newID'";
        //       $DB->queryOrDie($query, '0.84 be sure that id of the root entity if 0 in glpi_entities');
        $migration->addField("glpi_entities", 'address', "text");
        $migration->addField("glpi_entities", 'postcode', "string");
        $migration->addField("glpi_entities", 'town', "string");
        $migration->addField("glpi_entities", 'state', "string");
        $migration->addField("glpi_entities", 'country', "string");
开发者ID:jose-martins,项目名称:glpi,代码行数:67,代码来源:update_0831_084.php

示例10: addToOcsArray

 static function addToOcsArray($computers_id, $toadd, $field)
 {
     global $DB;
     $query = "SELECT `{$field}`\n                FROM `glpi_plugin_ocsinventoryng_ocslinks`\n                WHERE `computers_id` = '{$computers_id}'";
     if ($result = $DB->query($query)) {
         if ($DB->numrows($result)) {
             $tab = importArrayFromDB($DB->result($result, 0, 0));
             // Stripslashes because importArray get clean array
             foreach ($toadd as $key => $val) {
                 $tab[$key] = stripslashes($val);
             }
             $query = "UPDATE `glpi_plugin_ocsinventoryng_ocslinks`\n                      SET `{$field}` = '" . addslashes(exportArrayToDB($tab)) . "'\n                      WHERE `computers_id` = '{$computers_id}'";
             $DB->query($query);
         }
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:16,代码来源:ocsserver.class.php

示例11: isAgentCanDo

 /**
  * Get if agent allowed to do this TASK
  *
  * @param $module_name value Name of the module
  * @param $items_id integer id of the agent
  *
  * @return bool
  *
  **/
 function isAgentCanDo($module_name, $items_id)
 {
     $agentModule = $this->getActivationExceptions($module_name);
     if ($agentModule['is_active'] == 0) {
         $a_agentList = importArrayFromDB($agentModule['exceptions']);
         if (in_array($items_id, $a_agentList)) {
             return TRUE;
         } else {
             return FALSE;
         }
     } else {
         $a_agentList = importArrayFromDB($agentModule['exceptions']);
         if (in_array($items_id, $a_agentList)) {
             return FALSE;
         } else {
             return TRUE;
         }
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:28,代码来源:agentmodule.class.php

示例12: if

   $_POST = $_GET;
   $pmComponentscatalog_rule->delete($_POST);
   Html::redirect($CFG_GLPI['root_doc']."/plugins/monitoring/front/componentscatalog.form.php?id=".$_POST['plugin_monitoring_componentscalalog_id']);
} else if (isset($_GET['contains'])
        OR isset($_GET['reset'])) {
//   if (isset($_SESSION['plugin_monitoring_rules'])) {
//      unset($_SESSION['plugin_monitoring_rules']);
//   }
//   $_SESSION['plugin_monitoring_rules'] = $_POST;
//   $_SESSION['plugin_monitoring_rules_REQUEST_URI'] = $_SERVER['REQUEST_URI'];
   //Html::back();
} else if (isset($_GET['id'])
        AND !isset($_GET['itemtype'])) {
   $pmComponentscatalog_rule->getFromDB($_GET['id']);

   $val = importArrayFromDB($pmComponentscatalog_rule->fields['condition']);
   $nbfields = 1;
   $nbfields = count($val['field']);
   foreach ($val as $name=>$data) {
      if (is_array($data)) {
         $i =0;
         foreach ($data as $key => $value) {
            $val[$name."[".$key."]"] = $value;
         }
         unset($val[$name]);
      }
   }
   $_POST = $val;
   $_POST["glpisearchcount"] = $nbfields;
   $_POST['id'] = $_GET['id'];
   $_POST['name'] = $pmComponentscatalog_rule->fields['name'];
开发者ID:euqip,项目名称:glpi-smartcities,代码行数:31,代码来源:componentscatalog_rule.form.php

示例13: deleteGaugeItems

 function deleteGaugeItems($array)
 {
     $this->getFromDB($array['id']);
     $aggregate_items = importArrayFromDB($this->fields['aggregate_items']);
     $split = explode('|', $array['delete_item']);
     if (count($split) == 5) {
         unset($aggregate_items[$split[0]][$split[1]][$split[2]][$split[3]][$split[4]]);
         if (count($aggregate_items[$split[0]][$split[1]][$split[2]][$split[3]]) == 0) {
             unset($aggregate_items[$split[0]][$split[1]][$split[2]][$split[3]]);
             if (count($aggregate_items[$split[0]][$split[1]][$split[2]]) == 0) {
                 unset($aggregate_items[$split[0]][$split[1]][$split[2]]);
                 if (count($aggregate_items[$split[0]][$split[1]]) == 0) {
                     unset($aggregate_items[$split[0]][$split[1]]);
                     if (count($aggregate_items[$split[0]]) == 0) {
                         unset($aggregate_items[$split[0]]);
                     }
                 }
             }
         }
     }
     $input = array('id' => $array['id'], 'aggregate_items' => exportArrayToDB($aggregate_items));
     $this->update($input);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:23,代码来源:customitem_gauge.class.php

示例14: array_merge

     }
 } else {
     // Normal load process : use normal config table. If problem try old one
     if ($config_object->getFromDB(1)) {
         $config_ok = true;
     } else {
         // Manage glpi_config table before 0.80
         $config_object->forceTable('glpi_config');
         if ($config_object->getFromDB(1)) {
             $config_ok = true;
         }
     }
 }
 if ($config_ok) {
     $CFG_GLPI = array_merge($CFG_GLPI, $config_object->fields);
     $CFG_GLPI['priority_matrix'] = importArrayFromDB($config_object->fields['priority_matrix'], true);
     Config::detectRootDoc();
     // Path for icon of document type
     $CFG_GLPI["typedoc_icon_dir"] = $CFG_GLPI["root_doc"] . "/pics/icones";
 } else {
     echo "Error accessing config table";
     exit;
 }
 // If debug mode activated : display some informations
 if ($_SESSION['glpi_use_mode'] == DEBUG_MODE) {
     // display_errors only need for for E_ERROR, E_PARSE, ... which cannot be catched
     ini_set('display_errors', 'On');
     // Recommended development settings
     error_reporting(E_ALL | E_STRICT);
     set_error_handler('userErrorHandlerDebug');
 } else {
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:config.php

示例15: moveBookmark

 /**
  * Move a bookmark in an ordered collection
  *
  * @since version 0.85
  *
  * @param $items    array      of the rules ID to move
  * @param $ref_ID   integer    of the rule position  (0 means all, so before all or after all)
  * @param $action   string     of move : after or before ( default 'after')
  *
  * @return true if all ok
  **/
 function moveBookmark($items = array(), $ref_ID, $action = 'after')
 {
     global $DB;
     if (count($items)) {
         // Clean IDS : drop ref_ID
         if (isset($items[$ref_ID])) {
             unset($items[$ref_ID]);
         }
         $user = new User();
         $personalorderfield = 'privatebookmarkorder';
         if ($user->getFromDB(Session::getLoginUserID())) {
             $personalorder = importArrayFromDB($user->fields[$personalorderfield]);
         }
         if (!is_array($personalorder)) {
             return false;
         }
         $newpersonalorder = array();
         foreach ($personalorder as $val) {
             // Found item
             if ($val == $ref_ID) {
                 // Add after so add ref ID
                 if ($action == 'after') {
                     $newpersonalorder[] = $ref_ID;
                 }
                 foreach ($items as $val2) {
                     $newpersonalorder[] = $val2;
                 }
                 if ($action == 'before') {
                     $newpersonalorder[] = $ref_ID;
                 }
             } else {
                 if (!isset($items[$val])) {
                     $newpersonalorder[] = $val;
                 }
             }
         }
         $user->update(array('id' => Session::getLoginUserID(), $personalorderfield => exportArrayToDB($newpersonalorder)));
         return true;
     }
     return false;
 }
开发者ID:pvasener,项目名称:glpi,代码行数:52,代码来源:bookmark.class.php


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