Initial import: Carteasy Shop (Dev-Stand)
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: admin_gift_certificate_editor.php
|
||||
* @package Easyshop
|
||||
* @copyright Copyright (C) 2005 - 2011 TA-EDV
|
||||
* @license proprietary
|
||||
* @author Richard Kammermayer <rkd@ta-edv.de>
|
||||
* Easyshop is a web shop system
|
||||
*/
|
||||
|
||||
include_once './core/gift_certificate.class.php';
|
||||
include_once './core/customer_group.class.php';
|
||||
include_once './core/structure.class.php';
|
||||
|
||||
class admin_gift_certificate_editor {
|
||||
private $base_object;
|
||||
private $layout_object;
|
||||
private $gift_certificate;
|
||||
|
||||
function __construct($base_object, $layout_object) {
|
||||
$this->base_object = $base_object;
|
||||
$this->layout_object = $layout_object;
|
||||
$this->gift_certificate = new Gift_certificate($base_object);
|
||||
} // end __construct
|
||||
|
||||
function run() {
|
||||
if(isset($_GET['id']) && $_GET['id']) {
|
||||
$has_id = true;
|
||||
} else if(isset($_POST['id']) && $_POST['id']) {
|
||||
$has_id = true;
|
||||
} else {
|
||||
$has_id = false;
|
||||
}
|
||||
|
||||
if(isset($_POST['submit'])) {
|
||||
$is_submitted = true;
|
||||
} else {
|
||||
$is_submitted = false;
|
||||
}
|
||||
|
||||
|
||||
// get customer groups
|
||||
$customer_group_object = new Customer_group($this->base_object);
|
||||
$customer_groups = $customer_group_object->get_all_groups();
|
||||
$this->layout_object->assign('customer_groups', $customer_groups);
|
||||
|
||||
// get all structure tree
|
||||
$structure_object = new Structure($this->base_object);
|
||||
$structure_tree = $structure_object->get_all_tree_full_path();
|
||||
$this->layout_object->assign('structure_tree', $structure_tree);
|
||||
|
||||
// create
|
||||
if($is_submitted && !$has_id) {
|
||||
$form_data = $this->gift_certificate->data_filter($_POST['form_field']);
|
||||
$this->gift_certificate->create($form_data);
|
||||
$data = $this->gift_certificate->get_data();
|
||||
$this->layout_object->assign('form_data', $data);
|
||||
}// read
|
||||
elseif($has_id && !$is_submitted && $_GET['mod'] != 'delete') {
|
||||
// template variable name
|
||||
$this->gift_certificate->id = $_GET['id'];
|
||||
$data = $this->gift_certificate->get_data();
|
||||
$this->layout_object->assign('form_data', $data);
|
||||
} // update
|
||||
elseif($has_id && $is_submitted && $_GET['mod'] != 'delete') {
|
||||
$this->gift_certificate->id = $_POST['id'];
|
||||
$data = $this->gift_certificate->data_filter($_POST['form_field']);
|
||||
$this->gift_certificate->update($data);
|
||||
$data = $this->gift_certificate->get_data();
|
||||
$this->layout_object->assign('form_data', $data);
|
||||
} // delete
|
||||
elseif($has_id && isset($_GET['mod']) && $_GET['mod'] == 'delete'){
|
||||
$this->gift_certificate->id = $_GET['id'];
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
return $this->layout_object->fetch('admin_gift_certificate_editor.tpl');
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // end admin_manufacturer_editor
|
||||
Reference in New Issue
Block a user