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
|
|
@ -89,6 +89,25 @@
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all Questgroups for a Seminary.
|
||||
*
|
||||
* @param int $seminaryId ID of Seminary
|
||||
* @return array List of Questgroups
|
||||
*/
|
||||
public function getQuestgroupsForSeminary($seminaryId)
|
||||
{
|
||||
return $this->db->query(
|
||||
'SELECT id, title, url '.
|
||||
'FROM questgroups '.
|
||||
'WHERE seminary_id = ? '.
|
||||
'ORDER BY title ASC',
|
||||
'i',
|
||||
$seminaryId
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a Questgroup by its ID.
|
||||
*
|
||||
|
|
@ -503,6 +522,33 @@
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new Questgroup.
|
||||
*
|
||||
* @param int $userId User-ID that creates the new character
|
||||
* @param int $seminaryId ID of Seminary
|
||||
* @param string $title Title for new Questgroup
|
||||
* @return int ID of new Questgroup
|
||||
*/
|
||||
public function createQuestgroup($userId, $seminaryId, $title)
|
||||
{
|
||||
$this->db->query(
|
||||
'INSERT INTO questgroups '.
|
||||
'(created_user_id, seminary_id, title, url) '.
|
||||
'VALUES '.
|
||||
'(?, ?, ?, ?)',
|
||||
'iiss',
|
||||
$userId,
|
||||
$seminaryId,
|
||||
$title,
|
||||
\nre\core\Linker::createLinkParam($title)
|
||||
);
|
||||
|
||||
|
||||
return $this->db->getInsertId();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -405,6 +405,36 @@
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new Quest.
|
||||
*
|
||||
* @param int $userId User-ID that creates the new character
|
||||
* @param string $name Name for new Quest
|
||||
* @param int $questgroupId ID of Questgroup
|
||||
* @param int $questtypeId ID of Questtype
|
||||
* @param int $xps XPs for new Quest
|
||||
* @param string $wrongtext Wrongtext for new Quest
|
||||
* @param string $task Task for new Quest
|
||||
* @return int ID of new Quest
|
||||
*/
|
||||
public function createQuest($userId, $name, $questgroupId, $questtypeId, $xps, $wrongtext, $task)
|
||||
{
|
||||
$this->db->query(
|
||||
'INSERT INTO quests '.
|
||||
'(created_user_id, questgroup_id, questtype_id, title, url, xps, wrong_text, task) '.
|
||||
'VALUES '.
|
||||
'(?, ?, ?, ?, ?, ?, ?, ?)',
|
||||
'iiississ',
|
||||
$userId, $questgroupId, $questtypeId,
|
||||
$name, \nre\core\Linker::createLinkParam($name),
|
||||
$xps, $wrongtext, $task
|
||||
);
|
||||
|
||||
|
||||
return $this->db->getInsertId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -34,6 +34,21 @@
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Get all registered Questtypes.
|
||||
*
|
||||
* @return array List of registered Questtypes
|
||||
*/
|
||||
public function getQuesttypes()
|
||||
{
|
||||
return $this->db->query(
|
||||
'SELECT id, title, url, classname '.
|
||||
'FROM questtypes '.
|
||||
'ORDER BY title ASC'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a Questtype by its ID
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue