Source for file block.pnformtabbedpanelset.php
Documentation is available at block.pnformtabbedpanelset.php
* @copyright (c) 2006, Zikula Development Team
* @link http://www.zikula.org
* @version $Id: block.pnformtabbedpanelset.php 24342 2008-06-06 12:03:14Z markwest $
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @package Zikula_Template_Plugins
* This plugin is used to create a set of panels with their own tabs for selection.
* The actual visibility management is handled in JavaScript by setting the CSS styling
* attribute "display" to "hidden" or not hidden. Default styling of the tabs is rather rudimentary
* but can be improved a lot with the techniques found at www.alistapart.com.
* <!--[pnformtabbedpanelset]-->
* <!--[pnformtabbedpanel title="Tab A"]-->
* ... content of first tab ...
* <!--[/pnformtabbedpanel]-->
* <!--[pnformtabbedpanel title="Tab B"]-->
* ... content of second tab ...
* <!--[/pnformtabbedpanel]-->
* <!--[/pnformtabbedpanelset]-->
* You can place any pnForms plugins inside the individual panels. The tabs
* require some special styling which is handled by the styles in system/pnForm/pnstyle/style.css.
* If you want to override this styling then either copy the styles to another stylesheet in the
* templates directory or change the cssClass attribute to something different than the default
* CSS class name for styling
* Internal tab index counter
return __FILE__ ; // FIXME: may be found in smarty's data???
// Beware - working on 1-based offset!
PageUtil::addVar('javascript', 'system/pnForm/pnjavascript/pnform_tabbedpanelset.js');
$idHtml = $this->getIdHtml();
$html = "<div class=\"{ $this->cssClass}\"{ $idHtml}><ul><li> </li>\n ";
for ($i=1, $titleCount=count($this->titles); $i<=$titleCount; ++$i)
$title = $this->titles[$i-1];
$selected = ($i == $this->selectedIndex);
$title = $render->pnFormTranslateForDisplay($title);
$cssClass .= ' selected';
$link = "<a href=\"#\" onclick=\"return pnFormTabbedPanelSet.handleTabClick( $i, $titleCount,'{ $this->id}')\"> $title</a> ";
$html .= "<li id=\"{ $this->id}Tab_{ $i}\" class=\" $cssClass\"> $link</li><li> </li>\n ";
$html .= "</ul></div><div style=\"clear: both\"></div>\n";
$html .= "<input type=\"hidden\" name=\"{ $this->id}SelectedIndex\" id=\"{ $this->id}SelectedIndex\" value=\"{ $this->selectedIndex}\"/>\n ";
// Called by child panels to register themselves
function registerTabbedPanel(&$render, &$panel, $title)
$panel->panelSetId = $this->id;
if (!$render->pnFormIsPostBack())
$panel->index = $this->registeredTabIndex++;
$this->titles[] = $title;
$panel->selected = ($this->selectedIndex == $panel->index);
function decode(&$render)
$this->selectedIndex = (int)FormUtil::getPassedValue("{ $this->id}SelectedIndex ", 1);
function smarty_block_pnformtabbedpanelset($params, $content, &$render)
return $render->pnFormRegisterBlock('pnFormTabbedPanelSet', $params, $content);
|