add ?entry text? to Quests and show them instead of the name

This commit is contained in:
coderkun 2014-04-17 13:53:21 +02:00
commit 7958dddd05
4 changed files with 61 additions and 8 deletions

View file

@ -69,6 +69,47 @@
}
/**
* Get count of Questtexts for a Quest.
*
* @param int $questId ID of the Quest
* @param string $questtexttypeUrl URL of the Questtexttype
* @return int Amount of Questtexts for a Quest
*/
public function getQuesttextCountOfQuest($questId, $questtexttypeUrl=null)
{
if(is_null($questtexttypeUrl))
{
$data = $this->db->query(
'SELECT count(questtexts.id) AS c '.
'FROM questtexts '.
'LEFT JOIN questtexttypes ON questtexttypes.id = questtexts.questtexttype_id '.
'WHERE questtexts.quest_id = ?',
'i',
$questId
);
}
else
{
$data = $this->db->query(
'SELECT count(questtexts.id) AS c '.
'FROM questtexts '.
'LEFT JOIN questtexttypes ON questtexttypes.id = questtexts.questtexttype_id '.
'WHERE questtexts.quest_id = ? and questtexttypes.url = ?',
'is',
$questId,
$questtexttypeUrl
);
}
if(!empty($data)) {
return $data[0]['c'];
}
return 0;
}
/**
* Get corresponding Questtext for a Sidequest.
*