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 page
  5.  * @author Simon Georget <simon@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. include_once(override('../page/' . SQL . '.inc.php'));
  12.  
  13. /**
  14.  * get_page()
  15.  * return a specific page
  16.  *
  17.  * @param  $page_id 
  18.  * @return $content string
  19.  */
  20. if(!function_exists('get_page')) {
  21.  
  22.     function get_page($page_id, $display_title = true, $display_header = true, $html_title = false, $breadcrumb = false)     {
  23.         
  24.         $data = $GLOBALS['sql_object']->DBSelect(SQL_getoneCompletePage($page_id, array('P')));
  25.         $content = '';
  26.  
  27.         if (!isset($data[0]['page_title'] )) {
  28.             _debug(__FUNCTION__ . ' : no data retrieved (the given ID may be incorrect or the page is not public).');
  29.             return false;
  30.         } else {
  31.             $title = formatText($data[0]['page_title'], '2HTML');
  32.             $header = linkin_content(formatText($data[0]['page_header'], '2HTML'));
  33.             $body = linkin_content(formatText($data[0]['page_body'], '2HTML'));
  34.             $posted_on = formatText($data[0]['page_published_date_display'], '2HTML');
  35.             $modify_on = formatText($data[0]['page_last_modify_display'], '2HTML');
  36.             $posted_by = formatText($data[0]['user_login'], '2HTML');
  37.             $statut = $data[0]['page_status'];
  38.  
  39.             $link_user = array('rub' => $GLOBALS['links'][U_L]['user-profile']['linkvalue'], 'id' => $data[0]['page_posted_by'], 'name' => $data[0]['user_login']);
  40.             $link_self = array('rub' => $GLOBALS['links'][U_L]['page']['linkvalue'], 'id' => $page_id, 'name' => $title);
  41.  
  42.  
  43.             if($html_title) SetHTMLTitle($title);
  44.             if($breadcrumb) setBreadcrumb(array($title => false));
  45.  
  46.             if($display_title) $content .= '<h1>' . $title . '</h1>' . END_LINE;
  47.  
  48.  
  49.             if($display_header) $content .= '<div class="chapo">' . $header . '</div>' . END_LINE;
  50.  
  51.             $content .= '<div class="body">' . $body . '</div>' . END_LINE;
  52.             
  53.             return $content;
  54.         }
  55.         
  56.     }
  57. }
  58.  
  59.  
  60. /**
  61.  * display_page()
  62.  *
  63.  * @param  $page_id 
  64.  * @return void 
  65.  */
  66. if(!function_exists('display_page')) {
  67.     
  68.     function display_page($page_id, $display_title = true, $display_header = true, $html_title = false, $breadcrumb = false) {
  69.         echo get_page($page_id, $display_title, $display_header, $html_title, $breadcrumb);
  70.     }
  71.     
  72. }
  73.  
  74. /**
  75.  * get_page_slot()
  76.  *
  77.  * @param  $page_id 
  78.  * @return $content string
  79.  */
  80. if(!function_exists('get_page_slot')) {
  81.     
  82.     function get_page_slot($page_id, $display_title = false) {
  83.         
  84.         $content  = '<div class="page-slot slot-'.$page_id.'">';
  85.         $content .= get_page($page_id, $display_title, false, false, false);
  86.         $content .='</div>';
  87.  
  88.         return $content;
  89.     }
  90.     
  91. }
  92.  
  93. /**
  94.  * display_page_slot()
  95.  *
  96.  * @param  $page_id 
  97.  * @return void 
  98.  */
  99. if(!function_exists('display_page_slot')) {
  100.     
  101.     function display_page_slot($page_id, $display_title = true) {
  102.         
  103.         echo get_page_slot($page_id, $display_title, false, false, false);
  104.     }
  105.     
  106. }
  107.  
  108. /**
  109.  * get_page_link()
  110.  *
  111.  * @param  $page_id 
  112.  * @return $content string
  113.  */
  114. if(!function_exists('get_page_link')) {
  115.     
  116.     function get_page_link($page_id) {
  117.  
  118.         $data = $GLOBALS['sql_object']->DBSelect(SQL_getoneCompletePage($page_id, array('P')));
  119.         $content = '';
  120.  
  121.         if (!isset($data[0])) {
  122.             _debug(__FUNCTION__ . ' : no data retrieved (the given ID may be incorrect).');
  123.             return false;
  124.         } else {
  125.             $title = formatText($data[0]['page_title'], '2HTML');
  126.             $link = array('rub' => $GLOBALS['links'][U_L]['page']['linkvalue'], 'id' => $page_id, 'name' => $title);
  127.             
  128.             return HrefMaker($link);
  129.         }
  130.         
  131.     }
  132.     
  133. }
  134.  
  135. /**
  136.  * display_page_title()
  137.  *
  138.  * @param  $page_id 
  139.  * @return void 
  140.  */
  141. if(!function_exists('display_page_title')) {
  142.     
  143.     function display_page_title($page_id) {
  144.         
  145.         echo get_page_title($page_id);
  146.     }
  147.     
  148. }
  149.  
  150. /**
  151.  * get_page_title()
  152.  *
  153.  * @param  $page_id 
  154.  * @return $content string
  155.  */
  156. if(!function_exists('get_page_title')) {
  157.     
  158.     function get_page_title($page_id) {
  159.  
  160.         $data = $GLOBALS['sql_object']->DBSelect(SQL_getPageTitle($page_id, array('P')));
  161.         $content = '';
  162.  
  163.         if (!isset($data[0])) {
  164.             _debug(__FUNCTION__ . ' : no data retrieved (the given ID may be incorrect).');
  165.             return false;
  166.         } else {
  167.             $title = formatText($data[0]['page_title'], '2HTML');
  168.             return $title;
  169.         }
  170.     }
  171.     
  172. }
  173.  
  174. ?>

Documentation generated on Thu, 20 Mar 2014 16:47:40 +0100 by phpDocumentor 1.4.1