Framework  3.9
WizardBar Class Reference

The WizardBar class is a user-interface control that draws a stepped nav bar for multi-stage workflows. More...

+ Inheritance diagram for WizardBar:
+ Collaboration diagram for WizardBar:

Public Member Functions

 WizardBar ($id, $tabs=array(), $queryString="", $useQueryString=true, $showNumber=false)
 Construct a new WizardBar control. More...
 
 writeHTML ()
 Writes the HTML for this control to standard output. More...
 
- Public Member Functions inherited from TabBar
 TabBar ($id, $tabs, $queryString="", $useQueryString=true, $showNumber=false)
 Construct a new TabBar control. More...
 
 preserveQueryString ()
 Preserve the current query string in tab links. More...
 
 dynamicLoad ($container)
 
 writeScript ()
 
 appendQueryString ($url, $qs)
 Appends a query string to the supplied URL. More...
 
 getNextPage ()
 Get the next page in the tab list after the current page. More...
 
 getPage ($idx, $appendQueryString=true)
 Return the URL for the page at the specified tab index. More...
 
 findPage ($page)
 Finds the tab containing the specified URL. More...
 
 next ()
 Move to the next page in the tab list. More...
 
 drawCheckList ()
 
 drawCheckListEntry ($title, $form)
 
 setDefaultStateImage ($img)
 

Public Attributes

 $spacer = " » "
 Spacer that appears between wizard steps. More...
 
 $strict = false
 When strict is set to true, navigation to future steps is always disabled. More...
 
 $rootSteps = 1
 The number of steps that can be reached without a query string when useQueryString is true. More...
 
 $scriptLinks = false
 True to specify that destinations are javascript and should be place in onclick attributes. More...
 
- Public Attributes inherited from TabBar
 $id
 The DOM ID of the TabBar container element. More...
 
 $tabs = array()
 The tab records in this tab bar. More...
 
 $queryString = null
 The query string parameters to append to the navigation links. More...
 
 $useQueryString = true
 Whether a query string is being used as the navigation key. More...
 
 $page = ""
 The current page (for display purposes). This can be set explicitly to force the correct tab display when in a sub-page, for instance. More...
 
 $showNumber
 True to display the step number, false if not. More...
 
 $states = array()
 Array of display states to apply, indexed by tab. More...
 
 $flags = array()
 Array of flags to apply, indexed by tab. More...
 
 $anchor = ""
 Anchor name to generate (leave empty for no anchor tag) More...
 
 $cssClass = ""
 CSS class to apply to the top level container for the tabs. More...
 
 $defaultStateImage
 Image to show in the default tab state. More...
 
 $showStates = true
 true to show tab states, false to ignore them More...
 
 $dynamic = false
 true to indicate dynamic (AJAX-based) loading More...
 
 $container = ""
 The DOM ID of the container that will contain dynamically loaded content. More...
 
 $dynamicLoadHandler = null
 Javascript function to call to handle dynamic content load (optional) More...
 
 $dynamicLoadFirstTab = true
 By default, dynamically loaded tab bars will do a request for the content of the first tab on page load. Set to false to disable this. More...
 
 $disabled = false
 Set to true to generate disabled tab navigation. More...
 

Detailed Description

The WizardBar class is a user-interface control that draws a stepped nav bar for multi-stage workflows.

Definition at line 44 of file wizard_bar.inc.

Member Function Documentation

◆ WizardBar()

WizardBar::WizardBar (   $id,
  $tabs = array(),
  $queryString = "",
  $useQueryString = true,
  $showNumber = false 
)

Construct a new WizardBar control.

Parameters
string$queryStringthe Query String portion of the page URIs
array$tabsthe steps in the workflow
string$queryStringthe query string to append to the links
bool$useQueryStringflag to indicate whether a query string is required. If so, and none is provided, then all tabs except the first are disabled.
bool$showNumberflag to indicate whether to display step numbers

Definition at line 61 of file wizard_bar.inc.

