From 874cbc9b922eb3924ac13ca62e392e537038a734 Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 17 Apr 2018 13:12:15 +0200 Subject: [PATCH] Added method getPhrasesByCategoryAndLanguage to system/Phrase_model It's used to retrived Phrases from DB using category and sprache as keys --- application/models/system/Phrase_model.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/application/models/system/Phrase_model.php b/application/models/system/Phrase_model.php index 775940a0c..7d2856932 100644 --- a/application/models/system/Phrase_model.php +++ b/application/models/system/Phrase_model.php @@ -22,7 +22,7 @@ class Phrase_model extends DB_Model return $ent; if (isError($ent = $this->isEntitled('system.tbl_phrasentext', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; - + $parametersArray = array('app' => $app, 'sprache' => $sprache); $query = 'SELECT phrase, @@ -36,7 +36,7 @@ class Phrase_model extends DB_Model if (isset($phrase)) { $parametersArray['phrase'] = $phrase; - + if (is_array($phrase)) { $query .= ' AND phrase IN ?'; @@ -57,7 +57,21 @@ class Phrase_model extends DB_Model $parametersArray['orgform_kurzbz'] = $orgform_kurzbz; $query .= ' AND orgform_kurzbz = ?'; } - + return $this->execQuery($query, $parametersArray); } + + /** + * + */ + public function getPhrasesByCategoryAndLanguage($categories, $language) + { + $query = 'SELECT p.category, p.phrase, pt.text + FROM system.tbl_phrase p + INNER JOIN system.tbl_phrasentext pt USING(phrase_id) + WHERE p.category IN ? + AND pt.sprache = ?'; + + return $this->execQuery($query, array($categories, $language)); + } }