Skip to content

Commit

Permalink
fixed some templates to use cache (fixes #619)
Browse files Browse the repository at this point in the history
  • Loading branch information
kawahara committed Feb 14, 2010
1 parent be6a612 commit 1709d1f
Show file tree
Hide file tree
Showing 33 changed files with 307 additions and 223 deletions.
12 changes: 12 additions & 0 deletions apps/mobile_frontend/modules/ranking/actions/components.class.php
@@ -0,0 +1,12 @@
<?php

/**
* ranking components.
*
* @package opRankingPlugin
* @subpackage ranking
* @author Shogo Kawahara <kawahara@tejimaya.net>
*/
class rankingComponents extends opRankingPluginRankingComponents
{
}
18 changes: 18 additions & 0 deletions apps/mobile_frontend/modules/ranking/config/cache.yml
@@ -0,0 +1,18 @@
_menu:
enabled: true

_access:
enabled: true
lifetime: 3600

_friend:
enabled: true
lifetime: 3600

_community:
enabled: true
lifetime: 3600

_topic:
enabled: true
lifetime: 3600
23 changes: 23 additions & 0 deletions apps/mobile_frontend/modules/ranking/templates/_access.php
@@ -0,0 +1,23 @@
<?php op_mobile_page_title(__('Ranking'), __('Access number No1 member')) ?>
<?php if ($memberList['number']): ?>
<?php

echo '<center>' . __('It is a ranking of the member with a lot of numbers of yesterday of accesses.') . '</center>';

$list = array();
for ($i = 0; $i < $memberList['number']; $i++)
{
$member = $memberList['model'][$i];
$list[] = __('No%0%', array('%0%' => $memberList['rank'][$i])).'<br>'
. __('%0% :%1% access', array('%0%' => link_to($member->getName(), 'member/profile?id='.$member->getId()), '%1%' => $memberList['count'][$i]));
}

$options = array(
'border' => true,
);

op_include_list('rankingList', $list, $options);
?>
<?php else: ?>
<?php echo '<center>' . __('all member is 0 access') . '</center>' ?>
<?php endif; ?>
@@ -1,7 +1,6 @@
<?php op_mobile_page_title(__('Ranking'), __('Participation number No1 %community%')); ?>
<?php if ($ranking['number']): ?>
<?php

op_mobile_page_title(__('Ranking'), __('Participation number No1 %community%'));

echo '<center>'.__('It is a ranking of a lot of %community% of the participant that are.', array('%community%' => $op_term['community']->pluralize())).'</center>';

$list = array();
Expand All @@ -17,4 +16,7 @@
);

op_include_list('rankingList', $list, $options);
op_include_parts('rankingLink', 'RankingLink');
?>
<?php else: ?>
<?php echo '<center>' . __('No %community%') . '</center>'; ?>
<?php endif; ?>
22 changes: 22 additions & 0 deletions apps/mobile_frontend/modules/ranking/templates/_friend.php
@@ -0,0 +1,22 @@
<?php op_mobile_page_title(__('Ranking'), __('Member of number No1 of %friend%', array('%friend%' => $op_term['friend']->pluralize()))); ?>
<?php if ($memberList['number']): ?>
<?php
echo '<center>'.__('It is a ranking of the member with a lot of numbers of registered %friend%.', array('%friend%' => $op_term['friend']->pluralize())).'</center>';

$list = array();
for ($i = 0; $i < $memberList['number']; $i++)
{
$member = $memberList['model'][$i];
$list[] = __('No%0%', array('%0%' => $memberList['rank'][$i])).'<br>'
. __('%0% :%1% member', array('%0%' => link_to($member->getName(), 'member/profile?id='.$member->getId()), '%1%' => $memberList['count'][$i]));
}

$options = array(
'border' => true,
);

op_include_list('rankingList', $list, $options);
?>
<?php else: ?>
<?php echo '<center>' . __('There is no member who has a %friend%') . '</center>'; ?>
<?php endif; ?>
@@ -1,8 +1,12 @@
<?php slot('op_mobile_footer_menu') ?>
<?php if (class_exists('Ashiato')): ?>
<?php echo link_to(__('Access number No1 member'), '@ranking_access') ?><br>
<?php endif; ?>
<?php if ($op_config['enable_friend_link']): ?>
<?php echo link_to(__('Member of number No1 of %friend%', array('%friend%' => $op_term['friend']->pluralize())), '@ranking_friend') ?><br>
<?php endif; ?>
<?php echo link_to(__('Participation number No1 %community%'), '@ranking_community') ?><br>
<?php if (class_exists('CommunityTopicComment')): ?>
<?php echo link_to(__('No1 %community% at each upsurge'), '@ranking_topic') ?>
<?php endif; ?>
<?php end_slot(); ?>
@@ -1,6 +1,6 @@
<?php op_mobile_page_title(__('Ranking'), __('No1 %community% at each upsurge')); ?>
<?php if ($ranking['number']): ?>
<?php
op_mobile_page_title(__('Ranking'), __('No1 %community% at each upsurge'));

