<?php

namespace FOPRouter;

class Import {
  
  

  
  

    // --- Statische Methoden ---
  
  public static function mitglied_ImportUploadURL($params = [] ) { 
    
    
    // --- BLOCK: main ---
    
		
		return self::mitglied_ImportUploadURL2($params);
	
    
  }

  public static function mitglied_ImportURL($params = [] ) { 
    
    
    // --- BLOCK: main ---
    
		
		return self::mitglied_ImportURL2($params);
	
    
  }

  public static function mitglied_ImportPrepareURL($id, $encoding = null , $params = [] ) { 
    
    
    // --- BLOCK: main ---
    
		$params['id'] = $id;$params['encoding'] = $encoding;
		return self::mitglied_ImportPrepareURL2($params);
	
    
  }

  public static function mitglied_ImportUploadURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'FOP/Import/mitglied_ImportUpload';
			$isFirst = true;
		}
		foreach ($params AS $k => $v) {
			if (!is_null($v)) {
				$url .= ($isFirst ? '?' : '&') . urlencode($k) . '=' . \FOP\Util::urlencode($v);
				$isFirst = false;
			}
		}
		if (\FOP\Configuration::getFOPUtilEnableRewrite() == 'true' || \FOP\Configuration::getFOPUtilEnableRewrite() == 1) {
			return \FOP\Util::getCurrentBaseurl() . $url;
		} else {
			return \FOP\Util::getCurrentBaseurl() . 'fop-router.php?q=' . urlencode($url);
		}
	
    
  }

  public static function mitglied_ImportURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'FOP/Import/mitglied_Import';
			$isFirst = true;
		}
		foreach ($params AS $k => $v) {
			if (!is_null($v)) {
				$url .= ($isFirst ? '?' : '&') . urlencode($k) . '=' . \FOP\Util::urlencode($v);
				$isFirst = false;
			}
		}
		if (\FOP\Configuration::getFOPUtilEnableRewrite() == 'true' || \FOP\Configuration::getFOPUtilEnableRewrite() == 1) {
			return \FOP\Util::getCurrentBaseurl() . $url;
		} else {
			return \FOP\Util::getCurrentBaseurl() . 'fop-router.php?q=' . urlencode($url);
		}
	
    
  }

  public static function mitglied_ImportPrepareURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'FOP/Import/mitglied_ImportPrepare';
			$isFirst = true;
		}
		foreach ($params AS $k => $v) {
			if (!is_null($v)) {
				$url .= ($isFirst ? '?' : '&') . urlencode($k) . '=' . \FOP\Util::urlencode($v);
				$isFirst = false;
			}
		}
		if (\FOP\Configuration::getFOPUtilEnableRewrite() == 'true' || \FOP\Configuration::getFOPUtilEnableRewrite() == 1) {
			return \FOP\Util::getCurrentBaseurl() . $url;
		} else {
			return \FOP\Util::getCurrentBaseurl() . 'fop-router.php?q=' . urlencode($url);
		}
	
    
  }

  public static function route($q) { 
    
    
    // --- BLOCK: main ---
    
	if (($q == 'mitglied_ImportUpload')) {
		try {
			$result = \FOP\Import::mitglied_ImportUploadAction();
		} catch(\FOP\AccessDeniedException $e){
			\EasyEditor\Errors::render($e->getMessage() ?: 'accessdenied');
			die();
		}
		if (isset($result)) {
			header('Content-Type: application/json'); 
			die(json_encode($result));
		} else {
			die('');
		}
	}if (($q == 'mitglied_Import')) {
		try {
			$result = \FOP\Import::mitglied_ImportAction();
		} catch(\FOP\AccessDeniedException $e){
			\EasyEditor\Errors::render($e->getMessage() ?: 'accessdenied');
			die();
		}
		if (isset($result)) {
			header('Content-Type: application/json'); 
			die(json_encode($result));
		} else {
			die('');
		}
	}if (($q == 'mitglied_ImportPrepare') && isset($_GET['id'])   ) {
		try {
			$result = \FOP\Import::mitglied_ImportPrepareAction($_GET['id'], isset($_GET['encoding']) ? $_GET['encoding'] : null);
		} catch(\FOP\AccessDeniedException $e){
			\EasyEditor\Errors::render($e->getMessage() ?: 'accessdenied');
			die();
		}
		if (isset($result)) {
			header('Content-Type: application/json'); 
			die(json_encode($result));
		} else {
			die('');
		}
	}

	header('HTTP/1.0 404 Not found');
	\EasyEditor\Errors::render('Die angeforderte Funktion wurde nicht gefunden.');
	die();
    
  }

  public static function mitglied_ImportUploadAccess() { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getGruppe())) && ((\FOP\User::getGruppe())) && ((\FOP\User::getGruppe())))) return false;
    // --- BLOCK: main ---
    return true;
    
  }

  public static function mitglied_ImportAccess() { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getGruppe())) && ((\FOP\User::getGruppe())) && ((\FOP\User::getGruppe())))) return false;
    // --- BLOCK: main ---
    return true;
    
  }

  public static function mitglied_ImportPrepareAccess($id, $encoding = null ) { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getGruppe())) && ((\FOP\User::getGruppe())) && ((\FOP\User::getGruppe())))) return false;
    // --- BLOCK: main ---
    return true;
    
  }


  
  

  
  
}



