diff --git a/application/controllers/api/v1/system/Message.php b/application/controllers/api/v1/system/Message.php index 32f888eee..365499894 100644 --- a/application/controllers/api/v1/system/Message.php +++ b/application/controllers/api/v1/system/Message.php @@ -12,7 +12,7 @@ */ // ------------------------------------------------------------------------ -if (!defined('BASEPATH')) exit('No direct script access allowed'); +if (!defined("BASEPATH")) exit("No direct script access allowed"); class Message extends APIv1_Controller { @@ -23,7 +23,7 @@ class Message extends APIv1_Controller { parent::__construct(); // Load library MessageLib - $this->load->library('MessageLib'); + $this->load->library("MessageLib"); } /** @@ -31,8 +31,8 @@ class Message extends APIv1_Controller */ public function getMessagesByPersonID() { - $person_id = $this->get('person_id'); - $all = $this->get('all'); + $person_id = $this->get("person_id"); + $all = $this->get("all"); if (isset($person_id)) { @@ -51,8 +51,8 @@ class Message extends APIv1_Controller */ public function getMessagesByUID() { - $uid = $this->get('uid'); - $all = $this->get('all'); + $uid = $this->get("uid"); + $all = $this->get("all"); if (isset($uid)) { @@ -71,7 +71,7 @@ class Message extends APIv1_Controller */ public function getMessagesByToken() { - $token = $this->get('token'); + $token = $this->get("token"); if (isset($token)) { @@ -85,6 +85,23 @@ class Message extends APIv1_Controller } } + /** + * @return void + */ + public function getRedirectByToken() + { + $token = $this->get("token"); + + if (isset($token)) + { + redirect(CIS_ROOT); + } + else + { + $this->response(); + } + } + /** * @return void */ @@ -95,13 +112,13 @@ class Message extends APIv1_Controller if (is_object($validation) && $validation->error == EXIT_SUCCESS) { $result = $this->messagelib->sendMessage( - $this->post()['person_id'], - $this->post()['receiver_id'], - $this->post()['subject'], - $this->post()['body'], + $this->post()["person_id"], + $this->post()["receiver_id"], + $this->post()["subject"], + $this->post()["body"], PRIORITY_NORMAL, - $this->post()['relationmessage_id'], - $this->post()['oe_kurzbz'] + $this->post()["relationmessage_id"], + $this->post()["oe_kurzbz"] ); $this->response($result, REST_Controller::HTTP_OK); @@ -122,13 +139,13 @@ class Message extends APIv1_Controller if (is_object($validation) && $validation->error == EXIT_SUCCESS) { $result = $this->messagelib->sendMessageVorlage( - $this->post()['sender_id'], - $this->post()['receiver_id'], - $this->post()['vorlage_kurzbz'], - $this->post()['oe_kurzbz'], - $this->post()['data'], - isset($this->post()['relationmessage_id']) ? $this->post()['relationmessage_id'] : null, - isset($this->post()['orgform_kurzbz']) ? $this->post()['orgform_kurzbz'] : null + $this->post()["sender_id"], + $this->post()["receiver_id"], + $this->post()["vorlage_kurzbz"], + $this->post()["oe_kurzbz"], + $this->post()["data"], + isset($this->post()["relationmessage_id"]) ? $this->post()["relationmessage_id"] : null, + isset($this->post()["orgform_kurzbz"]) ? $this->post()["orgform_kurzbz"] : null ); $this->response($result, REST_Controller::HTTP_OK); @@ -144,9 +161,9 @@ class Message extends APIv1_Controller */ public function postChangeStatus() { - $person_id = $this->post()['person_id']; - $message_id = $this->post()['message_id']; - $status = $this->post()['status']; + $person_id = $this->post()["person_id"]; + $message_id = $this->post()["message_id"]; + $status = $this->post()["status"]; if (isset($person_id) && isset($message_id) && isset($status) && in_array($status, array(MSG_STATUS_UNREAD, MSG_STATUS_READ, MSG_STATUS_ARCHIVED, MSG_STATUS_DELETED))) @@ -165,55 +182,55 @@ class Message extends APIv1_Controller { if (!isset($message)) { - return $this->_error('Parameter is null'); + return $this->_error("Parameter is null"); } - if (!isset($message['person_id'])) + if (!isset($message["person_id"])) { - return $this->_error('person_id is not set'); + return $this->_error("person_id is not set"); } - if (!isset($message['subject'])) + if (!isset($message["subject"])) { - return $this->_error('subject is not set'); + return $this->_error("subject is not set"); } - if( !isset($message['body'])) + if( !isset($message["body"])) { - return $this->_error('body is not set'); + return $this->_error("body is not set"); } - if (!isset($message['oe_kurzbz'])) + if (!isset($message["oe_kurzbz"])) { - return $this->_error('oe_kurzbz is not set'); + return $this->_error("oe_kurzbz is not set"); } - return $this->_success('Input data are valid'); + return $this->_success("Input data are valid"); } private function _validatePostMessageVorlage($message = null) { if (!isset($message)) { - return $this->_error('Parameter is null'); + return $this->_error("Parameter is null"); } - if (!isset($message['sender_id'])) + if (!isset($message["sender_id"])) { - return $this->_error('person_id of sender is not set'); + return $this->_error("person_id of sender is not set"); } - if (!isset($message['receiver_id'])) + if (!isset($message["receiver_id"])) { - return $this->_error('person_id of receiver is not set'); + return $this->_error("person_id of receiver is not set"); } - if (!isset($message['vorlage_kurzbz'])) + if (!isset($message["vorlage_kurzbz"])) { - return $this->_error('vorlage_kurzbz is not set'); + return $this->_error("vorlage_kurzbz is not set"); } - if( !isset($message['oe_kurzbz'])) + if( !isset($message["oe_kurzbz"])) { - return $this->_error('oe_kurzbz is not set'); + return $this->_error("oe_kurzbz is not set"); } - if (!isset($message['data'])) + if (!isset($message["data"])) { - return $this->_error('data is not set'); + return $this->_error("data is not set"); } - return $this->_success('Input data are valid'); + return $this->_success("Input data are valid"); } } diff --git a/application/controllers/system/Messages.php b/application/controllers/system/Messages.php index 9a356a707..80f846786 100755 --- a/application/controllers/system/Messages.php +++ b/application/controllers/system/Messages.php @@ -161,4 +161,19 @@ class Messages extends VileSci_Controller return $person_id; } + + public function getVorlage() + { + $vorlage_kurzbz = $this->input->get("vorlage_kurzbz"); + + if (isset($vorlage_kurzbz)) + { + $this->load->model("system/Vorlagestudiengang_model", "VorlagestudiengangModel"); + $result = $this->VorlagestudiengangModel->loadWhere(array("vorlage_kurzbz" => $vorlage_kurzbz)); + + $this->output + ->set_content_type('application/json') + ->set_output(json_encode($result)); + } + } } diff --git a/application/views/system/messageReply.php b/application/views/system/messageReply.php index 253d3f4da..6f57cc7ca 100644 --- a/application/views/system/messageReply.php +++ b/application/views/system/messageReply.php @@ -1,28 +1,52 @@ -load->view('templates/header'); ?> - - +load->view("templates/header", array("title" => "MessageReply", "jquery" => true, "tinymce" => true)); ?> -
-
- -
-
- To: uid . " " . $message->vorname . " " . $message->nachname . " " . $message->kontakt; ?>
- Subject:
- -
- -
+ +
+ +
+
+ To: uid . " " . $message->vorname . " " . $message->nachname . " " . $message->kontakt; ?>
+ Subject:
+ +
-
- - + +
+
+ +            + templatelib->widget("Vorlage_widget", array("title" => "Vorlage")); ?> +
+
+ + + + diff --git a/application/views/system/messageWrite.php b/application/views/system/messageWrite.php index 961d6ed78..f0d22070a 100644 --- a/application/views/system/messageWrite.php +++ b/application/views/system/messageWrite.php @@ -1,28 +1,52 @@ -load->view('templates/header'); ?> - - +load->view("templates/header", array("title" => "MessageReply", "jquery" => true, "tinymce" => true)); ?> -
-
- -
-
- To: vorname . " " . $receiver->nachname; ?>
- Subject:
- -
- -
+ +
+ +
+
+ To: vorname . " " . $receiver->nachname; ?>
+ Subject:
+ +
-
- - + +
+
+ +            + templatelib->widget("Vorlage_widget", array("title" => "Vorlage")); ?> +
+
+ + + + diff --git a/application/views/widgets/vorlage.php b/application/views/widgets/vorlage.php new file mode 100644 index 000000000..a1d503578 --- /dev/null +++ b/application/views/widgets/vorlage.php @@ -0,0 +1,7 @@ + diff --git a/application/widgets/vorlage_widget.php b/application/widgets/vorlage_widget.php new file mode 100644 index 000000000..c25bc7e67 --- /dev/null +++ b/application/widgets/vorlage_widget.php @@ -0,0 +1,17 @@ +load->model("system/Vorlage_model", "VorlageModel"); + $this->VorlageModel->addOrder("vorlage_kurzbz"); + $result = $this->VorlageModel->load(); + + if (is_object($result) && $result->error == EXIT_SUCCESS) + { + $data = array("vorlage" => $result->retval); + $this->view("widgets/vorlage", $data); + } + } +}