• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to organize code for multiple purposes ?

Hi All,
In my previous project with CI, I had different types of users [eg. Admin, Manager, User]
Admin manages everyone and Manager manages some users.
So they have interfaces for managing the users, also each user has his own [My Account] section to update his own information.
Also there is a signup page.
What I mean is all these funtionalities are basically the same, which is managing user.
The difference is showing/Hiding some fields and having some restrictions and so on. And sometimes validations are different.

The way I organized these was like this :


and in each controller, functions for Update/Add/Edit.
But I feel that I'm doing it in the wrong way, because each time I want to ask a simple field to users table, I have to change all these files which is error-prone.

Can you give me your feedback about how can I overcome this in future projects ?
Do you think having a library for managing users will be a better way and just doing some settings in each file ?
Any idea is appreciated.


Has any body any Idea ?
How do you guys handle the same situation in your projects ?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.