<?
function dispHome() {

  $str = '';
  $str .= dispHomeEdito();

  //$str .= '<div class="top_box">';
  //$str .= ' <object width="790" height="168"><param name="movie" value="http://www.dailymotion.com/flash/dmwall/dmwall.swf?feed=/eptv&cols=9&rows=2&slide=0&brand=none"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="transparent"></param><embed width="790" height="168" wmode="transparent" allowscriptaccess="always" src="http://www.dailymotion.com/flash/dmwall/dmwall.swf?feed=/eptv&cols=9&rows=2&slide=0&duration=30&brand=none" type="application/x-shockwave-flash" /></object>';
  //$str .= '</div>';

  $str .= '<div id="left_side">';
  $str .= '<div id="lastnewsbox">';
  $str .= '<h1><img alt="" src="images/puce.png" />&nbsp;<strong>Les derni&egrave;res actualit&eacute;s</strong>&nbsp;<a type="application/rss+xml" href="?rss=News"><img alt="Flux RSS Actuali&eacute;s" src="images/rss.png" height="14px" /></a></h1>';

  $str .= '<ul>';
  $str .= dispNewsRows(15);
  $str .= '</ul>';
  $str .= '</div>';
  $str .= '</div>';

  $str .= '<div id="right_side">';
  $str .= '<div class="rightbox">';
  $str .= '<h1><img alt="" src="images/puce.png" />&nbsp;<strong>Les derni&egrave;res vid&eacute;os</strong>&nbsp;<a type="application/rss+xml" href="?rss=Videos"><img alt="Flux RSS Vid&eacute;os" src="images/rss.png" height="14px" /></a></h1>';
  $str .= dispHomeLastVideos();
  $str .='</div></div>';

  echo $str;
}

function dispHomeEdito(){
  $result = getLastEdito();
  if (mysql_num_rows($result))
    $edito = mysql_fetch_array($result);

  $str = '<div id="all_side">';
  $str .= '<div id="editobox">';
  $str .= '<h1><img alt="" src="images/puce.png" />&nbsp;<small>Edito :</small> '.$edito["edito_title"].'</h1>';
  $str .= '<table width=100%><tr>';
  $str .= '<td><img id="logo_edito" alt="" src="images/edito_logo.png" />';
  $str .= '<td>'.$edito["edito_comment"].'</td>';
  $str .= '</tr></table>';
  $str .= '</div>';
  $str .= '</div>';

  return $str;
}

function dispHomeLastVideos(){
  if ($_SESSION["user_right"] >= $GLOBALS["PRIV_GUEST"])
    $result = getLastVideosByTendu(2);
  else if ($_SESSION["user_right"] >= $GLOBALS["GUEST"])
    $result = getLastVideosByTendu(1);
  else
    $result = getLastVideosByTendu(0);

  $str = '<ul>';

  if (mysql_num_rows($result)){
    for ($cpt = 0; $cpt < 20 && ($video = mysql_fetch_array($result)); $cpt++) {
      // DISP LAST VIDEOS BY TENDU
      $str .= dispWhenTendu($video["video_tendu"]);

      $str .= '&nbsp;<li><a href="?video=' . $video["video_id"] . ' " class="texte_link"' . '>'.$video["video_name"].'</a></td><td>';

      if ($video["video_path_daily"]) {
	$str .= '&nbsp;&nbsp;&nbsp;';
	$str .= '<a href="javascript:popup_video_dailymotion(\'?dailymotion='.$video["video_id"].'\')">';
	$str .= '<img class="daily_preview" src=\'../images/daily.png\' height="18" border=0 />';
	$str .= '</a>';
      }
      $str .= '&nbsp;&nbsp;&nbsp;<strong>'.$video["video_size"].' Mo</strong>';
    }
    $str .= '</ul>';
  }

  $str .= '</small>';

  return ($str);
}

?>
