Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/pc_frontend/i18n/messages.ja.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@
<source>[1]1 topic has new comments|(1,Inf]%1% topics have new comments</source>
<target>[1,Inf]%1% 件のトピックに新着コメントがあります</target>
</trans-unit>
<trans-unit id="">
<source>Recently Posted %Community% Topics By This Member</source>
<target>書き込み一覧</target>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php if (count($communityTopic)): ?>
<div id="homeRecentList_<?php echo $gadget->getId() ?>" class="dparts homeRecentList"><div class="parts">
<div class="partsHeading"><h3><?php echo __('Recently Posted %Community% Topics By This Member') ?></h3></div>
<div class="block">
<ul class="articleList">
<?php foreach ($communityTopic as $topic): ?>
<li><span class="date"><?php echo op_format_date($topic->getUpdatedAt(), 'XShortDateJa') ?></span>
<?php echo link_to(sprintf('%s(%d)',
op_truncate($topic->getName(), 36),
$topic->getCommunityTopicComment()->count()
), '@communityTopic_show?id='.$topic->getId())
?></li>
<?php endforeach; ?>
</ul>
</div>
</div></div>
<?php endif; ?>
15 changes: 15 additions & 0 deletions config/profile_gadget.yml
Original file line number Diff line number Diff line change
@@ -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}
13 changes: 13 additions & 0 deletions lib/action/opCommunityTopicPluginTopicComponents.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
}
17 changes: 17 additions & 0 deletions lib/model/doctrine/PluginCommunityTopicCommentTable.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
30 changes: 30 additions & 0 deletions lib/model/doctrine/PluginCommunityTopicTable.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}