mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
Messages Inbox Outbox
This commit is contained in:
@@ -8,8 +8,7 @@ class Messages extends VileSci_Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->library('MessageLib');
|
||||
//$this->load->model('person/Person_model');
|
||||
//$this->load->model('system/Message_model');
|
||||
$this->load->model('person/Person_model', 'PersonModel');
|
||||
}
|
||||
|
||||
public function index($person_id = null)
|
||||
@@ -18,7 +17,7 @@ class Messages extends VileSci_Controller
|
||||
$this->load->view('system/messages.php', $data);
|
||||
}
|
||||
|
||||
public function table($person_id = null)
|
||||
public function inbox($person_id = null)
|
||||
{
|
||||
if (empty($person_id))
|
||||
$person_id = $this->input->post('person_id', TRUE);
|
||||
@@ -31,12 +30,43 @@ class Messages extends VileSci_Controller
|
||||
|
||||
$data = array
|
||||
(
|
||||
'uid' => $this->getUID(),
|
||||
'messages' => $msg->retval
|
||||
);
|
||||
//var_dump ($data);
|
||||
$this->load->view('system/messagesList.php', $data);
|
||||
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($this->getUID());
|
||||
else
|
||||
$msg = $this->messagelib->getMessagesByPerson($person_id);
|
||||
if ($msg->error)
|
||||
show_error($msg->retval);
|
||||
|
||||
$data = array
|
||||
(
|
||||
'uid' => $this->getUID(),
|
||||
'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);
|
||||
|
||||
@@ -134,6 +134,10 @@ class Templates extends FHC_Controller
|
||||
$data['studiengang_kz'] = $this->input->post('studiengang_kz', TRUE);
|
||||
$data['version'] = $this->input->post('version', TRUE);
|
||||
$data['oe_kurzbz'] = $this->input->post('oe_kurzbz', TRUE);
|
||||
if ($this->input->post('orgform_kurzbz') == '')
|
||||
$data['orgform_kurzbz'] = null;
|
||||
else
|
||||
$data['orgform_kurzbz'] = $this->input->post('orgform_kurzbz', TRUE);
|
||||
$data['text'] = $this->input->post('text', TRUE);
|
||||
$data['aktiv'] = $this->input->post('aktiv', TRUE);
|
||||
$vorlagetext = $this->vorlagelib->updateVorlagetext($vorlagestudiengang_id, $data);
|
||||
|
||||
@@ -128,7 +128,7 @@ class DB_Model extends FHC_Model
|
||||
* @param string $id ID (Primary Key) for SELECT ... WHERE
|
||||
* @return array
|
||||
*/
|
||||
public function load($id)
|
||||
public function load($id = null)
|
||||
{
|
||||
// Check Class-Attributes
|
||||
if (is_null($this->dbTable))
|
||||
@@ -150,6 +150,8 @@ class DB_Model extends FHC_Model
|
||||
else
|
||||
$result = $this->db->get_where($this->dbTable, $id);
|
||||
}
|
||||
elseif (empty($id))
|
||||
$result = $this->db->get($this->dbTable);
|
||||
else
|
||||
$result = $this->db->get_where($this->dbTable, array($this->pk => $id));
|
||||
|
||||
@@ -185,6 +187,8 @@ class DB_Model extends FHC_Model
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** ---------------------------------------------------------------
|
||||
* Load single data from DB-Table
|
||||
*
|
||||
@@ -212,7 +216,7 @@ class DB_Model extends FHC_Model
|
||||
else
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
|
||||
|
||||
/** ---------------------------------------------------------------
|
||||
* Add a table to join with
|
||||
*
|
||||
|
||||
@@ -3,7 +3,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class FHC_Controller extends CI_Controller
|
||||
{
|
||||
protected $_uid; // needs to be changed to protected $_uid
|
||||
protected $_uid;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -29,7 +29,8 @@ class Migration_Vorlage extends CI_Migration {
|
||||
else
|
||||
echo "Error adding public.tbl_vorlage.attribute!";
|
||||
}
|
||||
|
||||
|
||||
// tbl_vorlagestudiengang->Subject
|
||||
if (! @$this->db->simple_query('SELECT subject FROM public.tbl_vorlagestudiengang'))
|
||||
{
|
||||
$this->db->insert('system.tbl_berechtigung', array(
|
||||
@@ -48,6 +49,7 @@ class Migration_Vorlage extends CI_Migration {
|
||||
echo "Error adding public.tbl_vorlagestudiengang.subject!";
|
||||
}
|
||||
|
||||
// tbl_vorlagestudiengang->OrgForm
|
||||
if (! @$this->db->simple_query('SELECT orgform_kurzbz FROM public.tbl_vorlagestudiengang'))
|
||||
{
|
||||
$query= "ALTER TABLE public.tbl_vorlagestudiengang
|
||||
|
||||
@@ -23,13 +23,13 @@ class Message_model extends DB_Model
|
||||
if ($uid === $this->getUID())
|
||||
{
|
||||
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);
|
||||
}
|
||||
// if different user, for reading messages from other users
|
||||
else
|
||||
{
|
||||
if (! $this->fhc_db_acl->isBerechtigt('basis/message', 's'))
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> system/message:all', FHC_MODEL_ERROR);
|
||||
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> basis/message:all', FHC_MODEL_ERROR);
|
||||
}
|
||||
|
||||
// get Data
|
||||
@@ -120,4 +120,4 @@ public function getMessagesByPerson($person_id, $all)
|
||||
else
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</head>
|
||||
|
||||
<frameset rows="30%,*">
|
||||
<frame src="Messages/table<?php if (! empty($person_id)) echo '/'.$person_id; ?>" id="MessagesTop" name="MessagesTop" frameborder="0" />
|
||||
<frame src="Messages/inbox<?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">
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
$this->load->view('templates/header', array('title' => 'MessagesList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '4:{sorter:false}'));
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="span4">
|
||||
<h2>Inbox <?php if (empty($person))
|
||||
echo $uid;
|
||||
else
|
||||
echo ' -> Person '.$person->person_id.' ('.$person->vorname.')';
|
||||
?><br /><br />
|
||||
<form method="post" action="outbox">
|
||||
<button type="submit">Outbox</button>
|
||||
</form></h2>
|
||||
|
||||
<form method="post" action="">
|
||||
Person <input name="person_id"></input>
|
||||
<button type="submit">show Mails</button>
|
||||
</form>
|
||||
|
||||
<table id="t1" class="tablesorter">
|
||||
<thead>
|
||||
<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 ($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>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+12
-5
@@ -2,12 +2,19 @@
|
||||
$this->load->view('templates/header', array('title' => 'MessagesList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '4:{sorter:false}'));
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="span4">
|
||||
<h2>Vorlagen</h2>
|
||||
<div class="span4">
|
||||
<h2>Outbox <?php if (empty($person))
|
||||
echo $uid;
|
||||
else
|
||||
echo ' -> Person '.$person->person_id.' ('.$person->vorname.')';
|
||||
?><br /><br />
|
||||
<form method="post" action="inbox">
|
||||
<button type="submit">Inbox</button>
|
||||
</form></h2>
|
||||
|
||||
<form method="post" action="">
|
||||
Person
|
||||
<input name="person_id"></input>
|
||||
<button type="submit">Filter</button>
|
||||
Person <input name="person_id"></input>
|
||||
<button type="submit">show Mails</button>
|
||||
</form>
|
||||
|
||||
<table id="t1" class="tablesorter">
|
||||
@@ -10,6 +10,7 @@ StudiengangKZ: <?=$studiengang_kz?>
|
||||
Version: <input type="text" name="version" value="<?php echo $version; ?>" />
|
||||
Aktiv: <input type="text" name="aktiv" value="<?php echo $aktiv; ?>" />
|
||||
OE:<?php echo $this->templatelib->widget("organisationseinheit_widget", array('oe_kurzbz' => $oe_kurzbz)); ?>
|
||||
OrgForm:<?php echo $this->templatelib->widget("orgform_widget", array('orgform' => $orgform_kurzbz)); ?>
|
||||
<input type="hidden" name="vorlagestudiengang_id" value="<?php echo $vorlagestudiengang_id; ?>" />
|
||||
<input type="hidden" name="studiengang_kz" value="<?php echo $studiengang_kz; ?>" />
|
||||
<?php
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<select name="<?php echo $name; ?>">
|
||||
<select name="<?php echo $htmltagname; ?>">
|
||||
<?php foreach($items as $item): ?>
|
||||
<option value="<?php echo $item['value']; ?>" <?php if ($item['selected']) echo 'selected'?>>
|
||||
<?php echo $item['name']; ?>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<select name="<?php echo $htmltagname; ?>">
|
||||
<?php foreach($items as $item): ?>
|
||||
<option value="<?php echo $item['value']; ?>" <?php if ($item['selected']) echo 'selected'?>>
|
||||
<?php echo $item['name']; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
@@ -1,5 +1,6 @@
|
||||
<script type="text/javascript">
|
||||
tinymce.init({
|
||||
menubar: <?php echo $menubar; ?>,
|
||||
selector: "<?php echo $selector; ?>",
|
||||
plugins: [<?php echo $plugins; ?>],
|
||||
toolbar: "<?php echo $toolbar; ?>"
|
||||
|
||||
@@ -5,22 +5,34 @@
|
||||
*/
|
||||
class organisationseinheit_widget extends Widget
|
||||
{
|
||||
|
||||
protected $_htmltagname = 'oe_kurzbz';
|
||||
|
||||
public function display($data)
|
||||
{
|
||||
$this->load->model('organisation/Organisationseinheit_model');
|
||||
$res = $this->Organisationseinheit_model->getRecursiveList();
|
||||
var_dump($res);
|
||||
|
||||
// *** set data ***
|
||||
if (isset($data['htmltagname']))
|
||||
$this->_htmltagname = $data['htmltagname'];
|
||||
|
||||
// items from db
|
||||
foreach ($res->retval->result() as $obj)
|
||||
{
|
||||
$item = array('name' => $obj->name, 'value' => $obj->value);
|
||||
if (isset($data['oe_kurzbz']) && $obj->value == $data['oe_kurzbz'])
|
||||
$item = array
|
||||
(
|
||||
'name' => $obj->name,
|
||||
'value' => $obj->value
|
||||
);
|
||||
if (isset($data['oe_kurzbz']) && $data['oe_kurzbz'] == $obj->value)
|
||||
$item['selected'] = true;
|
||||
else
|
||||
$item['selected'] = false;
|
||||
$data['items'][] = $item;
|
||||
}
|
||||
if (! isset($data['name']))
|
||||
$data['name'] = 'oe_kurzbz';
|
||||
$data['htmltagname'] = $this->_htmltagname;
|
||||
|
||||
$this->view('widgets/organisationseinheit', $data);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* OrgForm widget
|
||||
*/
|
||||
class orgform_widget extends Widget
|
||||
{
|
||||
protected $_htmltagname = 'orgform_kurzbz';
|
||||
|
||||
public function display($data)
|
||||
{
|
||||
$this->load->model('codex/Orgform_model', 'OrgFormModel');
|
||||
$res = $this->OrgFormModel->load();
|
||||
|
||||
// set data
|
||||
if (isset($data['htmltagname']))
|
||||
$this->_htmltagname = $data['htmltagname'];
|
||||
|
||||
// empty item for null values
|
||||
$item = array
|
||||
(
|
||||
'name' => ' - ',
|
||||
'value' => ''
|
||||
);
|
||||
if (empty($data['oe_kurzbz']))
|
||||
$item['selected'] = true;
|
||||
else
|
||||
$item['selected'] = false;
|
||||
$data['items'][] = $item;
|
||||
|
||||
// items from db
|
||||
foreach ($res->retval as $obj)
|
||||
{
|
||||
$item = array
|
||||
(
|
||||
'name' => $obj->orgform_kurzbz.' ('.$obj->bezeichnung.')',
|
||||
'value' => $obj->orgform_kurzbz
|
||||
);
|
||||
if (isset($data['orgform']) && $obj->orgform_kurzbz == $data['orgform'])
|
||||
$item['selected'] = true;
|
||||
else
|
||||
$item['selected'] = false;
|
||||
$data['items'][] = $item;
|
||||
}
|
||||
$data['htmltagname'] = $this->_htmltagname;
|
||||
|
||||
$this->view('widgets/orgform', $data);
|
||||
}
|
||||
}
|
||||
@@ -15,13 +15,15 @@ class tinymce_widget extends Widget
|
||||
$data['text'] = '';
|
||||
if (! isset($data['style']))
|
||||
$data['style'] = 'width:100%';
|
||||
if (! isset($data['menubar']))
|
||||
$data['menubar'] = 'false';
|
||||
if (! isset($data['plugins']))
|
||||
$data['plugins'] = '
|
||||
"advlist autolink lists link image charmap print preview anchor",
|
||||
"searchreplace visualblocks code fullscreen",
|
||||
"insertdatetime media table contextmenu paste"';
|
||||
if (! isset($data['toolbar']))
|
||||
$data['toolbar'] = 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image';
|
||||
$data['toolbar'] = 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | code';
|
||||
|
||||
$this->view('widgets/tinymce', $data);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class studiengang extends Studiengang_model
|
||||
* @param studiengang_kz KZ des Studienganges der zu Laden ist
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function load($studiengang_kz)
|
||||
public function load($studiengang_kz = null)
|
||||
{
|
||||
if(!is_numeric($studiengang_kz))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user