Exemple #1
0
 function BxPhotosSearch($sParamName = '', $sParamValue = '', $sParamValue1 = '', $sParamValue2 = '')
 {
     parent::BxTemplSearchResultSharedMedia('BxPhotosModule');
     $this->aConstants['linksTempl'] = array('home' => 'home', 'file' => 'view/{uri}', 'category' => 'browse/category/{uri}', 'browseAll' => 'browse/', 'browseUserAll' => 'albums/browse/owner/{uri}', 'browseAllTop' => 'browse/top', 'tag' => 'browse/tag/{uri}', 'album' => 'browse/album/{uri}', 'add' => 'browse/my/add');
     $aMain = array('name' => 'bx_photos', 'title' => '_bx_photos', 'table' => 'bx_photos_main');
     $this->aCurrent = array_merge($aMain, $this->aCurrent);
     $this->aCurrent['ownFields'] = array('ID', 'Title', 'Uri', 'Date', 'Size', 'Views', 'Rate', 'RateCount', 'Hash');
     $this->aCurrent['searchFields'] = array('Title', 'Tags', 'Desc', 'Categories');
     $this->aCurrent['rss']['title'] = _t('_bx_photos');
     // redeclaration some unique fav fields
     $this->aAddPartsConfig['favorite']['table'] = 'bx_photos_favorites';
     $this->aAddPartsConfig['favorite']['mainField'] = 'ID';
     $this->oTemplate =& $this->oModule->_oTemplate;
     $this->aConstants['filesUrl'] = $this->oModule->_oConfig->getFilesUrl();
     $this->aConstants['filesDir'] = $this->oModule->_oConfig->getFilesPath();
     $this->aConstants['filesInAlbumCover'] = 17;
     $this->aConstants['picPostfix'] = $this->oModule->_oConfig->aFilePostfix;
     $this->aCurrent['restriction']['albumType']['value'] = $this->aCurrent['name'];
     switch ($sParamName) {
         case 'calendar':
             $this->aCurrent['restriction']['calendar-min'] = array('value' => "UNIX_TIMESTAMP('{$sParamValue}-{$sParamValue1}-{$sParamValue2} 00:00:00')", 'field' => 'Date', 'operator' => '>=', 'no_quote_value' => true);
             $this->aCurrent['restriction']['calendar-max'] = array('value' => "UNIX_TIMESTAMP('{$sParamValue}-{$sParamValue1}-{$sParamValue2} 23:59:59')", 'field' => 'Date', 'operator' => '<=', 'no_quote_value' => true);
             $this->aCurrent['title'] = _t('_bx_photos_caption_browse_by_day') . sprintf("%04u-%02u-%02u", $sParamValue, $sParamValue1, $sParamValue2);
             break;
         case 'top':
             $this->aCurrent['sorting'] = 'top';
             break;
         case 'popular':
             $this->aCurrent['sorting'] = 'popular';
             break;
         case 'featured':
             $this->aCurrent['restriction']['featured'] = array('value' => '1', 'field' => 'Featured', 'operator' => '=', 'paramName' => 'bx_photos_mode');
             break;
         case 'favorited':
             if (isset($this->aAddPartsConfig['favorite']) && !empty($this->aAddPartsConfig['favorite']) && getLoggedId() != 0) {
                 $this->aCurrent['join']['favorite'] = $this->aAddPartsConfig['favorite'];
                 $this->aCurrent['restriction']['fav'] = array('value' => getLoggedId(), 'field' => $this->aAddPartsConfig['favorite']['userField'], 'operator' => '=', 'table' => $this->aAddPartsConfig['favorite']['table']);
             }
             break;
         case 'album':
             $this->aCurrent['sorting'] = 'album_order';
             $this->aCurrent['restriction']['album'] = array('value' => '', 'field' => 'Uri', 'operator' => '=', 'paramName' => 'albumUri', 'table' => 'sys_albums');
             $this->aCurrent['restriction']['albumType'] = array('value' => $this->aCurrent['name'], 'field' => 'Type', 'operator' => '=', 'paramName' => 'albumType', 'table' => 'sys_albums');
             if ($sParamValue1 == 'owner' && strlen($sParamValue2) > 0) {
                 $this->aCurrent['restriction']['owner'] = array('value' => $sParamValue2, 'field' => 'NickName', 'operator' => '=', 'paramName' => 'ownerName', 'table' => 'Profiles');
             }
             break;
     }
 }
 function BxVideosSearch($sParamName = '', $sParamValue = '', $sParamValue1 = '', $sParamValue2 = '')
 {
     parent::BxTemplSearchResultSharedMedia('BxVideosModule');
     $this->aConstants['linksTempl'] = array('home' => 'home', 'file' => 'view/{uri}', 'category' => 'browse/category/{uri}', 'browseAll' => 'browse/', 'browseUserAll' => 'albums/browse/owner/{uri}', 'browseAllTop' => 'browse/top', 'tag' => 'browse/tag/{uri}', 'album' => 'browse/album/{uri}', 'add' => 'browse/my/add');
     // main part of aCurrent settings, usual most unique part of every module
     $aMain = array('name' => 'bx_videos', 'title' => '_bx_videos', 'table' => 'RayVideoFiles');
     $this->aCurrent = array_merge($aMain, $this->aCurrent);
     $this->aCurrent['ownFields'] = array_merge($this->aCurrent['ownFields'], array('Views', 'Source', 'Video'));
     $this->aCurrent['rss']['title'] = _t('_bx_videos');
     $this->aAddPartsConfig['favorite']['table'] = 'bx_videos_favorites';
     $this->oModule = BxDolModule::getInstance('BxVideosModule');
     $this->oTemplate =& $this->oModule->_oTemplate;
     $this->aConstants['filesUrl'] = $this->oModule->_oConfig->getFilesUrl();
     $this->aConstants['filesDir'] = $this->oModule->_oConfig->getFilesPath();
     $this->aConstants['picPostfix'] = array('browse' => '_small.jpg', 'file' => '.mp4', 'main' => '.flv');
     $this->aCurrent['restriction']['albumType']['value'] = $this->aCurrent['name'];
     switch ($sParamName) {
         case 'calendar':
             $this->aCurrent['restriction']['calendar-min'] = array('value' => "UNIX_TIMESTAMP('{$sParamValue}-{$sParamValue1}-{$sParamValue2} 00:00:00')", 'field' => 'Date', 'operator' => '>=', 'no_quote_value' => true);
             $this->aCurrent['restriction']['calendar-max'] = array('value' => "UNIX_TIMESTAMP('{$sParamValue}-{$sParamValue1}-{$sParamValue2} 23:59:59')", 'field' => 'Date', 'operator' => '<=', 'no_quote_value' => true);
             $this->aCurrent['title'] = _t('_bx_videos_caption_browse_by_day') . sprintf("%04u-%02u-%02u", $sParamValue, $sParamValue1, $sParamValue2);
             break;
         case 'top':
             $this->aCurrent['sorting'] = 'top';
             break;
         case 'popular':
             $this->aCurrent['sorting'] = 'popular';
             break;
         case 'featured':
             $this->aCurrent['restriction']['featured'] = array('value' => '1', 'field' => 'Featured', 'operator' => '=', 'paramName' => 'bx_videos_mode');
             break;
         case 'favorited':
             if (isset($this->aAddPartsConfig['favorite']) && !empty($this->aAddPartsConfig['favorite']) && getLoggedId() != 0) {
                 $this->aCurrent['join']['favorite'] = $this->aAddPartsConfig['favorite'];
                 $this->aCurrent['restriction']['fav'] = array('value' => getLoggedId(), 'field' => $this->aAddPartsConfig['favorite']['userField'], 'operator' => '=', 'table' => $this->aAddPartsConfig['favorite']['table']);
             }
             break;
         case 'album':
             $this->aCurrent['sorting'] = 'album_order';
             $this->aCurrent['restriction']['album'] = array('value' => '', 'field' => 'Uri', 'operator' => '=', 'paramName' => 'albumUri', 'table' => 'sys_albums');
             if ($sParamValue1 == 'owner' && strlen($sParamValue2) > 0) {
                 $this->aCurrent['restriction']['owner'] = array('value' => $sParamValue2, 'field' => 'NickName', 'operator' => '=', 'paramName' => 'ownerName', 'table' => 'Profiles');
             }
             break;
     }
 }
 function _getAlbumUnitItem($iIndex, $aPicture, $aParams = array())
 {
     $aResult = parent::_getAlbumUnitItem($iIndex, $aPicture, $aParams);
     $aResult['bx_if:exist']['content']['url'] = '';
     $sClass = '';
     if (empty($aPicture)) {
         if ($iIndex == 0) {
             $aResult['bx_if:not-exist']['condition'] = true;
             $aResult['bx_if:not-exist']['content']['class'] = ' sys-ai-empty';
         } else {
             $aResult['bx_if:not-exist']['condition'] = false;
         }
     } else {
         switch ($iIndex) {
             case 0:
                 $sClass = 'sys-ai-front';
                 break;
             case 1:
                 $sClass = 'sys-ai-middle';
                 break;
             case 2:
                 $sClass = 'sys-ai-back';
                 break;
             default:
                 $sClass = 'sys-ai-out';
         }
         $aResult['bx_if:exist']['content']['class'] = ' ' . $sClass;
         if (!empty($aPicture['Uri'])) {
             $aResult['bx_if:exist']['content']['url'] = $this->getCurrentUrl('file', $aPicture['id_object'], $aPicture['Uri']);
         }
         if (empty($aResult['bx_if:exist']['content']['url']) && !empty($aParams['album_url'])) {
             $aResult['bx_if:exist']['content']['url'] = $aParams['album_url'];
         }
     }
     return $aResult;
 }
