Login   Register  
PHP Classes
elePHPant
Icontem

File: showBookmarks.tpl.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of barry@nauta.be  >  Bookmarks  >  showBookmarks.tpl.php  >  Download  
File: showBookmarks.tpl.php
Role: Application script
Content type: text/plain
Description: Showing bookmarks
Class: Bookmarks
Manage lists of bookmark with Web interface
Author: By
Last change:
Date: 2004-04-27 12:31
Size: 3,288 bytes
 

Contents

Class file image Download
<?php
/**
 * The template file to show bookmarks, instantiates a proper tree-delegate and tree renderer
 * 
 * @package be.nauta.booby.plugins.bookmarks.view
 * @author Barry Nauta
 * @copyright Barry Nauta
 * 
 * This file is part of the Booby project.
 * The booby project is located at the following location:
 * http://www.nauta.be/booby/
 *
 * Copyright (c) 2003 - 2004 Barry Nauta
 *
 * The Booby project is released under the General Public License
 * More detailes in the file 'gpl.html' or on the following
 * website: <code>http://www.gnu.org</code> and look for licenses
 *
 * Enjoy :-)
 */
    /*
     * Show the ancestor path. Contributed by Michael
     */
    
if(isset($parameters['ancestors']) && $parentId != 0)
    {
        echo (
'<!-- Ancestors -->');
        echo (
'<table><tr>');
        
        
// The root link
        
echo ('<td><a href="?parentId=0" class="ancestor">'.$dictionary['root'].'</a></td>');

        
// all ancestors other than root
        
foreach($parameters['ancestors'] as $ancestor)
        { 
            echo (
'<td>&nbsp;/&nbsp;');
            echo (
'<a href="?parentId='.$ancestor->itemId.'" class="ancestor">');
            echo (
$ancestor->name);
            echo (
'</a>');
            echo (
'</td>');
        }
        echo (
'</tr></table>');
    }        

    include (
'templates/'.$_SESSION['booby_template'].'/icons.inc');
    
$configuration = array ();
    
    
/*
     * Build up a proper configuration for the tree display.
     */
    
$configuration['icons']=$icons;
    
$configuration['dictionary']=$dictionary;
    
$configuration['callback']='BookmarkController.php';
    
    
/*
     * Check for conditional overlib
     */
    
if (isset ($_SESSION['bookmarkOverlib']))
    {
        
$configuration ['overlib'] =$_SESSION['bookmarkOverlib'];
    }
    else
    {
        
$configuration ['overlib'] = true;
    }
    
    
/*
     * Check where the link should be opened (same window or new window)
     */
    
if (isset ($_SESSION['bookmarkNewWindowTarget']))
    {
        
$configuration ['bookmarkNewWindowTarget'] =$_SESSION['bookmarkNewWindowTarget'];
    }

    
/*
     * Are we displaying a yahoo like tree?
     */        
    
if (isset ($_SESSION['bookmarkTree']) && $_SESSION['bookmarkTree'] == 'Yahoo')
    {
        include_once 
"base/view/YahooTree.php";
        include_once 
"plugins/bookmarks/view/BookmarkYahooTreeDelegate.php";

        
/*
         * Build up a proper configuration for the tree display, this makes only sense for
         * the yahoo-like tree
         */
        
if (isset ($_SESSION['bookmarkYahooTreeColumnCount']))
        {
            
$configuration ['numberOfColumns'] =$_SESSION['bookmarkYahooTreeColumnCount'];
        }
        else
        {
            
$configuration ['numberOfColumns'] = 2;
        }

        
$delegate = new BookmarkYahooTreeDelegate ($configuration);
        
$tree = new YahooTree ($delegate$configuration);
    }
    
/*
     *  If not, render using default 
     */
    
else
    {
        include_once 
"base/view/Tree.php";
        include_once 
"plugins/bookmarks/view/BookmarkExplorerTreeDelegate.php";

        
$delegate = new BookmarkExplorerTreeDelegate ($configuration);
        
$tree = new Tree ($delegate$configuration);
        
/*
         * Do we show expanded items? (This is not a useful option in the yahoo tree)
         */
        
if (isset ($_SESSION['bookmarkExpand']))
        {
            
$tree -> setExpanded ($_SESSION['bookmarkExpand']);
        }
    }

    
/*
     * Now actually show the layout
     */
    
echo ($tree -> toHtml ($parent$renderObjects));
?>