CWIS Developer Documentation
TransportControlsUI.php
Go to the documentation of this file.
1 <?PHP
2 #
3 # FILE: TransportControlsUI.php
4 #
5 # Part of the Collection Workflow Integration System (CWIS)
6 # Copyright 2015 Edward Almasy and Internet Scout Research Group
7 # http://scout.wisc.edu/cwis/
8 #
9 
19 {
20  # ---- PUBLIC INTERFACE --------------------------------------------------
21 
22  # parameter ($_GET) variable names
23  const PNAME_REVERSESORT = "RS";
24  const PNAME_SORTFIELD = "SF";
25  const PNAME_STARTINGINDEX = "SI";
26  const PNAME_ACTIVETAB = "AT";
27 
35  public function PrintControls($ItemType, $BaseLink, $Message = "")
36  {
37  $this->SetItemType($ItemType);
38  $this->SetBaseLink($BaseLink);
39 
40  if (isset($this->ItemTypeNames[$ItemType]))
41  {
42  $TypeName = StdLib::Pluralize($this->ItemTypeNames[$ItemType]);
43  }
44 
45  if ($this->ShowAnyReverseButtons()
46  || $this->ShowAnyForwardButtons()
47  || strlen($Message))
48  {
49  if($this->ShowAnyReverseButtons() || $this->ShowAnyForwardButtons())
50  {
51  ?><div class="cw-transport-controls clearfix">
52  <?PHP
53  if ($this->ShowAnyReverseButtons())
54  {
55  $TitleAttrib = "Go to first page";
56  if (isset($TypeName)) { $TitleAttrib .= " of ".$TypeName; }
57  ?><div class="cw-transport-controls-left">
58  <a class="StyledButton NavStyledButton"
59  href="<?PHP print $this->GoToStartLink(); ?>"
60  title="<?= $TitleAttrib ?>">&#124;<span
61  style="position:relative; bottom: 1px;">&lt;</span></a>
62  <?PHP
63 
64  if ($this->ShowFastReverseButton())
65  {
66  $TitleAttrib = "Jump back";
67  if (isset($TypeName)) { $TitleAttrib .= " in ".$TypeName; }
68  ?><a class="StyledButton NavStyledButton"
69  href="<?PHP print $this->FastReverseLink(); ?>"
70  title="<?= $TitleAttrib ?>">&lt;&lt;</a> <?PHP
71  }
72 
73  if ($this->ShowReverseButton())
74  {
75  $TitleAttrib = "Go to previous page";
76  if (isset($TypeName)) { $TitleAttrib .= " of ".$TypeName; }
77  ?><a class="StyledButton NavStyledButton"
78  href="<?PHP print $this->ReverseLink(); ?>"
79  title="<?= $TitleAttrib ?>">&lt;</a> <?PHP
80  }
81 
82  ?></div><?PHP
83  }
84 
85  if ($this->ShowAnyForwardButtons())
86  {
87  ?><div class="cw-transport-controls-right">
88  <?PHP
89 
90  if ($this->ShowForwardButton())
91  {
92  $TitleAttrib = "Go to next page";
93  if (isset($TypeName)) { $TitleAttrib .= " of ".$TypeName; }
94  ?><a class="StyledButton NavStyledButton"
95  href="<?PHP print $this->ForwardLink(); ?>"
96  title="<?= $TitleAttrib ?>">&gt;</a> <?PHP
97  }
98 
99  if ($this->ShowFastForwardButton())
100  {
101  $TitleAttrib = "Jump forward";
102  if (isset($TypeName)) { $TitleAttrib .= " in ".$TypeName; }
103  ?><a class="StyledButton NavStyledButton"
104  href="<?PHP print $this->FastForwardLink(); ?>"
105  title="<?= $TitleAttrib ?>">&gt;&gt;</a> <?PHP
106  }
107 
108  $TitleAttrib = "Go to last page";
109  if (isset($TypeName)) { $TitleAttrib .= " of ".$TypeName; }
110  ?><a class="StyledButton NavStyledButton"
111  href="<?PHP print $this->GoToEndLink(); ?>"
112  title="<?= $TitleAttrib ?>">&gt;<span
113  style="position:relative; bottom: 1px;">&#124;</span></a>
114  </div><?PHP
115  }
116 
117  if($this->ShowAnyReverseButtons() && !$this->ShowAnyForwardButtons())
118  {
119  ?><div class="cw-transport-controls-msg-left-only clearfix"><?PHP
120  print strlen($Message) ? $Message : "&nbsp;";
121  ?></div><?PHP
122  }
123  elseif(!$this->ShowAnyReverseButtons()
124  && $this->ShowAnyForwardButtons())
125  {
126  ?><div class="cw-transport-controls-msg-right-only clearfix"><?PHP
127  print strlen($Message) ? $Message : "&nbsp;";
128  ?></div><?PHP
129  }
130  else
131  {
132  ?><div class="cw-transport-controls-msg clearfix"><?PHP
133  print strlen($Message) ? $Message : "&nbsp;";
134  ?></div><?PHP
135  }
136 
137  ?></div><?PHP
138  }
139  else
140  {
141  print strlen($Message) ? $Message : "&nbsp;";
142  }
143  }
144  }
145 }
146 
ShowForwardButton()
Report whether forward button should be displayed.
static Pluralize($Word)
Pluralize an English word.
Definition: StdLib.php:162
ShowAnyForwardButtons()
Report whether any forward buttons should be displayed.
Class to provide support for transport controls (used for paging back and forth through a list) in th...
Class to provide support for transport controls (used for paging back and forth through a list) in th...
ShowReverseButton()
Report whether reverse button should be displayed.
ShowAnyReverseButtons()
Report whether any reverse buttons should be displayed.
ShowFastReverseButton()
Report whether fast reverse button should be displayed.
ItemTypeNames($Names=NULL)
Get/set printable names for item types.
SetBaseLink($BaseLink)
Set current base link for Link methods.
ShowFastForwardButton()
Report whether fast forward button should be displayed.
PrintControls($ItemType, $BaseLink, $Message="")
Print transport control HTML.
SetItemType($ItemType)
Set current item type for Show or Link methods.