mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 16:32:20 +00:00
Adapted MessageLib, PhrasesLib and UDFLib to use the function getUserLanguage from language_helper
This commit is contained in:
@@ -268,7 +268,7 @@ class MessageLib
|
||||
}
|
||||
|
||||
/**
|
||||
* sendMessageVorlage() - sends new internal message using a template
|
||||
* Sends new internal message using a template
|
||||
*/
|
||||
public function sendMessageVorlage($sender_id, $receiver_id, $vorlage_kurzbz, $oe_kurzbz, $data, $relationmessage_id = null, $orgform_kurzbz = null, $multiPartMime = true)
|
||||
{
|
||||
@@ -298,16 +298,12 @@ class MessageLib
|
||||
{
|
||||
$receiver_id = $receivers->retval[$i]->person_id;
|
||||
|
||||
// Checks if the receiver exists
|
||||
$result = $this->ci->PersonModel->load($receiver_id);
|
||||
if (hasData($result))
|
||||
{
|
||||
// Set the language with the global value
|
||||
$sprache = DEFAULT_LANGUAGE;
|
||||
// If the receiver has a prefered language use this
|
||||
if (isset($result->retval[0]->sprache) && $result->retval[0]->sprache != '')
|
||||
{
|
||||
$sprache = $result->retval[0]->sprache;
|
||||
}
|
||||
// Retrives the language of the logged user
|
||||
$sprache = getUserLanguage();
|
||||
|
||||
// Loads template data
|
||||
$result = $this->ci->vorlagelib->loadVorlagetext($vorlage_kurzbz, $oe_kurzbz, $orgform_kurzbz, $sprache);
|
||||
|
||||
@@ -242,21 +242,8 @@ class PhrasesLib
|
||||
$categories = array($categories);
|
||||
}
|
||||
|
||||
// Use the given language if present, otherwise retrives the language for the logged user
|
||||
$language = DEFAULT_LANGUAGE;
|
||||
if (count($parameters) == 2 && !isEmptyString($parameters[1]) && is_string($parameters[1]))
|
||||
{
|
||||
$language = $parameters[1];
|
||||
}
|
||||
// Checks if the user is authenticated to retrive the users's language
|
||||
// NOTE: this library could be called when the user is not logged in the system
|
||||
// so this is why is checked if the function getAuthUID exists
|
||||
elseif (function_exists('getAuthUID'))
|
||||
{
|
||||
$this->_ci->load->model('person/Person_model', 'PersonModel');
|
||||
|
||||
$language = $this->_ci->PersonModel->getLanguage(getAuthUID());
|
||||
}
|
||||
// Retrives the language of the logged user
|
||||
$language = getUserLanguage(count($parameters) == 2 ? $parameters[1] : null);
|
||||
|
||||
// If only categories is not an empty array then loads phrases
|
||||
if (count($categories) > 0) $this->_setPhrases($categories, $language);
|
||||
|
||||
@@ -711,7 +711,7 @@ class UDFLib
|
||||
|| isset($jsonSchema->{UDFLib::TITLE})
|
||||
|| isset($jsonSchema->{UDFLib::PLACEHOLDER}))
|
||||
{
|
||||
// Loads PhrasesLib
|
||||
// Loads phrases library
|
||||
$this->_ci->load->library('PhrasesLib');
|
||||
|
||||
// If is set the label property in the json schema
|
||||
@@ -720,7 +720,7 @@ class UDFLib
|
||||
// Load the related phrase
|
||||
$tmpResult = $this->_ci->phraseslib->getPhrases(
|
||||
UDFLib::PHRASES_APP_NAME,
|
||||
DEFAULT_LANGUAGE,
|
||||
getUserLanguage(),
|
||||
$jsonSchema->{UDFLib::LABEL},
|
||||
null,
|
||||
null,
|
||||
@@ -738,7 +738,7 @@ class UDFLib
|
||||
// Load the related phrase
|
||||
$tmpResult = $this->_ci->phraseslib->getPhrases(
|
||||
UDFLib::PHRASES_APP_NAME,
|
||||
DEFAULT_LANGUAGE,
|
||||
getUserLanguage(),
|
||||
$jsonSchema->{UDFLib::TITLE},
|
||||
null,
|
||||
null,
|
||||
@@ -756,7 +756,7 @@ class UDFLib
|
||||
// Load the related phrase
|
||||
$tmpResult = $this->_ci->phraseslib->getPhrases(
|
||||
UDFLib::PHRASES_APP_NAME,
|
||||
DEFAULT_LANGUAGE,
|
||||
getUserLanguage(),
|
||||
$jsonSchema->{UDFLib::PLACEHOLDER},
|
||||
null,
|
||||
null,
|
||||
|
||||
Reference in New Issue
Block a user