CMS  Version 3.9
Slideshow Class Reference

The Slideshow class provides a reusable user interface control that displays images from the database in a zoomable format. More...

Public Member Functions

 Slideshow ($items, $width=500, $height=400)
 
 add ($items)
 
 writeScript ()
 
 writeHTML ()
 

Public Attributes

 $items
 
 $width
 
 $height
 
 $showInfo
 
 $showControls
 
 $showThumbnails
 
 $autoPlay
 
 $preload
 

Detailed Description

The Slideshow class provides a reusable user interface control that displays images from the database in a zoomable format.

The control is flexible, and can be used to display multiple images in either a slideshow or lightbox format. Additional information and navigation areas can be shown or hidden as required.

Author
andy

Definition at line 50 of file slideshow.inc.

Member Function Documentation

◆ add()

Slideshow::add (   $items)

Definition at line 81 of file slideshow.inc.

82  {
83  if (is_array($items))
84  {
85  $this->items[] = array_filter($items, validURL);
86  }
87  else
88  {
89  if (validURL($items)) $this->items[] = $items;
90  }
91  }

◆ Slideshow()

Slideshow::Slideshow (   $items,
  $width = 500,
  $height = 400 
)

Definition at line 61 of file slideshow.inc.

62  {
63  // If we were passed a single item, wrap it in an array
64  if (!is_array($items))
65  {
66  $items = array($items);
67  }
68 
69  $this->items = $items;
70 
71  $this->width = $width;
72  $this->height = $height;
73 
74  $this->showControls = true;
75  $this->showInfo = true;
76  $this->showThumbnails = true;
77  $this->autoPlay = false;
78  $this->preload = true;
79  }
$helpTree width
Definition: tree.inc:45
$desc height
Definition: event_edit.inc:64

◆ writeHTML()

Slideshow::writeHTML ( )

Definition at line 178 of file slideshow.inc.

179  {
180 ?>
181  <div id="progress">
182  <div class="text"></div>
183  <div class="border"><div class="bar">&nbsp;</div><div id="progress_count"></div></div>
184  </div>
185 <table id="slideshow" cellpadding="0" cellspacing="0" style="width: <? echo $this->width ?>px;">
186  <tr>
187  <td colspan="3">
188  <div id="viewport" style="height: <?echo $this->height ?>px">
189  <div id="gallery" style="height: <?echo $this->height ?>px">
190  <div id="zoom_overlay" style="left: <? echo $this->width - 40 ?>px">
191  <table id="zoomer" cellpadding="0" cellspacing="0">
192  <tr>
193  <td id="zoom_in"></td>
194  </tr>
195  <tr>
196  <td id="zoom_slider">
197  <div id="zoom_scale">
198  <div id="zoom_thumb"><img src="/fakoli/slideshow/images/zoom_thumb.gif" width="24" height="12" alt="" style="display: block;"/></div>
199  </div>
200  </td>
201  </tr>
202  <tr>
203  <td id="zoom_out"></td>
204  </tr>
205  </table>
206  </div>
207  </div>
208  </div>
209  </td>
210  </tr>
211  <tr<? if (!$this->showControls) echo " style='display:none'"; ?>>
212  <td colspan="3" id="controlbar"><div id="play_button" class="play">&nbsp;</div><div id="info_button" class="info">&nbsp;</div><span id="caption">&nbsp;</span></td>
213  </tr>
214  <tr<? if (!$this->showControls) echo " style='display:none'"; ?>>
215  <td colspan="3" id="credit">&nbsp;<span id="creditText"></span></td>
216  </tr>
217 </table>
218 <table cellpadding="0" cellspacing="0">
219 <tr>
220 <td>
221 <table id="thumbnails" cellpadding="0" cellspacing="0" style="width:<? echo $this->width."px"; if (!$this->showThumbnails) echo "; display:none"; ?>">
222  <tr>
223  <td id="scroll_left"></td>
224  <td id="strip">
225  <div id="thumbnail_strip" style="width: <? echo $this->width - 46 ?>px">
226  <div id="thumbnail_scroll"><div id="thumbnail_highlight"></div></div>
227  </div>
228  </td>
229  <td id="scroll_right"></td>
230  </tr>
231 </table>
232 </td>
233 </tr>
234 </table>
235 <?
236  }
& nbsp
Definition: index.inc:49
$helpTree style
Definition: tree.inc:46
$topicList colspan
Definition: group_form.inc:54

