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


PHP PluginDatainjectionCommonInjectionLib类代码示例

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


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

示例1: addOrUpdateObject

 /**
  * @see plugins/datainjection/inc/PluginDatainjectionInjectionInterface::addOrUpdateObject()
  **/
 function addOrUpdateObject($values = array(), $options = array())
 {
     $lib = new PluginDatainjectionCommonInjectionLib($this, $values, $options);
     $lib->processAddOrUpdate();
     return $lib->getInjectionResults();
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:9,代码来源:computermodelinjection.class.php

示例2: addValueToInject

 /**
  * Add a value to the fields to inject
  *
  * @param $fields_toinject                the fields
  * @param $searchOptions                  options related to the itemtype to inject
  * @param $mapping                        the mapping which matches the field
  * @param $value                          the value for this field, as readed from the CSV file
  * @param $several            array       of all fields which can be mapping more than one time
  *                                        in the model
  * @return nothing
  **/
 function addValueToInject(&$fields_toinject, $searchOptions, $mapping, $value, $several = array())
 {
     // Option will be found only for "main" type.
     $option = PluginDatainjectionCommonInjectionLib::findSearchOption($searchOptions, $mapping->getValue());
     $return_value = $value;
     if ($option['displaytype'] == 'multiline_text' && in_array($mapping->getValue(), $several) && $value != PluginDatainjectionCommonInjectionLib::EMPTY_VALUE) {
         $return_value = '';
         if (isset($fields_toinject[$mapping->getItemtype()][$mapping->getValue()])) {
             $return_value .= $fields_toinject[$mapping->getItemtype()][$mapping->getValue()];
         }
         $return_value .= $mapping->getMappingName() . "=" . $value . "\n";
     }
     $fields_toinject[$mapping->getItemtype()][$mapping->getValue()] = $return_value;
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:25,代码来源:engine.class.php

示例3: prepareLogResults

 /**
  * @param $models_id
  **/
 static function prepareLogResults($models_id)
 {
     $results = Toolbox::stripslashes_deep(json_decode(PluginDatainjectionSession::getParam('results'), true));
     $todisplay = array();
     $model = new self();
     $model->getFromDB($models_id);
     if (!empty($results)) {
         foreach ($results as $result) {
             $tmp = array('line' => $result['line'], 'status' => $result['status'], 'check_sumnary' => PluginDatainjectionCommonInjectionLib::getLogLabel(PluginDatainjectionCommonInjectionLib::SUCCESS), 'check_message' => PluginDatainjectionCommonInjectionLib::getLogLabel(PluginDatainjectionCommonInjectionLib::SUCCESS), 'type' => __('Undetermined', 'datainjection'), 'status_message' => PluginDatainjectionCommonInjectionLib::getLogLabel($result['status']), 'itemtype' => $model->fields['itemtype'], 'url' => '', 'item' => '');
             if (isset($result[PluginDatainjectionCommonInjectionLib::ACTION_CHECK])) {
                 $check_infos = $result[PluginDatainjectionCommonInjectionLib::ACTION_CHECK];
                 $tmp['check_status'] = $check_infos['status'];
                 $tmp['check_sumnary'] = PluginDatainjectionCommonInjectionLib::getLogLabel($check_infos['status']);
                 $tmp['check_message'] = '';
                 $first = true;
                 foreach ($check_infos as $key => $val) {
                     if ($key !== 'status' && $val[0] != PluginDatainjectionCommonInjectionLib::SUCCESS) {
                         $tmp['check_message'] .= ($first ? '' : "\n") . sprintf(__('%1$s (%2$s)'), PluginDatainjectionCommonInjectionLib::getLogLabel($val[0]), $val[1]);
                         $first = false;
                     }
                 }
             }
             //Store the action type (add/update)
             if (isset($result['type'])) {
                 $tmp['type'] = PluginDatainjectionCommonInjectionLib::getActionLabel($result['type']);
             }
             if (isset($result[$model->fields['itemtype']])) {
                 $tmp['item'] = $result[$model->fields['itemtype']];
                 $url = Toolbox::getItemTypeFormURL($model->fields['itemtype']) . "?id=" . $result[$model->fields['itemtype']];
                 $tmp['url'] = "<a href='" . $url . "'>" . $result[$model->fields['itemtype']] . "</a>";
             }
             if ($result['status'] == PluginDatainjectionCommonInjectionLib::SUCCESS) {
                 $todisplay[PluginDatainjectionCommonInjectionLib::SUCCESS][] = $tmp;
             } else {
                 $todisplay[PluginDatainjectionCommonInjectionLib::FAILED][] = $tmp;
             }
         }
     }
     return $todisplay;
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:43,代码来源:model.class.php

示例4: keepInfo

 /**
  * @param $info      PluginDatainjectionInfo object
  * @param $value
  **/
 static function keepInfo(PluginDatainjectionInfo $info, $value)
 {
     $itemtype = $info->getInfosType();
     $injectionClass = PluginDatainjectionCommonInjectionLib::getInjectionClassInstance($itemtype);
     $options = $injectionClass->getOptions($itemtype);
     $option = PluginDatainjectionCommonInjectionLib::findSearchOption($options, $info->getValue());
     if ($option) {
         switch ($option['displaytype']) {
             default:
             case 'text':
             case 'multiline_text':
                 if ($value != PluginDatainjectionCommonInjectionLib::EMPTY_VALUE) {
                     return true;
                 }
                 return false;
             case 'dropdown':
             case 'user':
             case 'contact':
                 if ($value != PluginDatainjectionCommonInjectionLib::DROPDOWN_EMPTY_VALUE) {
                     return true;
                 }
                 return false;
         }
     }
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:29,代码来源:info.class.php

示例5: getUsedMappingsOrInfos

 /**
  * @param $options   array
  **/
 static function getUsedMappingsOrInfos($options = array())
 {
     global $DB;
     $p['itemtype'] = self::NO_VALUE;
     $p['primary_type'] = '';
     $p['mapping_or_info'] = array();
     $p['called_by'] = '';
     $p['need_decode'] = true;
     foreach ($options as $key => $value) {
         $p[$key] = $value;
     }
     if ($p['need_decode']) {
         $mapping_or_info = json_decode(Toolbox::stripslashes_deep($options['mapping_or_info']), true);
     } else {
         $mapping_or_info = $options['mapping_or_info'];
     }
     $used = array();
     $table = $p['called_by'] == 'PluginDatainjectionMapping' ? "glpi_plugin_datainjection_mappings" : "glpi_plugin_datainjection_infos";
     $datas = getAllDatasFromTable($table, "`models_id` = '" . $mapping_or_info['models_id'] . "'");
     $injectionClass = PluginDatainjectionCommonInjectionLib::getInjectionClassInstance($p['itemtype']);
     $options = $injectionClass->getOptions();
     foreach ($datas as $data) {
         if ($data['value'] != self::NO_VALUE) {
             foreach ($options as $option) {
                 if (isset($option['table']) && $option['table'] == getItemTypeForTable($data['itemtype']) && $option['linkfield'] == $data['value'] && $option['displaytype'] != 'multiline_text' && $mapping_or_info['value'] != $data['value']) {
                     $used[$option['linkfield']] = $option['linkfield'];
                     break;
                 }
             }
         }
     }
     return $used;
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:36,代码来源:injectiontype.class.php


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