Source

EYuiDemo / protected / controllers / ExampleController.php

<?php

class ExampleController extends Controller
{
	public function actions()
	{
		return array();
	}
	
	/**
		demo for EYuiSearch
	*/
	public function actionEYuiSearch() 
	{ 
		$model=new Example; 

		if(isset($_POST['Example'])) 
		{ 
			$model->attributes=$_POST['Example']; 
			if($model->validate()) 
			{ 
				$this->redirect(array('ok'));
				return; 
			} 
		} 
		$this->render('eyuisearch',array('model'=>$model)); 
	}

	public function actionOk(){
		$this->renderText("Ok example finished. <a href='index.php?r=example/eyuisearch'>Start Again</a>");
	}

	/**
		demo for EYuiForm
		
		it will use TblUser as the target user model for this form.
	*/
	public function actionEYuiForm(){
	
		// TblUser will provide extra validation for your form
		// in order to do that, it must implements: EYuiFormIValidator
		//
		$user = TblUser::model()->findByPk(1);

		/*
			please note here:
			
			If you decide not use EYuiFormDb then use:
				$this->render('eyuiform',array('model'=>YourClass::model()));
			but in YourClass.php you must implement:
				EYuiFormIStorage.php
				and
				EYuiFormIValidator.php
			this two interfaces ensure YourClass has the appropiated required methods
			to work togheter with EYuiForm.
		*/
		$this->render('eyuiform'
			,array('user'=>$user,'validationModel'=>EYuiFormDb::newModel($user)));
	}
	
	public function actionEYuiAjaxAction() 
	{ 
		$this->render('eyuiajaxaction'); 
	}	
}