From d68b6fb8c56e3322b27884ec62f01583e73b0ac8 Mon Sep 17 00:00:00 2001 From: Kimura Youichi Date: Tue, 3 Jun 2014 01:47:34 +0900 Subject: [PATCH] add the topicCommentSnsListBox gadget to display all topics in the SNS. (fixes #3610) --- .../actions/components.class.php | 5 +++++ .../templates/_topicCommentSnsListBox.php | 21 +++++++++++++++++++ .../templates/_partsTopicRecentList.php | 6 ++++++ config/gadget.yml | 16 ++++++++++++++ .../PluginCommunityTopicTable.class.php | 9 ++++++++ 5 files changed, 57 insertions(+) create mode 100644 apps/pc_frontend/modules/communityTopic/templates/_topicCommentSnsListBox.php create mode 100644 apps/pc_frontend/templates/_partsTopicRecentList.php diff --git a/apps/pc_frontend/modules/communityTopic/actions/components.class.php b/apps/pc_frontend/modules/communityTopic/actions/components.class.php index c9642c7..9c9737a 100644 --- a/apps/pc_frontend/modules/communityTopic/actions/components.class.php +++ b/apps/pc_frontend/modules/communityTopic/actions/components.class.php @@ -10,4 +10,9 @@ class communityTopicComponents extends opCommunityTopicPluginTopicComponents { + public function executeTopicCommentSnsListBox() + { + $this->communityTopic = Doctrine_Core::getTable('CommunityTopic') + ->getRecentlyUpdatedTopicsSns($this->gadget->getConfig('col')); + } } diff --git a/apps/pc_frontend/modules/communityTopic/templates/_topicCommentSnsListBox.php b/apps/pc_frontend/modules/communityTopic/templates/_topicCommentSnsListBox.php new file mode 100644 index 0000000..bcda7c0 --- /dev/null +++ b/apps/pc_frontend/modules/communityTopic/templates/_topicCommentSnsListBox.php @@ -0,0 +1,21 @@ + + + +
  • getUpdatedAt(), 'XShortDateJa') ?> +getName(), 36), + $topic->getCommunityTopicComment()->count() + ), '@communityTopic_show?id='.$topic->getId()), + $topic->getCommunity()->getName() +) ?>
  • + + +id, array( + 'title' => 'SNS全体のコミュニティ最新書き込み', + 'listBody' => get_slot('body'), + 'moreInfo' => array( + link_to(__('More'), array('sf_route' => 'communityTopic_search_all')), + ), +)) ?> + diff --git a/apps/pc_frontend/templates/_partsTopicRecentList.php b/apps/pc_frontend/templates/_partsTopicRecentList.php new file mode 100644 index 0000000..57a7acb --- /dev/null +++ b/apps/pc_frontend/templates/_partsTopicRecentList.php @@ -0,0 +1,6 @@ +setDefault('class', 'homeRecentList') ?> +
    + +
    diff --git a/config/gadget.yml b/config/gadget.yml index 6c0b195..3bcc42d 100644 --- a/config/gadget.yml +++ b/config/gadget.yml @@ -29,3 +29,19 @@ recentCommunityEventComment: IsRequired: true Default: 5 Choices: {1: 1, 3: 3, 5: 5, 7: 7, 10: 10} + +recentCommunityTopicCommentSns: + caption: + ja_JP: "SNS全体のコミュニティ最新トピックリスト" + description: + ja_JP: "SNS全体のコミュニティトピックの最新書き込みリストを表示します" + component: [communityTopic, topicCommentSnsListBox] + config: + col: + Name: "col" + Caption: "表示するトピック数" + FormType: "select" + ValueType: "integer" + IsRequired: true + Default: 5 + Choices: {1: 1, 3: 3, 5: 5, 7: 7, 10: 10} diff --git a/lib/model/doctrine/PluginCommunityTopicTable.class.php b/lib/model/doctrine/PluginCommunityTopicTable.class.php index f6944ea..0623c6c 100644 --- a/lib/model/doctrine/PluginCommunityTopicTable.class.php +++ b/lib/model/doctrine/PluginCommunityTopicTable.class.php @@ -82,6 +82,15 @@ public function getRecentlyTopicListPager($memberId, $page = 1, $size = 50) return $pager; } + public function getRecentlyUpdatedTopicsSns($limit = 5) + { + return $this->createQuery() + ->whereIn('community_id', opCommunityTopicToolkit::getPublicCommunityIdList()) + ->orderBy('updated_at DESC') + ->limit($limit) + ->execute(); + } + public function getSearchQuery($communityId = null, $target = null, $keyword = null) { $q = $this->createQuery();