Exemple #4
0
 function getSearchUnit($aData)
 {
     $sContent = parent::getSearchUnit($aData);
     return $this->oTemplate->parseHtmlByContent($sContent, array('size' => _format_time($aData['size'] / 1000)));
 }
 function _getAlbumUnitItem($iIndex, $aPicture)
 {
     $aResult = parent::_getAlbumUnitItem($iIndex, $aPicture);
     $sClass = '';
     if (empty($aPicture)) {
         if ($iIndex == 0) {
             $aResult['bx_if:not-exist']['condition'] = true;
             $aResult['bx_if:not-exist']['content']['class'] = ' sys-ai-empty';
         } else {
             $aResult['bx_if:not-exist']['condition'] = false;
         }
     } else {
         switch ($iIndex) {
             case 0:
                 $sClass = 'sys-ai-front';
                 break;
             case 1:
                 $sClass = 'sys-ai-middle';
                 break;
             case 2:
                 $sClass = 'sys-ai-back';
                 break;
             default:
                 $sClass = 'sys-ai-out';
         }
         $aResult['bx_if:exist']['content']['class'] = ' ' . $sClass;
     }
     return $aResult;
 }
 function getAlterOrder()
 {
     $aSql = array();
     switch ($this->aCurrent['sorting']) {
         case 'popular':
             $aSql['order'] = " ORDER BY `Listens` DESC";
             break;
         case 'album_order':
             $aSql['order'] = " ORDER BY `obj_order` ASC, `id_object` DESC";
             break;
         default:
             $aSql = parent::getAlterOrder();
     }
     return $aSql;
 }