mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
9a4f5480c4
- The function getAuthUID() present in the helper fhcauth_helper.php now tries to work always with CI session to get the uid - REST_controller doesn't need anymore to handle the uid - FHC_Controller and FHC_Model load fhcauth_helper in their constructor, so any class that extends them now could call the function getAuthUID() anywhere in the code - The controllers don't need anymore to pass the uid to the models or to the libraries - Library FHC_DB_ACL load fhcauth_helper in its constructor and uses getAuthID()
111 lines
2.6 KiB
PHP
Executable File
111 lines
2.6 KiB
PHP
Executable File
<?php
|
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class Messages extends VileSci_Controller
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->library('MessageLib');
|
|
$this->load->model('person/Person_model', 'PersonModel');
|
|
}
|
|
|
|
public function index($person_id = null)
|
|
{
|
|
$data = array('person_id' => $person_id);
|
|
$this->load->view('system/messages.php', $data);
|
|
}
|
|
|
|
public function inbox($person_id = null)
|
|
{
|
|
if (empty($person_id))
|
|
$person_id = $this->input->post('person_id', TRUE);
|
|
if (empty($person_id))
|
|
$msg = $this->messagelib->getMessagesByUID(getAuthUID());
|
|
else
|
|
$msg = $this->messagelib->getMessagesByPerson($person_id);
|
|
if ($msg->error)
|
|
show_error($msg->retval);
|
|
|
|
$data = array
|
|
(
|
|
'uid' => getAuthUID(),
|
|
'messages' => $msg->retval
|
|
);
|
|
if (!empty($person_id))
|
|
{
|
|
$person = $this->PersonModel->load($person_id);
|
|
$data['person'] = $person->retval[0];
|
|
}
|
|
// var_dump ($data);
|
|
$this->load->view('system/messagesInbox.php', $data);
|
|
}
|
|
|
|
public function outbox($person_id = null)
|
|
{
|
|
if (empty($person_id))
|
|
$person_id = $this->input->post('person_id', TRUE);
|
|
if (empty($person_id))
|
|
$msg = $this->messagelib->getMessagesByUID(getAuthUID());
|
|
else
|
|
$msg = $this->messagelib->getMessagesByPerson($person_id);
|
|
if ($msg->error)
|
|
show_error($msg->retval);
|
|
|
|
$data = array
|
|
(
|
|
'uid' => getAuthUID(),
|
|
'messages' => $msg->retval
|
|
);
|
|
if (!empty($person_id))
|
|
{
|
|
$person = $this->PersonModel->load($person_id);
|
|
$data['person'] = $person->retval[0];
|
|
}
|
|
//var_dump ($data);
|
|
$this->load->view('system/messagesOutbox.php', $data);
|
|
}
|
|
|
|
public function view($msg_id)
|
|
{
|
|
$msg = $this->messagelib->getMessage($msg_id);
|
|
//var_dump($msg);
|
|
if ($msg->error)
|
|
show_error($msg->retval);
|
|
if (count($msg->retval) != 1)
|
|
show_error('Nachricht nicht vorhanden! ID: '.$msg_id);
|
|
|
|
$data = array
|
|
(
|
|
'message' => $msg->retval[0]
|
|
);
|
|
//var_dump($data['message']);
|
|
$v = $this->load->view('system/messageView', $data);
|
|
}
|
|
|
|
public function write($vorlage_kurzbz = null)
|
|
{
|
|
$data = array
|
|
(
|
|
'subject' => 'TestSubject',
|
|
'body' => 'TestDevelopmentBodyText'
|
|
);
|
|
$v = $this->load->view('system/messageWrite', $data);
|
|
}
|
|
|
|
public function send()
|
|
{
|
|
$body = $this->input->post('body', TRUE);
|
|
$subject = $this->input->post('subject', TRUE);
|
|
if (! $this->messagelib->addRecipient(1))
|
|
show_error('Error: AddRecipient');
|
|
$msg = $this->messagelib->sendMessage(1,$body ,$subject);
|
|
if ($msg->error)
|
|
show_error($msg->retval);
|
|
$msg_id = $msg->retval;
|
|
|
|
redirect('/system/Message/view/'.$msg_id);
|
|
}
|
|
}
|