context sentetive menu

Hi guys

I am thinking to develop the application in more configurable way.

At this point there is field on my database called role which will be used to figure which access current user has hence in my view I show the links for all actions the user can do but it needs couple of IF-ELSE statement in the view

I am thinking to have a context sensitive menu for all CRUD functions and now I can check the role field but what if I add more field to the DB? Then I should write more IF-ELSE statement for each of them.

Lets I want add a language field in the DB then showing the proper language based on who is logged in. There must be a way to just change a config-type file and it automatically set the language.

What if I add a color field to the DB and again based on who is logged in, it looks the color field and changes the theme’s color.

I dont want add and IF-ELSE statement in my view for any new field I add to the DB.

Let me know if I am not clear or if you have some idea.

This is my /views/site/page/Menu.php:





<?php

$this->pageTitle=Yii::app()->name . ' - Menu';

$this->breadcrumbs=array(

	'Menu',

);

?>

<h1>Menu</h1>

This is the place where we should move all menus. I guess <br>

<p>This is a "static" page. You may change the content of this page

by updating the file <br> <tt><?php //echo __FILE__; ?></tt></p>


<?php


$theID=Yii::app()->user->name;




if(Yii::app()->user->isAdmin)

{


	echo'Actions available to you:';

	echo('<ol>');

	echo('<b>'.'<li>');

	echo CHtml::link('Create',CController::createUrl('user/create'));

	echo('</li>'.'</b>');

	

	echo('<b>'.'<li>');

	echo CHtml::link('Manage',CController::createUrl('user/admin'));

	//echo('<a href="index.php?r=user/admin">Manage</a>');

	echo('</li>'.'</b>');	

	

	echo('<b>'.'<li>');

	echo CHtml::link('List',CController::createUrl('user/index'));

	//echo('<a href="index.php?r=user/index">List</a>');

	echo('</li>'.'</b>');

	

	echo('<b>'.'<li>');

	echo CHtml::link('Update',CController::createUrl('user/update').'&id='.$theID);

	//echo('<a href="index.php?r=user/update&id='    .$theID.'">update</a>');

	echo('</li>'.'</b>');

	

	

	echo('<b>'.'<li>');

	echo CHtml::link('Delete',CController::createUrl('user/delete').'&id='.$theID);

	//echo('<a href="index.php?r=user/delete&id='    .$theID.'">delete</a>');

	echo('</li>'.'</b>');

	

	

echo('</ol>');

 }

 else if(!Yii::app()->user->isGuest)

	

{

	echo'Actions available to you:';

	echo('<ol>');

	

		echo('<b>'.'<li>');

		echo CHtml::link('List',CController::createUrl('user/index'));

		echo('</li>'.'</b>');

	

	echo('</ol>');




}

else

echo 'Not much a guest user can do unless you log in';

  


?>



The snapshot I attach is what I get if the user is admin

Thanks