<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2005 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.3
  $Source:
  $Revision:
  $Author:
  $Date:
**********************************************/
// ------------------------------------------------------------------------- //
//  Theme "fotogallery"                                                      //
// ------------------------------------------------------------------------- //
//  Theme "fotogallery" by tibu is based on "giallo".                        //
//  All original credits from "giallo" appear below.                         //  
//  The theme "giallo" has been done by GauGau (http://gaugau.de/) based on  //
//  the framed template of studicasa.nl (their website has gone down, so I   //
//  guess no one will care). The usage of this theme is free for personal    //
//  use, not for commercial use (according to the disclaimer of studiocasa)! //
// ------------------------------------------------------------------------- //
//  Updated for 1.4.3 by Donnoman@donovanbray.com                            //
// ------------------------------------------------------------------------- //
//  This theme has 2 column categories, and jump to nav bar for displayimage //
//  Credits for column categories and jump to nav bar as follows...          //
//  Column categories: http://coppermine-gallery.net/forum/index.php?topic=24551.0 //
//  Jump to nav bar: http://coppermine-gallery.net/forum/index.php?topic=20599.0   //
define('THEME_HAS_RATING_GRAPHICS', 1); 
define('THEME_HAS_NAVBAR_GRAPHICS', 1);
define('THEME_IS_XHTML10_TRANSITIONAL',1);

$template_sys_menu_spacer='';

// HTML template for the category list
$template_cat_list = <<<EOT
<!-- BEGIN header -->
        <tr>
                <td class="tableh1" width="40%"><b>{CATEGORY}</b></td>
                <td class="tableh1" width="5%" align="center"><b>{ALBUMS}</b></td>
                <td class="tableh1" width="5%" align="center"><b>{PICTURES}</b></td>
                <td class="tableh1" width="40%"><b>{CATEGORY}</b></td>
                <td class="tableh1" width="5%" align="center"><b>{ALBUMS}</b></td>
                <td class="tableh1" width="5%" align="center"><b>{PICTURES}</b></td>
        </tr>
<!-- END header -->
<!-- BEGIN catrow_noalb -->
        <tr>
                <td class="tableh2" colspan="6"><table border="0"><tr><td>{CAT_THUMB} {DEBUG}</td><td><span class="catlink"><b>{CAT_TITLE}</b></span>{CAT_DESC}</td></tr></table></td>
        </tr>
<!-- END catrow_noalb -->
<!-- BEGIN catrow -->
                <td class="tableb"><table border="0"><tr><td>{CAT_THUMB}</td><td><span class="catlink"><b>{CAT_TITLE}</b></span>{CAT_DESC}</td></tr></table></td>
                <td class="tableb" align="center">{ALB_COUNT} {DEBUG}</td>
                <td class="tableb" align="center">{PIC_COUNT}</td>
<!-- END catrow -->
<!-- BEGIN catrow_blank -->
                <td class="tableb" align="center"></td>
                <td class="tableb" align="center">{DEBUG}</td>
                <td class="tableb" align="center"></td>
<!-- END catrow_blank -->
<!-- BEGIN footer -->
        <tr>
                <td colspan="6" class="tableh1" align="center"><span class="statlink"><b>{STATISTICS}</b></span></td>
        </tr>
<!-- END footer -->
<!-- BEGIN spacer -->
        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
<!-- END spacer -->

EOT;

function theme_display_cat_list($breadcrumb, &$cat_data, $statistics)
{
	global $template_cat_list, $lang_cat_list;
	
	starttable('100%');
	
	if (count($cat_data) > 0) {
		$template = template_extract_block($template_cat_list, 'header');
		$params = array('{CATEGORY}' => $lang_cat_list['category'],
		'{ALBUMS}' => $lang_cat_list['albums'],
		'{PICTURES}' => $lang_cat_list['pictures'],
		);
		echo template_eval($template, $params);
	}
	
	$template_noabl = template_extract_block($template_cat_list, 'catrow_noalb');
	$template = template_extract_block($template_cat_list, 'catrow');
	$template_blank = template_extract_block($template_cat_list, 'catrow_blank');
	
	$count=0;
	$columnCount=2;
	echo "<tr>";    
    
	foreach($cat_data as $category) {
		$count++;    	
		if (count($category) == 3) {
			if ($count%$columnCount==0) {
				$params = array('{DEBUG}' => "");
				echo template_eval($template_blank, $params);
			}
			$params = array('{CAT_TITLE}' => $category[0],
								'{CAT_THUMB}' => $category['cat_thumb'],
								'{CAT_DESC}' => $category[1],
								'{DEBUG}' => ""
			);
			$count=0;
			echo template_eval($template_noabl, $params);
		} else {
			$params = array('{CAT_TITLE}' => $category[0],
								'{CAT_THUMB}' => $category['cat_thumb'],
								'{CAT_DESC}' => $category[1],
								'{CAT_ALBUMS}' => $category['cat_albums'],
								'{ALB_COUNT}' => $category[2],
								'{PIC_COUNT}' => $category[3],
								'{DEBUG}' => ""
			);
			echo template_eval($template, $params);
		}
		if ($count%$columnCount==0) {
			echo "</tr> <tr>";
		}
	}

	echo "</tr>";
    if ($statistics && count($cat_data) > 0) {
        $template = template_extract_block($template_cat_list, 'footer');
        $params = array('{STATISTICS}' => $statistics);
        echo template_eval($template, $params);
    }
    endtable();

    if (count($cat_data) > 0)
        echo template_extract_block($template_cat_list, 'spacer');
}
define('THEME_HAS_FILM_STRIP_GRAPHIC', 1); 


?>
