b2evolution PHP Cross Reference Blogging Systems

Source: /skins/manual/_catdir.disp.php - 289 lines - 11017 bytes - Text - Print

Description: This is the template that displays the links to the latest comments for a blog

   1  <?php
   2  /**

   3   * This is the template that displays the links to the latest comments for a blog

   4   *

   5   * This file is not meant to be called directly.

   6   * It is meant to be called by an include in the main.page.php template.

   7   * To display a feedback, you should call a stub AND pass the right parameters

   8   * For example: /blogs/index.php?disp=comments

   9   *

  10   * b2evolution - {@link http://b2evolution.net/}

  11   * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}

  12   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}

  13   *

  14   * @package evoskins

  15   * @subpackage manual

  16   */
  17  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  18  
  19  global $cat, $MainList;
  20  
  21  if( !empty( $cat ) )
  22  {    // Start of Category's page
  23      global $disp, $disp_detail, $Item, $Settings;
  24  
  25      if( $Settings->get( 'chapter_ordering' ) == 'manual' &&
  26          $Blog->get_setting( 'orderby' ) == 'order' &&
  27          $Blog->get_setting( 'orderdir' ) == 'ASC' )
  28      {    // Items & categories are ordered by manual field 'order'
  29          // In this mode we should show them in one merged list ordered by field 'order'

  30          $chapters_items_mode = 'order';
  31          $main_items_unit = 'all'; // Remove paging for items of main category, Show all items on one page

  32      }
  33      else
  34      {    // Standard mode for all other cases
  35          $chapters_items_mode = 'std';
  36          $main_items_unit = $Blog->get_setting('what_to_show');
  37      }
  38  
  39  
  40      // Init MainList

  41      $MainList = new ItemList2( $Blog, $Blog->get_timestamp_min(), $Blog->get_timestamp_max(), $Blog->get_setting('posts_per_page') );
  42      $MainList->load_from_Request();
  43      $MainList->set_filters( array(
  44              'cat_array' => array( $cat ), // Limit only by selected cat (exclude posts from child categories)
  45              'cat_focus' => 'main',
  46              'page'      => param( 'paged', 'integer', 1, true, true ),
  47              'unit'      => $main_items_unit,
  48          ) );
  49      $MainList->query();
  50      $MainList->nav_target = $cat; // set navigation target, we are always navigating through category in this skin

  51  
  52      $disp = 'posts';
  53      $disp_detail = 'posts-cat';
  54  
  55      // Go Grab the featured post:

  56      $intro_Item = get_featured_Item(); // $intro_Item is used below for comments form

  57      $Item = $intro_Item;
  58  
  59      if( empty( $Item ) || $Item->get( 'title' ) == '' )
  60      { // Display chapter title only if intro post has no title
  61          $ChapterCache = & get_ChapterCache();
  62          if( $curr_Chapter = & $ChapterCache->get_by_ID( $cat, false ) )
  63          { // Display category title
  64              echo '<div class="bTitle linked">';
  65  
  66              echo '<h1 class="page_title">'.$curr_Chapter->get( 'name' ).'</h1>';
  67              echo '<div class="roundbutton_group">';
  68              echo $curr_Chapter->get_edit_link( array(
  69                      'text'          => get_icon( 'edit' ).' '.T_('Edit Cat'),
  70                      'class'         => 'roundbutton roundbutton_text',
  71                      'redirect_page' => 'front',
  72                  ) );
  73  
  74              // Button to create a new page

  75              $write_new_intro_url = $Blog->get_write_item_url( $cat, '', '', 'intro-cat' );
  76              if( !empty( $write_new_intro_url ) )
  77              { // Display button to write a new intro
  78                  echo '<a href="'.$write_new_intro_url.'" class="roundbutton roundbutton_text">'
  79                          .get_icon( 'add' ).' '
  80                          .T_('Add Intro')
  81                      .'</a>';
  82              }
  83              echo '</div>';
  84  
  85              echo '<div class="clear"></div></div>';
  86          }
  87      }
  88  
  89      if( !empty( $Item ) )
  90      {    // We have a featured/intro post to display:
  91          // ---------------------- ITEM BLOCK INCLUDED HERE ------------------------

  92          skin_include( '_item_block.inc.php', array(
  93                  'feature_block'     => true,
  94                  'content_mode'      => 'auto',        // 'auto' will auto select depending on $disp-detail
  95                  'intro_mode'        => 'normal',    // Intro posts will be displayed in normal mode
  96                  'item_class'        => 'featured_post',
  97                  'image_size'        => 'fit-640x480',
  98                  'disp_comments'     => false,
  99                  'disp_comment_form' => false,
 100                  'disp_notification' => false,
 101                  'item_link_type'    => 'none',
 102              ) );
 103          // ----------------------------END ITEM BLOCK  ----------------------------

 104      }
 105  
 106      $sub_chapters = $Skin->get_chapters( $cat );
 107  
 108      if( $chapters_items_mode != 'order' && count( $sub_chapters ) > 0 )
 109      {    // Display subchapters
 110  ?>
 111  <h4><?php echo T_('Subchapters'); ?>:</h4>
 112  <ul class="chapters_list">
 113  <?php
 114          foreach( $sub_chapters as $sub_Chapter )
 115          {    // Loop through categories:
 116              skin_include( '_cat_list.inc.php', array(
 117                      'Chapter' => $sub_Chapter,
 118                  ) );
 119          }    // End of categories loop.

 120  ?>
 121      </ul>
 122  <?php
 123      }
 124  
 125      // Button to create a new sub-chapter

 126      $create_new_chapter_url = $Blog->get_create_chapter_url( $cat );
 127      if( !empty( $create_new_chapter_url ) )
 128      {    // Display button to write a new post
 129          echo '<a href="'.$create_new_chapter_url.'" class="roundbutton roundbutton_text_noicon" style="margin-bottom:15px">'.T_('Add a sub-chapter here').'</a><br />';
 130      }
 131  
 132      // ---------------------------------- START OF POSTS ------------------------------------

 133  
 134      // Display the posts ONLY from MAIN category

 135  ?>
 136  <h4 style="margin-top:20px"><?php echo T_('Pages in this chapter'); ?>:</h4>
 137  <?php
 138      // -------------------- PREV/NEXT PAGE LINKS (POST LIST MODE) --------------------

 139      mainlist_page_links( array(
 140              'block_start' => '<div class="navigation_top"><div class="navigation">'.T_('Page').': ',
 141              'block_end' => '</div></div>',
 142              'prev_text' => T_('Previous'),
 143              'next_text' => T_('Next'),
 144          ) );
 145      // ------------------------- END OF PREV/NEXT PAGE LINKS -------------------------

 146  ?>
 147  <ul class="posts_list">
 148  <?php
 149      $prev_item_order = 0;
 150      while( $Item = & mainlist_get_item() )
 151      {    // For each blog post, do everything below up to the closing curly brace "}"
 152  
 153          if( $chapters_items_mode == 'order' )
 154          {    // In this mode we display the chapters inside a posts list
 155              foreach( $sub_chapters as $s => $sub_Chapter )
 156              {    // Loop through categories to find for current order
 157                  if( ( $sub_Chapter->get( 'order' ) <= $Item->get( 'order' ) && $sub_Chapter->get( 'order' ) > $prev_item_order ) ||
 158                        /* This condition is needed for NULL order: */

 159                        ( $Item->get( 'order' ) == 0 && $sub_Chapter->get( 'order' ) >= $Item->get( 'order' ) ) )
 160                  {    // Display chapter
 161                      skin_include( '_cat_list.inc.php', array(
 162                              'Chapter' => $sub_Chapter,
 163                              'after_title' => '</h3><div class="clear"></div>',
 164                          ) );
 165                      // Remove this chapter from array to avoid the duplicates

 166                      unset( $sub_chapters[ $s ] );
 167                  }
 168              }
 169  
 170              // Save current post order for next iteration

 171              $prev_item_order = $Item->get( 'order' );
 172          }
 173  
 174          // ---------------------- ITEM BLOCK INCLUDED HERE ------------------------

 175          skin_include( '_item_list.inc.php', array() );
 176          // ----------------------------END ITEM BLOCK  ----------------------------

 177      }
 178  
 179      if( $chapters_items_mode == 'order' )
 180      {
 181          foreach( $sub_chapters as $s => $sub_Chapter )
 182          {    // Loop through rest categories that have order more than last item
 183              skin_include( '_cat_list.inc.php', array(
 184                      'Chapter' => $sub_Chapter,
 185                      'after_title' => '</h3><div class="clear"></div>',
 186                  ) );
 187              // Remove this chapter from array to avoid the duplicates

 188              unset( $sub_chapters[ $s ] );
 189          }
 190      }
 191  ?>
 192  </ul>
 193  <?php
 194      // -------------------- PREV/NEXT PAGE LINKS (POST LIST MODE) --------------------

 195      mainlist_page_links( array(
 196              'block_start' => '<div class="navigation">'.T_('Page').': ',
 197              'block_end' => '</div>',
 198              'prev_text' => T_('Previous'),
 199              'next_text' => T_('Next'),
 200          ) );
 201      // ------------------------- END OF PREV/NEXT PAGE LINKS -------------------------

 202  
 203  
 204      // Button to create a new page

 205      $write_new_post_url = $Blog->get_write_item_url( $cat );
 206      if( !empty( $write_new_post_url ) )
 207      {    // Display button to write a new post
 208          echo '<a href="'.$write_new_post_url.'" class="roundbutton roundbutton_text_noicon" style="margin-top:15px">'.T_('Add a page here').'</a>';
 209      }
 210  
 211  
 212      // Init MainList for posts ONLY from EXTRA categories

 213      $MainList = new ItemList2( $Blog, $Blog->get_timestamp_min(), $Blog->get_timestamp_max(), $Blog->get_setting('posts_per_page'), 'ItemCache', 'extra_' );
 214      $MainList->load_from_Request();
 215      $MainList->set_filters( array(
 216              'cat_array' => array( $cat ), // Limit only by selected cat (exclude posts from child categories)
 217              'cat_focus' => 'extra',
 218              'page'      => param( 'extra_paged', 'integer', 1, true, true ),
 219          ) );
 220      $MainList->query();
 221      $MainList->nav_target = $cat; // set navigation target, we are always navigating through category in this skin

 222  
 223      if( isset( $MainList ) && $MainList->result_num_rows > 0 )
 224      {
 225  ?>
 226  <h4 style="margin-top:20px"><?php echo T_('See also'); ?>:</h4>
 227  <?php
 228          // -------------------- PREV/NEXT PAGE LINKS (POST LIST MODE) --------------------

 229          mainlist_page_links( array(
 230                  'block_start' => '<div class="navigation_top"><div class="navigation">'.T_('Page').': ',
 231                  'block_end' => '</div></div>',
 232                  'prev_text' => T_('Previous'),
 233                  'next_text' => T_('Next'),
 234              ) );
 235          // ------------------------- END OF PREV/NEXT PAGE LINKS -------------------------

 236  ?>
 237  <ul class="posts_list">
 238  <?php
 239      while( $Item = & mainlist_get_item() )
 240      {    // For each blog post, do everything below up to the closing curly brace "}"
 241          // ---------------------- ITEM BLOCK INCLUDED HERE ------------------------

 242          skin_include( '_item_list.inc.php', array(
 243                  'before_title'   => '<h3><i>',
 244                  'after_title'    => '</i></h3>',
 245                  'before_content' => '<div class="excerpt"><i>',
 246                  'after_content'  => '</i></div>',
 247              ) );
 248          // ----------------------------END ITEM BLOCK  ----------------------------

 249      }
 250  ?>
 251  </ul>
 252  <?php
 253          // -------------------- PREV/NEXT PAGE LINKS (POST LIST MODE) --------------------

 254          mainlist_page_links( array(
 255                  'block_start' => '<div class="navigation">'.T_('Page').': ',
 256                  'block_end' => '</div>',
 257                  'prev_text' => T_('Previous'),
 258                  'next_text' => T_('Next'),
 259              ) );
 260          // ------------------------- END OF PREV/NEXT PAGE LINKS -------------------------

 261      }
 262  
 263      // ---------------------------------- END OF POSTS ------------------------------------

 264  
 265  
 266      if( !empty( $intro_Item ) )
 267      {
 268          global $c, $ReqURI;
 269          $c = 1; // Display comments

 270  
 271          // ------------------ FEEDBACK (COMMENTS/TRACKBACKS) INCLUDED HERE ------------------

 272          skin_include( '_item_feedback.inc.php', array(
 273                  'before_section_title' => '<h2 class="comments_list_title">',
 274                  'after_section_title'  => '</h2>',
 275                  'form_title_start'     => '<h3 class="comments_form_title">',
 276                  'form_title_end'       => '</h3>',
 277                  'Item'                 => $intro_Item,
 278                  'form_title_text'      => T_('Comment form'),
 279                  'comments_title_text'  => T_('Comments on this chapter'),
 280                  'form_comment_redirect_to' => $ReqURI,
 281              ) );
 282          // Note: You can customize the default item feedback by copying the generic

 283          // /skins/_item_feedback.inc.php file into the current skin folder.

 284          // ---------------------- END OF FEEDBACK (COMMENTS/TRACKBACKS) ---------------------

 285      }
 286  
 287  } // End of Category's page

 288  
 289  ?>

title

Description

title

Description

title

Description

title

title

Body