Cheetah
ChFilesPageAlbumView.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbPageView');
9 
10 require_once('ChFilesCmtsAlbums.php');
11 
13 {
14  var $aInfo;
16 
18  var $oConfig;
19  var $oDb;
20  var $oModule;
21 
23 
25  {
26  parent::__construct('ch_files_album_view');
27  $this->aInfo = $aInfo;
28  $this->iProfileId = $oModule->_iProfileId;
29 
30  $this->oModule = $oModule;
31  $this->oConfig = $oModule->_oConfig;
32  $this->oDb = $oModule->_oDb;
33  $this->oTemplate = $oModule->_oTemplate;
34 
35  $this->sBrowseCode = $sBrowseCode;
36 
37  if(!empty($aInfo['Caption'])) {
38  $GLOBALS['oTopMenu']->setCustomSubHeader(_t('_sys_album_x', $aInfo['Caption']));
39  $GLOBALS['oTopMenu']->setCustomSubHeaderUrl(CH_WSB_URL_ROOT . $this->oConfig->getBaseUri() . 'browse/album/' . $aInfo['Uri'] . '/owner/' . getUsername($aInfo['Owner']));
40  }
41  }
42 
43  function getBlockCode_Objects($iBlockId)
44  {
45  if(!empty($this->sBrowseCode))
46  return $this->sBrowseCode;
47 
48  $sClassName = $this->oConfig->getClassPrefix() . 'Search';
49  ch_import('Search', $this->oModule->_aModule);
50  $oSearch = new $sClassName('album');
51  $aParams = array('album' => $this->aInfo['Uri'], 'owner' => getUsername($this->aInfo['Owner']));
52  $aCustom = array(
53  'enable_center' => true,
54  'per_page' => $this->oConfig->getGlParam('number_view_album'),
55  'sorting' => 'album_order'
56  );
57  $aHtml = $oSearch->getBrowseBlock($aParams, $aCustom);
58  $iCount = $oSearch->aCurrent['paginate']['totalNum'];
59  $sPaginate = '';
60  if ($iCount > $oSearch->aCurrent['paginate']['perPage']) {
61  $sLink = $this->oConfig->getBaseUri() . 'browse/album/' . $aParams['album'] . '/owner/' . $aParams['owner'];
62  $oPaginate = new ChWsbPaginate(array(
63  'page_url' => $sLink . '&page={page}&per_page={per_page}',
64  'count' => $iCount,
65  'per_page' => $oSearch->aCurrent['paginate']['perPage'],
66  'page' => $oSearch->aCurrent['paginate']['page'],
67  'on_change_per_page' => 'document.location=\'' . CH_WSB_URL_ROOT . $sLink . '&page=1&per_page=\' + this.value;'
68  ));
69  $sPaginate = $oPaginate->getPaginate();
70  }
71 
72  if(empty($aHtml['code']))
73  $aHtml['code'] = MsgBox(_t('_Empty'));
74 
75  return DesignBoxContent(_t('_' . $this->oConfig->getMainPrefix() . '_browse_by_album', $this->aInfo['Caption']), $aHtml['code'], 1, '', $sPaginate);
76  }
77 
79  {
80  return $this->oModule->getBlockActionsAlbum($this->aInfo);
81  }
82 
84  {
85  $aOwner = array('medProfId' => $this->aInfo['Owner'], 'NickName' => getNickName($this->aInfo['Owner']));
86  return $this->oTemplate->getFileAuthor($aOwner);
87  }
88 
89  function getBlockCode_Info()
90  {
91  return $this->oTemplate->getAlbumInfo($this->aInfo);
92  }
93 
95  {
96  $this->oTemplate->addCss('cmts.css');
97 
98  $oCmtsView = new ChFilesCmtsAlbums($this->oConfig->getMainPrefix() . '_albums', $this->aInfo['ID']);
99  if(!$oCmtsView->isEnabled())
100  return '';
101 
102  return $oCmtsView->getCommentsFirst();
103  }
104 }
MsgBox
MsgBox($sText, $iTimer=0)
Definition: design.inc.php:175
ChFilesPageAlbumView\$aInfo
$aInfo
Definition: ChFilesPageAlbumView.php:14
ChWsbPageView
Definition: ChWsbPageView.php:99
ChFilesPageAlbumView\$iProfileId
$iProfileId
Definition: ChFilesPageAlbumView.php:15
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
ChFilesPageAlbumView\$oConfig
$oConfig
Definition: ChFilesPageAlbumView.php:18
ChFilesPageAlbumView\getBlockCode_Actions
getBlockCode_Actions()
Definition: ChFilesPageAlbumView.php:78
php
ChFilesPageAlbumView
Definition: ChFilesPageAlbumView.php:13
getNickName
getNickName( $ID='')
Definition: profiles.inc.php:461
ChFilesPageAlbumView\$oDb
$oDb
Definition: ChFilesPageAlbumView.php:19
getUsername
getUsername( $ID='')
Definition: profiles.inc.php:443
ChWsbPaginate
Definition: ChWsbPaginate.php:69
ChFilesPageAlbumView\getBlockCode_Author
getBlockCode_Author()
Definition: ChFilesPageAlbumView.php:83
ChFilesPageAlbumView\getBlockCode_Info
getBlockCode_Info()
Definition: ChFilesPageAlbumView.php:89
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
ChFilesCmtsAlbums
Definition: ChFilesCmtsAlbums.php:11
ChFilesPageAlbumView\__construct
__construct($oModule, $aInfo, $sBrowseCode='')
Definition: ChFilesPageAlbumView.php:24
ChFilesPageAlbumView\$sBrowseCode
$sBrowseCode
Definition: ChFilesPageAlbumView.php:22
ChFilesPageAlbumView\getBlockCode_Comments
getBlockCode_Comments()
Definition: ChFilesPageAlbumView.php:94
ChFilesPageAlbumView\getBlockCode_Objects
getBlockCode_Objects($iBlockId)
Definition: ChFilesPageAlbumView.php:43
ChFilesPageAlbumView\$oModule
$oModule
Definition: ChFilesPageAlbumView.php:20
ChFilesPageAlbumView\$oTemplate
$oTemplate
Definition: ChFilesPageAlbumView.php:17
DesignBoxContent
DesignBoxContent($title, $content, $db_num=0, $caption_item='', $bottom_item='')
Definition: design.inc.php:78
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10