<?php

namespace TablesRouter;

class SammlungMitglied {
  
  

  
  

    // --- Statische Methoden ---
  
  public static function deleteConfirmURL($id = null , $params = [] ) { 
    
    
    // --- BLOCK: main ---
    
		$params['id'] = $id;
		return self::deleteConfirmURL2($params);
	
    
  }

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

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

  public static function createURL($params = [] , $column_mitglied = null , $column_sammlung = null ) { 
    
    
    // --- BLOCK: main ---
    
		$params['column_mitglied'] = $column_mitglied;$params['column_sammlung'] = $column_sammlung;
		return self::createURL2($params);
	
    
  }

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

  public static function deleteURL($id, $params = [] ) { 
    
    
    // --- BLOCK: main ---
    
		$params['id'] = $id;
		return self::deleteURL2($params);
	
    
  }

  public static function deleteConfirmURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'Tables/SammlungMitglied/deleteConfirm';
			$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 viewURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'Tables/SammlungMitglied/view';
			$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 indexURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'Tables/SammlungMitglied/index';
			$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 == 'deleteConfirm') ) {
		try {
			$result = \Tables\SammlungMitglied::deleteConfirmAction(isset($_GET['id']) ? $_GET['id'] : 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('');
		}
	}if (($q == 'view') ) {
		try {
			$result = \Tables\SammlungMitglied::viewAction(isset($_GET['id']) ? $_GET['id'] : 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('');
		}
	}if (($q == 'create')  ) {
		try {
			$result = \Tables\SammlungMitglied::createAction(isset($_GET['column_mitglied']) ? $_GET['column_mitglied'] : null, isset($_GET['column_sammlung']) ? $_GET['column_sammlung'] : 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('');
		}
	}if (($q == 'edit') ) {
		try {
			$result = \Tables\SammlungMitglied::editAction(isset($_GET['id']) ? $_GET['id'] : 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('');
		}
	}if (($q == 'delete') && isset($_GET['id'])  ) {
		try {
			$result = \Tables\SammlungMitglied::deleteAction($_GET['id']);
		} 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 == 'index' || $q == '')) {
		try {
			$result = \Tables\SammlungMitglied::indexAction();
		} 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 createURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'Tables/SammlungMitglied/create';
			$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 editURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'Tables/SammlungMitglied/edit';
			$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 deleteURL2($params) { 
    
    
    // --- BLOCK: main ---
    
		// Default-URL - kann durch rewrite-Regeln abgeändert werden
		
		if (!isset($url)) {
			$url = 'Tables/SammlungMitglied/delete';
			$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 indexAccess() { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()))) return false;
    // --- BLOCK: main ---
    return true;
    
  }

  public static function deleteConfirmAccess($id = null ) { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getSammlung()) && (\FOP\User::getSammlung())))) return false;
    // --- BLOCK: access-itemlist-sammlungMitglied-delete ---
    
		if ($id !== null && \FOP\Database::query('SELECT SUM(CASE WHEN COALESCE(('.\FOP\Database::quote(\FOP\User::getSammlung()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getSammlung()).') FROM '.qi('sammlung').' '.qi('0Q6Rl41x').' WHERE '.qi('0Q6Rl41x').'.'.qi('ID').' = '.qi('sammlungMitglied').'.'.qi('sammlung').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getSammlung()).'), false) THEN 0 ELSE 1 END) FROM '.qi('sammlungMitglied').' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('ID').''))->fetchColumn() > 0) {
			return false;
		}
	
    // --- BLOCK: main ---
    return true;
    
  }

  public static function viewAccess($id = null ) { 
    
    
    // --- BLOCK: access ---
    if(!(!\FOP\User::getIsGuest())) return false;
    // --- BLOCK: main ---
    return true;
    
  }

  public static function deleteAccess($id) { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getSammlung()) && (\FOP\User::getSammlung())))) return false;
    // --- BLOCK: access-itemlist-sammlungMitglied-delete ---
    
		if (\FOP\Database::query('SELECT SUM(CASE WHEN COALESCE(('.\FOP\Database::quote(\FOP\User::getSammlung()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getSammlung()).') FROM '.qi('sammlung').' '.qi('0Q6Rl41x').' WHERE '.qi('0Q6Rl41x').'.'.qi('ID').' = '.qi('sammlungMitglied').'.'.qi('sammlung').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getSammlung()).'), false) THEN 0 ELSE 1 END) FROM '.qi('sammlungMitglied').' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('ID').''))->fetchColumn() > 0) {
			return false;
		}
	
    // --- BLOCK: main ---
    return true;
    
  }

  public static function createAccess($column_mitglied = null , $column_sammlung = null ) { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && ((\FOP\User::getSammlung()) && (\FOP\User::getSammlung())))) return false;
    // --- BLOCK: access-item-mitglied-select-column_mitglied ---
    
		if ($column_mitglied !== null && $column_mitglied !== null && \FOP\Database::query('SELECT '.(\FOP\User::getIsGuest() ? 'false' : 'true').' FROM '.qi('mitglied').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($column_mitglied))->fetchColumn() != 1) {
			return false;
		}
	
    // --- BLOCK: access-item-sammlung-ZGkQqulb-column_sammlung ---
    
		if ($column_sammlung !== null && $column_sammlung !== null && \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getSammlung()).') FROM '.qi('sammlung').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($column_sammlung))->fetchColumn() != 1) {
			return false;
		}
	
    // --- BLOCK: main ---
    return true;
    
  }

  public static function editAccess($id = null ) { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getSammlung()) && (\FOP\User::getSammlung())))) return false;
    // --- BLOCK: access-item-sammlungMitglied-edit-id ---
    
		if ($id !== null && \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getSammlung()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getSammlung()).') FROM '.qi('sammlung').' '.qi('x8cDLexm').' WHERE '.qi('x8cDLexm').'.'.qi('ID').' = '.qi('sammlungMitglied').'.'.qi('sammlung').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getSammlung()).') FROM '.qi('sammlungMitglied').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() != 1) {
			return false;
		}
	
    // --- BLOCK: main ---
    return true;
    
  }


  
  

  
  
}



