<?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_new_and_updated_listing($params) {
  global $dbConn, $theme_name, $theme_path, $msg;

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

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

  if (!$params['max_item']) {
    $params['max_item'] = '10';
  }

  $tpl = new Template;

  $query = "select *, if (last_updated != '0000-00-00 00:00:00', last_updated, date) date_order
            from idx_link
            where suspended = 0 and (new = 1 or updated = 1)
            order by date_order desc limit $params[max_item]";

  $links_obj = new clsLink;
  $links_obj->query                 = $query;
  $links_obj->table_name            = "idx_link";
  $links_obj->category_table_name   = "idx_category";
  $links_obj->max_rows              = $params['max_item'];
  $links_obj->rating_image_path     = "themes/" . $theme_name . "/images/rating/";
  $links_obj->rev_rating_image_path = "themes/" . $theme_name . "/images/review/";
  $links_obj->date_format           = $msg["10161"];
  $links_obj->template_file         = $theme_path . "/blocks/{$params['template_rows']}";
  $link                             = $links_obj->Display();

  $tpl->assign("link", $link);
  $tpl->assign("title", $params['title']);
  $tpl->display("blocks/" . $params['template']);
}


?>
