<?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)
 *
 */
 
  /*===================================================
    SelectGetRated()
  ===================================================*/
  
  function SelectGetRated() {
    global $theme_path;

    DisplayTemplate($theme_path . "get_rated_select.html");
  }
  

  /*===================================================
    SearchGetRatedID()
  ===================================================*/
  
  function SearchGetRatedID() {

    // vars global configuration
    global $theme_path;

    // vars url & form
    global $query;

    // vars messages
    global $msg;

    // vars template
    global $link, $num_links, $pagination, $error_msg, $keyword;

    $tpl       = new Template();
    $keyword   = $query;
    $query     = "select * from idx_link where title like '%$query%'";

    $links_obj = new clsLink;
    $links_obj->query               = $query;
    $links_obj->table_name          = "idx_link";
    $links_obj->category_table_name = "idx_category";
    $links_obj->template_file       = $theme_path . "get_rated_search_rows.html";
    $links_obj->date_format         = $msg["10151"];
    $links_obj->paging              = true;
    $links_obj->pg_size             = 25;
    $links_obj->href                = "get_rated.php";
    $links_obj->more_param          = "&pflag=search&query=$keyword";
    $link                           = $links_obj->Display();
    $pagination                     = $links_obj->pagination;
    $num_links                      = $links_obj->record_count_of_display;

    if ($num_links == 0) {
      $tpl->assign('keyword', $keyword);
      $error_msg = $tpl->fetch('var:' . $msg["10152"]);
      DisplayTemplate($theme_path . "search_error.html", "\$error_msg,\$keyword");
    }
    else
      DisplayTemplate($theme_path . "get_rated_search.html", "\$link,\$num_links,\$pagination,\$keyword");
    }


  /*===================================================
    ViewGetRated()
  ===================================================*/
  
  function ViewGetRated() {
    global $theme_path, $id;

    DisplayTemplate($theme_path . "get_rated_code.html", "\$id");
  }


  /*===================================================
    main
  ===================================================*/

  include "application.php";

  RunPreFilter(__FILE__);

  if (empty($pflag)) {
    SelectGetRated();
  }
  elseif ($pflag == 'search') {
    SearchGetRatedID();
  }
  elseif ($pflag == 'view') {
    ViewGetRated();
  }

  RunPostFilter(__FILE__);

?>