Custom view with many buttons as user input

i want to show a list of items and corresponding actions that the user can perform for each item, these actions will be shown as buttons. Further the buttons will be dynamic, i.e. once a certain action has been performed, that button will not be shown anymore, or it may be shown as undo action button.

i get that this is somewhat like a CButtonColumn. is this correct?

Also the data that i will use to populate the list will be dynamic, but not from a db in my app, but an external web source. Should i be using a form model for it? or i can do this without a model?

Then where in the app directory can i put the view for this?

And how do i decide the controller for it? write a new controller, or have an action in an existing controller?

Any kind of help will be much appreciated. :) Im a total newbie to web programming in general, and completely confused how to handle this, following full MVC practices. So please guide me.

Bump. Do ask for clarifications if required.

i guess i asked the wrong question!!! as no one has answered!! Frustrating. Even hints would have been helpful. Forum people, i expected more from you all !! Some feedback is better than no feedback.

Anyway, if any other newbie comes along with a similar problem, they’ll be able to see the way i have done it, so here’s my solution. It’s not complete yet.

So to get the different items in place, in order i used a Cgridview, with just one column for item description, and one CButtonColumn.

This code i put in a new view in the views/site folder. So accordingly the controller for the view is the sitecontroller.

Made a modified button column. I just removed the default update, delete, buttons by specifying a new ‘template’ for the buttons.

I basically followed this article from the Yii wiki.




<?php

$this->widget('zii.widgets.grid.CGridView',

	array('dataProvider' => $dataProvider,

		'id'=>'page-select-grid',

		'columns'=>array(

			'page_name',

			array(

				'class'=>'CButtonColumn',

				'template'=>'{email}{post}{admin}',

				'buttons'=>array(

					'email'=>array(

						'label'=>'Email',

						'imageUrl'=>Yii::app()->request->baseUrl.'/images/email.png',

						'url'=>'"#"',

						// 'click'=>'function(){alert("Email!");}',

					),

					'postjob'=>array(

						'label'=>'Post',

						'imageUrl'=>Yii::app()->request->baseUrl.'/images/post.png',

						'url'=> '"#"'

						// 'click'=>'function(){alert("Post!");}',

					),

					'goadmin'=>array(

						'label'=>'Go to Admin',

						'imageUrl'=>Yii::app()->request->baseUrl.'/images/admin.png',

						'url'=>'"#"'

						// 'click'=>'function(){alert("Go to Admin!");}',

					)

				)

			),

		),

	)

);

?>



Im trying to get an ajax button working here, i’ll put that code when done.

the Controller actions are also not complete, will put that too when complete