<?php
/**
 * @package      Easyway Shop
 * @copyright    Copyright (C) 2005 - 2011 TA-EDV
 * @license      proprietary
 * @author       Richard Kammermayer <rk@ta-edv.de>
 * 
 * Program Description:
 * Easyway Shop is an e-commerce system with many features.
 * 
 * File Description:
 * 
 */


class admin_setting_editor {
	
	private $layout_object;
	
	function __construct($base_object, $layout_object) {
		$this->base_object = $base_object;
		$this->layout_object = $layout_object;
	}
	
	public function run() {
		if(isset($_GET['action'])) {
			$action = $_GET['action'];
		} elseif (isset($_POST['action'])) {
			$action = $_POST['action'];
		} else {
			$action = '';
		}

		if($action == 'submit' && isset($_POST['form_data'])) {
			$form_data = $_POST['form_data'];
			$this->base_object->customer->set_config_item('admin_language', $form_data['language']);
			header('Location: '.$_SERVER['REQUEST_URI']);
			exit();
		}

		$this->layout_object->assign('admin_language', $this->base_object->customer->get_config_item('admin_language'));
		$this->layout_object->assign('language_selection', $this->base_object->i18n->admin_language_code_iso639);
		return $this->layout_object->fetch('admin_setting_editor.tpl');

	}
	
}


