This commit is contained in:
Paminger
2016-06-22 08:11:59 +02:00
18 changed files with 552 additions and 47 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 009;
$config['migration_version'] = '009';
/*
|--------------------------------------------------------------------------
@@ -23,45 +23,20 @@ class Message extends APIv1_Controller
{
parent::__construct();
// Load model MessageModel
$this->load->model('system/message_model', 'MessageModel');
// Load set the uid of the model to let to check the permissions
$this->MessageModel->setUID($this->_getUID());
$this->load->library('MessageLib', array('uid' => $this->_getUID()));
}
/**
* @return void
*/
public function getMessage()
public function getMessagesByPersonID()
{
$messageID = $this->get('message_id');
$person_id = $this->get('person_id');
$all = $this->get('all');
if (isset($messageID))
if (isset($person_id))
{
$result = $this->MessageModel->load($messageID);
$this->response($result, REST_Controller::HTTP_OK);
}
else
{
$this->response();
}
}
/**
* @return void
*/
public function postMessage()
{
if ($this->_validate($this->post()))
{
if (isset($this->post()['message_id']))
{
$result = $this->MessageModel->update($this->post()['message_id'], $this->post());
}
else
{
$result = $this->MessageModel->insert($this->post());
}
$result = $this->messagelib->getMessagesByPerson($person_id, $all);
$this->response($result, REST_Controller::HTTP_OK);
}
@@ -71,8 +46,39 @@ class Message extends APIv1_Controller
}
}
private function _validate($message = NULL)
/**
* @return void
*/
public function postMessage()
{
if ($this->_validate($this->post()))
{
$this->messagelib->addRecipient($this->post()['person_id']);
$result = $this->messagelib->sendMessage(
$this->post()['person_id'],
$this->post()['subject'],
$this->post()['body'],
PRIORITY_NORMAL,
NULL,
$this->post()['oe_kurzbz']
);
$this->response($result, REST_Controller::HTTP_OK);
}
else
{
$this->response();
}
}
private function _validate($message = null)
{
if (!isset($message['person_id']) || !isset($message['subject']) ||
!isset($message['body']) || !isset($message['oe_kurzbz']))
{
return false;
}
return true;
}
}
+147
View File
@@ -0,0 +1,147 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
class Phrases extends FHC_Controller
{
public function __construct()
{
parent::__construct();
$this->load->library('PhrasesLib');
}
public function index()
{
$this->load->view('system/phrases.php');
}
public function table()
{
$phrases = $this->phraseslib->getPhraseByApp('aufnahme');
if ($phrases->error)
show_error($phrases->retval);
//var_dump($vorlage);
$data = array
(
'app' => 'aufnahme',
'phrases' => $phrases->retval
);
$v = $this->load->view('system/phrasesList.php', $data);
}
public function view($phrase_id = null)
{
if (empty($phrase_id))
exit;
$phrase_inhalt = $this->phraseslib->getPhraseInhalt($phrase_id);
if ($phrase_inhalt->error)
show_error($phrase_inhalt->retval);
//var_dump($vorlage);
$data = array
(
'phrase_id' => $phrase_id,
'phrase_inhalt' => $phrase_inhalt->retval
);
$v = $this->load->view('system/phrasesinhaltList.php', $data);
}
public function edit($phrase_id = null)
{
if (empty($phrase_id))
exit;
$phrase = $this->phraseslib->getPhrase($phrase_id);
//var_dump($vorlage);
if ($phrase->error)
show_error($phrase->retval);
if (count($phrase->retval) != 1)
show_error('Phrase nicht vorhanden! ID: '.$phrase_id);
$data = array
(
'phrase' => $phrase->retval[0]
);
//var_dump($data['message']);
$v = $this->load->view('system/phrasesEdit', $data);
}
public function write($vorlage_kurzbz = null)
{
$data = array
(
'subject' => 'TestSubject',
'body' => 'TestDevelopmentBodyText'
);
$v = $this->load->view('system/messageWrite', $data);
}
public function save()
{
$phrase_id = $this->input->post('phrase_id', TRUE);
$data['phrase'] = $this->input->post('phrase', TRUE);
$phrase = $this->phraseslib->savePhrase($phrase_id, $data);
if ($phrase->error)
show_error($phrase->retval);
$phrase_id = $phrase->retval;
redirect('/system/Phrases/edit/'.$phrase_id);
}
public function newText()
{
$vorlage_kurzbz = $this->input->post('vorlage_kurzbz', TRUE);
$data = array
(
'vorlage_kurzbz' => $vorlage_kurzbz,
'studiengang_kz' => 0,
'version' => 1,
'oe_kurzbz' => 'etw'
);
$vorlagetext = $this->vorlagelib->insertVorlagetext($data);
if ($vorlagetext->error)
show_error($vorlagetext->retval);
$vorlagestudiengang_id = $vorlagetext->retval;
redirect('/system/Templates/editText/'.$vorlagestudiengang_id);
}
public function editText($phrase_inhalt_id)
{
$phrase_inhalt = $this->phraseslib->getPhraseInhaltById($phrase_inhalt_id);
if ($phrase_inhalt->error)
show_error($phrase_inhalt->retval);
$data = $phrase_inhalt->retval[0];
$this->load->view('system/phraseinhaltEdit', $data);
}
public function saveText()
{
$phrase_inhalt_id = $this->input->post('phrase_inhalt_id', TRUE);
$data['orgeinheit_kurzbz'] = $this->input->post('oe_kurzbz', TRUE);
$data['text'] = $this->input->post('text', TRUE);
$data['description'] = $this->input->post('description', TRUE);
$data['sprache'] = $this->input->post('sprache', TRUE);
$phrase_inhalt = $this->phraseslib->updatePhraseInhalt($phrase_inhalt_id, $data);
if ($phrase_inhalt->error)
show_error($phrase_inhalt->retval);
$data['phrase_inhalt_id'] = $phrase_inhalt_id;
redirect('/system/Phrases/editText/'.$phrase_inhalt_id);
//$this->load->view('system/templatetextEdit', $data);
}
public function preview($vorlagestudiengang_id)
{
$formdata = $this->input->post('formdata', FALSE);
$daten = json_decode($formdata, TRUE);
$vorlagetext = $this->vorlagelib->getVorlagetextById($vorlagestudiengang_id);
if ($vorlagetext->error)
show_error($vorlagetext->retval);
$data = array
(
'text' => $this->vorlagelib->parseVorlagetext($vorlagetext->retval[0]->text, $daten)
);
$this->load->view('system/templatetextPreview', $data);
}
}
+1
View File
@@ -21,4 +21,5 @@ class FHC_Controller extends CI_Controller
else
return $this->_uid;
}
}
+6 -1
View File
@@ -11,13 +11,18 @@ class MessageLib
{
private $recipients = array();
public function __construct()
public function __construct($params)
{
$this->ci =& get_instance();
$this->ci->config->load('message');
//$this->ci->load->model('person/Person_model', 'PersonModel');
$this->ci->load->model('system/Message_model', 'MessageModel');
if (is_array($params) && isset($params['uid']))
{
$this->ci->MessageModel->setUID($params['uid']);
}
$this->ci->load->model('system/MsgStatus_model', 'MsgStatusModel');
$this->ci->load->model('system/Recipient_model', 'RecipientModel');
$this->ci->load->model('system/Attachment_model', 'AttachmentModel');
+159
View File
@@ -0,0 +1,159 @@
<?php
if (! defined('BASEPATH'))
exit('No direct script access allowed');
/**
* Name: Messaging Library for FH-Complete
*
*
*/
class PhrasesLib
{
public function __construct()
{
//require_once APPPATH.'config/message.php';
$this->ci =& get_instance();
$this->ci->load->library('parser');
$this->ci->load->model('system/Phrase_model', 'PhraseModel');
$this->ci->load->model('system/Phrase_inhalt_model', 'PhraseInhaltModel');
$this->ci->load->helper('language');
//$this->ci->lang->load('fhcomplete');
}
/**
* getPhrase() - will load a spezific Phrase
*
* @param integer $vorlage_kurzbz REQUIRED
* @return struct
*/
function getPhrase($phrase_id)
{
if (empty($phrase_id))
return $this->_error(MSG_ERR_INVALID_MSG_ID);
$phrase = $this->ci->PhraseModel->load($phrase_id);
return $phrase;
}
/**
* getSubMessages() - will return all Messages subordinated from a specified message.
*
* @param integer $msg_id REQUIRED
* @return array
*/
function getPhraseByApp($app = null)
{
$phrases = $this->ci->PhraseModel->loadWhere(array('app' => $app));
return $phrases;
}
function getPhraseInhalt($phrase_id)
{
if (empty($phrase_id))
return $this->_error(MSG_ERR_INVALID_MSG_ID);
$phrase_inhalt = $this->ci->PhraseInhaltModel->loadWhere(array('phrase_id' => $phrase_id));
return $phrase_inhalt;
}
/**
* savePhrase() - will save a spezific Phrase.
*
* @param array $data REQUIRED
* @return array
*/
function savePhrase($phrase_id, $data)
{
if (empty($data))
return $this->_error(MSG_ERR_INVALID_MSG_ID);
$phrase = $this->ci->PhraseModel->update($phrase_id, $data);
return $phrase;
}
/**
* getVorlagetextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
function getPhraseInhaltById($phrase_inhalt_id)
{
if (empty($phrase_inhalt_id))
return $this->_error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
$phrase_inhalt = $this->ci->PhraseInhaltModel->loadWhere(array('phrase_inhalt_id' =>$phrase_inhalt_id));
return $phrase_inhalt;
}
/**
* loadVorlagetext() - will load the best fitting Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @param string $oe_kurzbz OPTIONAL
* @param string $orgform_kurzbz OPTIONAL
* @return array
*/
function loadVorlagetext($vorlage_kurzbz, $oe_kurzbz=null, $orgform_kurzbz=null)
{
if (empty($vorlage_kurzbz))
return $this->_error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
$vorlage = $this->ci->VorlageStudiengangModel->getVorlageStudiengang($vorlage_kurzbz, $oe_kurzbz, $orgform_kurzbz);
return $vorlage;
}
/**
* insertVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
function insertVorlagetext($data)
{
$vorlagetext = $this->ci->VorlageStudiengangModel->insert($data);
return $vorlagetext;
}
/**
* loadVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
function getVorlagetextById($vorlagestudiengang_id)
{
$vorlagetext = $this->ci->VorlageStudiengangModel->load($vorlagestudiengang_id);
return $vorlagetext;
}
/**
* saveVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template.
*
* @param string $vorlage_kurzbz REQUIRED
* @return array
*/
function updatePhraseInhalt($phrase_inhalt_id, $data)
{
$phrase_inhalt = $this->ci->PhraseInhaltModel->update($phrase_inhalt_id, $data);
return $phrase_inhalt;
}
/**
* parseVorlagetext() - will parse a Vorlagetext.
*
* @param string $text REQUIRED
* @param array $data REQUIRED
* @return string
*/
function parseVorlagetext($text, $data = array())
{
if (empty($text))
return $this->_error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
$text = $this->ci->parser->parse_string($text, $data, TRUE);
return $text;
}
}
@@ -54,4 +54,3 @@ class Migration_Add_apikey extends CI_Migration {
$this->dbforge->drop_table('ci_apikey');
}
}
+4 -3
View File
@@ -44,9 +44,10 @@ class Migration_Phrase extends CI_Migration {
phrase_inhalt_id serial,
phrase_id bigint NOT NULL,
sprache varchar(32) NOT NULL,
orgeinheit_kurzbz varchar(32) NOT NULL,
orgform_kurzbz varchar(32) NOT NULL,
orgeinheit_kurzbz varchar(32),
orgform_kurzbz varchar(32),
text text,
description text,
insertamum timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
insertvon varchar(32),
PRIMARY KEY (phrase_inhalt_id)
@@ -64,7 +65,7 @@ class Migration_Phrase extends CI_Migration {
}
}
}
public function down()
{
try
@@ -0,0 +1,15 @@
<?php
class Phrase_inhalt_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'public.tbl_phrase_inhalt';
$this->pk = 'phrase_inhalt_id';
}
}
@@ -0,0 +1,15 @@
<?php
class Phrase_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'public.tbl_phrase';
$this->pk = 'phrase_id';
}
}
@@ -0,0 +1,31 @@
<?php
$this->load->view('templates/header', array('title' => 'TemplateEdit', 'tinymce' => true, 'jsonforms' => true));
?>
<div class="row">
<div class="span4">
<h2>Phrase Inhalt: <?=$phrase_inhalt_id?></h2>
<form method="post" action="../saveText/<?=$phrase_inhalt_id?>">
<input type="hidden" name="phrase_inhalt_id" value="<?php echo $phrase_inhalt_id; ?>" />
<table>
<tr><td>OE</td><td><?php echo $this->templatelib->widget("organisationseinheit_widget", array('oe_kurzbz' => $orgeinheit_kurzbz)); ?></td></tr>
<tr><td>Sprache</td><td><input type="text" name="sprache" value="<?php echo $sprache?>"></td></tr>
<tr><td>Text</td><td><textarea name="text" cols="50" rows="5"><?php echo $text ?></textarea></td></tr>
<tr><td>Beschreibung</td><td><textarea name="description" cols="50" rows="5"><?php echo $description ?></textarea></td></tr>
<?php
// This is an example to show that you can load stuff from inside the template file
//echo $this->templatelib->widget("tinymce_widget", array('name' => 'text', 'text' => $text));
?>
<tr><td colspan="2" align="right"><button type="submit">Save</button></td></tr>
</table>
</form>
</div>
</div>
<!--
<iframe name="TemplatePreview" width="100%" src=""/>
-->
</body>
</html>
+20
View File
@@ -0,0 +1,20 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
<html lang="de_AT">
<head>
<title>VileSci - Phrasen</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<frameset rows="30%,*">
<frame src="Phrases/table" id="PhrasesTop" name="PhrasesTop" frameborder="0" />
<frame src="Phrases/edit" id="PhrasesBottom" name="PhrasesBottom" frameborder="0" />
<noframes>
<body bgcolor="#FFFFFF">
This application works only with a frames-enabled browser.<br />
<a href="PhrasesList">Use without frames</a>
</body>
</noframes>
</frameset>
</html>
+17
View File
@@ -0,0 +1,17 @@
<?php
$this->load->view('templates/header', array('title' => 'PhrasesEdit'));
?>
<div class="row">
<div class="span4">
<h2>Phrase: <?php echo $phrase->phrase_id; ?></h2>
<form method="post" action="../save">
Bezeichnung: <input type="text" name="phrase" value="<?php echo $phrase->phrase; ?>" />
<input type="hidden" name="phrase_id" value="<?php echo $phrase->phrase_id; ?>" />
<button type="submit">Save</button>
</form>
</div>
</div>
</body>
</html>
+37
View File
@@ -0,0 +1,37 @@
<?php
$this->load->view('templates/header', array('title' => 'PhrasesList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '2:{sorter:false}'));
?>
<div class="row">
<div class="span4">
<h2>Phrasen</h2>
<!--
<form method="post" action="">
App: aufnahme
<?php
// This is an example to show that you can load stuff from inside the template file
//echo $this->templatelib->widget("mimetype_widget", array('mimetype' => $mimetype));
?>
<button type="submit">Filter</button>
</form>
-->
<table id="t1" class="tablesorter">
<thead>
<tr><th class='table-sortable:default'>ID</th>
<th class='table-sortable:default'>Phrase</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($phrases as $p): ?>
<tr><td><a href="edit/<?php echo $p->phrase_id; ?>" target="PhrasesBottom"><?php echo $p->phrase_id; ?></a></td>
<td><?php echo $p->phrase; ?></td>
<td><a href="view/<?php echo $p->phrase_id; ?>" target="PhrasesBottom">View</a></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
</div>
</body>
</html>
@@ -0,0 +1,42 @@
<?php
$this->load->view('templates/header', array('title' => 'PhrasenInhaltList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '5:{sorter:false}'));
?>
<div class="row">
<div class="span4">
<h2>Phrase Inhalt - <?php echo $phrase_id; ?></h2>
<form method="post" action="../newtext" target="TemplatesBottom">
<input type="hidden" name="phrase_id" value="<?php echo $phrase_id; ?>"/>
<button type="submit">Neu</button>
</form>
<table id="t1" class="tablesorter">
<thead>
<tr><th class='table-sortable:default'>ID</th>
<th class='table-sortable:default'>Sprache</th>
<th class='table-sortable:default'>OrgEinheit</th>
<th class='table-sortable:default'>OrgForm</th>
<th class='table-sortable:default'>Text</th>
<th>Beschreibung</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($phrase_inhalt as $v): ?>
<tr><td><a href="../edittext/<?php echo $v->phrase_inhalt_id; ?>" target="PhrasesBottom"><?php echo $v->phrase_inhalt_id; ?></a></td>
<td><?php echo $v->sprache; ?></td>
<td><?php echo $v->orgeinheit_kurzbz; ?></td>
<td><?php echo $v->orgform_kurzbz; ?></td>
<td><?php echo $v->text; ?></td>
<td><?php echo $v->description; ?></td>
<td><a href="../edittext/<?php echo $v->phrase_inhalt_id; ?>" target="PhrasesBottom">edit</a></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
</div>
<?php
$this->load->view('templates/footer');
?>
+8 -5
View File
@@ -347,10 +347,13 @@ if (isset($assign_to_config) && is_array($assign_to_config))
*/
$LANG =& load_class('Lang', 'core');
define('FHC_INTEGER',1);
define('FHC_STRING',2);
define('FHC_BOOLEAN',3);
define('FHC_LANG_ARRAY',4);
if (!defined('FHC_INTEGER'))
{
define('FHC_INTEGER',1);
define('FHC_STRING',2);
define('FHC_BOOLEAN',3);
define('FHC_LANG_ARRAY',4);
}
function &get_instance()
{
@@ -369,4 +372,4 @@ require_once(dirname(__FILE__).'/application/core/FHC_Model.php');
$model=new CI_Model();
// Traits
require_once(dirname(__FILE__).'/ci_db_extra.php');
require_once(dirname(__FILE__).'/ci_db_extra.php');
+2 -1
View File
@@ -225,7 +225,8 @@ $menu=array
'link'=>'left.php?categorie=Admin', 'target'=>'nav',
'Cronjobs'=>array('name'=>'Cronjobs', 'link'=>'stammdaten/cronjobverwaltung.php', 'target'=>'main','permissions'=>array('basis/cronjob')),
'Vorlagen'=>array('name'=>'Vorlagen', 'link'=>'../index.ci.php/system/Templates', 'target'=>'main','permissions'=>array('basis/cronjob')),
'Messages'=>array('name'=>'Nachrichten', 'link'=>'../index.ci.php/system/Messages', 'target'=>'main','permissions'=>array('basis/cronjob'))
'Messages'=>array('name'=>'Nachrichten', 'link'=>'../index.ci.php/system/Messages', 'target'=>'main','permissions'=>array('basis/cronjob')),
'Phrasen'=>array('name'=>'Phrasen', 'link'=>'../index.ci.php/system/Phrases', 'target'=>'main','permissions'=>array('basis/cronjob'))
),
'SD-Tools'=> array
(
+9 -3
View File
@@ -343,7 +343,8 @@ DELETE FROM system.tbl_rolleberechtigung WHERE berechtigung_kurzbz IN (
'basis/lehrverband',
'basis/log',
'basis/mitarbeiter',
'basis/msg_message',
'basis/msg_message',
'basis/message',
'basis/msg_thread',
'basis/notiz',
'basis/notizzuordnung',
@@ -419,7 +420,8 @@ DELETE FROM system.tbl_rolleberechtigung WHERE berechtigung_kurzbz IN (
'basis/vw_studiensemester',
'lehre/reservierung',
'lehre/reihungstest',
'wawi/inventar:begrenzt'
'wawi/inventar:begrenzt',
'fs/dms'
);
-- DELETE FROM system.tbl_berechtigung
@@ -569,6 +571,7 @@ DELETE FROM system.tbl_berechtigung WHERE berechtigung_kurzbz IN (
'basis/log',
'basis/mitarbeiter',
'basis/msg_message',
'basis/message',
'basis/msg_thread',
'basis/notiz',
'basis/notizzuordnung',
@@ -644,7 +647,8 @@ DELETE FROM system.tbl_berechtigung WHERE berechtigung_kurzbz IN (
'basis/vw_studiensemester',
'lehre/reservierung',
'lehre/reihungstest',
'wawi/inventar:begrenzt'
'wawi/inventar:begrenzt',
'fs/dms'
);
-- INSERT Permissions
@@ -870,6 +874,7 @@ INSERT INTO system.tbl_berechtigung (berechtigung_kurzbz, beschreibung) VALUES('
INSERT INTO system.tbl_berechtigung (berechtigung_kurzbz, beschreibung) VALUES('lehre/reihungstest', '');
INSERT INTO system.tbl_berechtigung (berechtigung_kurzbz, beschreibung) VALUES('wawi/inventar:begrenzt', '');
INSERT INTO system.tbl_berechtigung (berechtigung_kurzbz, beschreibung) VALUES('fs/dms', '');
INSERT INTO system.tbl_berechtigung (berechtigung_kurzbz, beschreibung) VALUES('basis/message', '');
-- INSERT link between user admin and permissions
INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art) VALUES('basis/archiv', 'admin', 'suid');
@@ -1094,6 +1099,7 @@ INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art
INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art) VALUES('lehre/reihungstest', 'admin', 'suid');
INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art) VALUES('wawi/inventar:begrenzt', 'admin', 'suid');
INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art) VALUES('fs/dms', 'admin', 'suid');
INSERT INTO system.tbl_rolleberechtigung (berechtigung_kurzbz, rolle_kurzbz, art) VALUES('basis/message', 'admin', 'suid');
-- EMPTY public.tbl_statistik
DELETE FROM public.tbl_statistik;