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

Documentation generated on Sat, 08 Nov 2008 14:51:54 +0100 by phpDocumentor 1.4.1