Cheetah
ChSoundsTemplate.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbFilesTemplate');
9 
11 {
12  function __construct (&$oConfig, &$oDb)
13  {
14  parent::__construct($oConfig, $oDb);
15  }
16 
17  function getFileConcept ($iFileId, $aExtra = array())
18  {
19  $sOverride = false;
20  $oAlert = new ChWsbAlerts($this->_oConfig->getMainPrefix(), 'display_player', $iFileId, getLoggedId(), array('extra' => $aExtra, 'override' => &$sOverride));
21  $oAlert->alert();
22  if ($sOverride)
23  return $sOverride;
24 
25  $iFileId = (int)$iFileId;
26  return '<div class="viewFile" style="width:100%">' . getApplicationContent('mp3', 'player', array('id' => $iFileId, 'user' => (int)$_COOKIE['memberID'], 'password' => clear_xss($_COOKIE['memberPassword'])), true) . '</div>';
27  }
28 
29  function getViewFile (&$aInfo)
30  {
31  $oVotingView = new ChTemplVotingView('ch_' . $this->_oConfig->getUri(), $aInfo['medID']);
32  $iWidth = (int)$this->_oConfig->getGlParam('file_width');
33  if ($aInfo['prevItem'] > 0)
34  $aPrev = $this->_oDb->getFileInfo(array('fileId'=>$aInfo['prevItem']), true, array('medUri', 'medTitle'));
35  if ($aInfo['nextItem'] > 0)
36  $aNext = $this->_oDb->getFileInfo(array('fileId'=>$aInfo['nextItem']), true, array('medUri', 'medTitle'));
37  $aUnit = array(
38  'file' => $this->getFileConcept($aInfo['medID']),
39  'width' => $iWidth,
40  'fileUrl' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aInfo['medUri'],
41  'fileTitle' => $aInfo['medTitle'],
42  'fileDescription' => nl2br($aInfo['medDesc']),
43  'rate' => $oVotingView->isEnabled() ? $oVotingView->getBigVoting(1, $aInfo['Rate']): '',
44  'favInfo' => isset($aInfo['favCount']) ? $aInfo['favCount'] : '',
45  'viewInfo' => $aInfo['medViews'],
46  'albumUri' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'browse/album/' . $aInfo['albumUri'] . '/owner/' . $aInfo['NickName'],
47  'albumCaption' => $aInfo['albumCaption'],
48  'ch_if:prev' => array(
49  'condition' => $aInfo['prevItem'] > 0,
50  'content' => array(
51  'linkPrev' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aPrev['medUri'],
52  'titlePrev' => $aPrev['medTitle'],
53  'percent' => $aInfo['nextItem'] > 0 ? 50 : 100,
54  )
55  ),
56  'ch_if:next' => array(
57  'condition' => $aInfo['nextItem'] > 0,
58  'content' => array(
59  'linkNext' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aNext['medUri'],
60  'titleNext' => $aNext['medTitle'],
61  'percent' => $aInfo['prevItem'] > 0 ? 50 : 100,
62  )
63  ),
64  );
65  return $sCode = $this->parseHtmlByName('view_unit.html', $aUnit);
66  }
67 
68  function getCompleteFileInfoForm (&$aInfo, $sUrlPref = '')
69  {
70  $aMain = $this->getBasicFileInfoForm($aInfo, $sUrlPref);
71  if ($aInfo['AllowAlbumView'] == CH_WSB_PG_ALL)
72  {
73  $aAdd = array(
74  'embed' => array(
75  'type' => 'text',
76  'value' => $this->getEmbedCode($aInfo['medID']),
77  'attrs' => array(
78  'onclick' => 'this.focus(); this.select();',
79  'readonly' => 'readonly',
80  ),
81  'caption'=> _t('_Embed')
82  ),
83  );
84  $aMain = array_merge($aMain, $aAdd);
85  }
86  return $aMain;
87  }
88 
90  {
91  $sOverride = false;
92  $oAlert = new ChWsbAlerts($this->_oConfig->getMainPrefix(), 'embed_code', $iFileId, getLoggedId(), array('override' => &$sOverride));
93  $oAlert->alert();
94  if ($sOverride)
95  return $sOverride;
96 
97  $iFileId = (int)$iFileId;
98  return getEmbedCode('mp3', 'player', array('id'=>$iFileId));
99  }
100 }
ChSoundsTemplate\getFileConcept
getFileConcept($iFileId, $aExtra=array())
Definition: ChSoundsTemplate.php:17
$aUnit
$aUnit
Definition: short_profile_info.php:31
$sCode
$sCode
Definition: explanation.php:19
ChSoundsTemplate\getViewFile
getViewFile(&$aInfo)
Definition: ChSoundsTemplate.php:29
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
$oAlert
$oAlert
Definition: embed.php:15
ChWsbFilesTemplate
Definition: ChWsbFilesTemplate.php:13
php
ChSoundsTemplate
Definition: ChSoundsTemplate.php:11
$aInfo
$aInfo
Definition: constants.inc.php:21
ChWsbAlerts
Definition: ChWsbAlerts.php:39
getLoggedId
getLoggedId()
Definition: profiles.inc.php:32
$oDb
global $oDb
Definition: db.inc.php:39
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
getApplicationContent
getApplicationContent($sModule, $sApp, $aParamValues=array(), $bInline=false, $bEmbedCode=false, $sHtmlId="")
Definition: content.inc.php:166
CH_WSB_PG_ALL
const CH_WSB_PG_ALL
Definition: ChWsbPrivacy.php:12
ChSoundsTemplate\getEmbedCode
getEmbedCode($iFileId)
Definition: ChSoundsTemplate.php:89
ChWsbFilesTemplate\getBasicFileInfoForm
getBasicFileInfoForm(&$aInfo, $sUrlPref='')
Definition: ChWsbFilesTemplate.php:61
ChSoundsTemplate\__construct
__construct(&$oConfig, &$oDb)
Definition: ChSoundsTemplate.php:12
$iFileId
$iFileId
Definition: embed.php:12
ChWsbTemplate\parseHtmlByName
parseHtmlByName($sName, $aVariables, $mixedKeyWrapperHtml=null, $sCheckIn=CH_WSB_TEMPLATE_CHECK_IN_BOTH)
Definition: ChWsbTemplate.php:660
ChTemplVotingView
Definition: ChTemplVotingView.php:14
clear_xss
clear_xss($val)
Definition: utils.inc.php:700
ChSoundsTemplate\getCompleteFileInfoForm
getCompleteFileInfoForm(&$aInfo, $sUrlPref='')
Definition: ChSoundsTemplate.php:68