22.07.2013 Views

download - Index of

download - Index of

download - Index of

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

}<br />

}<br />

}<br />

$this->redirect(array('view','id'=>$model->id));<br />

$this->render('create',array(<br />

'model'=>$model,<br />

));<br />

Mari kita bahas code di atas :<br />

class MahasiswaController extends Controller<br />

{<br />

Ini adalah identitas dari controller, disini nama controllernya adalah<br />

MahasiswaController dimana class ini akan meng extends class Controller.<br />

/**<br />

* @return array action filters<br />

*/<br />

public function filters()<br />

{<br />

return array(<br />

'accessControl',<br />

);<br />

}<br />

/**<br />

* Specifies the access control rules.<br />

* This method is used by the 'accessControl' filter.<br />

* @return array access control rules<br />

*/<br />

public function accessRules()<br />

{<br />

return array(<br />

array('allow',<br />

'actions'=>array('index','view'),<br />

'users'=>array('*'),<br />

),<br />

array('allow',<br />

'actions'=>array('create','update'),<br />

'users'=>array('@'),<br />

),<br />

array('allow',<br />

'actions'=>array('admin','delete'),<br />

'users'=>array('admin'),<br />

),<br />

array('deny',<br />

'users'=>array('*'),<br />

Page 27

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!