mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 10:22:18 +00:00
- Added Phrase controller
- Phrase controller has the method getPhrases() to get sentences translated into several languages - Added method getPhrases to PhrasesLib - Modified the PhrasesLib constructor to pass the uid to the models - Added method getPhrases to Phrase_model
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
class Phrase_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -12,4 +12,57 @@ class Phrase_model extends DB_Model
|
||||
$this->pk = 'phrase_id';
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function getPhrases($app, $sprache, $phrase = null, $orgeinheit_kurzbz = null, $orgform_kurzbz = null)
|
||||
{
|
||||
// Checks if the operation is permitted by the API caller
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl['public.tbl_phrase'], 's'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['public.tbl_phrase'], FHC_MODEL_ERROR);
|
||||
if (! $this->fhc_db_acl->isBerechtigt($this->acl['public.tbl_phrase_inhalt'], 's'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['public.tbl_phrase_inhalt'], FHC_MODEL_ERROR);
|
||||
|
||||
$parametersArray = array('app' => $app, 'sprache' => $sprache);
|
||||
|
||||
$query = 'SELECT phrase,
|
||||
sprache,
|
||||
orgeinheit_kurzbz,
|
||||
orgform_kurzbz,
|
||||
text
|
||||
FROM public.tbl_phrase JOIN public.tbl_phrase_inhalt USING (phrase_id)
|
||||
WHERE app = ? AND sprache = ?';
|
||||
|
||||
if (isset($phrase))
|
||||
{
|
||||
$parametersArray['phrase'] = $phrase;
|
||||
|
||||
if (is_array($phrase))
|
||||
{
|
||||
$query .= ' AND phrase IN ?';
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= ' AND phrase = ?';
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($orgeinheit_kurzbz))
|
||||
{
|
||||
$parametersArray['orgeinheit_kurzbz'] = $orgeinheit_kurzbz;
|
||||
$query .= ' AND orgeinheit_kurzbz = ?';
|
||||
}
|
||||
if (isset($orgform_kurzbz))
|
||||
{
|
||||
$parametersArray['orgform_kurzbz'] = $orgform_kurzbz;
|
||||
$query .= ' AND orgform_kurzbz = ?';
|
||||
}
|
||||
|
||||
$result = $this->db->query($query, $parametersArray);
|
||||
|
||||
if (is_object($result))
|
||||
return $this->_success($result->result());
|
||||
else
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user