/** * * Display additional information form from Model form * @param PluginDatainjectionModel $model */ static function showFormInfos(PluginDatainjectionModel $model) { $canedit = $model->can($model->fields['id'], UPDATE); self::showAddInfo($model, $canedit); $model->loadInfos(); $nb = count($model->getInfos()); if ($nb > 0) { echo "<form method='post' name='info_form' id='info_form' action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr>"; if ($canedit) { echo "<th> </th>"; } echo "<th>" . __('Tables', 'datainjection') . "</th>"; echo "<th>" . __('Fields', 'datainjection') . "</th>"; echo "<th>" . __('Mandatory information', 'datainjection') . "</th>"; echo "</tr>"; foreach ($model->getInfos() as $info) { $info->fields = Toolbox::stripslashes_deep($info->fields); $infos_id = $info->fields['id']; echo "<tr class='tab_bg_1'>"; if ($canedit) { echo "<td width='10'>"; $sel = ""; if (isset($_GET["select"]) && $_GET["select"] == "all") { $sel = "checked"; } echo "<input type='checkbox' name='item[" . $infos_id . "]' value='1' {$sel}>"; echo "</td>"; } echo "<td class='center'>"; $rand = PluginDatainjectionInjectionType::dropdownLinkedTypes($info, array('primary_type' => $model->fields['itemtype'])); echo "</td>"; echo "<td class='center'><span id='span_field_{$infos_id}'></span></td>"; echo "<td class='center'><span id='span_mandatory_{$infos_id}'></span></td></tr>"; } if ($canedit) { echo "<tr>"; echo "<td class='tab_bg_2 center' colspan='4'>"; echo "<input type='hidden' name='models_id' value='" . $model->fields['id'] . "'>"; echo "<input type='submit' name='update' value='" . _sx('button', 'Save') . "' class='submit'>"; echo "</td></tr>"; Html::openArrowMassives("info_form", true); Html::closeArrowMassives(array('delete' => __('Delete permanently'))); } echo "</table>"; Html::closeForm(); } }
/** * @param $model PluginDatainjectionModel object **/ static function showFormMappings(PluginDatainjectionModel $model) { global $CFG_GLPI; $canedit = $model->can($model->fields['id'], UPDATE); if (isset($_SESSION['datainjection']['lines'])) { $lines = unserialize($_SESSION['datainjection']['lines']); } else { $lines = array(); } echo "<form method='post' name=form action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>"; //Display link to the preview popup if (isset($_SESSION['datainjection']['lines']) && !empty($lines)) { $nblines = $_SESSION['datainjection']['nblines']; echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_1'><td class='center'>"; $url = $CFG_GLPI["root_doc"] . "/plugins/datainjection/front/popup.php?popup=preview&models_id=" . $model->getID(); echo "<a href=# onClick=\"var w = window.open('{$url}' , 'glpipopup', " . "'height=400, width=600, top=100, left=100, scrollbars=yes' );w.focus();\"/>"; echo __('See the file', 'datainjection') . "</a>"; echo "</td></tr>"; } echo "<table class='tab_cadre_fixe'>"; echo "<tr>"; echo "<th>" . __('Header of the file', 'datainjection') . "</th>"; echo "<th>" . __('Tables', 'datainjection') . "</th>"; echo "<th>" . _n('Field', 'Fields', 2) . "</th>"; echo "<th>" . __('Link field', 'datainjection') . "</th>"; echo "</tr>"; $model->loadMappings(); foreach ($model->getMappings() as $mapping) { $mapping->fields = Toolbox::stripslashes_deep($mapping->fields); $mappings_id = $mapping->getID(); echo "<tr class='tab_bg_1'>"; echo "<td class='center'>" . $mapping->fields['name'] . "</td>"; echo "<td class='center'>"; $options = array('primary_type' => $model->fields['itemtype']); PluginDatainjectionInjectionType::dropdownLinkedTypes($mapping, $options); echo "</td>"; echo "<td class='center'><span id='span_field_{$mappings_id}'>"; echo "</span></td>"; echo "<td class='center'><span id='span_mandatory_{$mappings_id}'></span></td>"; } if ($canedit) { echo "<tr> <td class='tab_bg_2 center' colspan='4'>"; echo "<input type='hidden' name='models_id' value='" . $model->fields['id'] . "'>"; echo "<input type='submit' name='update' value='" . _sx('button', 'Save') . "' class='submit'>"; echo "</td></tr>"; } echo "</table>"; Html::closeForm(); }
function showAdvancedForm($ID, $options = array()) { if ($ID > 0) { $this->check($ID, READ); } else { // Create item $this->check(-1, UPDATE); $this->getEmpty(); echo Html::hidden('step', array('value' => 1)); } echo "<form name='form' method='post' action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>"; echo "<div class='center' id='tabsbody'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr><th colspan='2'>" . self::getTypeName() . "</th>"; echo "<th colspan='2'>" . PluginDatainjectionDropdown::getStatusLabel($this->fields['step']) . "</th></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td><input type='hidden' name='users_id' value='" . Session::getLoginUserID() . "'>" . __('Name') . "</td>"; echo "<td>"; Html::autocompletionTextField($this, "name"); echo "</td>"; echo "<td colspan='2'></td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td colspan='4' class='center'>"; Dropdown::showPrivatePublicSwitch($this->fields["is_private"], $this->fields["entities_id"], $this->fields["is_recursive"]); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Comments') . "</td>"; echo "<td colspan='3' class='middle'>"; echo "<textarea cols='45' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>"; echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Type of datas to import', 'datainjection') . "</td>"; echo "<td>"; if ($this->fields['step'] == '' || $this->fields['step'] == self::INITIAL_STEP) { //Get only the primary types PluginDatainjectionInjectionType::dropdown($this->fields['itemtype'], true); } else { $itemtype = new $this->fields['itemtype'](); echo $itemtype->getTypeName(); } echo "</td><td colspan='2'></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Allow lines creation', 'datainjection') . "</td>"; echo "<td>"; Dropdown::showYesNo("behavior_add", $this->fields['behavior_add']); echo "</td><td>" . __('Allow lines update', 'datainjection') . "</td>"; echo "<td>"; Dropdown::showYesNo("behavior_update", $this->fields['behavior_update']); echo "</td></tr>"; echo "<tr class='tab_bg_1'><th colspan='4'>" . __('Advanced options', 'datainjection') . "</th></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Allow creation of dropdowns', 'datainjection') . "</td>"; echo "<td>"; Dropdown::showYesNo("can_add_dropdown", $this->fields['can_add_dropdown']); echo "</td>"; echo "<td>" . __('Dates format', 'datainjection') . "</td>"; echo "<td>"; Dropdown::showFromArray('date_format', PluginDatainjectionDropdown::dateFormats(), array('value' => $this->fields['date_format'])); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Allow update of existing fields', 'datainjection') . "</td>"; echo "<td>"; Dropdown::showYesNo("can_overwrite_if_not_empty", $this->fields['can_overwrite_if_not_empty']); echo "</td>"; echo "<td>" . __('Float format', 'datainjection') . "</td>"; echo "<td>"; Dropdown::showFromArray('float_format', PluginDatainjectionDropdown::floatFormats(), array('value' => $this->fields['float_format'])); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Try to establish network connection is possible', 'datainjection') . "</td>"; echo "<td>"; Dropdown::showYesNo("perform_network_connection", $this->fields['perform_network_connection']); echo "</td>"; echo "<td>" . __('Port unicity criteria', 'datainjection') . "</td>"; echo "<td>"; Dropdown::showFromArray('port_unicity', PluginDatainjectionDropdown::portUnicityValues(), array('value' => $this->fields['port_unicity'])); echo "</td></tr>"; if ($ID > 0) { $tmp = self::getInstance('csv'); $tmp->showAdditionnalForm($this); } $this->showFormButtons($options); return true; }
Datainjection plugin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Datainjection plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with datainjection. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- @package datainjection @author the datainjection plugin team @copyright Copyright (c) 2010-2013 Datainjection plugin team @license GPLv2+ http://www.gnu.org/licenses/gpl.txt @link https://forge.indepnet.net/projects/datainjection @link http://www.glpi-project.org/ @since 2009 ---------------------------------------------------------------------- */ // Direct access to file if (strpos($_SERVER['PHP_SELF'], "dropdownChooseField.php")) { include '../../../inc/includes.php'; header("Content-Type: text/html; charset=UTF-8"); Html::header_nocache(); } Session::checkCentralAccess(); PluginDatainjectionInjectionType::dropdownFields($_POST);
Datainjection plugin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Datainjection plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with datainjection. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- @package datainjection @author the datainjection plugin team @copyright Copyright (c) 2010-2013 Datainjection plugin team @license GPLv2+ http://www.gnu.org/licenses/gpl.txt @link https://forge.indepnet.net/projects/datainjection @link http://www.glpi-project.org/ @since 2009 ---------------------------------------------------------------------- */ // Direct access to file if (strpos($_SERVER['PHP_SELF'], "dropdownMandatory.php")) { include '../../../inc/includes.php'; header("Content-Type: text/html; charset=UTF-8"); Html::header_nocache(); } Session::checkCentralAccess(); PluginDatainjectionInjectionType::showMandatoryCheckBox($_POST);
static function methodListItemtypes($params, $protocol) { if (isset($params['help'])) { return array('help' => 'bool,optional'); } if (!isset($_SESSION['glpiID'])) { return self::Error($protocol, WEBSERVICES_ERROR_NOTAUTHENTICATED); } return PluginDatainjectionInjectionType::getItemtypes(); }