diff --git a/application/controllers/system/messages/MessageClient.php b/application/controllers/system/messages/MessageClient.php index a0cc5c518..5adb49296 100644 --- a/application/controllers/system/messages/MessageClient.php +++ b/application/controllers/system/messages/MessageClient.php @@ -34,7 +34,7 @@ class MessageClient extends FHC_Controller public function read() { // Loads the view to read messages - $this->load->view('system/messages/ajaxRead'); + $this->load->view('system/messages/ajaxRead', $this->CLMessagesModel->prepareAjaxRead()); } /** diff --git a/application/models/CL/Messages_model.php b/application/models/CL/Messages_model.php index cbb42543f..dc4f4382c 100644 --- a/application/models/CL/Messages_model.php +++ b/application/models/CL/Messages_model.php @@ -91,6 +91,23 @@ class Messages_model extends CI_Model } } + /** + * Prepares data for the view system/messages/ajaxRead + */ + public function prepareAjaxRead() + { + $psResult = $this->PrestudentModel->loadWhere(array('person_id' => getAuthPersonId())); + + if (isError($psResult)) show_error('An error occurred while loading this page, please contact the site administrator'); + + if (hasData($psResult)) + { + return array('writeButton' => ''); + } + + return array('writeButton' => ''); + } + /** * Prepares data for the view system/messages/ajaxWrite */ diff --git a/application/views/system/messages/ajaxRead.php b/application/views/system/messages/ajaxRead.php index 1ed1b7f40..f7d60a68d 100644 --- a/application/views/system/messages/ajaxRead.php +++ b/application/views/system/messages/ajaxRead.php @@ -44,7 +44,7 @@ - +