pnForm
[ class tree: pnForm ] [ index: pnForm ] [ all elements ]

Class: pnFormContextMenu

Source Location: /system/pnForm/plugins/block.pnformcontextmenu.php

Class Overview

pnFormPlugin
   |
   --pnFormStyledPlugin
      |
      --pnFormContextMenu

Context menu plugin


Variables

Methods


Inherited Variables

Inherited Methods

Class: pnFormStyledPlugin

pnFormStyledPlugin::renderAttributes()

Class: pnFormPlugin

pnFormPlugin::pnFormPlugin()
Constructor
pnFormPlugin::create()
Create event handler
pnFormPlugin::dataBound()
DataBound event handler
pnFormPlugin::decode()
Decode event handler
pnFormPlugin::decodePostBackEvent()
Decode event handler for actions that generate a postback event
pnFormPlugin::getIdHtml()
Utility function to generate HTML for ID attribute
pnFormPlugin::initialize()
Initialize event handler
pnFormPlugin::load()
Load event handler
pnFormPlugin::postRender()
PostRender event handler
pnFormPlugin::readParameters()
Read Smarty plugin parameters
pnFormPlugin::registerPlugin()
pnFormPlugin::render()
Render event handler
pnFormPlugin::renderAttributes()
pnFormPlugin::renderBegin()
RenderBegin event handler
pnFormPlugin::renderContent()
RenderContent event handler
pnFormPlugin::renderEnd()
RenderEnd event handler

Class Details

[line 55]
Context menu plugin

This plugin creates a popup menu to be used as a right-click context menu. To use it you must do three things:

  • Create a menu
  • Add menu items (as sub-pugins of the menu)
  • Add a reference to the menu (there can be more than one of these)
Example usage with two menu items:
  1.  <!--[pnformcontextmenu id="MyMenu" width="150px"]-->
  2.    <!--[pnformcontextmenuitem title=_EDIT commandName="edit"]-->
  3.    <!--[pnformcontextmenuitem title=_NEW commandName="new"]-->
  4.  <!--[/pnformcontextmenu]-->
  5.  
  6.  <!--[foreach from=items item=item]-->
  7.  <!--[$item.title]--> <!--[pnformcontextmenureference menuId="MyMenu" commandArgument=$item.id]-->
  8.  <!--[/foreach]-->
As you can see it is possible to reuse the same menu more than once on a page - in the example above it is used as a context menu for each of the "items" (for instance articles or webshop goods). Where ever you insert a "pnformcontextmenureference" you will get a small clickable arrow indicating the menu. Clicking on the reference will bring op the menu.

In your event handler (which defaults to "handleCommand") you should check for both commandName and commandArgument:

  1.  function handleCommand(&$render&$args)
  2.  {
  3.    echo "Command: $args[commandName]$args[commandArgument]";
  4.  }
The commandName value indicates the menu item which was clicked and the commandArgument is the value set at the menu reference. The use of commandArgument makes it easy to identify which $item the menu was activated for.




[ Top ]


Class Variables

$cssClass =

[line 64]

CSS class name

The class name is applied to the div element that surrounds the entire menu. Defaults to "contextMenu".



Type:   string


[ Top ]

$onCommand =

[line 73]

Name of command event handler method

Defaults to "handleCommand".



Type:   string


[ Top ]

$zIndex =

[line 83]

Z-index for absolute positioning

No need to change or set this unless there's a conflict with other libraries (for instance prototype).



Type:   int


[ Top ]



Class Methods


method create [line 92]

void create( &$render)



Overrides pnFormPlugin::create() (Create event handler)

Parameters:

   &$render  

[ Top ]

method dataBound [line 99]

void dataBound( &$render)



Overrides pnFormPlugin::dataBound() (DataBound event handler)

Parameters:

   &$render  

[ Top ]

method firstTime [line 134]

void firstTime( [ $doSet = false])



Parameters:

   $doSet  

[ Top ]

method getFilename [line 86]

void getFilename( )



[ Top ]

method renderBegin [line 107]

void renderBegin( &$render)



Overrides pnFormPlugin::renderBegin() (RenderBegin event handler)

Parameters:

   &$render  

[ Top ]

method renderEnd [line 122]

void renderEnd( &$render)



Overrides pnFormPlugin::renderEnd() (RenderEnd event handler)

Parameters:

   &$render  

[ Top ]


Documentation generated on Fri, 18 Jul 2008 21:43:10 +0200 by phpDocumentor 1.4.1