Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

Commit

Permalink
event: pdgaUrl if pdgaEventId is set
Browse files Browse the repository at this point in the history
  • Loading branch information
tuminoid committed Feb 4, 2015
1 parent 3ccc091 commit 529b151
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 12 deletions.
9 changes: 9 additions & 0 deletions core/event.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,15 @@ function FeesRequired()
// of changing all the constructor calls.
return EventRequiresFees($this->id);
}

/**
* Returns URL to PDGA if EventId is set, null otherwise
*/
function getPDGAUrl()
{
if ($this->pdgaEventId)
return "http://www.pdga.com/tour/event/" . $this->pdgaEventId;
}
}

/* *****************************************************************************
Expand Down
6 changes: 6 additions & 0 deletions templates/eventviews/index.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
<td id="contactInfo"><div style="font-family: monospace">{$contactInfoHTML}</div></td>
</tr>

{if $pdgaUrl}
<tr>
<td>{translate id=event_pdga_url}</td>
<td><a href="{$pdgaUrl}">{$pdgaUrl}</a></td>
</tr>
{/if}



Expand Down
7 changes: 6 additions & 1 deletion templates/eventviews/leaderboard.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{**
* Suomen Frisbeegolfliitto Kisakone
* Copyright 2009-2010 Kisakone projektiryhmä
* Copyright 2013 Tuomo Tanskanen <tuomo@tanskanen.org>
* Copyright 2013-2015 Tuomo Tanskanen <tuomo@tanskanen.org>
*
* Leaderboard
*
Expand Down Expand Up @@ -72,6 +72,11 @@
{$page->formattedText}
</div>

{if $pdgaUrl}
<div id="pdga_link">
<a href="{$pdgaUrl}">{translate id=event_pdga_results_url}</a>
</div>
{/if}

{assign var=extrahead value=$xtrahead}
<p class="preliminary" style="display: none">
Expand Down
10 changes: 9 additions & 1 deletion templates/eventviews/results.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{**
* Suomen Frisbeegolfliitto Kisakone
* Copyright 2009-2010 Kisakone projektiryhmä
* Copyright 2013-2014 Tuomo Tanskanen <tuomo@tanskanen.org>
* Copyright 2013-2015 Tuomo Tanskanen <tuomo@tanskanen.org>
*
* Results and live results
*
Expand Down Expand Up @@ -106,12 +106,20 @@
min-width: 16px;
}

#pdga_link {
padding: 1em;
}
{/literal}</style>
{else}
<div id="event_content">
{$page->formattedText}
</div>

{if $pdgaUrl}
<div id="pdga_link">
<a href="{$pdgaUrl}">{translate id=event_pdga_results_url}</a>
</div>
{/if}

<table class="round_selection_table narrow" >
{foreach from=$classes key=classid item=class}
Expand Down
15 changes: 5 additions & 10 deletions ui/event.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function InitializeSmartyVariables(&$smarty, $error)
$smarty->assign('contactInfoHTML', $ci_html);
$smarty->assign('contactInfoJS', $ci_js);
$smarty->assign('rounds', $event->GetRounds());
$smarty->assign('pdgaUrl', $event->getPDGAUrl());

if ($user) {
$player = $user->GetPlayer();
Expand All @@ -82,23 +83,21 @@ function InitializeSmartyVariables(&$smarty, $error)
$smarty->assign('index_schedule_text', $index_schedule_content);
break;


case 'competitors':
$view = 'competitors';
language_include('users');
$participants = $event->GetParticipants(@$_GET['sort'], @$_GET['search']);
$smarty->assign('participants', $participants);
$smarty->assign('pdgaUrl', $event->getPDGAUrl());
break;


case 'queue':
$view = 'queue';
language_include('users');
$queue = $event->GetQueue(@$_GET['sort'], @$_GET['search']);
$smarty->assign('queue', $queue);
break;


case 'quotas':
$view = 'quotas';
$smarty->assign('playerlimit', $event->playerLimit);
Expand All @@ -107,7 +106,6 @@ function InitializeSmartyVariables(&$smarty, $error)
$smarty->assign('queues', GetEventQueueCounts($event->id));
break;


case 'schedule':
$view = 'schedule';
$rounds = $event->GetRounds();
Expand All @@ -119,21 +117,18 @@ function InitializeSmartyVariables(&$smarty, $error)
$smarty->assign('allow_print', IsAdmin() || $event->management != '');
break;


case 'course':
$view = 'course';
$smarty->assign('courses', pdr_GetCourses($event));
break;


case 'cancelsignup':
$view = 'cancelsignup';
$smarty->assign('signupOpen', $event->SignupPossible());
$smarty->assign('paid', $event->eventFeePaid);
$smarty->assign('queued', $event->GetPlayerStatus($user->player) == 'queued');
break;


case 'signupinfo':
$view = 'signupinfo';
$smarty->assign('classes', $event->GetClasses());
Expand All @@ -149,7 +144,6 @@ function InitializeSmartyVariables(&$smarty, $error)
}
break;


case 'payment':
$view = 'payment';
$smarty->assign('classes', $event->GetClasses());
Expand All @@ -159,19 +153,19 @@ function InitializeSmartyVariables(&$smarty, $error)
$smarty->assign('queued', $event->GetPlayerStatus($user->player) == 'queued');
break;


case 'newsarchive':
$view = 'newsarchive';
$smarty->assign('news', $event->GetNews(0, 9999));
break;


case 'results':
case 'liveresults':
$view = 'results';
$rounds = $event->GetRounds();
$smarty->assign('classes', $event->GetClasses());
$smarty->assign('rounds', $rounds);
$smarty->assign('pdgaUrl', $event->getPDGAUrl());

$roundnum = @$_GET['round'];
if (!$roundnum)
$roundnum = 1;
Expand Down Expand Up @@ -200,6 +194,7 @@ function InitializeSmartyVariables(&$smarty, $error)
$view = 'leaderboard';
$results_tmp = GetEventResultsWithoutHoles($event->id);
$results = pdr_GroupByClasses($results_tmp);
$smarty->assign('pdgaUrl', $event->getPDGAUrl());

$scoresAssigned = null;
foreach ($results as $class) {
Expand Down
2 changes: 2 additions & 0 deletions ui/languages/fi-FI/events
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ event_official Toimitsija
event_add_official Lisää toimitsija
event_pdga PDGA asetukset
event_pdga_id Kilpailunumero
event_pdga_url Kilpailu PDGA:n sivuilla
event_pdga_results_url Kilpailun tulokset ja ratingit PDGA:n sivuilla


round_start_time Kierroksen ajankohta
Expand Down

0 comments on commit 529b151

Please sign in to comment.