mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 16:44:28 +00:00
Merge after last Commit
This commit is contained in:
@@ -55,7 +55,7 @@ class LogLib
|
||||
$function = $backtrace_arr[$functionIndex]['function'];
|
||||
}
|
||||
|
||||
if (isset($backtrace_arr[$lineIndex]['line']) && $backgrace_arr[$lineIndex]['line'] != '')
|
||||
if (isset($backtrace_arr[$lineIndex]['line']) && $backtrace_arr[$lineIndex]['line'] != '')
|
||||
{
|
||||
$line = $backtrace_arr[$lineIndex]['line'];
|
||||
}
|
||||
|
||||
@@ -58,6 +58,14 @@ class MailLib
|
||||
$alias = $this->alias_from_system;
|
||||
}
|
||||
}
|
||||
if (defined('MAIL_FROM') && MAIL_FROM != '')
|
||||
{
|
||||
$from = MAIL_FROM;
|
||||
if (is_null($alias) || $alias == '')
|
||||
{
|
||||
$alias = $this->alias_from_system;
|
||||
}
|
||||
}
|
||||
|
||||
$this->ci->email->from($from, $alias);
|
||||
|
||||
@@ -65,12 +73,14 @@ class MailLib
|
||||
$recipient = $to;
|
||||
$recipientCC = $cc;
|
||||
$recipientBCC = $bcc;
|
||||
if ($this->validateEmailAddress(MAIL_DEBUG))
|
||||
if (defined('MAIL_DEBUG') && MAIL_DEBUG != '')
|
||||
{
|
||||
// if is it valid use it!!!
|
||||
$recipient = MAIL_DEBUG;
|
||||
$recipientCC = MAIL_DEBUG;
|
||||
$recipientBCC = MAIL_DEBUG;
|
||||
if ($recipientCC != '')
|
||||
$recipientCC = MAIL_DEBUG;
|
||||
if ($recipientBCC != '')
|
||||
$recipientBCC = MAIL_DEBUG;
|
||||
}
|
||||
|
||||
$this->ci->email->to($recipient);
|
||||
|
||||
@@ -15,7 +15,7 @@ class MessageLib
|
||||
public function __construct()
|
||||
{
|
||||
// Get code igniter instance
|
||||
$this->ci =& get_instance();
|
||||
$this->ci =& get_instance();
|
||||
|
||||
// Loads message configuration
|
||||
$this->ci->config->load('message');
|
||||
@@ -41,70 +41,70 @@ class MessageLib
|
||||
$this->ci->load->helper('message');
|
||||
|
||||
// Loads phrases
|
||||
$this->ci->lang->load('message');
|
||||
}
|
||||
$this->ci->lang->load('message');
|
||||
}
|
||||
|
||||
/**
|
||||
* getMessage() - returns the specified received message for a specified person
|
||||
*/
|
||||
public function getMessage($msg_id, $person_id)
|
||||
{
|
||||
if (empty($msg_id))
|
||||
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
|
||||
/**
|
||||
* getMessage() - returns the specified received message for a specified person
|
||||
*/
|
||||
public function getMessage($msg_id, $person_id)
|
||||
{
|
||||
if (empty($msg_id))
|
||||
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
|
||||
if (empty($person_id))
|
||||
return $this->_error('', MSG_ERR_INVALID_RECIPIENTS);
|
||||
return $this->_error('', MSG_ERR_INVALID_RECIPIENTS);
|
||||
|
||||
$msg = $this->ci->RecipientModel->getMessage($msg_id, $person_id);
|
||||
|
||||
return $msg;
|
||||
}
|
||||
return $msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* getMessagesByUID() - will return all messages, including the latest status for specified user. It don´t returns Attachments.
|
||||
*/
|
||||
public function getMessagesByUID($uid, $oe_kurzbz = null, $all = false)
|
||||
{
|
||||
if (empty($uid))
|
||||
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
|
||||
* getMessagesByUID() - will return all messages, including the latest status for specified user. It don´t returns Attachments.
|
||||
*/
|
||||
public function getMessagesByUID($uid, $oe_kurzbz = null, $all = false)
|
||||
{
|
||||
if (empty($uid))
|
||||
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
|
||||
|
||||
$msg = $this->ci->RecipientModel->getMessagesByUID($uid, $oe_kurzbz, $all);
|
||||
|
||||
return $msg;
|
||||
}
|
||||
return $msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* getMessagesByPerson() - will return all messages, including the latest status for specified user. It don´t returns Attachments.
|
||||
*/
|
||||
public function getMessagesByPerson($person_id, $oe_kurzbz = null, $all = false)
|
||||
{
|
||||
if (empty($person_id))
|
||||
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
|
||||
* getMessagesByPerson() - will return all messages, including the latest status for specified user. It don´t returns Attachments.
|
||||
*/
|
||||
public function getMessagesByPerson($person_id, $oe_kurzbz = null, $all = false)
|
||||
{
|
||||
if (empty($person_id))
|
||||
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
|
||||
|
||||
$msg = $this->ci->RecipientModel->getMessagesByPerson($person_id, $oe_kurzbz, $all);
|
||||
|
||||
return $msg;
|
||||
}
|
||||
return $msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* getSentMessagesByPerson() - Get all sent messages from a person identified by person_id
|
||||
*/
|
||||
public function getSentMessagesByPerson($person_id, $oe_kurzbz = null, $all = false)
|
||||
{
|
||||
if (empty($person_id))
|
||||
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
|
||||
* getSentMessagesByPerson() - Get all sent messages from a person identified by person_id
|
||||
*/
|
||||
public function getSentMessagesByPerson($person_id, $oe_kurzbz = null, $all = false)
|
||||
{
|
||||
if (empty($person_id))
|
||||
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
|
||||
|
||||
$msg = $this->ci->MessageModel->getMessagesByPerson($person_id, $oe_kurzbz, $all);
|
||||
|
||||
return $msg;
|
||||
}
|
||||
return $msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* getMessageByToken
|
||||
*/
|
||||
public function getMessageByToken($token)
|
||||
{
|
||||
if (empty($token))
|
||||
return $this->_error('', MSG_ERR_INVALID_TOKEN);
|
||||
* getMessageByToken
|
||||
*/
|
||||
public function getMessageByToken($token)
|
||||
{
|
||||
if (empty($token))
|
||||
return $this->_error('', MSG_ERR_INVALID_TOKEN);
|
||||
|
||||
$result = $this->ci->RecipientModel->getMessageByToken($token);
|
||||
if (hasData($result))
|
||||
@@ -138,43 +138,43 @@ class MessageLib
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* getCountUnreadMessages
|
||||
*/
|
||||
public function getCountUnreadMessages($person_id, $oe_kurzbz = null)
|
||||
{
|
||||
if (!is_numeric($person_id))
|
||||
return $this->_error('', MSG_ERR_INVALID_RECIPIENTS);
|
||||
/**
|
||||
* getCountUnreadMessages
|
||||
*/
|
||||
public function getCountUnreadMessages($person_id, $oe_kurzbz = null)
|
||||
{
|
||||
if (!is_numeric($person_id))
|
||||
return $this->_error('', MSG_ERR_INVALID_RECIPIENTS);
|
||||
|
||||
$msg = $this->ci->RecipientModel->getCountUnreadMessages($person_id, $oe_kurzbz);
|
||||
|
||||
return $msg;
|
||||
}
|
||||
return $msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* updateMessageStatus() - will change status on message for particular user
|
||||
/**
|
||||
* updateMessageStatus() - will change status on message for particular user
|
||||
* NOTE: it performs an insert, NOT an update
|
||||
*/
|
||||
public function updateMessageStatus($message_id, $person_id, $status)
|
||||
{
|
||||
if (empty($message_id))
|
||||
{
|
||||
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
|
||||
}
|
||||
*/
|
||||
public function updateMessageStatus($message_id, $person_id, $status)
|
||||
{
|
||||
if (empty($message_id))
|
||||
{
|
||||
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
|
||||
}
|
||||
|
||||
if (empty($person_id))
|
||||
{
|
||||
return $this->_error('', MSG_ERR_INVALID_USER_ID);
|
||||
}
|
||||
if (empty($person_id))
|
||||
{
|
||||
return $this->_error('', MSG_ERR_INVALID_USER_ID);
|
||||
}
|
||||
|
||||
// NOTE: Not use empty otherwise if status is 0 it returns an error
|
||||
if (!isset($status))
|
||||
{
|
||||
return $this->_error('', MSG_ERR_INVALID_STATUS_ID);
|
||||
}
|
||||
if (!isset($status))
|
||||
{
|
||||
return $this->_error('', MSG_ERR_INVALID_STATUS_ID);
|
||||
}
|
||||
|
||||
// Searches if the status is already present
|
||||
$result = $this->ci->MsgStatusModel->load(array($message_id, $person_id, $status));
|
||||
@@ -195,17 +195,17 @@ class MessageLib
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
if (!is_numeric($sender_id))
|
||||
{
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
if (!is_numeric($sender_id))
|
||||
{
|
||||
$sender_id = $this->ci->config->item('system_person_id');
|
||||
}
|
||||
}
|
||||
|
||||
$receivers = $this->_getReceivers($receiver_id, $oe_kurzbz);
|
||||
|
||||
@@ -270,17 +270,17 @@ class MessageLib
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sendMessageVorlage() - sends new internal message using a template
|
||||
*/
|
||||
public function sendMessageVorlage($sender_id, $receiver_id, $vorlage_kurzbz, $oe_kurzbz, $data, $relationmessage_id = null, $orgform_kurzbz = null, $multiPartMime = true)
|
||||
{
|
||||
if (!is_numeric($sender_id))
|
||||
{
|
||||
* sendMessageVorlage() - sends new internal message using a template
|
||||
*/
|
||||
public function sendMessageVorlage($sender_id, $receiver_id, $vorlage_kurzbz, $oe_kurzbz, $data, $relationmessage_id = null, $orgform_kurzbz = null, $multiPartMime = true)
|
||||
{
|
||||
if (!is_numeric($sender_id))
|
||||
{
|
||||
$sender_id = $this->ci->config->item('system_person_id');
|
||||
}
|
||||
}
|
||||
|
||||
$receivers = $this->_getReceivers($receiver_id, $oe_kurzbz);
|
||||
|
||||
@@ -387,7 +387,7 @@ class MessageLib
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the messages from DB and sends them via email
|
||||
@@ -426,54 +426,90 @@ class MessageLib
|
||||
if ((!is_null($result->retval[$i]->receiver) && $result->retval[$i]->receiver != '')
|
||||
|| (!is_null($result->retval[$i]->employeecontact) && $result->retval[$i]->employeecontact != ''))
|
||||
{
|
||||
$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',
|
||||
array(
|
||||
'href' => $href,
|
||||
'subject' => $result->retval[0]->subject,
|
||||
'body' => $result->retval[0]->body
|
||||
),
|
||||
true
|
||||
);
|
||||
$href = $this->ci->config->item('message_server').$this->ci->config->item('message_html_view_url').$result->retval[$i]->token;
|
||||
|
||||
$vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailHTML');
|
||||
|
||||
if(hasData($vorlage))
|
||||
{
|
||||
// Using a template for the html email body
|
||||
$body = $this->ci->parser->parse_string(
|
||||
$vorlage->retval[0]->text,
|
||||
array(
|
||||
'href' => $href,
|
||||
'subject' => $result->retval[$i]->subject,
|
||||
'body' => $result->retval[$i]->body
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Using a template for the html email body
|
||||
$body = $this->ci->parser->parse(
|
||||
'templates/mailHTML',
|
||||
array(
|
||||
'href' => $href,
|
||||
'subject' => $result->retval[$i]->subject,
|
||||
'body' => $result->retval[$i]->body
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
if (is_null($body) || $body == '')
|
||||
{
|
||||
$this->ci->loglib->logError('Error while parsing the mail template');
|
||||
}
|
||||
|
||||
// Using a template for the plain text email body
|
||||
$altBody = $this->ci->parser->parse(
|
||||
'templates/mailTXT',
|
||||
array(
|
||||
'href' => $href,
|
||||
'subject' => $result->retval[0]->subject,
|
||||
'body' => $result->retval[0]->body
|
||||
),
|
||||
true
|
||||
);
|
||||
$vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailTXT');
|
||||
if(hasData($vorlage))
|
||||
{
|
||||
// Using a template for the plain text email body
|
||||
$altBody = $this->ci->parser->parse_string(
|
||||
$vorlage->retval[0]->text,
|
||||
array(
|
||||
'href' => $href,
|
||||
'subject' => $result->retval[$i]->subject,
|
||||
'body' => $result->retval[$i]->body
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Using a template for the plain text email body
|
||||
$altBody = $this->ci->parser->parse(
|
||||
'templates/mailTXT',
|
||||
array(
|
||||
'href' => $href,
|
||||
'subject' => $result->retval[$i]->subject,
|
||||
'body' => $result->retval[$i]->body
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
if (is_null($altBody) || $altBody == '')
|
||||
{
|
||||
$this->ci->loglib->logError('Error while parsing the mail template');
|
||||
}
|
||||
|
||||
// If the sender kontakt does not exist, then system-sender is used if empty
|
||||
// If the sender is not an employee, then system-sender is used if empty
|
||||
$sender = '';
|
||||
if (!is_null($result->retval[0]->sender) && $result->retval[0]->sender != '')
|
||||
if (!is_null($result->retval[0]->senderemployeecontact) && $result->retval[0]->senderemployeecontact != '')
|
||||
{
|
||||
$sender = $result->retval[0]->sender;
|
||||
$sender = $result->retval[0]->senderemployeecontact.'@'.DOMAIN;
|
||||
}
|
||||
|
||||
$receiverContanct = $result->retval[$i]->receiver;
|
||||
$receiverContact = $result->retval[$i]->receiver;
|
||||
if (!is_null($result->retval[$i]->employeecontact) && $result->retval[$i]->employeecontact != '')
|
||||
{
|
||||
$receiverContanct = $result->retval[$i]->employeecontact.'@'.DOMAIN;
|
||||
$receiverContact = $result->retval[$i]->employeecontact.'@'.DOMAIN;
|
||||
}
|
||||
|
||||
// Sending email
|
||||
$sent = $this->ci->maillib->send(
|
||||
$sender,
|
||||
$receiverContanct,
|
||||
$receiverContact,
|
||||
$result->retval[$i]->subject,
|
||||
$body,
|
||||
null,
|
||||
@@ -571,15 +607,32 @@ class MessageLib
|
||||
{
|
||||
// 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;
|
||||
$bodyMsg = $this->ci->parser->parse(
|
||||
'templates/mailHTML',
|
||||
array(
|
||||
'href' => $href,
|
||||
'subject' => $result->retval[0]->subject,
|
||||
'body' => $result->retval[0]->body
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
$vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailHTML');
|
||||
if(hasData($vorlage))
|
||||
{
|
||||
$bodyMsg = $this->ci->parser->parse_string(
|
||||
$vorlage->retval[0]->text,
|
||||
array(
|
||||
'href' => $href,
|
||||
'subject' => $result->retval[0]->subject,
|
||||
'body' => $result->retval[0]->body
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$bodyMsg = $this->ci->parser->parse(
|
||||
'templates/mailHTML',
|
||||
array(
|
||||
'href' => $href,
|
||||
'subject' => $result->retval[0]->subject,
|
||||
'body' => $result->retval[0]->body
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
if (is_null($bodyMsg) || $bodyMsg == '')
|
||||
{
|
||||
// $body = $result->retval[0]->body;
|
||||
@@ -587,15 +640,31 @@ class MessageLib
|
||||
}
|
||||
|
||||
// Using a template for the plain text email body
|
||||
$altBody = $this->ci->parser->parse(
|
||||
'templates/mailTXT',
|
||||
array(
|
||||
'href' => $href,
|
||||
'subject' => $result->retval[0]->subject,
|
||||
'body' => $result->retval[0]->body
|
||||
),
|
||||
true
|
||||
);
|
||||
$vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailTXT');
|
||||
if(hasData($vorlage))
|
||||
{
|
||||
$altBody = $this->ci->parser->parse_string(
|
||||
$vorlage->retval[0]->text,
|
||||
array(
|
||||
'href' => $href,
|
||||
'subject' => $result->retval[0]->subject,
|
||||
'body' => $result->retval[0]->body
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$altBody = $this->ci->parser->parse(
|
||||
'templates/mailTXT',
|
||||
array(
|
||||
'href' => $href,
|
||||
'subject' => $result->retval[0]->subject,
|
||||
'body' => $result->retval[0]->body
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
if (is_null($altBody) || $altBody == '')
|
||||
{
|
||||
$this->ci->loglib->logError('Error while parsing the plain text mail template');
|
||||
@@ -606,23 +675,23 @@ class MessageLib
|
||||
$bodyMsg = $altBody = $body;
|
||||
}
|
||||
|
||||
// If the sender kontakt does not exist, then system-sender is used if empty
|
||||
// If the sender is not an employee, then system-sender is used if empty
|
||||
$sender = '';
|
||||
if (!is_null($result->retval[0]->sender) && $result->retval[0]->sender != '')
|
||||
if (!is_null($result->retval[0]->senderemployeecontact) && $result->retval[0]->senderemployeecontact != '')
|
||||
{
|
||||
$sender = $result->retval[0]->sender;
|
||||
$sender = $result->retval[0]->senderemployeecontact.'@'.DOMAIN;
|
||||
}
|
||||
|
||||
$receiverContanct = $result->retval[0]->receiver;
|
||||
$receiverContact = $result->retval[0]->receiver;
|
||||
if (!is_null($result->retval[0]->employeecontact) && $result->retval[0]->employeecontact != '')
|
||||
{
|
||||
$receiverContanct = $result->retval[0]->employeecontact.'@'.DOMAIN;
|
||||
$receiverContact = $result->retval[0]->employeecontact.'@'.DOMAIN;
|
||||
}
|
||||
|
||||
// Sending email
|
||||
$sent = $this->ci->maillib->send(
|
||||
$sender,
|
||||
$receiverContanct,
|
||||
$receiverContact,
|
||||
is_null($subject) ? $result->retval[0]->subject : $subject, // if parameter subject is not null, use it!
|
||||
$bodyMsg,
|
||||
null,
|
||||
@@ -689,8 +758,8 @@ class MessageLib
|
||||
return $sent;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Private methods
|
||||
// ------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Update the table tbl_msg_recipient
|
||||
@@ -736,29 +805,29 @@ class MessageLib
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the receivers id that are enabled to read messages for that oe_kurzbz
|
||||
*/
|
||||
private function _getReceiversByOekurzbz($oe_kurzbz)
|
||||
{
|
||||
* Gets the receivers id that are enabled to read messages for that oe_kurzbz
|
||||
*/
|
||||
private function _getReceiversByOekurzbz($oe_kurzbz)
|
||||
{
|
||||
// Load Benutzerfunktion_model
|
||||
$this->ci->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
|
||||
// Join with table public.tbl_benutzer on field uid
|
||||
$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 = '.$this->ci->db->escape($oe_kurzbz).
|
||||
' AND funktion_kurzbz = '.$this->ci->db->escape($this->ci->config->item('assistent_function')).
|
||||
' AND (NOW() BETWEEN COALESCE(datum_von, NOW()) AND COALESCE(datum_bis, NOW()))'
|
||||
);
|
||||
|
||||
return $receivers;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the receivers id
|
||||
*/
|
||||
private function _getReceivers($receiver_id, $oe_kurzbz = null)
|
||||
{
|
||||
/**
|
||||
* Gets the receivers id
|
||||
*/
|
||||
private function _getReceivers($receiver_id, $oe_kurzbz = null)
|
||||
{
|
||||
$receivers = null;
|
||||
|
||||
// If no receiver_id is given...
|
||||
@@ -782,13 +851,13 @@ class MessageLib
|
||||
}
|
||||
|
||||
return $receivers;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given receiver id is a valid person
|
||||
*/
|
||||
private function _checkReceiverId($receiver_id)
|
||||
{
|
||||
/**
|
||||
* Checks if the given receiver id is a valid person
|
||||
*/
|
||||
private function _checkReceiverId($receiver_id)
|
||||
{
|
||||
// Load Person_model
|
||||
$this->ci->load->model('person/Person_model', 'PersonModel');
|
||||
$result = $this->ci->PersonModel->load($receiver_id);
|
||||
@@ -798,13 +867,13 @@ class MessageLib
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a message in DB
|
||||
**/
|
||||
private function _saveMessage($sender_id, $receiver_id, $subject, $body, $relationmessage_id, $oe_kurzbz)
|
||||
{
|
||||
/**
|
||||
* Save a message in DB
|
||||
**/
|
||||
private function _saveMessage($sender_id, $receiver_id, $subject, $body, $relationmessage_id, $oe_kurzbz)
|
||||
{
|
||||
// Starts db transaction
|
||||
$this->ci->db->trans_start(false);
|
||||
|
||||
@@ -854,27 +923,27 @@ class MessageLib
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for function error
|
||||
*/
|
||||
private function _error($retval = '', $code = null)
|
||||
{
|
||||
/**
|
||||
* Wrapper for function error
|
||||
*/
|
||||
private function _error($retval = '', $code = null)
|
||||
{
|
||||
return error($retval, $code, MessageLib::MSG_INDX_PREFIX);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for function success
|
||||
*/
|
||||
private function _success($retval = '', $code = null)
|
||||
{
|
||||
/**
|
||||
* Wrapper for function success
|
||||
*/
|
||||
private function _success($retval = '', $code = null)
|
||||
{
|
||||
return success($retval, $code, MessageLib::MSG_INDX_PREFIX);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function parseMessageText($text, $data = array())
|
||||
{
|
||||
return $this->ci->parser->parse_string($text, $data, true);
|
||||
|
||||
@@ -9,9 +9,9 @@ class VorlageLib
|
||||
/**
|
||||
* Loads parser library and OrganisationseinheitLib library
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
require_once APPPATH.'config/message.php';
|
||||
public function __construct()
|
||||
{
|
||||
require_once APPPATH.'config/message.php';
|
||||
|
||||
$this->ci =& get_instance();
|
||||
|
||||
@@ -21,83 +21,83 @@ class VorlageLib
|
||||
$this->ci->load->model('system/Vorlage_model', 'VorlageModel');
|
||||
$this->ci->load->model('system/Vorlagestudiengang_model', 'VorlageStudiengangModel');
|
||||
|
||||
$this->ci->load->helper('language');
|
||||
// Loads helper message to manage returning messages
|
||||
$this->ci->load->helper('language');
|
||||
// Loads helper message to manage returning messages
|
||||
$this->ci->load->helper('message');
|
||||
//$this->ci->lang->load('fhcomplete');
|
||||
}
|
||||
//$this->ci->lang->load('fhcomplete');
|
||||
}
|
||||
|
||||
/**
|
||||
* getVorlage() - will load a spezific Template
|
||||
*
|
||||
* @param int $vorlage_kurzbz REQUIRED
|
||||
* @return struct
|
||||
*/
|
||||
public function getVorlage($vorlage_kurzbz)
|
||||
{
|
||||
if (empty($vorlage_kurzbz))
|
||||
return error(MSG_ERR_INVALID_MSG_ID);
|
||||
|
||||
$vorlage = $this->ci->VorlageModel->load($vorlage_kurzbz);
|
||||
return $vorlage;
|
||||
}
|
||||
|
||||
/**
|
||||
* getSubMessages() - will return all Messages subordinated from a specified message.
|
||||
*
|
||||
* @param int $msg_id REQUIRED
|
||||
* @return array
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public function saveVorlage($vorlage_kurzbz, $data)
|
||||
{
|
||||
if (empty($data))
|
||||
return error(MSG_ERR_INVALID_MSG_ID);
|
||||
|
||||
$vorlage = $this->ci->VorlageModel->update($vorlage_kurzbz, $data);
|
||||
return $vorlage;
|
||||
}
|
||||
|
||||
/**
|
||||
* getVorlagetextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template.
|
||||
*
|
||||
* @param string $vorlage_kurzbz REQUIRED
|
||||
* @return array
|
||||
*/
|
||||
public function getVorlagetextByVorlage($vorlage_kurzbz)
|
||||
* getVorlage() - will load a spezific Template
|
||||
*
|
||||
* @param int $vorlage_kurzbz REQUIRED
|
||||
* @return struct
|
||||
*/
|
||||
public function getVorlage($vorlage_kurzbz)
|
||||
{
|
||||
if (empty($vorlage_kurzbz))
|
||||
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
||||
if (empty($vorlage_kurzbz))
|
||||
return error(MSG_ERR_INVALID_MSG_ID);
|
||||
|
||||
$vorlage = $this->ci->VorlageStudiengangModel->loadWhere(array('vorlage_kurzbz' => $vorlage_kurzbz));
|
||||
return $vorlage;
|
||||
}
|
||||
$vorlage = $this->ci->VorlageModel->load($vorlage_kurzbz);
|
||||
return $vorlage;
|
||||
}
|
||||
|
||||
/**
|
||||
* loadVorlagetext() - will load the best fitting Template.
|
||||
*
|
||||
* @param string $vorlage_kurzbz REQUIRED
|
||||
* @param string $oe_kurzbz OPTIONAL
|
||||
* @param string $orgform_kurzbz OPTIONAL
|
||||
* getSubMessages() - will return all Messages subordinated from a specified message.
|
||||
*
|
||||
* @param int $msg_id REQUIRED
|
||||
* @return array
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public function saveVorlage($vorlage_kurzbz, $data)
|
||||
{
|
||||
if (empty($data))
|
||||
return error(MSG_ERR_INVALID_MSG_ID);
|
||||
|
||||
$vorlage = $this->ci->VorlageModel->update($vorlage_kurzbz, $data);
|
||||
return $vorlage;
|
||||
}
|
||||
|
||||
/**
|
||||
* getVorlagetextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template.
|
||||
*
|
||||
* @param string $vorlage_kurzbz REQUIRED
|
||||
* @return array
|
||||
*/
|
||||
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));
|
||||
return $vorlage;
|
||||
}
|
||||
|
||||
/**
|
||||
* loadVorlagetext() - will load the best fitting Template.
|
||||
*
|
||||
* @param string $vorlage_kurzbz REQUIRED
|
||||
* @param string $oe_kurzbz OPTIONAL
|
||||
* @param string $orgform_kurzbz OPTIONAL
|
||||
* @param string $sprache OPTIONAL
|
||||
* @return array
|
||||
*/
|
||||
public function loadVorlagetext($vorlage_kurzbz, $oe_kurzbz = null, $orgform_kurzbz = null, $sprache = null)
|
||||
* @return array
|
||||
*/
|
||||
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));
|
||||
|
||||
if (empty($vorlage_kurzbz))
|
||||
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
||||
|
||||
// Try to search the template with the given vorlage_kurzbz and other parameters if present
|
||||
$queryParameters = array("vorlage_kurzbz" => $vorlage_kurzbz, "aktiv" => true);
|
||||
|
||||
@@ -120,7 +120,7 @@ class VorlageLib
|
||||
{
|
||||
// Builds where clause
|
||||
$where = $this->_where($vorlage_kurzbz, $orgform_kurzbz, $sprache);
|
||||
|
||||
|
||||
$vorlage = $this->ci->organisationseinheitlib->treeSearch(
|
||||
'public',
|
||||
'tbl_vorlagestudiengang',
|
||||
@@ -133,17 +133,17 @@ class VorlageLib
|
||||
);
|
||||
}
|
||||
|
||||
return $vorlage;
|
||||
}
|
||||
return $vorlage;
|
||||
}
|
||||
|
||||
/**
|
||||
* _where
|
||||
*/
|
||||
private function _where($vorlage_kurzbz, $orgform_kurzbz, $sprache)
|
||||
{
|
||||
/**
|
||||
* _where
|
||||
*/
|
||||
private function _where($vorlage_kurzbz, $orgform_kurzbz, $sprache)
|
||||
{
|
||||
// Builds where clause
|
||||
$where = "vorlage_kurzbz = ".$this->ci->VorlageModel->escape($vorlage_kurzbz);
|
||||
|
||||
|
||||
if (is_null($sprache))
|
||||
{
|
||||
$where .= " AND sprache IS NULL";
|
||||
@@ -152,60 +152,60 @@ class VorlageLib
|
||||
{
|
||||
$where .= " AND sprache = ".$this->ci->VorlageModel->escape($sprache);
|
||||
}
|
||||
|
||||
|
||||
$where .= " AND aktiv = true";
|
||||
|
||||
|
||||
return $where;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* insertVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
|
||||
*
|
||||
* @param string $vorlage_kurzbz REQUIRED
|
||||
* @return array
|
||||
*/
|
||||
public function insertVorlagetext($data)
|
||||
* insertVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
|
||||
*
|
||||
* @param string $vorlage_kurzbz REQUIRED
|
||||
* @return array
|
||||
*/
|
||||
public function insertVorlagetext($data)
|
||||
{
|
||||
$vorlagetext = $this->ci->VorlageStudiengangModel->insert($data);
|
||||
return $vorlagetext;
|
||||
}
|
||||
$vorlagetext = $this->ci->VorlageStudiengangModel->insert($data);
|
||||
return $vorlagetext;
|
||||
}
|
||||
|
||||
/**
|
||||
* loadVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
|
||||
*
|
||||
* @param string $vorlage_kurzbz REQUIRED
|
||||
* @return array
|
||||
*/
|
||||
public function getVorlagetextById($vorlagestudiengang_id)
|
||||
* loadVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
|
||||
*
|
||||
* @param string $vorlage_kurzbz REQUIRED
|
||||
* @return array
|
||||
*/
|
||||
public function getVorlagetextById($vorlagestudiengang_id)
|
||||
{
|
||||
$vorlagetext = $this->ci->VorlageStudiengangModel->load($vorlagestudiengang_id);
|
||||
return $vorlagetext;
|
||||
}
|
||||
$vorlagetext = $this->ci->VorlageStudiengangModel->load($vorlagestudiengang_id);
|
||||
return $vorlagetext;
|
||||
}
|
||||
|
||||
/**
|
||||
* saveVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
|
||||
*
|
||||
* @param string $vorlage_kurzbz REQUIRED
|
||||
* @return array
|
||||
*/
|
||||
public function updateVorlagetext($vorlagestudiengang_id, $data)
|
||||
* saveVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
|
||||
*
|
||||
* @param string $vorlage_kurzbz REQUIRED
|
||||
* @return array
|
||||
*/
|
||||
public function updateVorlagetext($vorlagestudiengang_id, $data)
|
||||
{
|
||||
$vorlagetext = $this->ci->VorlageStudiengangModel->update($vorlagestudiengang_id, $data);
|
||||
return $vorlagetext;
|
||||
}
|
||||
$vorlagetext = $this->ci->VorlageStudiengangModel->update($vorlagestudiengang_id, $data);
|
||||
return $vorlagetext;
|
||||
}
|
||||
|
||||
/**
|
||||
* parseVorlagetext() - will parse a Vorlagetext.
|
||||
*
|
||||
* @param string $text REQUIRED
|
||||
* @param array $data REQUIRED
|
||||
* @return string
|
||||
*/
|
||||
public function parseVorlagetext($text, $data = array())
|
||||
* parseVorlagetext() - will parse a Vorlagetext.
|
||||
*
|
||||
* @param string $text REQUIRED
|
||||
* @param array $data REQUIRED
|
||||
* @return string
|
||||
*/
|
||||
public function parseVorlagetext($text, $data = array())
|
||||
{
|
||||
if (empty($text))
|
||||
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
||||
if (empty($text))
|
||||
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
||||
$text = $this->ci->parser->parse_string($text, $data, true);
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user