This commit is contained in:
Paminger
2016-06-28 12:34:12 +02:00
parent 5e4090e0ce
commit e21b2f6233
12 changed files with 409 additions and 90 deletions
+2 -81
View File
@@ -293,86 +293,7 @@ class MessageLib
// ------------------------------------------------------------------------
/**
* reply_to_message() - replies to internal message. This function will NOT create a new thread or participant list
*
* @param integer $msg_id REQUIRED
* @param integer $sender_id REQUIRED
* @param string $subject
* @param string $body
* @param integer $priority
* @return array
*/
function reply_to_message($msg_id, $sender_id, $subject = '', $body = '', $priority = PRIORITY_NORMAL)
{
if (empty($sender_id))
{
return $this->_invalid_id(MSG_ERR_INVALID_SENDER_ID);
}
if (empty($msg_id))
{
return $this->_invalid_id(MSG_ERR_INVALID_MSG_ID);
}
if ($new_msg_id = $this->ci->message_model->reply_to_message($msg_id, $sender_id, $body, $priority))
{
return $this->_success($new_msg_id, MSG_MESSAGE_SENT);
}
// General Error Occurred
return $this->_general_error();
}
// ------------------------------------------------------------------------
/**
* get_participant_list() - returns list of participants on given thread. If sender_id set, sender_id will be left off list
*
* @param integer $thread_id REQUIRED
* @param integer $sender_id REQUIRED
* @return array
*/
function get_participant_list($thread_id, $sender_id = 0)
{
if (empty($thread_id))
{
return $this->_invalid_id(MSG_ERR_INVALID_THREAD_ID);
}
if ($participants = $this->ci->message_model-> get_participant_list($thread_id, $sender_id))
{
return $this->_success($participants);
}
// General Error Occurred
return $this->_general_error();
}
// ------------------------------------------------------------------------
/**
* get_msg_count() - returns integer with count of message for user, by status. defaults to new messages
*
* @param integer $user_id REQUIRED
* @param integer $status_id OPTIONAL - defaults to "Unread"
* @return array
*/
function get_msg_count($user_id, $status_id = MSG_STATUS_UNREAD)
{
if (empty($user_id))
{
return $this->_invalid_id(MSG_ERR_INVALID_USER_ID);
}
if (is_numeric($message = $this->ci->message_model->get_msg_count($user_id, $status_id)))
{
return $this->_success($message);
}
// General Error Occurred
return $this->_general_error();
}
// ------------------------------------------------------------------------
// Private Functions from here out!
@@ -422,4 +343,4 @@ class MessageLib
'msg' => lang('message_'.$error)
);
}
}
}