Added method getPhrasesByCategoryAndLanguage to system/Phrase_model

It's used to retrived Phrases from DB using category and sprache as keys
This commit is contained in:
Paolo
2018-04-17 13:12:15 +02:00
parent ae3815fafd
commit 874cbc9b92
+17 -3
View File
@@ -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));
}
}