<?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)
 *
 */
 
  /*===================================================
    ViewFavorite()
  ===================================================*/

  function ViewFavorite() {

    // vars global configuration
    global $dbConn, $theme_path, $theme_name, $category_separator;

    // vars url & form
    global $id;

    // vars messages
    global $msg;

    // vars template
    global $error_msg, $fav_item, $title, $description, $date;

    $links_obj = new clsLink;
    $links_obj->table_name                 = "idx_link";
    $links_obj->favorite_table_name        = "idx_favorites";
    $links_obj->favorite_detail_table_name = "idx_favorites_detail";
    $links_obj->category_table_name        = "idx_category";
    $links_obj->category_separator         = $category_separator;
    $links_obj->template_file              = $theme_path . "cp/favorite_detail_rows.html";
    $links_obj->date_format                = $msg["20101"];
    $links_obj->rating_image_path          = "../themes/" . $theme_name . "/images/rating/";
    $links_obj->rev_rating_image_path      = "../themes/" . $theme_name . "/images/review/";
    $fav_item                              = $links_obj->ViewFavorite($id);

    // get favorite info

    $query       = "select * from idx_favorites where favorite_id = '$id'";
    $result      = $dbConn->Execute($query);
    $title       = $result->Fields("title");
    $description = $result->Fields("description");
    $date        = $result->Fields("date");
    $date        = date($msg["20102"], @strtotime($date));

    if ($fav_item == 1)
      DisplayTemplate($theme_path . "cp/no_favorite.html");
    else
      DisplayTemplate($theme_path . "cp/favorite_view.html", "\$fav_item,\$title,\$description,\$date");
  }


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

  include "../application.php";

  RunPreFilter(__FILE__);

  ViewFavorite();

  RunPostFilter(__FILE__);

?>