added 'more events' link on start page; update #208
This commit is contained in:
parent
1df52c4914
commit
e32f482f66
@ -2599,6 +2599,7 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2171', 'Please
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2172', 'Yes, I want to recieve mailings about news and actions on opencaching.de. (max. 2-5 per year)', '2013-11-03 10:09:14');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2173', 'No, I dont\'t want any mailings about news and actions on opencaching.de.', '2013-11-03 10:09:14');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2174', 'Newsletter:', '2013-11-03 10:09:14');
|
||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2176', 'Planned events', '2013-11-03 10:09:14');
|
||||
|
||||
-- Table sys_trans_ref
|
||||
SET NAMES 'utf8';
|
||||
@ -6687,6 +6688,7 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2172', 'DE', 'Ja, ich möchte Informationen zu Neuigkeiten und Aktionen auf opencaching.de per Email erhalten. (max. 2-5 pro Jahr)', '2013-11-03 10:09:14');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2173', 'DE', 'Nein, ich möchte keine Informationen zu Neuigkeiten und Aktionen auf opencaching.de per Email erhalten.', '2013-11-03 10:09:14');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2174', 'DE', 'Newsletter:', '2013-11-03 10:09:14');
|
||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2176', 'DE', 'Geplante Events', '2013-11-03 10:09:14');
|
||||
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');
|
||||
|
@ -97,6 +97,9 @@
|
||||
|
||||
// get newest events
|
||||
$tpl->assign_rs('events', $getNew->rsForSmarty('event'));
|
||||
// get total event count for all countries
|
||||
$tpl->assign('total_events', sql_value_slave(
|
||||
"SELECT COUNT(*) FROM `caches` WHERE `type`=6 AND `date_hidden` >= curdate() AND `status`=1", 0));
|
||||
|
||||
// get newest caches
|
||||
$tpl->assign_rs('newcaches', $getNew->rsForSmarty('cache'));
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
$startat = isset($_REQUEST['startat']) ? $_REQUEST['startat']+0 : 0;
|
||||
$country = isset($_REQUEST['country']) ? $_REQUEST['country'] : '';
|
||||
$cachetype = isset($_REQUEST['cachetype']) ? $_REQUEST['cachetype']+0 : 0;
|
||||
$bEvents = ($cachetype == 6);
|
||||
|
||||
$perpage = 100;
|
||||
$startat -= $startat % $perpage;
|
||||
@ -27,12 +29,16 @@
|
||||
{
|
||||
require($opt['rootpath'] . 'lib2/logic/cacheIcon.inc.php');
|
||||
|
||||
$cachetype_condition = ($cachetype ? " AND `caches`.`type` = " . sql_escape($cachetype) : "");
|
||||
if ($bEvents)
|
||||
$cachetype_condition .= " AND `date_hidden` >= curdate()";
|
||||
$date_field = ($bEvents ? 'date_hidden' : 'date_created');
|
||||
$newCaches = array();
|
||||
|
||||
$rsNewCaches = sql_slave(
|
||||
"SELECT `caches`.`cache_id` `cacheid`, `caches`.`wp_oc` `wpoc`,
|
||||
`caches`.`name` `cachename`, `caches`.`type`, `caches`.`country` `country`,
|
||||
`caches`.`date_created` `date_created`,
|
||||
`caches`.`$date_field` `date_created`,
|
||||
IFNULL(`sys_trans_text`.`text`,`countries`.`en`) AS `country_name`,
|
||||
`user`.`user_id` `userid`, `user`.`username` `username`,
|
||||
`ca`.`attrib_id` IS NOT NULL AS `oconly`
|
||||
@ -42,7 +48,8 @@
|
||||
LEFT JOIN `sys_trans_text` ON `sys_trans_text`.`trans_id` = `countries`.`trans_id`
|
||||
AND `sys_trans_text`.`lang` = '" . sql_escape($opt['template']['locale']) . "'
|
||||
LEFT JOIN `caches_attributes` `ca` ON `ca`.`cache_id`=`caches`.`cache_id` AND `ca`.`attrib_id`=6
|
||||
WHERE `caches`.`status` = 1" . ($country ? " AND `caches`.`country`='" . sql_escape($country) . "'" : "") . "
|
||||
WHERE `caches`.`status` = 1" . ($country ? " AND `caches`.`country`='" . sql_escape($country) . "'" : "") .
|
||||
$cachetype_condition . "
|
||||
ORDER BY `caches`.`date_created` DESC
|
||||
LIMIT " . ($startat+0) . ', ' . ($perpage+0));
|
||||
// see also write_newcaches_urls() in sitemap.class.php
|
||||
@ -52,15 +59,16 @@
|
||||
$tpl->assign('newCaches', $newCaches);
|
||||
|
||||
$startat = isset($_REQUEST['startat']) ? $_REQUEST['startat']+0 : 0;
|
||||
$cacheype_par = ($cachetype ? "&cachetype=$cachetype" : "");
|
||||
if ($country == '')
|
||||
{
|
||||
$count = sql_value_slave("SELECT COUNT(*) FROM `caches` WHERE `caches`.`status`=1", 0);
|
||||
$pager = new pager("newcaches.php?startat={offset}");
|
||||
$count = sql_value_slave("SELECT COUNT(*) FROM `caches` WHERE `caches`.`status`=1" . $cachetype_condition, 0);
|
||||
$pager = new pager("newcaches.php?startat={offset}" . $cacheype_par);
|
||||
}
|
||||
else
|
||||
{
|
||||
$count = sql_value_slave("SELECT COUNT(*) FROM `caches` WHERE `caches`.`status`=1 AND `caches`.`country`='&1'", 0, $country);
|
||||
$pager = new pager("newcaches.php?country=".$country."&startat={offset}");
|
||||
$count = sql_value_slave("SELECT COUNT(*) FROM `caches` WHERE `caches`.`status`=1 AND `caches`.`country`='&1'" . $cachetype_condition, 0, $country);
|
||||
$pager = new pager("newcaches.php?country=".$country."&startat={offset}" . $cacheype_par);
|
||||
}
|
||||
$pager->make_from_offset($startat, $count, 100);
|
||||
|
||||
@ -77,6 +85,8 @@
|
||||
WHERE `countries`.`short`='&1'", '', $country, $opt['template']['locale'])
|
||||
);
|
||||
}
|
||||
|
||||
$tpl->assign('events', $bEvents);
|
||||
}
|
||||
|
||||
$tpl->display();
|
||||
|
@ -6,7 +6,7 @@
|
||||
{* OCSTYLE *}
|
||||
<div class="content2-pagetitle">
|
||||
<img src="resource2/{$opt.template.style}/images/cacheicon/traditional.gif" style="align: left; margin-right: 10px;" width="32" height="32" alt="" />
|
||||
{if $countryCode == ''}{t}Latest caches{/t}{else}{t 1=$countryName|escape}Newest caches in %1{/t}{/if}
|
||||
{if $events}{t}Planned events{/t}{elseif $countryCode == ''}{t}Latest caches{/t}{else}{t 1=$countryName|escape}Newest caches in %1{/t}{/if}
|
||||
</div>
|
||||
|
||||
<table width="100%" class="table">
|
||||
|
@ -68,6 +68,9 @@
|
||||
<p class="content-title-noshade-size3">
|
||||
<img src="resource2/{$opt.template.style}/images/cacheicon/event.gif" style="align: left; margin-right: 10px;" width="24" height="24" alt="" />
|
||||
{t 1=$usercountry|escape}The next events in %1{/t}
|
||||
{if $total_events > $events|@count}
|
||||
<span class="content-title-link">[<a href="newcaches.php?cachetype=6">{t}more{/t}...</a>]</span>
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
<div class="content2-section-no-p">
|
||||
|
Loading…
x
Reference in New Issue
Block a user