Skip to content
Permalink
Browse files

added Oconly-81 contest page

  • Loading branch information...
following5 committed Aug 3, 2013
1 parent 4a38302 commit 96b2f1c1ca6c85e89f68f7a14ed242f97461587f
@@ -898,6 +898,7 @@ INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustrin
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('101', 'MNU_START_WIKINEWS', 'New Wiki articles', '2113', 'New Wiki articles', '2113', '0', '!http://wiki.opencaching.de/index.php/Hauptseite/Neue_Artikel', '1', '1', '4', '', '0', NULL);
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('102', 'MNU_START_NEWFEATURES', 'New features', '2115', 'New features', '2115', '0', 'articles.php?page=changelog', '1', '1', '5', '', '0', NULL);
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('103', 'MNU_MYPROFILE_OWNERLOGS', 'Log history', '2126', 'Log history', '2126', '0', '!okapi/apps/', '0', '9', '10', '', '1', NULL);
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('104', 'MNU_CACHES_OCONLY81', 'OConly-81', '2139', 'OConly-81', '2139', '0', 'oconly81.php', '1', '10', '5', '', '1', NULL);

-- Table sys_trans
SET NAMES 'utf8';
@@ -2558,8 +2559,16 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2133', 'Copy EN
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2134', 'I know what I am doing, do not show this advice again today.', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2135', 'Show OConly-81 stats', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2136', 'OConly statistics', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2137', 'The user has found %1 of 81 theoretically possible terrain/difficulty combinations.', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2137', 'The user has found <b>%1</b> of <b>81</b> theoretically possible terrain/difficulty combinations.', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2138', 'Finds by region', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2139', 'OConly-81', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2140', 'These Opencaching users participate in the OConly-81 contest:', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2141', 'OConly-81 statistics', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2142', 'inactive', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2143', '<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>.', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2144', 'Participants', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2146', 'Statistics', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2147', 'Overall terrain and difficulty distribution of active OConly caches:', '2010-09-07 20:19:07');

