Exemplo n.º 1
0
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with yourCMDB.  If not, see <http://www.gnu.org/licenses/>.
*
*********************************************************************/
/**
* WebUI element: import from file after preview
* @author Michael Batz <*****@*****.**>
*/
use yourCMDB\fileimporter\Importer;
use yourCMDB\fileimporter\FileImportException;
use yourCMDB\fileimporter\FileImportOptionsRequiredException;
//required parameters: $paramFilename, $paramFormat, $importOptions
//get number of objects to import
$fileImporter = new Importer($paramFilename, $paramFormat, $importOptions, $authUser);
try {
    $countObjectsToImport = $fileImporter->getObjectsToImportCount();
    //start: panel
    echo "<div class=\"container\">";
    echo "<div class=\"panel panel-default cmdb-contentpanel\">";
    //panel headline
    echo "<div class=\"panel-heading\">";
    echo "<h3 class=\"panel-title text-center\">";
    echo gettext("Importing objects...");
    echo "</h3>";
    echo "</div>";
    //start panel content
    echo "<div class=\"panel-body\">";
    //load worker
    $data = $_POST;
Exemplo n.º 2
0
*
* yourCMDB 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 yourCMDB.  If not, see <http://www.gnu.org/licenses/>.
*
*********************************************************************/
/**
* WebUI element: import from file after preview
* @author Michael Batz <*****@*****.**>
*/
use yourCMDB\fileimporter\Importer;
use Exception;
//required parameters: $paramFilename, $paramFormat, $importOptions
$fileImporter = new Importer($paramFilename, $paramFormat, $importOptions, $authUser);
$output = 0;
try {
    //get data for preview
    $output = $fileImporter->import();
} catch (Exception $e) {
    //print error
    $output = gettext("Error importing objects");
}
//output
echo $output;
?>

Exemplo n.º 3
0
*
*********************************************************************/
/**
* WebUI element: preview of import
* @author Michael Batz <*****@*****.**>
*/
use yourCMDB\fileimporter\Importer;
use yourCMDB\fileimporter\FileImportException;
use yourCMDB\fileimporter\FileImportOptionsRequiredException;
//required parameters: $paramFilename, $paramFormat, $importOptions
//save uploaded file in temp directory
if ($paramFilename == "") {
    $paramFilename = "../tmp/" . time() . ".import";
    move_uploaded_file($_FILES['file']['tmp_name'], $paramFilename);
}
$fileImporter = new Importer($paramFilename, $paramFormat, $importOptions, $authUser);
$previewData = null;
try {
    //get data for preview
    $previewData = $fileImporter->getPreviewData();
    //show import options page for import format
    switch ($paramFormat) {
        case "ImportFormatCsv":
            include "formats/PreviewCsv.php";
            break;
    }
} catch (FileImportException $e) {
    //print error
    $paramError = gettext("Could not read from uploaded file. Please check permissions.");
    include "Form.php";
}
Exemplo n.º 4
0
* yourCMDB 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 yourCMDB.  If not, see <http://www.gnu.org/licenses/>.
*
*********************************************************************/
/**
* WebUI element: import actions
* @author Michael Batz <*****@*****.**>
*/
use yourCMDB\fileimporter\Importer;
//get import and export formats
$importFormats = Importer::getInputFormats();
$exportFormats = $config->getDataExchangeConfig()->getExportFormats();
//get objecttypes
$objectTypes = $config->getObjectTypeConfig()->getObjectTypeGroups();
//print messagebar
include "include/messagebar.inc.php";
//start: panel
echo "<div class=\"container\">";
echo "<div class=\"panel panel-default cmdb-contentpanel\">";
//panel headline
echo "<div class=\"panel-heading\">";
echo "<h3 class=\"panel-title text-center\">";
echo gettext("Import and Export");
echo "</h3>";
echo "</div>";
//start panel content