[eluser]K.OS[/eluser]
Hi,
quick question, how would you approach this problem:
I have one view, lets say a view called 'nav'. This view contains the complete menu structure for my site. I have some Users with different roles and not all of them are allowed to access all function through the menu.
i blocked access for some controller functions with this function:
Code:
function requireUserRole($role = 3)
{
if ($role >= $this->session->userdata['role']) {
return true;
}else{
return false;
}
}
only if this function call is true, certain other function will be executed… this works well to block access to functions in my controller.
But because of the MVC structure i want to avoid calling this functions in my controller as well. How would you filter your view to show just some entries?
Code:
<ul>
<!-- this should be available to every user -->
<li>
<a href="<?= site_url('presentation/add') ?>">neue Präsentation</a>
</li>
<!-- this item should just be available to certain users with certain roles -->
<li>
<a href="<?= site_url('presentation/list_all') ?>">alle Präsentationen</a>
<a href="<?= site_url('presentation/list_all/xml') ?>">xml</a>
</li>
</ul>