mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-20 13:39:27 +00:00
CMS-System
- Versionierung - Review und Übersetzer Benachrichtigung - News Prototyp
This commit is contained in:
@@ -23,6 +23,9 @@
|
||||
*/
|
||||
|
||||
require_once('../config/cis.config.inc.php');
|
||||
require_once('../include/functions.inc.php');
|
||||
require_once('../include/content.class.php');
|
||||
$sprache = getSprache();
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
|
||||
+592
-90
@@ -19,6 +19,7 @@
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
* Karl Burkhart <karl.burkhart@technikum-wien.at>.
|
||||
*/
|
||||
session_start();
|
||||
require_once('../config/cis.config.inc.php');
|
||||
require_once('../include/content.class.php');
|
||||
require_once('../include/template.class.php');
|
||||
@@ -26,9 +27,11 @@ require_once('../include/functions.inc.php');
|
||||
require_once('../include/sprache.class.php');
|
||||
require_once('../include/gruppe.class.php');
|
||||
require_once('../include/datum.class.php');
|
||||
require_once('../include/xsdformprinter/xsdformprinter.php');
|
||||
require_once('../include/mail.class.php');
|
||||
require_once('../include/benutzerfunktion.class.php');
|
||||
require_once('../include/organisationseinheit.class.php');
|
||||
require_once('../include/benutzerberechtigung.class.php');
|
||||
require_once('../include/xsdformprinter/xsdformprinter.php');
|
||||
require_once('../include/DifferenceEngine/DifferenceEngine.php');
|
||||
|
||||
$user = get_uid();
|
||||
@@ -38,6 +41,8 @@ $rechte->getBerechtigungen($user);
|
||||
|
||||
if(!$rechte->isBerechtigt('basis/cms'))
|
||||
die('Sie haben keine Berechtigung fuer diese Seite');
|
||||
|
||||
$berechtigte_oe = $rechte->getOEkurzbz('basis/cms')
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
@@ -63,7 +68,7 @@ if(!$rechte->isBerechtigt('basis/cms'))
|
||||
plugins : "spellchecker,pagebreak,style,layer,table,advhr,advimage,advlink,inlinepopups,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
|
||||
|
||||
// Theme options
|
||||
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontsizeselect",
|
||||
theme_advanced_buttons1 : "code, bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontsizeselect",
|
||||
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,|,forecolor,backcolor",
|
||||
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,|,print,|,ltr,rtl,|,fullscreen",
|
||||
//theme_advanced_buttons4 : "insertfile,insertimage",
|
||||
@@ -71,7 +76,10 @@ if(!$rechte->isBerechtigt('basis/cms'))
|
||||
theme_advanced_toolbar_align : "center",
|
||||
theme_advanced_statusbar_location : "bottom",
|
||||
theme_advanced_resizing : true,
|
||||
|
||||
force_br_newlines : true,
|
||||
force_p_newlines : false,
|
||||
forced_root_block : ''
|
||||
|
||||
}
|
||||
);
|
||||
function FHCFileBrowser(field_name, url, type, win)
|
||||
@@ -123,12 +131,45 @@ if(!is_null($method))
|
||||
{
|
||||
switch($method)
|
||||
{
|
||||
case 'add_new_content':
|
||||
$oe = new organisationseinheit();
|
||||
$oe->getAll();
|
||||
if(!isset($oe->result[0]))
|
||||
die('Es ist keine Organisationseinheit vorhanden');
|
||||
case 'content_sperre':
|
||||
if(!isset($_GET['contentsprache_id']))
|
||||
die('Falsche Parameteruebergabe');
|
||||
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'su'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
$contentsprache_id=$_GET['contentsprache_id'];
|
||||
if(isset($_POST['sperren']))
|
||||
{
|
||||
$content = new content();
|
||||
if($content->sperren($contentsprache_id, $user))
|
||||
$message.='<span class="ok">Eintrag gesperrt</span>';
|
||||
else
|
||||
$message.='<span class="error">'.$content->errormsg.'</span>';
|
||||
}
|
||||
elseif(isset($_POST['freigeben']))
|
||||
{
|
||||
$content = new content();
|
||||
if($content->freigeben($contentsprache_id, $user))
|
||||
$message.='<span class="ok">Eintrag freigegeben</span>';
|
||||
else
|
||||
$message.='<span class="error">'.$content->errormsg.'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<span class="error">Unbekannte Sperre</span>';
|
||||
}
|
||||
break;
|
||||
case 'add_new_content':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'sui'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
$template = new template();
|
||||
$template->getAll();
|
||||
if(!isset($template->result[0]))
|
||||
@@ -136,12 +177,14 @@ if(!is_null($method))
|
||||
|
||||
$content = new content();
|
||||
$content->new = true;
|
||||
$content->oe_kurzbz=$oe->result[0]->oe_kurzbz;
|
||||
$content->oe_kurzbz=$berechtigte_oe[0];
|
||||
$content->template_kurzbz=$template->result[0]->template_kurzbz;
|
||||
$content->titel = 'Neuer Eintrag';
|
||||
$content->aktiv=true;
|
||||
$content->menu_open=true;
|
||||
$content->content = '<?xml version="1.0" encoding="UTF-8" ?><content></content>';
|
||||
$content->sichtbar=false;
|
||||
$content->version='0';
|
||||
$content->version='1';
|
||||
$content->sprache='German';
|
||||
$content->insertvon = $user;
|
||||
$content->insertamum = date('Y-m-d H:i:s');
|
||||
@@ -155,8 +198,77 @@ if(!is_null($method))
|
||||
else
|
||||
$message .= '<span class="error">'.$content->errormsg.'</span>';
|
||||
|
||||
break;
|
||||
case 'add_uebersetzung':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'sui'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
$content = new content();
|
||||
$content->getContent($content_id);
|
||||
|
||||
$content->new = true;
|
||||
$content->sichtbar=false;
|
||||
$content->sprache=$_POST['sprache'];
|
||||
$content->insertvon = $user;
|
||||
$content->insertamum = date('Y-m-d H:i:s');
|
||||
$content->updatevon = $user;
|
||||
$content->updateamum = date('Y-m-d H:i:s');
|
||||
$content->reviewvon='';
|
||||
$content->reviewamum='';
|
||||
$content->gesperrt_uid='';
|
||||
|
||||
if($content->saveContentSprache())
|
||||
{
|
||||
$message .= '<span class="ok">Eintrag wurde erfolgreich angelegt</span>';
|
||||
$action='prefs';
|
||||
$sprache=$_POST['sprache'];
|
||||
}
|
||||
else
|
||||
$message .= '<span class="error">'.$content->errormsg.'</span>';
|
||||
|
||||
break;
|
||||
case 'add_newversion':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'sui'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
$content = new content();
|
||||
$content->getContent($content_id, $sprache);
|
||||
$maxversion = $content->getMaxVersion($content_id, $content->sprache);
|
||||
|
||||
$content->new = true;
|
||||
$content->sichtbar=false;
|
||||
$content->reviewvon='';
|
||||
$content->reviewamum='';
|
||||
$content->version=$maxversion+1;
|
||||
$content->insertvon = $user;
|
||||
$content->insertamum = date('Y-m-d H:i:s');
|
||||
$content->updatevon = $user;
|
||||
$content->updateamum = date('Y-m-d H:i:s');
|
||||
$content->gesperrt_uid='';
|
||||
|
||||
if($content->saveContentSprache())
|
||||
{
|
||||
$message .= '<span class="ok">Eintrag wurde erfolgreich angelegt</span>';
|
||||
$action='prefs';
|
||||
$version = $content->version;
|
||||
}
|
||||
else
|
||||
$message .= '<span class="error">'.$content->errormsg.'</span>';
|
||||
|
||||
break;
|
||||
case 'rights_add_group':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'su'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
if(!isset($_POST['gruppe_kurzbz']))
|
||||
die('Fehlender Parameter');
|
||||
|
||||
@@ -173,6 +285,12 @@ if(!is_null($method))
|
||||
|
||||
break;
|
||||
case 'rights_delete_group':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'su'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
if(!isset($_GET['gruppe_kurzbz']))
|
||||
die('Fehlender Parameter');
|
||||
|
||||
@@ -184,10 +302,18 @@ if(!is_null($method))
|
||||
|
||||
break;
|
||||
case 'prefs_save':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'su'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
$content = new content();
|
||||
$titel = $_POST['titel'];
|
||||
$oe_kurzbz=$_POST['oe_kurzbz'];
|
||||
$sichtbar=isset($_POST['sichtbar']);
|
||||
$aktiv=isset($_POST['aktiv']);
|
||||
$menu_open=isset($_POST['menu_open']);
|
||||
$template_kurzbz = $_POST['template_kurzbz'];
|
||||
|
||||
if($content->getContent($content_id, $sprache, $version))
|
||||
@@ -195,6 +321,8 @@ if(!is_null($method))
|
||||
$content->titel = $titel;
|
||||
$content->oe_kurzbz = $oe_kurzbz;
|
||||
$content->sichtbar = $sichtbar;
|
||||
$content->aktiv = $aktiv;
|
||||
$content->menu_open = $menu_open;
|
||||
$content->template_kurzbz = $template_kurzbz;
|
||||
$content->updateamum=date('Y-m-d H:i:s');
|
||||
$content->updatevon=$user;
|
||||
@@ -207,7 +335,167 @@ if(!is_null($method))
|
||||
else
|
||||
$message.='<span class="error">'.$content->errormsg.'</span>';
|
||||
break;
|
||||
case 'prefs_reviewed':
|
||||
$bf = new benutzerfunktion();
|
||||
if($bf->benutzerfunktion_exists($user, 'review'))
|
||||
{
|
||||
$content = new content();
|
||||
$content->getContent($content_id, $sprache, $version);
|
||||
|
||||
$content->reviewamum = date('Y-m-d H:i:s');
|
||||
$content->reviewvon = $user;
|
||||
|
||||
if($content->saveContentSprache(false))
|
||||
$message.='<span class="ok">Erfolgreich reviewed</span>';
|
||||
else
|
||||
$message.='<span class="error">'.$content->errormsg.'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<span class="error">Sie dürfen kein Review durchführen</span>';
|
||||
}
|
||||
break;
|
||||
case 'prefs_requestreview':
|
||||
$content = new content();
|
||||
$content->getContent($content_id, $sprache, $version);
|
||||
|
||||
$oe = new organisationseinheit();
|
||||
$oe_arr = $oe->getParents($content->oe_kurzbz);
|
||||
|
||||
foreach($oe_arr as $organisationseinheit)
|
||||
{
|
||||
echo $organisationseinheit;
|
||||
$fkt = new benutzerfunktion();
|
||||
$fkt->getBenutzerFunktionen('review', $organisationseinheit);
|
||||
if(count($fkt->result)>0)
|
||||
break;
|
||||
}
|
||||
|
||||
if(count($fkt->result)==0)
|
||||
$fkt->getBenutzerFunktionen('review');
|
||||
$to='';
|
||||
foreach($fkt->result as $row)
|
||||
{
|
||||
if($to!='')
|
||||
$to.=',';
|
||||
$to .= $row->uid.'@'.DOMAIN;
|
||||
}
|
||||
if($to!='')
|
||||
{
|
||||
$from = 'no-reply@'.DOMAIN;
|
||||
$subject = 'CMS Review Request';
|
||||
$text = "Dies ist eine automatisch generierte E-Mail.\n\n
|
||||
Es wurde ein Review für die Seite '$content->titel' ($sprache, Version $version) angefordert.\n
|
||||
\n
|
||||
(um den Link anzuzeigen müssen Sie in die HTML Ansicht wechseln)
|
||||
\n
|
||||
\n
|
||||
Mit freundlichen Grüßen\n
|
||||
\n
|
||||
FH Technikum Wien\n
|
||||
Hoechstaedtplatz 5, 1200 Wien, AUSTRIA";
|
||||
$texthtml = "Dies ist eine automatisch generierte E-Mail.<br><br>
|
||||
Es wurde ein Review für die Seite '$content->titel' ($sprache, Version $version) angefordert.<br>
|
||||
<br>
|
||||
<a href=\"".APP_ROOT."cms/admin.php?content_id=".$content->content_id."&sprache=$sprache&version=$version&action=content\">zum Artikel</a>
|
||||
<br>
|
||||
<br>
|
||||
Mit freundlichen Grüßen<br>
|
||||
<br>
|
||||
FH Technikum Wien<br>
|
||||
Hoechstaedtplatz 5, 1200 Wien, AUSTRIA
|
||||
";
|
||||
|
||||
$mail = new mail($to, $from, $subject, $text);
|
||||
$mail->setHTMLContent($texthtml);
|
||||
if($mail->send())
|
||||
{
|
||||
$message.='<span class="ok">Review Anforderung wurde an '.$to.' versendet</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<span class="error">Fehler beim Senden des Mails an '.$to.'</span>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<span class="error">Es ist kein Review Team vorhanden</span>';
|
||||
}
|
||||
break;
|
||||
case 'prefs_requesttranslate':
|
||||
$content = new content();
|
||||
$content->getContent($content_id, $sprache, $version);
|
||||
|
||||
$oe = new organisationseinheit();
|
||||
$oe_arr = $oe->getParents($content->oe_kurzbz);
|
||||
|
||||
foreach($oe_arr as $organisationseinheit)
|
||||
{
|
||||
echo $organisationseinheit;
|
||||
$fkt = new benutzerfunktion();
|
||||
$fkt->getBenutzerFunktionen('translate', $organisationseinheit);
|
||||
if(count($fkt->result)>0)
|
||||
break;
|
||||
}
|
||||
|
||||
if(count($fkt->result)==0)
|
||||
$fkt->getBenutzerFunktionen('translate');
|
||||
$to='';
|
||||
foreach($fkt->result as $row)
|
||||
{
|
||||
if($to!='')
|
||||
$to.=',';
|
||||
$to .= $row->uid.'@'.DOMAIN;
|
||||
}
|
||||
if($to!='')
|
||||
{
|
||||
$from = 'no-reply@'.DOMAIN;
|
||||
$subject = 'CMS Review Request';
|
||||
$text = "Dies ist eine automatisch generierte E-Mail.\n\n
|
||||
Es wurde ein Artikel angelegt/bearbeitet. Dieser kann nun übersetzt werden: '$content->titel'.\n
|
||||
\n
|
||||
(um den Link anzuzeigen müssen Sie in die HTML Ansicht wechseln)
|
||||
\n
|
||||
\n
|
||||
Mit freundlichen Grüßen\n
|
||||
\n
|
||||
FH Technikum Wien\n
|
||||
Hoechstaedtplatz 5, 1200 Wien, AUSTRIA";
|
||||
$texthtml = "Dies ist eine automatisch generierte E-Mail.<br><br>
|
||||
Es wurde ein Artikel angelegt/bearbeitet. Dieser kann nun übersetzt werden: '$content->titel'<br>
|
||||
<br>
|
||||
<a href=\"".APP_ROOT."cms/admin.php?content_id=".$content->content_id."&sprache=$sprache&version=$version)&action=content\">zum Artikel</a>
|
||||
<br>
|
||||
<br>
|
||||
Mit freundlichen Grüßen<br>
|
||||
<br>
|
||||
FH Technikum Wien<br>
|
||||
Hoechstaedtplatz 5, 1200 Wien, AUSTRIA
|
||||
";
|
||||
|
||||
$mail = new mail($to, $from, $subject, $text);
|
||||
$mail->setHTMLContent($texthtml);
|
||||
if($mail->send())
|
||||
{
|
||||
$message.='<span class="ok">Übersetzungsanforderung wurde an '.$to.' versendet</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<span class="error">Fehler beim Senden des Mails an '.$to.'</span>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<span class="error">Es ist kein Übersetzer eingetragen</span>';
|
||||
}
|
||||
break;
|
||||
case 'childs_add':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'su'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
$content = new content();
|
||||
$content->content_id = $content_id;
|
||||
$content->child_content_id = $_POST['child_content_id'];
|
||||
@@ -219,6 +507,12 @@ if(!is_null($method))
|
||||
$message.='<span class="error">'.$content->errormsg.'</span>';
|
||||
break;
|
||||
case 'childs_delete':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'su'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
if(isset($_GET['contentchild_id']))
|
||||
{
|
||||
$contentchild_id = $_GET['contentchild_id'];
|
||||
@@ -233,6 +527,48 @@ if(!is_null($method))
|
||||
$message.='<span class="error">Fehler: ID wurde nicht uebergeben</span>';
|
||||
}
|
||||
break;
|
||||
case 'childs_sort_up':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'su'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
if(isset($_GET['contentchild_id']))
|
||||
{
|
||||
$contentchild_id = $_GET['contentchild_id'];
|
||||
$content = new content();
|
||||
if($content->SortUp($contentchild_id))
|
||||
$message.='<span class="ok">Sortieren erfolgrecih</span>';
|
||||
else
|
||||
$message.='<span class="error">'.$content->errormsg.'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<span class="error">Fehler: ID wurde nicht uebergeben</span>';
|
||||
}
|
||||
break;
|
||||
case 'childs_sort_down':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'su'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
if(isset($_GET['contentchild_id']))
|
||||
{
|
||||
$contentchild_id = $_GET['contentchild_id'];
|
||||
$content = new content();
|
||||
if($content->SortDown($contentchild_id))
|
||||
$message.='<span class="ok">Sortieren erfolgrecih</span>';
|
||||
else
|
||||
$message.='<span class="error">'.$content->errormsg.'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<span class="error">Fehler: ID wurde nicht uebergeben</span>';
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@@ -252,34 +588,66 @@ $db = new basis_db();
|
||||
echo '
|
||||
<a href="'.$_SERVER['PHP_SELF'].'?action=prefs&method=add_new_content">Neuen Eintrag hinzufügen</a>
|
||||
<br><br>
|
||||
<table class="treetable">';
|
||||
$qry = "SELECT * FROM (
|
||||
SELECT
|
||||
distinct on(content_id) *
|
||||
FROM
|
||||
campus.tbl_content
|
||||
LEFT JOIN campus.tbl_contentchild USING(content_id)
|
||||
WHERE content_id NOT IN (SELECT child_content_id FROM campus.tbl_contentchild WHERE child_content_id=tbl_content.content_id)
|
||||
) as a
|
||||
ORDER BY contentchild_id, titel";
|
||||
if($result = $db->db_query($qry))
|
||||
|
||||
<a href="admin.php?content_id='.$content_id.'&action='.$action.'&sprache='.$sprache.'&menu=content">Content</a> |
|
||||
<a href="admin.php?content_id='.$content_id.'&action='.$action.'&sprache='.$sprache.'&menu=news">News</a>
|
||||
|
||||
<table class="treetable" >';
|
||||
|
||||
$menu='content';
|
||||
if(isset($_GET['menu']))
|
||||
{
|
||||
$_SESSION['cms/menu']=$_GET['menu'];
|
||||
$menu=$_GET['menu'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($_SESSION['cms/menu']))
|
||||
$menu=$_SESSION['cms/menu'];
|
||||
else
|
||||
$menu='content';
|
||||
}
|
||||
|
||||
$rootcontent = new content();
|
||||
$rootcontent->getRootContent();
|
||||
|
||||
foreach($rootcontent->result as $row)
|
||||
{
|
||||
$output='';
|
||||
$output.= '<tr>';
|
||||
$content = new content();
|
||||
$content->getContent($row->content_id, $sprache, null, null, true);
|
||||
|
||||
while($row = $db->db_fetch_object($result))
|
||||
if($menu=='news' && $content->template_kurzbz!='news')
|
||||
continue;
|
||||
if($menu=='content' && $content->template_kurzbz=='news')
|
||||
continue;
|
||||
|
||||
if($content->template_kurzbz=='news')
|
||||
{
|
||||
echo '<tr>';
|
||||
$content = new content();
|
||||
|
||||
echo '<td>';
|
||||
drawmenulink($row->content_id, $row->titel);
|
||||
echo '</td>';
|
||||
$output.= '<td>';
|
||||
$output.= drawmenulink($row->content_id, $content->titel.' '.$content->insertamum, $content->oe_kurzbz);
|
||||
|
||||
$output.= '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$output.= '<td><br>';
|
||||
$output.= drawmenulink($row->content_id, $content->titel, $content->oe_kurzbz);
|
||||
|
||||
$output.= '</td>';
|
||||
$submenu_depth=0;
|
||||
drawsubmenu($row->content_id);
|
||||
echo '</tr>';
|
||||
$output .= drawsubmenu($row->content_id);
|
||||
}
|
||||
|
||||
//Wenn im gesamten Subtree kein Eintrag vorhanden ist auf den eine Berechtigung vorhanden ist,
|
||||
//dann wird der ganze Subtree nicht angezeigt.
|
||||
if($output!='' && strstr($output,'<a href='))
|
||||
echo $output.'</tr>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo '</td><td valign="top">';
|
||||
@@ -287,12 +655,13 @@ echo '</td><td valign="top">';
|
||||
//Editieren
|
||||
if(!is_null($content_id))
|
||||
{
|
||||
echo get_content_link('prefs','Eigenschaften').' | ';
|
||||
echo get_content_link('content','Inhalt').' | ';
|
||||
echo get_content_link('preview','Vorschau').' | ';
|
||||
echo get_content_link('rights','Rechte').' | ';
|
||||
echo get_content_link('childs','Childs').' | ';
|
||||
echo get_content_link('history','History');
|
||||
echo '<h2>Content ID: '.$content_id.' | Version:'.$version.' | Sprache:'.$sprache.'</h2>';
|
||||
$content = new content();
|
||||
$oe = $content->getOrganisationseinheit($content_id);
|
||||
if(!in_array($oe, $berechtigte_oe))
|
||||
die('Sie haben keine Berechtigung fuer diesen Eintrag');
|
||||
|
||||
drawheader();
|
||||
|
||||
echo '<div style="float: right;">'.$message.'</div>';
|
||||
echo '<br><br>';
|
||||
@@ -306,9 +675,9 @@ if(!is_null($content_id))
|
||||
case 'content':
|
||||
print_content();
|
||||
break;
|
||||
case 'preview':
|
||||
echo '<iframe src="content.php?content_id='.$content_id.'&version='.$version.'&sprache='.$sprache.'" style="width: 600px; height: 500px; border: 1px solid black;">';
|
||||
break;
|
||||
//case 'preview':
|
||||
|
||||
// break;
|
||||
case 'rights':
|
||||
print_rights();
|
||||
break;
|
||||
@@ -327,16 +696,95 @@ echo '</body>
|
||||
</html>';
|
||||
|
||||
/******* FUNCTIONS **********/
|
||||
/**
|
||||
* Header fuer Content
|
||||
*/
|
||||
function drawheader()
|
||||
{
|
||||
global $content_id, $action, $sprache, $version, $action;
|
||||
|
||||
//vorhandene Versionen dieser Sprache anzeigen
|
||||
$content = new content();
|
||||
$content->loadVersionen($content_id, $sprache);
|
||||
echo '<table width="100%">
|
||||
<tr>
|
||||
<td width="33%">';
|
||||
echo 'Versionen: ';
|
||||
|
||||
foreach($content->result as $row)
|
||||
{
|
||||
if($version=='')
|
||||
$version=$row->version;
|
||||
|
||||
if($version==$row->version)
|
||||
$class='marked';
|
||||
else
|
||||
$class='';
|
||||
|
||||
echo ' <a href="'.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&sprache='.$sprache.'&version='.$row->version.'&action='.$action.'" class="'.$class.'">';
|
||||
echo $row->version;
|
||||
echo '</a>, ';
|
||||
}
|
||||
echo '<br>';
|
||||
//vorhandene Sprachen dieses Contents anzeigen
|
||||
$content = new content();
|
||||
if(!$vorhandene_sprachen = $content->getLanguages($content_id, $version))
|
||||
die($content->errormsg);
|
||||
echo 'Sprachen: ';
|
||||
foreach($vorhandene_sprachen as $lang)
|
||||
{
|
||||
if($sprache==$lang)
|
||||
$class='marked';
|
||||
else
|
||||
$class='';
|
||||
echo ' <a href="'.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&sprache='.$lang.'&action='.$action.'" class="'.$class.'">'; //&version='.$version.'
|
||||
echo $lang;
|
||||
echo '</a>,';
|
||||
}
|
||||
echo '</td><td align="center" width="33%">';
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&sprache='.$sprache.'&action='.$action.'&method=add_newversion" method="POST">';
|
||||
echo '<input type="submit" value="Neue Version anlegen">';
|
||||
echo '</form>';
|
||||
echo '</td><td align="right" width="33%">';
|
||||
$sprache_obj = new sprache();
|
||||
$sprache_obj->getAll();
|
||||
|
||||
//Wenn noch nicht alle Uebersetzungen vorhanden sind,
|
||||
//wird ein Formular zum Erstellen der Uebersetzung angezeigt.
|
||||
if(count($vorhandene_sprachen)!=count($sprache_obj->result))
|
||||
{
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&action='.$action.'&method=add_uebersetzung" method="POST">';
|
||||
echo 'Übersetzung in <SELECT name="sprache">';
|
||||
foreach($sprache_obj->result as $row)
|
||||
{
|
||||
if(!in_array($row->sprache, $vorhandene_sprachen))
|
||||
echo '<option value="'.$row->sprache.'">'.$row->bezeichnung_arr[$sprache].'</option>';
|
||||
}
|
||||
echo '</SELECT>';
|
||||
echo '<input type="submit" value="anlegen">';
|
||||
echo '</form>';
|
||||
}
|
||||
echo '</td></tr>';
|
||||
echo '</table><hr>';
|
||||
|
||||
echo get_content_link('prefs','Eigenschaften').' | ';
|
||||
echo get_content_link('content','Inhalt').' | ';
|
||||
echo get_content_link('rights','Rechte').' | ';
|
||||
echo get_content_link('childs','Childs').' | ';
|
||||
echo get_content_link('history','History');
|
||||
}
|
||||
/**
|
||||
* Gibt einen Menue Link aus
|
||||
* @param $id
|
||||
* @param $titel
|
||||
*/
|
||||
function drawmenulink($id, $titel)
|
||||
function drawmenulink($id, $titel, $oe_kurzbz)
|
||||
{
|
||||
global $content_id, $action, $sprache, $version;
|
||||
echo '<a href="admin.php?content_id='.$id.'&action='.$action.'&sprache='.$sprache.'&version='.$version.'" '.($content_id==$id?'class="marked"':'').'>'.$titel.'</a> ('.$id.')';
|
||||
global $content_id, $action, $sprache, $berechtigte_oe;
|
||||
if(in_array($oe_kurzbz, $berechtigte_oe))
|
||||
return '<a href="admin.php?content_id='.$id.'&action='.$action.'&sprache='.$sprache.'" '.($content_id==$id?'class="marked"':'').'>'.$titel.'</a> ('.$id.')';
|
||||
else
|
||||
return $titel.' ('.$id.')';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -347,39 +795,30 @@ function drawmenulink($id, $titel)
|
||||
*/
|
||||
function drawsubmenu($content_id, $einrueckung=" ")
|
||||
{
|
||||
global $db, $action, $submenu_depth;
|
||||
global $db, $action, $submenu_depth, $sprache;
|
||||
$output='';
|
||||
$submenu_depth++;
|
||||
if($submenu_depth>20)
|
||||
if($submenu_depth>100)
|
||||
{
|
||||
echo 'Menürekursion?! -> Abbruch';
|
||||
return 0;
|
||||
}
|
||||
$qry = "SELECT
|
||||
tbl_contentchild.content_id,
|
||||
tbl_contentchild.child_content_id,
|
||||
tbl_content.titel
|
||||
FROM
|
||||
campus.tbl_contentchild
|
||||
JOIN campus.tbl_content ON(tbl_contentchild.child_content_id=tbl_content.content_id)
|
||||
WHERE
|
||||
tbl_contentchild.content_id='".addslashes($content_id)."'";
|
||||
if($result = $db->db_query($qry))
|
||||
$childcontent = new content();
|
||||
$childcontent->getChilds($content_id);
|
||||
|
||||
foreach($childcontent->result as $row)
|
||||
{
|
||||
if($db->db_num_rows($result)>0)
|
||||
{
|
||||
|
||||
while($row = $db->db_fetch_object($result))
|
||||
{
|
||||
echo "<tr>\n";
|
||||
echo '<td>';
|
||||
echo $einrueckung;
|
||||
drawmenulink($row->child_content_id, $row->titel);
|
||||
drawsubmenu($row->child_content_id, $einrueckung." ");
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
}
|
||||
$content = new content();
|
||||
$content->getContent($row->content_id, $sprache, null, null, true);
|
||||
$output.= "<tr>\n";
|
||||
$output.= '<td>';
|
||||
$output.= $einrueckung;
|
||||
$output.=drawmenulink($row->child_content_id, $content->titel, $content->oe_kurzbz);
|
||||
$output.=drawsubmenu($row->child_content_id, $einrueckung." ");
|
||||
$output.= "</td>\n";
|
||||
$output.= "</tr>\n";
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -389,8 +828,8 @@ function drawsubmenu($content_id, $einrueckung=" ")
|
||||
*/
|
||||
function get_content_link($key, $name)
|
||||
{
|
||||
global $action, $content_id;
|
||||
return '<a href="'.$_SERVER['PHP_SELF'].'?action='.$key.'&content_id='.$content_id.'" '.($action==$key?'class="marked"':'').'>'.$name.'</a>';
|
||||
global $action, $content_id, $sprache, $version;
|
||||
return '<a href="'.$_SERVER['PHP_SELF'].'?action='.$key.'&content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'" '.($action==$key?'class="marked"':'').'>'.$name.'</a>';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -410,7 +849,7 @@ function print_childs()
|
||||
{
|
||||
$("#childs_table").tablesorter(
|
||||
{
|
||||
sortList: [[1,1]],
|
||||
sortList: [[0,0]],
|
||||
widgets: ["zebra"]
|
||||
});
|
||||
});
|
||||
@@ -418,6 +857,7 @@ function print_childs()
|
||||
echo '<table id="childs_table" class="tablesorter" style="width: auto;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Sortierung</th>
|
||||
<th>ID</th>
|
||||
<th>Titel</th>
|
||||
<th></th>
|
||||
@@ -426,9 +866,17 @@ function print_childs()
|
||||
<tbody>';
|
||||
foreach($content->result as $row)
|
||||
{
|
||||
$child = new content();
|
||||
$child->getContent($row->child_content_id);
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td>',$row->sort;
|
||||
echo ' <a href="'.$_SERVER['PHP_SELF'].'?action=childs&content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&contentchild_id='.$row->contentchild_id.'&method=childs_sort_up" title="Nach oben sortieren"><img src="../skin/images/up.png" alt="up"></a>';
|
||||
echo ' <a href="'.$_SERVER['PHP_SELF'].'?action=childs&content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&contentchild_id='.$row->contentchild_id.'&method=childs_sort_down" title="Nach unten sortieren"><img src="../skin/images/down.png" alt="down"></a>';
|
||||
echo '</td>';
|
||||
echo '<td>',$row->child_content_id,'</td>';
|
||||
echo '<td>',$row->titel,'</td>';
|
||||
echo '<td>',$child->titel,'</td>';
|
||||
|
||||
echo '<td>
|
||||
<a href="'.$_SERVER['PHP_SELF'].'?action=childs&content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&contentchild_id='.$row->contentchild_id.'&method=childs_delete" title="entfernen">
|
||||
<img src="../skin/images/delete_x.png">
|
||||
@@ -458,22 +906,19 @@ function print_childs()
|
||||
*/
|
||||
function print_prefs()
|
||||
{
|
||||
global $content_id, $sprache, $version;
|
||||
global $content_id, $sprache, $version, $user;
|
||||
|
||||
$content = new content();
|
||||
if(!$content->getContent($content_id, $sprache, $version))
|
||||
die($content->errormsg);
|
||||
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&action=prefs&method=prefs_save" method="POST">
|
||||
echo '<form name="form_pref" action="'.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&action=prefs&method=prefs_save" method="POST">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Titel</td>
|
||||
<td><input type="text" name="titel" size="40" maxlength="256" value="'.$content->titel.'"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Vorlage</td>
|
||||
<td>
|
||||
<SELECT name="template_kurzbz">';
|
||||
<SELECT name="template_kurzbz" onchange="alert(\'Achtung: Das Ändern der Vorlage kann zum Datenverlust des Contents führen!\n\nÄndern Sie die Vorlage nur wenn Sie wirklich wissen was sie tun.\');">';
|
||||
$template = new template();
|
||||
$template->getAll();
|
||||
foreach($template->result as $row)
|
||||
@@ -512,13 +957,47 @@ function print_prefs()
|
||||
</SELECT>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Aktiv</td>
|
||||
<td><input type="checkbox" name="aktiv" '.($content->aktiv?'checked':'').'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Menü offen</td>
|
||||
<td><input type="checkbox" name="menu_open" '.($content->menu_open?'checked':'').'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><hr></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Titel</td>
|
||||
<td><input type="text" name="titel" size="40" maxlength="256" value="'.$content->titel.'"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Sichtbar</td>
|
||||
<td><input type="checkbox" name="sichtbar" '.($content->sichtbar?'checked':'').'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" value="Speichern"></td>
|
||||
<td><input type="submit" value="Speichern">';
|
||||
if($content->reviewvon!='')
|
||||
{
|
||||
$datum_obj = new datum();
|
||||
echo 'Reviewed von '.$content->reviewvon.' am '.$datum_obj->formatDatum($content->reviewamum,'d.m.Y H:i');
|
||||
}
|
||||
|
||||
echo ' ';
|
||||
echo '<input type="submit" value="Review anfordern" onclick="document.form_pref.action=\''.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&action=prefs&method=prefs_requestreview\'">';
|
||||
$bf = new benutzerfunktion();
|
||||
if($bf->benutzerfunktion_exists($user, 'review'))
|
||||
echo '<input type="submit" value="Review OK" onclick="document.form_pref.action=\''.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&action=prefs&method=prefs_reviewed\'">';
|
||||
|
||||
echo '<input type="submit" value="Übersetzer benachrichtigen" onclick="document.form_pref.action=\''.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&action=prefs&method=prefs_requesttranslate\'">';
|
||||
|
||||
|
||||
echo '
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
@@ -598,21 +1077,44 @@ function print_rights()
|
||||
*/
|
||||
function print_content()
|
||||
{
|
||||
global $content_id, $sprache, $version;
|
||||
|
||||
global $content_id, $sprache, $version, $user;
|
||||
|
||||
$content = new content();
|
||||
|
||||
if(!$content->getContent($content_id, $sprache, $version))
|
||||
die($content->errormsg);
|
||||
|
||||
echo '<div>';
|
||||
$template = new template();
|
||||
$template->load($content->template_kurzbz);
|
||||
|
||||
$xfp = new XSDFormPrinter();
|
||||
$xfp->getparams='?content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&action=content';
|
||||
$xfp->output($template->xsd,$content->content);
|
||||
echo '</div>';
|
||||
if($content->gesperrt_uid!='' && $content->gesperrt_uid!=$user)
|
||||
{
|
||||
$content->getSperrLog($content->contentsprache_id);
|
||||
echo "Dieser Content ist gesperrt von $content->uid seit $content->start!";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&contentsprache_id='.$content->contentsprache_id.'&sprache='.$sprache.'&version='.$version.'&action=content&method=content_sperre" method="POST">';
|
||||
if($content->gesperrt_uid=='')
|
||||
echo '<input type="submit" value="Zur Bearbeitung sperren" name="sperren">';
|
||||
else
|
||||
echo '<input type="submit" value="Sperre Freigeben" name="freigeben">';
|
||||
echo '</form>';
|
||||
|
||||
if($content->gesperrt_uid!='' && $content->gesperrt_uid==$user)
|
||||
{
|
||||
echo '<div>';
|
||||
$template = new template();
|
||||
$template->load($content->template_kurzbz);
|
||||
|
||||
$xfp = new XSDFormPrinter();
|
||||
$xfp->getparams='?content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&action=content';
|
||||
$xfp->output($template->xsd,$content->content);
|
||||
echo '</div>';
|
||||
}
|
||||
echo '
|
||||
<br>
|
||||
<h3>Vorschau</h3>
|
||||
<iframe src="content.php?content_id='.$content_id.'&version='.$version.'&sprache='.$sprache.'&sichtbar" style="width: 800px; height: 500px; border: 1px solid black;">
|
||||
';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-1
@@ -35,6 +35,7 @@ else
|
||||
|
||||
$version = (isset($_GET['version'])?$_GET['version']:null);
|
||||
$sprache = (isset($_GET['sprache'])?$_GET['sprache']:getSprache());
|
||||
$sichtbar = !isset($_GET['sichtbar']);
|
||||
|
||||
//XML Content laden
|
||||
$content = new content();
|
||||
@@ -46,7 +47,7 @@ if($content->islocked($content_id))
|
||||
die($uid.': Sie haben keine Berechtigung fuer diese Seite');
|
||||
}
|
||||
|
||||
if(!$content->getContent($content_id, $sprache, $version))
|
||||
if(!$content->getContent($content_id, $sprache, $version, $sichtbar, true))
|
||||
die($content->errormsg);
|
||||
|
||||
$XML = new DOMDocument();
|
||||
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 FH 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
|
||||
* Karl Burkhart <burkhart@technikum-wien.at>.
|
||||
*/
|
||||
require_once('../config/cis.config.inc.php');
|
||||
require_once('../include/basis_db.class.php');
|
||||
if (!$db = new basis_db())
|
||||
die('Fehler beim Oeffnen der Datenbankverbindung');
|
||||
|
||||
if(isset($_GET['src']) && $_GET['src']=='flag' && isset($_GET['sprache']))
|
||||
{
|
||||
$qry = "SELECT flagge as bild FROM public.tbl_sprache WHERE sprache='".addslashes($_GET['sprache'])."'";
|
||||
}
|
||||
else
|
||||
die('Unkown type');
|
||||
|
||||
//Header fuer Bild schicken
|
||||
header("Content-type: image/gif");
|
||||
$result = $db->db_query($qry);
|
||||
$row = $db->db_fetch_object($result);
|
||||
//base64 zurueckwandeln und ausgeben
|
||||
echo base64_decode($row->bild);
|
||||
?>
|
||||
|
||||
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 FH 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
|
||||
* Karl Burkhart <karl.burkhart@technikum-wien.at>.
|
||||
*/
|
||||
/**
|
||||
* Laedt den Content und das zugeordnete Template aus der Datenbank und
|
||||
* zeigt diese an.
|
||||
*/
|
||||
require_once('../config/cis.config.inc.php');
|
||||
require_once('../include/content.class.php');
|
||||
require_once('../include/template.class.php');
|
||||
require_once('../include/functions.inc.php');
|
||||
|
||||
$version = (isset($_GET['version'])?$_GET['version']:null);
|
||||
$sprache = (isset($_GET['sprache'])?$_GET['sprache']:getSprache());
|
||||
$sichtbar = !isset($_GET['sichtbar']);
|
||||
|
||||
//XML Content laden
|
||||
$content = new content();
|
||||
$db = new basis_db();
|
||||
|
||||
|
||||
$qry = "SELECT content FROM campus.tbl_content JOIN campus.tbl_contentsprache USING(content_id) WHERE tbl_content.template_kurzbz='news'";
|
||||
$content = '<?xml version="1.0" encoding="UTF-8"?><content>';
|
||||
if($result = $db->db_query($qry))
|
||||
{
|
||||
while($row = $db->db_fetch_object($result))
|
||||
{
|
||||
$content .=$row->content;
|
||||
}
|
||||
}
|
||||
$content .= '</content>';
|
||||
//echo $content;
|
||||
$XML = new DOMDocument();
|
||||
$XML->loadXML($content);
|
||||
|
||||
//XSLT Vorlage laden
|
||||
$template = new template();
|
||||
if(!$template->load('news'))
|
||||
die($template->errormsg);
|
||||
|
||||
$xsltemplate = new DOMDocument();
|
||||
$xsltemplate->loadXML($template->xslt_xhtml);
|
||||
|
||||
//Transformation
|
||||
$processor = new XSLTProcessor();
|
||||
$processor->importStylesheet($xsltemplate);
|
||||
|
||||
echo $processor->transformToXML($XML);
|
||||
?>
|
||||
@@ -184,6 +184,7 @@ class benutzerfunktion extends basis_db
|
||||
$qry.=" AND semester='".addslashes($semester)."'";
|
||||
|
||||
$qry.=" ORDER BY funktion_kurzbz, oe_kurzbz, semester";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
|
||||
+574
-78
@@ -35,6 +35,8 @@ class content extends basis_db
|
||||
public $insertamum;
|
||||
public $insertvon;
|
||||
public $oe_kurzbz;
|
||||
public $aktiv;
|
||||
public $menu_open;
|
||||
|
||||
public $contentsprache_id;
|
||||
public $sprache;
|
||||
@@ -43,6 +45,7 @@ class content extends basis_db
|
||||
public $content;
|
||||
public $reviewvon;
|
||||
public $reviewamum;
|
||||
public $gesperrt_uid;
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
@@ -53,13 +56,36 @@ class content extends basis_db
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getContent($content_id, $sprache='German', $version=null, $sichtbar=null)
|
||||
/**
|
||||
* Laedt den Content in der angegebenen Sprache
|
||||
* Sollte der Content in dieser Sprache nicht vorhanden sein, wird der Content in der Default Sprache geladen
|
||||
*
|
||||
* @param $content_id
|
||||
* @param $sprache optional
|
||||
* @param $version optional
|
||||
* @param $sichtbar optional
|
||||
*/
|
||||
public function getContent($content_id, $sprache=DEFAULT_LANGUAGE, $version=null, $sichtbar=null, $load_default_language=false)
|
||||
{
|
||||
if(!is_numeric($content_id))
|
||||
{
|
||||
$this->errormsg='ContentID ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!$this->contentSpracheExists($content_id, $sprache, $version, $sichtbar))
|
||||
{
|
||||
if($load_default_language)
|
||||
{
|
||||
$sprache = DEFAULT_LANGUAGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Der Content existiert in dieser Sprache nicht ';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$qry = "SELECT
|
||||
*,
|
||||
tbl_contentsprache.insertamum, tbl_contentsprache.insertvon,
|
||||
@@ -73,9 +99,9 @@ class content extends basis_db
|
||||
if($sichtbar)
|
||||
$qry.=" AND sichtbar=true";
|
||||
if($version!='')
|
||||
$qry.=" AND tbl_contentsprache.version='".addslashes($version)."'";
|
||||
$qry.=" ORDER BY version LIMIT 1";
|
||||
|
||||
$qry.=" AND tbl_contentsprache.version='".addslashes(intval($version))."'";
|
||||
$qry.=" ORDER BY version DESC LIMIT 1";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
@@ -95,6 +121,9 @@ class content extends basis_db
|
||||
$this->updatevon = $row->updatevon;
|
||||
$this->insertamum = $row->insertamum;
|
||||
$this->insertvon = $row->insertvon;
|
||||
$this->menu_open = ($row->menu_open=='t'?true:false);
|
||||
$this->aktiv = ($row->aktiv=='t'?true:false);
|
||||
$this->gesperrt_uid = $row->gesperrt_uid;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -109,7 +138,35 @@ class content extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Laedt die Organisationseinheit eines Contents
|
||||
*
|
||||
* @param $content_id
|
||||
* @return varchar oe_kurzbz des Contents
|
||||
*/
|
||||
public function getOrganisationseinheit($content_id)
|
||||
{
|
||||
$qry = "SELECT oe_kurzbz FROM campus.tbl_content WHERE content_id='".addslashes($content_id)."'";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
return $row->oe_kurzbz;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg.='Es wurde kein Eintrag mit dieser ID gefunden';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg.='Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Prueft ob der Zugriff auf den Content eingeschraenkt ist auf
|
||||
* eine bestimmte Benutzergruppe
|
||||
@@ -302,34 +359,7 @@ class content extends basis_db
|
||||
}
|
||||
}
|
||||
|
||||
public function getMenueArray($content_id)
|
||||
{
|
||||
$arr = array();
|
||||
if(!is_numeric($content_id))
|
||||
{
|
||||
$this->errormsg='ContentID ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "SELECT
|
||||
tbl_contentchild.content_id,
|
||||
tbl_contentchild.child_content_id,
|
||||
tbl_content.titel
|
||||
FROM
|
||||
campus.tbl_contentchild
|
||||
JOIN campus.tbl_content ON(tbl_contentchild.child_content_id=tbl_content.content_id)
|
||||
WHERE
|
||||
tbl_contentchild.content_id='".addslashes($content_id)."'";
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$arr[$row->titel]=array('name'=>$row->titel, 'link'=>APP_ROOT.'content.php?content_id='.$row->child_content_id, 'target'=>'main');
|
||||
$arr[$row->titel]=array_merge($arr[$row->titel],$this->getMenueArray($row->child_content_id));
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Speichert den XML Content
|
||||
@@ -355,33 +385,37 @@ class content extends basis_db
|
||||
|
||||
if($new)
|
||||
{
|
||||
$qry = "BEGIN;INSERT INTO campus.tbl_content(template_kurzbz, oe_kurzbz, titel, updatevon, updateamum, insertvon, insertamum) VALUES(".
|
||||
$qry = "BEGIN;INSERT INTO campus.tbl_content(template_kurzbz, oe_kurzbz, updatevon, updateamum, insertvon, insertamum, aktiv, menu_open) VALUES(".
|
||||
$this->addslashes($this->template_kurzbz).','.
|
||||
$this->addslashes($this->oe_kurzbz).','.
|
||||
$this->addslashes($this->titel).','.
|
||||
$this->addslashes($this->updatevon).','.
|
||||
$this->addslashes($this->updateamum).','.
|
||||
$this->addslashes($this->insertvon).','.
|
||||
$this->addslashes($this->insertamum).');'.
|
||||
'INSERT INTO campus.tbl_contentsprache(content, sprache, content_id, version, sichtbar, insertamum, insertvon) VALUES('.
|
||||
$this->addslashes($this->insertamum).','.
|
||||
($this->aktiv?'true':'false').','.
|
||||
($this->menu_open?'true':'false').');'.
|
||||
'INSERT INTO campus.tbl_contentsprache(content, sprache, content_id, version, sichtbar, insertamum, insertvon, titel) VALUES('.
|
||||
$this->addslashes($this->content).','.
|
||||
$this->addslashes($this->sprache).','.
|
||||
"currval('campus.seq_content_content_id'),".
|
||||
$this->addslashes($this->version).','.
|
||||
($this->sichtbar?'true':'false').','.
|
||||
$this->addslashes($this->insertamum).','.
|
||||
$this->addslashes($this->insertvon).');';
|
||||
$this->addslashes($this->insertvon).','.
|
||||
$this->addslashes($this->titel).');';
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry = "UPDATE campus.tbl_content SET ".
|
||||
" titel=".$this->addslashes($this->titel).','.
|
||||
" updatevon=".$this->addslashes($this->updatevon).','.
|
||||
" updateamum=".$this->addslashes($this->updateamum).','.
|
||||
" template_kurzbz=".$this->addslashes($this->template_kurzbz).','.
|
||||
" oe_kurzbz=".$this->addslashes($this->oe_kurzbz).
|
||||
" oe_kurzbz=".$this->addslashes($this->oe_kurzbz).','.
|
||||
" aktiv=".($this->aktiv?'true':'false').','.
|
||||
" menu_open=".($this->menu_open?'true':'false').
|
||||
" WHERE content_id='".addslashes($this->content_id)."';".
|
||||
"UPDATE campus.tbl_contentsprache SET ".
|
||||
" titel=".($this->addslashes($this->titel)).','.
|
||||
" sichtbar=".($this->sichtbar?'true':'false').
|
||||
" WHERE contentsprache_id='".addslashes($this->contentsprache_id)."';";
|
||||
}
|
||||
@@ -424,39 +458,7 @@ class content extends basis_db
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt die Child-Contents eines Eintrages
|
||||
*
|
||||
* @param $content_id
|
||||
*/
|
||||
public function getChilds($content_id)
|
||||
{
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
campus.tbl_contentchild
|
||||
JOIN campus.tbl_content ON(tbl_content.content_id=tbl_contentchild.child_content_id)
|
||||
WHERE
|
||||
tbl_contentchild.content_id='".addslashes($content_id)."'
|
||||
ORDER BY titel";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$obj = new content();
|
||||
|
||||
$obj->contentchild_id = $row->contentchild_id;
|
||||
$obj->content_id = $row->content_id;
|
||||
$obj->child_content_id = $row->child_content_id;
|
||||
$obj->titel = $row->titel;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Laedt alle Content Eintraege
|
||||
*
|
||||
@@ -495,16 +497,94 @@ class content extends basis_db
|
||||
}
|
||||
}
|
||||
|
||||
/************ Menue / Childnodes *****************/
|
||||
|
||||
/**
|
||||
* Liefert die Alle Childcontents des uebergebenen Contents als Array zurueck.
|
||||
* Dieses kann zB direkt in das Vilesci Menue integriert werden
|
||||
*
|
||||
* @param $content_id
|
||||
* @param $sprache
|
||||
*/
|
||||
public function getMenueArray($content_id, $sprache=DEFAULT_LANGUAGE, $sichtbar=null)
|
||||
{
|
||||
$arr = array();
|
||||
if(!is_numeric($content_id))
|
||||
{
|
||||
$this->errormsg='ContentID ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "SELECT
|
||||
tbl_contentchild.content_id,
|
||||
tbl_contentchild.child_content_id
|
||||
FROM
|
||||
campus.tbl_contentchild
|
||||
JOIN campus.tbl_content ON(tbl_contentchild.child_content_id=tbl_content.content_id)
|
||||
WHERE
|
||||
tbl_contentchild.content_id='".addslashes($content_id)."'
|
||||
AND aktiv=true
|
||||
ORDER BY sort
|
||||
";
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$content = new content();
|
||||
$content->getContent($row->child_content_id, $sprache, null, $sichtbar, true);
|
||||
|
||||
if($sichtbar && !$content->sichtbar)
|
||||
continue;
|
||||
|
||||
$arr[$content->titel]=array('name'=>$content->titel, 'link'=>APP_ROOT.'cms/content.php?content_id='.$row->child_content_id, 'target'=>'main', 'open'=>($content->menu_open?'true':'false'),'content_id'=>$content->content_id);
|
||||
$arr[$content->titel]=array_merge($arr[$content->titel],$this->getMenueArray($row->child_content_id, $sprache, $sichtbar));
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt die Child-Contents eines Eintrages
|
||||
*
|
||||
* @param $content_id
|
||||
*/
|
||||
public function getChilds($content_id)
|
||||
{
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
campus.tbl_contentchild
|
||||
JOIN campus.tbl_content ON(tbl_content.content_id=tbl_contentchild.child_content_id)
|
||||
WHERE
|
||||
tbl_contentchild.content_id='".addslashes($content_id)."'
|
||||
ORDER BY sort";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$obj = new content();
|
||||
|
||||
$obj->contentchild_id = $row->contentchild_id;
|
||||
$obj->content_id = $row->content_id;
|
||||
$obj->child_content_id = $row->child_content_id;
|
||||
$obj->sort = $row->sort;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt alle Content Eintraege die fuer den uebergeben Content als
|
||||
* Childnodes infrage kommen.
|
||||
* Eintraege bei denen es zu einer Rekursion im Tree kommen koennte werden
|
||||
* nicht geliefert
|
||||
*/
|
||||
public function getpossibleChilds($content_id)
|
||||
public function getpossibleChilds($content_id, $sprache=DEFAULT_LANGUAGE)
|
||||
{
|
||||
$qry = "SELECT
|
||||
*
|
||||
*, (SELECT titel FROM campus.tbl_contentsprache WHERE sprache='".addslashes($sprache)."' AND content_id=tbl_content.content_id ORDER BY version LIMIT 1) as titel
|
||||
FROM
|
||||
campus.tbl_content
|
||||
WHERE
|
||||
@@ -520,7 +600,8 @@ class content extends basis_db
|
||||
SELECT content_id
|
||||
FROM parents
|
||||
GROUP BY content_id)
|
||||
AND content_id<>'".addslashes($content_id)."'";
|
||||
AND content_id<>'".addslashes($content_id)."'
|
||||
ORDER BY titel";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
@@ -528,8 +609,8 @@ class content extends basis_db
|
||||
{
|
||||
$obj = new content();
|
||||
|
||||
$obj->content_id = $row->content_id;
|
||||
$obj->titel = $row->titel;
|
||||
$obj->content_id = $row->content_id;
|
||||
$obj->oe_kurzbz = $row->oe_kurzbz;
|
||||
$obj->template_kurzbz = $row->template_kurzbz;
|
||||
$obj->updateamum = $row->updateamum;
|
||||
@@ -547,6 +628,7 @@ class content extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loescht eine Contentzuordnung
|
||||
*
|
||||
@@ -568,7 +650,7 @@ class content extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fuegt eine Gruppe zu einem Content hinzu
|
||||
* @return boolean
|
||||
@@ -592,6 +674,252 @@ class content extends basis_db
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt alle Content Eintraege die keine Childs von anderen Contenteintraegen sind
|
||||
* @return boolean
|
||||
*/
|
||||
public function getRootContent()
|
||||
{
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM (
|
||||
SELECT
|
||||
distinct on(content_id) *
|
||||
FROM
|
||||
campus.tbl_content
|
||||
LEFT JOIN campus.tbl_contentchild USING(content_id)
|
||||
WHERE content_id NOT IN (SELECT child_content_id FROM campus.tbl_contentchild WHERE child_content_id=tbl_content.content_id)
|
||||
) as a
|
||||
ORDER BY sort";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$obj = new content();
|
||||
|
||||
$obj->content_id = $row->content_id;
|
||||
$obj->template_kurzbz = $row->template_kurzbz;
|
||||
$obj->oe_kurzbz = $row->oe_kurzbz;
|
||||
$obj->updatevon = $row->updatevon;
|
||||
$obj->updateamum = $row->updateamum;
|
||||
$obj->insertamum = $row->insertamum;
|
||||
$obj->insertvon = $row->insertvon;
|
||||
$obj->aktiv = ($row->aktiv=='t'?true:false);
|
||||
$obj->menu_open = ($row->menu_open=='t'?true:false);
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sortiert einen Menueeintrag nach oben
|
||||
* @param $contentchild_id
|
||||
*/
|
||||
public function SortUp($contentchild_id)
|
||||
{
|
||||
$qry = "SELECT
|
||||
sort, contentchild_id
|
||||
FROM
|
||||
campus.tbl_contentchild
|
||||
WHERE
|
||||
content_id=(SELECT content_id FROM campus.tbl_contentchild
|
||||
WHERE contentchild_id='".addslashes($contentchild_id)."')
|
||||
AND sort<(SELECT sort FROM campus.tbl_contentchild
|
||||
WHERE contentchild_id='".addslashes($contentchild_id)."')
|
||||
ORDER BY sort DESC LIMIT 1;";
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$nachbar_id = $row->contentchild_id;
|
||||
$nachbar_sort = $row->sort;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler bei Abfrage';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "UPDATE campus.tbl_contentchild
|
||||
SET sort=(SELECT sort FROM campus.tbl_contentchild
|
||||
WHERE contentchild_id='".addslashes($contentchild_id)."')
|
||||
WHERE contentchild_id='".addslashes($nachbar_id)."';
|
||||
UPDATE campus.tbl_contentchild SET sort='".addslashes($nachbar_sort)."'
|
||||
WHERE contentchild_id='".addslashes($contentchild_id)."';";
|
||||
if($this->db_query($qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errosmg='Fehler beim Setzen der Sortierung';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sortiert einen Menueeintrag nach unten
|
||||
* @param $contentchild_id
|
||||
*/
|
||||
public function SortDown($contentchild_id)
|
||||
{
|
||||
$qry = "SELECT
|
||||
sort, contentchild_id
|
||||
FROM
|
||||
campus.tbl_contentchild
|
||||
WHERE
|
||||
content_id=(SELECT content_id FROM campus.tbl_contentchild
|
||||
WHERE contentchild_id='".addslashes($contentchild_id)."')
|
||||
AND sort>(SELECT sort FROM campus.tbl_contentchild
|
||||
WHERE contentchild_id='".addslashes($contentchild_id)."')
|
||||
ORDER BY sort ASC LIMIT 1;";
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$nachbar_id = $row->contentchild_id;
|
||||
$nachbar_sort = $row->sort;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler bei Abfrage';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "UPDATE campus.tbl_contentchild
|
||||
SET sort=(SELECT sort FROM campus.tbl_contentchild
|
||||
WHERE contentchild_id='".addslashes($contentchild_id)."')
|
||||
WHERE contentchild_id='".addslashes($nachbar_id)."';
|
||||
UPDATE campus.tbl_contentchild SET sort='".addslashes($nachbar_sort)."'
|
||||
WHERE contentchild_id='".addslashes($contentchild_id)."';";
|
||||
if($this->db_query($qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errosmg='Fehler beim Setzen der Sortierung';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/************ Contentsprache *****************/
|
||||
|
||||
/**
|
||||
* Speichert den Contentsprache Eintrag
|
||||
*
|
||||
* @param boolean $new
|
||||
*/
|
||||
public function saveContentSprache($new=null)
|
||||
{
|
||||
if(is_null($new))
|
||||
$new = $this->new;
|
||||
|
||||
if($new)
|
||||
{
|
||||
$qry = 'INSERT INTO campus.tbl_contentsprache(sprache, content_id, version, sichtbar, content,
|
||||
reviewvon, reviewamum, updateamum, updatevon, insertamum, insertvon, titel, gesperrt_uid) VALUES('.
|
||||
$this->addslashes($this->sprache).','.
|
||||
$this->addslashes($this->content_id).','.
|
||||
$this->addslashes($this->version).','.
|
||||
($this->sichtbar?'true':'false').','.
|
||||
$this->addslashes($this->content).','.
|
||||
$this->addslashes($this->reviewvon).','.
|
||||
$this->addslashes($this->reviewamum).','.
|
||||
$this->addslashes($this->updateamum).','.
|
||||
$this->addslashes($this->updatevon).','.
|
||||
$this->addslashes($this->insertamum).','.
|
||||
$this->addslashes($this->insertvon).','.
|
||||
$this->addslashes($this->titel).','.
|
||||
$this->addslashes($this->gesperrt_uid).');';
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry = "UPDATE campus.tbl_contentsprache SET ".
|
||||
" sprache=".$this->addslashes($this->sprache).','.
|
||||
" content_id=".$this->addslashes($this->content_id).','.
|
||||
" version=".$this->addslashes($this->version).','.
|
||||
" sichtbar=".($this->sichtbar?'true':'false').','.
|
||||
" content=".$this->addslashes($this->content).','.
|
||||
" reviewvon=".$this->addslashes($this->reviewvon).','.
|
||||
" reviewamum=".$this->addslashes($this->reviewamum).','.
|
||||
" updatevon=".$this->addslashes($this->updatevon).','.
|
||||
" updateamum=".$this->addslashes($this->updateamum).','.
|
||||
" titel=".$this->addslashes($this->titel).','.
|
||||
" gesperrt_uid=".$this->addslashes($this->gesperrt_uid).
|
||||
" WHERE contentsprache_id='".addslashes($this->contentsprache_id)."';";
|
||||
}
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($new)
|
||||
{
|
||||
$qry = "SELECT currval('campus.seq_contentsprache') as contentsprache_id";
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$this->contentsprache_id = $row->contentsprache_id;
|
||||
$this->db_query('COMMIT;');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Auslesen der Sequence';
|
||||
$this->db_query('ROLLBACK;');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Auslesen der Sequence';
|
||||
$this->db_query('ROLLBACK;');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Speichern der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert die hoechste Versionsnummer eines Contents/Sprache
|
||||
*
|
||||
* @param $content_id
|
||||
* @param $sprache
|
||||
*/
|
||||
public function getMaxVersion($content_id, $sprache)
|
||||
{
|
||||
$qry = "SELECT max(version) maxversion FROM campus.tbl_contentsprache WHERE content_id='".addslashes($content_id)."' AND sprache='".addslashes($sprache)."'";
|
||||
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 Versionen des Contents
|
||||
*
|
||||
@@ -601,7 +929,7 @@ class content extends basis_db
|
||||
{
|
||||
$qry = "SELECT
|
||||
contentsprache_id, sprache, content_id, version, sichtbar, reviewamum, reviewvon,
|
||||
updateamum, updatevon, insertamum, insertvon
|
||||
updateamum, updatevon, insertamum, insertvon, titel
|
||||
FROM campus.tbl_contentsprache
|
||||
WHERE content_id='".addslashes($content_id)."' AND sprache='".addslashes($sprache)."'
|
||||
ORDER BY version DESC";
|
||||
@@ -614,6 +942,7 @@ class content extends basis_db
|
||||
|
||||
$obj->contentsprache_id = $row->contentsprache_id;
|
||||
$obj->sprache = $row->sprache;
|
||||
$obj->titel = $row->titel;
|
||||
$obj->content_id = $row->content_id;
|
||||
$obj->version = $row->version;
|
||||
$obj->sichtbar = ($row->sichtbar=='t'?true:false);
|
||||
@@ -634,5 +963,172 @@ class content extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert die Sprachen in denen der Content vorhanden ist
|
||||
*
|
||||
* @param $content_id
|
||||
* @param $version
|
||||
*/
|
||||
public function getLanguages($content_id)
|
||||
{
|
||||
$qry = "SELECT distinct sprache FROM campus.tbl_contentsprache WHERE content_id='".addslashes($content_id)."'";
|
||||
$sprachen = array();
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$sprachen[]=$row->sprache;
|
||||
}
|
||||
}
|
||||
array_unique($sprachen);
|
||||
return $sprachen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prueft ob der Content in der angegeben Sprache vorhanden ist
|
||||
* @param $content_id
|
||||
* @param $sprache
|
||||
* @param $version optional
|
||||
* @return boolean
|
||||
*/
|
||||
public function contentSpracheExists($content_id, $sprache, $version=null, $sichtbar=null)
|
||||
{
|
||||
$qry = "SELECT 1 FROM campus.tbl_contentsprache
|
||||
WHERE
|
||||
content_id='".addslashes($content_id)."'
|
||||
AND sprache='".addslashes($sprache)."'
|
||||
";
|
||||
if(!is_null($version) && $version!='')
|
||||
$qry.=" AND version='".addslashes(intval($version))."'";
|
||||
if($sichtbar)
|
||||
$qry.=" AND sichtbar=".($sichtbar?'true':'false');
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($this->db_num_rows($result)>0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehlerhafte SQL Abfrage';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt einen Eintrag der Tabelle Contentsprache
|
||||
*
|
||||
* @param $contentsprache_id
|
||||
*/
|
||||
public function loadContentSprache($contentsprache_id)
|
||||
{
|
||||
$qry = "SELECT * FROM campus.tbl_contentsprache WHERE contentsprache_id='".addslashes($contentsprache_id)."'";
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$this->contentsprache_id = $row->contentsprache_id;
|
||||
$this->sprache = $row->sprache;
|
||||
$this->content_id = $row->content_id;
|
||||
$this->version = $row->version;
|
||||
$this->sichtbar = $row->sichtbar;
|
||||
$this->content = $row->content;
|
||||
$this->reviewvon = $row->reviewvon;
|
||||
$this->reviewamum = $row->reviewamum;
|
||||
$this->updateamum = $row->updateamum;
|
||||
$this->updatevon = $row->updatevon;
|
||||
$this->insertamum = $row->insertamum;
|
||||
$this->insertvon = $row->insertvon;
|
||||
$this->titel = $row->titel;
|
||||
$this->gesperrt_uid = $row->gesperrt_uid;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Es ist kein Eintrag mit dieser ID vorhanden';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/************ ContentLOG *****************/
|
||||
|
||||
/**
|
||||
* Liefert den Logeintrag der fuer die Sperre verantwortlich ist
|
||||
*
|
||||
* @param $contentsprache_id
|
||||
*/
|
||||
public function getSperrLog($contentsprache_id)
|
||||
{
|
||||
$qry = "SELECT * FROM campus.tbl_contentlog WHERE contentsprache_id='".addslashes($contentsprache_id)."' AND ende is null LIMIT 1;";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$this->contentlog_id=$row->contentlog_id;
|
||||
$this->contentsprache_id=$row->contentsprache_id;
|
||||
$this->uid = $row->uid;
|
||||
$this->start = $row->start;
|
||||
$this->ende = $row->ende;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sperrt einen Eintrag zum Bearbeiten
|
||||
*
|
||||
* @param $contentsprache_id
|
||||
* @param $user
|
||||
*/
|
||||
public function sperren($contentsprache_id, $user)
|
||||
{
|
||||
$qry = 'INSERT INTO campus.tbl_contentlog(uid, contentsprache_id, start) VALUES('.
|
||||
$this->addslashes($user).','.
|
||||
$this->addslashes($contentsprache_id).',now());
|
||||
UPDATE campus.tbl_contentsprache SET gesperrt_uid='.$this->addslashes($user).
|
||||
' WHERE contentsprache_id='.$this->addslashes($contentsprache_id);
|
||||
|
||||
if($this->db_query($qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Sperren';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt einen Eintrag nach dem Bearbeiten wieder frei
|
||||
*
|
||||
* @param $contentsprache_id
|
||||
* @param $user
|
||||
*/
|
||||
public function freigeben($contentsprache_id, $user)
|
||||
{
|
||||
$qry = 'UPDATE campus.tbl_contentlog SET ende=now() WHERE'.
|
||||
' uid='.$this->addslashes($user).
|
||||
' AND contentsprache_id='.$this->addslashes($contentsprache_id).
|
||||
' AND ende is null;'.
|
||||
'UPDATE campus.tbl_contentsprache SET gesperrt_uid=null;';
|
||||
|
||||
if($this->db_query($qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Sperren';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -837,15 +837,15 @@ function manual_basic_auth()
|
||||
*/
|
||||
function getSprache()
|
||||
{
|
||||
if(isset($_SESSION['FHC_SPRACHE']))
|
||||
if(isset($_SESSION['sprache']))
|
||||
{
|
||||
$sprache=$_SESSION['FHC_SPRACHE'];
|
||||
$sprache=$_SESSION['sprache'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($_COOKIE['FHC_SPRACHE']))
|
||||
if(isset($_COOKIE['sprache']))
|
||||
{
|
||||
$sprache=$_COOKIE['FHC_SPRACHE'];
|
||||
$sprache=$_COOKIE['sprache'];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -862,7 +862,7 @@ function getSprache()
|
||||
*/
|
||||
function setSprache($sprache)
|
||||
{
|
||||
$_SESSION['FHC_SPRACHE']=$sprache;
|
||||
setcookie('FHC_SPRACHE',$sprache,time()+60*60*24*30,'/');
|
||||
$_SESSION['sprache']=$sprache;
|
||||
setcookie('sprache',$sprache,time()+60*60*24*30,'/');
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -390,6 +390,40 @@ class organisationseinheit extends basis_db
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert die OEs die im Tree ueberhalb der uebergebene OE liegen
|
||||
*
|
||||
* @param $oe_kurzbz
|
||||
*/
|
||||
public function getParents($oe_kurzbz)
|
||||
{
|
||||
$parents=array();
|
||||
|
||||
$qry="WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz) as
|
||||
(
|
||||
SELECT oe_kurzbz, oe_parent_kurzbz FROM public.tbl_organisationseinheit
|
||||
WHERE oe_kurzbz='".addslashes($oe_kurzbz)."' and aktiv = true
|
||||
UNION ALL
|
||||
SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes
|
||||
WHERE o.oe_kurzbz=oes.oe_parent_kurzbz and aktiv = true
|
||||
)
|
||||
SELECT oe_kurzbz
|
||||
FROM oes";
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$parents[]=$row->oe_kurzbz;
|
||||
}
|
||||
return $parents;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prueft ob $child eine Organisationseinheit unterhalb der OE $oe_kurzbz ist
|
||||
*
|
||||
|
||||
@@ -28,11 +28,12 @@ require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
class sprache extends basis_db
|
||||
{
|
||||
public $result;
|
||||
|
||||
public static $index_arr;
|
||||
public $sprache; // string
|
||||
public $locale;
|
||||
public $index; // int, id des array index
|
||||
public $content; // boolean
|
||||
public $bezeichnung_arr;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -77,9 +78,13 @@ class sprache extends basis_db
|
||||
* Lädt alle verfügbaren Sprachen
|
||||
* @return true bei Erfolg, false wenn ein Fehler aufgetreten ist.
|
||||
*/
|
||||
public function getAll()
|
||||
public function getAll($content=null)
|
||||
{
|
||||
$qry = "SELECT * FROM public.tbl_sprache;";
|
||||
$qry = "SELECT *,".$this->getSprachQuery('bezeichnung')." FROM public.tbl_sprache";
|
||||
|
||||
if(!is_null($content))
|
||||
$qry.= " WHERE content=".($content?'true':'false');
|
||||
$qry.=" ORDER BY sprache";
|
||||
|
||||
if(!$this->db_query($qry))
|
||||
{
|
||||
@@ -94,12 +99,35 @@ class sprache extends basis_db
|
||||
$sprache->locale = $row->locale;
|
||||
$sprache->index = $row->index;
|
||||
$sprache->content = ($row->content=='t'?true:false);
|
||||
$sprache->bezeichnung_arr=$this->parseSprachResult('bezeichnung',$row);
|
||||
|
||||
$this->result[] = $sprache;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Lädt das Index Array
|
||||
* @return true bei Erfolg, false wenn ein Fehler aufgetreten ist.
|
||||
*/
|
||||
public function loadIndexArray()
|
||||
{
|
||||
$qry = "SELECT sprache, index FROM public.tbl_sprache ORDER BY index";
|
||||
|
||||
if(!$this->db_query($qry))
|
||||
{
|
||||
$this->errormsg ="Fehler bei der Abfrage.";
|
||||
return false;
|
||||
}
|
||||
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->index_arr[$row->sprache]=$row->index;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Löscht die übergebene Sprache
|
||||
@@ -151,7 +179,7 @@ class sprache extends basis_db
|
||||
public function getSpracheFromIndex($index)
|
||||
{
|
||||
$sprache = '';
|
||||
$qry = "SELECT sprache FROM public.tbl_sprache WHERE index = $index ;";
|
||||
$qry = "SELECT sprache FROM public.tbl_sprache WHERE index = '".addslashes($index)."';";
|
||||
|
||||
if(!$this->db_query($qry))
|
||||
{
|
||||
@@ -165,4 +193,50 @@ class sprache extends basis_db
|
||||
}
|
||||
return $sprache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert einen String mit den aufgespaltenen Elementen fuer mehrsprachige Arrays
|
||||
* Der Result der Query kann dann mittels parseSprachResult wieder in ein Array umgewandelt werden
|
||||
*
|
||||
* @param $feldname
|
||||
* @return string mit den aufgeschluesselten Arrayelementen der Sprache
|
||||
*/
|
||||
public function getSprachQuery($feldname)
|
||||
{
|
||||
$result = '';
|
||||
|
||||
if(!isset($this->index_arr))
|
||||
$this->loadIndexArray();
|
||||
|
||||
foreach($this->index_arr as $sprache=>$index)
|
||||
{
|
||||
$result .= $feldname.'['.$index.'] as '.$feldname.'_'.$index.',';
|
||||
}
|
||||
return mb_substr($result,0,-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wandelt den Result von mehrsprachigen Arrays in einer SQL Query in ein PHP Array um
|
||||
*
|
||||
* @param $feldname name der Datenbankspalte
|
||||
* @param $row row des SQL Results
|
||||
* @return array mit den Sprachen der Spalte
|
||||
*/
|
||||
public function parseSprachResult($feldname, $row)
|
||||
{
|
||||
$result = array();
|
||||
|
||||
if(!isset($this->index_arr))
|
||||
$this->getAll();
|
||||
|
||||
foreach($this->index_arr as $sprache=>$index)
|
||||
{
|
||||
$name = $feldname.'_'.$index;
|
||||
if(isset($row->$name))
|
||||
$result[$sprache] = $row->$name;
|
||||
else
|
||||
$result[$sprache] = null;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
+16
-4
@@ -430,9 +430,13 @@ TABLE.stdplan TD
|
||||
/* Fonts */
|
||||
h1
|
||||
{
|
||||
font-size: medium;
|
||||
font-size: small;
|
||||
color: #ffffff;
|
||||
background-color: #009e84;
|
||||
background-color: #008381; /*gruen*/
|
||||
font-weight: bold;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
padding-left: 4px;
|
||||
}
|
||||
h1 td
|
||||
{
|
||||
@@ -452,9 +456,17 @@ h1 a:hover
|
||||
|
||||
h2
|
||||
{
|
||||
/*
|
||||
font-size: small;
|
||||
color: #ffffff;
|
||||
background-color: #00a4d2; /*hellblau*/
|
||||
background-color: #00a4d2;
|
||||
*/
|
||||
background-color: #CCCCCC; /*mittel-grau */
|
||||
font-weight: normal;
|
||||
font-size: small;
|
||||
height: 19px;
|
||||
padding-top: 2px;
|
||||
padding-left: 2px;
|
||||
}
|
||||
h2 td
|
||||
{
|
||||
@@ -510,7 +522,7 @@ font.ContentHeader
|
||||
background-color: #F0F0F0;
|
||||
|
||||
}
|
||||
#news .news .titel
|
||||
#news .news .titel table
|
||||
{
|
||||
font-weight: bold;
|
||||
font-size: small;
|
||||
|
||||
@@ -2307,9 +2307,9 @@ if(!@$db->db_query("SELECT zgv FROM public.tbl_preincoming LIMIT 1"))
|
||||
ALTER TABLE public.tbl_preincoming ADD COLUMN person_id_coordinator_int integer;
|
||||
ALTER TABLE public.tbl_preincoming ADD COLUMN code varchar(64);
|
||||
|
||||
ALTER TABLE public.tbl_preincoming ADD CONSTRAINT fk_person_preincoming_emergency FOREIGN KEY(person_id) REFERENCES public.tbl_person (person_id) ON UPDATE CASCADE ON DELETE RESTRICT;
|
||||
ALTER TABLE public.tbl_preincoming ADD CONSTRAINT fk_person_preincoming_coordinator_dep FOREIGN KEY(person_id) REFERENCES public.tbl_person (person_id) ON UPDATE CASCADE ON DELETE RESTRICT;
|
||||
ALTER TABLE public.tbl_preincoming ADD CONSTRAINT fk_person_preincoming_coordinator_int FOREIGN KEY(person_id) REFERENCES public.tbl_person (person_id) ON UPDATE CASCADE ON DELETE RESTRICT;
|
||||
ALTER TABLE public.tbl_preincoming ADD CONSTRAINT fk_person_preincoming_emergency FOREIGN KEY(person_id_emergency) REFERENCES public.tbl_person (person_id) ON UPDATE CASCADE ON DELETE RESTRICT;
|
||||
ALTER TABLE public.tbl_preincoming ADD CONSTRAINT fk_person_preincoming_coordinator_dep FOREIGN KEY(person_id_coordinator_dep) REFERENCES public.tbl_person (person_id) ON UPDATE CASCADE ON DELETE RESTRICT;
|
||||
ALTER TABLE public.tbl_preincoming ADD CONSTRAINT fk_person_preincoming_coordinator_int FOREIGN KEY(person_id_coordinator_int) REFERENCES public.tbl_person (person_id) ON UPDATE CASCADE ON DELETE RESTRICT;
|
||||
ALTER TABLE public.tbl_preincoming ALTER COLUMN bachelor SET NOT NULL;
|
||||
ALTER TABLE public.tbl_preincoming ALTER COLUMN master SET NOT NULL;
|
||||
";
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="news">
|
||||
<xs:element name="datum" type="xs:date"/>
|
||||
<xs:element name="verfasser" type="xs:string"/>
|
||||
<xs:element name="betreff" type="xs:string"/>
|
||||
<xs:element name="text" type="wysiwyg"/>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:template match="/">
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../skin/style.css.php" type="text/css" />
|
||||
<title>News</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>News</h1>
|
||||
<div id="news">
|
||||
<xsl:apply-templates match="news" />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
<xsl:template match="news">
|
||||
|
||||
<div class="news">
|
||||
<div class="titel">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td width="60%" align="left"><xsl:value-of select="betreff"/></td>
|
||||
<td width="40%" align="right"><xsl:value-of select="verfasser"/> <span style="font-weight: normal"> ( <xsl:value-of select="datum"/> )</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="text">
|
||||
<xsl:value-of select="text" disable-output-escaping="yes" />
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
</xsl:template>
|
||||
</xsl:stylesheet >
|
||||
|
||||
|
||||
Reference in New Issue
Block a user