diff --git a/htdocs/doc/sql/static-data/data.sql b/htdocs/doc/sql/static-data/data.sql
index 5746268c4..b1141c718 100644
--- a/htdocs/doc/sql/static-data/data.sql
+++ b/htdocs/doc/sql/static-data/data.sql
@@ -693,6 +693,7 @@ INSERT INTO `profile_options` (`id`, `name`, `trans_id`, `internal_use`, `defaul
INSERT INTO `profile_options` (`id`, `name`, `trans_id`, `internal_use`, `default_value`, `check_regex`, `option_order`, `option_input`, `optionset`) VALUES ('9', 'Cache icons', '1872', '1', '1', '^[1-9]$', '140', 'select:1=classic OC,', '2');
INSERT INTO `profile_options` (`id`, `name`, `trans_id`, `internal_use`, `default_value`, `check_regex`, `option_order`, `option_input`, `optionset`) VALUES ('10', 'Show %1preview pictures
(% of map area, 0=off)', '1928', '1', '7', '^[0-5]?[0-9]$', '150', 'text', '2');
INSERT INTO `profile_options` (`id`, `name`, `trans_id`, `internal_use`, `default_value`, `check_regex`, `option_order`, `option_input`, `optionset`) VALUES ('11', 'Show picture stats and gallery', '1944', '1', '1', '^[0-1]$', '60', 'checkbox', '1');
+INSERT INTO `profile_options` (`id`, `name`, `trans_id`, `internal_use`, `default_value`, `check_regex`, `option_order`, `option_input`, `optionset`) VALUES ('13', 'Show OConly-81 stats', '2135', '1', '0', '^[0-1]$', '65', 'checkbox', '1');
-- Table replication_overwritetypes
SET NAMES 'utf8';
@@ -2555,6 +2556,10 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2131', 'If you
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2132', 'You can offer this Geocache to more than one user. The first user committing the adoption will get the new owner of this Geocache. With the adoption, you will give the committing user an unlimited right to use, modifiy, publish and sublicense content of this Geocache.', '2010-08-28 11:48:04');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2133', 'Copy EN', '2010-08-28 11:48:04');
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 ('2138', 'Finds by region', '2010-09-07 20:19:07');
-- Table sys_trans_ref
SET NAMES 'utf8';
@@ -6568,6 +6573,10 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
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 \– 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 ('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 ('2138', 'DE', 'Funde nach Region', '2010-08-28 11:48: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');
diff --git a/htdocs/lib2/OcSmarty.class.php b/htdocs/lib2/OcSmarty.class.php
index b04947e9a..910e0a9ac 100644
--- a/htdocs/lib2/OcSmarty.class.php
+++ b/htdocs/lib2/OcSmarty.class.php
@@ -138,6 +138,7 @@ function compile($resource_name, $compile_id = null)
function display($dummy1=null, $dummy2=null, $dummy3=null)
{
global $opt, $db, $cookie, $login, $menu, $sqldebugger, $translate;
+ global $useragent_msie;
$cookie->close();
// if the user is an admin, dont cache the content
@@ -184,6 +185,7 @@ function display($dummy1=null, $dummy2=null, $dummy3=null)
$optn['geokrety'] = $opt['geokrety'];
$optn['template']['usercountrieslist'] = labels::getLabels('usercountrieslist');
$optn['help']['oconly'] = helppagelink('oconly','OConly');
+ $optn['msie'] = $useragent_msie;
// url-sessions? (for session timout display)
$optn['session']['url'] = false;
diff --git a/htdocs/lib2/logic/const.inc.php b/htdocs/lib2/logic/const.inc.php
index a0f05b471..32e7bf644 100644
--- a/htdocs/lib2/logic/const.inc.php
+++ b/htdocs/lib2/logic/const.inc.php
@@ -72,6 +72,7 @@
define('USR_OPT_MAP_PREVIEW', 10);
define('USR_OPT_PICSTAT', 11);
define('USR_OPT_TRANSLANG', 12);
+ define('USR_OPT_OCONLY81', 13);
// user.data_license values
define('OLD_DATA_LICSENSE',0); // before deadline
diff --git a/htdocs/resource2/ocstyle/css/style_screen.css b/htdocs/resource2/ocstyle/css/style_screen.css
index ec2014801..f816df90e 100644
--- a/htdocs/resource2/ocstyle/css/style_screen.css
+++ b/htdocs/resource2/ocstyle/css/style_screen.css
@@ -340,6 +340,13 @@ div.changelog ul li ul {font-size: 83%; margin:0}
.narrowtable th {margin: 0px; background-color: #deebcd; color: #404040; padding: 2px 7px 2px 7px; border-top: solid 1px #404040; border-bottom: solid 1px #404040; empty-cells: show; text-align: left; font-size: 120%; }
.narrowtable-caption {margin: 0.5em 0px 1.0em 30px; padding: 0px; clear: both; text-align: left; font-size: 120%;}
+.stattable { font-size:10px; line-height:1.4em; padding:0; background-color: white; }
+.stattable th { background-color: #deebcd; color: #404040; border:0; min-width: 1.8em; line-height:1.4em; }
+.stattable th.h1 { background-color: #fff; }
+span.percent { font-size: 11px; }
+
+
+
td.listicon {
width:1%;
margin-right:0 !important;
@@ -367,9 +374,8 @@ td.search_listcolor2 { background:#f0f0f0; }
.img-right-border-topmargin {float: right; margin: 3px 0px 0px 10px; border: solid 1px rgb(150,150,150);}
/* Other */
-div.default {
- font-size:110%;
-}
+div.default { font-size:110%; }
+td.default { font-size:12px; }
/* Links */
a.nooutline:focus { outline: 0; }
diff --git a/htdocs/search.php b/htdocs/search.php
index 8348facad..04b596f08 100644
--- a/htdocs/search.php
+++ b/htdocs/search.php
@@ -410,6 +410,7 @@
$options['orderRatingFirst'] = true;
$options['country'] = isset($_REQUEST['country']) ? $_REQUEST['country'] : '';
+ $options['adm2'] = isset($_REQUEST['adm2']) ? $_REQUEST['adm2'] : '';
$options['cachetype'] = isset($_REQUEST['cachetype']) ? $_REQUEST['cachetype'] : '';
$options['cachesize'] = isset($_REQUEST['cachesize']) ? $_REQUEST['cachesize'] : '';
@@ -1015,12 +1016,20 @@
// ignore NC listings, which are mostly unmaintained or dead
$sql_where[] = "`caches`.`wp_gc_maintained`=''";
}
+
if (!isset($options['country'])) $options['country']='';
if ($options['country'] != '')
{
$sql_where[] = '`caches`.`country`=\'' . sql_escape($options['country']) . '\'';
}
+ if (!isset($options['adm2'])) $options['adm2']='';
+ if ($options['adm2'] != '')
+ {
+ $sql_innerjoin[] = '`cache_location` ON `cache_location`.`cache_id`=`caches`.`cache_id`';
+ $sql_where[] = '`cache_location`.`code2`=\'' . sql_escape($options['adm2']) . '\'';
+ }
+
if ($options['cachetype'] != '')
{
$types = explode(';', $options['cachetype']);
diff --git a/htdocs/templates2/ocstyle/res_cacheicon_22.tpl b/htdocs/templates2/ocstyle/res_cacheicon_22.tpl
index 149461b57..e97f94171 100644
--- a/htdocs/templates2/ocstyle/res_cacheicon_22.tpl
+++ b/htdocs/templates2/ocstyle/res_cacheicon_22.tpl
@@ -5,27 +5,28 @@
***************************************************************************}
{strip} {* OCSTYLE *}
{*cachetype=1 status=1 logtype=0 owner=false small=false*}
+{if !isset($alignicon)}{assign var="alignicon" value="left"}{/if}
{if $cachetype==1}
-
+
{elseif $cachetype==2}
-
+
{elseif $cachetype==3}
-
+
{elseif $cachetype==4}
-
+
{elseif $cachetype==5}
-
+
{elseif $cachetype==6}
-
+
{elseif $cachetype==7}
-
+
{elseif $cachetype==8}
-
+
{elseif $cachetype==9}
-
+
{elseif $cachetype==10}
-
+
{else}
{/if}
diff --git a/htdocs/templates2/ocstyle/res_cachetypestats.tpl b/htdocs/templates2/ocstyle/res_cachetypestats.tpl
new file mode 100644
index 000000000..dd9282915
--- /dev/null
+++ b/htdocs/templates2/ocstyle/res_cachetypestats.tpl
@@ -0,0 +1,29 @@
+{***************************************************************************
+ * You can find the license in the docs directory
+ *
+ * Unicode Reminder メモ
+ ***************************************************************************}
+ {* OCSTYLE *}
+{if $opt.msie}
+
+{/if}
+{foreach from=$stat item=stats}
+ {if $opt.msie}
+
+ {else}
+ |
+ {else}
+
+ {/if}
+{/foreach}
+{if $opt.msie}
+
+{/if}
\ No newline at end of file
diff --git a/htdocs/templates2/ocstyle/res_userstats.tpl b/htdocs/templates2/ocstyle/res_userstats.tpl
new file mode 100644
index 000000000..8c0fff40c
--- /dev/null
+++ b/htdocs/templates2/ocstyle/res_userstats.tpl
@@ -0,0 +1,116 @@
+{***************************************************************************
+ * You can find the license in the docs directory
+ *
+ * Unicode Reminder メモ
+ ***************************************************************************}
+ {* OCSTYLE *}
+
+
+
+
+
+
+ {if $show_statistics==true}
+
+ |
+
+
+ {include file="res_cachetypestats.tpl" stat=$hidden_by_cachetype total=$hidden logs=false oconly=true}
+
+ |
+
+ |
+ {/if}
+
+
+
+
+
+
+ {if $show_statistics==true}
+
+ |
+
+
+ {include file="res_cachetypestats.tpl" stat=$found_by_cachetype total=$found logs=true oconly=true}
+
+ |
+
+ |
+
+
+
+
+
+
+
+
+
+ {if $maintainence > 0}
+
+
+
+
+ {/if}
+ {/if}
+
+
+
+
+
+
+ {if $show_picstat && $logpics !== null}
+
+
+
+
+ {/if}
+
+ {if $show_statistics==true}
+ |
+ |
+
+
+
+ {t}Finds by region{/t}:
+ |
+
+
+ {foreach from=$regionstat item=region name=regions}
+
+
+ {$region.count}
+ |
+
+ {if !$region.state}{$region.country}{else}{$region.country}{/if}
+ {if $region.state}> {$region.state}{/if}
+
+ |
+
+ {/foreach}
+
+ |
+
+ {/if}
diff --git a/htdocs/templates2/ocstyle/usertops.tpl b/htdocs/templates2/ocstyle/usertops.tpl
index 029e34be5..5673911b0 100644
--- a/htdocs/templates2/ocstyle/usertops.tpl
+++ b/htdocs/templates2/ocstyle/usertops.tpl
@@ -5,7 +5,7 @@
***************************************************************************}
{* OCSTYLE *}
-
+
{t 1=$userid 2=$username|escape}Recommendations of
%2{/t}
diff --git a/htdocs/templates2/ocstyle/viewprofile.tpl b/htdocs/templates2/ocstyle/viewprofile.tpl
index ee03b0e79..bd0c791e9 100644
--- a/htdocs/templates2/ocstyle/viewprofile.tpl
+++ b/htdocs/templates2/ocstyle/viewprofile.tpl
@@ -93,7 +93,7 @@
{/if}
-{* statistics *}
+{* all-caches statistics *}
@@ -104,92 +104,99 @@
|
-
-
-
-
+ {include file="res_userstats.tpl"
+ oconly=false
+ hidden=$hidden
+ hidden_active=$active
+ hidden_by_cachetype=$userstatshidden
+ found=$founds
+ found_by_cachetype=$userstatsfound
+ dnf=$notfound
+ notes=$note
+ maintainence=$maintenance
+ recommended=$recommended
+ maxrecommended=$maxrecommended
+ logpics=$logpics
+ regionstat=$regionstat}
+
+ |
+
- {if $show_statistics==true}
- {foreach from=$userstatshidden item=stats}
-
- {include file="res_cacheicon_15.tpl" cachetype=$stats.id}{$stats.cachetype|escape}: |
- {$stats.anzahl}
-
- ({t}show{/t})
-
- |
-
- {/foreach}
-
|
- {/if}
+{* OConly statistics *}
+
+
+
+ {t}OConly statistics{/t}
+
+
-
-
-
-
+
+ |
- {if $show_statistics==true}
- {foreach from=$userstatsfound item=stats}
+ {include file="res_userstats.tpl"
+ oconly=true
+ hidden=$oconly_hidden
+ hidden_active=$oconly_hidden_active
+ hidden_by_cachetype=$oconly_userstatshidden
+ found=$oconly_found
+ found_by_cachetype=$oconly_userstatsfound
+ dnf=$oconly_dnf
+ notes=$oconly_note
+ maintainence=$oconly_maint
+ recommended=$oconly_recommended
+ maxrecommended=null
+ logpics=$oconly_logpics
+ regionstat=$oconly_regionstat}
+
+ |
+
+ {if $show_oconly81}
+
+
- {include file="res_cacheicon_15.tpl" cachetype=$stats.id}{$stats.cachetype|escape}: |
- {$stats.anzahl}
-
- ({t}show{/t})
-
- |
+ |
+ {t}Terrain{/t} |
- {/foreach}
- |
-
-
-
-
-
-
-
-
-
- {if $maintenance > 0}
-
-
-
-
- {/if}
- {/if}
-
-
-
-
-
-
- {if $show_picstat}
-
-
-
-
+
+ |
+
+ {foreach from=$stat81 key=step item=dummy}
+ | {$step/2} |
+ {/foreach}
+ Σ |
+
+ {assign var=matrixfound value=0}
+ {foreach from=$stat81 key=difficulty item=terrains name=difficulty}
+
+ {if $smarty.foreach.difficulty.first}
+ {t}Difficulty{/t} |
+ {/if}
+ {$difficulty/2} |
+ {assign var=dsum value=0}
+ {foreach from=$terrains key=terrain item=count}
+
+ {if $count}
+ {$count}
+ {assign var=dsum value=$dsum+$count}
+ {assign var=matrixfound value=$matrixfound+1}
+ {else} {/if}
+ |
+ {/foreach}
+ {if $dsum}{$dsum}{/if} |
+
+ {/foreach}
+
+ |
+ Σ |
+ {foreach from=$stat81_tsum item=count}
+ {if $count}{$count}{/if} |
+ {/foreach}
+ {$oconly_found} |
+
+
+ {t 1=$matrixfound}The user has found %1 of 81 theoretically possible terrain/difficulty combinations.{/t} |
+
+
+ |
{/if}
-
- |
diff --git a/htdocs/usertops.php b/htdocs/usertops.php
index d4c087205..4f80101e2 100644
--- a/htdocs/usertops.php
+++ b/htdocs/usertops.php
@@ -10,6 +10,7 @@
$tpl->menuitem = MNU_CACHES_USERTOPS;
$userid = isset($_REQUEST['userid']) ? $_REQUEST['userid']+0 : 0;
+ $oconly = isset($_REQUEST['oconly']) && $_REQUEST['oconly'];
$sUsername = sql_value("SELECT `username` FROM `user` WHERE `user_id`='&1'", null, $userid);
if ($sUsername == null)
@@ -17,6 +18,7 @@
$tpl->assign('userid', $userid);
$tpl->assign('username', $sUsername);
+ $tpl->assign('oconly',$oconly);
$rs = sql("SELECT `cache_rating`.`cache_id` AS `cacheid`, `caches`.`name` AS `cachename`, `user`.`username` AS `ownername`, `caches`.`type` AS `type`, `caches`.`status` AS `status`, `ca`.`attrib_id` IS NOT NULL AS `oconly`
FROM `cache_rating`
@@ -25,8 +27,9 @@
INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`
LEFT JOIN `caches_attributes` `ca` ON `ca`.`cache_id`=`caches`.`cache_id` AND `ca`.`attrib_id`=6
WHERE `cache_status`.`allow_user_view`=1
- AND `cache_rating`.`user_id`='&1'
- ORDER BY `caches`.`name` ASC", $userid);
+ AND `cache_rating`.`user_id`='&1'
+ AND (NOT '&2' OR `ca`.`attrib_id` IS NOT NULL)
+ ORDER BY `caches`.`name` ASC", $userid, $oconly ? 1 : 0);
$tpl->assign_rs('ratings', $rs);
sql_free_result($rs);
diff --git a/htdocs/viewprofile.php b/htdocs/viewprofile.php
index 2cbb7504c..a5b0528b8 100644
--- a/htdocs/viewprofile.php
+++ b/htdocs/viewprofile.php
@@ -29,6 +29,7 @@
}
}
+ // user data and basic statistics
$rs = sql("SELECT `user`.`username`,
`user`.`last_login`,
`user`.`pmr_flag`,
@@ -75,36 +76,196 @@
$tpl->assign('description',
sql_value("SELECT `description` FROM `user` WHERE `user_id`='&1'", "", $userid));
- $rs = sql("SELECT COUNT(*) AS `anzahl`, `t`.`id`, IFNULL(`tt`.`text`, `t`.`name`) AS `cachetype`
- FROM `caches` AS `c`
- LEFT JOIN `cache_type` AS `t` ON `t`.`id`=`c`.`type`
- LEFT JOIN `sys_trans` AS `st` ON `st`.`id`=`t`.`trans_id` AND `t`.`name`=`st`.`text`
- LEFT JOIN `sys_trans_text` AS `tt` ON `st`.`id`=`tt`.`trans_id` AND `tt`.`lang`='&2'
- LEFT JOIN `cache_status` ON `cache_status`.`id`=`c`.`status`
- WHERE `c`.`user_id`='&1' AND `allow_user_view`='1'
- GROUP BY `t`.`id`
- ORDER BY `anzahl` DESC",
- $userid,
- $opt['template']['locale']);
- $tpl->assign_rs('userstatshidden', $rs);
+ $useropt = new useroptions($userid);
+ $show_statistics = $useropt->getOptValue(USR_OPT_SHOWSTATS);
+ $show_oconly81 = $useropt->getOptValue(USR_OPT_OCONLY81);
+
+ if ($show_statistics)
+ {
+ // detail statistics
+ $rs = sql("SELECT COUNT(*) AS `anzahl`, `t`.`id`, IFNULL(`tt`.`text`, `t`.`name`) AS `cachetype`
+ FROM `caches` AS `c`
+ LEFT JOIN `cache_type` AS `t` ON `t`.`id`=`c`.`type`
+ LEFT JOIN `sys_trans` AS `st` ON `st`.`id`=`t`.`trans_id` AND `t`.`name`=`st`.`text`
+ LEFT JOIN `sys_trans_text` AS `tt` ON `st`.`id`=`tt`.`trans_id` AND `tt`.`lang`='&2'
+ LEFT JOIN `cache_status` ON `cache_status`.`id`=`c`.`status`
+ WHERE `c`.`user_id`='&1' AND `allow_user_view`='1'
+ GROUP BY `t`.`id`
+ ORDER BY `anzahl` DESC, `t`.`ordinal` ASC",
+ $userid,
+ $opt['template']['locale']);
+ $tpl->assign_rs('userstatshidden', $rs);
+ sql_free_result($rs);
+
+ $rs = sql("SELECT COUNT(*) AS `anzahl`, `t`.`id`, IFNULL(`tt`.`text`, `t`.`name`) AS `cachetype`
+ FROM `cache_logs` AS `l`
+ LEFT JOIN `caches` AS `c` ON `l`.`cache_id`=`c`.`cache_id`
+ LEFT JOIN `cache_type` AS `t` ON `t`.`id`=`c`.`type`
+ LEFT JOIN `sys_trans` AS `st` ON `st`.`id`=`t`.`trans_id` AND `t`.`name`=`st`.`text`
+ LEFT JOIN `sys_trans_text` AS `tt` ON `st`.`id`=`tt`.`trans_id` AND `tt`.`lang`='&2'
+ WHERE `l`.`user_id`='&1' AND (`l`.`type`=1 OR `l`.`type`=7)
+ GROUP BY `t`.`id`
+ ORDER BY `anzahl` DESC, `t`.`ordinal` ASC",
+ $userid,
+ $opt['template']['locale']);
+ $tpl->assign_rs('userstatsfound', $rs);
+ sql_free_result($rs);
+
+ $rs = sql("
+ SELECT
+ COUNT(*) AS `count`,
+ IFNULL(`stt`.`text`, `caches`.`country`) AS `country`,
+ IF(`caches`.`country`='&3' AND `cache_location`.`code1`='&3', `cache_location`.`adm2`, NULL) AS `state`,
+ `caches`.`country` AS `countrycode`,
+ `cache_location`.`code2` AS `adm2code`
+ FROM
+ `cache_logs`
+ INNER JOIN `caches` ON `caches`.`cache_id`=`cache_logs`.`cache_id`
+ INNER JOIN `cache_location` ON `cache_location`.`cache_id`=`cache_logs`.`cache_id`
+ LEFT JOIN `countries` ON `countries`.`short`=`caches`.`country`
+ LEFT JOIN `sys_trans_text` `stt` ON `stt`.`lang`='&2' AND `stt`.`trans_id`=`countries`.`trans_id`
+ WHERE `cache_logs`.`user_id`='&1' AND `cache_logs`.`type` IN (1,7)
+ GROUP BY `country`, `state`
+ ORDER BY `count` DESC, `country`, `state`",
+ $userid, $opt['template']['locale'], $login->getUserCountry());
+
+ $tpl->assign_rs('regionstat', $rs);
+ sql_free_result($rs);
+ }
+
+ // OConly statistics
+ $oconly_hidden = sql_value("
+ SELECT COUNT(*)
+ FROM `caches`
+ INNER JOIN `caches_attributes` ON `caches_attributes`.`cache_id`=`caches`.`cache_id` AND `caches_attributes`.`attrib_id`=6
+ INNER JOIN `cache_status` ON `cache_status`.`id`=`caches`.`status` AND `allow_user_view`=1
+ WHERE `user_id`='&1'",
+ 0, $userid);
+ $oconly_hidden_active = sql_value("
+ SELECT COUNT(*)
+ FROM `caches`
+ INNER JOIN `caches_attributes` ON `caches_attributes`.`cache_id`=`caches`.`cache_id` AND `caches_attributes`.`attrib_id`=6
+ WHERE `user_id`='&1' AND `caches`.`status`=1",
+ 0, $userid);
+ $oconly_recommended = sql_value("
+ SELECT COUNT(*)
+ FROM `cache_logs`
+ INNER JOIN `caches_attributes` ON `caches_attributes`.`cache_id`=`cache_logs`.`cache_id` AND `caches_attributes`.`attrib_id`=6
+ INNER JOIN `cache_rating` ON `cache_rating`.`user_id`=`cache_logs`.`user_id` AND `cache_rating`.`cache_id`=`cache_logs`.`cache_id` AND `cache_rating`.`rating_date`=`cache_logs`.`date`
+ WHERE `cache_logs`.`user_id`='&1' AND `cache_logs`.`type` IN (1,7)",
+ 0, $userid);
+
+ $rs = sql("
+ SELECT
+ COUNT(*) AS `count`,
+ IFNULL(`stt`.`text`, `caches`.`country`) AS `country`,
+ IF(`caches`.`country`='&3' AND `cache_location`.`code1`='&3', `cache_location`.`adm2`, NULL) AS `state`,
+ `caches`.`country` AS `countrycode`,
+ `cache_location`.`code2` AS `adm2code`
+ FROM
+ `cache_logs`
+ INNER JOIN `caches_attributes` ON `caches_attributes`.`cache_id`=`cache_logs`.`cache_id` AND `caches_attributes`.`attrib_id`=6
+ INNER JOIN `caches` ON `caches`.`cache_id`=`cache_logs`.`cache_id`
+ INNER JOIN `cache_location` ON `cache_location`.`cache_id`=`cache_logs`.`cache_id`
+ LEFT JOIN `countries` ON `countries`.`short`=`caches`.`country`
+ LEFT JOIN `sys_trans_text` `stt` ON `stt`.`lang`='&2' AND `stt`.`trans_id`=`countries`.`trans_id`
+ WHERE `cache_logs`.`user_id`='&1' AND `cache_logs`.`type` IN (1,7)
+ GROUP BY `country`, `state`
+ ORDER BY `count` DESC, `country`, `state`",
+ $userid, $opt['template']['locale'], $login->getUserCountry());
+
+ $tpl->assign_rs('oconly_regionstat', $rs);
sql_free_result($rs);
- $rs = sql("SELECT COUNT(*) AS `anzahl`, `t`.`id`, IFNULL(`tt`.`text`, `t`.`name`) AS `cachetype`
- FROM `cache_logs` AS `l`
- LEFT JOIN `caches` AS `c` ON `l`.`cache_id`=`c`.`cache_id`
- LEFT JOIN `cache_type` AS `t` ON `t`.`id`=`c`.`type`
- LEFT JOIN `sys_trans` AS `st` ON `st`.`id`=`t`.`trans_id` AND `t`.`name`=`st`.`text`
- LEFT JOIN `sys_trans_text` AS `tt` ON `st`.`id`=`tt`.`trans_id` AND `tt`.`lang`='&2'
- WHERE `l`.`user_id`='&1' AND (`l`.`type`=1 OR `l`.`type`=7)
- GROUP BY `t`.`id`
- ORDER BY `anzahl` DESC",
- $userid,
- $opt['template']['locale']);
- $tpl->assign_rs('userstatsfound', $rs);
+ $rs = sql("
+ SELECT `cache_logs`.`type`, COUNT(*) AS `count`
+ FROM `cache_logs`
+ INNER JOIN `caches_attributes` ON `caches_attributes`.`cache_id`=`cache_logs`.`cache_id` AND `caches_attributes`.`attrib_id`=6
+ WHERE `user_id`='&1'
+ GROUP BY `cache_logs`.`type`",
+ $userid);
+ $oconly_found = 0;
+ $oconly_dnf = 0;
+ $oconly_note = 0;
+ $oconly_maint = 0;
+ while ($r = sql_fetch_assoc($rs))
+ {
+ switch ($r['type'])
+ {
+ case 1:
+ case 7: $oconly_found += $r['count']; break;
+ case 2: $oconly_dnf = $r['count']; break;
+ case 3: $oconly_note = $r['count']; break;
+ case 9:
+ case 10:
+ case 11:
+ case 13: $oconly_maint += $r['count']; break;
+ }
+ }
sql_free_result($rs);
+ $tpl->assign('oconly_found', $oconly_found);
+ $tpl->assign('oconly_dnf', $oconly_dnf);
+ $tpl->assign('oconly_note', $oconly_note);
+ $tpl->assign('oconly_maint', $oconly_maint);
- $useropt = new useroptions($userid);
- $tpl->assign('show_statistics', ($useropt->getOptValue(USR_OPT_SHOWSTATS) == 1));
+ // OConly detail statistics
+ if ($show_statistics)
+ {
+ $rs = sql("SELECT COUNT(*) AS `anzahl`, `t`.`id`, IFNULL(`tt`.`text`, `t`.`name`) AS `cachetype`
+ FROM `caches` AS `c`
+ LEFT JOIN `cache_type` AS `t` ON `t`.`id`=`c`.`type`
+ LEFT JOIN `sys_trans` AS `st` ON `st`.`id`=`t`.`trans_id` AND `t`.`name`=`st`.`text`
+ LEFT JOIN `sys_trans_text` AS `tt` ON `st`.`id`=`tt`.`trans_id` AND `tt`.`lang`='&2'
+ LEFT JOIN `cache_status` ON `cache_status`.`id`=`c`.`status`
+ INNER JOIN `caches_attributes` ON `caches_attributes`.`cache_id`=`c`.`cache_id` AND `caches_attributes`.`attrib_id`=6
+ WHERE `c`.`user_id`='&1' AND `allow_user_view`='1'
+ GROUP BY `t`.`id`
+ ORDER BY `anzahl` DESC, `t`.`ordinal` ASC",
+ $userid,
+ $opt['template']['locale']);
+ $tpl->assign_rs('oconly_userstatshidden', $rs);
+ sql_free_result($rs);
+
+ $rs = sql("SELECT COUNT(*) AS `anzahl`, `t`.`id`, IFNULL(`tt`.`text`, `t`.`name`) AS `cachetype`
+ FROM `cache_logs` AS `l`
+ LEFT JOIN `caches` AS `c` ON `l`.`cache_id`=`c`.`cache_id`
+ LEFT JOIN `cache_type` AS `t` ON `t`.`id`=`c`.`type`
+ LEFT JOIN `sys_trans` AS `st` ON `st`.`id`=`t`.`trans_id` AND `t`.`name`=`st`.`text`
+ LEFT JOIN `sys_trans_text` AS `tt` ON `st`.`id`=`tt`.`trans_id` AND `tt`.`lang`='&2'
+ INNER JOIN `caches_attributes` ON `caches_attributes`.`cache_id`=`c`.`cache_id` AND `caches_attributes`.`attrib_id`=6
+ WHERE `l`.`user_id`='&1' AND (`l`.`type`=1 OR `l`.`type`=7)
+ GROUP BY `t`.`id`
+ ORDER BY `anzahl` DESC, `t`.`ordinal` ASC",
+ $userid,
+ $opt['template']['locale']);
+ $tpl->assign_rs('oconly_userstatsfound', $rs);
+ sql_free_result($rs);
+ }
+
+ 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['difficulty']] += $r['count'];
+ }
+ sql_free_result($rs);
+ $tpl->assign('stat81',$stat81);
+ $tpl->assign('stat81_maxcount',max(10,$maxcount));
+ $tpl->assign('stat81_tsum', $tsum);
+ }
$tpl->assign('username', $record['username']);
$tpl->assign('userid', $userid);
@@ -117,6 +278,12 @@
$tpl->assign('active', $active);
$tpl->assign('recommended', sql_value("SELECT COUNT(*) FROM `cache_rating` WHERE `user_id`='&1'", 0, $userid));
$tpl->assign('maxrecommended', floor($record['found'] * $opt['logic']['rating']['percentageOfFounds'] / 100));
+ $tpl->assign('show_statistics', $show_statistics);
+ $tpl->assign('show_oconly81', $show_oconly81);
+
+ $tpl->assign('oconly_hidden', $oconly_hidden);
+ $tpl->assign('oconly_hidden_active', $oconly_hidden_active);
+ $tpl->assign('oconly_recommended', $oconly_recommended);
$user = new user($userid);