Sitellite Application Framework
Class Tree         Index         All Elements

Class: DropMenu

Source Location: Program_Root/GUI/DropMenu.php

Class Overview


DropMenu generates HTML and JavaScript for DHTML drop menus.


Author(s)

Version

  • 1.2, 2003-04-15, $Id: DropMenu.php,v 1.3 2006/04/29 16:54:13 lux Exp $

Copyright

  • Copyright (C) 2001-2003, Simian Systems Inc.

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 86]
DropMenu generates HTML and JavaScript for DHTML drop menus.

This class is accompanied by a JavaScript script which provides the necessary JavaScript components to the drop menu system.

Also requires the DropMenuItem and Template classes.

New in 1.0:

  • Fixed some outdated javascript mouse tracking function references.
New in 1.2:
  • Updated the javascript function names and modified the generated templates to use the new SimpleTemplate syntax.

1 <?php
2
3 $dropMenu = new DropMenu ('company', 10, 30);
4
5 // set a background colour change on each item
6 $dropMenu->extraMouseOver = 'sdmSetBgcolor (\'_td_{layerID}\', \'#CCCCCC\')';
7 $dropMenu->extraMouseOut = 'sdmSetBgcolor (\'_td_{layerID}\', \'#FFFFFF\');
8
9 $aboutItem =& $dropMenu->addItem ('About Us', '/index/about');
10 $aboutMenu =& $aboutItem->addChild ('about');
11
12 $aboutMenu->addItem ('Corporate Profile', '/index/corporate');
13 $aboutMenu->addItem ('History', '/index/history');
14 $invItem =& $aboutMenu->addItem ('Investor Relations', '/index/investors');
15 $invMenu =& $invItem->addChild ('inv');
16 $invMenu->addItem ('Annual Report', '/index/annual_report');
17
18 $aboutMenu->addItem ('Contact Us', '/index/contact');
19
20 // create the drop menu divs
21 echo $dropMenu->write ();
22
23 // next, we need the dropmenu.js file
24 echo '<script language="javascript1.2" src="/js/dropmenu.js"></script>';
25
26 // we also need a javascript list of menus called menuList
27 echo '<script language="javascript1.2"><!--' . "\n";
28 echo "sdmMenuList = new Array ('" . join ("', '", $dropMenu->getList ()) . "');\n";
29 echo '// --></script>';
30
31 // attach this drop menu to something visible on the page.
32 echo '<a href="/index/company" onmouseover="sdmShowAndHide(\'company\')">Company</a>';
33
34 ? >




Tags:

access:  public
version:  1.2, 2003-04-15, $Id: DropMenu.php,v 1.3 2006/04/29 16:54:13 lux Exp $
license:  http://www.sitellite.org/index/license
copyright:  Copyright (C) 2001-2003, Simian Systems Inc.
author:  John Luxford <mailto:lux@simian.ca>


[ Top ]


Class Variables

$direction =  'right'

[line 150]

The direction the menu should open to a new level. Defaults to 'right'.



Tags:

access:  public

Type:   mixed


[ Top ]

$extraMouseOut =  ''

[line 174]

Optional extra JavaScript to call in each item loses focus.



Tags:

access:  public

Type:   mixed


[ Top ]

$extraMouseOver =  ''

[line 166]

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



Tags:

access:  public

Type:   mixed


[ Top ]

$items = array ()

[line 158]

An array of DropMenuItem objects



Tags:

access:  public

Type:   mixed


[ Top ]

$itemTemplate =

[line 141]

The template used to draw each drop menu item.



Tags:

access:  public

Type:   mixed


[ Top ]

$lineHeight =  19

[line 125]

The height of each item in the menu. Default is 19.



Tags:

access:  public

Type:   mixed


[ Top ]

$menuWidth =

[line 117]

The width of the menu.



Tags:

access:  public

Type:   mixed


[ Top ]

$name =

[line 93]

The name of the menu.



Tags:

access:  public

Type:   mixed


[ Top ]

$template =

[line 133]

The template used to draw the drop menu DIV.



Tags:

access:  public

Type:   mixed


[ Top ]

$xpos =

[line 101]

The x position of the top-left corner of the menu.



Tags:

access:  public

Type:   mixed


[ Top ]

$ypos =

[line 109]

The y position of the top-left corner of the menu.



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


constructor DropMenu [line 189]

DropMenu DropMenu( string $name, [integer $xpos = 0], [integer $ypos = 0], [integer $menuWidth = 150], [integer $lineHeight = 18], [string $template = ''], [string $direction = 'right'])

Constructor method.



Tags:

access:  public


Parameters:

string   $name  
integer   $xpos  
integer   $ypos  
integer   $menuWidth  
integer   $lineHeight  
string   $template  
string   $direction  

[ Top ]

method addItem [line 230]

object &addItem( string $text, string $link)

Creates a new DropMenuItem class, passing on what info is required, and adding it to the items array.



Tags:

access:  public


Parameters:

string   $text  
string   $link  

[ Top ]

method getList [line 285]

array getList( )

Returns a list of menu names, including the current menu and all its children.



Tags:

access:  public


[ Top ]

method write [line 250]

string write( [string $show = ''])

Writes the drop menu div 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 menu if it has any child menus.



Tags:

access:  public


Parameters:

string   $show  

[ Top ]


Copyright © 2007, SIMIAN systems Inc.
All rights reserved. Privacy policy
Documentation generated on Tue, 13 Feb 2007 17:17:26 -0600 by Sitellite AppDoc and phpDocumentor 1.2.2