This commit is contained in:
Stefan Puraner
2016-08-08 11:17:15 +02:00
14 changed files with 940 additions and 775 deletions
+1
View File
@@ -190,6 +190,7 @@ $config['fhc_acl'] = array
'public.tbl_tag' => 'basis/tag',
'public.tbl_variable' => 'basis/variable',
'public.tbl_vorlage' => 'system/vorlage',
'public.tbl_vorlagedokument' => 'system/vorlagestudiengang',
'public.tbl_vorlagestudiengang' => 'system/vorlagestudiengang',
'public.tbl_rt_person' => 'basis/person',
'public.vw_studiensemester' => 'basis/studiensemester',
+38 -1
View File
@@ -42,7 +42,7 @@ class Templates extends FHC_Controller
$vorlagentext = $this->vorlagelib->getVorlagetextByVorlage($vorlage_kurzbz);
if ($vorlagentext->error)
show_error($vorlagentext->retval);
//var_dump($vorlage);
//var_dump($vorlagentext);
$data = array
(
@@ -128,6 +128,43 @@ class Templates extends FHC_Controller
$this->load->view('system/templatetextEdit', $data);
}
public function linkDocuments($vorlagestudiengang_id)
{
$this->load->model('system/vorlagedokument_model');
$return = $this->vorlagedokument_model->loadDokumenteFromVorlagestudiengang($vorlagestudiengang_id);
$data['documents'] = $return->retval;
$this->load->model('system/dokument_model');
$this->dokument_model->addOrder("bezeichnung");
$return = $this->dokument_model->load();
$data['allDocuments'] = $return->retval;
$data['vorlagestudiengang_id'] = $vorlagestudiengang_id;
$this->load->view('system/templateLinkDocuments', $data);
}
public function saveDocuments($vorlagestudiengang_id, $dokument_kurzbz, $sort)
{
$this->load->model('system/vorlagedokument_model');
$insert['vorlagestudiengang_id'] = $vorlagestudiengang_id;
$insert['dokument_kurzbz'] = $dokument_kurzbz;
$insert['sort'] = $sort;
$this->vorlagedokument_model->insert($insert);
}
public function deleteDocumentLink($vorlagestudiengang_id)
{
$this->load->model('system/vorlagedokument_model');
$this->vorlagedokument_model->delete($vorlagestudiengang_id);
}
public function changeSort($vorlagestudiengang_id, $sort)
{
$this->load->model('system/vorlagedokument_model');
$this->vorlagedokument_model->update($vorlagestudiengang_id, array("sort"=>$sort));
}
public function saveText()
{
$vorlagestudiengang_id = $this->input->post('vorlagestudiengang_id', TRUE);
+1 -1
View File
@@ -217,4 +217,4 @@ class VorlageLib
$return->retval = $retval;
return $return;
}
}
}
@@ -0,0 +1,14 @@
<?php
class Dokument_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'public.tbl_dokument';
$this->pk = 'dokument_kurzbz';
}
}
@@ -0,0 +1,41 @@
<?php
class Vorlagedokument_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'public.tbl_vorlagedokument';
$this->pk = 'vorlagedokument_id';
}
/**
*
*/
public function loadDokumenteFromVorlagestudiengang($vorlagestudiengang_id)
{
// Checks if the operation is permitted by the API caller
if (! $this->fhc_db_acl->isBerechtigt($this->getBerechtigungKurzbz('public.tbl_vorlagedokument'), 's'))
return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->getBerechtigungKurzbz('public.tbl_vorlagedokument'), FHC_MODEL_ERROR);
$result = null;
$qry = "SELECT vorlagedokument_id, sort, vorlagestudiengang_id, dokument_kurzbz, bezeichnung
FROM public.tbl_vorlagedokument
JOIN public.tbl_dokument USING(dokument_kurzbz)
WHERE vorlagestudiengang_id=?
ORDER BY sort ASC
";
$result = $this->db->query($qry, array($vorlagestudiengang_id));
if (is_object($result))
return $this->_success($result->result());
else
return $this->_error($this->db->error(), FHC_DB_ERROR);
}
}
+78 -78
View File
@@ -1,78 +1,78 @@
<?php
$this->load->view('templates/header', array('title' => 'TemplateEdit', 'jquery' => true, 'textile' => true));
?>
<div class="row">
<div class="span4">
<h2>Phrasentext: <?=$phrasentext_id?></h2>
<form method="post" action="../saveText/<?=$phrasentext_id?>">
<input type="hidden" name="phrase_inhalt_id" value="<?php echo $phrasentext_id; ?>" />
<table>
<tr>
<td>OE</td>
<td><?php echo $this->templatelib->widget("organisationseinheit_widget", array('oe_kurzbz' => $orgeinheit_kurzbz)); ?></td>
<td>Preview</td>
</tr>
<tr><td>Orgform</td><td><?php echo $this->templatelib->widget("orgform_widget", array('orgform_kurzbz' => $orgform_kurzbz)); ?></td><td></td></tr>
<tr><td>Sprache</td><td><?php echo $this->templatelib->widget("sprache_widget", array('sprache' => $sprache)); ?></td><td></td></tr>
<tr><td>Text</td><td><textarea name="text" style="width:500px; height:300px;" id="markitup"><?php echo $text ?></textarea></td>
<td valign="top">
<div id="textile-preview" style="width:500px; height:300px; border: 1px solid gray; overflow: auto;"></div>
</td>
</tr>
<tr><td>Beschreibung</td><td><textarea name="description" style="width:500px; height:100px;"><?php echo $description ?></textarea></td>
<td><h3>Formatierung (Textile) Hilfe:</h3><br/>
<code>
_emphasis_
*strong*
??citation??
-deleted text-
+inserted text+
^superscript^
</code><br/>
<a href="https://warpedvisions.org/projects/textile-cheat-sheet/" target="_blank">Textile CheatSheet</a>
</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>
<script>
$(document).ready(function () {
initTextile();
});
function initTextile() {
var $content = $('#markitup'); // my textarea
var $preview = $('#textile-preview'); // the preview div
//$content.markItUp(); // init markitup
// use a simple timer to check if the textarea content has changed
var value = $content.val();
$preview.html(textile.convert(value));
setInterval(function () {
var newValue = $content.val();
if (value != newValue) {
value = newValue;
$preview.html(textile.convert(newValue)); // convert the textile to html
}
}, 500);
};
</script>
<!--
<iframe name="TemplatePreview" width="100%" src=""/>
-->
</body>
</html>
<?php
$this->load->view('templates/header', array('title' => 'TemplateEdit', 'jquery' => true, 'textile' => true));
?>
<div class="row">
<div class="span4">
<h2>Phrasentext: <?=$phrasentext_id?></h2>
<form method="post" action="../saveText/<?=$phrasentext_id?>">
<input type="hidden" name="phrase_inhalt_id" value="<?php echo $phrasentext_id; ?>" />
<table>
<tr>
<td>OE</td>
<td><?php echo $this->templatelib->widget("organisationseinheit_widget", array('oe_kurzbz' => $orgeinheit_kurzbz)); ?></td>
<td>Preview</td>
</tr>
<tr><td>Orgform</td><td><?php echo $this->templatelib->widget("orgform_widget", array('orgform_kurzbz' => $orgform_kurzbz)); ?></td><td></td></tr>
<tr><td>Sprache</td><td><?php echo $this->templatelib->widget("sprache_widget", array('sprache' => $sprache)); ?></td><td></td></tr>
<tr><td>Text</td><td><textarea name="text" style="width:500px; height:300px;" id="markitup"><?php echo $text ?></textarea></td>
<td valign="top">
<div id="textile-preview" style="width:500px; height:300px; border: 1px solid gray; overflow: auto;"></div>
</td>
</tr>
<tr><td>Beschreibung</td><td><textarea name="description" style="width:500px; height:100px;"><?php echo $description ?></textarea></td>
<td><h3>Formatierung (Textile) Hilfe:</h3><br/>
<code>
_emphasis_
*strong*
??citation??
-deleted text-
+inserted text+
^superscript^
</code><br/>
<a href="https://warpedvisions.org/projects/textile-cheat-sheet/" target="_blank">Textile CheatSheet</a>
</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>
<script>
$(document).ready(function () {
initTextile();
});
function initTextile() {
var $content = $('#markitup'); // my textarea
var $preview = $('#textile-preview'); // the preview div
//$content.markItUp(); // init markitup
// use a simple timer to check if the textarea content has changed
var value = $content.val();
$preview.html(textile.convert(value));
setInterval(function () {
var newValue = $content.val();
if (value != newValue) {
value = newValue;
$preview.html(textile.convert(newValue)); // convert the textile to html
}
}, 500);
};
</script>
<!--
<iframe name="TemplatePreview" width="100%" src=""/>
-->
</body>
</html>
+38 -38
View File
@@ -1,38 +1,38 @@
<?php
$this->load->view('templates/header', array('title' => 'PhrasesList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '3:{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>App</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->app; ?></td>
<td><a href="edit/<?php echo $p->phrase_id; ?>" target="PhrasesBottom"><?php echo $p->phrase; ?></a></td>
<td><a href="view/<?php echo $p->phrase_id; ?>" target="PhrasesTop">Phrasentexte bearbeiten</a></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
</div>
</body>
</html>
<?php
$this->load->view('templates/header', array('title' => 'PhrasesList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '3:{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>App</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->app; ?></td>
<td><a href="edit/<?php echo $p->phrase_id; ?>" target="PhrasesBottom"><?php echo $p->phrase; ?></a></td>
<td><a href="view/<?php echo $p->phrase_id; ?>" target="PhrasesTop">Phrasentexte bearbeiten</a></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
</div>
</body>
</html>
@@ -0,0 +1,67 @@
<?php
$this->load->view('templates/header', array('title' => 'TemplateLinkDocuments', 'tablesort' => true, 'tableid' => 't1', 'sortList' => '2,1', 'headers' => '3:{sorter:false},4:{sorter:false}'));
?>
<script>
function addDocument(dokument_kurzbz)
{
var addDocumentDefault = document.getElementById("addDocumentDefault");
addDocumentDefault.selected = true;
$.post("../saveDocuments/"+<?=$vorlagestudiengang_id?>+"/"+dokument_kurzbz+"/0", function(answer)
{
window.location.href=window.location.href;
});
}
function delDocument(vorlagedokument_id)
{
$.post("../deleteDocumentLink/"+vorlagedokument_id, function(answer)
{
window.location.href=window.location.href;
});
}
function changeSort(vorlagedokument_id, sortnum)
{
$.post("../changeSort/"+vorlagedokument_id+"/"+sortnum, function(answer)
{
window.location.href=window.location.href;
});
}
</script>
<h2><?=$vorlagestudiengang_id?></h2>
<table id="t1" class="tablesorter">
<thead>
<tr>
<th>ID</th>
<th>Bezeichnung</th>
<th>Sortierung</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($documents as $d): ?>
<tr>
<td><?=$d->vorlagedokument_id?></td>
<td><?=$d->bezeichnung?></td>
<td> <?=$d->sort?></td>
<td><a onclick="changeSort('<?=$d->vorlagedokument_id?>', <?=$d->sort?>+1)"><img src="<?php echo APP_ROOT?>/skin/images/up.png"/></a> <a onclick="changeSort('<?=$d->vorlagedokument_id?>', <?=$d->sort?>-1)"><img src="<?php echo APP_ROOT?>/skin/images/down.png"/></a></td>
<td><a onclick="delDocument('<?=$d->vorlagedokument_id?>')">löschen</a></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<select>
<option selected="true" id="addDocumentDefault" disabled>Dokument hinzufuegen</option>
<?php foreach($allDocuments as $d): ?>
<option onclick="addDocument('<?=$d->dokument_kurzbz?>');"><?=$d->bezeichnung?></option>
<?php endforeach ;?>
</select>
</body>
</html>
+32 -32
View File
@@ -1,32 +1,32 @@
<?php
$this->load->view('templates/header', array('title' => 'TemplateEdit', 'jsoneditor' => true));
?>
<div class="row">
<div class="span4">
<h2>Vorlage: <?php echo $vorlage->vorlage_kurzbz; ?></h2>
<form method="post" action="../save">
Bezeichnung: <input type="text" name="bezeichnung" value="<?php echo $vorlage->bezeichnung; ?>" />
Anmerkung: <input type="text" name="anmerkung" value="<?php echo $vorlage->anmerkung; ?>" /><br/>
MimeType:<?php echo $this->templatelib->widget("mimetype_widget", array('mimetype' => $vorlage->mimetype)); ?>
Attribute: <?php echo $this->templatelib->widget("jsoneditor_widget", array('json' => $vorlage->attribute)); ?>
<input type="hidden" name="attribute" id="attribute" value="<?=$vorlage->attribute?>" />
<input type="hidden" name="vorlage_kurzbz" value="<?php echo $vorlage->vorlage_kurzbz; ?>" />
<button type="submit" onclick="getJSON(this.form);">Save</button>
</form>
</div>
</div>
<script type="text/javascript" >
// get json
function getJSON(form)
{
form.elements["attribute"].value = JSON.stringify(jsoneditor.get(), null, 2);
//alert(form.elements["attribute"].value);
}
</script>
</body>
</html>
<?php
$this->load->view('templates/header', array('title' => 'TemplateEdit', 'jsoneditor' => true));
?>
<div class="row">
<div class="span4">
<h2>Vorlage: <?php echo $vorlage->vorlage_kurzbz; ?></h2>
<form method="post" action="../save">
Bezeichnung: <input type="text" name="bezeichnung" value="<?php echo $vorlage->bezeichnung; ?>" />
Anmerkung: <input type="text" name="anmerkung" value="<?php echo $vorlage->anmerkung; ?>" /><br/>
MimeType:<?php echo $this->templatelib->widget("mimetype_widget", array('mimetype' => $vorlage->mimetype)); ?>
Attribute: <?php echo $this->templatelib->widget("jsoneditor_widget", array('json' => $vorlage->attribute)); ?>
<input type="hidden" name="attribute" id="attribute" value="<?=$vorlage->attribute?>" />
<input type="hidden" name="vorlage_kurzbz" value="<?php echo $vorlage->vorlage_kurzbz; ?>" />
<button type="submit" onclick="getJSON(this.form);">Save</button>
</form>
</div>
</div>
<script type="text/javascript" >
// get json
function getJSON(form)
{
form.elements["attribute"].value = JSON.stringify(jsoneditor.get(), null, 2);
//alert(form.elements["attribute"].value);
}
</script>
</body>
</html>
+38 -38
View File
@@ -1,38 +1,38 @@
<?php
$this->load->view('templates/header', array('title' => 'TemplatesList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '4:{sorter:false}'));
?>
<div class="row">
<div class="span4">
<h2>Vorlagen</h2>
<form method="post" action="">
MimeType
<?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'>Vorlage</th>
<th class='table-sortable:default'>Bezeichnung</th>
<th>Anmerkung</th><th>MimeType</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($vorlage as $v): ?>
<tr><td><a href="edit/<?php echo $v->vorlage_kurzbz; ?>" target="TemplatesBottom"><?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; ?>">Vorlagenexte bearbeiten</a></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
</div>
</body>
</html>
<?php
$this->load->view('templates/header', array('title' => 'TemplatesList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '4:{sorter:false}'));
?>
<div class="row">
<div class="span4">
<h2>Vorlagen</h2>
<form method="post" action="">
MimeType
<?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'>Vorlage</th>
<th class='table-sortable:default'>Bezeichnung</th>
<th>Anmerkung</th><th>MimeType</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($vorlage as $v): ?>
<tr><td><a href="edit/<?php echo $v->vorlage_kurzbz; ?>" target="TemplatesBottom"><?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; ?>">Vorlagenexte bearbeiten</a></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
</div>
</body>
</html>
+43 -43
View File
@@ -1,43 +1,43 @@
<?php
$this->load->view('templates/header', array('title' => 'TemplateEdit', 'tinymce' => true, 'jsonforms' => true));
?>
<div class="row">
<div class="span4">
<h2>Vorlagetext: <?=$vorlagestudiengang_id?></h2>
<!--StudiengangKZ: <?=$studiengang_kz?>-->
<form method="post" action="../saveText/<?=$vorlagestudiengang_id?>">
OE:<?php echo $this->templatelib->widget("organisationseinheit_widget", array('oe_kurzbz' => $oe_kurzbz, 'typ' => "'Erhalter','Studienzentrum','Studiengang','Lehrgang'")); ?>
Sprache:<?php echo $this->templatelib->widget("sprache_widget", array('sprache' => $sprache)); ?>
OrgForm:<?php echo $this->templatelib->widget("orgform_widget", array('orgform' => $orgform_kurzbz)); ?>
Version: <input type="text" name="version" value="<?php echo $version; ?>" size="1" />
Aktiv: <input type="text" name="aktiv" value="<?php echo $aktiv; ?>" size="1" />
<input type="hidden" name="vorlagestudiengang_id" value="<?php echo $vorlagestudiengang_id; ?>" />
<input type="hidden" name="studiengang_kz" value="<?php echo $studiengang_kz; ?>" />
<?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));
?>
<button type="submit">Save</button>
</form>
<hr/><h2>Preview-Data</h2>
<form method="post" action="../preview/<?=$vorlagestudiengang_id?>" target="TemplatePreview">
<?php echo $this->templatelib->widget("jsonforms_widget", array('id' => 'dataform', 'schema' => $schema)); ?>
<input type="hidden" name="formdata" id="formdata" value="" />
<button type="submit" onclick="getFormdata(this.form);">Preview</button>
</form>
</div>
</div>
<script type="text/javascript" >
// get json
function getFormdata(form)
{
form.elements["formdata"].value = JSON.stringify(bf.getData(), null, 2);
//alert(form.elements["formdata"].value);
}
</script>
<iframe name="TemplatePreview" width="100%" src=""/>
</body>
</html>
<?php
$this->load->view('templates/header', array('title' => 'TemplateEdit', 'tinymce' => true, 'jsonforms' => true));
?>
<div class="row">
<div class="span4">
<h2>Vorlagetext: <?=$vorlagestudiengang_id?></h2>
<!--StudiengangKZ: <?=$studiengang_kz?>-->
<form method="post" action="../saveText/<?=$vorlagestudiengang_id?>">
OE:<?php echo $this->templatelib->widget("organisationseinheit_widget", array('oe_kurzbz' => $oe_kurzbz, 'typ' => "'Erhalter','Studienzentrum','Studiengang','Lehrgang'")); ?>
Sprache:<?php echo $this->templatelib->widget("sprache_widget", array('sprache' => $sprache)); ?>
OrgForm:<?php echo $this->templatelib->widget("orgform_widget", array('orgform' => $orgform_kurzbz)); ?>
Version: <input type="text" name="version" value="<?php echo $version; ?>" size="1" />
Aktiv: <input type="text" name="aktiv" value="<?php echo $aktiv; ?>" size="1" />
<input type="hidden" name="vorlagestudiengang_id" value="<?php echo $vorlagestudiengang_id; ?>" />
<input type="hidden" name="studiengang_kz" value="<?php echo $studiengang_kz; ?>" />
<?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));
?>
<button type="submit">Save</button>
</form>
<hr/><h2>Preview-Data</h2>
<form method="post" action="../preview/<?=$vorlagestudiengang_id?>" target="TemplatePreview">
<?php echo $this->templatelib->widget("jsonforms_widget", array('id' => 'dataform', 'schema' => $schema)); ?>
<input type="hidden" name="formdata" id="formdata" value="" />
<button type="submit" onclick="getFormdata(this.form);">Preview</button>
</form>
</div>
</div>
<script type="text/javascript" >
// get json
function getFormdata(form)
{
form.elements["formdata"].value = JSON.stringify(bf.getData(), null, 2);
//alert(form.elements["formdata"].value);
}
</script>
<iframe name="TemplatePreview" width="100%" src=""/>
</body>
</html>
+50 -45
View File
@@ -1,45 +1,50 @@
<?php
$this->load->view('templates/header', array('title' => 'TemplatetextList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '7:{sorter:false}'));
?>
<div class="row">
<div class="span4">
<h2>Vorlagentext - <?php echo $vorlage_kurzbz; ?></h2>
<form method="post" action="../newtext" target="TemplatesBottom">
<input type="hidden" name="vorlage_kurzbz" value="<?php echo $vorlage_kurzbz; ?>"/>
<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'>Vorlage</th>
<th class='table-sortable:default'>Version</th>
<th class='table-sortable:default'>OrgEinheit</th>
<th class='table-sortable:default'>OrgForm</th>
<th class='table-sortable:default'>Berechtigung</th>
<th>Anmerkung</th><th>Aktiv</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($vorlagentext as $v): ?>
<tr><td><a href="../edittext/<?php echo $v->vorlagestudiengang_id; ?>" target="TemplatesBottom"><?php echo $v->vorlagestudiengang_id; ?></a></td>
<td><a href="../edittext/<?php echo $v->vorlagestudiengang_id; ?>" target="TemplatesBottom"><?php echo $v->vorlage_kurzbz; ?></a></td>
<td><?php echo $v->version; ?></td>
<td><?php echo $v->oe_kurzbz; ?></td>
<td></td>
<td><?php echo $v->berechtigung; ?></td>
<td><?php echo $v->anmerkung_vorlagestudiengang; ?></td>
<td><?php echo $v->aktiv; ?></td>
<td><a href="../editText/<?php echo $v->vorlagestudiengang_id; ?>" target="TemplatesBottom">Edit</a></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
</div>
<?php
$this->load->view('templates/footer');
?>
<?php
$this->load->view('templates/header', array('title' => 'TemplatetextList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '7:{sorter:false},8:{sorter:false},9:{sorter:false}'));
?>
<div class="row">
<div class="span4">
<h2>Vorlagentext - <?php echo $vorlage_kurzbz; ?></h2>
<form method="post" action="../newtext" target="TemplatesBottom">
<input type="hidden" name="vorlage_kurzbz" value="<?php echo $vorlage_kurzbz; ?>"/>
<button type="submit">Neu</button>
</form>
<table id="t1" class="tablesorter">
<thead>
<tr>
<th>ID</th>
<th>Vorlage</th>
<th>Version</th>
<th>OrgEinheit</th>
<th>OrgForm</th>
<th>Berechtigung</th>
<th>Anmerkung</th>
<th>Aktiv</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($vorlagentext as $v): ?>
<tr>
<td><a href="../edittext/<?php echo $v->vorlagestudiengang_id; ?>" target="TemplatesBottom"><?php echo $v->vorlagestudiengang_id; ?></a></td>
<td><a href="../edittext/<?php echo $v->vorlagestudiengang_id; ?>" target="TemplatesBottom"><?php echo $v->vorlage_kurzbz; ?></a></td>
<td><?php echo $v->version; ?></td>
<td><?php echo $v->oe_kurzbz; ?></td>
<td></td>
<td><?php echo $v->berechtigung; ?></td>
<td><?php echo $v->anmerkung_vorlagestudiengang; ?></td>
<td><?php echo $v->aktiv; ?></td>
<td><a href="../editText/<?php echo $v->vorlagestudiengang_id; ?>" target="TemplatesBottom">Edit Text</a></td>
<td><a href="../linkDocuments/<?php echo $v->vorlagestudiengang_id; ?>" target="TemplatesBottom">Edit Documents</a></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
</div>
<?php
$this->load->view('templates/footer');
?>
+498 -498
View File
@@ -1,498 +1,498 @@
<?php
/* Copyright (C) 2007 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
/**
* Verwaltet die Vorlagen fuer die Dokumentenerstellung
*/
require_once(dirname(__FILE__).'/basis_db.class.php');
require_once(dirname(__FILE__).'/organisationseinheit.class.php');
class vorlage extends basis_db
{
// ErgebnisArray
public $result=array();
public $num_rows=0;
public $errormsg;
public $new;
//Tabellenspalten
public $vorlage_kurzbz; // varchar(16)
public $studiengang_kz; // integer
public $version; // smallint
public $text; // text
public $mimetype; // varchar(64)
public $bezeichnung; // varchar(64)
public $anmerkung; // text
public $style; // text
public $berechtigung; // varchar(32)[]
public $oe_kurzbz; // varchar(32)
public $vorlagestudiengang_id; // bigint
public $anmerkung_vorlagestudiengang; // text
public $aktiv; // boolean
/**
* Konstruktor
*/
public function __construct()
{
parent::__construct();
}
/**
* Laedt eine Vorlage
* @param $vorlage_kurzbz
* @return true wenn ok, false im Fehlerfall
*/
public function loadVorlage($vorlage_kurzbz)
{
$qry = "SELECT * FROM public.tbl_vorlage WHERE vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz);
if($result = $this->db_query($qry))
{
if($row = $this->db_fetch_object($result))
{
$this->vorlage_kurzbz = $row->vorlage_kurzbz;
$this->bezeichnung = $row->bezeichnung;
$this->anmerkung = $row->anmerkung;
$this->mimetype = $row->mimetype;
return true;
}
else
{
$this->errormsg = 'Eintrag wurde nicht gefunden';
return false;
}
}
else
{
$this->errormsg = 'Fehler beim Laden der Daten';
return false;
}
}
/**
* Speichert eine Vorlage
* Wenn $new auf true gesetzt ist wird ein neuer Datensatz
* angelegt, ansonsten der Datensatz upgedated
* @return true wenn erfolgreich, false im Fehlerfall
*/
public function saveVorlage($new=null)
{
if(is_null($new))
$new = $this->new;
if($new)
{
$qry = "INSERT INTO public.tbl_vorlage(vorlage_kurzbz, bezeichnung, anmerkung, mimetype) VALUES(".
$this->db_add_param($this->vorlage_kurzbz).','.
$this->db_add_param($this->bezeichnung).','.
$this->db_add_param($this->anmerkung).','.
$this->db_add_param($this->mimetype).');';
}
else
{
$qry = 'UPDATE public.tbl_vorlage
SET bezeichnung='.$this->db_add_param($this->bezeichnung).',
anmerkung='.$this->db_add_param($this->anmerkung).',
mimetype='.$this->db_add_param($this->mimetype).'
WHERE vorlage_kurzbz='.$this->db_add_param($this->vorlage_kurzbz).';';
}
if($this->db_query($qry))
{
return true;
}
else
{
$this->errormsg = 'Fehler beim Speichern: '.$this->db_last_error();
return false;
}
}
/**
* Liefert alle Vorlagen
* @param $order Sortierreihenfolge. Default:vorlage_kurzbz
*/
public function getAllVorlagen($order='vorlage_kurzbz')
{
$qry ="SELECT * FROM public.tbl_vorlage ORDER BY ".$order.";";
if($result = $this->db_query($qry))
{
while($row = $this->db_fetch_object($result))
{
$obj = new vorlage();
$obj->vorlage_kurzbz = $row->vorlage_kurzbz;
$obj->bezeichnung = $row->bezeichnung;
$obj->anmerkung = $row->anmerkung;
$obj->mimetype = $row->mimetype;
$this->result[]= $obj;
}
}
else
return false;
}
/**
* Laedt die Vorlage zu einer OE
* @param $vorlage_kurzbz
* @return true wenn ok, false im Fehlerfall
*/
public function loadVorlageOE($vorlagestudiengang_id)
{
$qry = "SELECT * FROM public.tbl_vorlagestudiengang WHERE vorlagestudiengang_id=".$this->db_add_param($vorlagestudiengang_id);
if($result = $this->db_query($qry))
{
if($row = $this->db_fetch_object($result))
{
$this->vorlagestudiengang_id = $row->vorlagestudiengang_id;
$this->vorlage_kurzbz = $row->vorlage_kurzbz;
$this->studiengang_kz = $row->studiengang_kz;
$this->version = $row->version;
$this->text = $row->text;
$this->oe_kurzbz = $row->oe_kurzbz;
$this->style = $row->style;
$this->berechtigung = $row->berechtigung;
$this->anmerkung_vorlagestudiengang = $row->anmerkung_vorlagestudiengang;
$this->aktiv = $this->db_parse_bool($row->aktiv);
return true;
}
else
{
$this->errormsg = 'Eintrag wurde nicht gefunden';
return false;
}
}
else
{
$this->errormsg = 'Fehler beim Laden der Daten';
return false;
}
}
/**
* Laedt alle Versionen einer Vorlage
* @param $vorlage_kurzbz
* @param $oe_kurzbz Optional. Gibt nur die Vorlagen zu dieser OE aus.
* @return true wenn ok, false im Fehlerfall
*/
public function getAllVersions($vorlage_kurzbz=null, $oe_kurzbz=null)
{
$qry = "SELECT
*
FROM
public.tbl_vorlagestudiengang
WHERE
1=1";
if(!is_null($vorlage_kurzbz) && $vorlage_kurzbz!='')
{
$qry.=" AND vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz);
}
if(!is_null($oe_kurzbz) && $oe_kurzbz!='')
{
$qry.=" AND oe_kurzbz=".$this->db_add_param($oe_kurzbz);
}
if($result = $this->db_query($qry))
{
while($row = $this->db_fetch_object($result))
{
$obj = new vorlage();
$obj->vorlagestudiengang_id = $row->vorlagestudiengang_id;
$obj->vorlage_kurzbz = $row->vorlage_kurzbz;
$obj->studiengang_kz = $row->studiengang_kz;
$obj->version = $row->version;
$obj->text = $row->text;
$obj->oe_kurzbz = $row->oe_kurzbz;
$obj->style = $row->style;
$obj->berechtigung = $row->berechtigung;
$obj->anmerkung_vorlagestudiengang = $row->anmerkung_vorlagestudiengang;
$obj->aktiv = $this->db_parse_bool($row->aktiv);
$this->result[]= $obj;
}
}
else
{
$this->errormsg = 'Fehler beim Laden der Daten';
return false;
}
}
/**
* Liefert alle OEs, welche die $vorlage_kurzbz verwenden
* @param $vorlage_kurzbz Kurzbezeichnung der Vorlage
*/
public function getOEsFromVorlage($vorlage_kurzbz=null)
{
$qry ="SELECT DISTINCT
tbl_organisationseinheit.*
FROM
public.tbl_vorlagestudiengang
JOIN
public.tbl_organisationseinheit USING (oe_kurzbz)
WHERE
vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz)."
ORDER BY oe_kurzbz";
if($result = $this->db_query($qry))
{
while($row = $this->db_fetch_object($result))
{
$obj = new vorlage();
$obj->oe_kurzbz = $row->oe_kurzbz;
$obj->oe_parent_kurzbz = $row->oe_parent_kurzbz;
$obj->bezeichnung = $row->bezeichnung;
$obj->organisationseinheittyp_kurzbz = $row->organisationseinheittyp_kurzbz;
$obj->aktiv = $this->db_parse_bool($row->aktiv);
$obj->mailverteiler = $this->db_parse_bool($row->mailverteiler);
$obj->lehre = $this->db_parse_bool($row->lehre);
$this->result[]= $obj;
}
}
else
return false;
}
/**
* Speichert die Vorlage zu einer OE
* Wenn $new auf true gesetzt ist wird ein neuer Datensatz
* angelegt, ansonsten der Datensatz upgedated
* @return true wenn erfolgreich, false im Fehlerfall
*/
public function saveVorlageOE($new=null)
{
if($new == null)
$new = $this->new;
if($new)
{
$qry = "INSERT INTO public.tbl_vorlagestudiengang(vorlage_kurzbz,studiengang_kz,version,text,oe_kurzbz,style,berechtigung,anmerkung_vorlagestudiengang,aktiv) VALUES(".
$this->db_add_param($this->vorlage_kurzbz).','.
$this->db_add_param($this->studiengang_kz).','.
$this->db_add_param($this->version).','.
$this->db_add_param($this->text).','.
$this->db_add_param($this->oe_kurzbz).','.
$this->db_add_param($this->style).','.
$this->db_add_param($this->berechtigung).','.
$this->db_add_param($this->anmerkung_vorlagestudiengang).','.
$this->db_add_param($this->aktiv, FHC_BOOLEAN).');';
}
else
{
$qry = 'UPDATE public.tbl_vorlagestudiengang
SET vorlage_kurzbz='.$this->db_add_param($this->vorlage_kurzbz).',
studiengang_kz='.$this->db_add_param($this->studiengang_kz).',
version='.$this->db_add_param($this->version).',
text='.$this->db_add_param($this->text).',
oe_kurzbz='.$this->db_add_param($this->oe_kurzbz).',
style='.$this->db_add_param($this->style).',
berechtigung='.$this->db_add_param($this->berechtigung).',
aktiv='.$this->db_add_param($this->aktiv, FHC_BOOLEAN).',
anmerkung_vorlagestudiengang='.$this->db_add_param($this->anmerkung_vorlagestudiengang).'
WHERE vorlagestudiengang_id='.$this->db_add_param($this->vorlagestudiengang_id).';';
}
if($this->db_query($qry))
{
return true;
}
else
{
$this->errormsg = 'Fehler beim Speichern: '.$this->db_last_error();
return false;
}
}
/**
* Löscht die Vorlagestudiengagn
* @param type $vorlagestudiengang_id ID der Vorlage
*/
public function deleteVorlagestudiengang($vorlagestudiengang_id)
{
$qry = 'DELETE FROM public.tbl_vorlagestudiengang WHERE vorlagestudiengang_id='.$this->db_add_param($vorlagestudiengang_id).';';
if($this->db_query($qry))
{
return true;
}
else
{
$this->errormsg = 'Vorlage konnte nicht gelöscht werden';
return false;
}
}
/**
* Liefert die hoechste Version der Vorlage
*
* @param $oe_kurzbz Organisationseinheit der Vorlage
* @param $vorlage_kurzbz Name der Vorlage
*/
public function getMaxVersion($oe_kurzbz, $vorlage_kurzbz)
{
$qry = "SELECT
max(version) maxversion
FROM
public.tbl_vorlagestudiengang
WHERE
vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz)."
AND
oe_kurzbz=".$this->db_add_param($oe_kurzbz);
if($result = $this->db_query($qry))
{
if($row = $this->db_fetch_object($result))
return $row->maxversion;
else
return 0;
}
else
{
$this->errormsg='Fehler beim Ermitteln der hoechsten Version';
return false;
}
}
/**
* Liefert die aktuelle Vorlage
*
*
* @param $oe_kurzbz Organisationseinheit der Vorlage
* Fuer Kompatibilitaetszwecke kann hier statt der oe_kurzbz auch die Studiengangskennzahl uebergeben werden.
* In diesem Fall wird ein load der OE des Studiengangs durchgefhrt und die entsprechende OE verwendet.
* @param string $vorlage_kurzbz Name der Vorlage
* @param integer $version optional kann die Versionsnummer der Vorlage uebergeben werden
* @param boolean $aktiv default:true. Optional. Wenn false: werden nur inaktive Vorlagen geladen. Wenn null, werden alle Vorlagen geladen.
* @return boolean
*/
public function getAktuelleVorlage($oe_kurzbz, $vorlage_kurzbz, $version=null, $aktiv=true)
{
$studiengang_kz='';
if(is_numeric($oe_kurzbz))
{
$studiengang = new studiengang();
$studiengang->load($oe_kurzbz);
$oe_kurzbz=$studiengang->oe_kurzbz;
//Durch diese Bedingung wird die Abfrage der studiengang_kz im folgenden Abschnitt hinfaellig.
}
if($studiengang_kz!='') // Es sollte aktuell keine Vorlage mehr ueber die Studiengang_kz aufgerufen werden, da hier kein Fallback der OE erfolgt. Fuer Testzwecke bleibt das noch bestehen. Kindlm 11.09.2015
{
$qry = "SELECT
tbl_vorlagestudiengang.*, tbl_vorlage.mimetype, tbl_vorlage.bezeichnung
FROM
public.tbl_vorlagestudiengang
JOIN public.tbl_vorlage USING(vorlage_kurzbz)
WHERE
(studiengang_kz=0 OR studiengang_kz=".$this->db_add_param($studiengang_kz, FHC_INTEGER).") AND
vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz);
if(!is_null($version) && $version!='')
{
$qry.=" AND version=".$this->db_add_param($version, FHC_INTEGER);
}
if(!is_null($aktiv) && $aktiv!='')
{
$qry.=" AND aktiv=".$this->db_add_param($aktiv, FHC_BOOLEAN);
}
if($studiengang_kz<0) //Damit bei negativer studiengang_kz richtiges Ergebnis kommt
{
$qry .=" ORDER BY studiengang_kz ASC, version DESC LIMIT 1;";
}
else
{
$qry .=" ORDER BY studiengang_kz DESC, version DESC LIMIT 1;";
}
}
else
{
$qry = "SELECT
tbl_vorlagestudiengang.*, tbl_vorlage.mimetype, tbl_vorlage.bezeichnung
FROM
public.tbl_vorlagestudiengang
JOIN public.tbl_vorlage USING(vorlage_kurzbz)
WHERE oe_kurzbz=".$this->db_add_param($oe_kurzbz)."
AND vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz);
if(!is_null($version) && $version!='')
{
$qry.=" AND version=".$this->db_add_param($version, FHC_INTEGER);
}
if(!is_null($aktiv) && $aktiv!='')
{
$qry.=" AND aktiv=".$this->db_add_param($aktiv, FHC_BOOLEAN);
}
$qry.=" ORDER BY version DESC LIMIT 1";
}
if($this->db_query($qry))
{
if($row = $this->db_fetch_object())
{
$this->vorlage_kurzbz = $row->vorlage_kurzbz;
$this->studiengang_kz = $row->studiengang_kz;
$this->version = $row->version;
$this->text = $row->text;
$this->mimetype = $row->mimetype;
$this->bezeichnung = $row->bezeichnung;
$this->style = $row->style;
$this->berechtigung = $this->db_parse_array($row->berechtigung);
$this->anmerkung_vorlagestudiengang = $row->anmerkung_vorlagestudiengang;
$this->aktiv = $this->db_parse_bool($row->aktiv);
return true;
}
else
{
if($studiengang_kz!='')
{
$this->errormsg = 'Keine Vorlage gefunden';
return false;
}
else
{
//Wenn keine Vorlage zu dieser Organisationseinheit gefunden wurde,
//nachsehen ob fuer eine der uebergeordneten OEs eine Vorlage vorhanden ist.
$oe = new organisationseinheit();
$oe->load($oe_kurzbz);
if($oe->oe_parent_kurzbz!='')
{
return $this->getAktuelleVorlage($oe->oe_parent_kurzbz, $vorlage_kurzbz, $version, $aktiv);
}
else
{
$this->errormsg = 'Keine Vorlage gefunden';
return false;
}
}
}
}
else
{
$this->errormsg = 'Fehler beim Laden der Vorlage';
return false;
}
}
}
?>
<?php
/* Copyright (C) 2007 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
/**
* Verwaltet die Vorlagen fuer die Dokumentenerstellung
*/
require_once(dirname(__FILE__).'/basis_db.class.php');
require_once(dirname(__FILE__).'/organisationseinheit.class.php');
class vorlage extends basis_db
{
// ErgebnisArray
public $result=array();
public $num_rows=0;
public $errormsg;
public $new;
//Tabellenspalten
public $vorlage_kurzbz; // varchar(16)
public $studiengang_kz; // integer
public $version; // smallint
public $text; // text
public $mimetype; // varchar(64)
public $bezeichnung; // varchar(64)
public $anmerkung; // text
public $style; // text
public $berechtigung; // varchar(32)[]
public $oe_kurzbz; // varchar(32)
public $vorlagestudiengang_id; // bigint
public $anmerkung_vorlagestudiengang; // text
public $aktiv; // boolean
/**
* Konstruktor
*/
public function __construct()
{
parent::__construct();
}
/**
* Laedt eine Vorlage
* @param $vorlage_kurzbz
* @return true wenn ok, false im Fehlerfall
*/
public function loadVorlage($vorlage_kurzbz)
{
$qry = "SELECT * FROM public.tbl_vorlage WHERE vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz);
if($result = $this->db_query($qry))
{
if($row = $this->db_fetch_object($result))
{
$this->vorlage_kurzbz = $row->vorlage_kurzbz;
$this->bezeichnung = $row->bezeichnung;
$this->anmerkung = $row->anmerkung;
$this->mimetype = $row->mimetype;
return true;
}
else
{
$this->errormsg = 'Eintrag wurde nicht gefunden';
return false;
}
}
else
{
$this->errormsg = 'Fehler beim Laden der Daten';
return false;
}
}
/**
* Speichert eine Vorlage
* Wenn $new auf true gesetzt ist wird ein neuer Datensatz
* angelegt, ansonsten der Datensatz upgedated
* @return true wenn erfolgreich, false im Fehlerfall
*/
public function saveVorlage($new=null)
{
if(is_null($new))
$new = $this->new;
if($new)
{
$qry = "INSERT INTO public.tbl_vorlage(vorlage_kurzbz, bezeichnung, anmerkung, mimetype) VALUES(".
$this->db_add_param($this->vorlage_kurzbz).','.
$this->db_add_param($this->bezeichnung).','.
$this->db_add_param($this->anmerkung).','.
$this->db_add_param($this->mimetype).');';
}
else
{
$qry = 'UPDATE public.tbl_vorlage
SET bezeichnung='.$this->db_add_param($this->bezeichnung).',
anmerkung='.$this->db_add_param($this->anmerkung).',
mimetype='.$this->db_add_param($this->mimetype).'
WHERE vorlage_kurzbz='.$this->db_add_param($this->vorlage_kurzbz).';';
}
if($this->db_query($qry))
{
return true;
}
else
{
$this->errormsg = 'Fehler beim Speichern: '.$this->db_last_error();
return false;
}
}
/**
* Liefert alle Vorlagen
* @param $order Sortierreihenfolge. Default:vorlage_kurzbz
*/
public function getAllVorlagen($order='vorlage_kurzbz')
{
$qry ="SELECT * FROM public.tbl_vorlage ORDER BY ".$order.";";
if($result = $this->db_query($qry))
{
while($row = $this->db_fetch_object($result))
{
$obj = new vorlage();
$obj->vorlage_kurzbz = $row->vorlage_kurzbz;
$obj->bezeichnung = $row->bezeichnung;
$obj->anmerkung = $row->anmerkung;
$obj->mimetype = $row->mimetype;
$this->result[]= $obj;
}
}
else
return false;
}
/**
* Laedt die Vorlage zu einer OE
* @param $vorlage_kurzbz
* @return true wenn ok, false im Fehlerfall
*/
public function loadVorlageOE($vorlagestudiengang_id)
{
$qry = "SELECT * FROM public.tbl_vorlagestudiengang WHERE vorlagestudiengang_id=".$this->db_add_param($vorlagestudiengang_id);
if($result = $this->db_query($qry))
{
if($row = $this->db_fetch_object($result))
{
$this->vorlagestudiengang_id = $row->vorlagestudiengang_id;
$this->vorlage_kurzbz = $row->vorlage_kurzbz;
$this->studiengang_kz = $row->studiengang_kz;
$this->version = $row->version;
$this->text = $row->text;
$this->oe_kurzbz = $row->oe_kurzbz;
$this->style = $row->style;
$this->berechtigung = $row->berechtigung;
$this->anmerkung_vorlagestudiengang = $row->anmerkung_vorlagestudiengang;
$this->aktiv = $this->db_parse_bool($row->aktiv);
return true;
}
else
{
$this->errormsg = 'Eintrag wurde nicht gefunden';
return false;
}
}
else
{
$this->errormsg = 'Fehler beim Laden der Daten';
return false;
}
}
/**
* Laedt alle Versionen einer Vorlage
* @param $vorlage_kurzbz
* @param $oe_kurzbz Optional. Gibt nur die Vorlagen zu dieser OE aus.
* @return true wenn ok, false im Fehlerfall
*/
public function getAllVersions($vorlage_kurzbz=null, $oe_kurzbz=null)
{
$qry = "SELECT
*
FROM
public.tbl_vorlagestudiengang
WHERE
1=1";
if(!is_null($vorlage_kurzbz) && $vorlage_kurzbz!='')
{
$qry.=" AND vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz);
}
if(!is_null($oe_kurzbz) && $oe_kurzbz!='')
{
$qry.=" AND oe_kurzbz=".$this->db_add_param($oe_kurzbz);
}
if($result = $this->db_query($qry))
{
while($row = $this->db_fetch_object($result))
{
$obj = new vorlage();
$obj->vorlagestudiengang_id = $row->vorlagestudiengang_id;
$obj->vorlage_kurzbz = $row->vorlage_kurzbz;
$obj->studiengang_kz = $row->studiengang_kz;
$obj->version = $row->version;
$obj->text = $row->text;
$obj->oe_kurzbz = $row->oe_kurzbz;
$obj->style = $row->style;
$obj->berechtigung = $row->berechtigung;
$obj->anmerkung_vorlagestudiengang = $row->anmerkung_vorlagestudiengang;
$obj->aktiv = $this->db_parse_bool($row->aktiv);
$this->result[]= $obj;
}
}
else
{
$this->errormsg = 'Fehler beim Laden der Daten';
return false;
}
}
/**
* Liefert alle OEs, welche die $vorlage_kurzbz verwenden
* @param $vorlage_kurzbz Kurzbezeichnung der Vorlage
*/
public function getOEsFromVorlage($vorlage_kurzbz=null)
{
$qry ="SELECT DISTINCT
tbl_organisationseinheit.*
FROM
public.tbl_vorlagestudiengang
JOIN
public.tbl_organisationseinheit USING (oe_kurzbz)
WHERE
vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz)."
ORDER BY oe_kurzbz";
if($result = $this->db_query($qry))
{
while($row = $this->db_fetch_object($result))
{
$obj = new vorlage();
$obj->oe_kurzbz = $row->oe_kurzbz;
$obj->oe_parent_kurzbz = $row->oe_parent_kurzbz;
$obj->bezeichnung = $row->bezeichnung;
$obj->organisationseinheittyp_kurzbz = $row->organisationseinheittyp_kurzbz;
$obj->aktiv = $this->db_parse_bool($row->aktiv);
$obj->mailverteiler = $this->db_parse_bool($row->mailverteiler);
$obj->lehre = $this->db_parse_bool($row->lehre);
$this->result[]= $obj;
}
}
else
return false;
}
/**
* Speichert die Vorlage zu einer OE
* Wenn $new auf true gesetzt ist wird ein neuer Datensatz
* angelegt, ansonsten der Datensatz upgedated
* @return true wenn erfolgreich, false im Fehlerfall
*/
public function saveVorlageOE($new=null)
{
if($new == null)
$new = $this->new;
if($new)
{
$qry = "INSERT INTO public.tbl_vorlagestudiengang(vorlage_kurzbz,studiengang_kz,version,text,oe_kurzbz,style,berechtigung,anmerkung_vorlagestudiengang,aktiv) VALUES(".
$this->db_add_param($this->vorlage_kurzbz).','.
$this->db_add_param($this->studiengang_kz).','.
$this->db_add_param($this->version).','.
$this->db_add_param($this->text).','.
$this->db_add_param($this->oe_kurzbz).','.
$this->db_add_param($this->style).','.
$this->db_add_param($this->berechtigung).','.
$this->db_add_param($this->anmerkung_vorlagestudiengang).','.
$this->db_add_param($this->aktiv, FHC_BOOLEAN).');';
}
else
{
$qry = 'UPDATE public.tbl_vorlagestudiengang
SET vorlage_kurzbz='.$this->db_add_param($this->vorlage_kurzbz).',
studiengang_kz='.$this->db_add_param($this->studiengang_kz).',
version='.$this->db_add_param($this->version).',
text='.$this->db_add_param($this->text).',
oe_kurzbz='.$this->db_add_param($this->oe_kurzbz).',
style='.$this->db_add_param($this->style).',
berechtigung='.$this->db_add_param($this->berechtigung).',
aktiv='.$this->db_add_param($this->aktiv, FHC_BOOLEAN).',
anmerkung_vorlagestudiengang='.$this->db_add_param($this->anmerkung_vorlagestudiengang).'
WHERE vorlagestudiengang_id='.$this->db_add_param($this->vorlagestudiengang_id).';';
}
if($this->db_query($qry))
{
return true;
}
else
{
$this->errormsg = 'Fehler beim Speichern: '.$this->db_last_error();
return false;
}
}
/**
* Löscht die Vorlagestudiengagn
* @param type $vorlagestudiengang_id ID der Vorlage
*/
public function deleteVorlagestudiengang($vorlagestudiengang_id)
{
$qry = 'DELETE FROM public.tbl_vorlagestudiengang WHERE vorlagestudiengang_id='.$this->db_add_param($vorlagestudiengang_id).';';
if($this->db_query($qry))
{
return true;
}
else
{
$this->errormsg = 'Vorlage konnte nicht gelöscht werden';
return false;
}
}
/**
* Liefert die hoechste Version der Vorlage
*
* @param $oe_kurzbz Organisationseinheit der Vorlage
* @param $vorlage_kurzbz Name der Vorlage
*/
public function getMaxVersion($oe_kurzbz, $vorlage_kurzbz)
{
$qry = "SELECT
max(version) maxversion
FROM
public.tbl_vorlagestudiengang
WHERE
vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz)."
AND
oe_kurzbz=".$this->db_add_param($oe_kurzbz);
if($result = $this->db_query($qry))
{
if($row = $this->db_fetch_object($result))
return $row->maxversion;
else
return 0;
}
else
{
$this->errormsg='Fehler beim Ermitteln der hoechsten Version';
return false;
}
}
/**
* Liefert die aktuelle Vorlage
*
*
* @param $oe_kurzbz Organisationseinheit der Vorlage
* Fuer Kompatibilitaetszwecke kann hier statt der oe_kurzbz auch die Studiengangskennzahl uebergeben werden.
* In diesem Fall wird ein load der OE des Studiengangs durchgefhrt und die entsprechende OE verwendet.
* @param string $vorlage_kurzbz Name der Vorlage
* @param integer $version optional kann die Versionsnummer der Vorlage uebergeben werden
* @param boolean $aktiv default:true. Optional. Wenn false: werden nur inaktive Vorlagen geladen. Wenn null, werden alle Vorlagen geladen.
* @return boolean
*/
public function getAktuelleVorlage($oe_kurzbz, $vorlage_kurzbz, $version=null, $aktiv=true)
{
$studiengang_kz='';
if(is_numeric($oe_kurzbz))
{
$studiengang = new studiengang();
$studiengang->load($oe_kurzbz);
$oe_kurzbz=$studiengang->oe_kurzbz;
//Durch diese Bedingung wird die Abfrage der studiengang_kz im folgenden Abschnitt hinfaellig.
}
if($studiengang_kz!='') // Es sollte aktuell keine Vorlage mehr ueber die Studiengang_kz aufgerufen werden, da hier kein Fallback der OE erfolgt. Fuer Testzwecke bleibt das noch bestehen. Kindlm 11.09.2015
{
$qry = "SELECT
tbl_vorlagestudiengang.*, tbl_vorlage.mimetype, tbl_vorlage.bezeichnung
FROM
public.tbl_vorlagestudiengang
JOIN public.tbl_vorlage USING(vorlage_kurzbz)
WHERE
(studiengang_kz=0 OR studiengang_kz=".$this->db_add_param($studiengang_kz, FHC_INTEGER).") AND
vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz);
if(!is_null($version) && $version!='')
{
$qry.=" AND version=".$this->db_add_param($version, FHC_INTEGER);
}
if(!is_null($aktiv) && $aktiv!='')
{
$qry.=" AND aktiv=".$this->db_add_param($aktiv, FHC_BOOLEAN);
}
if($studiengang_kz<0) //Damit bei negativer studiengang_kz richtiges Ergebnis kommt
{
$qry .=" ORDER BY studiengang_kz ASC, version DESC LIMIT 1;";
}
else
{
$qry .=" ORDER BY studiengang_kz DESC, version DESC LIMIT 1;";
}
}
else
{
$qry = "SELECT
tbl_vorlagestudiengang.*, tbl_vorlage.mimetype, tbl_vorlage.bezeichnung
FROM
public.tbl_vorlagestudiengang
JOIN public.tbl_vorlage USING(vorlage_kurzbz)
WHERE oe_kurzbz=".$this->db_add_param($oe_kurzbz)."
AND vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz);
if(!is_null($version) && $version!='')
{
$qry.=" AND version=".$this->db_add_param($version, FHC_INTEGER);
}
if(!is_null($aktiv) && $aktiv!='')
{
$qry.=" AND aktiv=".$this->db_add_param($aktiv, FHC_BOOLEAN);
}
$qry.=" ORDER BY version DESC LIMIT 1";
}
if($this->db_query($qry))
{
if($row = $this->db_fetch_object())
{
$this->vorlage_kurzbz = $row->vorlage_kurzbz;
$this->studiengang_kz = $row->studiengang_kz;
$this->version = $row->version;
$this->text = $row->text;
$this->mimetype = $row->mimetype;
$this->bezeichnung = $row->bezeichnung;
$this->style = $row->style;
$this->berechtigung = $this->db_parse_array($row->berechtigung);
$this->anmerkung_vorlagestudiengang = $row->anmerkung_vorlagestudiengang;
$this->aktiv = $this->db_parse_bool($row->aktiv);
return true;
}
else
{
if($studiengang_kz!='')
{
$this->errormsg = 'Keine Vorlage gefunden';
return false;
}
else
{
//Wenn keine Vorlage zu dieser Organisationseinheit gefunden wurde,
//nachsehen ob fuer eine der uebergeordneten OEs eine Vorlage vorhanden ist.
$oe = new organisationseinheit();
$oe->load($oe_kurzbz);
if($oe->oe_parent_kurzbz!='')
{
return $this->getAktuelleVorlage($oe->oe_parent_kurzbz, $vorlage_kurzbz, $version, $aktiv);
}
else
{
$this->errormsg = 'Keine Vorlage gefunden';
return false;
}
}
}
}
else
{
$this->errormsg = 'Fehler beim Laden der Vorlage';
return false;
}
}
}
?>
+1 -1
View File
@@ -1313,7 +1313,7 @@ if($result = $db->db_query("SELECT * FROM public.tbl_vorlage WHERE vorlage_kurzb
$testQuery = "SELECT setval('seq_vorlagestudiengang_vorlagestudiengang_id', max(vorlagestudiengang_id)) FROM tbl_vorlagestudiengang;";
$testResult = $db->db_query($testQuery);
$text = file_get_contents('./system/xsl/Bewerberakt.xsl');
$text = file_get_contents('../system/xsl/Bewerberakt.xsl');
while($row = $db->db_fetch_object($result))
{