<?php
/**
 * @package linea21.core
 * @subpackage public
 * @author linea21 <info@linea21.com>
 * @version $id SVN
 * @access public
 * @license http://opensource.org/licenses/gpl-3.0.html
 */

include_once('../yellowpages/display.php');
$GLOBALS['filters'][LANGUAGE]['theme']['active'] = 1; // filter activation

SetHTMLTitle($GLOBALS['lang']['yp']['section']);

// récupération des variables GET et POST
if (isset($_REQUEST['id']) && !isset($_REQUEST['filter'])) {
  $yp_id=$_REQUEST['id'];
}
else $yp_id=-1;

if (isset($_REQUEST['filter'])) {
 	if ($_REQUEST['filter']=="alpha") {
 	  $filter_id=$_REQUEST['id'];
 	  $filter="alpha";
 	}
 	if ($_REQUEST['filter']==$GLOBALS['filters'][LANGUAGE]['theme']['linkvalue']) {

 	  $filter_id=$_REQUEST['id'];
 	  $filter=$GLOBALS['filters'][LANGUAGE]['theme']['linkvalue'];
 	}
}
else {
  $filter_id=-1;
  $filter=-1;
}
if (isset($_REQUEST['debut'])) $debut=$_REQUEST['debut'];
else $debut=0;
?>
<div id="contenu"><?php

if (ActiveItemKey($GLOBALS['activeitem'])=='directory' || ActiveItemKey($GLOBALS['activeitem'])== 'directory-detail') {
  /**
   * affichage de l'annuaire
   **/
  //DisplayUrlAddYellowpages();
  //DisplayAlphaBeta($filter,$filter_id);
  if ($yp_id==-1) {
    DisplayListYellowPages($debut, SELECT_LIMIT, $filter, $filter_id);

  }
  /**
   * affichage d'une organisation
   **/
  else {
    // set HTML Title
    $result=$GLOBALS['sql_object']->DBSelect(SQL_getOneYpName($yp_id));
    SetHTMLTitle(formatText($result[0]['yellowp_name'], '2HTML'));
    
    echo DisplayOneYellowPages($yp_id);
  }
}
/**
 * affichage du formulaire d'ajout
 **/
else echo DisplayAddYellowPages();
?></div>
