Welcome Guest, Not a member yet? Register   Sign In
Modular portal based on controller names?
#7

[eluser]DanielJay[/eluser]
eggshape,
I was planning on storing the navigation in a database. What I think I am going to go for is:

Code for gathering top navigation based on controllers
Code:
<?php

class Navigation extends Model {

        public function Find()
        {
                $this->load->helper('directory');
                $map = directory_map('system/application/controllers/');
                $available = array();
                foreach ($map as $controller) {
                        if (substr($controller, -4) == '.php') {
include_once('system/application/controllers/'.$controller);
$methods = get_class_methods(substr(ucfirst($controller), 0, -4));

if (in_array('activate', $methods) && in_array('deactivate', $methods)) {
                                $available[] = ucfirst(substr($controller, 0, -4));
}
                        }
                }
                return $available;
        }
}

?>

Setting up a "non modular" controller called Settings in which the above code would be ran in the index() to populate a table such as:
Employees Activate | Deactivate
Computers Activate | Deactivate
Helpdesk Activate | Deactivate

The above code would only be ran on rare occasions on a settings page. The Activate | Deactivate would be links to the selected activate() and deactivate() in the usual CodeIgniter fashion.

(The following is what you basically stated above eggshape)

The activate() function purpose:
1. Insert controller name and sub navigation into a navigation table which would be queried to populate the navigation
2. Create any necessary tables for dealing with the "module"

The deactivate() function purpose:
1. Remove controller name and sub navigation into a navigation table
2. Remove any tables created for the "module"

I think I finally have some solid ideas to work with here. Just time to play some MP3's or turn on the radio and get crunching on some code. Smile


Messages In This Thread
Modular portal based on controller names? - by El Forum - 01-14-2008, 08:26 PM
Modular portal based on controller names? - by El Forum - 01-14-2008, 10:10 PM
Modular portal based on controller names? - by El Forum - 01-15-2008, 03:25 AM
Modular portal based on controller names? - by El Forum - 01-15-2008, 03:41 AM
Modular portal based on controller names? - by El Forum - 01-15-2008, 07:47 AM
Modular portal based on controller names? - by El Forum - 01-15-2008, 10:46 AM
Modular portal based on controller names? - by El Forum - 01-15-2008, 11:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB