Bugfixes to allow to write to a person or to a prestudent from different GUIs

This commit is contained in:
Paolo
2020-02-12 14:43:11 +01:00
parent 98b2abeb51
commit 6882199d0e
8 changed files with 62 additions and 54 deletions
@@ -56,18 +56,18 @@ class Messages extends Auth_Controller
{
$subject = $this->input->post('subject');
$body = $this->input->post('body');
$persons = $this->input->post('persons');
$prestudenten = $this->input->post('prestudenten');
$recipients_ids = $this->input->post('recipients_ids');
$relationmessage_id = $this->input->post('relationmessage_id');
$type = $this->input->post('type');
$sendImplicitTemplate = $this->CLMessagesModel->sendImplicitTemplate($prestudenten, $subject, $body, $relationmessage_id);
$sendImplicitTemplate = $this->CLMessagesModel->sendImplicitTemplate($type, $recipients_ids, $subject, $body, $relationmessage_id);
if (isSuccess($sendImplicitTemplate))
{
$this->load->view('system/messages/htmlSuccess');
$this->load->view('system/messages/htmlMessageSentSuccess');
}
else
{
$this->load->view('system/messages/htmlError');
$this->load->view('system/messages/htmlMessageSentError');
}
}
@@ -92,17 +92,21 @@ class Messages extends Auth_Controller
*/
public function parseMessageText()
{
$person_id = $this->input->get('person_id');
$prestudent_id = $this->input->get('prestudent_id');
$receiver_id = $this->input->get('receiver_id');
$text = $this->input->get('text');
$type = $this->input->get('type');
if (!isEmptyString($person_id))
if ($type == Messages_model::TYPE_PERSONS)
{
$this->outputJson($this->CLMessagesModel->parseMessageText($person_id, $text));
$this->outputJson($this->CLMessagesModel->parseMessageTextPerson($receiver_id, $text));
}
elseif ($type == Messages_model::TYPE_PRESTUDENTS)
{
$this->outputJson($this->CLMessagesModel->parseMessageTextPrestudent($receiver_id, $text));
}
else
{
$this->outputJson($this->CLMessagesModel->parseMessageTextPrestudent($prestudent_id, $text));
$this->outputJsonError('Not a person nor a prestudent was provided');
}
}
@@ -73,11 +73,11 @@ class ViewMessage extends FHC_Controller
$sendReply = $this->CLMessagesModel->sendReply($receiver_id, $subject, $body, $relationmessage_id, $token);
if (isSuccess($sendReply))
{
$this->load->view('system/messages/htmlSuccess');
$this->load->view('system/messages/htmlMessageSentSuccess');
}
else
{
$this->load->view('system/messages/htmlError');
$this->load->view('system/messages/htmlMessageSentError');
}
}