function getDatasForTemplate($event, $options = array()) { global $CFG_GLPI, $DB; $this->datas['##notimported.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']); foreach ($options['notimported'] as $id => $item) { $tmp = array(); $tmp['##notimported.name##'] = $item['name']; $tmp['##notimported.serial##'] = $item['serial']; $tmp['##notimported.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']); $tmp['##notimported.ocsid##'] = $item['ocsid']; $tmp['##notimported.deviceid##'] = $item['ocs_deviceid']; $tmp['##notimported.tag##'] = $item['tag']; $tmp['##notimported.ocsserver##'] = Dropdown::getDropdownName('glpi_plugin_ocsinventoryng_ocsservers', $item['ocsid']); $tmp['##notimported.reason##'] = PluginOcsinventoryngNotimportedcomputer::getReason($item['reason']); $url = $CFG_GLPI["url_base"] . "/index.php?redirect=plugin_ocsinventoryng_" . $item['id']; $tmp['##notimported.url##'] = urldecode($url); $this->datas['notimported'][] = $tmp; } $this->getTags(); foreach ($this->tag_descriptions[NotificationTarget::TAG_LANGUAGE] as $tag => $values) { if (!isset($this->datas[$tag])) { $this->datas[$tag] = $values['label']; } } }
/** * @param $type * @param $id * @param $data * @param $num **/ function plugin_ocsinventoryng_giveItem($type, $id, $data, $num) { global $CFG_GLPI, $DB; $searchopt =& Search::getOptions($type); $table = $searchopt[$id]["table"]; $field = $searchopt[$id]["field"]; switch ("{$table}.{$field}") { case "glpi_plugin_ocsinventoryng_details.action": $detail = new PluginOcsinventoryngDetail(); return $detail->giveActionNameByActionID($data["ITEM_{$num}"]); case "glpi_plugin_ocsinventoryng_details.computers_id": $comp = new Computer(); $comp->getFromDB($data["ITEM_{$num}"]); return "<a href='" . Toolbox::getItemTypeFormURL('Computer') . "?id=" . $data["ITEM_{$num}"] . "'>" . $comp->getName() . "</a>"; case "glpi_plugin_ocsinventoryng_details.plugin_ocsinventoryng_ocsservers_id": $ocs = new PluginOcsinventoryngOcsServer(); $ocs->getFromDB($data["ITEM_{$num}"]); return "<a href='" . Toolbox::getItemTypeFormURL('PluginOcsinventoryngOcsServer') . "?id=" . $data["ITEM_{$num}"] . "'>" . $ocs->getName() . "</a>"; case "glpi_plugin_ocsinventoryng_details.rules_id": $detail = new PluginOcsinventoryngDetail(); $detail->getFromDB($data['id']); return PluginOcsinventoryngNotimportedcomputer::getRuleMatchedMessage($detail->fields['rules_id']); case "glpi_plugin_ocsinventoryng_notimportedcomputers.reason": return PluginOcsinventoryngNotimportedcomputer::getReason($data["ITEM_{$num}"]); } return ''; }