echo '<center>'.__('It is a ranking of the %community% with a lot of numbers of yesterday of bulletin board writing.').'</center>';

$list = array();
Expand All @@ -16,4 +16,7 @@
);

op_include_list('rankingList', $list, $options);
op_include_parts('rankingLink', 'RankingLink');
?>
<?php else: ?>
<?php echo '<center>'.__('Not written').'</center>'; ?>
<?php endif; ?>

This file was deleted.

20 changes: 0 additions & 20 deletions apps/mobile_frontend/modules/ranking/templates/accessSuccess.php

This file was deleted.

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions apps/mobile_frontend/modules/ranking/templates/friendSuccess.php

This file was deleted.

@@ -0,0 +1,2 @@
<?php include_partial('menu') ?>
<?php include_component('ranking', $type, array('culture' => $sf_user->getCulture())) ?>
5 changes: 0 additions & 5 deletions apps/mobile_frontend/modules/ranking/templates/topicError.php

This file was deleted.

2 changes: 1 addition & 1 deletion apps/pc_frontend/modules/ranking/actions/actions.class.php
Expand Up @@ -3,7 +3,7 @@
/**
* ranking actions.
*
* @package OpenPNE
* @package opRankingPlugin
* @subpackage ranking
* @author Your name here
* @version SVN: $Id: actions.class.php 9301 2008-05-27 01:08:46Z dwhittle $
Expand Down
12 changes: 12 additions & 0 deletions apps/pc_frontend/modules/ranking/actions/components.class.php
@@ -0,0 +1,12 @@
<?php

/**
* ranking components.
*
* @package opRankingPlugin
* @subpackage ranking
* @author Shogo Kawahara <kawahara@tejimaya.net>
*/
class rankingComponents extends opRankingPluginRankingComponents
{
}
18 changes: 18 additions & 0 deletions apps/pc_frontend/modules/ranking/config/cache.yml
@@ -0,0 +1,18 @@
_menu:
enabled: true

_access:
enabled: true
lifetime: 3600

_friend:
enabled: true
lifetime: 3600

_community:
enabled: true
lifetime: 3600

_topic:
enabled: true
lifetime: 3600
1 change: 1 addition & 0 deletions apps/pc_frontend/modules/ranking/config/view.yml
@@ -1,3 +1,4 @@
_menu:
all:
stylesheets: [/opRankingPlugin/css/ranking]
layout: layoutB
31 changes: 31 additions & 0 deletions apps/pc_frontend/modules/ranking/templates/_access.php
@@ -0,0 +1,31 @@
<?php if ($memberList['number']): ?>
<?php
$list = array();
for ($i = 0; $i < $memberList['number']; $i++)
{
$member = $memberList['model'][$i];
$list[$i][__('No%0%', array('%0%' => $memberList['rank'][$i]))] =
__('%0% :%1% access', array('%0%' => link_to($member->getName(), 'member/profile?id='.$member->getId()), '%1%' => $memberList['count'][$i]));
$selfintoroCaption = __('Self Introduction');
if ($member->getProfile('op_preset_self_introduction'))
{
$list[$i][$selfintoroCaption] = op_truncate($member->getProfile('op_preset_self_introduction'), 36, '', 3);
}
}

$options = array(
'id' => 'rankingResultList',
'title' => __('The No1 of the number of access member is %0%', array('%0%' => $memberList['model'][0]->getName())),
'link_to_detail' => 'member/profile?id=%d',
'model' => $memberList['model'],
'list' => $list,
'rank' => $memberList['rank'],
);

include_partial('global/partsRankingResultList', array('options' => $options));
?>
<?php else: ?>
<?php op_include_box('access_list', __('all member is 0 access'), array(
'title' => __('Access number No1 member'),
)); ?>
<?php endif; ?>
@@ -1,3 +1,4 @@
<?php if ($ranking['number']): ?>
<?php
$list = array();
for ($i = 0; $i < $ranking['number']; $i++)
Expand All @@ -6,19 +7,23 @@
$list[$i][__('No%0%', array('%0%' => $ranking['rank'][$i]))] =
link_to($community->getName(), 'community/home?id='.$community->getId()).' '.__(':%0% member', array('%0%' => $ranking['count'][$i]));
$list[$i][__('Category')] = $community->getCommunityCategory();
$list[$i][__('Manager')] = $ranking['admin'][$i]->getName();
$list[$i][__('Manager')] = link_to($ranking['admin'][$i]->getName(), '@obj_member_profile?id='.$ranking['admin'][$i]->getId());
$list[$i][__('Description')] = op_truncate($community->getConfig('description'), 36, '', 3);
}

