Przeglądaj źródła

#115 - hashtags clouds for albums, images and cameras

Alex Trofimov 11 lat temu
rodzic
commit
36b40d3482

+ 1 - 1
modules/boonex/albums/classes/BxAlbumsSearchResultMediaCamera.php

@@ -9,7 +9,7 @@
  * @{
  */
 
-bx_import('BxAlbumsSearchResultMedia', 'bx_albums');
+bx_import('SearchResultMedia', 'bx_albums');
 
 class BxAlbumsSearchResultMediaCamera extends BxAlbumsSearchResultMedia
 {

+ 3 - 0
modules/boonex/albums/install/langs/en.xml

@@ -93,6 +93,9 @@
 	<string name="_bx_albums_page_block_title_system_manage"><![CDATA[Manage Own Albums]]></string>
 	<string name="_bx_albums_page_block_title_system_manage_administration"><![CDATA[Manage All Albums]]></string>
 	<string name="_bx_albums_page_block_title_manage"><![CDATA[Manage Albums]]></string>
+	<string name="_bx_albums_page_block_title_popular_keywords_albums"><![CDATA[Popular Albums Hashtags]]></string>
+	<string name="_bx_albums_page_block_title_popular_keywords_media"><![CDATA[Popular Media Hashtags]]></string>
+	<string name="_bx_albums_page_block_title_popular_keywords_media_camera"><![CDATA[Popular Cameras]]></string>
 
     <string name="_bx_albums_menu_set_title_view_entry"><![CDATA[View Album]]></string>
     <string name="_bx_albums_menu_title_view_entry"><![CDATA[View Album]]></string>

+ 5 - 1
modules/boonex/albums/install/sql/enable.sql

@@ -133,7 +133,11 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbo
 
 SET @iBlockOrder = (SELECT `order` FROM `sys_pages_blocks` WHERE `object` = '' AND `cell_id` = 0 ORDER BY `order` DESC LIMIT 1);
 INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES
-('', 0, 'bx_albums', '', '_bx_albums_page_block_title_recent_media', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_albums";s:6:"method";s:20:"browse_popular_media";s:6:"params";a:3:{s:9:"unit_view";s:7:"gallery";s:13:"empty_message";b:1;s:13:"ajax_paginate";b:1;}}', 0, 1, 1, @iBlockOrder + 1);
+('', 0, 'bx_albums', '', '_bx_albums_page_block_title_recent_media', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_albums";s:6:"method";s:20:"browse_popular_media";s:6:"params";a:3:{s:9:"unit_view";s:7:"gallery";s:13:"empty_message";b:1;s:13:"ajax_paginate";b:1;}}', 0, 1, 1, @iBlockOrder + 1),
+('', 0, 'bx_albums', '', '_bx_albums_page_block_title_popular_keywords_albums', 11, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:14:"keywords_cloud";s:6:"params";a:2:{i:0;s:9:"bx_albums";i:1;s:9:"bx_albums";}s:5:"class";s:20:"TemplServiceMetatags";}', 0, 1, 1, @iBlockOrder + 2),
+('', 0, 'bx_albums', '', '_bx_albums_page_block_title_popular_keywords_media', 11, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:14:"keywords_cloud";s:6:"params";a:2:{i:0;s:15:"bx_albums_media";i:1;s:15:"bx_albums_media";}s:5:"class";s:20:"TemplServiceMetatags";}', 0, 1, 1, @iBlockOrder + 3),
+('', 0, 'bx_albums', '', '_bx_albums_page_block_title_popular_keywords_media_camera', 11, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:14:"keywords_cloud";s:6:"params";a:2:{i:0;s:22:"bx_albums_media_camera";i:1;s:22:"bx_albums_media_camera";}s:5:"class";s:20:"TemplServiceMetatags";}', 0, 1, 1, @iBlockOrder + 4);
+
 
 -- MENU: add to site menu
 

+ 3 - 0
modules/boonex/russian/data/langs/albums.xml

@@ -93,6 +93,9 @@
 	<string name="_bx_albums_page_block_title_system_manage"><![CDATA[Управление своими альбомами]]></string>
 	<string name="_bx_albums_page_block_title_system_manage_administration"><![CDATA[Управление всеми альбомами]]></string>
 	<string name="_bx_albums_page_block_title_manage"><![CDATA[Управление альбомами]]></string>
+	<string name="_bx_albums_page_block_title_popular_keywords_albums"><![CDATA[Популярные Хэштеги Альбомов]]></string>
+	<string name="_bx_albums_page_block_title_popular_keywords_media"><![CDATA[Популярные Хэштеги Изображений]]></string>
+	<string name="_bx_albums_page_block_title_popular_keywords_media_camera"><![CDATA[Популярные Фотокамеры]]></string>
 
     <string name="_bx_albums_menu_set_title_view_entry"><![CDATA[Просмотреть альбом]]></string>
     <string name="_bx_albums_menu_title_view_entry"><![CDATA[Просмотреть альбом]]></string>

+ 9 - 2
template/scripts/BxBaseServiceMetatags.php

@@ -25,10 +25,11 @@ class BxBaseServiceMetatags extends BxDol
     /**
      * Get keywords cloud.
      * @param $sObject metatgs object to get keywords cloud for
+     * @param $mixedSection search section to refer when keyword is clicked, set the same as $sObject to show content withing the module only, it can be one value or array of values, leave empty to show all possible content upon keyword click
      * @param $iMaxCount number of tags in keywords cloud, by default @see BX_METATAGS_KEYWORDS_IN_CLOUD
      * @return tags cloud HTML string
      */
-    public function serviceKeywordsCloud ($sObject, $sSection, $iMaxCount = BX_METATAGS_KEYWORDS_IN_CLOUD)
+    public function serviceKeywordsCloud ($sObject, $mixedSection, $iMaxCount = BX_METATAGS_KEYWORDS_IN_CLOUD)
     {
         $o = BxDolMetatags::getObjectInstance($sObject);
         $aKeywords = $o->keywordsPopularList($iMaxCount);
@@ -44,11 +45,17 @@ class BxBaseServiceMetatags extends BxDol
         $iRatingDiff = $iMaxRating - $iMinRating;
         $iRatingDiff = $iRatingDiff == 0 ? 1 : $iRatingDiff;
 
+        $sSectionPart = '';
+        if (is_array($mixedSection))
+            $sSectionPart = '&section[]=' . implode('&section[]=', $mixedSection);
+        elseif (is_string($mixedSection))
+            $sSectionPart = '&section[]=' . $mixedSection;
+
         $aUnits = array();
         foreach($aKeywords as $sKeyword => $iCount) {
             $aUnits[] = array(
                 'size' => $this->_iKeywordsCloudFontSizeMin + floor($iFontDiff * (($iCount - $iMinRating) / $iRatingDiff)),
-                'href' => BX_DOL_URL_ROOT . 'searchKeyword.php?type=keyword&keyword=' . rawurlencode($sKeyword) . '&section[]=' . $sSection,
+                'href' => BX_DOL_URL_ROOT . 'searchKeyword.php?type=keyword&keyword=' . rawurlencode($sKeyword) . $sSectionPart,
                 'count' => $iCount,
                 'keyword' => htmlspecialchars_adv($sKeyword),
             );