mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-26 00:54:27 +00:00
Messages
This commit is contained in:
@@ -86,7 +86,7 @@ $autoload['drivers'] = array();
|
||||
| $autoload['helper'] = array('url', 'file');
|
||||
*/
|
||||
//$autoload['helper'] = array();
|
||||
$autoload['helper'] = array('url');
|
||||
$autoload['helper'] = array('url', 'language');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
|
||||
@@ -67,6 +67,7 @@ define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
|
||||
*/
|
||||
define('SHOW_DEBUG_BACKTRACE', TRUE);
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Exit Status Codes
|
||||
|
||||
@@ -1,16 +1,24 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
// application's Users table - define your user table and columns here
|
||||
|
||||
define('USER_TABLE_TABLENAME', 'tbl_person p');
|
||||
define('USER_TABLE_ID', 'p.person_id');
|
||||
define('USER_TABLE_USERNAME', "CONCAT(p.vorname, ' ', p.nachname) as user_name");
|
||||
<?php
|
||||
if ( ! defined('BASEPATH'))
|
||||
exit('No direct script access allowed');
|
||||
|
||||
|
||||
$config['msg_delivery'] = true;
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Constants for Messaging System
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Statuses
|
||||
| Priority
|
||||
| Return Codes
|
||||
|
|
||||
*/
|
||||
// message statuses
|
||||
define('MSG_STATUS_UNREAD', 0);
|
||||
define('MSG_STATUS_READ', 1);
|
||||
define('MSG_STATUS_ARCHIVED', 2);
|
||||
define('MSG_STATUS_DELETED', 3);
|
||||
|
||||
// priority
|
||||
define('PRIORITY_LOW', 1);
|
||||
@@ -20,7 +28,7 @@ define('PRIORITY_URGENT', 4);
|
||||
|
||||
// status return message codes
|
||||
define('MSG_SUCCESS', 0);
|
||||
define('MSG_ERR_GENERAL', 1);
|
||||
define('MSG_ERROR', 1);
|
||||
define('MSG_ERR_INVALID_USER_ID', 2);
|
||||
define('MSG_ERR_INVALID_MSG_ID', 3);
|
||||
define('MSG_ERR_INVALID_THREAD_ID', 4);
|
||||
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Login extends VileSci_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('test.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);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class VileSci_Controller extends FHC_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
/*if (! $this->getUID() && strncmp(uri_string(), 'system/Login', 11) !== 0)
|
||||
redirect(site_url('system/Login/'.uri_string()));*/
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</head>
|
||||
|
||||
<frameset rows="30%,*">
|
||||
<frame src="Messages/table" id="MessagesTop" name="MessagesTop" frameborder="0" />
|
||||
<frame src="Messages/table<?php if (! empty($person_id)) echo '/'.$person_id; ?>" id="MessagesTop" name="MessagesTop" frameborder="0" />
|
||||
<frame src="Messages/edit" id="MessagesBottom" name="MessagesBottom" frameborder="0" />
|
||||
<noframes>
|
||||
<body bgcolor="#FFFFFF">
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user