- application/core/* -> CS compliant

- application/libraries/* -> CS compliant
- FHC_Model isEntitled method now return error() or success()
- Updated all code that uses isEntitled method from FHC_Model
- Removed Squiz.PHP.DisallowSizeFunctionsInLoops from CS ruleset
- Removed depracated method replace from DB_Model
- Removed unused method pgArrayPhp from DB_Model
- Renamed method arrayMergeIndex to _arrayCombine in DB_Model and set as private
- Added method _manageUDFs to DB_Model (a wrapper for UDFLib->manageUDFs)
This commit is contained in:
Paolo
2017-08-22 16:24:51 +02:00
parent 36ab348951
commit d8cd786079
35 changed files with 672 additions and 768 deletions
+24 -26
View File
@@ -79,7 +79,7 @@ class CallerLib
}
}
// If the given resource is a library
else if (strpos($parameters->resourceName, CallerLib::LIB_PREFIX) !== false)
elseif (strpos($parameters->resourceName, CallerLib::LIB_PREFIX) !== false)
{
// Check if the resource is already loaded, it works only with libraries and drivers
$isLoaded = $this->ci->load->is_loaded($parameters->resourceName);
@@ -89,10 +89,10 @@ class CallerLib
// Checks if the operation is permitted by the API caller
// Only for libraries, permissions are automatically handled by models
$result = $this->checkLibraryPermission(
$parameters->resourcePath,
$parameters->resourceName,
$parameters->function,
$permissionType
$parameters->resourcePath,
$parameters->resourceName,
$parameters->function,
$permissionType
);
if (isError($result))
{
@@ -117,7 +117,7 @@ class CallerLib
// Wrong selection!
else
{
$result = error('Neither a lib nor model: ' . $parameters->resourcePath . $parameters->resourceName);
$result = error('Neither a lib nor model: '.$parameters->resourcePath.$parameters->resourceName);
}
// If the resource was found and loaded
@@ -166,7 +166,7 @@ class CallerLib
$parameters->resourcePath = str_replace($parameters->resourceName, '', $parameterValue);
}
// The name of the function
else if ($parameterName == CallerLib::FUNCTION_PARAMETER)
elseif ($parameterName == CallerLib::FUNCTION_PARAMETER)
{
$parameters->function = $parameterValue;
}
@@ -217,7 +217,7 @@ class CallerLib
/**
* Loads a model using the given path and name
*
*
* NOTE: the models automatically handle the permissions
*/
private function _loadModel($resourcePath, $resourceName)
@@ -227,12 +227,12 @@ class CallerLib
try
{
$loaded = $this->ci->load->model($resourcePath . $resourceName);
$loaded = $this->ci->load->model($resourcePath.$resourceName);
}
catch (Exception $e)
{
// Errors while loading the model
$result = error('Errors while loading the model: ' . $e->getMessage());
$result = error('Errors while loading the model: '.$e->getMessage());
}
if (!is_null($loaded))
@@ -257,7 +257,7 @@ class CallerLib
$permissionPath = $resourcePath;
}
$permissionPath .= $resourceName . '.' . $function;
$permissionPath .= $resourceName.'.'.$function;
if ($this->ci->permissionlib->isEntitled($permissionPath, $permissionType) === false)
{
@@ -273,14 +273,14 @@ class CallerLib
/**
* Loads a library using the given path and name
*
*
* The method 'library' of the class CI_Loader provided by CI has some limitations,
* so to be able to check errors was used a workaround.
* It consists in:
* - Checking if the file (identified by parameters $resourcePath and $resourceName) exists
* - If exists it will be loaded using the method 'file' from CI_Loader
* - Checks if the loaded file contains a class identified by parameter $resourceName
*
*
* If one of the previous tests fails, it will be returned a null value
*/
private function _loadLibrary($resourcePath, $resourceName)
@@ -295,8 +295,8 @@ class CallerLib
$found = null;
for ($i = 0; $i < count($packagePaths) && is_null($found); $i++)
{
$file = $packagePaths[$i] . CallerLib::LIBS_PATH . DIRECTORY_SEPARATOR .
$resourcePath . $resourceName . CallerLib::LIB_FILE_EXTENSION;
$file = $packagePaths[$i].CallerLib::LIBS_PATH.DIRECTORY_SEPARATOR.
$resourcePath.$resourceName.CallerLib::LIB_FILE_EXTENSION;
if (file_exists($file))
{
$found = $file;
@@ -313,20 +313,20 @@ class CallerLib
{
$loaded = null;
// Same phrase error as load->model() provided by CI
$result = error($found . ' exists, but doesn\'t declare class ' . $resourceName);
$result = error($found.' exists, but doesn\'t declare class '.$resourceName);
}
}
else
{
$loaded = null;
// Same phrase error as load->model() provided by CI
$result = error('Unable to load the requested class: ' . $resourceName);
$result = error('Unable to load the requested class: '.$resourceName);
}
}
catch (Exception $e)
{
// Errors while loading the library
$result = error('Errors while loading the library: ' . $e->getMessage());
$result = error('Errors while loading the library: '.$e->getMessage());
}
if (!is_null($loaded))
@@ -339,7 +339,7 @@ class CallerLib
/**
* Calls a method of a class with the given parameters and returns its result
*
*
* @param string $resourceName identifies the class name
* @param string $function identifies the method name
* @param array $parameters contains the parameters to be passed to the method
@@ -359,7 +359,7 @@ class CallerLib
// If the function is static
if ($reflectionMethod->isStatic() === true)
{
$classMethod = $resourceName . '::' . $function;
$classMethod = $resourceName.'::'.$function;
}
// If the function is not static
else
@@ -370,7 +370,6 @@ class CallerLib
// If the resource's function is callable
if (is_callable($classMethod))
{
// Call resource->function()
// @ was applied to prevent really ugly and unmanageable errors
$resultCall = @call_user_func_array($classMethod, $parameters);
@@ -379,7 +378,7 @@ class CallerLib
// it will be recognized like a running error. A little bit tricky ;)
if ($resultCall === false)
{
$result = error('Error running ' . $resourceName . '->' . $function . '()');
$result = error('Error running '.$resourceName.'->'.$function.'()');
}
// Returns the result of resource->function()
else
@@ -389,14 +388,13 @@ class CallerLib
}
else
{
$result = error($resourceName . '->' . $function . '() is not callable!');
$result = error($resourceName.'->'.$function.'() is not callable!');
}
}
else
{
$result = error(
'Number of required parameters: ' . $reflectionMethod->getNumberOfRequiredParameters() .
'. Given: ' . count($parameters)
'Number of required parameters: '.$reflectionMethod->getNumberOfRequiredParameters().'. Given: '.count($parameters)
);
}
}
@@ -407,4 +405,4 @@ class CallerLib
return $result;
}
}
}
+11 -15
View File
@@ -2,12 +2,8 @@
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
*/
class DmsLib
{
//
const FILE_CONTENT_PROPERTY = 'file_content';
/**
@@ -27,7 +23,7 @@ class DmsLib
}
/**
*
* read
*/
public function read($dms_id, $version = null)
{
@@ -66,7 +62,7 @@ class DmsLib
}
/**
*
* getAktenAcceptedDms
*/
public function getAktenAcceptedDms($person_id, $dokument_kurzbz = null, $no_file = null)
{
@@ -92,13 +88,13 @@ class DmsLib
}
/**
*
* save
*/
public function save($dms)
{
$result = null;
if(isset($dms['new']) && $dms['new'] == true)
if (isset($dms['new']) && $dms['new'] == true)
{
// Remove new parameter to avoid DB insert errors
unset($dms['new']);
@@ -107,7 +103,7 @@ class DmsLib
if (isSuccess($result))
{
$filename = $result->retval;
if(isset($dms['dms_id']) && $dms['dms_id'] != '')
if (isset($dms['dms_id']) && $dms['dms_id'] != '')
{
$result = $this->ci->DmsVersionModel->insert(
$this->ci->DmsVersionModel->filterFields($dms, $dms['dms_id'], $filename)
@@ -148,7 +144,7 @@ class DmsLib
}
/**
*
* delete
*/
public function delete($person_id, $dms_id)
{
@@ -218,11 +214,11 @@ class DmsLib
}
/**
*
* _saveFileOnInsert
*/
private function _saveFileOnInsert($dms)
{
$filename = uniqid() . '.' . pathinfo($dms['name'], PATHINFO_EXTENSION);
$filename = uniqid().'.'.pathinfo($dms['name'], PATHINFO_EXTENSION);
$result = $this->ci->DmsFSModel->write($filename, $dms['file_content']);
if (isSuccess($result))
@@ -234,13 +230,13 @@ class DmsLib
}
/**
*
* _saveFileOnUpdate
*/
private function _saveFileOnUpdate($dms)
{
$result = null;
if(isset($dms['version']))
if (isset($dms['version']))
{
$result = $this->read($dms['dms_id'], $dms['version']);
@@ -252,4 +248,4 @@ class DmsLib
return $result;
}
}
}
+7 -12
View File
@@ -10,10 +10,6 @@
* @since Version 1.0.0
* @filesource
*/
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once FHCPATH.'include/authentication.class.php';
require_once FHCPATH.'include/AddonAuthentication.php';
/**
* FHC-Auth Helpers
@@ -25,7 +21,10 @@ require_once FHCPATH.'include/AddonAuthentication.php';
* @link http://fhcomplete.org/user_guide/helpers/fhcauth_helper.html
*/
// ------------------------------------------------------------------------
if (! defined('BASEPATH')) exit('No direct script access allowed');
require_once FHCPATH.'include/authentication.class.php';
require_once FHCPATH.'include/AddonAuthentication.php';
class FHC_Auth extends authentication
{
@@ -39,10 +38,6 @@ class FHC_Auth extends authentication
/**
* Auth Username, Password over FH-Complete
*
* @param string $username
* @param string $password
* @return bool
*/
public function basicAuthentication($username, $password)
{
@@ -57,9 +52,9 @@ class FHC_Auth extends authentication
}
/**
*
*
* TO BE UPDATED
*
*
* Get the md5 hashed password by the addon username
*
* @param string $username addon username
@@ -71,4 +66,4 @@ class FHC_Auth extends authentication
return md5($aam->getPasswordByUsername($username));
}
}
}
+20 -26
View File
@@ -1,5 +1,5 @@
<?php
/**
/***
* FH-Complete
*
* @package FHC-API
@@ -10,19 +10,13 @@
* @since Version 1.0
* @filesource
*/
// ------------------------------------------------------------------------
if (!defined('BASEPATH')) exit('No direct script access allowed');
class FilesystemLib
{
/*
*
*/
public function __construct() {}
/*
*
/**
* checkParameters
*/
private function checkParameters($filepath, $filename)
{
@@ -37,8 +31,8 @@ class FilesystemLib
}
}
/*
*
/**
* read
*/
public function read($filepath, $filename)
{
@@ -46,7 +40,7 @@ class FilesystemLib
if ($this->checkParameters($filepath, $filename))
{
$resource = $filepath . DIRECTORY_SEPARATOR . $filename;
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
if (file_exists($resource) && $fileHandle = fopen($resource, 'r'))
{
$result = '';
@@ -61,8 +55,8 @@ class FilesystemLib
return $result;
}
/*
*
/**
* write
*/
public function write($filepath, $filename, $content)
{
@@ -70,7 +64,7 @@ class FilesystemLib
if ($this->checkParameters($filepath, $filename) && isset($content))
{
$resource = $filepath . DIRECTORY_SEPARATOR . $filename;
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
if (is_writable($filepath) && $fileHandle = fopen($resource, 'w'))
{
if (fwrite($fileHandle, $content) !== false)
@@ -84,8 +78,8 @@ class FilesystemLib
return $result;
}
/*
*
/**
* append
*/
public function append($filepath, $filename, $content)
{
@@ -93,7 +87,7 @@ class FilesystemLib
if ($this->checkParameters($filepath, $filename) && isset($content))
{
$resource = $filepath . DIRECTORY_SEPARATOR . $filename;
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
if (is_writable($resource) && $fileHandle = fopen($resource, 'a'))
{
if (fwrite($fileHandle, $content) !== false)
@@ -107,8 +101,8 @@ class FilesystemLib
return $result;
}
/*
*
/**
* remove
*/
public function remove($filepath, $filename)
{
@@ -118,7 +112,7 @@ class FilesystemLib
{
if (is_writable($filepath))
{
$resource = $filepath . DIRECTORY_SEPARATOR . $filename;
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
$result = unlink($resource);
}
}
@@ -126,8 +120,8 @@ class FilesystemLib
return $result;
}
/*
*
/**
* rename
*/
public function rename($filepath, $filename, $newFilepath, $newFilename)
{
@@ -135,14 +129,14 @@ class FilesystemLib
if ($this->checkParameters($filepath, $filename) && $this->checkParameters($newFilepath, $newFilename))
{
$resource = $filepath . DIRECTORY_SEPARATOR . $filename;
$resource = $filepath.DIRECTORY_SEPARATOR.$filename;
if (is_writable($filepath) && is_writable($newFilepath) && file_exists($resource))
{
$destination = $newFilepath . DIRECTORY_SEPARATOR . $newFilename;
$destination = $newFilepath.DIRECTORY_SEPARATOR.$newFilename;
$result = rename($resource, $destination);
}
}
return $result;
}
}
}
+14 -10
View File
@@ -17,24 +17,25 @@ class LogLib
const LINE_SEPARATOR = ':';
/**
* Object initialization
* format
*/
public function __construct() {}
private function format($class, $function, $line)
{
$formatted = LogLib::CALLER_PREFIX;
if (!is_null($class) && $class != '')
{
$formatted .= $class . LogLib::CLASS_POSTFIX;
$formatted .= $class.LogLib::CLASS_POSTFIX;
}
$formatted .= $function . LogLib::LINE_SEPARATOR . $line . LogLib::CALLER_POSTFIX . ' ';
$formatted .= $function.LogLib::LINE_SEPARATOR.$line.LogLib::CALLER_POSTFIX.' ';
return $formatted;
}
/**
* getCaller
*/
private function getCaller()
{
$classIndex = 3;
@@ -62,13 +63,16 @@ class LogLib
return $this->format($class, $function, $line);
}
/**
* log
*/
private function log($level, $message)
{
log_message($level, $this->getCaller() . $message);
log_message($level, $this->getCaller().$message);
}
/**
*
* logDebug
*/
public function logDebug($message)
{
@@ -76,7 +80,7 @@ class LogLib
}
/**
*
* logInfo
*/
public function logInfo($message)
{
@@ -84,10 +88,10 @@ class LogLib
}
/**
*
* logError
*/
public function logError($message)
{
$this->log(LogLib::ERROR, $message);
}
}
}
+12 -12
View File
@@ -1,6 +1,6 @@
<?php
if (! defined("BASEPATH")) exit("No direct script access allowed");
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Library to manage the sending of the email
@@ -27,33 +27,33 @@ class MailLib
$this->ci =& get_instance();
// The second parameter is used to avoiding name collisions in the config array
$this->ci->config->load("mail", true);
$this->ci->config->load('mail', true);
// CI Email library
$this->ci->load->library("email");
$this->ci->load->library('email');
// Initializing email library with the loaded configurations
$this->ci->email->initialize($this->ci->config->config["mail"]);
$this->ci->email->initialize($this->ci->config->config['mail']);
// Set the configuration properties with the standard configuration values
$this->email_number_to_sent = $this->getEmailCfgItem("email_number_to_sent");
$this->email_number_per_time_range = $this->getEmailCfgItem("email_number_per_time_range");
$this->email_time_range = $this->getEmailCfgItem("email_time_range");
$this->email_from_system = $this->getEmailCfgItem("email_from_system");
$this->alias_from_system = $this->getEmailCfgItem("alias_from_system");
$this->email_number_to_sent = $this->getEmailCfgItem('email_number_to_sent');
$this->email_number_per_time_range = $this->getEmailCfgItem('email_number_per_time_range');
$this->email_time_range = $this->getEmailCfgItem('email_time_range');
$this->email_from_system = $this->getEmailCfgItem('email_from_system');
$this->alias_from_system = $this->getEmailCfgItem('alias_from_system');
}
/**
* Sends a single email
*/
public function send($from, $to, $subject, $message, $alias = "", $cc = null, $bcc = null, $altMessage = '')
public function send($from, $to, $subject, $message, $alias = '', $cc = null, $bcc = null, $altMessage = '')
{
// If from is not specified then use the standard one
if (is_null($from) || $from == "")
if (is_null($from) || $from == '')
{
$from = $this->email_from_system;
// If alias is not specified then use the standard one
if (is_null($alias) || $alias == "")
if (is_null($alias) || $alias == '')
{
$alias = $this->alias_from_system;
}
+31 -61
View File
@@ -3,12 +3,15 @@
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Messaging Library for FH-Complete
*/
* Messaging Library for FH-Complete
*/
class MessageLib
{
const MSG_INDX_PREFIX = 'message_';
/**
* Constructor
*/
public function __construct()
{
// Get code igniter instance
@@ -43,10 +46,6 @@ class MessageLib
/**
* getMessage() - returns the spicified received message for a specified person
*
* @param string $msg_id REQUIRED
* @param string $person_id REQUIRED
* @return object
*/
public function getMessage($msg_id, $person_id)
{
@@ -62,9 +61,6 @@ class MessageLib
/**
* getMessagesByUID() - will return all messages, including the latest status for specified user. It don´t returns Attachments.
*
* @param string $uid REQUIRED
* @return array
*/
public function getMessagesByUID($uid, $all = false)
{
@@ -78,9 +74,6 @@ class MessageLib
/**
* getMessagesByPerson() - will return all messages, including the latest status for specified user. It don´t returns Attachments.
*
* @param bigint $person_id REQUIRED
* @return array
*/
public function getMessagesByPerson($person_id, $all = false)
{
@@ -94,9 +87,6 @@ class MessageLib
/**
* getSentMessagesByPerson() - Get all sent messages from a person identified by person_id
*
* @param bigint $person_id REQUIRED
* @return array
*/
public function getSentMessagesByPerson($person_id, $all = false)
{
@@ -110,9 +100,6 @@ class MessageLib
/**
* getMessageByToken
*
* @param token string
* @return array
*/
public function getMessageByToken($token)
{
@@ -156,9 +143,6 @@ class MessageLib
/**
* getCountUnreadMessages
*
* @param bigint $person_id REQUIRED
* @return array
*/
public function getCountUnreadMessages($person_id)
{
@@ -172,11 +156,6 @@ class MessageLib
/**
* updateMessageStatus() - will change status on message for particular user
*
* @param integer $msg_id REQUIRED
* @param integer $user_id REQUIRED
* @param integer $status_id REQUIRED - should come from config/message.php list of constants
* @return array
*/
public function updateMessageStatus($message_id, $person_id, $status)
{
@@ -219,7 +198,6 @@ class MessageLib
/**
* sendMessage() - sends new internal message. This function will create a new thread
*
*/
public function sendMessage($sender_id, $receiver_id, $subject, $body, $priority = PRIORITY_NORMAL, $relationmessage_id = null, $oe_kurzbz = null, $multiPartMime = true)
{
@@ -270,7 +248,7 @@ class MessageLib
$result = $this->_error('', MSG_ERR_SUBJECT_EMPTY);
break;
}
else if (empty($body))
elseif (empty($body))
{
$result = $this->_error('', MSG_ERR_BODY_EMPTY);
break;
@@ -295,13 +273,6 @@ class MessageLib
/**
* sendMessageVorlage() - sends new internal message using a template
*
* @param integer $sender_id REQUIRED
* @param mixed $recipients REQUIRED - a single integer or an array of integers, representing user_ids
* @param string $subject
* @param string $body
* @param integer $priority
* @return array
*/
public function sendMessageVorlage($sender_id, $receiver_id, $vorlage_kurzbz, $oe_kurzbz, $data, $relationmessage_id = null, $orgform_kurzbz = null, $multiPartMime = true)
{
@@ -375,19 +346,19 @@ class MessageLib
$result = $this->_error('', MSG_ERR_TEMPLATE_NOT_FOUND);
break;
}
else if (is_array($result->retval) && count($result->retval) > 0)
elseif (is_array($result->retval) && count($result->retval) > 0)
{
if (is_null($result->retval[0]->oe_kurzbz))
{
$result = $this->_error('', MSG_ERR_TEMPLATE_NOT_FOUND);
break;
}
else if (empty($result->retval[0]->text))
elseif (empty($result->retval[0]->text))
{
$result = $this->_error('', MSG_ERR_INVALID_TEMPLATE);
break;
}
else if (empty($result->retval[0]->subject))
elseif (empty($result->retval[0]->subject))
{
$result = $this->_error('', MSG_ERR_INVALID_TEMPLATE);
break;
@@ -453,7 +424,7 @@ class MessageLib
// If the person has an email account
if (!is_null($result->retval[$i]->receiver) && $result->retval[$i]->receiver != '')
{
$href = $this->ci->config->item('message_server') . $this->ci->config->item('message_html_view_url') . $result->retval[0]->token;
$href = $this->ci->config->item('message_server').$this->ci->config->item('message_html_view_url').$result->retval[0]->token;
// Using a template for the html email body
$body = $this->ci->parser->parse(
'templates/mailHTML',
@@ -533,10 +504,10 @@ class MessageLib
$this->ci->loglib->logError('This person does not have an email account');
// Writing errors in tbl_message_recipient
$sme = $this->setMessageError(
$result->retval[$i]->message_id,
$result->retval[$i]->receiver_id,
'This person does not have an email account',
$result->retval[$i]->sentinfo
$result->retval[$i]->message_id,
$result->retval[$i]->receiver_id,
'This person does not have an email account',
$result->retval[$i]->sentinfo
);
if (!$sme)
{
@@ -570,10 +541,10 @@ class MessageLib
// Get a specific message from DB having EMAIL_KONTAKT_TYPE as relative contact type
$result = $this->ci->RecipientModel->getMessages(
EMAIL_KONTAKT_TYPE,
null,
null,
$message_id
EMAIL_KONTAKT_TYPE,
null,
null,
$message_id
);
// Checks if errors were occurred
if (isSuccess($result))
@@ -588,7 +559,7 @@ class MessageLib
if ($multiPartMime === true)
{
// Using a template for the html email body
$href = $this->ci->config->item('message_server') . $this->ci->config->item('message_html_view_url') . $result->retval[0]->token;
$href = $this->ci->config->item('message_server').$this->ci->config->item('message_html_view_url').$result->retval[0]->token;
$bodyMsg = $this->ci->parser->parse(
'templates/mailHTML',
array(
@@ -648,10 +619,10 @@ class MessageLib
$this->ci->loglib->logError('Error while sending an email');
// Writing errors in tbl_message_status
$sme = $this->setMessageError(
$result->retval[0]->message_id,
$result->retval[0]->receiver_id,
'Error while sending an email',
$result->retval[0]->sentinfo
$result->retval[0]->message_id,
$result->retval[0]->receiver_id,
'Error while sending an email',
$result->retval[0]->sentinfo
);
if (!$sme)
{
@@ -674,10 +645,10 @@ class MessageLib
$this->ci->loglib->logError('This person does not have an email account');
// Writing errors in tbl_message_status
$sme = $this->setMessageError(
$result->retval[0]->message_id,
$result->retval[0]->receiver_id,
'This person does not have an email account',
$result->retval[0]->sentinfo
$result->retval[0]->message_id,
$result->retval[0]->receiver_id,
'This person does not have an email account',
$result->retval[0]->sentinfo
);
if (!$sme)
{
@@ -702,8 +673,7 @@ class MessageLib
}
// ------------------------------------------------------------------------
// Private Functions from here out!
// ------------------------------------------------------------------------
// Private methods
/**
* Update the table tbl_message_recipient
@@ -740,7 +710,7 @@ class MessageLib
{
if (!is_null($prevSentInfo) && $prevSentInfo != '')
{
$sentInfo = $prevSentInfo . SENT_INFO_NEWLINE . $sentInfo;
$sentInfo = $prevSentInfo.SENT_INFO_NEWLINE.$sentInfo;
}
$parameters = array('sent' => null, 'sentinfo' => $sentInfo);
@@ -759,8 +729,8 @@ class MessageLib
$this->ci->BenutzerfunktionModel->addJoin('public.tbl_benutzer', 'uid');
// Get all the valid receivers id using the oe_kurzbz
$receivers = $this->ci->BenutzerfunktionModel->loadWhere(
'oe_kurzbz = \'' . $oe_kurzbz . '\''.
' AND funktion_kurzbz = \'' . $this->ci->config->item('assistent_function') . '\'' .
'oe_kurzbz = \''.$oe_kurzbz.'\''.
' AND funktion_kurzbz = \''.$this->ci->config->item('assistent_function').'\''.
' AND (NOW() BETWEEN COALESCE(datum_von, NOW()) AND COALESCE(datum_bis, NOW()))'
);
+64 -47
View File
@@ -76,11 +76,11 @@ class MigrationLib extends CI_Migration
{
if ($this->cli === true)
{
$colored = "\033[" . $color . "m%s\033[37m";
$colored = "\033[".$color."m%s\033[37m";
}
else
{
$colored = "<font color=\"" . $this->HTML_COLORS[$color] . "\">%s</font>";
$colored = "<font color=\"".$this->HTML_COLORS[$color]."\">%s</font>";
}
}
@@ -92,7 +92,7 @@ class MigrationLib extends CI_Migration
*/
private function _print($prefix, $text, $color = null)
{
printf($this->getColored($color), sprintf("%s %s" . $this->getEOL(), $prefix, $text));
printf($this->getColored($color), sprintf("%s %s".$this->getEOL(), $prefix, $text));
}
/**
@@ -139,8 +139,8 @@ class MigrationLib extends CI_Migration
*/
protected function startUP()
{
$this->printInfo(sprintf("%s Start method up of class %s %s",
MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
$this->printInfo(
sprintf("%s Start method up of class %s %s", MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
);
}
@@ -149,8 +149,8 @@ class MigrationLib extends CI_Migration
*/
protected function endUP()
{
$this->printInfo(sprintf("%s End method up of class %s %s",
MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
$this->printInfo(
sprintf("%s End method up of class %s %s", MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
);
}
@@ -159,8 +159,8 @@ class MigrationLib extends CI_Migration
*/
protected function startDown()
{
$this->printInfo(sprintf("%s Start method down of class %s %s",
MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
$this->printInfo(
sprintf("%s Start method down of class %s %s", MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
);
}
@@ -169,8 +169,8 @@ class MigrationLib extends CI_Migration
*/
protected function endDown()
{
$this->printInfo(sprintf("%s End method down of class %s %s",
MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
$this->printInfo(
sprintf("%s End method down of class %s %s", MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR)
);
}
@@ -179,11 +179,11 @@ class MigrationLib extends CI_Migration
*/
protected function addColumn($schema, $table, $fields)
{
foreach($fields as $name => $definition)
foreach ($fields as $name => $definition)
{
if (!$this->columnExists($name, $schema, $table))
{
if ($this->dbforge->add_column($schema . '.' . $table, array($name => $definition)))
if ($this->dbforge->add_column($schema.'.'.$table, array($name => $definition)))
{
$this->printMessage(sprintf("Column %s.%s.%s of type %s added", $schema, $table, $name, $definition["type"]));
}
@@ -204,11 +204,11 @@ class MigrationLib extends CI_Migration
*/
protected function modifyColumn($schema, $table, $fields)
{
foreach($fields as $name => $definition)
foreach ($fields as $name => $definition)
{
if ($this->columnExists($name, $schema, $table))
{
if ($this->dbforge->modify_column($schema . '.' . $table, array($name => $definition)))
if ($this->dbforge->modify_column($schema.'.'.$table, array($name => $definition)))
{
$this->printMessage(sprintf("Column %s.%s.%s has been modified", $schema, $table, $name));
}
@@ -231,7 +231,7 @@ class MigrationLib extends CI_Migration
{
if ($this->columnExists($field, $schema, $table))
{
if ($this->dbforge->drop_column($schema . '.' . $table, $field))
if ($this->dbforge->drop_column($schema.'.'.$table, $field))
{
$this->printMessage(sprintf("Column %s.%s.%s has been dropped", $schema, $table, $field));
}
@@ -289,8 +289,17 @@ class MigrationLib extends CI_Migration
*/
protected function addForeingKey($schema, $table, $name, $field, $schemaDest, $tableDest, $fieldDest, $attributes)
{
$query = sprintf("ALTER TABLE %s.%s ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s.%s (%s) %s",
$schema, $table, $name, $field, $schemaDest, $tableDest, $fieldDest, $attributes);
$query = sprintf(
"ALTER TABLE %s.%s ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s.%s (%s) %s",
$schema,
$table,
$name,
$field,
$schemaDest,
$tableDest,
$fieldDest,
$attributes
);
if (@$this->db->simple_query($query))
{
@@ -371,22 +380,26 @@ class MigrationLib extends CI_Migration
if (@$this->db->simple_query($query))
{
$this->printMessage(
sprintf("Granted permissions %s on table %s.%s to user %s",
is_null($stringPermission) ? $permissions : $stringPermission,
$schema,
$table,
$user
));
sprintf(
"Granted permissions %s on table %s.%s to user %s",
is_null($stringPermission) ? $permissions : $stringPermission,
$schema,
$table,
$user
)
);
}
else
{
$this->printError(
sprintf("Granting permissions %s on table %s.%s to user %s",
is_null($stringPermission) ? $permissions : $stringPermission,
$schema,
$table,
$user
));
sprintf(
"Granting permissions %s on table %s.%s to user %s",
is_null($stringPermission) ? $permissions : $stringPermission,
$schema,
$table,
$user
)
);
}
}
@@ -397,7 +410,7 @@ class MigrationLib extends CI_Migration
{
$this->dbforge->add_field($fields);
if ($this->dbforge->create_table($schema . '.' . $table, true))
if ($this->dbforge->create_table($schema.'.'.$table, true))
{
$this->printMessage(sprintf("Table %s.%s created or existing", $schema, $table));
}
@@ -412,7 +425,7 @@ class MigrationLib extends CI_Migration
*/
protected function dropTable($schema, $table)
{
if ($this->dbforge->drop_table($schema . "." . $table))
if ($this->dbforge->drop_table($schema.".".$table))
{
$this->printMessage(sprintf("Table %s.%s has been dropped", $schema, $table));
}
@@ -503,22 +516,26 @@ class MigrationLib extends CI_Migration
if (@$this->db->simple_query($query))
{
$this->printMessage(
sprintf("Granted permissions %s on sequence %s.%s to user %s",
is_null($stringPermission) ? $permissions : $stringPermission,
$schema,
$sequence,
$user
));
sprintf(
"Granted permissions %s on sequence %s.%s to user %s",
is_null($stringPermission) ? $permissions : $stringPermission,
$schema,
$sequence,
$user
)
);
}
else
{
$this->printError(
sprintf("Granting permissions %s on sequence %s.%s to user %s",
is_null($stringPermission) ? $permissions : $stringPermission,
$schema,
$sequence,
$user
));
sprintf(
"Granting permissions %s on sequence %s.%s to user %s",
is_null($stringPermission) ? $permissions : $stringPermission,
$schema,
$sequence,
$user
)
);
}
}
@@ -542,9 +559,9 @@ class MigrationLib extends CI_Migration
}
$this->printInfo(
"Query correctly executed: " .
substr(preg_replace("/\s+/", " ", trim($query)), 0, MigrationLib::PRINT_QUERY_LEN) .
"Query correctly executed: ".
substr(preg_replace("/\s+/", " ", trim($query)), 0, MigrationLib::PRINT_QUERY_LEN).
(strlen($query) > MigrationLib::PRINT_QUERY_LEN ? "..." : "")
);
}
}
}
@@ -4,6 +4,9 @@ if (! defined("BASEPATH")) exit("No direct script access allowed");
class OrganisationseinheitLib
{
/**
* Loads model OrganisationseinheitModel
*/
public function __construct()
{
$this->ci =& get_instance();
@@ -22,7 +25,7 @@ class OrganisationseinheitLib
* to the top, starting from the given oe_kurzbz. It stops when it finds a
* match with the other table, which attributes are passed as parameters:
* schema name, table name, fields to be selected, where conditions, orderby clause
*
*
* @param string $schema REQUIRED
* @param string $table REQUIRED
* @param mixed $fields REQUIRED
@@ -63,6 +66,9 @@ class OrganisationseinheitLib
return $result;
}
/**
* treeSearchEntire
*/
public function treeSearchEntire($table, $alias, $fields, $where, $orderby, $oe_kurzbz)
{
$select = "";
@@ -90,12 +96,15 @@ class OrganisationseinheitLib
{
$tmpResult = $this->treeSearchEntire($table, $alias, $select, $where, $orderby, $result->retval[0]->_ppk);
if (hasData($tmpResult) && $tmpResult->retval[0]->_pk != null && $tmpResult->retval[0]->_ppk != null && $tmpResult->retval[0]->_jtpk != null)
if (hasData($tmpResult)
&& $tmpResult->retval[0]->_pk != null
&& $tmpResult->retval[0]->_ppk != null
&& $tmpResult->retval[0]->_jtpk != null)
{
$result->retval = array_merge($result->retval, $tmpResult->retval);
}
}
else if ($result->retval[0]->_ppk != null)
elseif ($result->retval[0]->_ppk != null)
{
$result = $this->treeSearchEntire($table, $alias, $select, $where, $orderby, $result->retval[0]->_ppk);
}
@@ -103,4 +112,4 @@ class OrganisationseinheitLib
return $result;
}
}
}
+14 -15
View File
@@ -37,7 +37,7 @@ class PermissionLib
* PermissionLib's constructor
* Here is initialized the static property bb with all the rights of the user (API caller)
*/
function __construct()
public function __construct()
{
// Loads CI instance
$this->ci =& get_instance();
@@ -64,17 +64,16 @@ class PermissionLib
*/
public function isEntitled($sourceName, $permissionType)
{
$isEntitled = false;
// If the resource exists
if (isset($this->acl[$sourceName]))
{
// Checks permission
return $this->_isBerechtigt($this->acl[$sourceName], $permissionType);
}
// if the resource does not exist, do not lose useful clock cycles
else
{
return false;
$isEntitled = $this->_isBerechtigt($this->acl[$sourceName], $permissionType);
}
return $isEntitled;
}
/**
@@ -82,26 +81,26 @@ class PermissionLib
*/
public function getBerechtigungKurzbz($sourceName)
{
$returnValue = null;
if (isset($this->acl[$sourceName]))
{
return $this->acl[$sourceName];
}
else
{
return null;
$returnValue = $this->acl[$sourceName];
}
return $returnValue;
}
/**
* Checks user's (API caller) rights
*/
private function _isBerechtigt($berechtigung_kurzbz, $art = null, $oe_kurzbz = null, $kostenstelle_id = null)
private function _isBerechtigt($berechtigung_kurzbz, $art = null, $oe_kurzbz = null, $kostenstelle_id = null)
{
$isBerechtigt = false;
if (!is_null($berechtigung_kurzbz))
{
if(self::$bb->isBerechtigt($berechtigung_kurzbz, $oe_kurzbz, $art, $kostenstelle_id))
if (self::$bb->isBerechtigt($berechtigung_kurzbz, $oe_kurzbz, $art, $kostenstelle_id))
{
$isBerechtigt = true;
}
@@ -109,4 +108,4 @@ class PermissionLib
return $isBerechtigt;
}
}
}
+23 -50
View File
@@ -1,15 +1,11 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Name: Messaging Library for FH-Complete
*
*
*/
class PhrasesLib
{
/*
*
/**
* Loads parser library
*/
public function __construct()
{
@@ -28,17 +24,12 @@ class PhrasesLib
$this->ci->load->helper('language');
// Loads helper message to manage returning messages
$this->ci->load->helper('message');
//$this->ci->lang->load('fhcomplete');
}
/**
* getPhrase() - will load a spezific Phrase
*
* @param integer $vorlage_kurzbz REQUIRED
* @return struct
*/
function getPhrase($phrase_id)
public function getPhrase($phrase_id)
{
if (empty($phrase_id))
return error(MSG_ERR_INVALID_MSG_ID);
@@ -49,17 +40,17 @@ class PhrasesLib
/**
* getSubMessages() - will return all Messages subordinated from a specified message.
*
* @param integer $msg_id REQUIRED
* @return array
*/
function getPhraseByApp($app = null)
public function getPhraseByApp($app = null)
{
$phrases = $this->ci->PhraseModel->loadWhere(array('app' => $app));
return $phrases;
}
function getPhraseInhalt($phrase_id)
/**
* getPhraseInhalt
*/
public function getPhraseInhalt($phrase_id)
{
if (empty($phrase_id))
return error(MSG_ERR_INVALID_MSG_ID);
@@ -68,7 +59,10 @@ class PhrasesLib
return $phrasentext;
}
function delPhrasentext($phrasentext_id)
/**
* delPhrasentext
*/
public function delPhrasentext($phrasentext_id)
{
if (empty($phrasentext_id))
return error(MSG_ERR_INVALID_MSG_ID);
@@ -79,11 +73,8 @@ class PhrasesLib
/**
* savePhrase() - will save a spezific Phrase.
*
* @param array $data REQUIRED
* @return array
*/
function savePhrase($phrase_id, $data)
public function savePhrase($phrase_id, $data)
{
if (empty($data))
return error(MSG_ERR_INVALID_MSG_ID);
@@ -95,11 +86,8 @@ class PhrasesLib
/**
* getVorlagetextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
function getPhrasentextById($phrasentext_id)
public function getPhrasentextById($phrasentext_id)
{
if (empty($phrasentext_id))
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
@@ -109,11 +97,9 @@ class PhrasesLib
}
/**
* getPhrases() -
*
* @return struct
* getPhrases()
*/
function getPhrases($app, $sprache, $phrase = null, $orgeinheit_kurzbz = null, $orgform_kurzbz = null, $blockTags = null)
public function getPhrases($app, $sprache, $phrase = null, $orgeinheit_kurzbz = null, $orgform_kurzbz = null, $blockTags = null)
{
if (isset($app) && isset($sprache))
{
@@ -163,11 +149,8 @@ class PhrasesLib
/**
* insertPhraseinhalt() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
function insertPhraseinhalt($data)
public function insertPhraseinhalt($data)
{
$phrasentext = $this->ci->PhrasentextModel->insert($data);
return $phrasentext;
@@ -175,11 +158,8 @@ class PhrasesLib
/**
* getVorlagetextById() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
function getVorlagetextById($vorlagestudiengang_id)
public function getVorlagetextById($vorlagestudiengang_id)
{
$vorlagetext = $this->ci->VorlageStudiengangModel->load($vorlagestudiengang_id);
return $vorlagetext;
@@ -187,11 +167,8 @@ class PhrasesLib
/**
* saveVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
function updatePhraseInhalt($phrasentext_id, $data)
public function updatePhraseInhalt($phrasentext_id, $data)
{
$phrasentext = $this->ci->PhrasentextModel->update($phrasentext_id, $data);
return $phrasentext;
@@ -199,16 +176,12 @@ class PhrasesLib
/**
* parseVorlagetext() - will parse a Vorlagetext.
*
* @param string $text REQUIRED
* @param array $data REQUIRED
* @return string
*/
function parseVorlagetext($text, $data = array())
public function parseVorlagetext($text, $data = array())
{
if (empty($text))
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
$text = $this->ci->parser->parse_string($text, $data, TRUE);
$text = $this->ci->parser->parse_string($text, $data, true);
return $text;
}
}
}
+1 -4
View File
@@ -2,9 +2,6 @@
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
*/
class ReihungstestLib
{
/**
@@ -84,4 +81,4 @@ class ReihungstestLib
return false;
}
}
}
+26 -28
View File
@@ -48,7 +48,7 @@ class UDFLib
private $_ci; // Code igniter instance
/**
*
* Loads fhc helper
*/
public function __construct()
{
@@ -61,7 +61,7 @@ class UDFLib
// Public methods
/**
*
* UDFWidget
*/
public function UDFWidget($args, $htmlArgs = array())
{
@@ -100,6 +100,7 @@ class UDFLib
/**
* It renders the HTML of the UDF
*
* NOTE: When this method is called $widgetData contains different data from
* parameter $args in the constructor
*/
@@ -137,7 +138,7 @@ class UDFLib
$this->_sortJsonSchemas($jsonSchemasArray); // Sort the list of UDF by sort property
// Loops through json schemas
foreach($jsonSchemasArray as $jsonSchema)
foreach ($jsonSchemasArray as $jsonSchema)
{
// If the type property is not present then show an error
if (!isset($jsonSchema->{UDFLib::TYPE}))
@@ -266,7 +267,7 @@ class UDFLib
// If $toBeValidated == true => validation is performed
// If $toBeValidated == false => validation is NOT performed
$toBeValidated = false;
// If this UDF is NOT a checkbox
// If this UDF is NOT a checkbox
if ($decodedUDFDefinition->{UDFLib::TYPE} != UDFLib::CHKBOX_TYPE)
{
// If required property is NOT present in the UDF description
@@ -292,9 +293,9 @@ class UDFLib
if ($toBeValidated === true) // Checks if validation should be performed
{
$tmpValidate = $this->_validateUDFs(
$decodedUDFDefinition->{UDFLib::VALIDATION}, //
$decodedUDFDefinition->{UDFLib::NAME}, //
$val //
$decodedUDFDefinition->{UDFLib::VALIDATION},
$decodedUDFDefinition->{UDFLib::NAME},
$val
);
}
}
@@ -315,7 +316,7 @@ class UDFLib
// Copies the remaining required UDFs into $notValidUDFsArray
// because they were not supplied, therefore must be notified as error
foreach($requiredUDFsArray as $key => $val)
foreach ($requiredUDFsArray as $key => $val)
{
$notValidUDFsArray[] = array($val);
}
@@ -327,7 +328,7 @@ class UDFLib
// of the UDF that are not updated
if (is_array($udfValues) && count($udfValues) > 0)
{
foreach($udfValues as $fieldName => $fieldValue)
foreach ($udfValues as $fieldName => $fieldValue)
{
// If this field is not present in the given parameters
// then copy it from the DB without changes
@@ -354,7 +355,7 @@ class UDFLib
}
/**
*
* isUDFColumn
*/
public function isUDFColumn($columnName, $columnType)
{
@@ -377,7 +378,7 @@ class UDFLib
*/
private function _popUDFParameters(&$data)
{
foreach($data as $key => $val)
foreach ($data as $key => $val)
{
if (substr($key, 0, 4) == UDFLib::COLUMN_PREFIX)
{
@@ -402,7 +403,7 @@ class UDFLib
}
// Loops through all the supplied UDFs values
foreach($tmpUdfValues as $udfValIndx => $udfVal)
foreach ($tmpUdfValues as $udfValIndx => $udfVal)
{
// If the single UDF value is not an array or an object
if (!is_array($udfVal) && !is_object($udfVal))
@@ -456,7 +457,7 @@ class UDFLib
if (isset($decodedUDFValidation->{UDFLib::REGEX})
&& is_array($decodedUDFValidation->{UDFLib::REGEX}))
{
foreach($decodedUDFValidation->{UDFLib::REGEX} as $regexIndx => $regex)
foreach ($decodedUDFValidation->{UDFLib::REGEX} as $regexIndx => $regex)
{
if ($regex->language == UDFLib::BE_REGEX_LANGUAGE)
{
@@ -499,9 +500,7 @@ class UDFLib
*/
private function _sortJsonSchemas(&$jsonSchemasArray)
{
//
usort($jsonSchemasArray, function ($a, $b) {
//
if (!isset($a->{UDFLib::SORT}))
{
$a->{UDFLib::SORT} = 9999;
@@ -510,7 +509,6 @@ class UDFLib
{
$b->{UDFLib::SORT} = 9999;
}
if ($a->{UDFLib::SORT} == $b->{UDFLib::SORT})
{
return 0;
@@ -541,7 +539,7 @@ class UDFLib
{
show_error($udfResults->retval);
}
else if (is_string($udfResults))
elseif (is_string($udfResults))
{
show_error($udfResults);
}
@@ -550,7 +548,7 @@ class UDFLib
show_error('UDFWidget: generic error occurred');
}
}
else if (!hasData($udfResults))
elseif (!hasData($udfResults))
{
show_error(sprintf('%s.%s does not contain UDF', $schema, $table));
}
@@ -569,27 +567,27 @@ class UDFLib
$this->_renderCheckbox($jsonSchema, $widgetData);
}
// Textfield
else if ($jsonSchema->{UDFLib::TYPE} == 'textfield')
elseif ($jsonSchema->{UDFLib::TYPE} == 'textfield')
{
$this->_renderTextfield($jsonSchema, $widgetData);
}
// Textarea
else if ($jsonSchema->{UDFLib::TYPE} == 'textarea')
elseif ($jsonSchema->{UDFLib::TYPE} == 'textarea')
{
$this->_renderTextarea($jsonSchema, $widgetData);
}
// Date
else if ($jsonSchema->{UDFLib::TYPE} == 'date')
elseif ($jsonSchema->{UDFLib::TYPE} == 'date')
{
// To be done
}
// Dropdown
else if ($jsonSchema->{UDFLib::TYPE} == 'dropdown')
elseif ($jsonSchema->{UDFLib::TYPE} == 'dropdown')
{
$this->_renderDropdown($jsonSchema, $widgetData);
}
// Multiple dropdown
else if ($jsonSchema->{UDFLib::TYPE} == 'multipledropdown')
elseif ($jsonSchema->{UDFLib::TYPE} == 'multipledropdown')
{
$this->_renderDropdown($jsonSchema, $widgetData, true);
}
@@ -620,12 +618,12 @@ class UDFLib
$parameters = $jsonSchema->{UDFLib::LIST_VALUES}->enum;
}
// If the list of values to show should be retrived with a SQL statement
else if (isset($jsonSchema->{UDFLib::LIST_VALUES}->sql))
elseif (isset($jsonSchema->{UDFLib::LIST_VALUES}->sql))
{
// UDFModel is loaded in method _loadUDF that is called before the current method
$queryResult = $this->_ci->UDFModel->execQuery($jsonSchema->{UDFLib::LIST_VALUES}->sql);
if (hasData($queryResult))
{
{
$parameters = $queryResult->retval;
}
}
@@ -796,7 +794,7 @@ class UDFLib
if (isset($jsonSchemaValidation->{UDFLib::REGEX})
&& is_array($jsonSchemaValidation->{UDFLib::REGEX}))
{
foreach($jsonSchemaValidation->{UDFLib::REGEX} as $regex)
foreach ($jsonSchemaValidation->{UDFLib::REGEX} as $regex)
{
if ($regex->language === UDFLib::FE_REGEX_LANGUAGE)
{
@@ -836,4 +834,4 @@ class UDFLib
}
}
}
}
}
+31 -40
View File
@@ -1,16 +1,14 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Name: Messaging Library for FH-Complete
*
*
*/
class VorlageLib
{
private $recipients = array();
/**
* Loads parser library and OrganisationseinheitLib library
*/
public function __construct()
{
require_once APPPATH.'config/message.php';
@@ -32,10 +30,10 @@ class VorlageLib
/**
* getVorlage() - will load a spezific Template
*
* @param integer $vorlage_kurzbz REQUIRED
* @param int $vorlage_kurzbz REQUIRED
* @return struct
*/
function getVorlage($vorlage_kurzbz)
public function getVorlage($vorlage_kurzbz)
{
if (empty($vorlage_kurzbz))
return error(MSG_ERR_INVALID_MSG_ID);
@@ -47,23 +45,22 @@ class VorlageLib
/**
* getSubMessages() - will return all Messages subordinated from a specified message.
*
* @param integer $msg_id REQUIRED
* @param int $msg_id REQUIRED
* @return array
*/
function getVorlageByMimetype($mimetype = null)
public function getVorlageByMimetype($mimetype = null)
{
$vorlage = $this->ci->VorlageModel->loadWhere(array('mimetype' => $mimetype));
return $vorlage;
}
/**
* saveVorlage() - will save a spezific Template.
*
* @param array $data REQUIRED
* @return array
*/
function saveVorlage($vorlage_kurzbz, $data)
public function saveVorlage($vorlage_kurzbz, $data)
{
if (empty($data))
return error(MSG_ERR_INVALID_MSG_ID);
@@ -72,19 +69,18 @@ class VorlageLib
return $vorlage;
}
/**
* getVorlagetextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
function getVorlagetextByVorlage($vorlage_kurzbz)
public function getVorlagetextByVorlage($vorlage_kurzbz)
{
if (empty($vorlage_kurzbz))
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
$vorlage = $this->ci->VorlageStudiengangModel->loadWhere(array('vorlage_kurzbz' =>$vorlage_kurzbz));
$vorlage = $this->ci->VorlageStudiengangModel->loadWhere(array('vorlage_kurzbz' => $vorlage_kurzbz));
return $vorlage;
}
@@ -97,7 +93,7 @@ class VorlageLib
* @param string $sprache OPTIONAL
* @return array
*/
function loadVorlagetext($vorlage_kurzbz, $oe_kurzbz = null, $orgform_kurzbz = null, $sprache = null)
public function loadVorlagetext($vorlage_kurzbz, $oe_kurzbz = null, $orgform_kurzbz = null, $sprache = null)
{
if (empty($vorlage_kurzbz))
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
@@ -126,40 +122,35 @@ class VorlageLib
$where = $this->_where($vorlage_kurzbz, $orgform_kurzbz, $sprache);
$vorlage = $this->ci->organisationseinheitlib->treeSearch(
'public',
'tbl_vorlagestudiengang',
array("vorlage_kurzbz", "studiengang_kz", "version", "text", "oe_kurzbz",
"vorlagestudiengang_id", "style", "berechtigung", "anmerkung_vorlagestudiengang",
"aktiv", "sprache", "subject", "orgform_kurzbz"),
$where,
"version DESC",
$oe_kurzbz
'public',
'tbl_vorlagestudiengang',
array("vorlage_kurzbz", "studiengang_kz", "version", "text", "oe_kurzbz",
"vorlagestudiengang_id", "style", "berechtigung", "anmerkung_vorlagestudiengang",
"aktiv", "sprache", "subject", "orgform_kurzbz"),
$where,
"version DESC",
$oe_kurzbz
);
}
return $vorlage;
}
/**
* _where
*/
private function _where($vorlage_kurzbz, $orgform_kurzbz, $sprache)
{
// Builds where clause
$where = "vorlage_kurzbz = ".$this->ci->VorlageModel->escape($vorlage_kurzbz);
// if (is_null($orgform_kurzbz))
// {
// $where .= " AND orgform_kurzbz IS NULL";
// }
// else
// {
// $where .= " AND orgform_kurzbz = " . $this->ci->VorlageModel->escape($orgform_kurzbz);
// }
if (is_null($sprache))
{
$where .= " AND sprache IS NULL";
}
else
{
$where .= " AND sprache = " . $this->ci->VorlageModel->escape($sprache);
$where .= " AND sprache = ".$this->ci->VorlageModel->escape($sprache);
}
$where .= " AND aktiv = true";
@@ -173,7 +164,7 @@ class VorlageLib
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
function insertVorlagetext($data)
public function insertVorlagetext($data)
{
$vorlagetext = $this->ci->VorlageStudiengangModel->insert($data);
return $vorlagetext;
@@ -185,7 +176,7 @@ class VorlageLib
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
function getVorlagetextById($vorlagestudiengang_id)
public function getVorlagetextById($vorlagestudiengang_id)
{
$vorlagetext = $this->ci->VorlageStudiengangModel->load($vorlagestudiengang_id);
return $vorlagetext;
@@ -197,7 +188,7 @@ class VorlageLib
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
function updateVorlagetext($vorlagestudiengang_id, $data)
public function updateVorlagetext($vorlagestudiengang_id, $data)
{
$vorlagetext = $this->ci->VorlageStudiengangModel->update($vorlagestudiengang_id, $data);
return $vorlagetext;
@@ -210,11 +201,11 @@ class VorlageLib
* @param array $data REQUIRED
* @return string
*/
function parseVorlagetext($text, $data = array())
public function parseVorlagetext($text, $data = array())
{
if (empty($text))
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
$text = $this->ci->parser->parse_string($text, $data, TRUE);
$text = $this->ci->parser->parse_string($text, $data, true);
return $text;
}
}
}