Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 2a42b40

Browse files
committed
ENH: refs #265. Pass module name, full name, and description in GlobalModule
1 parent 98e7119 commit 2a42b40

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

modules/GlobalModule.php

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,24 @@ class MIDAS_GlobalModule extends AppController
1919
{
2020
/** contructor*/
2121
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
22-
{
22+
{
2323
parent::__construct($request, $response, $invokeArgs);
2424
$this->loadModuleElements();
2525
if(!isset($this->moduleName))
2626
{
2727
throw new Zend_Exception("Please set the module name in AppController");
28-
}
28+
}
2929
$fc = Zend_Controller_Front::getInstance();
3030
$this->view->moduleWebroot = $fc->getBaseUrl().'/modules/'.$this->moduleName;
31-
31+
$this->view->moduleName = $this->moduleName;
32+
33+
$config = new Zend_Config_Ini(BASE_PATH.'/modules/'.$this->moduleName.'/configs/module.ini', 'global', true);
34+
$this->view->moduleFullName = $config->fullname;
35+
$this->view->moduleDescription = $config->description;
36+
3237
$stack = debug_backtrace();
3338
$forward = $this->_getParam('forwardModule');
34-
39+
3540
// Add variables to the view that allow the retrieval of any enabled module
3641
// webroots
3742
$allModules = Zend_Registry::get('modulesEnable');
@@ -41,22 +46,22 @@ public function __construct(Zend_Controller_Request_Abstract $request, Zend_Cont
4146
$this->view->$modWebroot = $fc->getBaseUrl().'/modules/'.$mod;
4247
}
4348
}
44-
49+
4550
/** pre dispatch (zend)*/
4651
public function preDispatch()
47-
{
48-
parent::preDispatch();
52+
{
53+
parent::preDispatch();
4954
$this->view->setScriptPath(BASE_PATH."/modules/".$this->moduleName."/views");
5055
if($this->isTestingEnv())
5156
{
5257
$this->disableLayout();
5358
}
5459
else
55-
{
56-
60+
{
61+
5762
if(file_exists(BASE_PATH."/modules/".$this->moduleName."/layouts/layout.phtml"))
5863
{
59-
$this->_helper->layout->setLayoutPath(BASE_PATH."/modules/".$this->moduleName."/layouts");
64+
$this->_helper->layout->setLayoutPath(BASE_PATH."/modules/".$this->moduleName."/layouts");
6065
}
6166
}
6267
}
@@ -98,7 +103,7 @@ public function loadModuleElements()
98103
}
99104
}
100105
}
101-
106+
102107
if(isset($this->_moduleDaos))
103108
{
104109
foreach($this->_moduleDaos as $dao)
@@ -116,7 +121,7 @@ public function loadModuleElements()
116121
@$this->ModuleComponent->$component = new $nameComponent();
117122
}
118123
}
119-
124+
120125
if(isset($this->_moduleForms))
121126
{
122127
foreach($this->_moduleForms as $forms)

0 commit comments

Comments
 (0)