diff --git a/application/controllers/system/Messages.php b/application/controllers/system/Messages.php index 744eb880e..a7709a702 100644 --- a/application/controllers/system/Messages.php +++ b/application/controllers/system/Messages.php @@ -96,36 +96,7 @@ class Messages extends Auth_Controller } // ----------------------------------------------------------------------------------------------------------------- - // Public methods - JSON output - - /** - * Send a new message - * - The recipients are prestudents - * - An email template with message var may be provided - * - A global organisation unit may be provided, otherwise is used the prestudent one - */ - public function sendJson() - { - $prestudents = $this->input->post('prestudents'); - $vorlage_kurzbz = $this->input->post('vorlage_kurzbz'); - $oe_kurzbz = $this->input->post('oe_kurzbz'); - $msgVars = $this->input->post('msgvars'); - - $msgVarsData = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudents); - - $this->load->model('crm/Prestudent_model', 'PrestudentModel'); - $prestudentsData = $this->PrestudentModel->getOrganisationunits($prestudents); - - // Adds the organisation unit to each prestudent - if (isEmptyString($oe_kurzbz) && hasData($msgVarsData) && hasData($prestudentsData)) - { - $this->CLMessagesModel->addOeToPrestudents($msgVarsData, $prestudentsData); - } - - $send = $this->CLMessagesModel->send($msgVarsData, null, $oe_kurzbz, $vorlage_kurzbz, $msgVars); - - $this->outputJson(getData($send)); - } + // Public methods - JSON output - called by this controller and FASMessages (view system/messages/messageWrite) /** * Returns an object that represent a template store in database @@ -185,6 +156,9 @@ class Messages extends Auth_Controller } } + // ----------------------------------------------------------------------------------------------------------------- + // Public methods - JSON output - called by infocenter + /** * Outputs message data for a message (identified my msg id and receiver id) in JSON format */ @@ -204,4 +178,33 @@ class Messages extends Auth_Controller $this->outputJson(array(getData($msg)[0])); } } + + /** + * Send a new message + * - The recipients are prestudents + * - An email template with message var may be provided + * - A global organisation unit may be provided, otherwise is used the prestudent one + */ + public function sendJson() + { + $prestudents = $this->input->post('prestudents'); + $vorlage_kurzbz = $this->input->post('vorlage_kurzbz'); + $oe_kurzbz = $this->input->post('oe_kurzbz'); + $msgVars = $this->input->post('msgvars'); + + $msgVarsData = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudents); + + $this->load->model('crm/Prestudent_model', 'PrestudentModel'); + $prestudentsData = $this->PrestudentModel->getOrganisationunits($prestudents); + + // Adds the organisation unit to each prestudent + if (isEmptyString($oe_kurzbz) && hasData($msgVarsData) && hasData($prestudentsData)) + { + $this->CLMessagesModel->addOeToPrestudents($msgVarsData, $prestudentsData); + } + + $send = $this->CLMessagesModel->send($msgVarsData, null, $oe_kurzbz, $vorlage_kurzbz, $msgVars); + + $this->outputJson(getData($send)); + } } diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index d59c058cf..b83d6e48b 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -646,7 +646,7 @@ class InfoCenter extends Auth_Controller public function reloadMessages($person_id) { $messages = $this->MessageModel->getMessagesOfPerson($person_id, 1); - $this->load->view('system/messages/messageList.php', array('messages' => $messages->retval)); + $this->load->view('system/infocenter/messageList.php', array('messages' => $messages->retval)); } /** diff --git a/application/views/system/infocenter/infocenterDetails.php b/application/views/system/infocenter/infocenterDetails.php index 9e708d076..86493134c 100644 --- a/application/views/system/infocenter/infocenterDetails.php +++ b/application/views/system/infocenter/infocenterDetails.php @@ -22,7 +22,7 @@ 'customJSs' => array( 'public/js/bootstrapper.js', 'public/js/tablesort/tablesort.js', - 'public/js/messaging/messageList.js', + 'public/js/infocenter/messageList.js', 'public/js/infocenter/infocenterDetails.js' ), 'phrases' => array( @@ -147,7 +147,7 @@
load->view('system/messages/messageList.php', $messages); + $this->load->view('system/infocenter/messageList.php', $messages); ?>
diff --git a/application/views/system/messages/messageList.php b/application/views/system/infocenter/messageList.php similarity index 100% rename from application/views/system/messages/messageList.php rename to application/views/system/infocenter/messageList.php diff --git a/public/js/messaging/messageList.js b/public/js/infocenter/messageList.js similarity index 100% rename from public/js/messaging/messageList.js rename to public/js/infocenter/messageList.js