mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-28 09:29:38 +00:00
- Added helper language_helper to retrive the language of the logged user
- FHC_Controller now loads also the language_helper - Added missing comments to Auth_Controller - Fixed comments of session_helper
This commit is contained in:
@@ -48,6 +48,10 @@ class Auth_Controller extends FHC_Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an array of permissions to a string that contains them as a comma separated list
|
||||
* Ex: "<permission 1>, <permission 2>, <permission 3>"
|
||||
*/
|
||||
private function _rpsToString($requiredPermissions, $method)
|
||||
{
|
||||
$strRequiredPermissions = ''; // string that contains all the required permissions needed to access to this method
|
||||
|
||||
@@ -28,6 +28,9 @@ class FHC_Controller extends CI_Controller
|
||||
|
||||
// Loads helper session to manage the php session
|
||||
$this->load->helper('session');
|
||||
|
||||
// Loads language helper
|
||||
$this->load->helper('language');
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* FH-Complete
|
||||
*
|
||||
* @package FHC-Helper
|
||||
* @author FHC-Team
|
||||
* @copyright Copyright (c) 2016 fhcomplete.org
|
||||
* @license GPLv3
|
||||
* @since Version 1.0.0
|
||||
*/
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Function to retrive the language of the logged user
|
||||
* If is not possible to retrive it, then the default system language is returnd
|
||||
* If as parameter is given a valid language the it's returned useful to avoid
|
||||
* to write the same control structures for the language
|
||||
*/
|
||||
function getUserLanguage($language = null)
|
||||
{
|
||||
if (!isEmptyString($language)) return $language;
|
||||
|
||||
$ci =& get_instance(); // get CI instance
|
||||
|
||||
// Use the default system language, if it's possible retrives the language for the logged user
|
||||
$language = DEFAULT_LANGUAGE;
|
||||
// Checks if the user is authenticated to retrive the users's language
|
||||
// NOTE: this helper could be called when the user is not logged in the system
|
||||
// so this is why is checked if the function getAuthUID exists
|
||||
if (function_exists('getAuthUID'))
|
||||
{
|
||||
// NOTE: Stores the loaded model with the alias PersonModelLanguage to avoid to overwrite
|
||||
// an already loaded PersonModel used somewhere else
|
||||
$ci->load->model('person/Person_model', 'PersonModelLanguage');
|
||||
|
||||
$language = $ci->PersonModelLanguage->getLanguage(getAuthUID());
|
||||
}
|
||||
|
||||
return $language;
|
||||
}
|
||||
@@ -10,13 +10,6 @@
|
||||
* @since Version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Message Helper
|
||||
*
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
*/
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user