mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 16:44:28 +00:00
refactor(Cis Menu): changes method name and checks if the CIS4_MENU_ENTRY constant is defined
This commit is contained in:
@@ -31,7 +31,8 @@ class CisVue extends FHC_Controller
|
|||||||
public function Menu()
|
public function Menu()
|
||||||
{
|
{
|
||||||
$this->load->model('content/Content_model', 'ContentModel');
|
$this->load->model('content/Content_model', 'ContentModel');
|
||||||
$result = $this->ContentModel->getMenu(defined('CIS4_MENU_ENTRY') ? CIS4_MENU_ENTRY : null, get_uid());
|
$menu_contentID = $this->ContentModel->getMenuContentID();
|
||||||
|
$result = $this->ContentModel->getMenu($menu_contentID, get_uid());
|
||||||
$menu = getData($result) ?? (object)['childs' => []];
|
$menu = getData($result) ?? (object)['childs' => []];
|
||||||
|
|
||||||
$this->outputJsonSuccess($menu);
|
$this->outputJsonSuccess($menu);
|
||||||
|
|||||||
@@ -71,13 +71,23 @@ class Content_model extends DB_Model
|
|||||||
*
|
*
|
||||||
* @return integer|null content_id of the Cis4_Root Menu
|
* @return integer|null content_id of the Cis4_Root Menu
|
||||||
*/
|
*/
|
||||||
public function getCIS4_ContentID(){
|
public function getMenuContentID(){
|
||||||
|
// early return if the CIS4_MENU_ENTRY constant is defined
|
||||||
|
if(defined('CIS4_MENU_ENTRY'))
|
||||||
|
{
|
||||||
|
return CIS4_MENU_ENTRY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// load the CIS4 Menu content_id from the database using the column 'beschreibugn' of the campus.tbl_content table
|
||||||
$CIS4_ROOT_CONTENT = $this->loadWhere(["beschreibung"=>"CIS4_ROOT"]);
|
$CIS4_ROOT_CONTENT = $this->loadWhere(["beschreibung"=>"CIS4_ROOT"]);
|
||||||
|
|
||||||
if(isError($CIS4_ROOT_CONTENT))
|
if(isError($CIS4_ROOT_CONTENT))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$CIS4_ROOT_CONTENT = getData($CIS4_ROOT_CONTENT);
|
$CIS4_ROOT_CONTENT = getData($CIS4_ROOT_CONTENT);
|
||||||
|
|
||||||
if(count($CIS4_ROOT_CONTENT) > 0)
|
if(count($CIS4_ROOT_CONTENT) > 0)
|
||||||
{
|
{
|
||||||
return current($CIS4_ROOT_CONTENT)->content_id ?? null;
|
return current($CIS4_ROOT_CONTENT)->content_id ?? null;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ $this->load->view('templates/FHC-Header', $includesArray);
|
|||||||
if (!isset($menu)) {
|
if (!isset($menu)) {
|
||||||
$ci =& get_instance(); // get CI instance
|
$ci =& get_instance(); // get CI instance
|
||||||
$ci->load->model('content/Content_model', 'ContentModel');
|
$ci->load->model('content/Content_model', 'ContentModel');
|
||||||
$cis4_content_id = $ci->ContentModel->getCIS4_ContentID();
|
$cis4_content_id = $ci->ContentModel->getMenuContentID();
|
||||||
$result = $ci->ContentModel->getMenu($cis4_content_id, get_uid());
|
$result = $ci->ContentModel->getMenu($cis4_content_id, get_uid());
|
||||||
$menu = getData($result)->childs ?? [];
|
$menu = getData($result)->childs ?? [];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user