Procházet zdrojové kódy

#26 - "popular" tab instead of "featured"

Alex Trofimov před 12 roky
rodič
revize
a7c29cca65

+ 2 - 2
modules/base/text/classes/BxBaseModTextModule.php

@@ -49,9 +49,9 @@ class BxBaseModTextModule extends BxBaseModGeneralModule
      * Display featured entries
      * @return HTML string
      */
-    public function serviceBrowseFeatured ()
+    public function serviceBrowsePopular ()
     {
-        return $this->_serviceBrowse ('public', false, BX_DB_PADDING_DEF, true);
+        return $this->_serviceBrowse ('popular', false, BX_DB_PADDING_DEF, true);
     }
 
     /**

+ 1 - 0
modules/boonex/posts/classes/BxPostsConfig.php

@@ -43,6 +43,7 @@ class BxPostsConfig extends BxBaseModTextConfig
         	'URI_EDIT_ENTRY' => 'edit-post',
 
             'URL_HOME' => 'page.php?i=posts-home',
+            'URL_POPULAR' => 'page.php?i=posts-popular',
 
             // some params
             'PARAM_CHARS_SUMMARY' => 'bx_posts_summary_chars',

+ 17 - 5
modules/boonex/posts/classes/BxPostsSearchResult.php

@@ -77,6 +77,14 @@ class BxPostsSearchResult extends BxBaseModTextSearchResult
                 $this->aCurrent['rss']['link'] = 'modules/?r=posts/rss/' . $sMode;
                 break;
 
+            case 'popular':
+                bx_import('BxDolPermalinks');
+                $this->sBrowseUrl = BxDolPermalinks::getInstance()->permalink($CNF['URL_POPULAR']);
+                $this->aCurrent['title'] = _t('_bx_posts_page_title_browse_popular');
+                $this->aCurrent['rss']['link'] = 'modules/?r=posts/rss/' . $sMode;
+                $this->aCurrent['sorting'] = 'popular';
+                break;
+
             case '': // search results
                 $this->sBrowseUrl = BX_DOL_SEARCH_KEYWORD_PAGE;
                 $this->aCurrent['title'] = _t('_bx_posts');
@@ -120,12 +128,16 @@ class BxPostsSearchResult extends BxBaseModTextSearchResult
 
     function getAlterOrder()
     {
-        if ($this->aCurrent['sorting'] == 'last') {
-            $aSql = array();
-            $aSql['order'] = " ORDER BY `bx_posts_posts`.`added` DESC";
-            return $aSql;
+        $aSql = array();
+        switch ($this->aCurrent['sorting']) {
+            case 'last':
+                $aSql['order'] = ' ORDER BY `bx_posts_posts`.`added` DESC';
+                break;
+            case 'popular':
+                $aSql['order'] = ' ORDER BY `bx_posts_posts`.`views` DESC';
+                break;
         }
-        return array();
+        return $aSql;
     }
 }
 

+ 6 - 5
modules/boonex/posts/install/langs/en.xml

@@ -53,6 +53,7 @@
 	<string name="_bx_posts_page_title_search_results"><![CDATA[Posts matching "{0}"]]></string>
 	<string name="_bx_posts_page_title_browse_by_author"><![CDATA[Posts of {display_name}]]></string>
     <string name="_bx_posts_page_title_browse_recent"><![CDATA[Recent Posts]]></string>
+    <string name="_bx_posts_page_title_browse_popular"><![CDATA[Popular Posts]]></string>
     <string name="_bx_posts_page_title_sys_home"><![CDATA[Posts Home]]></string>
     <string name="_bx_posts_page_title_home"><![CDATA[Posts]]></string>
     <string name="_bx_posts_page_block_title_recent_entries"><![CDATA[Recent Posts]]></string>
@@ -60,9 +61,9 @@
     <string name="_bx_posts_page_block_title_entry_author"><![CDATA[Author]]></string>
     <string name="_bx_posts_page_block_title_entry_actions"><![CDATA[Actions]]></string>
     <string name="_bx_posts_page_block_title_entry_comments"><![CDATA[Comments]]></string>
-    <string name="_bx_posts_page_title_sys_entries_featured"><![CDATA[Featured Posts]]></string>
-    <string name="_bx_posts_page_title_entries_featured"><![CDATA[Featured Posts]]></string>
-    <string name="_bx_posts_page_block_title_featured_entries"><![CDATA[Featured Posts]]></string>
+    <string name="_bx_posts_page_title_sys_entries_popular"><![CDATA[Popular Posts]]></string>
+    <string name="_bx_posts_page_title_entries_popular"><![CDATA[Popular Posts]]></string>
+    <string name="_bx_posts_page_block_title_popular_entries"><![CDATA[Popular Posts]]></string>
     <string name="_bx_posts_page_title_sys_view_entry_comments"><![CDATA[Post Comments]]></string>
     <string name="_bx_posts_page_title_view_entry_comments"><![CDATA[Post Comments]]></string>
     <string name="_bx_posts_page_title_sys_entries_of_author"><![CDATA[Posts of author]]></string>
@@ -96,8 +97,8 @@
     <string name="_bx_posts_menu_item_title_entries_moderation"><![CDATA[Moderation]]></string>
     <string name="_bx_posts_menu_item_title_system_entries_administration"><![CDATA[Administration]]></string>
     <string name="_bx_posts_menu_item_title_entries_administration"><![CDATA[Administration]]></string>
-    <string name="_bx_posts_menu_item_title_system_entries_featured"><![CDATA[Featured]]></string>
-    <string name="_bx_posts_menu_item_title_entries_featured"><![CDATA[Featured]]></string>
+    <string name="_bx_posts_menu_item_title_system_entries_popular"><![CDATA[Popular]]></string>
+    <string name="_bx_posts_menu_item_title_entries_popular"><![CDATA[Popular]]></string>
     <string name="_bx_posts_menu_title_view_entry_submenu"><![CDATA[View Post Submenu]]></string>
     <string name="_bx_posts_menu_set_title_view_entry_submenu"><![CDATA[View Post Submenu]]></string>
     <string name="_bx_posts_menu_item_title_view_entry_submenu_entry"><![CDATA[Post]]></string>

+ 2 - 2
modules/boonex/posts/install/sql/disable.sql

@@ -8,7 +8,7 @@ DELETE FROM `sys_options_types` WHERE `id` = @iTypeId;
 
 -- PAGES
 DELETE FROM `sys_objects_page` WHERE `module` = 'bx_posts';
-DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_posts' OR `object` IN('bx_posts_create_entry', 'bx_posts_edit_entry', 'bx_posts_delete_entry', 'bx_posts_view_entry', 'bx_posts_view_entry_comments', 'bx_posts_home', 'bx_posts_featured', 'bx_posts_author');
+DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_posts' OR `object` IN('bx_posts_create_entry', 'bx_posts_edit_entry', 'bx_posts_delete_entry', 'bx_posts_view_entry', 'bx_posts_view_entry_comments', 'bx_posts_home', 'bx_posts_popular', 'bx_posts_author');
 
 -- MENU
 DELETE FROM `sys_objects_menu` WHERE `module` = 'bx_posts';
@@ -31,4 +31,4 @@ DELETE FROM `sys_objects_metatags` WHERE `object` = 'bx_posts';
 -- GRIDS
 DELETE FROM `sys_objects_grid` WHERE `object` IN ('bx_posts_administration', 'bx_posts_moderation');
 DELETE FROM `sys_grid_fields` WHERE `object` IN ('bx_posts_administration', 'bx_posts_moderation');
-DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_posts_administration', 'bx_posts_moderation');
+DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_posts_administration', 'bx_posts_moderation');

+ 5 - 5
modules/boonex/posts/install/sql/enable.sql

@@ -65,13 +65,13 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbo
 ('bx_posts_view_entry_comments', 1, 'bx_posts', '_bx_posts_page_block_title_entry_comments', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:15:\"entity_comments\";}', 0, 0, 1);
 
 
--- PAGE: featured entries
+-- PAGE: popular entries
 
 INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
-('bx_posts_featured', '_bx_posts_page_title_sys_entries_featured', '_bx_posts_page_title_entries_featured', 'bx_posts', 5, 2147483647, 1, 'posts-featured', 'page.php?i=posts-featured', '', '', '', 0, 1, 0, 'BxPostsPageBrowse', 'modules/boonex/posts/classes/BxPostsPageBrowse.php');
+('bx_posts_popular', '_bx_posts_page_title_sys_entries_popular', '_bx_posts_page_title_entries_popular', 'bx_posts', 5, 2147483647, 1, 'posts-popular', 'page.php?i=posts-popular', '', '', '', 0, 1, 0, 'BxPostsPageBrowse', 'modules/boonex/posts/classes/BxPostsPageBrowse.php');
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
-('bx_posts_featured', 1, 'bx_posts', '_bx_posts_page_block_title_featured_entries', 0, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:15:\"browse_featured\";}', 0, 1, 1);
+('bx_posts_popular', 1, 'bx_posts', '_bx_posts_page_block_title_popular_entries', 0, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:14:\"browse_popular\";}', 0, 1, 1);
 
 
 -- PAGE: entries of author
@@ -162,7 +162,7 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 
 INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
 ('bx_posts_submenu', 'bx_posts', 'posts-home', '_bx_posts_menu_item_title_system_entries_public', '_bx_posts_menu_item_title_entries_public', 'page.php?i=posts-home', '', '', '', '', 2147483647, 1, 1, 1),
-('bx_posts_submenu', 'bx_posts', 'posts-featured', '_bx_posts_menu_item_title_system_entries_featured', '_bx_posts_menu_item_title_entries_featured', 'page.php?i=posts-featured', '', '', '', '', 2147483647, 1, 1, 2),
+('bx_posts_submenu', 'bx_posts', 'posts-popular', '_bx_posts_menu_item_title_system_entries_popular', '_bx_posts_menu_item_title_entries_popular', 'page.php?i=posts-popular', '', '', '', '', 2147483647, 1, 1, 2),
 ('bx_posts_submenu', 'bx_posts', 'posts-moderation', '_bx_posts_menu_item_title_system_entries_moderation', '_bx_posts_menu_item_title_entries_moderation', 'page.php?i=posts-moderation', '', '', '', '', 64, 1, 1, 3),
 ('bx_posts_submenu', 'bx_posts', 'posts-administration', '_bx_posts_menu_item_title_system_entries_administration', '_bx_posts_menu_item_title_entries_administration', 'page.php?i=posts-administration', '', '', '', '', 128, 1, 1, 4);
 
@@ -307,4 +307,4 @@ INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `conf
 ('bx_posts_administration', 'single', 'delete', '', 'remove', 1, 2),
 ('bx_posts_administration', 'single', 'settings', '', 'cog', 0, 3),
 ('bx_posts_moderation', 'single', 'edit', '', 'pencil', 0, 1),
-('bx_posts_moderation', 'single', 'settings', '', 'cog', 0, 2);
+('bx_posts_moderation', 'single', 'settings', '', 'cog', 0, 2);