-- Table sys_trans_ref
SET NAMES 'utf8';
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2132', 'DE', 'Du kannst einen Geocache mehreren Benutzern zur Adoption anbieten. Der erste Benutzer, der die Adoption bestätigt, wird der neue Besitzer des Geocaches. Mit der Adoption gibst du dem Benutzer ein unbeschränktes Recht, urheberrechtlich geschützte Inhalte dieses Geocaches zu nutzen, zu modifizieren und weiterzugeben.', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2133', 'DE', 'EN kopieren', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2134', 'DE', 'Ich weiß was ich tue \&ndash; diesen Hinweis heute nicht mehr anzeigen.', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2135', 'DE', 'OConly81-Statistik anzeigen', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2135', 'DE', 'OConly-81-Statistik anzeigen', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2136', 'DE', 'OConly-Statistik', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2137', 'DE', 'Der Benutzer hat %1 von 81 theoretisch möglichen Gelände/Schwierigkeit-Kombinationen gefunden.', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2137', 'DE', 'Der Benutzer hat <b>%1</b> von <b>81</b> theoretisch möglichen Gelände/Schwierigkeit-Kombinationen gefunden.', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2138', 'DE', 'Funde nach Region', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2139', 'DE', 'OConly-81', '2010-09-07 20:19:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2140', 'DE', 'Diese Benutzer machen beim OConly-81-Wettbewerb mit:', '2010-09-07 20:19:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2141', 'DE', 'OConly-81-Statistik', '2010-09-07 20:19:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2142', 'DE', 'inaktiv', '2010-09-07 20:19:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2143', 'DE', '<b>OConly-81</b> ist ein neuer Wettbewerb bei dem es darum geht, OC-Only-Caches unter den verschiedensten Bedingungen zu finden, d.&nbsp;h. mit verschiedenen Schwierigkeits- und Geländewertungen. Um teilzunehmen, kannst du in deinen <a href=\"mydetails.php\">Profileinstellungen</a> die OConly-81-Statistik aktivieren.', '2010-09-07 20:19:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2144', 'DE', ' Teilnehmer', '2010-09-07 20:19:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2146', 'DE', 'Statistik', '2010-09-07 20:19:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2147', 'DE', 'Gelände- und Schwierigkeitsverteilung aller OConly-Caches:', '2010-09-07 20:19:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'EN', 'Reorder IDs', '2010-09-02 00:15:30');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2', 'EN', 'The database could not be reconnected.', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('3', 'EN', 'Testing – please do not login', '2010-08-28 11:48:07');
@@ -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);
}
?>
@@ -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();
?>
@@ -17,4 +17,5 @@ Disallow: /search.php?*output=ovl*
Disallow: /search.php?*output=txt*
Disallow: /search.php?*output=xml*
Disallow: /search.php?*queryid=*
Disallow: /search.php?*searchbyall=*
Disallow: /xml*
@@ -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;">&nbsp;</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;">&nbsp;</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>
@@ -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>&nbsp;&nbsp;&nbsp;{/if}</th>
<th class="h1" colspan="11" style="text-align:center; line-height:1.8em">{t}Terrain{/t}</th>
</tr>
<tr>
<td></td>
<td>&nbsp;<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>&nbsp;</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}&nbsp;&nbsp;&nbsp;</th>
{/if}
<th>&nbsp;{$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&amp;expert=0&amp;f_inactive=0&amp;output=HTML&amp;sort=byname&amp;{if $userid>0}finderid={$userid}&amp;searchbyfinder={else}f_inactive=1&amp;f_disabled=1&amp;searchall={/if}&amp;logtype=1,7&amp;calledbysearch=0&amp;cache_attribs=6&amp;terrainmin={$terrain}&amp;terrainmax={$terrain}&amp;difficultymin={$difficulty}&amp;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}&nbsp;{/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>
@@ -152,52 +152,21 @@
<tr><td class="spacer"></td></tr>

{if $show_oconly81}
<tr><td colspan="3">
<table class="stattable">
<tr>
<th class="h1"></th>
<th class="h1" colspan="11" style="text-align:center; line-height:1.8em">{t}Terrain{/t}</th>
</tr>
<tr>
<td></td>
<td>&nbsp;<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>
</tr>
{assign var=matrixfound 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}&nbsp;&nbsp;&nbsp;&nbsp;</th>
{/if}
<th>&nbsp;{$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&amp;expert=0&amp;f_inactive=0&amp;output=HTML&amp;sort=byname&amp;finderid={$userid}&amp;searchbyfinder=&amp;logtype=1,7&amp;calledbysearch=0&amp;cache_attribs=6&amp;terrainmin={$terrain}&amp;terrainmax={$terrain}&amp;difficultymin={$difficulty}&amp;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}&nbsp;{/if}
</td>
{/foreach}
<td style="text-align:center">{if $dsum}{$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>{$oconly_found}</b></td>
</tr>
<tr>
<td colspan="11" style="padding-top:0.5em"><p>{t 1=$matrixfound}The user has found %1 of 81 theoretically possible terrain/difficulty combinations.{/t}</p></td>
</tr>
</table>
</td></tr>
<tr id="oconly81">
<td colspan="3">
{include file="res_oconly81.tpl" userid=$userid}
</td>
</tr>
{else}
<tr>
<td valign="middle" class="header-small" style="white-space:nowrap" width="1%">
<img src="resource2/ocstyle/images/log/16x16-found.png" style="padding-right:2px" />
<b>{t}OConly-81 statistics{/t}:</b>
</td>
<td valign="middle">
{t}inactive{/t} (<a href="oconly81.php">{t}Info{/t}</a>)
</td>
</tr>
<tr><td class="spacer"></td></tr>
{/if}
</table>
@@ -244,27 +244,8 @@
if ($show_oconly81)
{
$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);
$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`*10 + `terrain`",
$userid);
$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);
require 'lib2/logic/oconly81.inc.php';
set_oconly81_tpldata($userid);
}
$tpl->assign('username', $record['username']);

0 comments on commit 96b2f1c

Please sign in to comment.
You can’t perform that action at this time.