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