diff --git a/htdocs/newevents.php b/htdocs/newevents.php new file mode 100644 index 00000000..1e400c65 --- /dev/null +++ b/htdocs/newevents.php @@ -0,0 +1,64 @@ +name = 'newevents'; + $tpl->menuitem = MNU_START_NEWCACHES; + + $startat = isset($_REQUEST['startat']) ? $_REQUEST['startat']+0 : 0; + $perpage = 100; + $startat -= $startat % $perpage; + if ($startat < 0) $startat = 0; + + $tpl->caching = true; + $tpl->cache_id = $startat; + if ($startat > 10 * $perpage) + $tpl->cache_lifetime = 3600; + else + $tpl->cache_lifetime = 300; + + if (!$tpl->is_cached()) + { + require($opt['rootpath'] . 'lib2/logic/cacheIcon.inc.php'); + + $newCaches = array(); + + $rsNewCaches = sql_slave('SELECT `caches`.`cache_id` `cacheid`, `caches`.`wp_oc` `wpoc`, `user`.`user_id` `userid`, `caches`.`country` `country`, `caches`.`name` `cachename`, `user`.`username` `username`, `caches`.`date_created` `date_created`, `cache_type`.`icon_large` FROM `caches` INNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id` INNER JOIN `cache_type` ON `caches`.`type`=`cache_type`.`id` WHERE `caches`.`status` = 1 AND `caches`.`type` = 6 ORDER BY `caches`.`date_created` DESC LIMIT ' . ($startat+0) . ', ' . ($perpage+0)); + while ($rNewCache = sql_fetch_assoc($rsNewCaches)) + { + $rNewCache['icon_large'] = getSmallCacheIcon($rNewCache['icon_large']); + $newCaches[] = $rNewCache; + } + sql_free_result($rsNewCaches); + $tpl->assign('newCaches', $newCaches); + + $count = sql_value_slave('SELECT COUNT(*) `count` FROM `caches`INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id` WHERE `cache_status`.`allow_user_view`=1', 0); + $maxstart = (ceil($count / $perpage)-1) * $perpage; + + if ($startat < 4 * $perpage) + { + $firstpage = 0; + $lastpage = 8 * $perpage; + } + else + { + $firstpage = $startat - 4 * $perpage; + $lastpage = $firstpage + 8 * $perpage; + } + if ($lastpage > $maxstart) + $lastpage = $maxstart; + + $tpl->assign('firstpage', $firstpage); + $tpl->assign('lastpage', $lastpage); + $tpl->assign('perpage', $perpage); + + $tpl->assign('startat', $startat); + $tpl->assign('maxstart', $maxstart); + } + + $tpl->display(); +?> diff --git a/htdocs/templates2/ocstyle/newevents.tpl b/htdocs/templates2/ocstyle/newevents.tpl new file mode 100644 index 00000000..6650b172 --- /dev/null +++ b/htdocs/templates2/ocstyle/newevents.tpl @@ -0,0 +1,76 @@ +{*************************************************************************** + * You can find the license in the docs directory + * + * Unicode Reminder メモ + ***************************************************************************} +{* OCSTYLE *} +
+ {t}Latest caches{/t} + {t}Upcoming/Latest Events{/t} +
+ + + + + + + {foreach name=newCaches from=$newCaches item=newCache} + + {/foreach} + + + + +
+ + {if $startat>0} + << + < + {else} + << + < + {/if} + + {section name=page start=$firstpage loop=$lastpage+1 step=100} + {if $smarty.section.page.index!=$startat} + {$smarty.section.page.index/$perpage+1} + {else} + {$smarty.section.page.index/$perpage+1} + {/if} + {/section} + + {if $startat<$maxstart} + > + >> + {else} + > + >> + {/if} + +
{$newCache.date_created|date_format:$opt.format.date} ({$newCache.country}): Cache {$newCache.cachename|escape} {t}by{/t} {$newCache.username|escape}
+ + {if $startat>0} + << + < + {else} + << + < + {/if} + + {section name=page start=$firstpage loop=$lastpage+1 step=100} + {if $smarty.section.page.index!=$startat} + {$smarty.section.page.index/$perpage+1} + {else} + {$smarty.section.page.index/$perpage+1} + {/if} + {/section} + + {if $startat<$maxstart} + > + >> + {else} + > + >> + {/if} + +
diff --git a/htdocs/templates2/ocstyle/start.tpl b/htdocs/templates2/ocstyle/start.tpl index 20c29f84..f94ea467 100644 --- a/htdocs/templates2/ocstyle/start.tpl +++ b/htdocs/templates2/ocstyle/start.tpl @@ -68,6 +68,7 @@

{t 1=$usercountry|escape}The next events in %1{/t} +   [{t}more{/t}...]