Ejemplo n.º 1
0
 /**
  * @param $model     PluginDatainjectionModel object
  **/
 static function showAdditionalInformationsForm(PluginDatainjectionModel $model)
 {
     $infos = getAllDatasFromTable('glpi_plugin_datainjection_infos', "`models_id` = '" . $model->getField('id') . "'");
     $table = false;
     $modeltype = PluginDatainjectionModel::getInstance($model->getField('filetype'));
     $modeltype->getFromDBByModelID($model->getField('id'));
     if (count($infos) || $modeltype->haveSample() || $model->fields['comment']) {
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr><th colspan='2'>" . sprintf(__('%1$s (%2$s)'), __('Complementary information', 'datainjection'), __('Choose a file', 'datainjection'));
         echo "</th></tr>\n";
         $table = true;
     }
     if ($modeltype->haveSample()) {
         echo "<tr class='tab_bg_1'>";
         echo "<td colspan='2' class='center'>";
         echo "<a href='" . $model->getFormURL() . "?sample=";
         echo $model->getField('id') . "' class='vsubmit'>" . __('Download file sample', 'datainjection');
         echo "</a></td></tr>\n";
     }
     if ($model->fields['comment']) {
         echo "<tr class='tab_bg_2'>";
         echo "<td colspan='2' class='center'>" . nl2br($model->fields['comment']) . "</td></tr>\n";
     }
     if (count($infos)) {
         $info = new PluginDatainjectionInfo();
         foreach ($infos as $tmp) {
             $info->fields = $tmp;
             echo "<tr class='tab_bg_1'>";
             self::displayAdditionalInformation($info, isset($_SESSION['datainjection']['infos']) ? $_SESSION['datainjection']['infos'] : array());
             echo "</tr>";
         }
     }
     if ($table) {
         echo "</table><br>";
     }
     $options['models_id'] = $model->getField('id');
     $options['confirm'] = 'process';
     PluginDatainjectionClientInjection::showUploadFileForm($options);
     //Store models_id in session for future usage
     $_SESSION['datainjection']['models_id'] = $model->getField('id');
 }
Ejemplo n.º 2
0
/*
 * @version $Id: clientinjection.form.php 581 2011-06-11 09:08:30Z remi $
 LICENSE

 This file is part of the datainjection plugin.

 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
 ---------------------------------------------------------------------- */
include '../../../inc/includes.php';
PluginDatainjectionClientInjection::exportErrorsInCSV();
Ejemplo n.º 3
0
 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     if ($item->getType() == __CLASS__) {
         switch ($tabnum) {
             case 1:
                 $item->showAdvancedForm($item->getID());
                 break;
             case 3:
                 $options['confirm'] = 'creation';
                 $options['models_id'] = $item->fields['id'];
                 $options['add_form'] = true;
                 $options['submit'] = __('Load this file', 'datainjection');
                 PluginDatainjectionClientInjection::showUploadFileForm($options);
                 break;
             case 4:
                 PluginDatainjectionMapping::showFormMappings($item);
                 break;
             case 5:
                 if ($item->fields['step'] > self::MAPPING_STEP) {
                     PluginDatainjectionInfo::showFormInfos($item);
                 }
                 break;
             case 6:
                 if ($item->fields['step'] > self::MAPPING_STEP) {
                     $item->showValidationForm();
                 }
                 break;
         }
     }
     return true;
 }
Ejemplo n.º 4
0
 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'], "injection.php")) {
    include '../../../inc/includes.php';
    header("Content-Type: text/html; charset=UTF-8");
    Html::header_nocache();
}
Session::checkCentralAccess();
$model = unserialize($_SESSION['datainjection']['currentmodel']);
PluginDatainjectionClientInjection::showInjectionForm($model, $_SESSION['glpiactive_entity']);
Ejemplo n.º 5
0
                    //File uploaded successfully and matches the given model : switch to the import tab
                    $_SESSION['datainjection']['file_name'] = $_FILES['filename']['name'];
                    $_SESSION['datainjection']['step'] = PluginDatainjectionClientInjection::STEP_PROCESS;
                    //Store model in session for injection
                    $_SESSION['datainjection']['currentmodel'] = serialize($model);
                    $_SESSION['datainjection']['go'] = true;
                } else {
                    //Got back to the file upload page
                    $_SESSION['datainjection']['step'] = PluginDatainjectionClientInjection::STEP_UPLOAD;
                }
            } else {
                Session::addMessageAfterRedirect(__('The file could not be found', 'datainjection'), true, ERROR, true);
            }
        }
        Html::back();
    } else {
        if (isset($_POST['finish']) || isset($_POST['cancel'])) {
            PluginDatainjectionSession::removeParams();
            Html::redirect(Toolbox::getItemTypeFormURL('PluginDatainjectionClientInjection'));
        } else {
            if (isset($_GET['id'])) {
                // Allow link to a model
                PluginDatainjectionSession::setParam('models_id', $_GET['id']);
            }
            $clientInjection = new PluginDatainjectionClientInjection();
            $clientInjection->title();
            $clientInjection->showForm(0);
        }
    }
}
Html::footer();
Ejemplo n.º 6
0
 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'], "results.php")) {
    include '../../../inc/includes.php';
    header("Content-Type: text/html; charset=UTF-8");
    Html::header_nocache();
}
Session::checkCentralAccess();
$model = unserialize($_SESSION['datainjection']['currentmodel']);
PluginDatainjectionClientInjection::showResultsForm($model);