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


PHP exportArrayToDB函数代码示例

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


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

示例1: addInfocomsForComputer

 /**
  * @param $computers_id
  * @param $date
  * @param $computer_updates
  * @return array
  */
 static function addInfocomsForComputer($computers_id, $date, $computer_updates)
 {
     global $DB;
     $infocom = new Infocom();
     $use_date = substr($date, 0, 10);
     if ($infocom->getFromDBByQuery("WHERE `items_id` = {$computers_id} AND `itemtype` = 'Computer'")) {
         if (empty($infocom->fields['use_date']) || $infocom->fields['use_date'] == 'NULL') {
             //add use_date
             $infocom->update(array('id' => $infocom->fields['id'], 'use_date' => $use_date));
         }
     } else {
         //add infocom
         $infocom->add(array('items_id' => $computers_id, 'itemtype' => 'Computer', 'use_date' => $use_date));
     }
     //Add lock
     $ocslink = new PluginOcsinventoryngOcslink();
     if ($ocslink->getFromDBforComputer($computers_id)) {
         $cfg_ocs = PluginOcsinventoryngOcsServer::getConfig($ocslink->fields["plugin_ocsinventoryng_ocsservers_id"]);
         if ($cfg_ocs["use_locks"]) {
             $computer_updates[] = "use_date";
             $query = "UPDATE `glpi_plugin_ocsinventoryng_ocslinks`\n                         SET `computer_update` = '" . addslashes(exportArrayToDB($computer_updates)) . "'\n                         WHERE `computers_id` = '{$computers_id}'";
             $DB->query($query);
         }
     }
     return $computer_updates;
 }
开发者ID:pluginsGLPI,项目名称:ocsinventoryng,代码行数:32,代码来源:ocsadmininfoslink.class.php

