Ejemplo n.º 1
0
<?php

$importConfigID = $_POST['importConfigID'];
$shortName = $_POST['shortName'];
$configuration = $_POST['configuration'];
$orgNameImported = $_POST['orgNameImported'];
$orgNameMapped = $_POST['orgNameMapped'];
if ($importConfigID != '') {
    $instance = new ImportConfig(new NamedArguments(array('primaryKey' => $importConfigID)));
} else {
    $instance = new ImportConfig();
}
$instance->shortName = $shortName;
$instance->configuration = $configuration;
try {
    $instance->save();
} catch (Exception $e) {
    echo $e->getMessage();
}
try {
    //first remove all payment records, then we'll add them back
    $instance->removeOrgNameMappings();
    $orgNameImportedArray = array();
    $orgNameImportedArray = explode(':::', $_POST['orgNameImported']);
    $orgNameMappedArray = array();
    $orgNameMappedArray = explode(':::', $_POST['orgNameMapped']);
    foreach ($orgNameImportedArray as $key => $value) {
        if ($value && $orgNameMapped[$key]) {
            $orgNameMapping = new OrgNameMapping();
            $orgNameMapping->importConfigID = $instance->primaryKey;
            $orgNameMapping->orgNameImported = $orgNameImportedArray[$key];
Ejemplo n.º 2
0
session_start();
include_once 'directory.php';
$pageTitle = _('Resources import');
include 'templates/header.php';
?>
<div id="importPage"><h1><?php 
echo _("Delimited File Import");
?>
</h1>
<?php 
// CSV configuration
$required_columns = array('titleText' => 0, 'resourceURL' => 0, 'resourceAltURL' => 0, 'parentResource' => 0, 'organization' => 0, 'role' => 0);
if ($_POST['submit']) {
    //get necessary configuration instances
    $importConfigInstanceArray = array();
    $instance = new ImportConfig();
    $importConfigInstanceArray = $instance->allAsArray();
    $orgMappingInstance = new OrgNameMapping();
    $orgMappings = array();
    $configuration = json_decode($instance->configuration, true);
    $delimiter = $_POST['delimiter'];
    $uploaddir = 'attachments/';
    $uploadfile = $uploaddir . basename($_FILES['uploadFile']['name']);
    if (move_uploaded_file($_FILES['uploadFile']['tmp_name'], $uploadfile)) {
        print '<p>' . _("The file has been successfully uploaded.") . '</p>';
        // Let's analyze this file
        if (($handle = fopen($uploadfile, "r")) !== FALSE) {
            if (($data = fgetcsv($handle, 0, $delimiter)) !== FALSE) {
                $columns_ok = true;
                foreach ($data as $key => $value) {
                    $available_columns[$value] = $key;
Ejemplo n.º 3
0
<?php

$importConfigID = $_GET['importConfigID'];
$importConfig = new ImportConfig(new NamedArguments(array('primaryKey' => $importConfigID)));
try {
    $importConfig->removeImportConfig();
    echo _("Import configuration successfully deleted.");
} catch (Exception $e) {
    echo $e->getMessage();
}
<?php

$instanceArray = array();
$obj = new ImportConfig();
$instanceArray = $obj->allAsArray();
echo "<div class='adminRightHeader'>" . _("Import Configuration") . "</div>";
if (count($instanceArray) > 0) {
    ?>
			<table  class='linedDataTable' >
				<tr>
				<th><?php 
    echo _("Name");
    ?>
</th>
				<th style='width:20px;'>&nbsp;</th>
				<th style='width:20px;'>&nbsp;</th>
				</tr>
				<?php 
    foreach ($instanceArray as $instance) {
        echo "<tr>";
        echo "<td>" . $instance['shortName'] . "</td>";
        echo "<td><a href='ajax_forms.php?action=getAdminImportConfigUpdateForm&updateID=" . $instance['importConfigID'] . "&height=700&width=1024&modal=true' class='thickbox'><img src='images/edit.gif' alt='edit' title='edit'></a></td>";
        echo "<td><a href='javascript:deleteImportConfig(\"ImportConfig\", \"" . $instance['importConfigID'] . "\");'><img src='images/cross.gif' alt='remove' title='remove'></a></td>";
        echo "</tr>";
    }
    ?>
				<br />
			</table>
			<?php 
} else {
    echo "(none found)<br />";