$options = array(
'id' => 'rankingResultList',
'title' => __("The No1 of the number of %community% member is '%0%'", array('%community%' => $op_term['community'], '%0%' => $ranking['model'][0]->getName())),
'link_to_detail' => 'community/home?id=%d',
'model' => $ranking['model'],
'list' => $list,
'rank' => $ranking['rank'],
);

slot('op_sidemenu');
include_parts('rankingLink', 'RankingLink');
end_slot();
include_parts('rankingResultList', 'RankingResultList', $options);
include_partial('global/partsRankingResultList', array('options' => $options));
?>
<?php else: ?>
<?php op_include_box('community_list', __('No %community%'), array(
'title' => __('Participation number No1 %community%'),
)); ?>
<?php endif; ?>
33 changes: 33 additions & 0 deletions apps/pc_frontend/modules/ranking/templates/_friend.php
@@ -0,0 +1,33 @@
<?php if ($memberList['number']): ?>
<?php
$list = array();
for ($i = 0; $i < $memberList['number']; $i++)
{
$member = $memberList['model'][$i];
$list[$i][__('No%0%', array('%0%' => $memberList['rank'][$i]))] =
__('%0% :%1% member', array('%0%' => link_to($member->getName(), '@obj_member_profile?id='.$member->getId()), '%1%' => $memberList['count'][$i]));
$selfintoroCaption = __('Self Introduction');
if ($member->getProfile('op_preset_self_introduction'))
{
$list[$i][$selfintoroCaption] = op_truncate($member->getProfile('op_preset_self_introduction'), 36, '', 3);
}
}

$options = array(
'id' => 'rankingResultList',
'title' => __('The No1 of the number of %friend% member is %0%', array(
'%friend%' => $op_term['friend']->pluralize(), '%0%' => $memberList['model'][0]->getName()
)),
'link_to_detail' => '@obj_member_profile?id=%d',
'model' => $memberList['model'],
'list' => $list,
'rank' => $memberList['rank'],
);

include_partial('global/partsRankingResultList', array('options' => $options));
?>
<?php else: ?>
<?php op_include_box('friend_list', __('There is no member who has a %friend%'), array(
'title' => __('Member of number No1 of %friend%', array('%friend%' => $op_term['friend']->pluralize()))
)); ?>
<?php endif; ?>
@@ -1,3 +1,4 @@
<?php slot('op_sidemenu'); ?>
<div class="parts rankingSideNav">

<?php if (class_exists('Ashiato')): ?>
Expand All @@ -8,11 +9,13 @@
</div>
<?php endif; ?>

<?php if ($op_config['enable_friend_link']): ?>
<div class="item">
<div class="partsHeading"><h3><?php echo __('Member of number No1 of %friend%', array('%friend%' => $op_term['friend']->pluralize())) ?></h3></div>
<p><?php echo __('It is a ranking of the member with a lot of numbers of registered %friend%.', array('%friend%' => $op_term['friend']->pluralize())) ?></p>
<p class="link"><?php echo link_to(__('Member of number No1 of %friend%', array('%friend%' => $op_term['friend']->pluralize())), 'ranking/friend') ?></p>
</div>
<?php endif; ?>

<div class="item">
<div class="partsHeading"><h3><?php echo __('Participation number No1 %community%') ?></h3></div>
Expand All @@ -29,3 +32,4 @@
<?php endif; ?>

</div>
<?php end_slot(); ?>
@@ -1,3 +1,4 @@
<?php if ($ranking['number']): ?>
<?php
$list = array();
for ($i = 0; $i < $ranking['number']; $i++)
Expand All @@ -11,14 +12,18 @@
}

$options = array(
'id' => 'rankingResultList',
'title' => __("No1 %community% is '%0%' at each upsurge", array('%community%' => $op_term['community'], '%0%' => $ranking['model'][0]->getName())),
'link_to_detail' => 'community/home?id=%d',
'model' => $ranking['model'],
'list' => $list,
'rank' => $ranking['rank'],
);

slot('op_sidemenu');
include_parts('rankingLink', 'RankingLink');
end_slot();
include_parts('rankingResultList', 'RankingResultList', $options);
include_partial('global/partsRankingResultList', array('options' => $options));
?>
<?php else: ?>
<?php op_include_box('community_list', __('Not written'), array(
'title' => __('No1 %community% at each upsurge'),
)); ?>
<?php endif; ?>

0 comments on commit 1709d1f

Please sign in to comment.