implement rudimental form for creating Quests and Questgroups
This commit is contained in:
parent
b64577a221
commit
bfe9155fe4
7 changed files with 271 additions and 7 deletions
|
|
@ -31,7 +31,8 @@
|
|||
* @var array
|
||||
*/
|
||||
public $permissions = array(
|
||||
'questgroup' => array('admin', 'moderator', 'user')
|
||||
'questgroup' => array('admin', 'moderator', 'user'),
|
||||
'create' => array('admin', 'moderator', 'user')
|
||||
);
|
||||
/**
|
||||
* User seminary permissions
|
||||
|
|
@ -39,7 +40,8 @@
|
|||
* @var array
|
||||
*/
|
||||
public $seminaryPermissions = array(
|
||||
'questgroup' => array('admin', 'moderator', 'user')
|
||||
'questgroup' => array('admin', 'moderator', 'user'),
|
||||
'create' => array('admin', 'moderator')
|
||||
);
|
||||
|
||||
|
||||
|
|
@ -174,6 +176,45 @@
|
|||
$this->set('quests', $quests);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: create.
|
||||
*
|
||||
* Create a new Questgroup.
|
||||
*
|
||||
* @param string $seminaryUrl URL-Title of a Seminary
|
||||
*/
|
||||
public function create($seminaryUrl)
|
||||
{
|
||||
// Get seminary
|
||||
$seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl);
|
||||
|
||||
// Create Questgroup
|
||||
$validation = true;
|
||||
if($this->request->getRequestMethod() == 'POST' && !is_null($this->request->getPostParam('create')))
|
||||
{
|
||||
// TODO Validation
|
||||
$title = $this->request->getPostParam('title');
|
||||
|
||||
// Create new Questgroup
|
||||
if($validation === true)
|
||||
{
|
||||
$questgroupId = $this->Questgroups->createQuestgroup(
|
||||
$this->Auth->getUserId(),
|
||||
$seminary['id'],
|
||||
$title
|
||||
);
|
||||
|
||||
// Redirect
|
||||
$this->redirect($this->linker->link(array('seminaries', 'seminary', $seminary['url'])));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Pass data to view
|
||||
$this->set('seminary', $seminary);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue