mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
further progress on rendering partMenu
This commit is contained in:
@@ -6,35 +6,37 @@ $config['stv_menu'] = array(
|
||||
'children' => array(
|
||||
'stg' => array(
|
||||
'library' => 'treemenu/StgLib',
|
||||
/*
|
||||
'children' => array(
|
||||
'pre' => array(
|
||||
'library' => 'treemenu/Prestudent'
|
||||
'library' => 'treemenu/PrestudentLib'
|
||||
),
|
||||
'sem' => array(
|
||||
'library' => 'treemenu/AusbSemester',
|
||||
'library' => 'treemenu/AusbSemesterLib',
|
||||
'children' => array(
|
||||
'vbd' => array(
|
||||
'library' => 'treemenu/Verband'
|
||||
'library' => 'treemenu/VerbandLib'
|
||||
)
|
||||
)
|
||||
),
|
||||
'orgform' => array(
|
||||
'library' => 'treemenu/OrgForm',
|
||||
'library' => 'treemenu/OrgFormLib',
|
||||
'children' => array(
|
||||
'pre' => array(
|
||||
'library' => 'treemenu/Prestudent'
|
||||
'library' => 'treemenu/PrestudentLib'
|
||||
),
|
||||
'sem' => array(
|
||||
'library' => 'treemenu/AusbSemester',
|
||||
'library' => 'treemenu/AusbSemesterLib',
|
||||
'children' => array(
|
||||
'vbd' => array(
|
||||
'library' => 'treemenu/Verband'
|
||||
'library' => 'treemenu/VerbandLib'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
*/
|
||||
),
|
||||
'inout' => array(
|
||||
'library' => 'treemenu/InOutLib'
|
||||
|
||||
@@ -64,19 +64,43 @@ class TreeMenu extends FHCAPI_Controller
|
||||
|
||||
$this->loadMenuConfig($treemenu);
|
||||
|
||||
$startconfig = $this->findStartLib($this->treemenuconfig, array_keys($this->uri->uri_to_assoc(7)));
|
||||
|
||||
$libpath = $startconfig['library'];
|
||||
$children = isset($startconfig['children']) ? $startconfig['children'] : array();
|
||||
$libname = basename($startconfig['library']);
|
||||
|
||||
$this->load->library(
|
||||
$libpath,
|
||||
$children,
|
||||
$libname
|
||||
);
|
||||
|
||||
$bhdebug = (object) array(
|
||||
'treemenu' => $treemenu,
|
||||
'treemenuconfig' => $this->treemenuconfig,
|
||||
'uri' => $this->uri->uri_to_assoc(7)
|
||||
'uri' => $this->uri->uri_to_assoc(7),
|
||||
'libpath' => $libpath,
|
||||
'libname' => $libname,
|
||||
'children' => $children,
|
||||
'startconfig' => $startconfig
|
||||
);
|
||||
$this->addMeta('bhdebug', $bhdebug);
|
||||
//$this->addMeta('bhci', $this);
|
||||
|
||||
$this->load->library($this->treemenuconfig->library, $this->treemenuconfig->children);
|
||||
|
||||
$data = $this->StvMenuLib->getSubMenu();
|
||||
$data = $this->$libname->getSubMenu();
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
protected function findStartLib($config, $uri)
|
||||
{
|
||||
$level = array_shift($uri);
|
||||
if(is_null($level)) {
|
||||
return $config;
|
||||
}
|
||||
return $this->findStartLib($config['children'][$level], $uri);
|
||||
}
|
||||
|
||||
protected function loadMenuConfig($treemenu)
|
||||
{
|
||||
$this->config->load('treemenu/' . $treemenu . '.php');
|
||||
|
||||
@@ -1,39 +1,42 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template
|
||||
*/
|
||||
require_once APPPATH . 'libraries/treemenu/TreeMenuLib.php';
|
||||
|
||||
/**
|
||||
* Description of InOutLib
|
||||
*
|
||||
* @author bambi
|
||||
*/
|
||||
class InOutLib
|
||||
class InOutLib extends TreeMenuLib
|
||||
{
|
||||
public function getSubMenu()
|
||||
public function getNodes()
|
||||
{
|
||||
return [
|
||||
'name' => 'International',
|
||||
'link' => 'inout',
|
||||
'children' => [
|
||||
[
|
||||
'name' => 'Incoming',
|
||||
'link' => 'inout/incoming',
|
||||
'leaf' => true
|
||||
],
|
||||
[
|
||||
'name' => 'Outgoing',
|
||||
'link' => 'inout/outgoing',
|
||||
'leaf' => true
|
||||
],
|
||||
[
|
||||
'name' => 'Gemeinsame Studien',
|
||||
'link' => 'inout/gemeinsamestudien',
|
||||
'leaf' => true
|
||||
[
|
||||
'name' => 'International',
|
||||
'link' => 'inout',
|
||||
'children' => [
|
||||
[
|
||||
'name' => 'Incoming',
|
||||
'link' => 'inout/incoming',
|
||||
'leaf' => true
|
||||
],
|
||||
[
|
||||
'name' => 'Outgoing',
|
||||
'link' => 'inout/outgoing',
|
||||
'leaf' => true
|
||||
],
|
||||
[
|
||||
'name' => 'Gemeinsame Studien',
|
||||
'link' => 'inout/gemeinsamestudien',
|
||||
'leaf' => true
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function getSubMenu()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template
|
||||
*/
|
||||
require_once APPPATH . 'libraries/treemenu/TreeMenuLib.php';
|
||||
|
||||
/**
|
||||
* Description of InOutLib
|
||||
*
|
||||
* @author bambi
|
||||
*/
|
||||
class StgLib
|
||||
class StgLib extends TreeMenuLib
|
||||
{
|
||||
public function getNodes()
|
||||
{
|
||||
$this->ci->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||
$res = $this->ci->StudiengangModel->loadWhere(array('aktiv' => true));
|
||||
$stgs = hasData($res) ? getData($res) : array();
|
||||
|
||||
$this->ci->addMeta('bhstg', $stgs);
|
||||
$nodes = array_map(
|
||||
function($stg) {
|
||||
return array(
|
||||
'name' => strtoupper($stg->typ . $stg->kurzbz) . ' ' . $stg->bezeichnung,
|
||||
'link' => 'stg/' . $stg->studiengang_kz,
|
||||
'leaf' => false
|
||||
);
|
||||
},
|
||||
$stgs
|
||||
);
|
||||
|
||||
return $nodes;
|
||||
}
|
||||
|
||||
public function getSubMenu()
|
||||
{
|
||||
return [
|
||||
'name' => 'International',
|
||||
'link' => 'inout',
|
||||
'children' => [
|
||||
[
|
||||
'name' => 'Incoming',
|
||||
'link' => 'inout/incoming',
|
||||
'leaf' => true
|
||||
],
|
||||
[
|
||||
'name' => 'Outgoing',
|
||||
'link' => 'inout/outgoing',
|
||||
'leaf' => true
|
||||
],
|
||||
[
|
||||
'name' => 'Gemeinsame Studien',
|
||||
'link' => 'inout/gemeinsamestudien',
|
||||
'leaf' => true
|
||||
]
|
||||
]
|
||||
'StgLib' => 'test123'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require_once APPPATH . 'library/treemenu/TreeMenuLib.php';
|
||||
require_once APPPATH . 'libraries/treemenu/TreeMenuLib.php';
|
||||
/**
|
||||
* Description of StvMenuLib
|
||||
*
|
||||
@@ -9,8 +9,15 @@ class StvMenuLib extends TreeMenuLib
|
||||
{
|
||||
public function getSubMenu()
|
||||
{
|
||||
return [
|
||||
'StvMenuLib' => null
|
||||
];
|
||||
$nodes = array();
|
||||
|
||||
foreach($this->children_config as $childconfig)
|
||||
{
|
||||
$childlib = basename($childconfig['library']);
|
||||
$childnodes = $this->ci->$childlib->getNodes();
|
||||
$nodes = array_merge($nodes, $childnodes);
|
||||
}
|
||||
|
||||
return $nodes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@ abstract class TreeMenuLib
|
||||
|
||||
public function __construct($children_config)
|
||||
{
|
||||
$this->ci = get_instance();
|
||||
$this->ci =& get_instance();
|
||||
$this->children_config = $children_config;
|
||||
foreach($this->children_config as $child_config)
|
||||
{
|
||||
$grandchildren_config = isset($child_config['children']) ? $child_config['children'] : [];
|
||||
$this->ci->load->library($child_config->library, $grandchildren_config);
|
||||
$this->ci->load->library($child_config['library'], $grandchildren_config, basename($child_config['library']));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user