ok seems to be one step closer to solving this, by using the
requestAction command. how can i insert the $ret data returned from
the tasklist model into the tasklist controller's $this->data ?
Membership model:
function beforeSave() {
$this->requestAction('tasklists/add');
return true;
}
Tasklist controller:
function add() {
$this->Tasklist->finddata();
if (empty($this->data)) {
$this->set('modules',
$this->Tasklist->Module->generateList());
$this->set('tasks',
$this->Tasklist->Task->generateList());
$this->set('users',
$this->Tasklist->User->generateList());
$this->render();
} else {
$this->cleanUpFields();
if ($this->Tasklist->save($this->data)) {
$this->Session->setFlash('The Tasklist has been
saved');
$this->redirect('/tasklists/index');
} else {
$this->Session->setFlash('Please correct errors
below.');
$this->set('modules',
$this->Tasklist->Module->generateList());
$this->set('tasks',
$this->Tasklist->Task->generateList());
$this->set('users',
$this->Tasklist->User->generateList());
}
}
}
Tasklist model:
function finddata() {
$ret = $this->query("SELECT `memberships`.`module_id`,
`memberships`.`user_id`, `tasks`.`id`as task_id
FROM
`memberships` , `tasks`
WHERE
`tasks`.`role_id` = `memberships`.`role_id`");
return $ret;
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---