-
Notifications
You must be signed in to change notification settings - Fork 0
ARMS Architecture
The new ANDS Registry (replacing "ORCA") will be powered by the CodeIgniter framework under an HMVC architecture.
/application/
modules/
<modulename>/
models/
views/
controllers/
widgets/
views/
/system/
<framework files (CodeIgniter core libraries)>
/engine/
<framework configuration (Config, Routing, etc.)>
The engine directory continues to contain most of the scaffolding, including the template views, libraries and helpers. This should be considered the "core" functionality and most users should extend the registry by adding their own modules and widgets.
Modules are fully-fledged Model-View-Controller structures. Unlike in vanilla CodeIgniter, Modules can invoke other modules' methods to run.
<?php echo modules::run('test/test/index', $param1, $param...); ?>
Modules are, by default, routed according to their module, controller and method name.
So, a request to <website>/fruits/fresh/show
will invoke modules/fruits/fresh.php show()
. However, if the controller name is the same as the module name, this will be treated as the "default" controller, so if your file structure is modules/fruits/fruits.php
a request to <website>/fruits/
will invoke that file's index() function
.
Widgets are lightweight ways to abstract code that might be regularly used in various areas of the application. Widgets are invoked by:
<?php widget::run('<widgetname>', $params...); ?>
Widgets are defined in /application/widgets/<widgetname>.php
as a PHP class. E.g.:
<?php
class User_login extends Widget
{
function run($visible = FALSE) {
if ($post = $this->input->post('loginform')) {
if ($post['username'] == 'admin') {
$query = $this->db->query("SELECT uid FROM user WHERE username='admin'");
$result = $query->row();
set_cookie('ci_user', $result->uid, 86500);
redirect();
}
}
if ($visible) $this->render('user_login');
}
}
The $this->render()
function is equivalent to $this->view->load()
and all variables in the second parameter are extracted into the view's scope.
All the usual CodeIgniter resources are available to widgets in $this->
.