[ Index ]

PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12)

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


Generated: Sun Jan 29 16:31:14 2012 Cross-referenced by PHPXref 0.7.1