示例2: prepareInputForUpdate

 function prepareInputForUpdate($input)
 {
     if (isset($input['networkports_id_list']) && is_array($input['networkports_id_list'])) {
         $input['networkports_id_list'] = exportArrayToDB($input['networkports_id_list']);
     } else {
         $input['networkports_id_list'] = exportArrayToDB(array());
     }
     return parent::prepareInputForAdd($input);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:9,代码来源:networkportaggregate.class.php

示例3: updateDurationCache

 /**
  * Update the calendar cache
  *
  * @param $calendars_id integer calendar ID
  **/
 function updateDurationCache($calendars_id)
 {
     if ($this->getFromDB($calendars_id)) {
         $input['id'] = $calendars_id;
         $input['cache_duration'] = exportArrayToDB($this->getDaysDurations());
         return $this->update($input);
     }
     return false;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:14,代码来源:calendar.class.php

示例4: addLocks

 /**
  * Add lock fields for a record.
  *
  * @param $p_itemtype Table id.
  * @param $p_items_id Line id.
  * @param $p_fieldsToLock Array of fields to lock.
  *TODO:  check rights and entity
  *
  * @return nothing
  **/
 static function addLocks($p_itemtype, $p_items_id, $p_fieldsToLock)
 {
     global $DB;
     $tableName = getTableForItemType($p_itemtype);
     $pfl = new PluginFusioninventoryLock();
     $a_exclude = $pfl->excludeFields();
     $p_fieldsToLock = array_diff($p_fieldsToLock, $a_exclude);
     $result = PluginFusioninventoryLock::getLock($tableName, $p_items_id);
     if ($DB->numrows($result)) {
         $row = $DB->fetch_assoc($result);
         $lockedFields = importArrayFromDB($row['tablefields']);
         if (count(array_diff($p_fieldsToLock, $lockedFields))) {
             // old locks --> new locks
             $p_fieldsToLock = array_merge($p_fieldsToLock, $lockedFields);
             $a_lines = $pfl->find("`tablename`='" . $tableName . "' AND `items_id`='" . $p_items_id . "'");
             $a_line = current($a_lines);
             $pfl->getFromDB($a_line['id']);
             $pfl->fields['tablefields'] = exportArrayToDB($p_fieldsToLock);
             $pfl->update($pfl->fields);
         }
     } elseif (count($p_fieldsToLock)) {
         // no locks --> new locks
         $input = array();
         $input['tablename'] = $tableName;
         $input['items_id'] = $p_items_id;
         $input['tablefields'] = exportArrayToDB($p_fieldsToLock);
         $pfl->add($input);
     }
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:39,代码来源:lock.class.php

示例5: prepareRun


//.........这里部分代码省略.........
                 $a_devicesubnet[$ip_subnet]['Printer'][$items_id] = 1;
             }
         }
         $a_agentsubnet = array();
         foreach ($a_subnet as $subnet => $num) {
             $a_agentList = $this->getAgentsSubnet($num, $communication, $subnet);
             if (!isset($a_agentList)) {
                 $a_agentsubnet[$subnet] = '';
             } else {
                 $a_agentsubnet[$subnet] = $a_agentList;
             }
         }
         $a_input = array();
         $a_input['plugin_fusioninventory_taskjobs_id'] = $taskjobs_id;
         $a_input['state'] = 1;
         $a_input['plugin_fusioninventory_agents_id'] = 0;
         $a_input['itemtype'] = '';
         $a_input['items_id'] = 0;
         $a_input['uniqid'] = $uniqid;
         $a_input['execution_id'] = $task->fields['execution_id'];
         $taskvalid = 0;
         foreach ($a_agentsubnet as $subnet => $a_agentList) {
             if (!isset($a_agentList) or isset($a_agentList) && is_array($a_agentList) && count($a_agentList) == '0' or isset($a_agentList) && !is_array($a_agentList) && $a_agentList == '') {
                 // No agent available for this subnet
                 for ($i = 0; $i < 2; $i++) {
                     $itemtype = 'Printer';
                     if ($i == '0') {
                         $itemtype = 'NetworkEquipment';
                     }
                     if (isset($a_devicesubnet[$subnet][$itemtype])) {
                         foreach ($a_devicesubnet[$subnet][$itemtype] as $items_id => $num) {
                             $a_input['itemtype'] = $itemtype;
                             $a_input['items_id'] = $items_id;
                             $a_input['specificity'] = exportArrayToDB($a_specificity['DEVICE'][$itemtype . $items_id]);
                             $Taskjobstates_id = $pfTaskjobstate->add($a_input);
                             //Add log of taskjob
                             $a_input['plugin_fusioninventory_taskjobstates_id'] = $Taskjobstates_id;
                             $a_input['state'] = 7;
                             $a_input['date'] = date("Y-m-d H:i:s");
                             $pfTaskjoblog->add($a_input);
                             $pfTaskjobstate->changeStatusFinish($Taskjobstates_id, 0, '', 1, "Unable to find agent to inventory " . "this " . $itemtype, 0, 0);
                             $a_input['state'] = 1;
                         }
                     }
                 }
             } else {
                 // add taskjobstate
                 $count_device_subnet = 0;
                 if (isset($a_devicesubnet[$subnet]['NetworkEquipment'])) {
                     $count_device_subnet += count($a_devicesubnet[$subnet]['NetworkEquipment']);
                 }
                 if (isset($a_devicesubnet[$subnet]['Printer'])) {
                     $count_device_subnet += count($a_devicesubnet[$subnet]['Printer']);
                 }
                 $nb_devicebyagent = ceil($count_device_subnet / count($a_agentList));
                 $nbagent = 0;
                 $agent_id = array_pop($a_agentList);
                 $a_input['state'] = 0;
                 for ($i = 0; $i < 2; $i++) {
                     $itemtype = 'Printer';
                     if ($i == '0') {
                         $itemtype = 'NetworkEquipment';
                     }
                     if (isset($a_devicesubnet[$subnet][$itemtype])) {
                         foreach ($a_devicesubnet[$subnet][$itemtype] as $items_id => $num) {
                             $a_input['itemtype'] = $itemtype;
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:67,代码来源:networkinventory.class.php

示例6: prepareInputForAdd

 function prepareInputForAdd($input)
 {
     if (isset($input["helpdesk_item_type"])) {
         $input["helpdesk_item_type"] = exportArrayToDB($input["helpdesk_item_type"]);
     }
     $this->profileRight = array();
     foreach (ProfileRight::getAllPossibleRights() as $right => $default) {
         if (isset($input[$right])) {
             $this->profileRight[$right] = $input[$right];
             unset($input[$right]);
         }
     }
     return $input;
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:14,代码来源:profile.class.php

示例7: FusionUnknownKnownDevice

 function FusionUnknownKnownDevice()
 {
     global $DB;
     $query = "SELECT *\n                FROM `glpi_networking_ports`\n                WHERE `ifmac` != ''\n                      AND `ifmac` != '00:00:00:00:00:00'\n                      AND `device_type`=" . PLUGIN_FUSIONINVENTORY_MAC_UNKNOWN . "\n                GROUP BY `ifmac`\n                HAVING COUNT(*)>0;";
     if ($result = $DB->query($query)) {
         while ($data = $DB->fetch_array($result)) {
             // $data = ID of unknown device
             $query_known = "SELECT *\n                            FROM `glpi_networking_ports`\n                            WHERE `ifmac` IN ('" . $data["ifmac"] . "','" . strtoupper($data["ifmac"]) . "',\n                                              '" . strtolower($data["ifmac"]) . "')\n                                  AND `device_type`!=" . PLUGIN_FUSIONINVENTORY_MAC_UNKNOWN . "\n                            LIMIT 0,1;";
             $result_known = $DB->query($query_known);
             if ($DB->numrows($result_known) > 0) {
                 $data_known = $DB->fetch_array($result_known);
                 $query_update = "UPDATE `glpi_networking_ports`\n                                SET `on_device`='" . $data_known["on_device"] . "',\n                                    `device_type='" . $data_known["device_type"] . "',\n                                    `logical_number`='" . $data_known["logical_number"] . "',\n                                    `name`='" . $data_known["name"] . "',\n                                    `ifaddr`='" . $data_known["ifaddr"] . "',\n                                    `iface`='" . $data_known["iface"] . "',\n                                    `netpoint`='" . $data_known["netpoint"] . "',\n                                    `netmask`='" . $data_known["netmask"] . "',\n                                    `gateway`='" . $data_known["gateway"] . "',\n                                    `subnet`='" . $data_known["subnet"] . "'\n                                  WHERE `ID`='" . $data["ID"] . "';";
                 $DB->query($query_update);
                 // Delete old networking port
                 $this->deleteFromDB($data_known["ID"], 1);
                 // Delete unknown device
                 $this->deleteFromDB($data["on_device"], 1);
                 // Modify OCS link of this networking port
                 $query = "SELECT *\n                         FROM `glpi_ocs_link`\n                         WHERE `glpi_id`='" . $data_known["on_device"] . "';";
                 $result = $DB->query($query);
                 if ($DB->numrows($result) == 1) {
                     $line = $DB->fetch_assoc($result);
                     $import_ip = importArrayFromDB($line["import_ip"]);
                     $ip_port = $import_ip[$data_known["ID"]];
                     unset($import_ip[$data_known["ID"]]);
                     $import_ip[$data["ID"]] = $ip_port;
                     $query_update = "UPDATE `glpi_ocs_link`\n                                   SET `import_ip`='" . exportArrayToDB($import_ip) . "'\n                                   WHERE `glpi_id`='" . $line["ID"] . "';";
                     $DB->query($query_update);
                 }
             }
         }
     }
 }
开发者ID:Hawke,项目名称:fusioninventory-for-glpi,代码行数:33,代码来源:unknowndevice.class.php

示例8: updateDisplayOptions

 /**
  * Update $_SESSION to set the display options.
  *
  * @since version 0.84
  *
  * @param $input         array   of data to update
  * @param $sub_itemtype  string  sub itemtype if needed (default '')
  *
  * @return nothing
  **/
 static function updateDisplayOptions($input = array(), $sub_itemtype = '')
 {
     $options = static::getAvailableDisplayOptions();
     if (count($options)) {
         if (empty($sub_itemtype)) {
             $display_options =& $_SESSION['glpi_display_options'][self::getType()];
         } else {
             $display_options =& $_SESSION['glpi_display_options'][self::getType()][$sub_itemtype];
         }
         // reset
         if (isset($input['reset'])) {
             foreach ($options as $option_group_name => $option_group) {
                 foreach ($option_group as $option_name => $attributs) {
                     $display_options[$option_name] = $attributs['default'];
                 }
             }
         } else {
             foreach ($options as $option_group_name => $option_group) {
                 foreach ($option_group as $option_name => $attributs) {
                     if (isset($input[$option_name]) && $_GET[$option_name] == 'on') {
                         $display_options[$option_name] = true;
                     } else {
                         $display_options[$option_name] = false;
                     }
                 }
             }
         }
         // Store new display options for user
         if ($uid = Session::getLoginUserID()) {
             $user = new User();
             if ($user->getFromDB($uid)) {
                 $user->update(array('id' => $uid, 'display_options' => exportArrayToDB($_SESSION['glpi_display_options'])));
             }
         }
     }
 }
开发者ID:korial29,项目名称:glpi,代码行数:46,代码来源:commonglpi.class.php

示例9: prepareInputForAdd

 /**
  * Gère la transformation des inputs multiples en quelque chose d'inserable dans la base (en l'occurence une chaine json).
  * .
  *
  * @see CommonDBTM::prepareInputForAdd()
  */
 final function prepareInputForAdd($input)
 {
     foreach (self::getConfigParams() as $param => $desc) {
         if (isset($input[$param]) && isset($desc['multiple']) && $desc['multiple']) {
             $input[$param] = exportArrayToDB($input[$param]);
         }
     }
     return $input;
 }
开发者ID:Etiennef,项目名称:configmanager,代码行数:15,代码来源:rule.class.php

示例10: saveDatas

 function saveDatas($params)
 {
     global $DB;
     $tasks_id = $params['tasks_id'];
     $tasks = json_decode($params['tasks']);
     //remove old jobs from task
     $query = "DELETE FROM " . $this->getTable() . "\n      WHERE plugin_fusioninventory_deploytasks_id = '" . $tasks_id . "'";
     $res = $DB->query($query);
     //get plugin id
     $plug = new Plugin();
     $plug->getFromDBbyDir('fusinvdeploy');
     $plugins_id = $plug->getField('id');
     //insert new rows
     $sql_tasks = array();
     $i = 0;
     foreach ($tasks as $task) {
         $task = get_object_vars($task);
         //encode action and definition
         //$action = exportArrayToDB(array(array(
         //    $task['action_type'] => $task['action_selection'])));
         $action = exportArrayToDB($task['action']);
         $definition = exportArrayToDB(array(array('PluginFusioninventoryDeployPackage' => $task['package_id'])));
         $sql_tasks[] = "INSERT INTO " . $this->getTable() . "\n         (\n            plugin_fusioninventory_deploytasks_id, name, date_creation, entities_id,\n            plugins_id, method, definition, action,\n            retry_nb, retry_time, periodicity_type, periodicity_count\n         ) VALUES (\n            '{$tasks_id}', 'job_" . $tasks_id . "_{$i}', NOW(), '0',\n            '{$plugins_id}', '" . $task['method'] . "', '{$definition}', '{$action}',\n            '" . $task['retry_nb'] . "', '" . $task['retry_time'] . "', 'minutes', '0'\n         )";
         $i++;
     }
     foreach ($sql_tasks as $query) {
         $res = $DB->query($query);
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:29,代码来源:deploytaskjob.class.php

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

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

示例13: array

      $input = array();
      $pmComponentscatalog->getFromDB($_POST['plugin_monitoring_componentscalalog_id']);
      $input['id'] = $_POST['id'];
      $input['entities_id'] = $pmComponentscatalog->fields['entities_id'];
      $input['is_recursive'] = $pmComponentscatalog->fields['is_recursive'];
      $input['name'] = $_POST['name'];
      $input['itemtype'] = $_POST['itemtype'];
      $input['plugin_monitoring_componentscalalog_id'] = $_POST['plugin_monitoring_componentscalalog_id'];
      unset($_POST['entities_id']);
      unset($_POST['is_recursive']);
      unset($_POST['name']);
      unset($_POST['updaterule']);
      unset($_POST['itemtypen']);
      unset($_POST['plugin_monitoring_componentscalalog_id']);
      unset($_POST['id']);
      $input['condition'] = exportArrayToDB($_POST);
      $pmComponentscatalog_rule->update($input);
      unset($_SESSION['plugin_monitoring_rules']);
      unset($_SESSION["glpisearch"][$input['itemtype']]);
      Html::redirect($CFG_GLPI['root_doc']."/plugins/monitoring/front/componentscatalog.form.php?id=".$input['plugin_monitoring_componentscalalog_id']);

   }
} else if (isset($_GET['deleterule'])) {
   $_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']);
//   }
开发者ID:euqip,项目名称:glpi-smartcities,代码行数:31,代码来源:componentscatalog_rule.form.php

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

示例15: savePlanningsInDB

 static function savePlanningsInDB()
 {
     $user = new User();
     $user->update(array('id' => $_SESSION['glpiID'], 'plannings' => exportArrayToDB($_SESSION['glpi_plannings'])));
 }
开发者ID:korial29,项目名称:glpi,代码行数:5,代码来源:planning.class.php


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