mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Berechtigungen hinzugefuegt; Code bereinigt
This commit is contained in:
+94
-22
@@ -442,42 +442,114 @@ class dokument extends basis_db
|
||||
}
|
||||
|
||||
/**
|
||||
* fügt ein Dokument einem Studiengang hinzu
|
||||
* @param dokument_kurzbz
|
||||
* stg_kz
|
||||
* onlinebewerbung true, wenn für Online-Bewerbung relevant
|
||||
* @return true wenn ok false im Fehlerfall
|
||||
* Laedt die Dokument Studiengang Zuordnung
|
||||
*
|
||||
* @param $dokument_kurzbz
|
||||
* @param $studiengang_kz
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function addDokument($dokument_kurzbz, $stg_kz, $onlinebewerbung=true)
|
||||
public function loadDokumentStudiengang($dokument_kurzbz, $studiengang_kz)
|
||||
{
|
||||
//Prüfung, ob Eintrag bereits vorhanden
|
||||
$qry='SELECT dokument_kurzbz FROM public.tbl_dokumentstudiengang
|
||||
WHERE dokument_kurzbz='.$this->db_add_param($dokument_kurzbz).' AND studiengang_kz='.$this->db_add_param($stg_kz,FHC_INTEGER);
|
||||
if($this->db_query($qry))
|
||||
$qry="SELECT * FROM public.tbl_dokumentstudiengang
|
||||
WHERE
|
||||
studiengang_kz=".$this->db_add_param($studiengang_kz)."
|
||||
AND dokument_kurzbz=".$this->db_add_param($dokument_kurzbz);
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($this->db_fetch_object())
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$this->errormsg = 'Eintrag bereits vorhanden';
|
||||
$this->dokument_kurzbz = $row->dokument_kurzbz;
|
||||
$this->studiengang_kz = $row->studiengang_kz;
|
||||
$this->onlinebewerbung = $this->db_parse_bool($row->onlinebewerbung);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prueft ob die Zuordnung Dokument zu Studiengang bereits vorhanden ist
|
||||
* @param $dokument_kurzbz
|
||||
* @parma $studiengang_kz
|
||||
* @return true wenn vorhanden, false wenn nicht vorhanden
|
||||
*/
|
||||
public function existsDokumentStudiengang($dokument_kurzbz, $studiengang_kz)
|
||||
{
|
||||
$qry='SELECT
|
||||
dokument_kurzbz
|
||||
FROM
|
||||
public.tbl_dokumentstudiengang
|
||||
WHERE
|
||||
dokument_kurzbz='.$this->db_add_param($dokument_kurzbz).'
|
||||
AND studiengang_kz='.$this->db_add_param($studiengang_kz,FHC_INTEGER);
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($this->db_num_rows($result)>0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Durchführen der Datenbankabfrage';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry='INSERT INTO public.tbl_dokumentstudiengang (dokument_kurzbz, studiengang_kz, onlinebewerbung)
|
||||
VALUES ('.
|
||||
$this->db_add_param($dokument_kurzbz).','.
|
||||
$this->db_add_param($stg_kz,FHC_INTEGER).','.
|
||||
$this->db_add_param($onlinebewerbung,FHC_BOOLEAN).')';
|
||||
|
||||
$this->db_query($qry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Speichert die Zuordnung Dokument zu Studiengang
|
||||
* @return true wenn ok false im Fehlerfall
|
||||
*/
|
||||
public function saveDokumentStudiengang()
|
||||
{
|
||||
if(!$this->existsDokumentStudiengang($this->dokument_kurzbz, $this->studiengang_kz))
|
||||
{
|
||||
$qry='INSERT INTO public.tbl_dokumentstudiengang (dokument_kurzbz, studiengang_kz, onlinebewerbung)
|
||||
VALUES ('.
|
||||
$this->db_add_param($this->dokument_kurzbz).','.
|
||||
$this->db_add_param($this->studiengang_kz,FHC_INTEGER).','.
|
||||
$this->db_add_param($this->onlinebewerbung,FHC_BOOLEAN).')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry = 'UPDATE public.tbl_dokumentstudiengang SET
|
||||
onlinebewerbung='.$this->db_add_param($this->onlinebewerbung,FHC_BOOLEAN).'
|
||||
WHERE
|
||||
dokument_kurzbz='.$this->db_add_param($this->dokument_kurzbz).'
|
||||
AND studiengang_kz='.$this->db_add_param($this->studiengang_kz);
|
||||
}
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern der Zuordnung';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt einen Dokumenttyp
|
||||
* @param $dokument_kurzbz
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function loadDokumenttyp($dokument_kurzbz)
|
||||
{
|
||||
$qry="Select * FROM public.tbl_dokument where dokument_kurzbz =".$this->db_add_param($dokument_kurzbz).";";
|
||||
$qry="SELECT * FROM public.tbl_dokument
|
||||
WHERE dokument_kurzbz =".$this->db_add_param($dokument_kurzbz).";";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
@@ -535,4 +607,4 @@ class dokument extends basis_db
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2014 fhcomplete.org
|
||||
*
|
||||
@@ -22,10 +21,11 @@
|
||||
* Authors: Martin Tatzber <tatzberm@technikum-wien.at>
|
||||
*
|
||||
*/
|
||||
|
||||
require_once('../../config/vilesci.config.inc.php');
|
||||
require_once('../../include/functions.inc.php');
|
||||
require_once('../../include/studiengang.class.php');
|
||||
require_once('../../include/dokument.class.php');
|
||||
require_once('../../include/benutzerberechtigung.class.php');
|
||||
|
||||
$stg_kz=isset($_REQUEST['stg_kz'])?$_REQUEST['stg_kz']:'';
|
||||
$dokument_kurzbz=isset($_REQUEST['dokument_kurzbz'])?$_REQUEST['dokument_kurzbz']:'';
|
||||
@@ -37,12 +37,22 @@ if(isset($_POST['add']))
|
||||
if(isset($_POST['saveDoc']))
|
||||
$action='saveDoc';
|
||||
|
||||
$uid = get_uid();
|
||||
$rechte = new benutzerberechtigung();
|
||||
$rechte->getBerechtigungen($uid);
|
||||
|
||||
if(!$rechte->isBerechtigt('basis/studiengang', $stg_kz, 'suid'))
|
||||
die('Sie haben keine Berechtigung für diese Seite');
|
||||
|
||||
if($action=='add')
|
||||
{
|
||||
if($dokument_kurzbz != '' && $stg_kz != '')
|
||||
{
|
||||
$dokument=new dokument();
|
||||
$dokument->addDokument($dokument_kurzbz, $stg_kz, $onlinebewerbung);
|
||||
$dokument->dokument_kurzbz = $dokument_kurzbz;
|
||||
$dokument->studiengang_kz = $stg_kz;
|
||||
$dokument->onlinebewerbung = $onlinebewerbung;
|
||||
$dokument->saveDokumentStudiengang();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +66,22 @@ if($action=='delete')
|
||||
}
|
||||
}
|
||||
|
||||
if($action =='toggleonline')
|
||||
{
|
||||
if($dokument_kurzbz != '' && $stg_kz != '')
|
||||
{
|
||||
$dokument=new dokument();
|
||||
if($dokument->loadDokumentStudiengang($dokument_kurzbz, $stg_kz))
|
||||
{
|
||||
$dokument->onlinebewerbung = !$dokument->onlinebewerbung;
|
||||
if(!$dokument->saveDokumentStudiengang())
|
||||
echo $dokument->errormsg;
|
||||
}
|
||||
else
|
||||
echo 'Zuordnung ist nicht vorhanden';
|
||||
}
|
||||
}
|
||||
|
||||
if($action=='saveDoc')
|
||||
{
|
||||
$dokBezeichnung=isset($_POST['dokument_bezeichnung'])?$_POST['dokument_bezeichnung']:'';
|
||||
@@ -100,7 +126,7 @@ $output .= '</select>
|
||||
|
||||
if($stg_kz!='')
|
||||
{
|
||||
$output .= '<table>
|
||||
$output .= '<table id="t1" class="tablesorter">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Dokumentname</th>
|
||||
@@ -111,50 +137,52 @@ if($stg_kz!='')
|
||||
<tbody>';
|
||||
$dokStg=new dokument();
|
||||
$dokStg->getDokumente($stg_kz);
|
||||
$zugewieseneDokumente=array();
|
||||
foreach($dokStg->result as $dok)
|
||||
{
|
||||
$checked=$dok->onlinebewerbung?' checked':'';
|
||||
$zugewieseneDokumente[]=$dok->dokument_kurzbz;
|
||||
$checked=$dok->onlinebewerbung?'true':'false';
|
||||
$output .= '<tr>
|
||||
<td>'.$dok->bezeichnung.'</td>
|
||||
<td><input type="checkbox"'.$checked.'></td>
|
||||
<td><a href="'.$_SERVER['PHP_SELF'].'?action=toggleonline&dokument_kurzbz='.$dok->dokument_kurzbz.'&stg_kz='.$stg_kz.'"><img src="../../skin/images/'.$checked.'.png" /></a></td>
|
||||
<td><a href="'.$_SERVER['PHP_SELF'].'?action=delete&dokument_kurzbz='.$dok->dokument_kurzbz.'&stg_kz='.$stg_kz.'">Zuordnung löschen</a></td>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
$output .= '
|
||||
<tr>
|
||||
<td>-</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td><select name="dokument_kurzbz">';
|
||||
$dokAll=new dokument();
|
||||
$dokAll->getAllDokumente();
|
||||
foreach($dokAll->result as $dok)
|
||||
{
|
||||
$output .= '<option value="'.$dok->dokument_kurzbz.'">'.$dok->bezeichnung.'</option>';
|
||||
if(!in_array($dok->dokument_kurzbz,$zugewieseneDokumente))
|
||||
$output .= '<option value="'.$dok->dokument_kurzbz.'">'.$dok->bezeichnung.'</option>';
|
||||
}
|
||||
$output .= '</select></td>
|
||||
<td><input type="checkbox" name="onlinebewerbung" checked></td>
|
||||
<td><input type="submit" name="add" value="Hinzufügen"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</tfoot>
|
||||
</table>
|
||||
<input type="submit" name="add" value="Hinzufügen">
|
||||
|
||||
</form>
|
||||
<br/>
|
||||
<br/>
|
||||
<input type="button" onclick="showDocumentForm()" value="neues Dokument erstellen">
|
||||
<input type="button" onclick="showDocumentForm()" value="neuen Dokumenttyp erstellen">
|
||||
<div id="documentForm" style="visibility:hidden">
|
||||
<form action="'.$_SERVER['PHP_SELF'].'" method="post">
|
||||
<input type="hidden" name="stg_kz" value="'.$stg_kz.'">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Kurzbezeichnung</td>
|
||||
<td><input type="text" id="dokument_kurzbz" name="dokument_kurzbz"></td>
|
||||
<td><input type="text" id="dokument_kurzbz" name="dokument_kurzbz" maxlength="8" size="8"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Bezeichnung</td>
|
||||
<td><input type="text" id="dokument_bezeichnung" name="dokument_bezeichnung"></td>
|
||||
<td><input type="text" id="dokument_bezeichnung" name="dokument_bezeichnung" maxlength="128"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="submit" name="saveDoc" value="Speichern">
|
||||
@@ -165,16 +193,23 @@ else
|
||||
$output .= '</form>';
|
||||
|
||||
|
||||
echo '
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
echo '<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link href="../../skin/vilesci.css" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" href="../../skin/tablesort.css" type="text/css">
|
||||
<script type="text/javascript" src="../../include/js/jquery.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function()
|
||||
{
|
||||
$("#t1").tablesorter();
|
||||
$("#t1").tablesorter(
|
||||
{
|
||||
sortList: [[0,0]],
|
||||
widgets: ["zebra"],
|
||||
headers: {2:{sorter:false}}
|
||||
});
|
||||
});
|
||||
|
||||
function showDocumentForm(dokument_kurzbz="",bezeichnung="",neu=true)
|
||||
@@ -185,16 +220,11 @@ echo '
|
||||
if(!neu)
|
||||
{
|
||||
document.getElementById("dokument_kurzbz").readOnly=true;
|
||||
/* document.getElementById("dokument_kurzbz").style=
|
||||
"background-color:#F2F2F2;
|
||||
color: #C6C6C6;
|
||||
border-color:#ddd"; */
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<head>
|
||||
<title>Zuordnung Studiengang - Dokumente</title>
|
||||
<title>Zuordnung Studiengang - Dokumente</title>
|
||||
</head>
|
||||
<body>
|
||||
'.$output.'
|
||||
|
||||
Reference in New Issue
Block a user