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_tag' => 'basis/tag',
'public.tbl_variable' => 'basis/variable', 'public.tbl_variable' => 'basis/variable',
'public.tbl_vorlage' => 'system/vorlage', 'public.tbl_vorlage' => 'system/vorlage',
'public.tbl_vorlagedokument' => 'system/vorlagestudiengang',
'public.tbl_vorlagestudiengang' => 'system/vorlagestudiengang', 'public.tbl_vorlagestudiengang' => 'system/vorlagestudiengang',
'public.tbl_rt_person' => 'basis/person', 'public.tbl_rt_person' => 'basis/person',
'public.vw_studiensemester' => 'basis/studiensemester', 'public.vw_studiensemester' => 'basis/studiensemester',
+38 -1
View File
@@ -42,7 +42,7 @@ class Templates extends FHC_Controller
$vorlagentext = $this->vorlagelib->getVorlagetextByVorlage($vorlage_kurzbz); $vorlagentext = $this->vorlagelib->getVorlagetextByVorlage($vorlage_kurzbz);
if ($vorlagentext->error) if ($vorlagentext->error)
show_error($vorlagentext->retval); show_error($vorlagentext->retval);
//var_dump($vorlage); //var_dump($vorlagentext);
$data = array $data = array
( (
@@ -128,6 +128,43 @@ class Templates extends FHC_Controller
$this->load->view('system/templatetextEdit', $data); $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() public function saveText()
{ {
$vorlagestudiengang_id = $this->input->post('vorlagestudiengang_id', TRUE); $vorlagestudiengang_id = $this->input->post('vorlagestudiengang_id', TRUE);
+1 -1
View File
@@ -217,4 +217,4 @@ class VorlageLib
$return->retval = $retval; $return->retval = $retval;
return $return; 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 <?php
$this->load->view('templates/header', array('title' => 'TemplateEdit', 'jquery' => true, 'textile' => true)); $this->load->view('templates/header', array('title' => 'TemplateEdit', 'jquery' => true, 'textile' => true));
?> ?>
<div class="row"> <div class="row">
<div class="span4"> <div class="span4">
<h2>Phrasentext: <?=$phrasentext_id?></h2> <h2>Phrasentext: <?=$phrasentext_id?></h2>
<form method="post" action="../saveText/<?=$phrasentext_id?>"> <form method="post" action="../saveText/<?=$phrasentext_id?>">
<input type="hidden" name="phrase_inhalt_id" value="<?php echo $phrasentext_id; ?>" /> <input type="hidden" name="phrase_inhalt_id" value="<?php echo $phrasentext_id; ?>" />
<table> <table>
<tr> <tr>
<td>OE</td> <td>OE</td>
<td><?php echo $this->templatelib->widget("organisationseinheit_widget", array('oe_kurzbz' => $orgeinheit_kurzbz)); ?></td> <td><?php echo $this->templatelib->widget("organisationseinheit_widget", array('oe_kurzbz' => $orgeinheit_kurzbz)); ?></td>
<td>Preview</td> <td>Preview</td>
</tr> </tr>
<tr><td>Orgform</td><td><?php echo $this->templatelib->widget("orgform_widget", array('orgform_kurzbz' => $orgform_kurzbz)); ?></td><td></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>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> <tr><td>Text</td><td><textarea name="text" style="width:500px; height:300px;" id="markitup"><?php echo $text ?></textarea></td>
<td valign="top"> <td valign="top">
<div id="textile-preview" style="width:500px; height:300px; border: 1px solid gray; overflow: auto;"></div> <div id="textile-preview" style="width:500px; height:300px; border: 1px solid gray; overflow: auto;"></div>
</td> </td>
</tr> </tr>
<tr><td>Beschreibung</td><td><textarea name="description" style="width:500px; height:100px;"><?php echo $description ?></textarea></td> <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/> <td><h3>Formatierung (Textile) Hilfe:</h3><br/>
<code> <code>
_emphasis_ _emphasis_
*strong* *strong*
??citation?? ??citation??
-deleted text- -deleted text-
+inserted text+ +inserted text+
^superscript^ ^superscript^
</code><br/> </code><br/>
<a href="https://warpedvisions.org/projects/textile-cheat-sheet/" target="_blank">Textile CheatSheet</a> <a href="https://warpedvisions.org/projects/textile-cheat-sheet/" target="_blank">Textile CheatSheet</a>
</td></tr> </td></tr>
<?php <?php
// This is an example to show that you can load stuff from inside the template file // 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)); //echo $this->templatelib->widget("tinymce_widget", array('name' => 'text', 'text' => $text));
?> ?>
<tr><td colspan="2" align="right"><button type="submit">Save</button></td></tr> <tr><td colspan="2" align="right"><button type="submit">Save</button></td></tr>
</table> </table>
</form> </form>
</div> </div>
</div> </div>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
initTextile(); initTextile();
}); });
function initTextile() { function initTextile() {
var $content = $('#markitup'); // my textarea var $content = $('#markitup'); // my textarea
var $preview = $('#textile-preview'); // the preview div var $preview = $('#textile-preview'); // the preview div
//$content.markItUp(); // init markitup //$content.markItUp(); // init markitup
// use a simple timer to check if the textarea content has changed // use a simple timer to check if the textarea content has changed
var value = $content.val(); var value = $content.val();
$preview.html(textile.convert(value)); $preview.html(textile.convert(value));
setInterval(function () { setInterval(function () {
var newValue = $content.val(); var newValue = $content.val();
if (value != newValue) { if (value != newValue) {
value = newValue; value = newValue;
$preview.html(textile.convert(newValue)); // convert the textile to html $preview.html(textile.convert(newValue)); // convert the textile to html
} }
}, 500); }, 500);
}; };
</script> </script>
<!-- <!--
<iframe name="TemplatePreview" width="100%" src=""/> <iframe name="TemplatePreview" width="100%" src=""/>
--> -->
</body> </body>
</html> </html>
+38 -38
View File
@@ -1,38 +1,38 @@
<?php <?php
$this->load->view('templates/header', array('title' => 'PhrasesList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '3:{sorter:false}')); $this->load->view('templates/header', array('title' => 'PhrasesList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '3:{sorter:false}'));
?> ?>
<div class="row"> <div class="row">
<div class="span4"> <div class="span4">
<h2>Phrasen</h2> <h2>Phrasen</h2>
<!-- <!--
<form method="post" action=""> <form method="post" action="">
App: aufnahme App: aufnahme
<?php <?php
// This is an example to show that you can load stuff from inside the template file // 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)); //echo $this->templatelib->widget("mimetype_widget", array('mimetype' => $mimetype));
?> ?>
<button type="submit">Filter</button> <button type="submit">Filter</button>
</form> </form>
--> -->
<table id="t1" class="tablesorter"> <table id="t1" class="tablesorter">
<thead> <thead>
<tr><th class='table-sortable:default'>ID</th> <tr><th class='table-sortable:default'>ID</th>
<th>App</th> <th>App</th>
<th class='table-sortable:default'>Phrase</th> <th class='table-sortable:default'>Phrase</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($phrases as $p): ?> <?php foreach ($phrases as $p): ?>
<tr><td><a href="edit/<?php echo $p->phrase_id; ?>" target="PhrasesBottom"><?php echo $p->phrase_id; ?></a></td> <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><?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="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> <td><a href="view/<?php echo $p->phrase_id; ?>" target="PhrasesTop">Phrasentexte bearbeiten</a></td>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</body> </body>
</html> </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 <?php
$this->load->view('templates/header', array('title' => 'TemplateEdit', 'jsoneditor' => true)); $this->load->view('templates/header', array('title' => 'TemplateEdit', 'jsoneditor' => true));
?> ?>
<div class="row"> <div class="row">
<div class="span4"> <div class="span4">
<h2>Vorlage: <?php echo $vorlage->vorlage_kurzbz; ?></h2> <h2>Vorlage: <?php echo $vorlage->vorlage_kurzbz; ?></h2>
<form method="post" action="../save"> <form method="post" action="../save">
Bezeichnung: <input type="text" name="bezeichnung" value="<?php echo $vorlage->bezeichnung; ?>" /> Bezeichnung: <input type="text" name="bezeichnung" value="<?php echo $vorlage->bezeichnung; ?>" />
Anmerkung: <input type="text" name="anmerkung" value="<?php echo $vorlage->anmerkung; ?>" /><br/> Anmerkung: <input type="text" name="anmerkung" value="<?php echo $vorlage->anmerkung; ?>" /><br/>
MimeType:<?php echo $this->templatelib->widget("mimetype_widget", array('mimetype' => $vorlage->mimetype)); ?> MimeType:<?php echo $this->templatelib->widget("mimetype_widget", array('mimetype' => $vorlage->mimetype)); ?>
Attribute: <?php echo $this->templatelib->widget("jsoneditor_widget", array('json' => $vorlage->attribute)); ?> 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="attribute" id="attribute" value="<?=$vorlage->attribute?>" />
<input type="hidden" name="vorlage_kurzbz" value="<?php echo $vorlage->vorlage_kurzbz; ?>" /> <input type="hidden" name="vorlage_kurzbz" value="<?php echo $vorlage->vorlage_kurzbz; ?>" />
<button type="submit" onclick="getJSON(this.form);">Save</button> <button type="submit" onclick="getJSON(this.form);">Save</button>
</form> </form>
</div> </div>
</div> </div>
<script type="text/javascript" > <script type="text/javascript" >
// get json // get json
function getJSON(form) function getJSON(form)
{ {
form.elements["attribute"].value = JSON.stringify(jsoneditor.get(), null, 2); form.elements["attribute"].value = JSON.stringify(jsoneditor.get(), null, 2);
//alert(form.elements["attribute"].value); //alert(form.elements["attribute"].value);
} }
</script> </script>
</body> </body>
</html> </html>
+38 -38
View File
@@ -1,38 +1,38 @@
<?php <?php
$this->load->view('templates/header', array('title' => 'TemplatesList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '4:{sorter:false}')); $this->load->view('templates/header', array('title' => 'TemplatesList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '4:{sorter:false}'));
?> ?>
<div class="row"> <div class="row">
<div class="span4"> <div class="span4">
<h2>Vorlagen</h2> <h2>Vorlagen</h2>
<form method="post" action=""> <form method="post" action="">
MimeType MimeType
<?php <?php
// This is an example to show that you can load stuff from inside the template file // 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)); echo $this->templatelib->widget("mimetype_widget", array('mimetype' => $mimetype));
?> ?>
<button type="submit">Filter</button> <button type="submit">Filter</button>
</form> </form>
<table id="t1" class="tablesorter"> <table id="t1" class="tablesorter">
<thead> <thead>
<tr><th class='table-sortable:default'>Vorlage</th> <tr><th class='table-sortable:default'>Vorlage</th>
<th class='table-sortable:default'>Bezeichnung</th> <th class='table-sortable:default'>Bezeichnung</th>
<th>Anmerkung</th><th>MimeType</th> <th>Anmerkung</th><th>MimeType</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($vorlage as $v): ?> <?php foreach ($vorlage as $v): ?>
<tr><td><a href="edit/<?php echo $v->vorlage_kurzbz; ?>" target="TemplatesBottom"><?php echo $v->vorlage_kurzbz; ?></a></td> <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->bezeichnung; ?></td>
<td><?php echo $v->anmerkung; ?></td> <td><?php echo $v->anmerkung; ?></td>
<td><?php echo $v->mimetype; ?></td> <td><?php echo $v->mimetype; ?></td>
<td><a href="view/<?php echo $v->vorlage_kurzbz; ?>">Vorlagenexte bearbeiten</a></td> <td><a href="view/<?php echo $v->vorlage_kurzbz; ?>">Vorlagenexte bearbeiten</a></td>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</body> </body>
</html> </html>
+43 -43
View File
@@ -1,43 +1,43 @@
<?php <?php
$this->load->view('templates/header', array('title' => 'TemplateEdit', 'tinymce' => true, 'jsonforms' => true)); $this->load->view('templates/header', array('title' => 'TemplateEdit', 'tinymce' => true, 'jsonforms' => true));
?> ?>
<div class="row"> <div class="row">
<div class="span4"> <div class="span4">
<h2>Vorlagetext: <?=$vorlagestudiengang_id?></h2> <h2>Vorlagetext: <?=$vorlagestudiengang_id?></h2>
<!--StudiengangKZ: <?=$studiengang_kz?>--> <!--StudiengangKZ: <?=$studiengang_kz?>-->
<form method="post" action="../saveText/<?=$vorlagestudiengang_id?>"> <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'")); ?> 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)); ?> Sprache:<?php echo $this->templatelib->widget("sprache_widget", array('sprache' => $sprache)); ?>
OrgForm:<?php echo $this->templatelib->widget("orgform_widget", array('orgform' => $orgform_kurzbz)); ?> OrgForm:<?php echo $this->templatelib->widget("orgform_widget", array('orgform' => $orgform_kurzbz)); ?>
Version: <input type="text" name="version" value="<?php echo $version; ?>" size="1" /> Version: <input type="text" name="version" value="<?php echo $version; ?>" size="1" />
Aktiv: <input type="text" name="aktiv" value="<?php echo $aktiv; ?>" 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="vorlagestudiengang_id" value="<?php echo $vorlagestudiengang_id; ?>" />
<input type="hidden" name="studiengang_kz" value="<?php echo $studiengang_kz; ?>" /> <input type="hidden" name="studiengang_kz" value="<?php echo $studiengang_kz; ?>" />
<?php <?php
// This is an example to show that you can load stuff from inside the template file // 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)); echo $this->templatelib->widget("tinymce_widget", array('name' => 'text', 'text' => $text));
?> ?>
<button type="submit">Save</button> <button type="submit">Save</button>
</form> </form>
<hr/><h2>Preview-Data</h2> <hr/><h2>Preview-Data</h2>
<form method="post" action="../preview/<?=$vorlagestudiengang_id?>" target="TemplatePreview"> <form method="post" action="../preview/<?=$vorlagestudiengang_id?>" target="TemplatePreview">
<?php echo $this->templatelib->widget("jsonforms_widget", array('id' => 'dataform', 'schema' => $schema)); ?> <?php echo $this->templatelib->widget("jsonforms_widget", array('id' => 'dataform', 'schema' => $schema)); ?>
<input type="hidden" name="formdata" id="formdata" value="" /> <input type="hidden" name="formdata" id="formdata" value="" />
<button type="submit" onclick="getFormdata(this.form);">Preview</button> <button type="submit" onclick="getFormdata(this.form);">Preview</button>
</form> </form>
</div> </div>
</div> </div>
<script type="text/javascript" > <script type="text/javascript" >
// get json // get json
function getFormdata(form) function getFormdata(form)
{ {
form.elements["formdata"].value = JSON.stringify(bf.getData(), null, 2); form.elements["formdata"].value = JSON.stringify(bf.getData(), null, 2);
//alert(form.elements["formdata"].value); //alert(form.elements["formdata"].value);
} }
</script> </script>
<iframe name="TemplatePreview" width="100%" src=""/> <iframe name="TemplatePreview" width="100%" src=""/>
</body> </body>
</html> </html>
+50 -45
View File
@@ -1,45 +1,50 @@
<?php <?php
$this->load->view('templates/header', array('title' => 'TemplatetextList', 'tablesort' => true, 'tableid' => 't1', 'headers' => '7:{sorter:false}')); $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="row">
<div class="span4"> <div class="span4">
<h2>Vorlagentext - <?php echo $vorlage_kurzbz; ?></h2> <h2>Vorlagentext - <?php echo $vorlage_kurzbz; ?></h2>
<form method="post" action="../newtext" target="TemplatesBottom"> <form method="post" action="../newtext" target="TemplatesBottom">
<input type="hidden" name="vorlage_kurzbz" value="<?php echo $vorlage_kurzbz; ?>"/> <input type="hidden" name="vorlage_kurzbz" value="<?php echo $vorlage_kurzbz; ?>"/>
<button type="submit">Neu</button> <button type="submit">Neu</button>
</form> </form>
<table id="t1" class="tablesorter"> <table id="t1" class="tablesorter">
<thead> <thead>
<tr><th class='table-sortable:default'>ID</th> <tr>
<th class='table-sortable:default'>Vorlage</th> <th>ID</th>
<th class='table-sortable:default'>Version</th> <th>Vorlage</th>
<th class='table-sortable:default'>OrgEinheit</th> <th>Version</th>
<th class='table-sortable:default'>OrgForm</th> <th>OrgEinheit</th>
<th class='table-sortable:default'>Berechtigung</th> <th>OrgForm</th>
<th>Anmerkung</th><th>Aktiv</th> <th>Berechtigung</th>
<th></th> <th>Anmerkung</th>
</tr> <th>Aktiv</th>
</thead> <th></th>
<tbody> <th></th>
<?php foreach ($vorlagentext as $v): ?> </tr>
<tr><td><a href="../edittext/<?php echo $v->vorlagestudiengang_id; ?>" target="TemplatesBottom"><?php echo $v->vorlagestudiengang_id; ?></a></td> </thead>
<td><a href="../edittext/<?php echo $v->vorlagestudiengang_id; ?>" target="TemplatesBottom"><?php echo $v->vorlage_kurzbz; ?></a></td> <tbody>
<td><?php echo $v->version; ?></td> <?php foreach ($vorlagentext as $v): ?>
<td><?php echo $v->oe_kurzbz; ?></td> <tr>
<td></td> <td><a href="../edittext/<?php echo $v->vorlagestudiengang_id; ?>" target="TemplatesBottom"><?php echo $v->vorlagestudiengang_id; ?></a></td>
<td><?php echo $v->berechtigung; ?></td> <td><a href="../edittext/<?php echo $v->vorlagestudiengang_id; ?>" target="TemplatesBottom"><?php echo $v->vorlage_kurzbz; ?></a></td>
<td><?php echo $v->anmerkung_vorlagestudiengang; ?></td> <td><?php echo $v->version; ?></td>
<td><?php echo $v->aktiv; ?></td> <td><?php echo $v->oe_kurzbz; ?></td>
<td><a href="../editText/<?php echo $v->vorlagestudiengang_id; ?>" target="TemplatesBottom">Edit</a></td> <td></td>
</tr> <td><?php echo $v->berechtigung; ?></td>
<?php endforeach ?> <td><?php echo $v->anmerkung_vorlagestudiengang; ?></td>
</tbody> <td><?php echo $v->aktiv; ?></td>
</table> <td><a href="../editText/<?php echo $v->vorlagestudiengang_id; ?>" target="TemplatesBottom">Edit Text</a></td>
</div> <td><a href="../linkDocuments/<?php echo $v->vorlagestudiengang_id; ?>" target="TemplatesBottom">Edit Documents</a></td>
</div> </tr>
<?php endforeach ?>
<?php </tbody>
$this->load->view('templates/footer'); </table>
?> </div>
</div>
<?php
$this->load->view('templates/footer');
?>
+498 -498
View File
@@ -1,498 +1,498 @@
<?php <?php
/* Copyright (C) 2007 Technikum-Wien /* Copyright (C) 2007 Technikum-Wien
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as * it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* Authors: Christian Paminger <[email protected]>, * Authors: Christian Paminger <[email protected]>,
* Andreas Oesterreicher <[email protected]> and * Andreas Oesterreicher <[email protected]> and
* Rudolf Hangl <[email protected]>. * Rudolf Hangl <[email protected]>.
*/ */
/** /**
* Verwaltet die Vorlagen fuer die Dokumentenerstellung * Verwaltet die Vorlagen fuer die Dokumentenerstellung
*/ */
require_once(dirname(__FILE__).'/basis_db.class.php'); require_once(dirname(__FILE__).'/basis_db.class.php');
require_once(dirname(__FILE__).'/organisationseinheit.class.php'); require_once(dirname(__FILE__).'/organisationseinheit.class.php');
class vorlage extends basis_db class vorlage extends basis_db
{ {
// ErgebnisArray // ErgebnisArray
public $result=array(); public $result=array();
public $num_rows=0; public $num_rows=0;
public $errormsg; public $errormsg;
public $new; public $new;
//Tabellenspalten //Tabellenspalten
public $vorlage_kurzbz; // varchar(16) public $vorlage_kurzbz; // varchar(16)
public $studiengang_kz; // integer public $studiengang_kz; // integer
public $version; // smallint public $version; // smallint
public $text; // text public $text; // text
public $mimetype; // varchar(64) public $mimetype; // varchar(64)
public $bezeichnung; // varchar(64) public $bezeichnung; // varchar(64)
public $anmerkung; // text public $anmerkung; // text
public $style; // text public $style; // text
public $berechtigung; // varchar(32)[] public $berechtigung; // varchar(32)[]
public $oe_kurzbz; // varchar(32) public $oe_kurzbz; // varchar(32)
public $vorlagestudiengang_id; // bigint public $vorlagestudiengang_id; // bigint
public $anmerkung_vorlagestudiengang; // text public $anmerkung_vorlagestudiengang; // text
public $aktiv; // boolean public $aktiv; // boolean
/** /**
* Konstruktor * Konstruktor
*/ */
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
} }
/** /**
* Laedt eine Vorlage * Laedt eine Vorlage
* @param $vorlage_kurzbz * @param $vorlage_kurzbz
* @return true wenn ok, false im Fehlerfall * @return true wenn ok, false im Fehlerfall
*/ */
public function loadVorlage($vorlage_kurzbz) public function loadVorlage($vorlage_kurzbz)
{ {
$qry = "SELECT * FROM public.tbl_vorlage WHERE vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz); $qry = "SELECT * FROM public.tbl_vorlage WHERE vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz);
if($result = $this->db_query($qry)) if($result = $this->db_query($qry))
{ {
if($row = $this->db_fetch_object($result)) if($row = $this->db_fetch_object($result))
{ {
$this->vorlage_kurzbz = $row->vorlage_kurzbz; $this->vorlage_kurzbz = $row->vorlage_kurzbz;
$this->bezeichnung = $row->bezeichnung; $this->bezeichnung = $row->bezeichnung;
$this->anmerkung = $row->anmerkung; $this->anmerkung = $row->anmerkung;
$this->mimetype = $row->mimetype; $this->mimetype = $row->mimetype;
return true; return true;
} }
else else
{ {
$this->errormsg = 'Eintrag wurde nicht gefunden'; $this->errormsg = 'Eintrag wurde nicht gefunden';
return false; return false;
} }
} }
else else
{ {
$this->errormsg = 'Fehler beim Laden der Daten'; $this->errormsg = 'Fehler beim Laden der Daten';
return false; return false;
} }
} }
/** /**
* Speichert eine Vorlage * Speichert eine Vorlage
* Wenn $new auf true gesetzt ist wird ein neuer Datensatz * Wenn $new auf true gesetzt ist wird ein neuer Datensatz
* angelegt, ansonsten der Datensatz upgedated * angelegt, ansonsten der Datensatz upgedated
* @return true wenn erfolgreich, false im Fehlerfall * @return true wenn erfolgreich, false im Fehlerfall
*/ */
public function saveVorlage($new=null) public function saveVorlage($new=null)
{ {
if(is_null($new)) if(is_null($new))
$new = $this->new; $new = $this->new;
if($new) if($new)
{ {
$qry = "INSERT INTO public.tbl_vorlage(vorlage_kurzbz, bezeichnung, anmerkung, mimetype) VALUES(". $qry = "INSERT INTO public.tbl_vorlage(vorlage_kurzbz, bezeichnung, anmerkung, mimetype) VALUES(".
$this->db_add_param($this->vorlage_kurzbz).','. $this->db_add_param($this->vorlage_kurzbz).','.
$this->db_add_param($this->bezeichnung).','. $this->db_add_param($this->bezeichnung).','.
$this->db_add_param($this->anmerkung).','. $this->db_add_param($this->anmerkung).','.
$this->db_add_param($this->mimetype).');'; $this->db_add_param($this->mimetype).');';
} }
else else
{ {
$qry = 'UPDATE public.tbl_vorlage $qry = 'UPDATE public.tbl_vorlage
SET bezeichnung='.$this->db_add_param($this->bezeichnung).', SET bezeichnung='.$this->db_add_param($this->bezeichnung).',
anmerkung='.$this->db_add_param($this->anmerkung).', anmerkung='.$this->db_add_param($this->anmerkung).',
mimetype='.$this->db_add_param($this->mimetype).' mimetype='.$this->db_add_param($this->mimetype).'
WHERE vorlage_kurzbz='.$this->db_add_param($this->vorlage_kurzbz).';'; WHERE vorlage_kurzbz='.$this->db_add_param($this->vorlage_kurzbz).';';
} }
if($this->db_query($qry)) if($this->db_query($qry))
{ {
return true; return true;
} }
else else
{ {
$this->errormsg = 'Fehler beim Speichern: '.$this->db_last_error(); $this->errormsg = 'Fehler beim Speichern: '.$this->db_last_error();
return false; return false;
} }
} }
/** /**
* Liefert alle Vorlagen * Liefert alle Vorlagen
* @param $order Sortierreihenfolge. Default:vorlage_kurzbz * @param $order Sortierreihenfolge. Default:vorlage_kurzbz
*/ */
public function getAllVorlagen($order='vorlage_kurzbz') public function getAllVorlagen($order='vorlage_kurzbz')
{ {
$qry ="SELECT * FROM public.tbl_vorlage ORDER BY ".$order.";"; $qry ="SELECT * FROM public.tbl_vorlage ORDER BY ".$order.";";
if($result = $this->db_query($qry)) if($result = $this->db_query($qry))
{ {
while($row = $this->db_fetch_object($result)) while($row = $this->db_fetch_object($result))
{ {
$obj = new vorlage(); $obj = new vorlage();
$obj->vorlage_kurzbz = $row->vorlage_kurzbz; $obj->vorlage_kurzbz = $row->vorlage_kurzbz;
$obj->bezeichnung = $row->bezeichnung; $obj->bezeichnung = $row->bezeichnung;
$obj->anmerkung = $row->anmerkung; $obj->anmerkung = $row->anmerkung;
$obj->mimetype = $row->mimetype; $obj->mimetype = $row->mimetype;
$this->result[]= $obj; $this->result[]= $obj;
} }
} }
else else
return false; return false;
} }
/** /**
* Laedt die Vorlage zu einer OE * Laedt die Vorlage zu einer OE
* @param $vorlage_kurzbz * @param $vorlage_kurzbz
* @return true wenn ok, false im Fehlerfall * @return true wenn ok, false im Fehlerfall
*/ */
public function loadVorlageOE($vorlagestudiengang_id) public function loadVorlageOE($vorlagestudiengang_id)
{ {
$qry = "SELECT * FROM public.tbl_vorlagestudiengang WHERE vorlagestudiengang_id=".$this->db_add_param($vorlagestudiengang_id); $qry = "SELECT * FROM public.tbl_vorlagestudiengang WHERE vorlagestudiengang_id=".$this->db_add_param($vorlagestudiengang_id);
if($result = $this->db_query($qry)) if($result = $this->db_query($qry))
{ {
if($row = $this->db_fetch_object($result)) if($row = $this->db_fetch_object($result))
{ {
$this->vorlagestudiengang_id = $row->vorlagestudiengang_id; $this->vorlagestudiengang_id = $row->vorlagestudiengang_id;
$this->vorlage_kurzbz = $row->vorlage_kurzbz; $this->vorlage_kurzbz = $row->vorlage_kurzbz;
$this->studiengang_kz = $row->studiengang_kz; $this->studiengang_kz = $row->studiengang_kz;
$this->version = $row->version; $this->version = $row->version;
$this->text = $row->text; $this->text = $row->text;
$this->oe_kurzbz = $row->oe_kurzbz; $this->oe_kurzbz = $row->oe_kurzbz;
$this->style = $row->style; $this->style = $row->style;
$this->berechtigung = $row->berechtigung; $this->berechtigung = $row->berechtigung;
$this->anmerkung_vorlagestudiengang = $row->anmerkung_vorlagestudiengang; $this->anmerkung_vorlagestudiengang = $row->anmerkung_vorlagestudiengang;
$this->aktiv = $this->db_parse_bool($row->aktiv); $this->aktiv = $this->db_parse_bool($row->aktiv);
return true; return true;
} }
else else
{ {
$this->errormsg = 'Eintrag wurde nicht gefunden'; $this->errormsg = 'Eintrag wurde nicht gefunden';
return false; return false;
} }
} }
else else
{ {
$this->errormsg = 'Fehler beim Laden der Daten'; $this->errormsg = 'Fehler beim Laden der Daten';
return false; return false;
} }
} }
/** /**
* Laedt alle Versionen einer Vorlage * Laedt alle Versionen einer Vorlage
* @param $vorlage_kurzbz * @param $vorlage_kurzbz
* @param $oe_kurzbz Optional. Gibt nur die Vorlagen zu dieser OE aus. * @param $oe_kurzbz Optional. Gibt nur die Vorlagen zu dieser OE aus.
* @return true wenn ok, false im Fehlerfall * @return true wenn ok, false im Fehlerfall
*/ */
public function getAllVersions($vorlage_kurzbz=null, $oe_kurzbz=null) public function getAllVersions($vorlage_kurzbz=null, $oe_kurzbz=null)
{ {
$qry = "SELECT $qry = "SELECT
* *
FROM FROM
public.tbl_vorlagestudiengang public.tbl_vorlagestudiengang
WHERE WHERE
1=1"; 1=1";
if(!is_null($vorlage_kurzbz) && $vorlage_kurzbz!='') if(!is_null($vorlage_kurzbz) && $vorlage_kurzbz!='')
{ {
$qry.=" AND vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz); $qry.=" AND vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz);
} }
if(!is_null($oe_kurzbz) && $oe_kurzbz!='') if(!is_null($oe_kurzbz) && $oe_kurzbz!='')
{ {
$qry.=" AND oe_kurzbz=".$this->db_add_param($oe_kurzbz); $qry.=" AND oe_kurzbz=".$this->db_add_param($oe_kurzbz);
} }
if($result = $this->db_query($qry)) if($result = $this->db_query($qry))
{ {
while($row = $this->db_fetch_object($result)) while($row = $this->db_fetch_object($result))
{ {
$obj = new vorlage(); $obj = new vorlage();
$obj->vorlagestudiengang_id = $row->vorlagestudiengang_id; $obj->vorlagestudiengang_id = $row->vorlagestudiengang_id;
$obj->vorlage_kurzbz = $row->vorlage_kurzbz; $obj->vorlage_kurzbz = $row->vorlage_kurzbz;
$obj->studiengang_kz = $row->studiengang_kz; $obj->studiengang_kz = $row->studiengang_kz;
$obj->version = $row->version; $obj->version = $row->version;
$obj->text = $row->text; $obj->text = $row->text;
$obj->oe_kurzbz = $row->oe_kurzbz; $obj->oe_kurzbz = $row->oe_kurzbz;
$obj->style = $row->style; $obj->style = $row->style;
$obj->berechtigung = $row->berechtigung; $obj->berechtigung = $row->berechtigung;
$obj->anmerkung_vorlagestudiengang = $row->anmerkung_vorlagestudiengang; $obj->anmerkung_vorlagestudiengang = $row->anmerkung_vorlagestudiengang;
$obj->aktiv = $this->db_parse_bool($row->aktiv); $obj->aktiv = $this->db_parse_bool($row->aktiv);
$this->result[]= $obj; $this->result[]= $obj;
} }
} }
else else
{ {
$this->errormsg = 'Fehler beim Laden der Daten'; $this->errormsg = 'Fehler beim Laden der Daten';
return false; return false;
} }
} }
/** /**
* Liefert alle OEs, welche die $vorlage_kurzbz verwenden * Liefert alle OEs, welche die $vorlage_kurzbz verwenden
* @param $vorlage_kurzbz Kurzbezeichnung der Vorlage * @param $vorlage_kurzbz Kurzbezeichnung der Vorlage
*/ */
public function getOEsFromVorlage($vorlage_kurzbz=null) public function getOEsFromVorlage($vorlage_kurzbz=null)
{ {
$qry ="SELECT DISTINCT $qry ="SELECT DISTINCT
tbl_organisationseinheit.* tbl_organisationseinheit.*
FROM FROM
public.tbl_vorlagestudiengang public.tbl_vorlagestudiengang
JOIN JOIN
public.tbl_organisationseinheit USING (oe_kurzbz) public.tbl_organisationseinheit USING (oe_kurzbz)
WHERE WHERE
vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz)." vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz)."
ORDER BY oe_kurzbz"; ORDER BY oe_kurzbz";
if($result = $this->db_query($qry)) if($result = $this->db_query($qry))
{ {
while($row = $this->db_fetch_object($result)) while($row = $this->db_fetch_object($result))
{ {
$obj = new vorlage(); $obj = new vorlage();
$obj->oe_kurzbz = $row->oe_kurzbz; $obj->oe_kurzbz = $row->oe_kurzbz;
$obj->oe_parent_kurzbz = $row->oe_parent_kurzbz; $obj->oe_parent_kurzbz = $row->oe_parent_kurzbz;
$obj->bezeichnung = $row->bezeichnung; $obj->bezeichnung = $row->bezeichnung;
$obj->organisationseinheittyp_kurzbz = $row->organisationseinheittyp_kurzbz; $obj->organisationseinheittyp_kurzbz = $row->organisationseinheittyp_kurzbz;
$obj->aktiv = $this->db_parse_bool($row->aktiv); $obj->aktiv = $this->db_parse_bool($row->aktiv);
$obj->mailverteiler = $this->db_parse_bool($row->mailverteiler); $obj->mailverteiler = $this->db_parse_bool($row->mailverteiler);
$obj->lehre = $this->db_parse_bool($row->lehre); $obj->lehre = $this->db_parse_bool($row->lehre);
$this->result[]= $obj; $this->result[]= $obj;
} }
} }
else else
return false; return false;
} }
/** /**
* Speichert die Vorlage zu einer OE * Speichert die Vorlage zu einer OE
* Wenn $new auf true gesetzt ist wird ein neuer Datensatz * Wenn $new auf true gesetzt ist wird ein neuer Datensatz
* angelegt, ansonsten der Datensatz upgedated * angelegt, ansonsten der Datensatz upgedated
* @return true wenn erfolgreich, false im Fehlerfall * @return true wenn erfolgreich, false im Fehlerfall
*/ */
public function saveVorlageOE($new=null) public function saveVorlageOE($new=null)
{ {
if($new == null) if($new == null)
$new = $this->new; $new = $this->new;
if($new) if($new)
{ {
$qry = "INSERT INTO public.tbl_vorlagestudiengang(vorlage_kurzbz,studiengang_kz,version,text,oe_kurzbz,style,berechtigung,anmerkung_vorlagestudiengang,aktiv) VALUES(". $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->vorlage_kurzbz).','.
$this->db_add_param($this->studiengang_kz).','. $this->db_add_param($this->studiengang_kz).','.
$this->db_add_param($this->version).','. $this->db_add_param($this->version).','.
$this->db_add_param($this->text).','. $this->db_add_param($this->text).','.
$this->db_add_param($this->oe_kurzbz).','. $this->db_add_param($this->oe_kurzbz).','.
$this->db_add_param($this->style).','. $this->db_add_param($this->style).','.
$this->db_add_param($this->berechtigung).','. $this->db_add_param($this->berechtigung).','.
$this->db_add_param($this->anmerkung_vorlagestudiengang).','. $this->db_add_param($this->anmerkung_vorlagestudiengang).','.
$this->db_add_param($this->aktiv, FHC_BOOLEAN).');'; $this->db_add_param($this->aktiv, FHC_BOOLEAN).');';
} }
else else
{ {
$qry = 'UPDATE public.tbl_vorlagestudiengang $qry = 'UPDATE public.tbl_vorlagestudiengang
SET vorlage_kurzbz='.$this->db_add_param($this->vorlage_kurzbz).', SET vorlage_kurzbz='.$this->db_add_param($this->vorlage_kurzbz).',
studiengang_kz='.$this->db_add_param($this->studiengang_kz).', studiengang_kz='.$this->db_add_param($this->studiengang_kz).',
version='.$this->db_add_param($this->version).', version='.$this->db_add_param($this->version).',
text='.$this->db_add_param($this->text).', text='.$this->db_add_param($this->text).',
oe_kurzbz='.$this->db_add_param($this->oe_kurzbz).', oe_kurzbz='.$this->db_add_param($this->oe_kurzbz).',
style='.$this->db_add_param($this->style).', style='.$this->db_add_param($this->style).',
berechtigung='.$this->db_add_param($this->berechtigung).', berechtigung='.$this->db_add_param($this->berechtigung).',
aktiv='.$this->db_add_param($this->aktiv, FHC_BOOLEAN).', aktiv='.$this->db_add_param($this->aktiv, FHC_BOOLEAN).',
anmerkung_vorlagestudiengang='.$this->db_add_param($this->anmerkung_vorlagestudiengang).' anmerkung_vorlagestudiengang='.$this->db_add_param($this->anmerkung_vorlagestudiengang).'
WHERE vorlagestudiengang_id='.$this->db_add_param($this->vorlagestudiengang_id).';'; WHERE vorlagestudiengang_id='.$this->db_add_param($this->vorlagestudiengang_id).';';
} }
if($this->db_query($qry)) if($this->db_query($qry))
{ {
return true; return true;
} }
else else
{ {
$this->errormsg = 'Fehler beim Speichern: '.$this->db_last_error(); $this->errormsg = 'Fehler beim Speichern: '.$this->db_last_error();
return false; return false;
} }
} }
/** /**
* Löscht die Vorlagestudiengagn * Löscht die Vorlagestudiengagn
* @param type $vorlagestudiengang_id ID der Vorlage * @param type $vorlagestudiengang_id ID der Vorlage
*/ */
public function deleteVorlagestudiengang($vorlagestudiengang_id) public function deleteVorlagestudiengang($vorlagestudiengang_id)
{ {
$qry = 'DELETE FROM public.tbl_vorlagestudiengang WHERE vorlagestudiengang_id='.$this->db_add_param($vorlagestudiengang_id).';'; $qry = 'DELETE FROM public.tbl_vorlagestudiengang WHERE vorlagestudiengang_id='.$this->db_add_param($vorlagestudiengang_id).';';
if($this->db_query($qry)) if($this->db_query($qry))
{ {
return true; return true;
} }
else else
{ {
$this->errormsg = 'Vorlage konnte nicht gelöscht werden'; $this->errormsg = 'Vorlage konnte nicht gelöscht werden';
return false; return false;
} }
} }
/** /**
* Liefert die hoechste Version der Vorlage * Liefert die hoechste Version der Vorlage
* *
* @param $oe_kurzbz Organisationseinheit der Vorlage * @param $oe_kurzbz Organisationseinheit der Vorlage
* @param $vorlage_kurzbz Name der Vorlage * @param $vorlage_kurzbz Name der Vorlage
*/ */
public function getMaxVersion($oe_kurzbz, $vorlage_kurzbz) public function getMaxVersion($oe_kurzbz, $vorlage_kurzbz)
{ {
$qry = "SELECT $qry = "SELECT
max(version) maxversion max(version) maxversion
FROM FROM
public.tbl_vorlagestudiengang public.tbl_vorlagestudiengang
WHERE WHERE
vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz)." vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz)."
AND AND
oe_kurzbz=".$this->db_add_param($oe_kurzbz); oe_kurzbz=".$this->db_add_param($oe_kurzbz);
if($result = $this->db_query($qry)) if($result = $this->db_query($qry))
{ {
if($row = $this->db_fetch_object($result)) if($row = $this->db_fetch_object($result))
return $row->maxversion; return $row->maxversion;
else else
return 0; return 0;
} }
else else
{ {
$this->errormsg='Fehler beim Ermitteln der hoechsten Version'; $this->errormsg='Fehler beim Ermitteln der hoechsten Version';
return false; return false;
} }
} }
/** /**
* Liefert die aktuelle Vorlage * Liefert die aktuelle Vorlage
* *
* *
* @param $oe_kurzbz Organisationseinheit der Vorlage * @param $oe_kurzbz Organisationseinheit der Vorlage
* Fuer Kompatibilitaetszwecke kann hier statt der oe_kurzbz auch die Studiengangskennzahl uebergeben werden. * 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. * In diesem Fall wird ein load der OE des Studiengangs durchgefhrt und die entsprechende OE verwendet.
* @param string $vorlage_kurzbz Name der Vorlage * @param string $vorlage_kurzbz Name der Vorlage
* @param integer $version optional kann die Versionsnummer der Vorlage uebergeben werden * @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. * @param boolean $aktiv default:true. Optional. Wenn false: werden nur inaktive Vorlagen geladen. Wenn null, werden alle Vorlagen geladen.
* @return boolean * @return boolean
*/ */
public function getAktuelleVorlage($oe_kurzbz, $vorlage_kurzbz, $version=null, $aktiv=true) public function getAktuelleVorlage($oe_kurzbz, $vorlage_kurzbz, $version=null, $aktiv=true)
{ {
$studiengang_kz=''; $studiengang_kz='';
if(is_numeric($oe_kurzbz)) if(is_numeric($oe_kurzbz))
{ {
$studiengang = new studiengang(); $studiengang = new studiengang();
$studiengang->load($oe_kurzbz); $studiengang->load($oe_kurzbz);
$oe_kurzbz=$studiengang->oe_kurzbz; $oe_kurzbz=$studiengang->oe_kurzbz;
//Durch diese Bedingung wird die Abfrage der studiengang_kz im folgenden Abschnitt hinfaellig. //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 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 $qry = "SELECT
tbl_vorlagestudiengang.*, tbl_vorlage.mimetype, tbl_vorlage.bezeichnung tbl_vorlagestudiengang.*, tbl_vorlage.mimetype, tbl_vorlage.bezeichnung
FROM FROM
public.tbl_vorlagestudiengang public.tbl_vorlagestudiengang
JOIN public.tbl_vorlage USING(vorlage_kurzbz) JOIN public.tbl_vorlage USING(vorlage_kurzbz)
WHERE WHERE
(studiengang_kz=0 OR studiengang_kz=".$this->db_add_param($studiengang_kz, FHC_INTEGER).") AND (studiengang_kz=0 OR studiengang_kz=".$this->db_add_param($studiengang_kz, FHC_INTEGER).") AND
vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz); vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz);
if(!is_null($version) && $version!='') if(!is_null($version) && $version!='')
{ {
$qry.=" AND version=".$this->db_add_param($version, FHC_INTEGER); $qry.=" AND version=".$this->db_add_param($version, FHC_INTEGER);
} }
if(!is_null($aktiv) && $aktiv!='') if(!is_null($aktiv) && $aktiv!='')
{ {
$qry.=" AND aktiv=".$this->db_add_param($aktiv, FHC_BOOLEAN); $qry.=" AND aktiv=".$this->db_add_param($aktiv, FHC_BOOLEAN);
} }
if($studiengang_kz<0) //Damit bei negativer studiengang_kz richtiges Ergebnis kommt if($studiengang_kz<0) //Damit bei negativer studiengang_kz richtiges Ergebnis kommt
{ {
$qry .=" ORDER BY studiengang_kz ASC, version DESC LIMIT 1;"; $qry .=" ORDER BY studiengang_kz ASC, version DESC LIMIT 1;";
} }
else else
{ {
$qry .=" ORDER BY studiengang_kz DESC, version DESC LIMIT 1;"; $qry .=" ORDER BY studiengang_kz DESC, version DESC LIMIT 1;";
} }
} }
else else
{ {
$qry = "SELECT $qry = "SELECT
tbl_vorlagestudiengang.*, tbl_vorlage.mimetype, tbl_vorlage.bezeichnung tbl_vorlagestudiengang.*, tbl_vorlage.mimetype, tbl_vorlage.bezeichnung
FROM FROM
public.tbl_vorlagestudiengang public.tbl_vorlagestudiengang
JOIN public.tbl_vorlage USING(vorlage_kurzbz) JOIN public.tbl_vorlage USING(vorlage_kurzbz)
WHERE oe_kurzbz=".$this->db_add_param($oe_kurzbz)." WHERE oe_kurzbz=".$this->db_add_param($oe_kurzbz)."
AND vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz); AND vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz);
if(!is_null($version) && $version!='') if(!is_null($version) && $version!='')
{ {
$qry.=" AND version=".$this->db_add_param($version, FHC_INTEGER); $qry.=" AND version=".$this->db_add_param($version, FHC_INTEGER);
} }
if(!is_null($aktiv) && $aktiv!='') if(!is_null($aktiv) && $aktiv!='')
{ {
$qry.=" AND aktiv=".$this->db_add_param($aktiv, FHC_BOOLEAN); $qry.=" AND aktiv=".$this->db_add_param($aktiv, FHC_BOOLEAN);
} }
$qry.=" ORDER BY version DESC LIMIT 1"; $qry.=" ORDER BY version DESC LIMIT 1";
} }
if($this->db_query($qry)) if($this->db_query($qry))
{ {
if($row = $this->db_fetch_object()) if($row = $this->db_fetch_object())
{ {
$this->vorlage_kurzbz = $row->vorlage_kurzbz; $this->vorlage_kurzbz = $row->vorlage_kurzbz;
$this->studiengang_kz = $row->studiengang_kz; $this->studiengang_kz = $row->studiengang_kz;
$this->version = $row->version; $this->version = $row->version;
$this->text = $row->text; $this->text = $row->text;
$this->mimetype = $row->mimetype; $this->mimetype = $row->mimetype;
$this->bezeichnung = $row->bezeichnung; $this->bezeichnung = $row->bezeichnung;
$this->style = $row->style; $this->style = $row->style;
$this->berechtigung = $this->db_parse_array($row->berechtigung); $this->berechtigung = $this->db_parse_array($row->berechtigung);
$this->anmerkung_vorlagestudiengang = $row->anmerkung_vorlagestudiengang; $this->anmerkung_vorlagestudiengang = $row->anmerkung_vorlagestudiengang;
$this->aktiv = $this->db_parse_bool($row->aktiv); $this->aktiv = $this->db_parse_bool($row->aktiv);
return true; return true;
} }
else else
{ {
if($studiengang_kz!='') if($studiengang_kz!='')
{ {
$this->errormsg = 'Keine Vorlage gefunden'; $this->errormsg = 'Keine Vorlage gefunden';
return false; return false;
} }
else else
{ {
//Wenn keine Vorlage zu dieser Organisationseinheit gefunden wurde, //Wenn keine Vorlage zu dieser Organisationseinheit gefunden wurde,
//nachsehen ob fuer eine der uebergeordneten OEs eine Vorlage vorhanden ist. //nachsehen ob fuer eine der uebergeordneten OEs eine Vorlage vorhanden ist.
$oe = new organisationseinheit(); $oe = new organisationseinheit();
$oe->load($oe_kurzbz); $oe->load($oe_kurzbz);
if($oe->oe_parent_kurzbz!='') if($oe->oe_parent_kurzbz!='')
{ {
return $this->getAktuelleVorlage($oe->oe_parent_kurzbz, $vorlage_kurzbz, $version, $aktiv); return $this->getAktuelleVorlage($oe->oe_parent_kurzbz, $vorlage_kurzbz, $version, $aktiv);
} }
else else
{ {
$this->errormsg = 'Keine Vorlage gefunden'; $this->errormsg = 'Keine Vorlage gefunden';
return false; return false;
} }
} }
} }
} }
else else
{ {
$this->errormsg = 'Fehler beim Laden der Vorlage'; $this->errormsg = 'Fehler beim Laden der Vorlage';
return false; 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;"; $testQuery = "SELECT setval('seq_vorlagestudiengang_vorlagestudiengang_id', max(vorlagestudiengang_id)) FROM tbl_vorlagestudiengang;";
$testResult = $db->db_query($testQuery); $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)) while($row = $db->db_fetch_object($result))
{ {