diff --git a/application/config/autoload.php b/application/config/autoload.php index 43aaa1598..4d2676de3 100755 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -86,7 +86,7 @@ $autoload['drivers'] = array(); | $autoload['helper'] = array('url', 'file'); */ //$autoload['helper'] = array(); -$autoload['helper'] = array('url'); +$autoload['helper'] = array('url', 'language'); /* | ------------------------------------------------------------------- diff --git a/application/config/constants.php b/application/config/constants.php index e1593c799..ccb30cf7d 100755 --- a/application/config/constants.php +++ b/application/config/constants.php @@ -67,6 +67,7 @@ define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b'); */ define('SHOW_DEBUG_BACKTRACE', TRUE); + /* |-------------------------------------------------------------------------- | Exit Status Codes diff --git a/application/config/message.php b/application/config/message.php index af32595b1..c4782ac7e 100644 --- a/application/config/message.php +++ b/application/config/message.php @@ -1,16 +1,24 @@ -load->view('test.php'); + } +} diff --git a/application/controllers/system/Messages.php b/application/controllers/system/Messages.php index c61fd5e75..ba3c79aee 100755 --- a/application/controllers/system/Messages.php +++ b/application/controllers/system/Messages.php @@ -12,18 +12,20 @@ class Messages extends VileSci_Controller //$this->load->model('system/Message_model'); } - public function index() + public function index($person_id = null) { - $this->load->view('system/messages.php'); + $data = array('person_id' => $person_id); + $this->load->view('system/messages.php', $data); } - public function table() + public function table($person_id = null) { - $person_id = $this->input->post('person_id', TRUE); - if ($person_id) - $msg = $this->messagelib->getMessagesByPerson($person_id); - else + if (empty($person_id)) + $person_id = $this->input->post('person_id', TRUE); + if (empty($person_id)) $msg = $this->messagelib->getMessagesByUID($this->getUID()); + else + $msg = $this->messagelib->getMessagesByPerson($person_id); if ($msg->error) show_error($msg->retval); @@ -31,7 +33,7 @@ class Messages extends VileSci_Controller ( 'messages' => $msg->retval ); - var_dump ($data); + //var_dump ($data); $this->load->view('system/messagesList.php', $data); } diff --git a/application/core/VileSci_Controller.php b/application/core/VileSci_Controller.php new file mode 100644 index 000000000..f3dcd1aee --- /dev/null +++ b/application/core/VileSci_Controller.php @@ -0,0 +1,13 @@ +getUID() && strncmp(uri_string(), 'system/Login', 11) !== 0) + redirect(site_url('system/Login/'.uri_string()));*/ + } + +} diff --git a/application/language/de-AT/message_lang.php b/application/language/de-AT/message_lang.php index 62b2b31f7..0f13225b9 100644 --- a/application/language/de-AT/message_lang.php +++ b/application/language/de-AT/message_lang.php @@ -3,17 +3,17 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); // Account Creation -$lang['message_'.MSG_SUCCESS] = 'Success'; -$lang['message_'.MSG_ERR_GENERAL] = 'Error'; -$lang['message_'.MSG_ERR_INVALID_USER_ID] = 'No user id specified'; -$lang['message_'.MSG_ERR_INVALID_MSG_ID] = 'No message id specified'; -$lang['message_'.MSG_ERR_INVALID_THREAD_ID] = 'No message thread id specified'; -$lang['message_'.MSG_ERR_INVALID_STATUS_ID] = 'No status specified'; -$lang['message_'.MSG_ERR_INVALID_SENDER_ID] = 'Not a valid sender'; -$lang['message_'.MSG_ERR_INVALID_RECIPIENTS] = 'No valid recipients'; -$lang['message_'.MSG_MESSAGE_SENT] = 'Message sent'; -$lang['message_'.MSG_STATUS_UPDATE] = 'Status updated'; -$lang['message_'.MSG_PARTICIPANT_ADDED] = 'Participant added'; -$lang['message_'.MSG_ERR_PARTICIPANT_EXISTS] = 'User is already participating in this thread'; -$lang['message_'.MSG_ERR_PARTICIPANT_NONSYSTEM] = 'This user id is not in the system'; -$lang['message_'.MSG_PARTICIPANT_REMOVED] = 'Participant removed from thread'; +$lang['message_'.MSG_SUCCESS] = 'Success'; +$lang['message_'.MSG_ERROR] = 'Error'; +$lang['message_'.MSG_ERR_INVALID_USER_ID] = 'No user id specified'; +$lang['message_'.MSG_ERR_INVALID_MSG_ID] = 'No message id specified'; +$lang['message_'.MSG_ERR_INVALID_THREAD_ID] = 'No message thread id specified'; +$lang['message_'.MSG_ERR_INVALID_STATUS_ID] = 'No status specified'; +$lang['message_'.MSG_ERR_INVALID_SENDER_ID] = 'Not a valid sender'; +$lang['message_'.MSG_ERR_INVALID_RECIPIENTS] = 'No valid recipients'; +$lang['message_'.MSG_MESSAGE_SENT] = 'Message sent'; +$lang['message_'.MSG_STATUS_UPDATE] = 'Status updated'; +$lang['message_'.MSG_PARTICIPANT_ADDED] = 'Participant added'; +$lang['message_'.MSG_ERR_PARTICIPANT_EXISTS] = 'User is already participating in this thread'; +$lang['message_'.MSG_ERR_PARTICIPANT_NONSYSTEM] = 'This user id is not in the system'; +$lang['message_'.MSG_PARTICIPANT_REMOVED] = 'Participant removed from thread'; diff --git a/application/language/en-US/message_lang.php b/application/language/en-US/message_lang.php index 09b776986..a59c19943 100644 --- a/application/language/en-US/message_lang.php +++ b/application/language/en-US/message_lang.php @@ -3,17 +3,17 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); // Account Creation -$lang['message_'.MSG_SUCCESS] = 'Success'; -$lang['message_'.MSG_ERR_GENERAL] = 'Error'; -$lang['message_'.MSG_ERR_INVALID_USER_ID] = 'No user id specified'; -$lang['message_'.MSG_ERR_INVALID_MSG_ID] = 'No message id specified'; -$lang['message_'.MSG_ERR_INVALID_THREAD_ID] = 'No message thread id specified'; -$lang['message_'.MSG_ERR_INVALID_STATUS_ID] = 'No status specified'; -$lang['message_'.MSG_ERR_INVALID_SENDER_ID] = 'Not a valid sender'; -$lang['message_'.MSG_ERR_INVALID_RECIPIENTS] = 'No valid recipients'; -$lang['message_'.MSG_MESSAGE_SENT] = 'Message sent'; -$lang['message_'.MSG_STATUS_UPDATE] = 'Status updated'; -$lang['message_'.MSG_PARTICIPANT_ADDED] = 'Participant added'; -$lang['message_'.MSG_ERR_PARTICIPANT_EXISTS] = 'User is already participating in this thread'; -$lang['message_'.MSG_ERR_PARTICIPANT_NONSYSTEM] = 'This user id is not in the system'; -$lang['message_'.MSG_PARTICIPANT_REMOVED] = 'Participant removed from thread'; +$lang['message_'.MSG_SUCCESS] = 'Success'; +$lang['message_'.MSG_ERRORR] = 'Error'; +$lang['message_'.MSG_ERR_INVALID_USER_ID] = 'No user id specified'; +$lang['message_'.MSG_ERR_INVALID_MSG_ID] = 'No message id specified'; +$lang['message_'.MSG_ERR_INVALID_THREAD_ID] = 'No message thread id specified'; +$lang['message_'.MSG_ERR_INVALID_STATUS_ID] = 'No status specified'; +$lang['message_'.MSG_ERR_INVALID_SENDER_ID] = 'Not a valid sender'; +$lang['message_'.MSG_ERR_INVALID_RECIPIENTS] = 'No valid recipients'; +$lang['message_'.MSG_MESSAGE_SENT] = 'Message sent'; +$lang['message_'.MSG_STATUS_UPDATE] = 'Status updated'; +$lang['message_'.MSG_PARTICIPANT_ADDED] = 'Participant added'; +$lang['message_'.MSG_ERR_PARTICIPANT_EXISTS] = 'User is already participating in this thread'; +$lang['message_'.MSG_ERR_PARTICIPANT_NONSYSTEM] = 'This user id is not in the system'; +$lang['message_'.MSG_PARTICIPANT_REMOVED] = 'Participant removed from thread'; diff --git a/application/libraries/MessageLib.php b/application/libraries/MessageLib.php index 2bb04ff2f..185e068a3 100644 --- a/application/libraries/MessageLib.php +++ b/application/libraries/MessageLib.php @@ -13,15 +13,15 @@ class MessageLib public function __construct() { - require_once APPPATH.'config/message.php'; + $this->ci =& get_instance(); + $this->ci->config->load('message'); - $this->ci =& get_instance(); //$this->ci->load->model('person/Person_model', 'PersonModel'); $this->ci->load->model('system/Message_model', 'MessageModel'); $this->ci->load->model('system/MsgStatus_model', 'MsgStatusModel'); $this->ci->load->model('system/Recipient_model', 'RecipientModel'); $this->ci->load->model('system/Attachment_model', 'AttachmentModel'); - $this->ci->load->helper('language'); + //$this->ci->load->helper('language'); $this->ci->lang->load('message'); } @@ -318,7 +318,7 @@ class MessageLib * * @return array */ - protected function _error($retval = '', $message = MSG_ERROR_GENERAL) + protected function _error($retval = '', $message = MSG_ERROR) { $return = new stdClass(); $return->error = EXIT_ERROR; diff --git a/application/models/system/Message_model.php b/application/models/system/Message_model.php index 4412c4078..f7128ad29 100644 --- a/application/models/system/Message_model.php +++ b/application/models/system/Message_model.php @@ -39,7 +39,7 @@ status, statusinfo, s.insertamum AS statusamum FROM public.tbl_msg_message m JOIN public.tbl_person USING (person_id) JOIN public.tbl_benutzer USING (person_id) -LEFT JOIN +LEFT OUTER JOIN ( SELECT message_id, person_id, status, statusinfo, tbl_msg_status.insertamum FROM public.tbl_msg_status @@ -55,7 +55,7 @@ LEFT JOIN USING (message_id, person_id) WHERE uid = ?'; if (! $all) - $sql .= ' AND status<2'; + $sql .= ' AND (status<3 OR status IS NULL)'; $result = $this->db->query($sql, array($uid)); if (is_object($result)) return $this->_success($result->result()); @@ -67,14 +67,16 @@ public function getMessagesByPerson($person_id, $all) { // Check wrights if (! $this->fhc_db_acl->isBerechtigt('basis/message', 's')) - return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> system/message', FHC_MODEL_ERROR); + return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> basis/message', FHC_MODEL_ERROR); + // prepare parameters + $person_id = (int)$person_id; // get Data $sql = 'SELECT person_id, message_id, subject, priority, relationmessage_id, oe_kurzbz, m.insertamum, anrede, titelpost, titelpre, nachname, vorname, vornamen, status, statusinfo, s.insertamum AS statusamum FROM public.tbl_msg_message m JOIN public.tbl_person USING (person_id) -LEFT JOIN +LEFT OUTER JOIN ( SELECT message_id, person_id, status, statusinfo, tbl_msg_status.insertamum FROM public.tbl_msg_status @@ -90,9 +92,9 @@ LEFT JOIN USING (message_id, person_id) WHERE person_id = ?'; if (! $all) - $sql .= ' AND status<2'; + $sql .= ' AND (status<3 OR status IS NULL)'; $result = $this->db->query($sql, array($person_id)); - var_dump($result); + //var_dump($result); if (is_object($result)) return $this->_success($result->result()); else diff --git a/application/views/system/messages.php b/application/views/system/messages.php index dd194c9f9..4b583edb4 100644 --- a/application/views/system/messages.php +++ b/application/views/system/messages.php @@ -7,7 +7,7 @@ - + <body bgcolor="#FFFFFF"> diff --git a/application/views/system/messagesList.php b/application/views/system/messagesList.php index 035e2b309..f9343af83 100644 --- a/application/views/system/messagesList.php +++ b/application/views/system/messagesList.php @@ -12,19 +12,28 @@ Person <table id="t1" class="tablesorter"> <thead> - <tr><th class='table-sortable:default'>Vorlage</th> - <th class='table-sortable:default'>Bezeichnung</th> - <th>Anmerkung</th><th>MimeType</th> + <tr><th>MessageID</th> + <th class='table-sortable:default'>Sender</th> + <th>Erstellt</th> + <th>Priorität</th> + <th>Status</th> + <th>StatusInfo</th> + <th>OE</th> + <th>Relation</th> <th></th> </tr> </thead> <tbody> - <?php foreach ($vorlage as $v): ?> - <tr><td><a href="edit/<?php echo $v->vorlage_kurzbz; ?>" target="MessagesBottom"><?php echo $v->vorlage_kurzbz; ?></a></td> - <td><?php echo $v->bezeichnung; ?></td> - <td><?php echo $v->anmerkung; ?></td> - <td><?php echo $v->mimetype; ?></td> - <td><a href="view/<?php echo $v->vorlage_kurzbz; ?>">View</a></td> + <?php foreach ($messages as $m): ?> + <tr><td><a href="view/<?php echo $m->message_id; ?>" target="MessagesBottom"><?php echo $m->message_id; ?></a></td> + <td><?php echo $m->titelpost.' '.$m->vorname.' '.$m->nachname.' '.$m->titelpre; ?></td> + <td><?php echo $m->insertamum; ?></td> + <td><?php echo $m->priority; ?></td> + <td><?php echo $m->status; ?></td> + <td><?php echo $m->statusinfo; ?></td> + <td><?php echo $m->oe_kurzbz; ?></td> + <td><?php echo $m->relationmessage_id; ?></td> + <td><a href="view/<?php echo $m->message_id; ?>">View</a></td> </tr> <?php endforeach ?> </tbody>