Added PHRASES translation for javascript

added:
. PhrasesLib.js: translate method for retreiving phrasentexte in users language with JS
. PhrasesLib.php: methods to retrieve data from Phrase_model and return as JSON
. Phrase_model: method to perform query for categories AND phrases-array AND language
. FHC-Header.php:
 -- included js lib
 -- generate global FHC_JS_PHRASES_STORAGE_OBJECT

Changes of other files: loading libs, inits,...
This commit is contained in:
Cris
2018-05-29 14:13:00 +02:00
parent 11ca6fb0cf
commit 865eea2245
8 changed files with 244 additions and 10 deletions
@@ -77,6 +77,40 @@ class Phrase_model extends DB_Model
return $this->execQuery($query, array($categories, $language));
}
/**
*
*/
public function getPhrasesByCategoryAndPhrasesAndLanguage($phrasesParams, $language)
{
$qry = '
SELECT p.category, p.phrase, pt.orgeinheit_kurzbz, pt.orgform_kurzbz, pt.text
FROM system.tbl_phrase p
INNER JOIN system.tbl_phrasentext pt USING(phrase_id)
WHERE ';
foreach ($phrasesParams as $category => $phrases)
{
$qry .= '
(p.category = \'' . $category . '\'
AND phrase IN (';
foreach ($phrases as $phrase)
{
$qry .= '\'' . $phrase . '\', ';
}
$qry = rtrim($qry, ', ');
$qry .= ')) AND pt.sprache = \'' . $language . '\' OR ';
}
$qry = rtrim($qry, 'OR ');
return $this->execQuery($qry, array($phrasesParams, $language));
}
/**
* Loads all categories