◆ writeScript()

Slideshow::writeScript ( )

Definition at line 93 of file slideshow.inc.

94  {
95  $mgr = new ImageManager();
96  global $config;
97 
98  ob_start();
99 ?>
100 <!--[if IE]>
101 <link rel="stylesheet" type="text/css" href="/fakoli/slideshow/ie.css"/>
102 <![endif]-->
103 
104 <script type="text/javascript"><!--
105 /* <![CDATA[ */
106 
107 window.addEvent('domready', function() {
108 
109  var slideshow = new Slideshow({preload: <?echo $this->preload ? "true" : "false"?>, showThumbnails: <?echo $this->showThumbnails ? "true" : "false"?>, showInfo: <?echo $this->showInfo ? "true" : "false" ?>, autoPlay: <?echo $this->autoPlay ? "true" : "false"?>});
110 
111  slideshow.thumbnails = [
112 <?
113  $thumbs = array();
114  foreach($this->items as $item)
115  {
116  $thumbs[] = "'http://".$config['http_host'].$mgr->thumbnailLink($item->image_id, 100)."'";
117  }
118 
119  echo implode(", ", $thumbs);
120 ?>
121  ];
122 
123  slideshow.images = [
124 <?
125  $images = array();
126  foreach($this->items as $item)
127  {
128  $images[] = "'http://".$config['http_host'].$mgr->imageLink($item->image_id)."'";
129  }
130 
131  echo implode(", ", $images);
132 ?>
133  ];
134 
135  slideshow.captions = [
136 <?
137 $first = true;
138 foreach($this->items as $item)
139 {
140  if (!$first) echo ", ";
141 ?>
142  "<?echo jsSafe(trim($item->getCaption())) ?>"
143 <?
144  $first = false;
145 }
146 ?>
147  ];
148 
149  slideshow.credits = [
150 <?
151 $first = true;
152 foreach($this->items as $item)
153 {
154  if (!$first) echo ", ";
155 ?>
156  "<i><? echo jsSafe(trim($item->getShortCredit())) ?></i>"
157 <?
158  $first = false;
159 }
160 ?>
161  ];
162 
163  slideshow.load();
164 });
165 
166 
167 //
168 
169 /* ]]> */
170 --></script>
171 <?
172  $script = ob_get_contents();
173  ob_end_clean();
174 
175  return $script;
176  }
The ImageManager class provides basic Image manipulation functions that are useful when working with ...
Slideshow($items, $width=500, $height=400)
Definition: slideshow.inc:61
global $config
Definition: import.inc:4
$images
Definition: slideshow.inc:44
$script
Definition: slideshow.inc:48

Member Data Documentation

◆ $autoPlay

Slideshow::$autoPlay

Definition at line 58 of file slideshow.inc.

◆ $height

Slideshow::$height

Definition at line 54 of file slideshow.inc.

◆ $items

Slideshow::$items

Definition at line 52 of file slideshow.inc.

◆ $preload

Slideshow::$preload

Definition at line 59 of file slideshow.inc.

◆ $showControls

Slideshow::$showControls

Definition at line 56 of file slideshow.inc.

◆ $showInfo

Slideshow::$showInfo

Definition at line 55 of file slideshow.inc.

◆ $showThumbnails

Slideshow::$showThumbnails

Definition at line 57 of file slideshow.inc.

◆ $width

Slideshow::$width

Definition at line 53 of file slideshow.inc.


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