gruops_controller.php

<?php
class GroupsController extends AppController {
var $name = 'Groups';
function index() {
$this->set('groups', $this->Group->find('all'));
}
function add() {
if(!empty($this->data)) {
if($this->Group->save($this->data)) {
$this->Session->setFlash("تم حفظ القائمة");
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash("لم يتم الحفظ، حاول ثانية");
}
} else {
$this->Session->setFlash("أضف قائمة جديدة");
}
}
}
?>

index.ctp

<?php echo $form->create('Group'); ?>
<fieldset>
	<legend>أضف قائمة جديدة</legend>
	<?php echo $form->input('groupname', array('label' => 'إسم القائمة')); ?>
</fieldset>
<?php echo $form->end('أضف'); ?>

add.ctp

<?php echo $form->create('Group'); ?>
<fieldset>
	<legend>أضف قائمة جديدة</legend>
	<?php echo $form->input('groupname', array('label' => 'إسم القائمة')); ?>
</fieldset>
<?php echo $form->end('أضف'); ?>

default.ctp

<html>
	<body>
		<h2>مهمات</h2>
		<?php echo $content_for_layout ?>
	</body>
</html>

group.php

<?
class Group extends AppModel {
var $name = 'Group';
}
?>