Now the helper message is loaded only by these controllers and models:

- APIv1_Controller
- FHC_Controller
- MessageToken_model
This commit is contained in:
Paolo
2018-06-27 11:10:40 +02:00
parent 581cb69a6f
commit d8bcc25ac2
8 changed files with 57 additions and 70 deletions
-3
View File
@@ -26,9 +26,6 @@ class Redirect extends FHC_Controller
// Loads config file fhcomplete
$this->config->load('fhcomplete');
// Loads message helper
$this->load->helper('message');
// Loads model MessageTokenModel
$this->load->model('system/MessageToken_model', 'MessageTokenModel');
}
@@ -16,9 +16,6 @@ class Phrases extends FHC_Controller
// Loads the widget library
$this->load->library('WidgetLib');
// Loads helper message to manage returning messages
$this->load->helper('message');
}
/**
@@ -7,14 +7,11 @@ class PrestudentMultiAssign extends VileSci_Controller
public function __construct()
{
parent::__construct();
// Loads helper message to manage returning messages
$this->load->helper('message');
// Loads the widget library
$this->load->library('WidgetLib');
}
public function index()
{
$studiengang = $this->input->post('studiengang');
@@ -22,27 +19,27 @@ class PrestudentMultiAssign extends VileSci_Controller
$aufnahmegruppe = $this->input->post('aufnahmegruppe');
$reihungstest = $this->input->post('reihungstest');
$stufe = $this->input->post('stufe');
// Converts string 'null' to a null value
$stufe = ($stufe == 'null' ? null : $stufe);
$studiengang = ($studiengang == 'null' ? null : $studiengang);
$reihungstest = ($reihungstest == 'null' ? null : $reihungstest);
$aufnahmegruppe = ($aufnahmegruppe == 'null' ? null : $aufnahmegruppe);
$studiensemester = ($studiensemester == 'null' ? null : $studiensemester);
$returnUsers = null;
if ($studiengang != null || $studiensemester != null || $aufnahmegruppe!= null
|| $reihungstest != null || $stufe != null)
{
$returnUsers = $this->_getPrestudents($studiengang, $studiensemester, $aufnahmegruppe, $reihungstest, $stufe);
}
$users = null;
if (hasData($returnUsers))
{
$users = $returnUsers->retval;
}
if ($returnUsers == null || isSuccess($returnUsers))
{
$viewData = array(
@@ -53,7 +50,7 @@ class PrestudentMultiAssign extends VileSci_Controller
'stufe' => $stufe,
'users' => $users
);
$this->load->view('system/aufnahme/prestudentMultiAssign', $viewData);
}
else if (isError($returnUsers))
@@ -61,7 +58,7 @@ class PrestudentMultiAssign extends VileSci_Controller
show_error($returnUsers->retval);
}
}
/**
* To assign a stufe to one or more prestudents
*/
@@ -69,16 +66,16 @@ class PrestudentMultiAssign extends VileSci_Controller
{
$prestudentIdArray = $this->input->post('prestudent_id');
$stufe = $this->input->post('stufe');
// Converts string 'null' to a null value
$stufe = ($stufe == 'null' ? null : $stufe);
// Load model PrestudentstatusModel
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
// Set the HTTP header
$this->output->set_header('Content-Type: application/json; charset=utf-8');
$result = error("No valid parameters");
if (isset($stufe)
&& isset($prestudentIdArray)
@@ -86,7 +83,7 @@ class PrestudentMultiAssign extends VileSci_Controller
&& count($prestudentIdArray) > 0)
{
$result = $this->PrestudentstatusModel->updateStufe($prestudentIdArray, $stufe);
if (isSuccess($result))
{
echo '{"msg": "Data correctly saved"}';
@@ -101,7 +98,7 @@ class PrestudentMultiAssign extends VileSci_Controller
echo '{"msg": "'.$result->retval.'"}';
}
}
/**
* To assign one or more prestudents to a gruppe
*/
@@ -109,16 +106,16 @@ class PrestudentMultiAssign extends VileSci_Controller
{
$prestudentIdArray = $this->input->post('prestudent_id');
$aufnahmegruppe = $this->input->post('aufnahmegruppe');
// Converts string 'null' to a null value
$aufnahmegruppe = ($aufnahmegruppe == 'null' ? null : $aufnahmegruppe);
// Load model PrestudentstatusModel
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
// Set the HTTP header
$this->output->set_header('Content-Type: application/json; charset=utf-8');
$result = error("No valid parameters");
if (isset($aufnahmegruppe)
&& isset($prestudentIdArray)
@@ -126,7 +123,7 @@ class PrestudentMultiAssign extends VileSci_Controller
&& count($prestudentIdArray) > 0)
{
$result = $this->PrestudentModel->updateAufnahmegruppe($prestudentIdArray, $aufnahmegruppe);
if (isSuccess($result))
{
echo '{"msg": "Data correctly saved"}';
@@ -141,7 +138,7 @@ class PrestudentMultiAssign extends VileSci_Controller
echo '{"msg": "'.$result->retval.'"}';
}
}
/**
* Get the prestudents using search parameters
*/
@@ -149,32 +146,32 @@ class PrestudentMultiAssign extends VileSci_Controller
{
// Load model prestudentm_model
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
if ($studiengang == '' || empty($studiengang))
{
$studiengang = null;
}
if ($studiensemester == '' || empty($studiensemester))
{
$studiensemester = null;
}
if ($aufnahmegruppe == '' || empty($aufnahmegruppe))
{
$aufnahmegruppe = null;
}
if ($reihungstest == '' || empty($reihungstest))
{
$reihungstest = null;
}
if ($stufe == '' || empty($stufe))
{
$stufe = null;
}
return $this->PrestudentModel->getPrestudentMultiAssign(
$studiengang,
$studiensemester,
@@ -183,4 +180,4 @@ class PrestudentMultiAssign extends VileSci_Controller
$stufe
);
}
}
}
+4
View File
@@ -17,7 +17,11 @@ class FHC_Controller extends CI_Controller
$this->_controllerId = null; // set _controllerId as null by default
// Loads helper fhcauth to manage the authentication
$this->load->helper('fhcauth');
// Loads helper message to manage returning messages
$this->load->helper('message');
}
//------------------------------------------------------------------------------------------------------------------
-3
View File
@@ -17,9 +17,6 @@ class FHC_Model extends CI_Model
$this->lang->load('fhc_model');
$this->lang->load('fhcomplete');
// Load return message helper
$this->load->helper('message');
// Loads the permission library
$this->load->library('PermissionLib');
}
+12 -15
View File
@@ -10,16 +10,13 @@ class FS_Model extends FHC_Model
public function __construct($filepath = null)
{
parent::__construct();
// Load the filesystem library
$this->load->library('FilesystemLib');
// Load return message helper
$this->load->helper('message');
$this->filepath = $filepath;
}
/** ---------------------------------------------------------------
* Read data from file system
*
@@ -29,13 +26,13 @@ class FS_Model extends FHC_Model
{
// Check Class-Attributes
if (is_null($this->filepath)) return error(FHC_MODEL_ERROR, FHC_ERROR);
// Check method parameters
if (is_null($filename)) return error(FHC_MODEL_ERROR, FHC_ERROR);
// Check rights
if (isError($ent = $this->isEntitled($this->filepath, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
if (!is_null($data = $this->filesystemlib->read($this->filepath, $filename)))
{
return success(base64_encode($data));
@@ -45,7 +42,7 @@ class FS_Model extends FHC_Model
return error(FHC_MODEL_ERROR, FHC_ERROR);
}
}
/** ---------------------------------------------------------------
* Writing data to file system
*
@@ -56,7 +53,7 @@ class FS_Model extends FHC_Model
{
// Check Class-Attributes
if (is_null($this->filepath)) return error(FHC_MODEL_ERROR, FHC_ERROR);
// Check method parameters
if (is_null($filename)) return error(FHC_MODEL_ERROR, FHC_ERROR);
if (is_null($content)) return error(FHC_MODEL_ERROR, FHC_ERROR);
@@ -84,7 +81,7 @@ class FS_Model extends FHC_Model
{
// Check Class-Attributes
if (is_null($this->filepath)) return error(FHC_MODEL_ERROR, FHC_ERROR);
// Check method parameters
if (is_null($content)) return error(FHC_MODEL_ERROR, FHC_ERROR);
if (is_null($filename)) return error(FHC_MODEL_ERROR, FHC_ERROR);
@@ -112,7 +109,7 @@ class FS_Model extends FHC_Model
{
// Check Class-Attributes
if (is_null($this->filepath)) return error(FHC_MODEL_ERROR, FHC_ERROR);
// Check method parameters
if (is_null($filename)) return error(FHC_MODEL_ERROR, FHC_ERROR);
@@ -128,7 +125,7 @@ class FS_Model extends FHC_Model
return error(FHC_MODEL_ERROR, FHC_ERROR);
}
}
/** ---------------------------------------------------------------
* Rename a file
*
@@ -139,11 +136,11 @@ class FS_Model extends FHC_Model
{
// Check Class-Attributes
if (is_null($this->filepath)) return error(FHC_MODEL_ERROR, FHC_ERROR);
// Check method parameters
if (is_null($filename)) return error(FHC_MODEL_ERROR, FHC_ERROR);
if (is_null($newFilename)) return error(FHC_MODEL_ERROR, FHC_ERROR);
// Check rights
if (isError($ent = $this->isEntitled($this->filepath, PermissionLib::UPDATE_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
@@ -8,6 +8,7 @@ class MessageToken_model extends CI_Model
{
/**
* Constructor
* NOTE: here are loaded libs, models, helpers, etc. because MessageToken_model extends directly the CI_Model
*/
public function __construct()
{
+13 -16
View File
@@ -10,12 +10,12 @@ class HTMLWidget extends Widget
const HTML_DEFAULT_VALUE = ''; // Default value of the html element
const HTML_NAME = 'name'; // HTML name attribute
const HTML_ID = 'id'; // HTML id attribute
// External block definition
const EXTERNAL_BLOCK = 'externalBlock'; // External block name
const EXTERNAL_START_BLOCK_HTML_TAG = '<div>'; // External block start tag
const EXTERNAL_END_BLOCK_HTML_TAG = '</div>'; // External block end tag
// HTML attributes
const LABEL = 'title';
const REGEX = 'regex';
@@ -26,21 +26,18 @@ class HTMLWidget extends Widget
const MAX_LENGTH = 'max-length';
const MIN_LENGTH = 'min-length';
const PLACEHOLDER = 'placeholder';
/**
* It gets also the htmlArgs array as parameter, it will be used to set the HTML properties
*/
public function __construct($name, $args = array(), $htmlArgs = array())
{
parent::__construct($name, $args);
// Initialising HTML properties
$this->_setHtmlProperties($htmlArgs);
// Loads helper message to manage returning messages
$this->load->helper('message');
}
/**
* Initialising html properties, such as the id and name attributes of the HTML element
*/
@@ -50,19 +47,19 @@ class HTMLWidget extends Widget
if (!isset($this->_args[HTMLWidget::HTML_ARG_NAME]))
{
$this->_args[HTMLWidget::HTML_ARG_NAME] = array();
// Avoids that elements in a HTML page have the same name or id
$randomIdentifier = uniqid(rand(0, 1000));
$this->_args[HTMLWidget::HTML_ARG_NAME][HTMLWidget::HTML_ID] = $randomIdentifier;
$this->_args[HTMLWidget::HTML_ARG_NAME][HTMLWidget::HTML_NAME] = $randomIdentifier;
foreach($htmlArgs as $argName => $argValue)
{
$this->_args[HTMLWidget::HTML_ARG_NAME][$argName] = $argValue;
}
}
}
/**
* Prints an attribute name and eventually also the value extracted from $htmlArgs
* Set $isValuePresent to false the value should not be displayed
@@ -76,12 +73,12 @@ class HTMLWidget extends Widget
if ($isValuePresent === true)
{
$value = $htmlArgs[$attribute];
if (is_bool($value))
{
$value = $value ? 'true' : 'false';
}
echo sprintf('%s="%s"', $attribute, $value);
}
else
@@ -91,7 +88,7 @@ class HTMLWidget extends Widget
}
}
}
/**
* Prints the external block start tag
*/
@@ -103,7 +100,7 @@ class HTMLWidget extends Widget
echo HTMLWidget::EXTERNAL_START_BLOCK_HTML_TAG;
}
}
/**
* Prints the external block end tag
*/
@@ -115,4 +112,4 @@ class HTMLWidget extends Widget
echo HTMLWidget::EXTERNAL_END_BLOCK_HTML_TAG;
}
}
}
}