<?php

/**
 *
 * INDEXU
 * Copyright(C), Nicecoder, 2000-2006, All Rights Reserved.
 *
 * INDEXU(tm) is protected by Indonesia and International copyright laws.
 * Unauthorized use or distribution of INDEXU(tm) is strictly prohibited,
 * violators will be prosecuted. To obtain a license for using INDEXU(tm),
 * please register at Nicecoder home page at http://www.nicecoder.com
 *
 * Author:
 *    Dody Rachmat Wicaksono (dody@nicecoder.com)
 *    M. Zuber (zubby@nicecoder.com)
 *
 */

function block_add_jump($params) {
  global $dbConn, $site_url, $category_separator;

  if (!$params['template']) {
    $params['template'] = 'block.add_jump.html';
  }

  $tpl = new Template;

  $query = "select a.category_id, b.path
            from idx_category a
                 left join idx_category_path b on (a.category_id = b.category_id)
            where visible = 1
            order by b.path asc";
  $result = $dbConn->Execute($query);

  while ($row = $result->FetchRow()) {
    $row['add_url'] = "$site_url/add.php?cat=$row[category_id]";
    $paths = explode($category_separator, $row['path']);
    $row['path'] = str_repeat('&nbsp; ', (@count($paths) - 1) * 3).$paths[@count($paths) - 1];
    $categories[] = $row;
  }
  
  $tpl->assign('categories', $categories);
  $tpl->display("blocks/" . $params['template']);
}

?>
