Files
FHC-Core/application/controllers/system/messages/MessageClient.php
T
Paolo 34dc82766a - Renamed public/js/messaging/messageClient.js to public/js/messaging/read.js
- Added new JS public/js/messaging/write.js used in view application/views/system/messages/ajaxWrite.php
- Added new public method write, listReceivedMessages, listSentMessages and sendMessageToOU to controller system/messages/MessageClient.php
- Removed private method _getReceiversByOekurzbz from MessageLib
- Fixed method sendMessageOU of MessageLib
- Added new public method prepareAjaxWrite to model CL/Messages_model
- Fixed method prepareAjaxReadReceived of model CL/Messages_model
- Added new public method prepareAjaxReadSent to model CL/Messages_model
- Changed method CL/Messages_model->_personLog interface
- Added new public method getOrganisationunitsByPersonId to crm/Prestudent_model
- Added new public method getReceivedMessages to model system/Recipient_model
- Changed getReceivedMessages method of model system/Recipient_model
- Changed view system/messages/ajaxRead.php
- Added new view system/messages/ajaxWrite.php
2019-06-28 19:01:25 +02:00

69 lines
1.7 KiB
PHP

<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
class MessageClient extends Auth_Controller
{
public function __construct()
{
parent::__construct(
array(
'read' => array('basis/person:r'),
'write' => array('basis/person:r'),
'listReceivedMessages' => array('basis/person:r'),
'listSentMessages' => array('basis/person:r'),
'sendMessageToOU' => array('basis/person:r')
)
);
// Loads model CLMessagesModel which contains the GUI logic
$this->load->model('CL/Messages_model', 'CLMessagesModel');
}
/**
* Starts the GUI used to read all the personal messages
*/
public function read()
{
// Loads the view to read messages
$this->load->view('system/messages/ajaxRead');
}
/**
* Starts the GUI used to write a personal message to an organisation unit
*/
public function write()
{
// Loads the view to write a message
$this->load->view('system/messages/ajaxWrite', $this->CLMessagesModel->prepareAjaxWrite());
}
/**
* Returns JSON that that contains all the received messages by the currently logged user
*/
public function listReceivedMessages()
{
$this->outputJson($this->CLMessagesModel->prepareAjaxReadReceived());
}
/**
* Returns JSON that that contains all the sent messages by the currently logged user
*/
public function listSentMessages()
{
$this->outputJson($this->CLMessagesModel->prepareAjaxReadSent());
}
/**
*
*/
public function sendMessageToOU()
{
$receiverOU = $this->input->post('receiverOU');
$subject = $this->input->post('subject');
$body = $this->input->post('body');
$this->outputJson($this->CLMessagesModel->sendToOrganisationUnit($receiverOU, $subject, $body));
}
}