linea21-modules
[ class tree: linea21-modules ] [ index: linea21-modules ] [ all elements ]

Source for file display.php

Documentation is available at display.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage news
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. include_once(themePath('../news/' SQL '.inc.php'));
  12.  
  13. /**
  14.  * DisplayListNews()
  15.  * Affichage de la liste des news publique
  16.  *
  17.  * @param  $statut 
  18.  * @param  $filter 
  19.  * @param  $id_filter 
  20.  * @param  $debut 
  21.  * @return void echo content
  22.  */
  23. if(!function_exists('DisplayListNews')) {
  24.  
  25.   function DisplayListNews($statut$filter$id_filter$debut)
  26.   {
  27.     if ($statut == 'public'{
  28.       $pas 100;
  29.       $suffix '';
  30.     else $pas SELECT_LIMIT;
  31.     if ($statut == 'archives_p'$suffix ' "'.strtolower(_t('statut','PA')).'"';
  32.     $data $GLOBALS['sql_object']->DBSelect(SQL_getNewsList($debut$pas$statut$filter$id_filter));
  33.     $datacount $GLOBALS['sql_object']->DBSelect(SQL_getCountNewsList($statut$filter$id_filter));
  34.     $bdd_nb_com $datacount[0]['num_rows'];
  35.     $bdd_nb_com_display '<p>' $bdd_nb_com ' ' _t('news','name2'$suffix '</p>' END_LINE;
  36.     $content '<h1 class="semnone">' _t('news','list''</h1>' END_LINE;
  37.     if ($data != 0{
  38.       // echo $bdd_nb_com_display;    // affichage du nombre d'enregistrements
  39.       $current_link array('rub' => $GLOBALS['links'][U_L]['news-archives']['linkvalue']);
  40.       Display_linkin_page($current_link$bdd_nb_com$debut$pas);
  41.       for($i 0$i count($data)$i++{
  42.         $link_detail array('rub' => $GLOBALS['links'][U_L]['news']['linkvalue']'id' => $data[$i]['news_id']'name' => $data[$i]['news_title']);
  43.         $link_theme array('rub' => $GLOBALS['links'][U_L]['news']['linkvalue']'filter' => $GLOBALS['filters'][U_L]['theme']['linkvalue']'id' => $data[$i]['sdtheme_id']'name' => $data[$i]['sdtheme_name']);
  44.         $link_level array('rub' => $GLOBALS['links'][U_L]['news']['linkvalue']'filter' => $GLOBALS['filters'][U_L]['level']['linkvalue']'id' => $data[$i]['news_level']'name' => $data[$i]['level_name']);
  45.         $link_scale array('rub' => $GLOBALS['links'][U_L]['news']['linkvalue']'filter' => $GLOBALS['filters'][U_L]['scale']['linkvalue']'id' => $data[$i]['news_scale']'name' => $data[$i]['scale_denomination']);
  46.         $link_user array('rub' => $GLOBALS['links'][U_L]['user-profile']['linkvalue']'id' => $data[$i]['news_posted_by']'name' => $data[$i]['user_login']);
  47.         $news_title formatText($data[$i]['complete_news_title']'2HTML');
  48.         $news_header formatText($data[$i]['news_header']'2HTML');
  49.         $news_sdtheme formatText($data[$i]['sdtheme_name']'2HTML');
  50.         $level_name formatText($data[$i]['level_name']'2HTML');
  51.         $scale_denomination formatText($data[$i]['scale_denomination']'2HTML');
  52.         $news_posted_on formatText($data[$i]['news_published_date_display']'2HTML');
  53.         $news_posted_by formatText($data[$i]['user_login']'2HTML');
  54.  
  55.         $content .= '<h2 class="nobottommargin"><a href="' HrefMaker($link_detail'" title="' formatText($news_title'2ATT''">' $news_title '</a>' END_LINE;
  56.         $content .= '</h2>' END_LINE;
  57.         $content .= '<p class="published_by">' END_LINE;
  58.         $content .= _t('statut','published_on'' ' $news_posted_on ' ';
  59.         $content .= _t('divers','by').' <a href="' HrefMaker($link_user'" title="' $GLOBALS['links'][U_L]['user-profile']['desc'' (' $news_posted_by ')">' $news_posted_by '</a>';
  60.         $content .= '</p>' END_LINE;
  61.          
  62.         $content .= '<p class="list_textcontent">' $news_header '</p>' END_LINE;
  63.         $content .= '<p class="filter_info">';
  64.         $content .= _t('divers','level'' : ';
  65.         $content .= '<a href="' HrefMaker($link_level'" title="' $GLOBALS['filters'][U_L]['level']['desc'' : ' formatText($level_name'2ATT''" class="filter_info_level">' $level_name '</a> ' END_LINE;
  66.         $content .= _t('divers','themeref'' : ';
  67.         $content .= ' <a href="' HrefMaker($link_theme'" title="' $GLOBALS['filters'][U_L]['theme']['desc'' : ' formatText($news_sdtheme'2ATT''" class="filter_info_theme">' $news_sdtheme '</a>' END_LINE;
  68.         $content .= _t('divers','scale'' : ';
  69.         $content .= ' <a href="' HrefMaker($link_scale'" title="' $GLOBALS['filters'][U_L]['scale']['desc'' : ' formatText($scale_denomination'2ATT''" class="filter_info_scale">' $scale_denomination '</a></p>' END_LINE;
  70.         if($i<count($data)-1$content .= '<hr />' END_LINE;
  71.       }
  72.     else {
  73.       $content .= '<p class="info">' _t('divers','nodata''</p>';
  74.     }
  75.  
  76.     echo $content;
  77.   }
  78. }
  79.  
  80. /**
  81.  * DisplayOneNews()
  82.  * Affichage d'une actualté en détail
  83.  *
  84.  * @param  $news_id 
  85.  * @return $stat Nom du statut + echo content
  86.  */
  87. if(!function_exists('DisplayOneNews')) {
  88.  
  89.   function DisplayOneNews($news_id)
  90.   {
  91.     $data $GLOBALS['sql_object']->DBSelect(SQL_getoneCompleteNews($news_id));
  92.     $content '';
  93.     if (count($data!= 1exit;
  94.     else {
  95.       $link_theme array('rub' => $GLOBALS['links'][U_L]['news']['linkvalue']'filter' => $GLOBALS['filters'][U_L]['theme']['linkvalue']'id' => $data[0]['theme_sd_theme']'name' => $data[0]['sdtheme_name']);
  96.       $link_level array('rub' => $GLOBALS['links'][U_L]['news']['linkvalue']'filter' => $GLOBALS['filters'][U_L]['level']['linkvalue']'id' => $data[0]['news_level']'name' => $data[0]['level_name']);
  97.       $link_scale array('rub' => $GLOBALS['links'][U_L]['news']['linkvalue']'filter' => $GLOBALS['filters'][U_L]['scale']['linkvalue']'id' => $data[0]['news_scale']'name' => $data[0]['scale_denomination']);
  98.       $link_user array('rub' => $GLOBALS['links'][U_L]['user-profile']['linkvalue']'id' => $data[0]['news_posted_by']'name' => $data[0]['user_login']);
  99.       $link_self array('rub' => $GLOBALS['links'][U_L]['news']['linkvalue']'id' => $news_id);
  100.       $news_title formatText($data[0]['news_title']'2HTML');
  101.       $news_header linkin_content(formatText($data[0]['news_header']'2HTML'));
  102.       $news_body linkin_content(formatText($data[0]['news_body']'2HTML'));
  103.       $news_template $data[0]['news_template'];
  104.       $news_photo_uri $data[0]['news_photo_uri'];
  105.       $news_sdtheme formatText($data[0]['sdtheme_name']'2HTML');
  106.       $news_scale_denomination formatText($data[0]['scale_denomination']'2HTML');
  107.       $news_theme formatText($data[0]['theme_name']'2HTML');
  108.       $news_level formatText($data[0]['level_name']'2HTML');
  109.       $news_posted_on formatText($data[0]['news_published_date_display']'2HTML');
  110.       $news_modify_on formatText($data[0]['news_last_modify_display']'2HTML');
  111.       $news_posted_by formatText($data[0]['user_login']'2HTML');
  112.       $news_statut $data[0]['news_statut'];
  113.  
  114.       $contents TemplateFormat($news_title$news_header$news_body$news_template$news_photo_uri);
  115.  
  116.       $content .= '<h1 class="nobottommargin">' $news_title '</h1>' END_LINE;
  117.       $content .= '<p class="published_by">' END_LINE;
  118.       $content .= _t('statut','published_on'' ' $news_posted_on ' ';
  119.       $content .= _t('divers','by').' <a href="' HrefMaker($link_user'" title="' $GLOBALS['links'][U_L]['user-profile']['desc'' (' $news_posted_by ')">' $news_posted_by '</a>';
  120.       if ($news_statut == 'PA'{
  121.         $content .= ' (' _t('statut','archived_on'' ' $news_modify_on ')';
  122.       }
  123.       $content .= formatted_permalink($link_self' - ');
  124.       $content .= '</p>' END_LINE;
  125.  
  126.       $content .= $contents;
  127.  
  128.       $content .= '<p class="filter_info">' END_LINE;
  129.       $content .= _t('divers','level'' : ';
  130.       $content .= '<a href="' HrefMaker($link_level'" title="' $GLOBALS['filters'][U_L]['level']['desc'' : ' formatText($news_level'2ATT''" class="filter_info_level">' $news_level '</a> ' END_LINE;
  131.       $content .= ' ' _t('divers','themeref'' : ';
  132.       $content .= '<a href="' HrefMaker($link_theme'" title="' $GLOBALS['filters'][U_L]['theme']['desc'' : ' formatText($news_sdtheme'2ATT''" class="filter_info_theme">' $news_sdtheme '</a> ';
  133.       //$content .= ' '._t('divers','sousthemeref') . ' :';
  134.       //$content .= $news_theme . END_LINE;
  135.       $content .= ' ' _t('divers','scale'' : ';
  136.       $content .= '<a href="' HrefMaker($link_scale'" title="' $GLOBALS['filters'][U_L]['scale']['desc'' : ' formatText($news_scale_denomination'2ATT''" class="filter_info_scale">' $news_scale_denomination '</a>' END_LINE;
  137.       $content .= '</p>' END_LINE;
  138.     }
  139.     echo $content;
  140.     return GetStatutName($news_statut);
  141.   }
  142. }
  143.  
  144. /**
  145.  * GetStatutName()
  146.  *
  147.  * @param  $statut 
  148.  * @return $stat Nom du statut
  149.  */
  150. if(!function_exists('GetStatutName')) {
  151.  
  152.   function GetStatutName($statut)
  153.   {
  154.     switch ($statut{
  155.       case 'P':
  156.         $stat 'public';
  157.         break;
  158.       case 'PA':
  159.         $stat 'archives_p';
  160.         break;
  161.       case 'AA':
  162.         $stat 'archives_a';
  163.         break;
  164.       default:
  165.         $stat 'public';
  166.     }
  167.     return $stat;
  168.   }
  169. }
  170.  
  171. /**
  172.  * DisplayLinkNews()
  173.  * Affiche ou non 1 lien vers les news a venir ou qui précéde.
  174.  *
  175.  * @param  $current_news 
  176.  * @param  $direction 
  177.  * @param  $statut 
  178.  * @return echo content
  179.  */
  180. if(!function_exists('DisplayLinkNews')) {
  181.  
  182.   function DisplayLinkNews($current_news$direction$statut)
  183.   {
  184.     if ($direction == 'NEXT'{
  185.       $requete SQL_getNextNews($current_news$statut);
  186.       $class 'next';
  187.       $prefix '&gt; &gt; ';
  188.       $suffix '';
  189.       $title _t('news','next_news');
  190.     }
  191.     if ($direction == 'PREVIOUS'{
  192.       $requete SQL_getPreviousNews($current_news$statut);
  193.       $class 'previous';
  194.       $prefix '';
  195.       $suffix ' &lt; &lt;';
  196.       $title _t('news','prev_news');
  197.     }
  198.     $data $GLOBALS['sql_object']->DBSelect($requete);
  199.  
  200.     if ($data == false || count($data!= 1$content '';
  201.     else {
  202.       $link_news array('rub' => $GLOBALS['links'][U_L]['news']['linkvalue']'id' => $data[0]['news_id']'name' => $data[0]['news_title']);
  203.       $news_complete_title formatText($data[0]['news_title']'2HTML');
  204.       $news_title formatText(cutText($data[0]['news_title']45)'2HTML');
  205.  
  206.       $content '<div class="' $class '">' END_LINE;
  207.       $content .= $prefix END_LINE;
  208.       $content .= '<a href="' HrefMaker($link_news'" title="' $title .' : '.formatText($news_complete_title'2ATT')'">' $news_title .'</a>';
  209.       $content .= $suffix END_LINE;
  210.       $content .= '</div>' END_LINE;
  211.     }
  212.     echo $content;
  213.   }
  214. }
  215.  
  216. /**
  217.  * TemplateFormat()
  218.  * Mise en page de l'actualité suivant son format
  219.  *
  220.  * @param  $title 
  221.  * @param  $header 
  222.  * @param  $body 
  223.  * @param  $template 
  224.  * @param  $photouri 
  225.  * @return $content 
  226.  */
  227. if(!function_exists('TemplateFormat')) {
  228.  
  229.   function TemplateFormat($title$header$body$template$photouri)
  230.   {
  231.     // '3' Template 2 photos
  232.     if ($template == 3{
  233.       list($photo1_src$photo2_srcGetAllPhotoUri($photouri);
  234.       list($body$body2cutBody($body);
  235.     }
  236.     if ($template == || $template == 2list($photo1_srcGetAllPhotoUri($photouri);
  237.     if ($template == 1$style ' class="tplimgleft"';
  238.     if ($template == || $template == 3$style ' class="tplimgright"';
  239.  
  240.     $content '<div>';
  241.     if ($template != 4$content .= EnlargeImage('../' $photo1_src$style'visuel ' $title);
  242.     $content .= '<p class="chapo">' $header '</p>' END_LINE;
  243.     $content .= '<p class="textcontent">' $body '</p>' END_LINE;
  244.     if ($template == 3{
  245.       $style ' class="tplimgleft"';
  246.       $content .= EnlargeImage('../' $photo2_src$style'visuel ' $title);
  247.       $content .= '<p class="textcontent">' $body2 '</p>' END_LINE;
  248.     }
  249.     $content .= '</div>';
  250.     $content .= '<br style="clear:both" />';
  251.  
  252.     return $content;
  253.   }
  254. }
  255.  
  256. ?>

Documentation generated on Fri, 01 Apr 2011 09:30:16 +0200 by phpDocumentor 1.4.1