62  {
63  parent::TabBar($id, $tabs, $queryString, $useQueryString, $showNumber);
64  }
$showNumber
True to display the step number, false if not.
Definition: tab_bar.inc:46
$queryString
The query string parameters to append to the navigation links.
Definition: tab_bar.inc:43
$useQueryString
Whether a query string is being used as the navigation key.
Definition: tab_bar.inc:44
$tabs
The tab records in this tab bar.
Definition: tab_bar.inc:42
$id
The DOM ID of the TabBar container element.
Definition: tab_bar.inc:41

◆ writeHTML()

WizardBar::writeHTML ( )

Writes the HTML for this control to standard output.

Reimplemented from TabBar.

Definition at line 69 of file wizard_bar.inc.

70  {
71  $first = true;
72  $future = false;
73  $count = 0;
74 
75  echo "<div id='{$this->id}'";
76 
77  if ($this->cssClass) echo " class='{$this->cssClass}'";
78 
79  echo "><ul>";
80  foreach($this->tabs as $text => $url)
81  {
82 
83  ++$count;
84  $active = "";
85  $style = "";
86 
87  if (!$first)
88  {
90  }
91  else
92  {
93  $spacer = "";
94  $first = false;
95  $style = "first ";
96  }
97 
98  if ($url == $this->page)
99  {
100  $style .= "current";
101  $future = true;
102  }
103  elseif (($this->disabled ||
104  ($future && $this->strict) ||
105  ($future && ($this->queryString == "" && $this->useQueryString)) && $count > $this->rootSteps)
106  || $this->states[$url] == 'disable')
107  {
108  $active = " class='disabled'";
109  $style .= "disabled";
110  }
111 
112  if ($this->showNumber) $text = "$count.&nbsp;$text";
113 
114  if ($this->useQueryString)
115  {
116  $dest = ($this->queryString!="" || ($this->rootSteps > 1 && $count <= $this->rootSteps)) ? $this->appendQueryString($url, $this->queryString) :"#";
117  }
118  else
119  {
120  $dest = ($url == $this->page || $this->disabled || ($future && $this->strict)) ? "#" : $url;
121  }
122 
123  if ($this->anchor)
124  {
125  $dest = ($dest != "#") ? "$dest#{$this->anchor}" : "#{$this->anchor}";
126  }
127 
128  if ($this->scriptLinks)
129  {
130  $link = "href=\"#\"";
131  if ($dest != '#')
132  {
133  $link .= " onclick=\"$dest; return false\"";
134  }
135  }
136  else
137  {
138  $link = "href=\"$dest\"";
139  }
140 
141  if ($this->showStates)
142  {
143  if (array_key_exists($url, $this->flags))
144  {
145  $text = "<img src='{$this->states[$this->flags[$url]]}' style='border: none; display: inline-block;vertical-align: middle'/>&nbsp;$text";
146  }
147  else if ($this->defaultStateImage)
148  {
149  $text = "<img src='{$this->defaultStateImage}' style='border: none; display: inline-block;vertical-align: middle'/>&nbsp;$text";
150  }
151  }
152 
153  echo "<li class='$style'>$spacer<a {$link}{$active}>{$text}</a></li>";
154  }
155 
156  // close wizard div
157  echo "</ul></div>\n";
158  }
appendQueryString($url, $qs)
Appends a query string to the supplied URL.
Definition: tab_bar.inc:311
$spacer
Spacer that appears between wizard steps.
Definition: wizard_bar.inc:46
$strict
When strict is set to true, navigation to future steps is always disabled.
Definition: wizard_bar.inc:47
$rootSteps
The number of steps that can be reached without a query string when useQueryString is true.
Definition: wizard_bar.inc:48

Member Data Documentation

◆ $rootSteps

WizardBar::$rootSteps = 1

The number of steps that can be reached without a query string when useQueryString is true.

Definition at line 48 of file wizard_bar.inc.

◆ $scriptLinks

WizardBar::$scriptLinks = false

True to specify that destinations are javascript and should be place in onclick attributes.

Definition at line 49 of file wizard_bar.inc.

◆ $spacer

WizardBar::$spacer = "&nbsp;&raquo;&nbsp;"

Spacer that appears between wizard steps.

Definition at line 46 of file wizard_bar.inc.

◆ $strict

WizardBar::$strict = false

When strict is set to true, navigation to future steps is always disabled.

Definition at line 47 of file wizard_bar.inc.


The documentation for this class was generated from the following file: