openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit e96b1998646cc8cd601b41bd361ba20845aeb9b3
parent d004de12ad2fc1146f517ccc79ae47b02f829edd
Author: dankert <devnull@localhost>
Date:   Wed, 10 Nov 2004 23:43:35 +0100

Beispiele fuer dynamische Templateelemente

Diffstat:
dynamicClasses/BreadCrumb.class.php | 115+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
dynamicClasses/CommonMenu.class.php | 95+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
dynamicClasses/LastPage.class.php | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
dynamicClasses/NextPage.class.php | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
dynamicClasses/PagesNavigation.class.php | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 447 insertions(+), 0 deletions(-)

diff --git a/dynamicClasses/BreadCrumb.class.php b/dynamicClasses/BreadCrumb.class.php @@ -0,0 +1,114 @@ +<?php +// --------------------------------------------------------------------------- +// $Id$ +// --------------------------------------------------------------------------- +// OpenRat Content Management System +// Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de +// +// 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. +// --------------------------------------------------------------------------- +// $Log$ +// Revision 1.1 2004-11-10 22:43:35 dankert +// Beispiele fuer dynamische Templateelemente +// +// --------------------------------------------------------------------------- + + + +/** + * Erstellen eines Menues + * @author Jan Dankert + */ +class Sitemap /*extends DynamicElement*/ +{ + /** + * Bitte immer alle Parameter in dieses Array schreiben, dies ist fuer den Web-Developer hilfreich. + * @type String + */ + var $parameters = Array( + 'beforeEntry'=>'Chars before an active menu entry' + ); + + /** + * Bitte immer eine Beschreibung benutzen, dies ist fuer den Web-Developer hilfreich. + * @type String + */ + var $description = 'Creates a main menu.'; + + + /** + * Zeichenkette, die vor einem aktiven Menuepunkt gezeigt wird + */ + var $beforeEntry = '<li><strong>'; + var $afterEntry = '</strong></li>'; + + var $api; + + /** + * Erstellen einer Sitemap + */ + function execute() + { + // Erstellen eines Untermenues + + // Ermitteln der aktuellen Seite + $thispage = new Page( $this->api->getObjectId() ); + $thispage->load(); // Seite laden + + // uebergeordneter Ordner dieser Seite + $this->showFolder( Folder::getRootObjectId() ); + } + + function showFolder( $oid ) + { + // uebergeordneter Ordner dieser Seite + $f = new Folder( $oid ); + + // Schleife ueber alle Objekte im aktuellen Ordner + foreach( $f->getObjectIds() as $id ) + { + $o = new Object( $id ); + $o->languageid = $this->page->languageid; + $o->load(); + + // Ordner + if ($o->isFolder ) + { + $this->api->output( '<li><strong>'.$o->name.'</strong><br/>' ); + $this->api->output( '<ul>' ); + $this->showFolder( $id ); // Rekursiver Aufruf dieser Methode + $this->api->output( '</ul></li>' ); + } + + // Seiten und Verkn?fpungen + if ($o->isPage || $o->isLink ) + { + // Wenn aktuelle Seite, dann markieren, sonst Link + if ( $this->api->getObjectId() == $id ) + { + // aktuelle Seite + $this->api->output( '<li><strong>'.$o->name.'</strong></li>' ); + } + else + { + // Link erzeugen + $this->api->output( '<li><a href="'.$this->api->page->path_to_object($id).'">'.$o->name.'</a></li>' ); + } + } + } + } +} + +?>+ \ No newline at end of file diff --git a/dynamicClasses/CommonMenu.class.php b/dynamicClasses/CommonMenu.class.php @@ -0,0 +1,94 @@ +<?php +// --------------------------------------------------------------------------- +// $Id$ +// --------------------------------------------------------------------------- +// OpenRat Content Management System +// Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de +// +// 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. +// --------------------------------------------------------------------------- +// $Log$ +// Revision 1.1 2004-11-10 22:43:35 dankert +// Beispiele fuer dynamische Templateelemente +// +// --------------------------------------------------------------------------- + + + +/** + * Erstellen eines Menues + * @author Jan Dankert + */ +class CommonMenu /*extends DynamicElement*/ +{ + /** + * Bitte immer alle Parameter in dieses Array schreiben, dies ist fuer den Web-Developer hilfreich. + * @type String + */ + var $parameters = Array( + 'beforeEntry'=>'Chars before an active menu entry' + ); + + /** + * Bitte immer eine Beschreibung benutzen, dies ist fuer den Web-Developer hilfreich. + * @type String + */ + var $description = 'Creates a main menu.'; + + + /** + * Zeichenkette, die vor einem aktiven Menuepunkt gezeigt wird + */ + var $beforeEntry = '<li><strong>'; + var $afterEntry = '</strong></li>'; + + var $api; + + // Erstellen des Hauptmenues + function execute() + { + // Erstellen eines Untermenues + + // Ermitteln der aktuellen Seite + $thispage = new Page( $this->api->getObjectId() ); + $thispage->load(); // Seite laden + + // uebergeordneter Ordner dieser Seite + $f = new Folder( $thispage->parentid ); + + // Schleife ueber alle Objekte im aktuellen Ordner + foreach( $f->getObjectIds() as $id ) + { + $o = new Object( $id ); + $o->languageid = $this->page->languageid; + $o->load(); + + // Nur Seiten anzeigen + if (!$o->isPage && !$o->isLink ) continue; + + // Wenn aktuelle Seite, dann markieren, sonst Link + if ( $this->api->getObjectId() == $id ) + { + // aktuelle Seite + $this->api->output( '<li><strong>'.$o->name.'</strong></li>' ); + } + else + { + // Link erzeugen + $this->api->output( '<li><a href="'.$this->api->page->path_to_object($id).'">'.$o->name.'</a></li>' ); + } + } + } +}+ \ No newline at end of file diff --git a/dynamicClasses/LastPage.class.php b/dynamicClasses/LastPage.class.php @@ -0,0 +1,78 @@ +<?php +// --------------------------------------------------------------------------- +// $Id$ +// --------------------------------------------------------------------------- +// OpenRat Content Management System +// Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de +// +// 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. +// --------------------------------------------------------------------------- +// $Log$ +// Revision 1.1 2004-11-10 22:43:35 dankert +// Beispiele fuer dynamische Templateelemente +// +// --------------------------------------------------------------------------- + + + +/** + * Erstellen eines Hauptmenues + * @author Jan Dankert + */ +class MainMenu /*extends DynamicElement*/ +{ + /** + * Bitte immer alle Parameter in dieses Array schreiben, dies ist fuer den Web-Developer hilfreich. + * @type String + */ + var $parameters = Array( + 'arrowChar'=>'String between menu entries, default: "&middot;"' + ); + + + var $arrowChar = ' &middot; '; + + /** + * Bitte immer eine Beschreibung benutzen, dies ist fuer den Web-Developer hilfreich. + * @type String + */ + var $description = 'Creates a main menu.'; + var $version = '$Id$'; + var $api; + + // Erstellen des Hauptmenues + function execute() + { + // Lesen des Root-Ordners + $folder = new Folder( Api::getRootObjectId() ); + + // Schleife ueber alle Inhalte des Root-Ordners + foreach( $folder->getObjectIds() as $id ) + { + $o = new Object( $id ); + $o->languageid = $this->page->languageid; + $o->load(); + if ( $o->isFolder ) // Nur wenn Ordner + { + $f = new Folder( $id ); + + // Ermitteln eines Objektes mit dem Dateinamen index + $oid = $f->getObjectIdByFileName('index'); + if ( is_numeric($oid) && $oid!=0 ) + $this->api->output( $this->arrowChar.'<a href="'.$this->page->path_to_object($oid).'" title="'.$o->desc.'">'.$o->name.'</a>' ); + } + } + } +}+ \ No newline at end of file diff --git a/dynamicClasses/NextPage.class.php b/dynamicClasses/NextPage.class.php @@ -0,0 +1,78 @@ +<?php +// --------------------------------------------------------------------------- +// $Id$ +// --------------------------------------------------------------------------- +// OpenRat Content Management System +// Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de +// +// 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. +// --------------------------------------------------------------------------- +// $Log$ +// Revision 1.1 2004-11-10 22:43:35 dankert +// Beispiele fuer dynamische Templateelemente +// +// --------------------------------------------------------------------------- + + + +/** + * Erstellen eines Hauptmenues + * @author Jan Dankert + */ +class MainMenu /*extends DynamicElement*/ +{ + /** + * Bitte immer alle Parameter in dieses Array schreiben, dies ist fuer den Web-Developer hilfreich. + * @type String + */ + var $parameters = Array( + 'arrowChar'=>'String between menu entries, default: "&middot;"' + ); + + + var $arrowChar = ' &middot; '; + + /** + * Bitte immer eine Beschreibung benutzen, dies ist fuer den Web-Developer hilfreich. + * @type String + */ + var $description = 'Creates a main menu.'; + var $version = '$Id$'; + var $api; + + // Erstellen des Hauptmenues + function execute() + { + // Lesen des Root-Ordners + $folder = new Folder( Api::getRootObjectId() ); + + // Schleife ueber alle Inhalte des Root-Ordners + foreach( $folder->getObjectIds() as $id ) + { + $o = new Object( $id ); + $o->languageid = $this->page->languageid; + $o->load(); + if ( $o->isFolder ) // Nur wenn Ordner + { + $f = new Folder( $id ); + + // Ermitteln eines Objektes mit dem Dateinamen index + $oid = $f->getObjectIdByFileName('index'); + if ( is_numeric($oid) && $oid!=0 ) + $this->api->output( $this->arrowChar.'<a href="'.$this->page->path_to_object($oid).'" title="'.$o->desc.'">'.$o->name.'</a>' ); + } + } + } +}+ \ No newline at end of file diff --git a/dynamicClasses/PagesNavigation.class.php b/dynamicClasses/PagesNavigation.class.php @@ -0,0 +1,78 @@ +<?php +// --------------------------------------------------------------------------- +// $Id$ +// --------------------------------------------------------------------------- +// OpenRat Content Management System +// Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de +// +// 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. +// --------------------------------------------------------------------------- +// $Log$ +// Revision 1.1 2004-11-10 22:43:35 dankert +// Beispiele fuer dynamische Templateelemente +// +// --------------------------------------------------------------------------- + + + +/** + * Erstellen eines Hauptmenues + * @author Jan Dankert + */ +class MainMenu /*extends DynamicElement*/ +{ + /** + * Bitte immer alle Parameter in dieses Array schreiben, dies ist fuer den Web-Developer hilfreich. + * @type String + */ + var $parameters = Array( + 'arrowChar'=>'String between menu entries, default: "&middot;"' + ); + + + var $arrowChar = ' &middot; '; + + /** + * Bitte immer eine Beschreibung benutzen, dies ist fuer den Web-Developer hilfreich. + * @type String + */ + var $description = 'Creates a main menu.'; + var $version = '$Id$'; + var $api; + + // Erstellen des Hauptmenues + function execute() + { + // Lesen des Root-Ordners + $folder = new Folder( Api::getRootObjectId() ); + + // Schleife ueber alle Inhalte des Root-Ordners + foreach( $folder->getObjectIds() as $id ) + { + $o = new Object( $id ); + $o->languageid = $this->page->languageid; + $o->load(); + if ( $o->isFolder ) // Nur wenn Ordner + { + $f = new Folder( $id ); + + // Ermitteln eines Objektes mit dem Dateinamen index + $oid = $f->getObjectIdByFileName('index'); + if ( is_numeric($oid) && $oid!=0 ) + $this->api->output( $this->arrowChar.'<a href="'.$this->page->path_to_object($oid).'" title="'.$o->desc.'">'.$o->name.'</a>' ); + } + } + } +}+ \ No newline at end of file