remove controllers, views and libraries for CisHmvc since not used

This commit is contained in:
Harald Bamberger
2024-11-05 16:48:30 +01:00
parent 8316290b31
commit 39cedfe6a0
11 changed files with 0 additions and 1094 deletions
-319
View File
@@ -1,319 +0,0 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
use \DOMDocument as DOMDocument;
/**
*
*/
class CisHmvc extends Auth_Controller
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct(
array(
'index' => 'basis/cis:r'
)
);
$this->load->model('content/Content_model', 'ContentModel');
}
// -----------------------------------------------------------------------------------------------------------------
// Public methods
/**
* @param string $method
*
* @return void
*/
public function _remap($method)
{
$this->index();
}
/**
* @return void
*/
public function index()
{
// TODO(chris): CI can't handle empty ("//") parameters
$path = explode('/', uri_string());
array_shift($path); // NOTE(chris): remove cis4/
$menu = $this->ContentModel->getMenu(6739, getAuthUID());
if (isError($menu)) {
// TODO(chris): Error Handling
return $this->load->view('CisHmvc/Error', ['error' => getError($menu)]);
}
$menu = getData($menu) ?? (object)['childs' => []];
$menu = $this->convertMenu($menu->childs, $path, APP_ROOT . 'index.ci.php/CisHmvc');
$current = ['childs' => $menu];
$params = $path;
foreach ($path as $key) {
if (!isset($current['childs'][$key])) {
if ($current['childs'] == $menu)
$current = null;
break;
}
$current = $current['childs'][$key];
array_shift($params);
}
if (!$current) {
return $this->notfound();
}
if (!$path)
{
$controller = 'CisHmvc/Dashboard';
$action = 'index';
}
else
{
switch ($current['orig']->template_kurzbz) {
case 'redirect':
list ($url, $target) = $this->getRedirectUrlAndTarget($current['orig']->content);
if (substr($url, 0, 1) == '#')
{
$controller = 'CisHmvc';
$action = 'notfound';
break;
}
if ($target)
{
$controller = 'CisHmvc';
$action = 'redirect';
array_unshift($params, $url);
break;
}
if (preg_match('/^(\.\.\/|\.\/)*index\.ci\.php\/(.*)$/', $url, $matches))
{
list ($controller, $action, $p) = $this->getControllerMethodAndParamsFromUrl($matches[2]);
if (!$controller)
{
$controller = 'CisHmvc';
$action = 'notfound';
}
else
{
while (count($p))
array_unshift($params, array_pop($p));
}
break;
}
if (preg_match('/^(\.\.\/|\.\/)*cms\/news\.php(.*)$/', $url, $matches))
{
$controller = 'CisHmvc/Cms';
$action = 'news';
$p = parse_url($url . '?infoscreen=0', PHP_URL_QUERY);
if ($p)
{
parse_str($p, $p);
$params += array_values(array_merge([
'infoscreen' => false,
'studiengang_kz' => null,
'semester' => null,
'mischen' => true,
'titel' => '',
'edit' => false,
'sichtbar' => true
], $p));
}
break;
}
if (preg_match('/^(\.\.\/|\.\/)*(addons|cms|cis)\/(.*)$/', $url, $matches))
{
$controller = 'CisHmvc/Cms';
$action = 'legacy';
array_unshift($params, $matches[2] . "/" . $matches[3]);
break;
}
$controller = 'CisHmvc/cms';
$action = 'debug';
array_unshift($params, $current['orig']);
break;
case 'contentohnetitel':
case 'contentmittitel':
$controller = 'CisHmvc/Cms';
$action = 'content';
array_unshift($params, $current['orig']->content_id);
break;
default:
$controller = 'CisHmvc/Cms';
$action = 'debug';
array_unshift($params, $current['orig']);
break;
}
}
$className = ucfirst(basename($controller));
$path = APPPATH . 'controllers/' . dirname($controller) . '/' . $className . '.php';
#var_dump(is_loaded());
require_once $path;
foreach (is_loaded() as $k => $v)
if (!in_array($k, ['benchmark','hooks','config','log','utf8','uri','router','output','security','input','lang','loader']))
unset(is_loaded()[$k]);
$this->router->directory = dirname($controller) . '/';
$this->router->class = $className;
$this->router->method = $action;
#var_dump($this->router->method);
$controller = new $className();
// NOTE(chris): this is needed because we loaded it in this controller and it can't be loaded twice
$controller->ContentModel = $this->ContentModel;
$this->load->library('CisHmvc/Loader', [$menu, $this->load], 'Cis4Loader');
$controller->load = $controller->Cis4Loader;
call_user_func_array(array(&$controller, $action), $params);
}
/**
* @return void
*/
public function notfound()
{
set_status_header(404);
$this->load->view('CisHmvc/Error', ['error' => '404: Site Not Found']);
}
/**
* @param uri_string $url
*
* @return void
*/
public function redirect($url)
{
redirect($url);
}
// -----------------------------------------------------------------------------------------------------------------
// Protected methods (move to lib?)
protected function getControllerMethodAndParamsFromUrl($url)
{
$segments = explode('/', $url);
$path = '';
while ($possibleController = array_shift($segments)) {
if (file_exists(APPPATH . 'controllers/' . $path . ucfirst($possibleController) . '.php'))
return [$path . $possibleController, array_shift($segments) ?: 'index', $segments];
$path .= $possibleController . '/';
}
return [null, null, null];
}
protected function getRedirectUrlAndTarget($content)
{
if (!$content)
return ['#', ''];
$url = '';
$target = '';
$xml = new DOMDocument();
$xml->loadXML($content);
if ($xml->getElementsByTagName('url')->item(0))
$url = $xml->getElementsByTagName('url')->item(0)->nodeValue;
// TODO(chris): get params
/*if (strpos($url, '$') !== FALSE)
var_dump($url);*/
if (isset($params) && is_array($params))
foreach ($params as $key => $value)
$url = str_replace('$' . $key, addslashes($value), $url);
if ($xml->getElementsByTagName('target')->item(0))
$target = $xml->getElementsByTagName('target')->item(0)->nodeValue;
if (!$url)
$url = '#';
if (substr($url, 0, 1) == '#')
$target = '';
if ($target == 'content' || $target == '_self')
$target = '';
return [$url, $target];
}
protected function convertMenu($items, $path, $path_prefix)
{
$menu = [];
$current_path = array_shift($path);
foreach ($items as $item)
{
$entry = [];
$entry['template_kurzbz'] = 'cis';
$entry['content_id'] = $item->content_id;
$entry['titel'] = $item->titel;
$slug = $this->createSlug($item->titel);
$entry['active'] = ($slug == $current_path);
$entry['menu_open'] = $entry['active'];
$entry['url'] = $path_prefix . '/' . $slug;
$entry['target'] = '';
$entry['childs'] = $this->convertMenu($item->childs, $path, $entry['url']);
if ($entry['active'])
$entry['orig'] = $item;
// TODO(chris): rewrite external and hash urls
if ($item->template_kurzbz == 'redirect')
{
list ($url, $target) = $this->getRedirectUrlAndTarget($item->content);
if (substr($url, 0, 1) == '#')
{
$entry['url'] = $url;
}
elseif ($target)
{
$entry['url'] = $url;
$entry['target'] = $target;
}
/*elseif (substr($url, 0, 7) != '../cis/' && substr($url, 0, 7) != '../cms/' && substr($url, 0, 10) != '../addons/' && substr($url, 0, 16) != '../index.ci.php/' && substr($url, 0, 1) != '?')
{
var_dump($entry['url']);
}*/
}
$menu[$slug] = $entry;
}
return $menu;
}
/**
* Function used to create a slug associated to an "ugly" string.
*
* @param string $text the string to transform.
*
* @return string the resulting slug.
*/
protected function createSlug($text)
{
$table = [
'Š'=>'S', 'š'=>'s', 'Đ'=>'Dj', 'đ'=>'dj', 'Ž'=>'Z', 'ž'=>'z', 'Č'=>'C', 'č'=>'c', 'Ć'=>'C', 'ć'=>'c',
'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'Ae', 'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E',
'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O',
'Õ'=>'O', 'Ö'=>'Oe', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'Ue', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'Ss',
'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'ae', 'å'=>'a', 'æ'=>'a', 'ç'=>'c', 'è'=>'e', 'é'=>'e',
'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i', 'ð'=>'o', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o',
'ô'=>'o', 'õ'=>'o', 'ö'=>'oe', 'ø'=>'o', 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ü'=>'ue', /*'ý'=>'y', duplicate? => see quality check*/'ý'=>'y', 'þ'=>'b',
'ÿ'=>'y', 'Ŕ'=>'R', 'ŕ'=>'r', '/' => '-', ' ' => '-'
];
$text = preg_replace(['/\s{2,}/', '/[\t\n]/'], ' ', $text);
$text = preg_replace('~[^\pL\d]+~u', '-', $text);
$text = strtr($text, $table);
$text = preg_replace('~^[^a-z]~i', '', $text);
return strtolower($text);
}
}
-115
View File
@@ -1,115 +0,0 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
/**
*
*/
class Cms extends Auth_Controller
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct(
array(
'debug' => 'user:r',
'legacy' => 'user:r',
'content' => 'user:r',
'news' => 'user:r'
)
);
// Loads WidgetLib
$this->load->library('CmsLib');
#$this->load->library('WidgetLib');
// Loads phrases system
$this->loadPhrases([
'global'
]);
}
// -----------------------------------------------------------------------------------------------------------------
// Public methods
/**
* @param stdClass $content
*
* @return void
*/
public function debug($content)
{
$msg = $content->template_kurzbz . ' not yet implemented';
if ($content->template_kurzbz == 'redirect') {
$msg .= '<pre class="card p-1 mt-3">' . htmlentities($content->content) . '</pre>';
}
$this->load->view('CisHmvc/Error', ['error' => $msg]);
}
/**
* @param string $url
*
* @return void
*/
public function legacy($url)
{
$this->load->view('CisHmvc/Cms/Legacy', ['url' => $url]);
}
/**
* @param int $content_id
* @param int $version
* @param string $sprache
* @param boolean $sichtbar
*
* @return void
*/
public function content($content_id, $version = null, $sprache = null, $sichtbar = true)
{
// return early if the content_id for the content is missing
if(!isset($content_id))
$this->terminateWithError("content_id is missing");
$content = $this->ContentModel->load($content_id);
if (isError($content))
$this->terminateWithError(getError($content));
$content = getData($content);
if(NULL === $content)
$this->terminateWithError("Content not found");
$content = current($content);
$this->load->view('CisVue/Cms/Content', ['content_id' => $content_id, 'template_kurzbz'=>$content->template_kurzbz , 'version' => $version, 'sprache' => $sprache, 'sichtbar' => $sichtbar]);
}
/**
* @param boolean $infoscreen
* @param string | null $studiengang_kz
* @param int | null $semester
* @param boolean $mischen
* @param string $titel
* @param boolean $edit
* @param boolean $sichtbar
*
* @return void
*/
/**
* @param boolean $infoscreen
* @param string | null $studiengang_kz
* @param int | null $semester
* @param boolean $mischen
* @param string $titel
* @param boolean $edit
* @param boolean $sichtbar
*
* @return void
*/
public function news($infoscreen = false, $studiengang_kz = null, $semester = null, $mischen = true, $titel = '', $edit = false, $sichtbar = true)
{
$this->load->view('CisHmvc/Cms/Content', ['infoscreen' => $infoscreen, 'studiengang_kz' => $studiengang_kz, 'semester' => $semester, 'mischen' => $mischen, 'titel' => $titel, 'edit' => $edit, 'sichtbar' => $sichtbar, "template_kurzbz"=>"news"]);
}
}
@@ -1,32 +0,0 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
*/
class Dashboard extends Auth_Controller
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct(
array(
'index' => 'dashboard/benutzer:r'
)
);
}
// -----------------------------------------------------------------------------------------------------------------
// Public methods
/**
* @return void
*/
public function index()
{
$this->load->view('CisHmvc/Dashboard.php');
}
}
-420
View File
@@ -1,420 +0,0 @@
<?php
defined('BASEPATH') || exit('No direct script access allowed');
/**
* Description of Cis4Loader
*
* @author chris
*/
class Loader extends CI_Loader
{
const OVERWRITE_PARAMS = [
'vue3' => true,
'bootstrap5' => true,
'bootstrap3' => false,
'fontawesome6' => true,
'fontawesome4' => false,
'axios027' => true,
'customJSModules' => [
'public/js/apps/Cis.js'
],
'customCSSs' => [
'public/css/Cis4/Cis.css'
]
];
protected $coreOptions = null;
protected $loader = null;
public function __construct($params)
{
$this->loader = $params[1];
$this->coreOptions = ['menu' => $params[0]];
}
/**
* View Loader
*
* Loads "view" files.
*
* @param string $view View name
* @param array $vars An associative array of data
* to be extracted for use in the view
* @param bool $return Whether to return the view output
* or leave it to the Output class
* @return object|string
*/
public function view($view, $vars = array(), $return = FALSE)
{
if ($view == 'templates/FHC-Header' || $view == 'templates/FHC-Footer')
{
$overwrittenParams = array_merge($vars, self::OVERWRITE_PARAMS);
foreach (['customJSModules', 'customCSSs'] as $key)
if (isset($vars[$key]))
$overwrittenParams[$key] = array_merge(self::OVERWRITE_PARAMS[$key], $vars[$key]);
if ($view == 'templates/FHC-Header')
{
$view1 = $view;
$param1 = $overwrittenParams;
$view2 = 'templates/CISHMVC-Header';
$param2 = $this->coreOptions;
}
else
{
$view1 = 'templates/CISHMVC-Footer';
$param1 = $this->coreOptions;
$view2 = $view;
$param2 = $overwrittenParams;
}
if ($return)
return $this->loader->view($view1, $param1, $return) . $this->loader->view($view2, $param2, $return);
$this->loader->view($view1, $param1, $return);
$this->loader->view($view2, $param2, $return);
}
else
{
return $this->loader->view($view, $vars, $return);
}
}
/**
* Initializer
*
* @todo Figure out a way to move this to the constructor
* without breaking *package_path*() methods.
* @uses CI_Loader::_ci_autoloader()
* @used-by CI_Controller::__construct()
* @return void
*/
public function initialize()
{
$this->loader->initialize();
}
// --------------------------------------------------------------------
/**
* Is Loaded
*
* A utility method to test if a class is in the self::$_ci_classes array.
*
* @used-by Mainly used by Form Helper function _get_validation_object().
*
* @param string $class Class name to check for
* @return string|bool Class object name if loaded or FALSE
*/
public function is_loaded($class)
{
return $this->loader->is_loaded($class);
}
// --------------------------------------------------------------------
/**
* Library Loader
*
* Loads and instantiates libraries.
* Designed to be called from application controllers.
*
* @param mixed $library Library name
* @param array $params Optional parameters to pass to the library class constructor
* @param string $object_name An optional object name to assign to
* @return object
*/
public function library($library, $params = NULL, $object_name = NULL)
{
$this->loader->library($library, $params, $object_name);
return $this;
}
// --------------------------------------------------------------------
/**
* Model Loader
*
* Loads and instantiates models.
*
* @param mixed $model Model name
* @param string $name An optional object name to assign to
* @param bool $db_conn An optional database connection configuration to initialize
* @return object
*/
public function model($model, $name = '', $db_conn = FALSE)
{
$this->loader->model($model, $name, $db_conn);
return $this;
}
// --------------------------------------------------------------------
/**
* Database Loader
*
* @param mixed $params Database configuration options
* @param bool $return Whether to return the database object
* @param bool $query_builder Whether to enable Query Builder
* (overrides the configuration setting)
*
* @return object|bool Database object if $return is set to TRUE,
* FALSE on failure, CI_Loader instance in any other case
*/
public function database($params = '', $return = FALSE, $query_builder = NULL)
{
$res = $this->loader->database($params, $return, $query_builder);
return $res == $this->loader ? $this : $res;
}
// --------------------------------------------------------------------
/**
* Load the Database Utilities Class
*
* @param object $db Database object
* @param bool $return Whether to return the DB Utilities class object or not
* @return object
*/
public function dbutil($db = NULL, $return = FALSE)
{
$res = $this->loader->dbutil($db, $return);
return $res === $this->loader ? $this : $res;
}
// --------------------------------------------------------------------
/**
* Load the Database Forge Class
*
* @param object $db Database object
* @param bool $return Whether to return the DB Forge class object or not
* @return object
*/
public function dbforge($db = NULL, $return = FALSE)
{
$res = $this->loader->dbforge($db, $return);
return $res === $this->loader ? $this : $res;
}
// --------------------------------------------------------------------
/**
* Generic File Loader
*
* @param string $path File path
* @param bool $return Whether to return the file output
* @return object|string
*/
public function file($path, $return = FALSE)
{
$res = $this->loader->file($path, $return);
return $res === $this->loader ? $this : $res;
}
// --------------------------------------------------------------------
/**
* Set Variables
*
* Once variables are set they become available within
* the controller class and its "view" files.
*
* @param array|object|string $vars
* An associative array or object containing values
* to be set, or a value's name if string
* @param string $val Value to set, only used if $vars is a string
* @return object
*/
public function vars($vars, $val = '')
{
$res = $this->loader->vars($vars, $val);
return $res === $this->loader ? $this : $res;
}
// --------------------------------------------------------------------
/**
* Clear Cached Variables
*
* Clears the cached variables.
*
* @return CI_Loader
*/
public function clear_vars()
{
$this->loader->clear_vars();
return $this;
}
// --------------------------------------------------------------------
/**
* Get Variable
*
* Check if a variable is set and retrieve it.
*
* @param string $key Variable name
* @return mixed The variable or NULL if not found
*/
public function get_var($key)
{
return $this->loader->get_var($key);
}
// --------------------------------------------------------------------
/**
* Get Variables
*
* Retrieves all loaded variables.
*
* @return array
*/
public function get_vars()
{
return $this->loader->get_vars();
}
// --------------------------------------------------------------------
/**
* Helper Loader
*
* @param string|string[] $helpers Helper name(s)
* @return object
*/
public function helper($helpers = array())
{
$this->loader->helper($helpers);
return $this;
}
// --------------------------------------------------------------------
/**
* Load Helpers
*
* An alias for the helper() method in case the developer has
* written the plural form of it.
*
* @uses CI_Loader::helper()
* @param string|string[] $helpers Helper name(s)
* @return object
*/
public function helpers($helpers = array())
{
return $this->helper($helpers);
}
// --------------------------------------------------------------------
/**
* Language Loader
*
* Loads language files.
*
* @param string|string[] $files List of language file names to load
* @param string Language name
* @return object
*/
public function language($files, $lang = '')
{
$this->loader->language($files, $lang);
return $this;
}
// --------------------------------------------------------------------
/**
* Config Loader
*
* Loads a config file (an alias for CI_Config::load()).
*
* @uses CI_Config::load()
* @param string $file Configuration file name
* @param bool $use_sections Whether configuration values should be loaded into their own section
* @param bool $fail_gracefully Whether to just return FALSE or display an error message
* @return bool TRUE if the file was loaded correctly or FALSE on failure
*/
public function config($file, $use_sections = FALSE, $fail_gracefully = FALSE)
{
return $this->loader->config($file, $use_sections, $fail_gracefully);
}
// --------------------------------------------------------------------
/**
* Driver Loader
*
* Loads a driver library.
*
* @param string|string[] $library Driver name(s)
* @param array $params Optional parameters to pass to the driver
* @param string $object_name An optional object name to assign to
*
* @return object|bool Object or FALSE on failure if $library is a string
* and $object_name is set. CI_Loader instance otherwise.
*/
public function driver($library, $params = NULL, $object_name = NULL)
{
$res = $this->loader->driver($library, $params, $object_name);
return $res === $this->loader ? $this : $res;
}
// --------------------------------------------------------------------
/**
* Add Package Path
*
* Prepends a parent path to the library, model, helper and config
* path arrays.
*
* @see CI_Loader::$_ci_library_paths
* @see CI_Loader::$_ci_model_paths
* @see CI_Loader::$_ci_helper_paths
* @see CI_Config::$_config_paths
*
* @param string $path Path to add
* @param bool $view_cascade (default: TRUE)
* @return object
*/
public function add_package_path($path, $view_cascade = TRUE)
{
$this->loader->add_package_path($path, $view_cascade);
return $this;
}
// --------------------------------------------------------------------
/**
* Get Package Paths
*
* Return a list of all package paths.
*
* @param bool $include_base Whether to include BASEPATH (default: FALSE)
* @return array
*/
public function get_package_paths($include_base = FALSE)
{
return $this->loader->get_package_paths($include_base);
}
// --------------------------------------------------------------------
/**
* Remove Package Path
*
* Remove a path from the library, model, helper and/or config
* path arrays if it exists. If no path is provided, the most recently
* added path will be removed removed.
*
* @param string $path Path to remove
* @return object
*/
public function remove_package_path($path = '')
{
$this->remove_package_path($path);
return $this;
}
}
-31
View File
@@ -1,31 +0,0 @@
<?php
$includesArray = array(
'customJSModules' => ['public/js/apps/Cis/Cms.js'],
'primevue3'=>true,
'customCSSs' => [
'public/css/Cis4/Cms.css',
#'skin/style.css.php'
]
);
if(isset($template_kurzbz)){
switch($template_kurzbz){
case 'raum_contentmittitel':
$includesArray['tabulator5'] = true;
break;
}
}
$this->load->view('templates/CISVUE-Header', $includesArray);
?>
<h2 ><?php echo isset($content_id)? "Content" : "News" ?></h2>
<hr/>
<div id="cms">
<?php echo (isset($content_id) ? '<cms-content :content_id="'.$content_id.'" :version="'.$version.'" :sprache="'.$sprache.'" :sichtbar="'.$sichtbar.'" />' : '<cms-news/>'); ?>
</div>
<?php $this->load->view('templates/CISVUE-Footer', $includesArray); ?>
-23
View File
@@ -1,23 +0,0 @@
<?php
$includesArray = array(
'title' => 'FH-Complete',
'customCSSs' => [
'public/css/Cis4/Legacy.css'
]
);
$this->load->view('templates/FHC-Header', $includesArray);
?>
<script type="text/javascript">
function resizeIframe(obj) {
// NOTE(chris): this only works on sites on the same domain which is always the case in this template
obj.style.height = (obj.contentWindow.document.scrollingElement.scrollHeight) + 'px';
// TODO(chris): add trigger on window.resize
}
</script>
<iframe src="<?= base_url($url); ?>" onload="resizeIframe(this)"></iframe>
<?php $this->load->view('templates/FHC-Footer', $includesArray); ?>
-21
View File
@@ -1,21 +0,0 @@
<?php
$includesArray = array(
'title' => 'FH-Complete',
'tabulator5'=>true,
'customJSModules' => ['public/js/apps/Dashboard/Fhc.js'],
'customCSSs' => [
'public/css/components/dashboard.css'
],
);
$this->load->view('templates/CISVUE-Header', $includesArray);
?>
<div id="content">
<h2>Dashboard</h2>
<hr>
<fhc-dashboard dashboard="CIS"/>
</div>
<?php $this->load->view('templates/CISVUE-Footer', $includesArray); ?>
-18
View File
@@ -1,18 +0,0 @@
<?php
$includesArray = array(
'title' => 'FH-Complete',
'bootstrap5' => true,
'fontawesome6' => true,
);
$this->load->view('templates/FHC-Header', $includesArray);
?>
<div id="wrapper">
<div class="alert alert-primary" role="alert">
<?= $error; ?>
</div>
</div>
<?php $this->load->view('templates/FHC-Footer', $includesArray); ?>
@@ -1 +0,0 @@
</main>
@@ -1,57 +0,0 @@
<?php
if (!isset($menu)) {
$menu = [];
if (property_exists($this->router, 'menu') && $this->router->menu && property_exists($this->router->menu, 'children')) {
$menu = $this->router->menu->children;
}
}
?>
<script type="text/javascript">
if (window.self !== window.top)
document.body.classList.add("in-frame");
</script>
<header id="cis-header" class="navbar-dark">
<button id="nav-main-btn" class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#nav-main" aria-controls="nav-main" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a id="nav-logo" class="d-none d-md-block" href="<?= site_url(''); ?>">
<img src="<?= base_url('/public/images/logo-300x160.png'); ?>" alt="Logo">
</a>
<nav id="nav-main" class="offcanvas offcanvas-start bg-dark" tabindex="-1" aria-labelledby="nav-main-btn" data-bs-backdrop="false">
<?php if ($menu) { ?>
<div id="nav-main-toggle" class="position-static d-none d-lg-block bg-dark">
<button type="button" class="btn bg-dark text-light rounded-0 p-1 d-flex align-items-center" data-bs-toggle="collapse" data-bs-target="#nav-main-menu" aria-expanded="true" aria-controls="nav-main-menu">
<i class="fa fa-arrow-circle-left"></i>
</button>
</div>
<?php } ?>
<div class="offcanvas-body p-0">
<fhc-searchbar id="nav-search" class="fhc-searchbar w-100" :searchoptions="searchbaroptions" :searchfunction="searchfunction"></fhc-searchbar>
<button id="nav-user-btn" class="btn btn-link rounded-0" type="button" data-bs-toggle="collapse" data-bs-target="#nav-user-menu" aria-expanded="false" aria-controls="nav-user-menu">
<img src="<?= site_url('Cis/Pub/bild/person/' . getAuthPersonId()); ?>" class="avatar rounded-circle"/>
</button>
<ul id="nav-user-menu" class="collapse list-unstyled" aria-labelledby="nav-user-btn">
<li><a class="btn btn-level-2 rounded-0 d-block" href="#" id="menu-profil">Profil</a></li>
<li><a class="btn btn-level-2 rounded-0 d-block" href="#">Ampeln</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="btn btn-level-2 rounded-0 d-block" href="<?= site_url('Cis/Auth/logout'); ?>">Logout</a></li>
</ul>
<?php if ($menu) { ?>
<div id="nav-main-menu" class="collapse collapse-horizontal show">
<div>
<?php
foreach ($menu as $entry) {
$this->load->view('templates/CISHMVC-Menu/Entry', ['entry' => $entry, 'menu_id' => 'menu']);
}
?>
</div>
</div>
<?php } ?>
</div>
</nav>
</header>
<main id="cis-main" class="flex-grow-1 overflow-scroll p-4">
@@ -1,57 +0,0 @@
<?php
if (is_array($entry) && isset($entry['content_id']))
$entry = (object)$entry;
if (!isset($content_id))
$content_id = $entry->content_id;
if (!isset($path))
$path = '';
$menu_id .= '-' . $content_id;
// TODO(chris): remove! DEBUG
#$entry->menu_open = false;
if (property_exists($entry, 'path')) {
$lang = getUserLanguage();
$link = $path . '/' . $entry->path[$lang];
$active = in_array($content_id, $this->router->breadcrumb);
$menu_open = $active ? true : (property_exists($entry, 'menu_open') ? $entry->menu_open : false);
$target = '';
$title = htmlspecialchars($entry->sprache[$lang]->titel);
} else {
$link = $entry->url;
$active = false;
$menu_open = $entry->menu_open;
$target = $entry->target;
$title = htmlspecialchars($entry->titel);
$entry->children = $entry->childs;
}
?>
<?php if ($entry->children) { ?>
<?php if (substr($link, 0, 1) == '#') { ?>
<a href="#<?= $menu_id; ?>" data-bs-toggle="collapse" aria-expanded="<?= $menu_open ? 'true' : 'false'; ?>" class="btn btn-default rounded-0 w-100 text-start dropdown-toggle btn-level-<?= substr_count($menu_id, '-'); ?><?= $menu_open ? '' : ' collapsed'; ?><?= $active ? ' active' : ''; ?>">
<span><?= $title; ?></span>
</a>
<?php } else { ?>
<div class="btn-group w-100">
<a<?= $link ? ' href="' . $link . '"' : ''; ?><?= $target ? ' target="' . $target . '"' : ''; ?> class="btn btn-default rounded-0 text-start btn-level-<?= substr_count($menu_id, '-'); ?><?= $active ? ' active' : ''; ?>">
<?= $title; ?>
</a>
<a href="#<?= $menu_id; ?>" data-bs-toggle="collapse" aria-expanded="<?= $menu_open ? 'true' : 'false'; ?>"class="btn btn-default rounded-0 dropdown-toggle dropdown-toggle-split flex-grow-0<?= $menu_open ? '' : ' collapsed'; ?><?= $active ? ' active' : ''; ?>" >
<span class="visually-hidden">Toggle Dropdown</span>
</a>
</div>
<?php } ?>
<ul id="<?= $menu_id; ?>" class="nav w-100 collapse<?= $menu_open ? ' show' : ''; ?>">
<?php foreach ($entry->children as $id => $child)
$this->load->view('templates/CISHMVC-Menu/Entry', ['content_id' => $id, 'entry' => $child, 'menu_id' => $menu_id, 'path' => $path]);
?>
</ul>
<?php } else { ?>
<a<?= $link ? ' href="' . $link . '"' : ''; ?><?= $target ? ' target="' . $target . '"' : ''; ?> class="btn btn-default rounded-0 w-100 text-start btn-level-<?= substr_count($menu_id, '-'); ?><?= $active ? ' active' : ''; ?>">
<?= $title; ?>
</a>
<?php } ?>