<?php
require_once(SYSTEM_LOGICS . 'admin_user/logic.php');

class ControlAdminUser extends LogicAdminUser {

	/*-------------------------------------------------------------------------
	* @ メンバ変数
	-------------------------------------------------------------------------*/

	/*-------------------------------------------------------------------------
	* @function_name: ロジックのコンストラクタ
	* @parameter	: なし
	* @return		: なし
	-------------------------------------------------------------------------*/
	function __construct() {
		parent::__construct();
	}

	/*-------------------------------------------------------------------------
	* @function_name: コントロールパネルシステム動画データ編集ロジック（各クラス共通）
	* @parameter	: なし
	* @return		: なし
	-------------------------------------------------------------------------*/
	function action() {  
	    $this -> checkAvailability("system", function(){
	        require_once($this -> getSystemHTML('TEMPLATE_MAINTENANCE_MODE_SYSTEM_PATH'));
	        exit();
	    });
	    
	    try{
    		// アクション実行
    		$this -> logic();
    
    		if($this -> getType() == TYPE_EXPORT_ADMIN_FAIL_LIST) {
    			header('Content-Type: application/octet-stream; charset=UTF-8');
    			header('Content-Disposition: attachment; filename=' . $this -> getFailID() . '_fail.csv');
    			header('Content-Transfer-Encoding: binary');
    
    			// 対象ファイルを出力する。
    			readfile(SYSTEM_DOCUMENT_ACCOUNT . 'Failed_Admin_Import' . DIRECTORY_SEPARATOR . $this -> getFailID() . '_fail.csv');
    		} elseif($this -> getType() == TYPE_ADMIN_USER_IMPORT_INPUT) {
    			require_once($this -> getSystemHTML('TEMPLATE_ADMIN_USER_IMPORT_INPUT_PATH', $this -> dispHTML()));
    		} elseif($this -> getType() == TYPE_ADMIN_USER_IMPORT_CONFIRM) {
    			require_once($this -> getSystemHTML('TEMPLATE_ADMIN_USER_IMPORT_CONFIRM_PATH', $this -> dispHTML()));
    		} elseif($this -> getType() == TYPE_ADMIN_IMPORT_FAIL_LIST) {
    			require_once($this -> getSystemHTML('TEMPLATE_ADMIN_USER_IMPORT_FAIL_PATH', $this -> dispHTML()));
    		} elseif($this -> getType() == TYPE_ADMIN_USER_EDIT_INPUT) {
    			require_once($this -> getSystemHTML('TEMPLATE_ADMIN_USER_EDIT_INPUT_PATH', $this -> dispHTML()));
    		} elseif($this -> getType() == TYPE_ADMIN_USER_DETAILS) {
    			require_once($this -> getSystemHTML('TEMPLATE_ADMIN_USER_DETAILS_PATH', $this -> dispHTML()));
    		} elseif($this -> getType() == TYPE_ADMIN_USER_INPUT) {
    			require_once($this -> getSystemHTML('TEMPLATE_ADMIN_USER_INPUT_PATH', $this -> dispHTML()));
    		} else {
    			require_once($this -> getSystemHTML('TEMPLATE_ADMIN_USER_LIST_PATH', $this -> dispHTML()));
    		}
	    } catch(Exception $ex){
	        header("Location: /");
	    }
	}
}
?>