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
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@

class communityTopicComponents extends opCommunityTopicPluginTopicComponents
{
public function executeTopicCommentSnsListBox()
{
$this->communityTopic = Doctrine_Core::getTable('CommunityTopic')
->getRecentlyUpdatedTopicsSns($this->gadget->getConfig('col'));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php if (count($communityTopic)): ?>
<?php slot('body') ?>
<?php foreach ($communityTopic as $topic): ?>
<li><span class="date"><?php echo op_format_date($topic->getUpdatedAt(), 'XShortDateJa') ?></span>
<?php echo sprintf('%s (%s)',
link_to(sprintf('%s(%d)',
op_truncate($topic->getName(), 36),
$topic->getCommunityTopicComment()->count()
), '@communityTopic_show?id='.$topic->getId()),
$topic->getCommunity()->getName()
) ?></li>
<?php endforeach ?>
<?php end_slot() ?>
<?php echo op_include_parts('topicRecentList', 'homeRecentList_'.$gadget->id, array(
'title' => 'SNS全体のコミュニティ最新書き込み',
'listBody' => get_slot('body'),
'moreInfo' => array(
link_to(__('More'), array('sf_route' => 'communityTopic_search_all')),
),
)) ?>
<?php endif ?>
6 changes: 6 additions & 0 deletions apps/pc_frontend/templates/_partsTopicRecentList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php $options->setDefault('class', 'homeRecentList') ?>
<div class="block">
<ul class="articleList">
<?php echo $options->getRaw('listBody') ?>
</ul>
</div>
16 changes: 16 additions & 0 deletions config/gadget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
9 changes: 9 additions & 0 deletions lib/model/doctrine/PluginCommunityTopicTable.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down