jonassanoj / dbpro

DB Project 1
19 stars 1 forks source link

controller/main: extend the _loadviews() function #68

Closed tilman-schieber closed 12 years ago

tilman-schieber commented 12 years ago

extend the _loadviews() function so it loads a different sidebar, depending what kind of user is logged in (not logged in, admin, editor or normal user). Create view/leftnav/user.php view/leftnav/editor.php view/leftnav/admin.php

You can make these views just copies of view/leftnav/default.php but make sure the correct one is loaded. Optional: put different dummy links in the sidebars depending on the type of user

the usertypeID can be found in the userdata variable usertype. Look at the table in the database or the wiki documentation to find out which ID is which type of user.

P.S.: this is a long explanation but the task is easy nonetheless

ahmadnawid commented 12 years ago

Hello,

I understand as you said above "the usertypeID can be found in the userdata variable usertype" this:

//for normal user. if($this -> session -> userdata('usertype') == 1)

Is it correct?

tilman-schieber commented 12 years ago

yes but first check if userdata has the key usertype otherwise the controller will abort with an error if noone is logged in.

tilman-schieber commented 12 years ago

Your function now loads the navigation bar two times for unregistered users you should test changes before you commit!

look at the logic of your if statements... especially try to find out what this evaluates to:

($this -> session -> userdata('usertype'))

if usertype=0 this statement will evaluate to FALSE why is this a problem?

ahmadnawid commented 12 years ago

I solve the problem now the view for unconfirmed user is in else part

tilman-schieber commented 12 years ago

the commited version still had the problem I mentioned two days ago. Please make sure to submit your changes in time. But it's working now, so