8 ch_import(
'ChTemplSearchResultSharedMedia');
14 parent::__construct(
'ChSoundsModule');
15 $this->aConstants[
'linksTempl'] = array(
17 'file' =>
'view/{uri}',
18 'category' =>
'browse/category/{uri}',
19 'browseAll' =>
'browse/',
20 'browseUserAll' =>
'albums/browse/owner/{uri}',
21 'browseAllTop' =>
'browse/top',
22 'tag' =>
'browse/tag/{uri}',
23 'album' =>
'browse/album/{uri}',
24 'add' =>
'browse/my/add'
28 'name' =>
'ch_sounds',
29 'title' =>
'_ch_sounds',
30 'table' =>
'RayMp3Files'
33 $this->aCurrent = array_merge($aMain, $this->aCurrent);
34 $this->aCurrent[
'ownFields'][] =
'Listens';
35 $this->aCurrent[
'rss'][
'title'] =
_t(
'_ch_sounds');
37 $this->aAddPartsConfig[
'favorite'][
'table'] =
'ch_sounds_favorites';
39 $this->oTemplate = &$this->oModule->_oTemplate;
40 $this->aConstants[
'filesUrl'] = $this->oModule->_oConfig->getFilesUrl();
41 $this->aConstants[
'filesDir'] = $this->oModule->_oConfig->getFilesPath();
42 $this->aConstants[
'filesInAlbumCover'] = 12;
43 $this->aConstants[
'picPostfix'] = $this->oModule->_oConfig->aFilePostfix;
45 $this->aCurrent[
'restriction'][
'albumType'][
'value'] = $this->aCurrent[
'name'];
49 $this->aCurrent[
'restriction'][
'calendar-min'] = array(
'value' =>
"UNIX_TIMESTAMP('{$sParamValue}-{$sParamValue1}-{$sParamValue2} 00:00:00')",
'field' =>
'Date',
'operator' =>
'>=',
'no_quote_value' =>
true);
50 $this->aCurrent[
'restriction'][
'calendar-max'] = array(
'value' =>
"UNIX_TIMESTAMP('{$sParamValue}-{$sParamValue1}-{$sParamValue2} 23:59:59')",
'field' =>
'Date',
'operator' =>
'<=',
'no_quote_value' =>
true);
51 $this->aCurrent[
'title'] =
_t(
'_ch_sounds_caption_browse_by_day') . sprintf(
"%04u-%02u-%02u",
$sParamValue, $sParamValue1, $sParamValue2);
54 $this->aCurrent[
'sorting'] =
'top';
57 $this->aCurrent[
'sorting'] =
'popular';
60 $this->aCurrent[
'restriction'][
'featured'] = array(
61 'value'=>
'1',
'field'=>
'Featured',
'operator'=>
'=',
'paramName'=>
'ch_sounds_mode'
65 if (isset($this->aAddPartsConfig[
'favorite']) && !
empty($this->aAddPartsConfig[
'favorite']) &&
getLoggedId() != 0) {
66 $this->aCurrent[
'join'][
'favorite'] = $this->aAddPartsConfig[
'favorite'];
67 $this->aCurrent[
'restriction'][
'fav'] = array(
69 'field' => $this->aAddPartsConfig[
'favorite'][
'userField'],
71 'table' => $this->aAddPartsConfig[
'favorite'][
'table']
76 $this->aCurrent[
'sorting'] =
'album_order';
77 $this->aCurrent[
'restriction'][
'album'] = array(
78 'value'=>
'',
'field'=>
'Uri',
'operator'=>
'=',
'paramName'=>
'albumUri',
'table'=>
'sys_albums'
80 if ($sParamValue1 ==
'owner' && strlen($sParamValue2) > 0) {
81 $this->aCurrent[
'restriction'][
'owner'] = array(
82 'value'=>$sParamValue2,
'field'=>
'NickName',
'operator'=>
'=',
'paramName'=>
'ownerName',
'table' =>
'Profiles'
98 'ownerName' =>
'NickName',
100 'voteTime' =>
'gal_date'
106 $sImgUrl = parent::getImgUrl(
$iId, $sImgType);
108 $sImgUrl = $this->aConstants[
'filesUrl'] .
'default.png';
116 if (!isset($this->aConstants[
'picPostfix'][
$sType]))
119 $s = $this->aConstants[
'filesDir'] .
$iId . $this->aConstants[
'picPostfix'][
$sType];
120 if (!file_exists(
$s) && isset($this->oModule->_oConfig->aFilePostfix[
$sType][
'fallback']))
121 $s = $this->aConstants[
'filesDir'] . $this->oModule->_oConfig->aFilePostfix[
$sType][
'fallback'];
133 return $this->oTemplate->getFileConcept($aSound[
'ID'], $aSound);
141 a.`Title` as `title`,
142 a.`Description` as `description`,
144 a.`Owner` as `owner`,
147 a.`RateCount` AS `rate_count`,
148 a.`CommentsCount` AS `comments_count`,
149 a.`Listens` AS `views_count`,
150 a.`Status` AS `status`,
151 b.`id_album` as `album_id`
152 FROM `RayMp3Files` as a
153 LEFT JOIN `sys_albums_objects` as b ON b.`id_object` = a.`ID`
154 LEFT JOIN `sys_albums` as c ON c.`ID`=b.`id_album`
155 WHERE a.`ID`='$iId' AND c.`Type`='ch_sounds'";
156 $aImageInfo =
db_arr($sqlQuery);
157 if(
empty($aImageInfo) || !is_array($aImageInfo))
164 'id' => $aImageInfo[
'id'],
165 'file' => $sFileName,
166 'file_path' => $sFilePath,
167 'title' => $aImageInfo[
'title'],
168 'owner' => $aImageInfo[
'owner'],
169 'description' => $aImageInfo[
'description'],
170 'width' => (
int)$this->oModule->_oConfig->getGlParam(
$sType .
'_width') + 2 * 2,
171 'height' => (
int)$this->oModule->_oConfig->getGlParam(
$sType .
'_height') + 2 * 2,
173 'date' => $aImageInfo[
'date'],
174 'rate' => $aImageInfo[
'rate'],
175 'rate_count' => $aImageInfo[
'rate_count'],
176 'comments_count' => $aImageInfo[
'comments_count'],
177 'views_count' => $aImageInfo[
'views_count'],
178 'status' => $aImageInfo[
'status'],
179 'album_id' => $aImageInfo[
'album_id']
201 foreach ($aFiles
as $k => $aRow) {
202 $aFiles[$k][
'thumb'] = $this->
getImgUrl($aRow[
'id'],
'browse');
203 $aFiles[$k][
'file'] = $this->
getImgUrl($aRow[
'id'],
'file');
211 $iViewer = $this->oModule->_iProfileId;
212 if ($isCheckPrivacy && !$this->oModule->oAlbumPrivacy->check(
'album_view', (
int)$iAlbumId, $iViewer))
215 foreach ($aFiles
as $k => $aRow) {
216 $aFiles[$k][
'thumb'] = $this->
getImgUrl($aRow[
'id'],
'browse');
217 $aFiles[$k][
'file'] = $this->
getImgUrl($aRow[
'id'],
'file');
225 foreach ($aFiles
as $k => $aRow) {
226 $aFiles[$k][
'thumb'] = $this->
getImgUrl($aRow[
'id'],
'browse');
227 $aFiles[$k][
'file'] = $this->
getImgUrl($aRow[
'id'],
'file');
237 return $this->oModule->getWallPost($aEvent,
'music');
245 return $this->oModule->getWallPostOutline($aEvent,
'music');
254 'prefix' =>
'id' .
time() .
'_' . rand(1, 999999),
255 'default_height' => 350,
256 'ch_repeat:sounds' => array (),
257 'ch_repeat:icons' => array (),
261 foreach($aFiles
as $aFile) {
262 $aVars[
'ch_repeat:sounds'][] = array (
263 'style' =>
false ===
$aVars[
'title'] ?
'' :
'display:none;',
264 'id' => $aFile[
'id'],
265 'sound' => $this->oTemplate->getFileConcept($aFile[
'id']),
267 $aVars[
'ch_repeat:icons'][] = array (
268 'id' => $aFile[
'id'],
269 'icon_url' => $aFile[
'file'],
270 'title' => $aFile[
'title'],
272 if (
false ===
$aVars[
'title'])
273 $aVars[
'title'] = $aFile[
'title'];
276 if (!
$aVars[
'ch_repeat:icons'])
279 $this->oTemplate->addCss(
'entry_view.css');
280 return $this->oTemplate->parseHtmlByName(
'entry_view_block_sounds.html',
$aVars);
286 switch ($this->aCurrent[
'sorting']) {
288 $aSql[
'order'] =
" ORDER BY `Listens` DESC";
292 $aSql[
'order'] =
" ORDER BY `obj_order` ASC, `id_object` DESC";
296 $aSql = parent::getAlterOrder();