[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/skins/photoblog/ -> _arcdir.php (source)

   1  <?php
   2  /**

   3   * This is the template that displays the archive directory 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 the archive directory, you should call a stub AND pass the right parameters

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

   9   *

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

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

  12   * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}

  13   *

  14   * @package evoskins

  15   */
  16  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  17  
  18  $archive_mode = $Blog->get_setting('archive_mode');
  19  
  20  if( $archive_mode != 'postbypost' )
  21  {    // Do the default display:
  22  
  23      // Call the Archives plugin WITH NO LIMIT & NO MORE LINK:

  24      $Plugins->call_by_code( 'evo_Arch', array( 'title'=>'',
  25                                                    'block_start'=>'',
  26                                                    'block_end'=>'',
  27                                                    'limit'=>'',
  28                                                    'more_link'=>'' ) );
  29      return;
  30  }
  31  
  32  // fp>SUSPECT

  33  // Display photos:

  34  // PROOF OF CONCEPT. VERY EXERIMENTAL. VERY NOT RELEASABLE.

  35  // TODO: permissions, statuses, aggregations...

  36  
  37  
  38  $FileCache = & get_Cache( 'FileCache' );
  39  
  40  $FileList = & new DataObjectList2( $FileCache );
  41  
  42  
  43  $SQL = & new SQL();
  44  $SQL->SELECT( 'post_ID, file_ID, file_title, file_root_type, file_root_ID, file_path, file_alt, file_desc' );
  45  $SQL->FROM( 'T_categories INNER JOIN T_postcats ON cat_ID = postcat_cat_ID
  46                              INNER JOIN T_items__item ON postcat_post_ID = post_ID
  47                              INNER JOIN T_links ON post_ID = link_itm_ID
  48                              INNER JOIN T_files ON link_file_ID = file_ID' );
  49  $SQL->WHERE( 'cat_blog_ID = '.$Blog->ID ); // fp> TODO: want to restrict on images :]

  50  $SQL->GROUP_BY( 'link_ID' );
  51  $SQL->ORDER_BY( 'post_'.$Blog->get_setting('orderby').' '.$Blog->get_setting('orderdir')
  52                                  .', post_ID '.$Blog->get_setting('orderdir').', link_ID' );
  53  
  54  $FileList->sql = $SQL->get();
  55  
  56  $FileList->query( false, false, false );
  57  
  58  echo '<table class="image_index" cellspacing="3">';
  59  
  60  $nb_cols = 8;
  61  $count = 0;
  62  $prev_post_ID = 0;
  63  while( $File = & $FileList->get_next() )
  64  {
  65      if( ! $File->is_image() )
  66      {    // Skip anything that is not an image
  67          // fp> TODO: maybe this property should be stored in link_ltype_ID

  68          continue;
  69      }
  70  
  71      if( $count % $nb_cols == 0 )
  72      {
  73          echo '<tr>';
  74      }
  75      echo '<td>';
  76  
  77      $post_ID = $FileList->rows[$FileList->current_idx-1]->post_ID;
  78      if( $post_ID != $prev_post_ID )
  79      {
  80          $prev_post_ID = $post_ID;
  81          $count++;
  82      }
  83  
  84      // Hack a dirty permalink( will redirect to canonical):

  85      // $link = url_add_param( $Blog->get('url'), 'p='.$post_ID );

  86  
  87      // Hack a link to the right "page". Very daring!!

  88      $link = url_add_param( $Blog->get('url'), 'paged='.$count );
  89  
  90      echo '<a href="'.$link.'">';
  91      // Generate the IMG THUMBNAIL tag with all the alt, title and desc if available

  92      echo '<img src="'.$File->get_thumb_url().'" '
  93                  .'alt="'.$File->dget('alt', 'htmlattr').'" '
  94                  .'title="'.$File->dget('title', 'htmlattr').'" />';
  95      echo '</a>';
  96  
  97      // fp> TODO: CLEAN link. I really need an ItemListLight now :#

  98      /*

  99          WARNING: the above is not an ItemList, it's a FileList :/

 100  

 101          Basic spec for ItemListLight:

 102          - either params to ItemList2 or parent class. I'm not sure.

 103          - no loading/nor querying of the content

 104          - load the title

 105          - handle the statuses / visibility as well as aggregation

 106          - basically all we need is be able to generate permalinks

 107          - we need this for regular text postbypost archives too (dirty links so far)

 108          - we could use this for any kind of lists (last posts, most popular, sitemap )

 109      */
 110  
 111      echo '</td>';
 112      if( $count % $nb_cols == 0 )
 113      {
 114          echo '</tr>';
 115      }
 116  
 117  }
 118  
 119  if( $count && ( $count % $nb_cols != 0 ) )
 120  {
 121      echo '</tr>';
 122  }
 123  
 124  
 125  echo '</table>';
 126  
 127  /*

 128   * $Log: _arcdir.php,v $

 129   * Revision 1.10  2007/05/14 02:43:07  fplanque

 130   * Started renaming tables. There probably won't be a better time than 2.0.

 131   *

 132   * Revision 1.9  2007/04/26 00:11:03  fplanque

 133   * (c) 2007

 134   *

 135   * Revision 1.8  2007/03/18 01:39:57  fplanque

 136   * renamed _main.php to main.page.php to comply with 2.0 naming scheme.

 137   * (more to come)

 138   *

 139   * Revision 1.7  2007/03/11 20:39:44  fplanque

 140   * little fix

 141   *

 142   * Revision 1.6  2007/01/23 09:25:39  fplanque

 143   * Configurable sort order.

 144   *

 145   * Revision 1.5  2007/01/23 03:46:24  fplanque

 146   * cleaned up presentation

 147   *

 148   * Revision 1.4  2007/01/15 20:48:19  fplanque

 149   * constrained photoblog image size

 150   * TODO: sharpness issue

 151   *

 152   * Revision 1.3  2006/12/14 23:02:28  fplanque

 153   * the unbelievable hack :P

 154   *

 155   * Revision 1.1  2006/12/14 22:29:37  fplanque

 156   * thumbnail archives proof of concept

 157   *

 158   */
 159  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics