Cheetah
ChPhotosPageHome.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbFilesPageHome');
9 
11 {
12  function __construct (&$oShared)
13  {
14  parent::__construct($oShared);
15  }
16 
17  function getBlockCode_Cover ()
18  {
19  $bUseFeatured = $this->oConfig->getGlParam('cover_featured') == 'on';
20 
21  $iRows = (int)$this->oConfig->getGlParam('cover_rows');
22  $iColumns = (int)$this->oConfig->getGlParam('cover_columns');
23  $iExcess = 20;
24 
25  $iCountRequired = $iRows * $iColumns + $iExcess;
26  $this->oSearch->clearFilters(array('activeStatus', 'allow_view', 'album_status', 'albumType', 'ownerStatus'), array('albumsObjects', 'albums'));
27  if($bUseFeatured)
28  $this->oSearch->aCurrent['restriction']['featured'] = array(
29  'field' => 'Featured',
30  'value' => '1',
31  'operator' => '=',
32  'param' => 'featured'
33  );
34  $this->oSearch->aCurrent['paginate']['perPage'] = $iCountRequired;
35  $aFiles = $this->oSearch->getSearchData();
36  if(empty($aFiles))
37  return '';
38 
39  $iCount = count($aFiles);
40  if($iCount < $iCountRequired)
41  while($iCount < $iCountRequired) {
42  $aFiles = array_merge($aFiles, $aFiles);
43  $iCount = count($aFiles);
44  }
45 
46  $sViewUrl = CH_WSB_URL_ROOT . $this->oModule->_oConfig->getBaseUri() . 'view/';
47 
48  $aTmplVarsImages = array();
49  foreach($aFiles as $aFile)
50  $aTmplVarsImages[] = array(
51  'src' => $this->oSearch->getImgUrl($aFile['Hash'], 'browse'),
52  'link' => $sViewUrl . $aFile['uri'],
53  'title' => ch_html_attribute($aFile['title'])
54  );
55 
56  $this->oTemplate->addCss(array('cover.css'));
57  $this->oTemplate->addJs(array('modernizr.js', 'jquery.gridrotator.js'));
58  return $this->oTemplate->parseHtmlByName('cover.html', array(
59  'loading' => $GLOBALS['oFunctions']->loadingBoxInline(),
60  'ch_repeat:images' => $aTmplVarsImages,
61  'rows' => $iRows,
62  'columns' => $iColumns
63  ));
64  }
65 
67  {
68  $this->oSearch->clearFilters(array('activeStatus', 'allow_view', 'album_status', 'albumType', 'ownerStatus'), array('albumsObjects', 'albums'));
69  $this->oSearch->aCurrent['restriction']['featured'] = array(
70  'field' => 'Featured',
71  'value' => '1',
72  'operator' => '=',
73  'param' => 'featured'
74  );
75  $this->oSearch->aCurrent['paginate']['perPage'] = 1;
76  $aFiles = $this->oSearch->getSearchData();
77  return $this->oSearch->getSwitcherUnit($aFiles[0], array('showLink'=>1, 'showRate' => 1, 'showDate' => 1, 'showFrom' => 1));
78  }
79 }
ChPhotosPageHome\getBlockCode_LatestFile
getBlockCode_LatestFile()
Definition: ChPhotosPageHome.php:66
ChWsbFilesPageHome
Definition: ChWsbFilesPageHome.php:12
ChPhotosPageHome
Definition: ChPhotosPageHome.php:11
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
php
ChPhotosPageHome\getBlockCode_Cover
getBlockCode_Cover()
Definition: ChPhotosPageHome.php:17
ch_html_attribute
ch_html_attribute($mixedInput)
Definition: utils.inc.php:1324
ChPhotosPageHome\__construct
__construct(&$oShared)
Definition: ChPhotosPageHome.php:12
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10