From 7236f1cdbe51728f37b21c80e8b27d7599e6653b Mon Sep 17 00:00:00 2001 From: kaoru nishizoe Date: Tue, 15 Apr 2014 18:02:58 +0900 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E4=B8=AD=E3=81=AE=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=90=E3=83=BC=E3=81=8C=E6=9B=B8=E3=81=8D=E8=BE=BC?= =?UTF-8?q?=E3=82=93=E3=81=A0=E3=82=B3=E3=83=9F=E3=83=A5=E3=83=8B=E3=83=86?= =?UTF-8?q?=E3=82=A3=E3=83=88=E3=83=94=E3=83=83=E3=82=AF=E3=81=AE=E4=B8=80?= =?UTF-8?q?=E8=A6=A7=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=83=97?= =?UTF-8?q?=E3=83=AD=E3=83=95=E3=82=A3=E3=83=BC=E3=83=AB=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E7=94=A8=E3=81=AE=E3=82=AC=E3=82=B8=E3=82=A7=E3=83=83=E3=83=88?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/pc_frontend/i18n/messages.ja.xml | 4 +++ .../_topicCommentByMemberListBox.php | 17 +++++++++++ config/profile_gadget.yml | 15 ++++++++++ ...munityTopicPluginTopicComponents.class.php | 13 ++++++++ ...PluginCommunityTopicCommentTable.class.php | 17 +++++++++++ .../PluginCommunityTopicTable.class.php | 30 +++++++++++++++++++ 6 files changed, 96 insertions(+) create mode 100644 apps/pc_frontend/modules/communityTopic/templates/_topicCommentByMemberListBox.php create mode 100644 config/profile_gadget.yml diff --git a/apps/pc_frontend/i18n/messages.ja.xml b/apps/pc_frontend/i18n/messages.ja.xml index 44edd15..1bc3ddf 100644 --- a/apps/pc_frontend/i18n/messages.ja.xml +++ b/apps/pc_frontend/i18n/messages.ja.xml @@ -218,6 +218,10 @@ [1]1 topic has new comments|(1,Inf]%1% topics have new comments [1,Inf]%1% 件のトピックに新着コメントがあります + + Recently Posted %Community% Topics By This Member + 書き込み一覧 + diff --git a/apps/pc_frontend/modules/communityTopic/templates/_topicCommentByMemberListBox.php b/apps/pc_frontend/modules/communityTopic/templates/_topicCommentByMemberListBox.php new file mode 100644 index 0000000..cf449ed --- /dev/null +++ b/apps/pc_frontend/modules/communityTopic/templates/_topicCommentByMemberListBox.php @@ -0,0 +1,17 @@ + +
+

+
+
    + +
  • getUpdatedAt(), 'XShortDateJa') ?> +getName(), 36), + $topic->getCommunityTopicComment()->count() + ), '@communityTopic_show?id='.$topic->getId()) + ?>
  • + +
+
+
+ diff --git a/config/profile_gadget.yml b/config/profile_gadget.yml new file mode 100644 index 0000000..b99cbe9 --- /dev/null +++ b/config/profile_gadget.yml @@ -0,0 +1,15 @@ +recentCommunityTopicCommentForProfile: + caption: + ja_JP: "書き込み一覧" + description: + ja_JP: "プロフィールを表示中のメンバーが書き込んだコミュニティトピックの一覧を表示します" + component: [communityTopic, topicCommentByMemberListBox] + config: + col: + Name: "col" + Caption: "表示するトピック数" + FormType: "select" + ValueType: "integer" + IsRequired: true + Default: 5 + Choices: {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10} diff --git a/lib/action/opCommunityTopicPluginTopicComponents.class.php b/lib/action/opCommunityTopicPluginTopicComponents.class.php index bcfd9ff..5bfcb3e 100644 --- a/lib/action/opCommunityTopicPluginTopicComponents.class.php +++ b/lib/action/opCommunityTopicPluginTopicComponents.class.php @@ -77,4 +77,17 @@ public function executeSmtMemberLatestTopicList($request) return sfView::SUCCESS; } + + public function executeTopicCommentByMemberListBox($request) + { + if ($request->hasParameter('id') && $request->getParameter('module') == 'member' && $request->getParameter('action') == 'profile') + { + $this->member = Doctrine::getTable('Member')->find($request->getParameter('id')); + } + else + { + $this->member = $this->getUser()->getMember(); + } + $this->communityTopic = Doctrine::getTable('CommunityTopic')->retrivesCommentsByMemberId($this->member->getId(), $this->gadget->getConfig('col')); + } } diff --git a/lib/model/doctrine/PluginCommunityTopicCommentTable.class.php b/lib/model/doctrine/PluginCommunityTopicCommentTable.class.php index 7cb6641..7e2f4fd 100644 --- a/lib/model/doctrine/PluginCommunityTopicCommentTable.class.php +++ b/lib/model/doctrine/PluginCommunityTopicCommentTable.class.php @@ -56,4 +56,21 @@ public function getMaxNumber($communityTopicId) return 0; } + + public function getCommentedIdsByMemberId($memberId) + { + $result = array(); + + $resultSet = $this->createQuery() + ->select('community_topic_id') + ->where('member_id = ?', $memberId) + ->execute(array(), Doctrine::HYDRATE_NONE); + + foreach ($resultSet as $value) + { + $result[] = $value[0]; + } + + return $result; + } } diff --git a/lib/model/doctrine/PluginCommunityTopicTable.class.php b/lib/model/doctrine/PluginCommunityTopicTable.class.php index f6944ea..e398c93 100644 --- a/lib/model/doctrine/PluginCommunityTopicTable.class.php +++ b/lib/model/doctrine/PluginCommunityTopicTable.class.php @@ -120,4 +120,34 @@ public function getResultListPager(Doctrine_Query $query, $page = 1, $size = 20) return $pager; } + + public function retrivesCommentsByMemberId($memberId, $limit = 5) + { + $communityTopicIdsComment = Doctrine::getTable('CommunityTopicComment')->getCommentedIdsByMemberId($memberId); + $communityTopicIdsTopic = Doctrine::getTable('CommunityTopic')->getCommentedIdsByMemberId($memberId); + $communityTopicIds = array_merge($communityTopicIdsComment, $communityTopicIdsTopic); + + return $this->createQuery() + ->whereIn('id', $communityTopicIds) + ->limit($limit) + ->orderBy('updated_at DESC') + ->execute(); + } + + public function getCommentedIdsByMemberId($memberId) + { + $result = array(); + + $resultSet = $this->createQuery() + ->select('id') + ->where('member_id = ?', $memberId) + ->execute(array(), Doctrine::HYDRATE_NONE); + + foreach ($resultSet as $value) + { + $result[] = $value[0]; + } + + return $result; + } }