[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/template/inc_script/frontend_render/disabled/ -> gallery.php (source)

   1  <?php
   2  
   3  // load phpwcmsImageGallery class
   4  include_once (PHPWCMS_ROOT.'/include/inc_lib/imagegallery.inc.php');
   5  
   6  
   7  $gallery = & new phpwcmsImageGallery();
   8  //$gallery->setQuerySeparator('?');
   9  $gallery->setAlias( 'aid=116' );
  10  $gallery->image_sort            = 'DESC';
  11  $gallery->image_limit            = 3;
  12  
  13  $gallery->setGallerySort('NAME-DESC');
  14  $gallery->list_thumbnail_crop    = 1;
  15  $gallery->list_image_width        = 70;
  16  $gallery->list_image_height        = 70;
  17  $gallery->list_image_crop        = 1;
  18  $gallery->list_template            = '    <div class="gallery">
  19      {TITLE}
  20      {THUMBNAIL}
  21      {DESCRIPTION}
  22      <div class="clear_both"></div>
  23  </div>';
  24  $gallery->list_title_prefix        = '<h3>[LINK]<strong>{DATE:d.m.Y}</strong> &#8211; ';
  25  $gallery->list_thumbnail_prefix    = '<div class="thumbnail">[LINK]';
  26  $gallery->list_thumbnail_suffix    = '[/LINK]</div>';
  27  $gallery->list_thumbnail        = 0;
  28  $gallery->list_thumbnail_width    = 50;
  29  $gallery->list_thumbnail_height    = 50;
  30  
  31  
  32  $gallery->gallery_only = true;
  33  
  34  if( strpos($content['all'], '{GALLERY}') !== FALSE ) {
  35  
  36      $galleries = array();
  37  
  38      // List the galleries in selected sub gallery
  39      if( isset($_getVar['subgallery']) ) {
  40  
  41          $_getVar['subgallery'] = intval($_getVar['subgallery']);
  42          
  43          $sql  = 'SELECT pf.*, pj.f_id AS f_root_id, pj.f_name AS f_root_name ';
  44          $sql .= 'FROM '.DB_PREPEND.'phpwcms_file pf ';
  45          $sql .= 'LEFT JOIN '.DB_PREPEND.'phpwcms_file pj ';
  46          $sql .= 'ON pf.f_pid=pj.f_id ';
  47          $sql .= 'WHERE pf.f_id='.$_getVar['subgallery'];
  48  
  49          $subgallery  = _dbQuery($sql);
  50          
  51          $gallery_breadcrumb = array();
  52          
  53          if(isset($subgallery[0])) {
  54          
  55              $subgallery                = $subgallery[0];
  56              $subgallery_get            = '';
  57              $subgallery_class        = 'root';
  58              $gallery_breadcrumb_url    = 'index.php'.returnGlobalGET_QueryString('htmlentities', array(), array('gallery', 'subgallery'), $gallery->alias);
  59          
  60              // check if parent directory exists
  61              if(!empty($subgallery['f_root_id'])) {
  62                  $gallery_breadcrumb[]    = '<a href="'.$gallery_breadcrumb_url.'" class="root">'.html_specialchars($subgallery['f_root_name']).'</a>';
  63                  $subgallery_get            = '&amp;subgallery='.$_getVar['subgallery'];
  64                  $subgallery_class        = 'sub';
  65              }
  66              $gallery_breadcrumb[] = '<a href="'.$gallery_breadcrumb_url.$subgallery_get.'" class="'.$subgallery_class.'">'.html_specialchars($subgallery['f_name']).'</a>';    
  67          
  68          }
  69          
  70  
  71          
  72          // show gallery
  73          if( isset($_getVar['gallery']) ) {
  74  
  75              $gallery->thumb_width            = 160;
  76              $gallery->thumb_height            = 160;
  77              $gallery->width                    = 750;
  78              $gallery->height                = 700;
  79              $gallery->detail_thumbnail_crop    = 1;
  80              $gallery->detail_title_prefix    = '<h2><strong>{DATE:d.m.Y}</strong> &#8211; ';
  81              $gallery->detail_gallery_back    = '<div class="backlink">[LINK]Go back[/LINK]</div>';
  82              $gallery->image_limit            = 0;
  83              
  84              $gallery->detail_thumbnail_prefix    = '<div class="thumbnail">';
  85              $gallery->detail_thumbnail_suffix    = '<hr />{DOWNLOAD}</div>';
  86              
  87              $gallery->download                = true;
  88              $gallery->download_direct        = false;
  89              $galleries[] = $gallery->showGallery( $_getVar['gallery'] );
  90              
  91              // show title of selected gallery
  92              if(isset($gallery->gallery['f_name'])) {
  93                  $gallery_breadcrumb[] = '<span class="active">'.html_specialchars($gallery->gallery['f_name']).'</span>';    
  94              }
  95  
  96          } else {
  97          
  98              $galleries[] = $gallery->listGalleries( $_getVar['subgallery'] );
  99              
 100          }
 101          
 102          // render current gallery path
 103          if(count($gallery_breadcrumb)) {
 104              array_unshift($galleries, '<div class="gallery_breadcrumb">' . LF . '    ' . implode(' / ', $gallery_breadcrumb) . LF . '</div>');
 105          }
 106  
 107          $gallery = implode(LF, $galleries);
 108  
 109  
 110      // list sub galleries in root
 111      } else {
 112      
 113          $gallery_root = $gallery->getGalleryTree();
 114          
 115          $g = 0;
 116  
 117          foreach($gallery_root as $row) {
 118      
 119              $subgalleries   = $gallery->getGallerySub($row['f_id']);
 120              
 121              $subgallery        = '';
 122              if(is_array($subgalleries) && count($subgalleries)) {
 123                  
 124                  $subgallery  = '        <ul class="sub">' . LF;
 125                  
 126                  foreach($subgalleries as $sub) {
 127                      
 128                      $subgallery .= '            <li class="sub">' . LF;
 129                      $subgallery .= '                <h3><a href="'.$gallery->url.'&amp;subgallery='.$sub['f_id'].'">';
 130                      $subgallery .=                    html_specialchars($sub['f_name']).'</a></h3>' . LF;
 131                      if($row['f_longinfo'] != '') {
 132                          $subgallery .= '        ' . plaintext_htmlencode($sub['f_longinfo']) . LF;
 133                      }
 134                      $subgallery .= '            </li>' . LF;
 135                  }
 136                  
 137                  $subgallery .= '        </ul>' . LF;            
 138              }
 139              
 140              $galleries[$g]  = '    <li class="root">' . LF;
 141              $galleries[$g] .= '        <h2>';
 142              
 143              if($subgallery != '') {
 144                  $galleries[$g] .= html_specialchars($row['f_name']);
 145              } else {
 146                  $galleries[$g] .= '<a href="'.$gallery->url.'&amp;subgallery='.$row['f_id'].'">' . html_specialchars($row['f_name']) . '</a>';
 147              }
 148              
 149              $galleries[$g] .= '</h2>' . LF;
 150              if($row['f_longinfo'] != '') {
 151                  $galleries[$g] .= '        ' . plaintext_htmlencode($row['f_longinfo']) . LF;
 152              }
 153              $galleries[$g] .= $subgallery;    
 154              $galleries[$g] .= '    </li>';
 155              $g++;
 156  
 157          }
 158          
 159                  
 160          $gallery = count($galleries) ? '<ul class="gallery">' . LF . implode(LF, $galleries) . LF . '</ul>' : '';
 161      
 162      }
 163      
 164      $content['all']        = str_replace('{GALLERY}',                '<hr /><h1>Gallery</h1>'.LF.$gallery.LF.'<hr />',            $content['all']);
 165  }
 166  
 167  
 168  ?>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7