Merge branch 'phrases'

This commit is contained in:
Cris
2018-06-06 15:14:33 +02:00
16 changed files with 699 additions and 146 deletions
+2 -2
View File
@@ -25,11 +25,11 @@ class FHC_Controller extends CI_Controller
* NOTE: The library is loaded with the alias 'p', so must me used with this alias in the rest of the code.
* EX: $this->p->t(<category>, <phrase name>)
*/
public function loadPhrases($categories, $language = null)
protected function loadPhrases($categories, $language = null)
{
$this->load->library('PhrasesLib', array($categories, $language), 'p');
}
/**
* Sets the unique id for the called controller
* NOTE: it is only working with HTTP GET request, not neeaded with POST
+126 -68
View File
@@ -14,6 +14,8 @@ class PhrasesLib
{
$this->_ci =& get_instance();
$this->_phrases = null; // set the property _phrases as null by default
// CI parser
$this->_ci->load->library('parser');
@@ -78,7 +80,6 @@ class PhrasesLib
return $this->_ci->PhraseModel->update($phrase_id, $data);
}
/**
* getVorlagetextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template.
*/
@@ -179,91 +180,60 @@ class PhrasesLib
}
/**
*
* Retrives a phrases from the the property _phrases with the given parameters
* It also replace parameters inside the phrase if they are provided
* @param string $category Category name which is used to categorize the phrase.
* @param string $phrase Phrase name.
* @param array $parameters Array of String var(s) to be set into phrases' placeholder values (order matters).
* @return string Phrase text
*/
public function t($category, $phrase, $parameters = array(), $orgeinheit_kurzbz = null, $orgform_kurzbz = null)
{
if (isset($this->_phrases) && is_array($this->_phrases))
// If the property _phrases is populated
if (is_array($this->_phrases))
{
// Loops through the _phrases property
for ($i = 0; $i < count($this->_phrases); $i++)
{
$_phrase = $this->_phrases[$i];
$_phrase = $this->_phrases[$i]; // single phrase
// If the single phrase match the given parameters and is not an empty string
if ($_phrase->category == $category
&& $_phrase->phrase == $phrase
&& $_phrase->orgeinheit_kurzbz == $orgeinheit_kurzbz
&& $_phrase->orgform_kurzbz== $orgform_kurzbz
&& (!empty($_phrase->text)))
{
if ($parameters == null)
$parameters = array();
return $this->_ci->parser->parse_string($_phrase->text, $parameters, true);
}
}
//fallback 1: if phrase not found in phrases-array, try with default language
$default_language = DEFAULT_LANGUAGE;
$categories = $this->_ci->PhraseModel->getCategories();
if (hasData($categories))
{
$categories = $categories->retval;
foreach($categories as $cat)
$all_categories[] = $cat->category;
}
$phrases = $this->_ci->PhraseModel->getPhrasesByCategoryAndLanguage($all_categories, $default_language);
if (hasData($phrases))
{
$default_phrases = $phrases->retval;
}
if (isset($default_phrases) && is_array($default_phrases))
{
for ($i = 0; $i < count($default_phrases); $i++)
&& $_phrase->orgform_kurzbz == $orgform_kurzbz
&& (!empty(trim($_phrase->text))))
{
$_phrase = $default_phrases[$i];
// var_dump($_phrase);
// echo $phrase . "<br>";
// echo $_phrase->phrase . "<br><br>";
if (!is_array($parameters)) $parameters = array(); // if params is not an array
if ($_phrase->category == $category
&& $_phrase->phrase == $phrase
&& $_phrase->orgeinheit_kurzbz == $orgeinheit_kurzbz
&& $_phrase->orgform_kurzbz== $orgform_kurzbz)
{
if ($parameters == null)
$parameters = array();
return $this->_ci->parser->parse_string($_phrase->text, $parameters, true);
}
return $this->_ci->parser->parse_string($_phrase->text, $parameters, true); // parsing
}
}
//fallback 2: if phrase not found at all, return phrasename
$phrase = '<< PHRASE ' . $phrase . ' >>';
return $this->_ci->parser->parse_string($phrase, $parameters, true);
}
}
// If a valid phrase is not found
return '<< PHRASE '.$phrase.' >>';
}
// -----------------------------------------------------------------------------------------------------------------
// Private methods
/**
* Extends the functionalities of the constructor of this class
* This is a workaround to use more parameters in the construct since PHP doesn't support many constructors
* The new accepted parameters are:
* - categories: could be a string or an array of strings. These are the categories used to load phrases
* - language: optional parameter must be a string. It's used to load phrases
* @param (array) $params Array of categories and (optional) language.
* categories:
* - could be a string or an array of strings. These are the categories used to load phrases
* - could be an array of categories, and for each category there is an array of phrases
* language: optional parameter must be a string. It's used to load phrases
*/
private function _extend_construct($params)
{
// Checks if the $params is an array with at least one element
if (is_array($params) && count($params) > 0)
{
$parameters = $params[0]; // temporary variable
$parameters = $params[0]; // temporary variable
$isIndexArray = false; //flag for indexed array
// If there are parameters
if (is_array($parameters) && count($parameters) > 0)
@@ -287,15 +257,103 @@ class PhrasesLib
$language = $this->_ci->PersonModel->getLanguage(getAuthUID());
}
// Loads phrases
$phrases = $this->_ci->PhraseModel->getPhrasesByCategoryAndLanguage($categories, $language);
// If there are phrases loaded then store them in the property _phrases
if (hasData($phrases))
{
$this->_phrases = $phrases->retval;
}
$this->_setPhrases($categories, $language);
}
}
}
/**
* Retrieves phrases in the users language.
* If a phrase is not set in the users language it will be retrieved in the default language.
* Stores phrases-array in property $_phrases.
* @param array $categories Could be an:
* - indexed array: string or an array of strings. These are the categories used to load phrases.
* - associative array: of categories, and for each category there is an array of phrases.
* @param string User's language or default language.
*/
private function _setPhrases($categories, $language)
{
$phrases = null;
// Checks if categories is associative or indexed array
if (ctype_digit(implode('', array_keys($categories))))
{
// is indexed array -> Loads phrases
$isIndexArray = true;
$phrases = $this->_ci->PhraseModel->getPhrasesByCategoryAndLanguage($categories, $language);
}
else
{
// is assoc array -> Loads specific phrasentexte by category and phrases
$isIndexArray = false;
$phrases = $this->_ci->PhraseModel
->getPhrasesByCategoryAndPhrasesAndLanguage($categories, $language);
}
// If language is not default language and phrasentext is null -> fallback to default language
if ($language != DEFAULT_LANGUAGE)
{
// get array with phrasentexte in the default language
$defaultPhrases = null;
if ($isIndexArray)
{
$defaultPhrases = $this->_ci->PhraseModel
->getPhrasesByCategoryAndLanguage($categories, DEFAULT_LANGUAGE);
}
else
{
$defaultPhrases = $this->_ci->PhraseModel
->getPhrasesByCategoryAndPhrasesAndLanguage($categories, DEFAULT_LANGUAGE);
}
// combine array with phrasentexte in users language and in default language
// (default used if phrasentext in users language is null or not set)
if (hasData($phrases) && hasData($defaultPhrases))
{
// loop through phrases in default language
foreach ($defaultPhrases->retval as $defaultPhrase)
{
$found = false; // flag for found phrase
// loop through phrases in users language
foreach ($phrases->retval as $phrase)
{
// if same phrase and category found and text is not null
// use phrase in users language
if ($phrase->phrase == $defaultPhrase->phrase
&& $phrase->category == $defaultPhrase->category
&& !is_null($phrase->text))
{
$found = true;
break;
}
}
// otherwise use phrase in default language
if (!$found)
{
array_push($phrases->retval, $defaultPhrase);
}
}
}
elseif (hasData($defaultPhrases))
{
$phrases = $defaultPhrases;
}
}
// If there are phrases loaded then store them in the property _phrases
if (hasData($phrases))
{
$this->_phrases = $phrases->retval;
}
}
/**
* Returns the property _phrases JSON encoded
* @return json encoded property _phrases
*/
public function getJSON()
{
return json_encode($this->_phrases);
}
}
+23 -6
View File
@@ -79,13 +79,30 @@ class Phrase_model extends DB_Model
}
/**
* Loads all categories
* Loads phrases using category(s) and language as keys using associative category array
* that contains also phrases for each category
*/
public function getCategories()
public function getPhrasesByCategoryAndPhrasesAndLanguage($phrasesParams, $language)
{
$query = 'SELECT DISTINCT category
FROM system.tbl_phrase';
$query = '
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 pt.sprache = ? AND ';
return $this->execQuery($query);
$parametersArray = array($language);
foreach ($phrasesParams as $category => $phrases)
{
$query .= '(category = ? AND phrase IN ?) OR ';
$parametersArray[] = $category;
$parametersArray[] = $phrases;
}
$query = rtrim($query, ' OR ');
$query .= ' ORDER BY p.category, p.phrase, pt.orgeinheit_kurzbz DESC, pt.orgform_kurzbz DESC';
return $this->execQuery($query, $parametersArray);
}
}
}
@@ -5,12 +5,18 @@
'title' => 'Info Center',
'jquery' => true,
'jqueryui' => true,
'ajaxlib' => true,
'bootstrap' => true,
'fontawesome' => true,
'sbadmintemplate' => true,
'tablesorter' => true,
'ajaxlib' => true,
'filterwidget' => true,
'phrases' => array(
'person' => array('vorname', 'nachname'),
'global' => array('mailAnXversandt'),
'ui' => array('bitteEintragWaehlen')
),
'navigationwidget' => true,
'customCSSs' => 'public/css/sbadmin2/tablesort_bootstrap.css',
'customJSs' => array('public/js/bootstrapper.js', 'public/js/infocenter/infocenterPersonDataset.js')
@@ -27,12 +33,17 @@
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h3 class="page-header">Infocenter <?php echo ucfirst($this->p->t('global', 'uebersicht')); ?></h3>
<h3 class="page-header">Infocenter
<?php echo ucfirst($this->p->t('global', 'uebersicht')); ?>
</h3>
</div>
</div>
<div>
<?php
$this->load->view('system/infocenter/infocenterData.php', array('fhc_controller_id' => $fhc_controller_id));
$this->load->view(
'system/infocenter/infocenterData.php',
array('fhc_controller_id' => $fhc_controller_id)
);
?>
</div>
</div>
@@ -7,6 +7,8 @@
'bootstrap' => true,
'fontawesome' => true,
'jqueryui' => true,
'ajaxlib' => true,
'phraseslib' => true,
'tablesorter' => true,
'tinymce' => true,
'sbadmintemplate' => true,
@@ -22,8 +24,33 @@
array(
'public/js/bootstrapper.js',
'public/js/tablesort/tablesort.js',
'public/js/infocenter/infocenterDetails.js')
'public/js/infocenter/infocenterDetails.js'
),
'phrases' =>
array(
'infocenter' =>
array(
'notizHinzufuegen',
'notizAendern',
'bewerberParken',
'bewerberAusparken',
'nichtsZumAusparken',
'fehlerBeimAusparken',
'fehlerBeimParken',
'bewerberGeparktBis'
),
'ui' =>
array(
'gespeichert',
'fehlerBeimSpeichern'
),
'global' =>
array(
'bis',
'zeilen'
)
)
)
);
?>
<body>
@@ -42,14 +69,17 @@
</div>
<div class="col-lg-4">
<div class="headerright text-right">
<?php echo $this->p->t('global', 'wirdBearbeitetVon') . ':' ?>
<?php echo $this->p->t('global', 'wirdBearbeitetVon').':' ?>
<?php
if (isset($lockedby)):
echo $lockedby;
?>
&nbsp;&nbsp;
<a href="../unlockPerson/<?php echo $stammdaten->person_id; ?>?fhc_controller_id=<?php echo $fhc_controller_id; ?>"><i
class="fa fa-sign-out"></i>&nbsp;<?php echo ucfirst($this->p->t('ui', 'freigeben')) ?></a>
<a href="../unlockPerson/<?php echo $stammdaten->person_id; ?>
?fhc_controller_id=<?php echo $fhc_controller_id; ?>">
<i class="fa fa-sign-out"></i>&nbsp;
<?php echo ucfirst($this->p->t('ui', 'freigeben')) ?>
</a>
<?php endif; ?>
</div>
</div>
@@ -59,7 +89,9 @@
<div class="row">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading text-center"><h4><?php echo ucfirst($this->p->t('global','stammdaten')) ?></h4></div>
<div class="panel-heading text-center">
<h4><?php echo ucfirst($this->p->t('global', 'stammdaten')) ?></h4>
</div>
<div class="panel-body">
<?php $this->load->view('system/infocenter/stammdaten.php'); ?>
<?php $this->load->view('system/infocenter/anmerkungenZurBewerbung.php'); ?>
@@ -73,7 +105,9 @@
<div class="col-lg-12">
<div class="panel panel-primary">
<a name="DokPruef"></a><!-- anchor for jumping to the section -->
<div class="panel-heading text-center"><h4><?php echo ucfirst($this->p->t('infocenter','dokumentenpruefung')) ?></h4></div>
<div class="panel-heading text-center">
<h4><?php echo ucfirst($this->p->t('infocenter', 'dokumentenpruefung')) ?></h4>
</div>
<div class="panel-body">
<?php $this->load->view('system/infocenter/dokpruefung.php'); ?>
</div> <!-- ./panel-body -->
@@ -87,7 +121,8 @@
<div class="panel panel-primary">
<div class="panel-heading text-center">
<a name="ZgvPruef"></a>
<h4><?php echo $this->p->t('infocenter', 'zgv') . ' - ' . ucfirst($this->p->t('lehre','pruefung'))?></h4>
<h4><?php echo $this->p->t('infocenter', 'zgv'). ' - '.
ucfirst($this->p->t('lehre', 'pruefung'))?></h4>
</div>
<div class="panel-body">
<?php $this->load->view('system/infocenter/zgvpruefungen.php'); ?><!-- /.panel-group -->
@@ -102,7 +137,7 @@
<div class="panel panel-primary">
<div class="panel-heading text-center">
<a name="Nachrichten"></a>
<h4 class="text-center"><?php echo ucfirst($this->p->t('global','nachrichten')) ?></h4>
<h4 class="text-center"><?php echo ucfirst($this->p->t('global', 'nachrichten')) ?></h4>
</div>
<div class="panel-body">
<div class="row">
@@ -121,7 +156,8 @@
<div class="panel panel-primary">
<div class="panel-heading text-center">
<a name="NotizAkt"></a>
<h4 class="text-center"><?php echo ucfirst($this->p->t('global','notizen')) . ' & ' . ucfirst($this->p->t('global','aktivitaeten')) ?></h4>
<h4 class="text-center"><?php echo ucfirst($this->p->t('global', 'notizen')). ' & '.
ucfirst($this->p->t('global', 'aktivitaeten')) ?></h4>
</div>
<div class="panel-body">
<div class="row">
@@ -17,13 +17,13 @@ $this->load->view(
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h3 class="page-header">Zugangsvoraussetzungen <?php echo $studiengang_kurzbz; ?> - <?php echo $studiengang_bezeichnung; ?></h3>
<h3 class="page-header"><?php echo $this->p->t('infocenter', 'zugangsvoraussetzungen'); ?> <?php echo $studiengang_kurzbz; ?> - <?php echo $studiengang_bezeichnung; ?></h3>
</div>
</div>
<div id="data">
<?php if (empty($data)): ?>
Keine Zugangsvoraussetzungen für den Studiengang definiert
<?php
<?php echo $this->p->t('infocenter', 'keineZugangsvoraussetzungenTxt'); ?>
<?php
else:
echo json_decode($data);
endif;
@@ -201,7 +201,7 @@
</div>
</div>
<div class="col-lg-<?php echo $columns[3] ?>">
<div class="form-group"><label><?php echo $this->p->t('infocenter', 'zgv') . ' ' . $this->p->t('lehre','master') . ' ' . $this->p->t('person','nation') . ':'?></label>
<div class="form-group"><label><?php echo $this->p->t('infocenter', 'zgv') . ' ' . $this->p->t('lehre','master') . ' ' . $this->p->t('person', 'nation') . ':'?></label>
<?php
if ($infoonly)
echo $zgvpruefung->zgvmanation_bez;
@@ -220,7 +220,7 @@
<div class="row">
<div class="col-xs-6 text-left">
<button type="button" class="btn btn-default zgvUebernehmen" id="zgvUebernehmen_<?php echo $zgvpruefung->prestudent_id ?>">
<?php echo $this->p->t('infocenter', 'letzteZgvUebernehmen') ?>
<?php echo $this->p->t('infocenter', 'letzteZgvUebernehmen') ?>
</button>
</div>
<div class="col-xs-6 text-right">
@@ -249,7 +249,7 @@
class="d-inline float-right"
required>
<option value="null"
selected="selected"><?php echo $this->p->t('infocenter', 'absagegrund', array($this->p->t('global', 'waehlen'))) . '...' ?>
selected="selected"><?php echo ucfirst($this->p->t('infocenter', 'absagegrund')) . '...' ?>
</option>
<?php foreach ($statusgruende as $statusgrund): ?>
<option value="<?php echo $statusgrund->statusgrund_id ?>"><?php echo $statusgrund->bezeichnung_mehrsprachig[0] ?></option>
@@ -323,7 +323,7 @@
data-toggle="modal"
data-target="#freigabeModal_<?php echo $zgvpruefung->prestudent_id ?>"
data-toggle="tooltip" title="<?php echo $disabledTxt ?>">
<?php echo $this->p->t('ui', 'freigabeAnStudiengang') ?>
<?php echo $this->p->t('ui', 'freigabeAnStudiengang') ?>
</button>
</div>
</div>
@@ -340,10 +340,10 @@
</button>
<h4 class="modal-title"
id="freigabeModalLabel">
<?php echo $this->p->t('global', 'freigabeBestaetigen') ?></h4>
<?php echo $this->p->t('infocenter', 'freigabeBestaetigen') ?></h4>
</div>
<div class="modal-body">
<?php echo $this->p->t('infocenter', 'interessentFreigebenTxt') ?>
<?php echo $this->p->t('infocenter', 'interessentFreigebenTxt') ?>
</div>
<div class="modal-footer">
<button type="button"
@@ -353,7 +353,7 @@
<a href="../saveFreigabe/<?php echo $zgvpruefung->prestudent_id ?>?fhc_controller_id=<?php echo $fhc_controller_id; ?>">
<button type="button"
class="btn btn-primary">
<?php echo $this->p->t('infocenter', 'interessentFreigeben') ?>
<?php echo $this->p->t('infocenter', 'interessentFreigeben') ?>
</button>
</a>
</div>
+31 -3
View File
@@ -11,6 +11,7 @@ $calledMethod = $this->router->method;
$title = isset($title) ? $title : null;
$customCSSs = isset($customCSSs) ? $customCSSs : null;
$customJSs = isset($customJSs) ? $customJSs : null;
$phrases = isset($phrases) ? $phrases : null;
// By default set the parameters to false
$jquery = isset($jquery) ? $jquery : false;
@@ -84,6 +85,25 @@ function _generateJSDataStorageObject($calledPath, $calledMethod)
echo $toPrint;
}
/**
* Generates global JS-Object to pass phrases to other javascripts
*/
function _generateJSPhrasesStorageObject($phrases)
{
$ci =& get_instance();
$ci->load->library('PhrasesLib', array($phrases), 'pj');
$toPrint = "\n";
$toPrint .= '<script type="text/javascript">';
$toPrint .= "\n";
$toPrint .= 'var FHC_JS_PHRASES_STORAGE_OBJECT = '.$ci->pj->getJSON();
$toPrint .= "\n";
$toPrint .= '</script>';
$toPrint .= "\n\n";
echo $toPrint;
}
/**
* Generates tags for the javascripts you want to include, the parameter could by a string or an array of strings
*/
@@ -184,6 +204,10 @@ function _generateAddonsJSsInclude($calledFrom)
// NOTE: must be called before any other JS include
_generateJSDataStorageObject($calledPath, $calledMethod);
// Generates the global object to pass phrases to javascripts
// NOTE: must be called before including the PhrasesLib.js
_generateJSPhrasesStorageObject($phrases);
// JQuery V3
if ($jquery === true) _generateJSsInclude('vendor/components/jquery/jquery.min.js');
@@ -194,9 +218,6 @@ function _generateAddonsJSsInclude($calledFrom)
_generateJSsInclude('vendor/components/jqueryui/ui/i18n/datepicker-de.js'); // datepicker german language file
}
// AjaxLib JS
if ($ajaxlib === true) _generateJSsInclude('public/js/AjaxLib.js');
// Bootstrap JS
if ($bootstrap === true) _generateJSsInclude('vendor/twbs/bootstrap/dist/js/bootstrap.min.js');
@@ -218,6 +239,13 @@ function _generateAddonsJSsInclude($calledFrom)
_generateJSsInclude('vendor/BlackrockDigital/startbootstrap-sb-admin-2/dist/js/sb-admin-2.min.js');
}
// AjaxLib JS
// NOTE: must be called before including others JS libraries that use it
if ($ajaxlib === true) _generateJSsInclude('public/js/AjaxLib.js');
// PhrasesLib JS
if ($phrases != null) _generateJSsInclude('public/js/PhrasesLib.js');
// FilterWidget JS
if($filterwidget === true) _generateJSsInclude('public/js/FilterWidget.js') ;
@@ -2,14 +2,14 @@
<div>
<span class="filter-options-span">
Filter description:
<?php echo ucfirst($this->p->t('global', 'beschreibung')); ?>:
</span>
<span>
<input type="text" id="customFilterDescription" value="">
</span>
<span>
<input type="button" id="saveCustomFilterButton" value="Save filter">
<input type="button" id="saveCustomFilterButton" value="<?php echo ucfirst($this->p->t('ui', 'speichern')); ?>">
</span>
</div>
@@ -2,7 +2,7 @@
<div>
<span class="filter-options-span">
Add field:
<?php echo ucfirst($this->p->t('filter', 'feldHinzufuegen')); ?>:
</span>
<span>
@@ -4,7 +4,7 @@
<div>
<span class="filter-options-span">
Add filter:
<?php echo ucfirst($this->p->t('filter', 'filterHinzufuegen')); ?>:
</span>
<span>
@@ -12,6 +12,6 @@
</span>
<span>
<input id="applyFilter" type="button" value="Apply filter">
<input id="applyFilter" type="button" value="<?php echo ucfirst($this->p->t('global', 'hinzufuegen')); ?>">
</span>
</div>
+2 -2
View File
@@ -78,7 +78,7 @@ var FHC_FilterWidget = {
$("#filterSelectFieldsDnd").append(strHtml);
}
var strDropDown = '<option value="">Select a field to add...</option>';
var strDropDown = '<option value="">' + FHC_PhraseLib.t('ui', 'bitteEintragWaehlen') + '</option>';
$("#addField").append(strDropDown);
if (data.allSelectedFields != null)
@@ -126,7 +126,7 @@ var FHC_FilterWidget = {
if (data != null)
{
var strDropDown = '<option value="">Select a filter to add...</option>';
var strDropDown = '<option value="">' + FHC_PhraseLib.t('ui', 'bitteEintragWaehlen') + '</option>';
$("#addFilter").append(strDropDown);
if (data.selectedFilters != null)
+73
View File
@@ -0,0 +1,73 @@
/**
* FH-Complete
*
* @package
* @author
* @copyright Copyright (c) 2016 fhcomplete.org
* @license GPLv3
* @link https://fhcomplete.org
* @since Version 1.0.0
*/
/**
* Definition and initialization of object FHC_PhraseLib
*/
var FHC_PhraseLib = {
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Returns the phrase-text in the user's language
* @param {String} category : phrase-category
* @param {String} phrase : phrase-name
* @param {array} params : String-parameters to be set in variables in phrasentext
* @returns {String} : phrase-text
*/
t: function (category, phrase, params = []) {
// Checks if FHC_JS_PHRASES_STORAGE_OBJECT is an array
if ($.isArray(FHC_JS_PHRASES_STORAGE_OBJECT))
{
// loop through global JS PHRASES STORAGE OBJECT and search for phrase
for (i in FHC_JS_PHRASES_STORAGE_OBJECT)
{
var phraseObj = FHC_JS_PHRASES_STORAGE_OBJECT[i]; // Single phrase object
// If the single phrase match the given parameters and is not an empty string
if (phraseObj.category == category
&& phraseObj.phrase == phrase
&& phraseObj.text != null
&& phraseObj.text.trim() != '')
{
// If params is null or not an array
if (params == null || (params != null && !$.isArray(params)))
{
params = [];
}
return FHC_PhraseLib._replacePhraseVariable(phraseObj.text, params); // parsing
}
}
}
return '<< PHRASE ' + phrase + ' >>';
},
//------------------------------------------------------------------------------------------------------------------
// Private methods
/**
* Returns phrase with variables being replaced
* @param {String} phrase : phrasen-text (with one ore more variables)
* @param {array} replaceStringArr : String-array to be set in variables in phrasentext (order matters)
* @returns {String} : replaced phrasen-text
*/
_replacePhraseVariable: function (phrase, replaceStringArr) {
for (var i = 0; i < replaceStringArr.length; i++)
{
phrase = phrase.replace(/\{(.*?)\}/, replaceStringArr[i]);
}
return phrase;
}
};
+11 -11
View File
@@ -133,7 +133,7 @@ $(document).ready(
var notizTitle = $(this).find("td:eq(1)").text();
var notizContent = this.title;
$("#notizform label:first").text("Notiz ändern").css("color", "red");
$("#notizform label:first").text(FHC_PhraseLib.t('infocenter', 'notizAendern')).css("color", "red");
$("#notizform :input[type='reset']").css("display", "inline-block");
$("#notizform :input[name='hiddenNotizId']").val(notizId);
@@ -243,7 +243,7 @@ var InfocenterDetails = {
saveZgv: function(data)
{
var zgvError = function(){
$("#zgvSpeichern_" + prestudentid).before("<span id='zgvSpeichernNotice' class='text-danger'>Fehler beim Speichern der ZGV!</span>&nbsp;&nbsp;");
$("#zgvSpeichern_" + prestudentid).before("<span id='zgvSpeichernNotice' class='text-danger'>" + FHC_PhraseLib.t('ui', 'fehlerBeimSpeichern') + "</span>&nbsp;&nbsp;");
};
var prestudentid = data.prestudentid;
@@ -258,7 +258,7 @@ var InfocenterDetails = {
if (FHC_AjaxClient.hasData(data))
{
InfocenterDetails._refreshLog();
$("#zgvSpeichern_" + prestudentid).before("<span id='zgvSpeichernNotice' class='text-success'>ZGV erfolgreich gespeichert!</span>&nbsp;&nbsp;");
$("#zgvSpeichern_" + prestudentid).before("<span id='zgvSpeichernNotice' class='text-success'>" + FHC_PhraseLib.t('ui', 'gespeichert') + "</span>&nbsp;&nbsp;");
}
else
{
@@ -392,11 +392,11 @@ var InfocenterDetails = {
if (data.length > 0)
InfocenterDetails.getParkedDate(personid);
else
$("#unparkmsg").removeClass().addClass("text-warning").text(" Nichts zum Ausparken.");
$("#unparkmsg").removeClass().addClass("text-warning").text(FHC_PhraseLib.t('infocenter', 'nichtsZumAusparken'));
}
},
errorCallback: function(){
$("#unparkmsg").removeClass().addClass("text-danger").text(" Fehler beim Ausparken!");
$("#unparkmsg").removeClass().addClass("text-danger").text(FHC_PhraseLib.t('infocenter', 'fehlerBeimAusparken'));
},
veilTimeout: 0
}
@@ -440,8 +440,8 @@ var InfocenterDetails = {
{
$("#parking").html(
'<div class="form-group form-inline">'+
'<button class="btn btn-default" id="parklink" type="button""><i class="fa fa-clock-o"></i>&nbsp;BewerberIn parken</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+
'bis&nbsp;&nbsp;'+
'<button class="btn btn-default" id="parklink" type="button""><i class="fa fa-clock-o"></i>&nbsp;' + FHC_PhraseLib.t('infocenter', 'bewerberParken') + '</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+
FHC_PhraseLib.t('global', 'bis') + '&nbsp;&nbsp;'+
'<input id="parkdate" type="text" class="form-control" placeholder="Parkdatum" style="height: 25px; width: 99px">&nbsp;'+
'<span class="text-danger" id="parkmsg"></span>'+
'</div>');
@@ -467,8 +467,8 @@ var InfocenterDetails = {
var parkdate = $.datepicker.parseDate("yy-mm-dd", date);
var gerparkdate = $.datepicker.formatDate("dd.mm.yy", parkdate);
$("#parking").html(
'BewerberIn geparkt bis '+gerparkdate+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+
'<button class="btn btn-default" id="unparklink"><i class="fa fa-sign-out"></i>&nbsp;BewerberIn ausparken</button>&nbsp;'+
FHC_PhraseLib.t('infocenter', 'bewerberGeparktBis')+'&nbsp;&nbsp;'+gerparkdate+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+
'<button class="btn btn-default" id="unparklink"><i class="fa fa-sign-out"></i>&nbsp;'+FHC_PhraseLib.t('infocenter', 'bewerberAusparken')+'</button>&nbsp;'+
'<span id="unparkmsg"></span>'
);
@@ -491,11 +491,11 @@ var InfocenterDetails = {
{
$("#notizmsg").empty();
$("#notizform :input[name='hiddenNotizId']").val("");
$("#notizform label:first").text("Notiz hinzufügen").css("color", "black");
$("#notizform label:first").text(FHC_PhraseLib.t('infocenter', 'notizHinzufuegen')).css("color", "black");
$("#notizform :input[type='reset']").css("display", "none");
},
_errorSaveNotiz: function()
{
$("#notizmsg").text("Fehler beim Speichern der Notiz!&nbsp;");
$("#notizmsg").text(FHC_PhraseLib.t('ui', 'fehlerBeimSpeichern'));
}
};
+1 -1
View File
@@ -61,7 +61,7 @@ var Tablesort = {
size: size,
cssDisabled: 'disabled',
savePages: false,
output: '{startRow} {endRow} / {totalRows} Zeilen'
output: '{startRow} {endRow} / {totalRows} ' + FHC_PhraseLib.t('global', 'zeilen')
}
);
}
+357 -27
View File
@@ -26,7 +26,7 @@
$new = false;
$phrases = array(
$phrases = array(
//******************* CORE/global
array(
'app' => 'core',
@@ -48,6 +48,26 @@ $phrases = array(
)
)
),
array(
'app' => 'core',
'category' => 'global',
'phrase' => 'zeilen',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Zeilen',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'lines',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'global',
@@ -909,6 +929,48 @@ $phrases = array(
)
),
array(
'app' => 'core',
'category' => 'global',
'phrase' => 'mailAnXversandt',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Mail an {email} versandt.',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Mail was sent to {email}.',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'global',
'phrase' => 'beschreibung',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Beschreibung',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'description',
'description' => '',
'insertvon' => 'system'
)
)
),
//******************************* CORE/ui
array(
@@ -1231,6 +1293,46 @@ $phrases = array(
)
)
),
array(
'app' => 'core',
'category' => 'ui',
'phrase' => 'fehlerBeimSpeichern',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Fehler beim Speichern',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Error on Saving',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'ui',
'phrase' => 'gespeichert',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Gespeichert',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Saved',
'description' => '',
'insertvon' => 'system'
)
)
),
//*************************** CORE/filter
@@ -1255,6 +1357,70 @@ $phrases = array(
)
),
array(
'app' => 'core',
'category' => 'filter',
'phrase' => 'filterHinzufuegen',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Filter hinzufügen',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'add filter',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'filter',
'phrase' => 'feldHinzufuegen',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Feld hinzufügen',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'add field',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'filter',
'phrase' => 'filterBeschreibung',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Filter Beschreibung',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'filter description',
'description' => '',
'insertvon' => 'system'
)
)
),
//**************************** CORE/person
@@ -2184,6 +2350,46 @@ $phrases = array(
)
)
),
array(
'app' => 'infocenter',
'category' => 'infocenter',
'phrase' => 'zugangsvoraussetzungen',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Zugangsvoraussetzungen',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => '',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'infocenter',
'category' => 'infocenter',
'phrase' => 'keineZugangsvoraussetzungenTxt',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Keine Zugangsvoraussetzungen für den Studiengang definiert',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => '',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'infocenter',
'category' => 'infocenter',
@@ -2273,8 +2479,8 @@ $phrases = array(
array(
'sprache' => 'German',
'text' => 'Bei Absage von InteressentInnen erhalten diese den Status "Abgewiesener" und deren '
. 'ZGV-Daten können im Infocenter nicht mehr bearbeitet oder freigegeben werden. '
. 'Alle nicht gespeicherten ZGV-Daten gehen verloren. Fortfahren?',
.'ZGV-Daten können im Infocenter nicht mehr bearbeitet oder freigegeben werden. '
.'Alle nicht gespeicherten ZGV-Daten gehen verloren. Fortfahren?',
'description' => '',
'insertvon' => 'system'
),
@@ -2380,7 +2586,7 @@ $phrases = array(
),
array(
'sprache' => 'English',
'text' => '',
'text' => 'Approve applicant',
'description' => '',
'insertvon' => 'system'
)
@@ -2483,7 +2689,7 @@ $phrases = array(
),
array(
'sprache' => 'English',
'text' => 'change note',
'text' => 'Change note',
'description' => '',
'insertvon' => 'system'
)
@@ -2568,7 +2774,128 @@ $phrases = array(
'insertvon' => 'system'
)
)
),
array(
'app' => 'infocenter',
'category' => 'infocenter',
'phrase' => 'bewerberParken',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'BewerberIn parken',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Park applicant',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'infocenter',
'category' => 'infocenter',
'phrase' => 'bewerberAusparken',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'BewerberIn ausparken',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Unpark applicant',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'infocenter',
'category' => 'infocenter',
'phrase' => 'nichtsZumAusparken',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Nichts zum ausparken',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => '',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'infocenter',
'category' => 'infocenter',
'phrase' => 'fehlerBeimAusparken',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Fehler beim Ausparken',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => '',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'infocenter',
'category' => 'infocenter',
'phrase' => 'fehlerBeimParken',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Fehler beim Parken',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => '',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'infocenter',
'category' => 'infocenter',
'phrase' => 'bewerberGeparktBis',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'BewerberIn geparkt bis',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Applicant parked until',
'description' => '',
'insertvon' => 'system'
)
)
)
);
@@ -2581,9 +2908,9 @@ foreach ($phrases as $phrase)
$qry = "SELECT phrase_id
FROM system.tbl_phrase
WHERE
app=" . $db->db_add_param($phrase['app']) . " AND
category=" . $db->db_add_param($phrase['category']) . " AND
phrase=" . $db->db_add_param($phrase['phrase']);
app=". $db->db_add_param($phrase['app']). " AND
category=". $db->db_add_param($phrase['category']). " AND
phrase=". $db->db_add_param($phrase['phrase']);
//*** CHECK PHRASE
if ($result = $db->db_query($qry))
@@ -2600,11 +2927,11 @@ foreach ($phrases as $phrase)
insertvon,
category)
VALUES(".
$db->db_add_param($phrase['app']) . ','.
$db->db_add_param($phrase['phrase']) . ','.
$db->db_add_param($phrase['app']). ','.
$db->db_add_param($phrase['phrase']). ','.
' now(),'.
$db->db_add_param($phrase['insertvon']) . ','.
$db->db_add_param($phrase['category']) . ');';
$db->db_add_param($phrase['insertvon']). ','.
$db->db_add_param($phrase['category']). ');';
if ($db->db_query($qry_insert))
{
@@ -2618,11 +2945,11 @@ foreach ($phrases as $phrase)
$phrase_id = $obj->id;
}
}
echo 'Kategorie/Phrase: <b>' . $phrase['category'] . '/' . $phrase['phrase'] . ' hinzugefügt</b><br>';
echo 'Kategorie/Phrase: <b>'. $phrase['category']. '/'. $phrase['phrase']. ' hinzugefügt</b><br>';
}
else
echo '<span class="error">Fehler: ' . $phrase['category'] . '/' . $phrase['phrase'] . ' hinzufügen nicht möglich</span><br>';
echo '<span class="error">Fehler: '. $phrase['category']. '/'.
$phrase['phrase']. ' hinzufügen nicht möglich</span><br>';
}
//phrase existing -> get phrase_id
else
@@ -2631,23 +2958,23 @@ foreach ($phrases as $phrase)
{
$phrase_id = $obj->phrase_id;
}
echo 'Kategorie/Phrase: ' . $phrase['category'] . '/' . $phrase['phrase'] . ' vorhanden.<br>';
echo 'Kategorie/Phrase: '. $phrase['category']. '/'. $phrase['phrase']. ' vorhanden.<br>';
}
//*** CHECK PHRASENTEXT
//loop through languages
foreach ($phrase['phrases'] as $phrase_phrases)
{
{
$language = $phrase_phrases['sprache'];
//query phrasentext in certain language
$qry_language =
$qry_language =
"SELECT *
FROM system.tbl_phrasentext
WHERE
phrase_id=" . $phrase_id . " AND
sprache='" . $language . "'";
phrase_id=". $phrase_id. " AND
sprache='". $language. "'";
if ($result_language = $db->db_query($qry_language))
@@ -2665,22 +2992,25 @@ foreach ($phrases as $phrase)
insertamum,
insertvon)
VALUES(".
$db->db_add_param($phrase_id, FHC_INTEGER) . ','.
$db->db_add_param($phrase_phrases['sprache']) . ','.
$db->db_add_param($phrase_id, FHC_INTEGER). ','.
$db->db_add_param($phrase_phrases['sprache']). ','.
' NULL,'.
' NULL,'.
$db->db_add_param($phrase_phrases['text']) . ','.
$db->db_add_param($phrase_phrases['description']) . ','.
$db->db_add_param($phrase_phrases['text']). ','.
$db->db_add_param($phrase_phrases['description']). ','.
' now(),'.
$db->db_add_param($phrase_phrases['insertvon']) . ');';
$db->db_add_param($phrase_phrases['insertvon']). ');';
if ($db->db_query($qry_insert))
{
echo '-- Phrasentext ' . strtoupper(substr($phrase_phrases['sprache'], 0, 3)) . ': <b>' . $phrase_phrases['text'] . ' hinzugefügt</b><br>';
echo '-- Phrasentext '. strtoupper(substr($phrase_phrases['sprache'], 0, 3)). ': <b>'.
$phrase_phrases['text']. ' hinzugefügt</b><br>';
}
else
{
echo '<span class="error">Fehler: Phrasentext ' . strtoupper(substr($phrase_phrases['sprache'], 0, 3)) . ': '. $phrase_phrases['text'] . ' hinzufügen nicht möglich</span><br>';
echo '<span class="error">Fehler: Phrasentext '.
strtoupper(substr($phrase_phrases['sprache'], 0, 3)). ': '. $phrase_phrases['text'].
' hinzufügen nicht möglich</span><br>';
}
}
}