Welcome Guest, Not a member yet? Register   Sign In
Code injection for a module based system.
#1

[eluser]xhypno402[/eluser]
Ok, let me give a run down.

I have built an enterprise based management system on top of CI. This system uses the modular CI setup that was posted on the forums a few months back.

Here is the system layout.

system/
..application/
....modules/
......module1/
......module2/


Lets say that module1 is our authentication module (Auth) and module2 is our users module (User).

Auth handles logging a user into the system and building navigation for the rest of the application based on the data about the users permissions. I won't get into detail, but navigation and permissions to access controllers in modules is handled by a few WebServices and an xml configuration file located in a config directory in each module.

Lets say User has 2 controllers, Display and Update. These controllers will be displayed in a tree based navigation created by the Auth module. This is where my problem falls.

When accessing http://host/Auth/login a user is presented a login prompt and the information provided is checked against a WebService and then authentication information is saved in session. The user is then passed to http://host/User/Display/ for access to the system.

I am having trouble finding a way to keep my code modularized with regards to the navigation. The functions that build the navigation are part of the Auth module and I do not want to add them to the User module. I am also trying to keep the code as segregated as possible to allow for modules to be created and dropped in to the modules directory and automatically be added for use, (This is already function, just not with navigation across the modules).

If you have an idea as to how I can build this so each module can access the navigation code in the Auth module please let me know. As of right now I am at a loss.

-Phil
#2

[eluser]esra[/eluser]
There were two module file system contributions--one called Modular Separation by Zacharias Knudsen (formerly Zawk and Dynacheck) and a second contribution by Elliot Haughn. Modular Separation is currently up to v2.4.1 with another major release in the works. The MY_Loader extension does support new methods that allow controllers to access methods in other module controllers. Do a search for 'Modular Separation'.

A large number of changes were added to the v2.x series over a relatively short period of time. Aside from the solution mentioned above, you can achieve better module encapsulation with the new v2.4.1 directory structure because it allows modules to have their own libraries, helpers, config, plugins, and language directories. A separate contribution was recently written and posted elsewhere that allows modules to have their own routes.php file.
#3

[eluser]xhypno402[/eluser]
hey esra,

It is the Modular Separation by Zacharias Knudsen that I am using. I am also currently using version 2.4.1. I will take a look at the My_Loader extension.

-Phil
#4

[eluser]xhypno402[/eluser]
Current problem with just extending MY_Loader is that the class that I need to run is trying to access a model associated with the module it resides in. I am currently receiving an error that stats the module I am trying to access can not be loaded.

Any ideas?
#5

[eluser]esra[/eluser]
Post a message in the MS thread referring to this thread to see if Zacharias can offer a solution. Earlier, there was some talk about developing a solution for installing and sharing classes among modules for the proposed module installer.
#6

[eluser]xhypno402[/eluser]
For further info.

Error received when I include the class from the other module.

Severity: Notice

Message: Undefined property: Navigation::$Users

Filename: libraries/Loader.php

Line Number: 921
#7

[eluser]xhypno402[/eluser]
My issue has been solved. the problem is inside the code of the modular seperation package. This is a really singular issue do to my strict seperation of code.




Theme © iAndrew 2016 - Forum software by © MyBB