shop-old/core/old/import.class.php
2026-04-20 01:03:43 +02:00

114 lines
2.3 KiB
PHP

<?php
/*
* @version $Id: index.php 10381 2008-06-01 03:35:53Z $
* @package Carteasy
* @copyright Copyright (C) 2005 - 2011 Wlanium
* @license proprietary
* @author Thomas Bartelt
* Carteasy is a web shop system
*/
include_once './core/main.class.php';
class Import extends Main {
public $list_table_config = array (
'title' => 'Import',
'db_table' => 'import',
'list_fields' => array(
array(
'db_field' => 'name',
'name' => 'Name',
'sortable' => 1
),
array(
'db_field' => 'count_imported_items',
'name' => 'Importierte Datensätze',
'sortable' => 1
),
array(
'db_field' => 'last_import_date',
'name' => 'Letzter Import',
'sortable' => 1
)
),
'search_fields' => array('name'),
'db_id_field' => 'id',
'edit_link' => 'index.php?admin_modul=admin_import_editor&id=',
'toolbar' => array(
'delete' => '0',
'new' => '',
'copy' => 0,
'select_all' => 1,
'edit' => 0,
'actions' => 0,
'filter' => 0,
'search' => 1
)
);
private $object_fields = array(
'name' => 'text',
'customer_group_id' =>'integer',
'all_item_groups' => 'integer',
'export_filter' => 'text',
'count_exported_items' => 'integer'
);
protected $base_object;
protected $db;
function __construct($base_object) {
parent::__construct($base_object);
$this->db = $base_object->db;
$this->base_object = $base_object;
} // end __construct
public function get_all() {
$sql = "SELECT * FROM export";
$result = $this->db->query($sql);
$data = array();
while ($obj = $result->fetch_object()) {
$data[$obj->id] = $obj;
}
return $data;
} // end get_all
public function get_data() {
if ($this->id) {
$sql = "SELECT * FROM import WHERE id = ".$this->id;
$result = $this->db->query($sql);
$obj = $result->fetch_object();
return $obj;
}
return false;
} // end get_data
public function save_file($id, $element_name) {
// get import modul data
$this->id=$id;
$data = $this->get_data();
$import_modul = $data->import_filter;
// save file
if (move_uploaded_file($_FILES['Filedata']['tmp_name'], ROOT_DIR.'tmp/import/'.basename($_FILES['Filedata']['name']))) {
$log_object = Logger::get_instance();
// load import modul
include_once './core/import_filter/'.$import_modul;
//return
return true;
} else {
return false;
}
}
} // end Export
?>