1<?php
2/* This script shows the trend in exchange rates as retrieved from ECB. */
3
4include('includes/session.php');
5$Title = _('View Currency Trend');
6$ViewTopic= 'Currencies';
7$BookMark = 'ExchangeRateTrend';
8include('includes/header.php');
9
10$FunctionalCurrency = $_SESSION['CompanyRecord']['currencydefault'];
11
12if ( isset($_GET['CurrencyToShow']) ){
13	$CurrencyToShow = $_GET['CurrencyToShow'];
14} elseif ( isset($_POST['CurrencyToShow']) ) {
15	$CurrencyToShow = $_POST['CurrencyToShow'];
16}
17
18// ************************
19// SHOW OUR MAIN INPUT FORM
20// ************************
21
22	echo '<form method="post" id="update" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">';
23    echo '<div>';
24	echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
25	echo '<p class="page_title_text"><img alt="" src="', $RootPath, '/css/', $Theme,
26		'/images/currency.png" title="', // Icon image.
27		_('View Currency Trend'), '" /> ', // Icon title.
28		_('View Currency Trend'), '</p>';// Page title.
29	echo '<table>'; // First column
30
31	$SQL = "SELECT currabrev FROM currencies";
32	$result=DB_query($SQL);
33	include('includes/CurrenciesArray.php'); // To get the currency name from the currency code.
34
35	// CurrencyToShow Currency Picker
36	echo '<tr>
37			<td><select name="CurrencyToShow" onchange="ReloadForm(update.submit)">';
38
39	DB_data_seek($result, 0);
40	while ($myrow=DB_fetch_array($result)) {
41		if ($myrow['currabrev']!=$_SESSION['CompanyRecord']['currencydefault']){
42			echo '<option';
43			if ( $CurrencyToShow==$myrow['currabrev'] )	{
44				echo ' selected="selected"';
45			}
46			echo ' value="' . $myrow['currabrev'] . '">' . $CurrencyName[$myrow['currabrev']] . ' (' . $myrow['currabrev'] . ')</option>';
47		}
48	}
49	echo '</select></td>
50		</tr>
51		</table>
52		<br />
53		<div class="centre">
54			<input type="submit" name="submit" value="' . _('Accept') . '" />
55		</div>
56	</div>
57	</form>';
58
59// **************
60// SHOW OUR GRAPH
61// **************
62	$image = 'http://www.google.com/finance/getchart?q=' . $FunctionalCurrency . $CurrencyToShow . '&amp;x=CURRENCY&amp;p=3M&amp;i=86400';
63
64	echo '<br />
65		<table class="selection">
66		<tr>
67			<th>
68				<div class="centre">
69					<b>' . $FunctionalCurrency . ' / ' . $CurrencyToShow . '</b>
70				</div>
71			</th>
72		</tr>
73		<tr>
74			<td><img src="' . $image . '" alt="' ._('Trend Currently Unavailable') . '" /></td>
75		</tr>
76		</table>';
77
78include('includes/footer.php');
79?>
80