Class: DropMenuItem

  • Package: saf.GUI
  • Author: John Luxford <lux@simian.ca>
  • Copyright: Copyright (C) 2001-2003, Simian Systems Inc.
  • License: http://www.sitellite.org/index/license Simian Open Software License
  • Version: 1.0, 2002-10-28, $Id: DropMenuItem.php,v 1.4 2007/10/06 00:06:30 lux Exp $
  • Access: public

DropMenuItem provides individual menu item facilities to the
DropMenu class, which generates HTML and JavaScript for DHTML drop menus.

New in 1.0:
- Fixed some outdated javascript mouse tracking function references.


Usage Example


<?php

$dropMenu 
= new DropMenu ('company'1030);

// set a background colour change on each item
$dropMenu->extraMouseOver 'sdmSetBgcolor (\'_td_{layerID}\', \'#CCCCCC\')';
$dropMenu->extraMouseOut 'sdmSetBgcolor (\'_td_{layerID}\', \'#FFFFFF\');

$aboutItem =& $dropMenu->addItem ('
About Us', '/index/about');
$aboutMenu =& $aboutItem->addChild ('
about');

$aboutMenu->addItem ('
Corporate Profile', '/index/corporate');
$aboutMenu->addItem ('
History', '/index/history');
$invItem =& $aboutMenu->addItem ('
Investor Relations', '/index/investors');
$invMenu =& $invItem->addChild ('
inv');
$invMenu->addItem ('
Annual Report', '/index/annual_report');

$aboutMenu->addItem ('
Contact Us', '/index/contact');

// create the drop menu divs
echo $dropMenu->write ();

// next, we need the dropmenu.js file
echo '
<script language="javascript1.2" src="/js/dropmenu.js"></script>';

// we also need a javascript list of menus called menuList
echo '<script language="javascript1.2"><!--' . "\n";
echo "sdmMenuList = new Array ('" . join ("', '", $dropMenu->getList ()) . "');\n";
echo '// --></script>';

// attach this drop menu to something visible on the page.
echo '<a href="/index/company" onmouseover="sdmShowAndHide(\'company\')">Company</a>';

?>

Return to Top



Properties


$template

  • Access: public

The template to use to generate the menu item.


$fill

  • Access: public

The object or associative array to use to fill the template with upon
calling render().


$span

  • Access: public

The span of this cell. Set to -1 and the cell will disappear. Use
$this->attrs['colspan'] or ['rowspan'] to set these properties in the
corresponding HTML <td> tag.


$attrs = array ()

  • Access: public

Contains all HTML <td> properties for the current object.


$default

  • Access: public

$default is an optional default value to place in cells whose
templates result in no output.


$type = 'db'


$collection


$limit


$fields


$total = 0


$list = false


$remember = array ()


$skipHeaders = array ()


$header = ''


$footer = ''


$editUrl = false


$addUrl = false


$deleteUrl = false


$error


$name

  • Access: public

The name of the menu.


$xpos

  • Access: public

The x position of the drop menu this item is a part of. Used for
inheriting to a child menu.


$ypos

  • Access: public

The y position of the drop menu this item is a part of. Used for
inheriting to a child menu.


$menuWidth

  • Access: public

The width of the drop menu this item is a part of. Used for
inheriting to a child menu.


$lineHeight

  • Access: public

The height of this item and each item in its parent drop menu.
Used for inheriting to a child menu.


$itemTemplate

  • Access: public

The template used to draw each drop menu item.


$direction = 'right'

  • Access: public

The direction of the drop menu this item is a part of. Used for
inheriting to a child menu.


$items = array ()

  • Access: public

An array of DropMenuItem objects


$extraMouseOver = ''

  • Access: public

Optional extra JavaScript to call when the item is in focus.


$extraMouseOut = ''

  • Access: public

Optional extra JavaScript to call when the item loses focus.


$text

  • Access: public

The text of the menu item.


$link

  • Access: public

The URL to link this item to.


$menu_tpl

  • Access: public

The menu template to use to generate child drop menus.


$child

  • Access: public

The child DropMenu object of this item.


$mouseover

  • Access: private

The private mouseover data detailing this item's behaviour.

Return to Top



Methods


DropMenuItem ($text, $link, $xpos = 0, $ypos = 0, $menuWidth = 150, $lineHeight = 18, $menu_tpl = '', $link_tpl = '')

  • Access: public

Constructor method.


write ($show = '')

  • Access: public
  • Return: string

Writes the drop menu item, as well as any child menus, and returns
it as a string. The 'show' property is for internal use, as this method
may be called again by one of the items inside this child's menu if it has
any child menus.


&addChild ($name)

  • Access: public
  • Return: object

Creates a new DropMenu class, passing on what info is required,
and adding it to the child property. Note: an item may have only one
child menu.

Return to Top

Copyright © 2008 Sitellite CMS Project

Powered by Sitellite 5.0 Content Management System