-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a38302
commit 96b2f1c
Showing
8 changed files
with
247 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/*************************************************************************** | ||
* For license information see doc/license.txt | ||
* | ||
* Unicode Reminder メモ | ||
* | ||
* Display some status information about the server and Opencaching | ||
***************************************************************************/ | ||
|
||
function set_oconly81_tpldata($userid) | ||
{ | ||
global $tpl; | ||
|
||
$terr = $tsum = array(2=>0, 3=>0, 4=>0, 5=>0, 6=>0, 7=>0, 8=>0, 9=>0, 10=>0); | ||
$stat81 = array(2=>$terr, 3=>$terr, 4=>$terr, 5=>$terr, 6=>$terr, 7=>$terr, 8=>$terr, 9=>$terr, 10=>$terr); | ||
|
||
if ($userid > 0) | ||
{ | ||
$rs = sql(" | ||
SELECT `difficulty`, `terrain`, COUNT(*) AS `count` | ||
FROM `cache_logs` | ||
INNER JOIN `caches` ON `caches`.`cache_id`=`cache_logs`.`cache_id` | ||
INNER JOIN `caches_attributes` ON `caches_attributes`.`cache_id`=`cache_logs`.`cache_id` AND `caches_attributes`.`attrib_id`=6 | ||
WHERE `cache_logs`.`user_id`='&1' AND `cache_logs`.`type` IN (1,7) | ||
GROUP BY `difficulty`, `terrain`", | ||
$userid); | ||
} | ||
else | ||
{ | ||
$rs = sql(" | ||
SELECT `difficulty`, `terrain`, COUNT(*) AS `count` | ||
FROM `caches` | ||
INNER JOIN `caches_attributes` ON `caches_attributes`.`cache_id`=`caches`.`cache_id` AND `caches_attributes`.`attrib_id`=6 | ||
WHERE `status`=1 | ||
GROUP BY `difficulty`, `terrain`"); | ||
} | ||
$maxcount = 0; | ||
|
||
while ($r = sql_fetch_assoc($rs)) | ||
{ | ||
$stat81[$r['difficulty']][$r['terrain']] = $r['count']; | ||
$maxcount = max($maxcount, $r['count']); | ||
$tsum[$r['terrain']] += $r['count']; | ||
} | ||
sql_free_result($rs); | ||
$tpl->assign('stat81',$stat81); | ||
$tpl->assign('stat81_maxcount',max(10,$maxcount)); | ||
$tpl->assign('stat81_tsum', $tsum); | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/*************************************************************************** | ||
* For license information see doc/license.txt | ||
* | ||
* Unicode Reminder メモ | ||
* | ||
* Display some status information about the server and Opencaching | ||
***************************************************************************/ | ||
|
||
require 'lib2/web.inc.php'; | ||
require 'lib2/logic/oconly81.inc.php'; | ||
|
||
$tpl->name = 'oconly81'; | ||
$tpl->menuitem = MNU_CACHES_OCONLY81; | ||
$tpl->caching = true; | ||
$tpl->cache_lifetime = 900; | ||
|
||
$login->verify(); | ||
|
||
sql_temp_table('oconly81'); | ||
sql(" | ||
CREATE TEMPORARY TABLE &oconly81 ENGINE=MEMORY | ||
SELECT DISTINCT `user`.`user_id`, `caches`.`terrain`, `caches`.`difficulty` | ||
FROM `user` | ||
INNER JOIN `cache_logs` ON `cache_logs`.`user_id`=`user`.`user_id` AND `cache_logs`.`type` IN (1,7) | ||
INNER JOIN `caches` ON `caches`.`cache_id`=`cache_logs`.`cache_id` | ||
INNER JOIN `caches_attributes` ON `caches_attributes`.`cache_id`=`cache_logs`.`cache_id` AND `caches_attributes`.`attrib_id`=6 | ||
INNER JOIN `user_options` ON `user_options`.`user_id`=`user`.`user_id` | ||
WHERE `user_options`.`option_id`=13 AND `user_options`.`option_value`='1'"); | ||
$rs = sql(" | ||
SELECT `user`.`username`, `user`.`user_id`, COUNT(*) AS `count` | ||
FROM `user` | ||
INNER JOIN &oconly81 ON &oconly81.`user_id`=`user`.`user_id` | ||
GROUP BY `user`.`user_id` | ||
ORDER BY `user`.`username`"); | ||
$tpl->assign_rs('users', $rs); | ||
sql_free_result($rs); | ||
sql_drop_temp_table('oconly81'); | ||
|
||
set_oconly81_tpldata(0); | ||
|
||
$tpl->display(); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{*************************************************************************** | ||
* You can find the license in the docs directory | ||
* | ||
* Unicode Reminder メモ | ||
***************************************************************************} | ||
{* OCSTYLE *} | ||
<div class="content2-pagetitle"> | ||
<img src="resource2/{$opt.template.style}/images/misc/is_oconly_small.png" style="align: left; margin-right: 10px;" /> | ||
{t}OConly-81{/t} | ||
</div> | ||
|
||
<div class="content-txtbox-noshade" style="padding-right: 25px;"> | ||
<p> | ||
{t}<b>OConly-81</b> is a new contest about finding OConly caches under varying conditions, i.e. with different difficulty and terrain ratings. To participate, you can enable the OConly-81 statistics in your <a href="mydetails.php">user profile settings</a>.{/t}<br /> | ||
</p> | ||
|
||
<div class="buffer" style="width: 500px;"> </div> | ||
|
||
<div class="content2-container bg-blue02"> | ||
<p class="content-title-noshade-size2"> | ||
<img src="resource2/{$opt.template.style}/images/profile/32x32-profile.png" style="align: left; margin-right: 10px;" width="32" height="32" /> | ||
{t}Participants{/t} | ||
</p> | ||
</div> | ||
|
||
<p> | ||
{t}These Opencaching users participate in the OConly-81 contest:{/t} | ||
</p> | ||
|
||
<ul style="column-count:4; -moz-column-count:4; -webkit-column-count:4;"> | ||
{foreach from=$users item=user} | ||
<li><a href="viewprofile.php?userid={$user.user_id}#oconly81">{$user.username}</a> ({$user.count})</li> | ||
{/foreach} | ||
</ul> | ||
|
||
<div class="buffer" style="width: 500px;"> </div> | ||
|
||
<div class="content2-container bg-blue02"> | ||
<p class="content-title-noshade-size2"> | ||
<img src="resource2/{$opt.template.style}/images/cacheicon/traditional.gif" style="align: left; margin-right: 10px;" width="32" height="32" /> | ||
{t}Statistics{/t} | ||
</p> | ||
</div> | ||
|
||
<p> | ||
{t}Overall terrain and difficulty distribution of active OConly caches:{/t} | ||
</p> | ||
|
||
<table class="table"> | ||
<tr> | ||
<td> | ||
{include file="res_oconly81.tpl" userid=$userid} | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{*************************************************************************** | ||
* You can find the license in the docs directory | ||
* | ||
* Unicode Reminder メモ | ||
***************************************************************************} | ||
{* OCSTYLE *} | ||
<table class="stattable"> | ||
<tr> | ||
<th class="h1" style="text-align:right">{if $userid>0}<a href="oconly81.php">OConly-81</a> {/if}</th> | ||
<th class="h1" colspan="11" style="text-align:center; line-height:1.8em">{t}Terrain{/t}</th> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td> <img src="resource2/ocstyle/images/log/16x16-found.png" /</td> | ||
{foreach from=$stat81 key=step item=dummy} | ||
<th style="text-align:center">{$step/2}</th> | ||
{/foreach} | ||
<th class="h1" style="text-align:center">Σ</th> | ||
<td> </td> | ||
</tr> | ||
|
||
{assign var=matrixfound value=0} | ||
{assign var=totalsum value=0} | ||
{foreach from=$stat81 key=difficulty item=terrains name=difficulty} | ||
<tr> | ||
{if $smarty.foreach.difficulty.first} | ||
<th class="h1" rowspan="9">{t}Difficulty{/t} </th> | ||
{/if} | ||
<th> {$difficulty/2}</th> | ||
{assign var=dsum value=0} | ||
{foreach from=$terrains key=terrain item=count} | ||
<td style="text-align:center; background-color:{if $count}rgb({$count/$stat81_maxcount*-242+242.5|floor},{$count/$stat81_maxcount*-242+242.5|floor},242){else}#f2f2f2{/if}" {if $count}onclick='location.href="search.php?showresult=1&expert=0&f_inactive=0&output=HTML&sort=byname&{if $userid>0}finderid={$userid}&searchbyfinder={else}f_inactive=1&f_disabled=1&searchall={/if}&logtype=1,7&calledbysearch=0&cache_attribs=6&terrainmin={$terrain}&terrainmax={$terrain}&difficultymin={$difficulty}&difficultymax={$difficulty}"'{/if}> | ||
{if $count} | ||
<span style="cursor:pointer; color:{if $count > $stat81_maxcount/3}#fff{else}#000{/if}">{$count}</span> | ||
{assign var=dsum value=$dsum+$count} | ||
{assign var=matrixfound value=$matrixfound+1} | ||
{else} {/if} | ||
</td> | ||
{/foreach} | ||
<td style="text-align:center">{if $dsum}{$dsum}{assign var=totalsum value=$totalsum+$dsum}{/if}</td> | ||
</tr> | ||
{/foreach} | ||
|
||
<tr> | ||
<td rowspan="2"></td> | ||
<th class="h1" style="text-align:center">Σ</th> | ||
{foreach from=$stat81_tsum item=count} | ||
<td style="text-align:center">{if $count}{$count}{/if}</td> | ||
{/foreach} | ||
<td style="text-align:center"><b>{$totalsum}</b></td> | ||
</tr> | ||
{if $userid > 0} | ||
<tr> | ||
<td colspan="12" style="padding-top:0.5em"><p>{t 1=$matrixfound}The user has found <b>%1</b> of <b>81</b> theoretically possible terrain/difficulty combinations.{/t}</p></td> | ||
</tr> | ||
{/if} | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters