function gen_page($cat=''){
// Generates the display of the icons for the user to choose
// Loop through all the files and use their
// file-names as proper links
// for their sub-directories/thumbs displays
if($cat == ''){
$this->out = '$lt;tr>';
$i = 1;
foreach($this->lst as $f){
$this->out .= '$lt;td style="text-align: center;">
$lt;a href="photos.php?cat='.$f.'" alt="Category: '.$this->clean($f).'">
$lt;img src="'.$this->ico.'fldr.gif" alt="'.$this->clean($f).'">
$lt;br>'.$this->clean($f).'$lt;/a>$lt;/td>';
/*
Here we deal with the width of our table. We want 5 images across,
by however many rows it takes to complete the set. To do that, we
set a variable ($i) to "1" and then start our loop. It increments at
the end, just before the next item. When we reach the 5th itteration,
the following if() statement catches it using the modulus operator and
inserts the end of our row and beginning of another.
*/
if($i%$this->cols == 0){
// If we have reached 5
$this->out .= '$lt;/tr>$lt;tr>';
}
$i++;
}
}
else{
$this->out = '$lt;tr>';
$i = 1;
foreach($this->lst as $f){
$this->out .= '$lt;td style="text-align: center;">
$lt;a href="photos.php?cat='.$cat.'&evt='.$f.'" alt="Event: '.$this->clean($f).'">
$lt;img src="'.$this->ico.'fldr.gif" alt="'.$this->clean($f).'">
$lt;br>'.
$this->clean($f).'$lt;a>$lt;/td>';
if($i%$this->cols == 0){
$this->out .= '$lt;/tr>$lt;tr>';
}
$i++;
}
}
echo $this->out;
}
function gen_thumbs($cat, $evt){
// Generates the thumbnail display
// Loop through all thumbs, and use their file-names as proper links
// for their larger counterpart.
$img_path = $this->_rt.$cat.'/'.$evt.'/thumbs/';
$i = 1;
$this->out = '$lt;tr>'."\n";
if(count($this->lst)>=1){
foreach($this->lst as $f){
$this->out .= '$lt;td style="text-align: center;">$lt;a href="photos.php?cat='.$cat.'&evt=
'.$evt.'&pic='.$f.'">$lt;img src="'.$img_path.$f.'" alt="'.$this->clean($evt).' '.substr($f, 0, -4).'">$lt;/a>$lt;/td>'."\n";
if($i%$this->cols==0){
$this->out .= '$lt;/tr>'."\n".'$lt;tr>';
}
$i++;
}
if($i%$this->cols!==0){
$this->out .= '$lt;/tr>'."\n";
}
}
else{
$this->out .= '$lt;td>There are no images to display in this event.$lt;/td>$lt;/tr>';
}
echo $this->out;
}
function gen_pic($cat, $evt, $pic){
// Generates the picture display
// Take the path from above (get_items()) and use that to generate path
// to large photo and display to browser.
$path = $this->_rt.$cat.'/'.$evt.'/'.$pic;
$this->out = '$lt;tr>$lt;td style="text-align: center; font-weight: bold;">'.$this->clean($cat).':
'.$this->clean($evt).'$lt;br>';
$this->out .= substr($pic, 0, -4).'$lt;/td>$lt;/tr>';
$this->out .= '$lt;tr>$lt;td style="text-align: center;">$lt;img src="'.$path.'">$lt;/td>$lt;/tr>';
$this->out .= '$lt;tr>$lt;td style="text-align: center;">'.$this->paginate($cat, $evt, $pic).'$lt;/td>$lt;/tr>';
echo $this->out;
}