Location: PHPKode > projects > iLP System > Release 2.2/upload/lib/templates/tpl.search.php
<?php
/**
 * iLP System Template: Suche (Frontend)
 * 
 * Autor:		Florian "ApoY2k" Peschka
 * Projekt:		iLP System
 * Paket:		apoy2k.ilp.wrynn.lib.tpl
 * Lizenz:		CreativeCommons (by-nc-sa)
 * Kontakt:		hide@address.com
 * Version:		2.1.1
 */

// Search form
if (!isset($tpl['url'][1]) || 'show' == $tpl['url'][1])
{
	echo '<h1>'.$lang['search']['navi']['home'].'</h1>
		<p>
			'.$lang['search']['home']['text'].'
		</p>
		<div id="errorMessage" class="warning">
			<h1><img src="images/icons/error.png" alt="icon" /> '.$lang['error']['header'].'</h1>
			<ul>
				<li><span class="note">'.$lang['error']['note'].'</span></li>
			</ul>
		</div>
		<form method="post" action="?ilp='.ilpUrlEncode('search;item;do').'" id="itemsearch">
			<fieldset>
				<legend><img src="images/icons/magnifier.png" alt="icon" /> '.$lang['search']['home']['header'].'</legend>
				<div class="inputGroup">
					<div class="inputField" id="searchField">
						<input type="text" id="searchitem_term" name="searchitem_term" />
						<div class="inputDesc">
							<label for="searchitem_term">
								'.$lang['search']['home']['desc'].'<br />'.$lang['page']['itemidnote'].'
							</label>
						</div>
					</div>
				</div>
			</fieldset>
			<div>
				<input type="submit" value="'.$lang['search']['navi']['home'].'" />
			</div>
		</form>';
}

// Search results
elseif (isset($tpl['url'][1]))
{
	
	// Search item
	if ('item' == $tpl['url'][1])
	{
		echo '<h1><a href="?ilp='.ilpUrlEncode('search').'">'.$lang['search']['navi']['home'].'</a> | '.$lang['search']['navi']['items'].' <em>&quot;'.$tpl['search']['term'].'&quot;</em></h1>';
	
		if (isset($tpl['search']['list'][0]))
		{
			echo '<p>
					'.$lang['search']['results']['list'].':
				</p>
				<fieldset>
					<legend><img src="images/icons/magnifier.png" alt="icon" /> Auf Listen gefunden</legend>
					<table cellpadding="0" cellspacing="1" border="0" class="itemlist">
						<thead>
							<tr>
								<th>
									'.$lang['list']['player'].'
								</th>
								<th>
									'.$lang['list']['item'].'
								</th>
								<th>
									'.$lang['list']['points'].'
								</th>
							</tr>
						</thead>
						<tbody>';
			
			foreach ($tpl['search']['list'] as $row)
			{
				// Charakterstring in Array umwandeln
				$row['char'] = unserialize($row['char']);
				
				echo '<tr>
						<td>
							<img src="images/icons/'.$row['char']['class'].'.png" alt="wowicon" /><img src="images/icons/'.$row['char']['class'].$row['char']['spec'].'.png" alt="wowicon" /> <a href="?ilp='.ilpUrlEncode('search;user;'.$row['user_id']).'" rel="'.getSafeURL('http://armorylite.com/'.$_SESSION['config']['guild_region'].'/'.$_SESSION['config']['guild_realm'].'/'.$row['char']['name']).'" class="class-'.$row['char']['class'].'">'.$row['char']['name'].'</a>
						</td>
						<td>
							'.getWowheadLink($row['item_id'], $lang['tooltip_locale']).'
						</td>
						<td>
							'.$row['item_value'].'
						</td>
					</tr>';
			}
			
			echo '</tbody>
				</table>
				</fieldset>';
		}
		
		if (isset($tpl['search']['loot'][0]))
		{
			echo '<p>
					'.$lang['search']['results']['loot'].':
				</p>
				<fieldset>
					<legend><img src="images/icons/magnifier.png" alt="icon" /> In Ereignissen gefunden</legend>
					<table cellpadding="0" cellspacing="1" border="0" class="lootlist">
						<thead>
							<tr>
								<th>
									'.$lang['list']['player'].'
								</th>
								<th>
									'.$lang['list']['event'].'
								</th>
								<th>
									'.$lang['list']['date'].'
								</th>
								<th>
									'.$lang['list']['item'].'
								</th>
								<th>
									'.$lang['list']['points'].'
								</th>
							</tr>
						</thead>
						<tbody>';
			
			foreach ($tpl['search']['loot'] as $row)
			{
				// Charakterstring in Array umwandeln
				$row['char'] = unserialize($row['char']);
				
				echo '<tr>
						<td>
							<img src="images/icons/'.$row['char']['class'].'.png" alt="wowicon" /><img src="images/icons/'.$row['char']['class'].$row['char']['spec'].'.png" alt="wowicon" /> <a href="?ilp='.ilpUrlEncode('search;user;'.$row['looter_id']).'" rel="'.getSafeURL('http://armorylite.com/'.$_SESSION['config']['guild_region'].'/'.$_SESSION['config']['guild_realm'].'/'.$row['char']['name']).'" class="class-'.$row['char']['class'].'">'.$row['char']['name'].'</a>
						</td>
						<td>
							<a href="?ilp='.ilpUrlEncode('start;events;detail;'.$row['event_id']).'">'.$row['name'].'</a>
						</td>
						<td>
							'.$row['date'].'
						</td>
						<td>
							'.getWowheadLink($row['item_id'], $lang['tooltip_locale']).'
						</td>
						<td>
							'.$row['value'].'
						</td>
					</tr>';
			}
			
			echo '</table>
				</fieldset>';
		}
	}
	
	// User profile
	elseif ('user' == $tpl['url'][1])
	{
		echo '<h1>'.$lang['search']['user']['header'].' '.$tpl['search']['user']['char']['name'].'</h1>
		<div id="statistics">
			'.$tpl['search']['user']['charinfo'].'
			<div id="stats">
				<b>'.$lang['statistics']['attendance'].':</b> <span class="percent ';
				
				if (33 >= $tpl['search']['user']['stats']['attendance'])
				{
					echo 'low';
				}
				elseif (66 >= $tpl['search']['user']['stats']['attendance'])
				{
					echo 'middle';
				}
				else {
					echo 'high';
				}
				
				echo '" style="float: right;">'.getProgressBar(100, $tpl['search']['user']['stats']['attendance']).' '.$tpl['search']['user']['stats']['attendance'].'%</span><br />
				<b>'.$lang['statistics']['ninja'].':</b> <span class="percent ';
				
				if (33 >= $tpl['search']['user']['stats']['ninja'])
				{
					echo 'low';
				}
				elseif (66 >= $tpl['search']['user']['stats']['ninja'])
				{
					echo 'middle';
				}
				else {
					echo 'high';
				}
				
				echo '" style="float: right;">'.getProgressBar(100, $tpl['search']['user']['stats']['ninja']).' '.$tpl['search']['user']['stats']['ninja'].'%</span><br />
				<b>'.$lang['statistics']['tea'].':</b><span class="percent ';
				
				if (33 >= $tpl['search']['user']['stats']['tea'])
				{
					echo 'low';
				}
				elseif (66 >= $tpl['search']['user']['stats']['tea'])
				{
					echo 'middle';
				}
				else {
					echo 'high';
				}
				
				echo '" style="float: right;">'.getProgressBar(100, $tpl['search']['user']['stats']['tea']).' '.$tpl['search']['user']['stats']['tea'].'%</span><br />
				<b>'.$lang['statistics']['events'].':</b> '.$tpl['search']['user']['stats']['event_count'].'<br />
				<b>'.$lang['statistics']['loot'].':</b> '.$tpl['search']['user']['stats']['loot_count'].'<br />
				<b>'.$lang['statistics']['gained'].':</b> '.$tpl['search']['user']['stats']['event_value'].'<br />
				<b>'.$lang['statistics']['spent'].':</b> '.$tpl['search']['user']['stats']['loot_value'].'
			</div>
		</div>
		<table class="itemlist" cellpadding="0" cellspacing="1" border="0">
			<thead>
				<tr>
					<th>
						'.$lang['list']['item'].'
					</th>
					<th>
						'.$lang['list']['points'].'
					</th>
				</tr>
			</thead>
			<tbody>';
	
		if (1 <= count($tpl['search']['user']['list']))
		{
			foreach ($tpl['search']['user']['list'] as $row)
			{
				echo '<tr>
						<td>
							'.getWowHeadLink($row['item_id'], $lang['tooltip_locale']).'
						</td>
						<td>
							'.$row['item_value'].'
						</td>
					</tr>';
			}
		}
		else
		{
			echo '<tr>
					<td colspan="2" class="info">
						'.$lang['error']['noitems']['text'].'
					</td>
				</tr>';
		}
		
		echo '
				</tbody>
			</table>
			<fieldset>
				<legend><img src="images/icons/magnifier.png" alt="icon" /> '.$tpl['search']['user']['char']['name'].' '.$lang['search']['user']['events'].'</legend>
				<div class="blocklist eventList">';
		
			foreach ($tpl['search']['user']['events'] as $row)
			{
				echo '<a href="?ilp='.ilpUrlEncode('start;events;detail;'.$row['event_id']).'">
						<img src="images/icons/'.$row['icon'].'" />
						<span>
							<b>'.$row['name'].'</b><br />
							<span class="note">'.$row['date'].'</span>
						</span>
					</a>';
			}
			
			echo '</div>
				</fieldset>
				<fieldset>
					<legend><img src="images/icons/magnifier.png" alt="icon" /> '.$tpl['search']['user']['char']['name'].' '.$lang['search']['user']['loots'].'</legend>
					<table cellpadding="0" cellspacing="1" border="0" class="lootlist">
						<thead>
							<tr>
								<th>
									'.$lang['list']['event'].'
								</th>
								<th>
									'.$lang['list']['date'].'
								</th>
								<th>
									'.$lang['list']['item'].'
								</th>
								<th>
									'.$lang['list']['points'].'
								</th>
							</tr>
						</thead>
						<tbody>';
				
				if (1 <= count($tpl['search']['user']['loots']))
				{
					foreach ($tpl['search']['user']['loots'] as $row)
					{
						echo '<tr>
								<td>
									<a href="?ilp='.ilpUrlEncode('start;events;detail;'.$row['event_id']).'">'.$row['name'].'</a>
								</td>
								<td>
									'.$row['date'].'
								</td>
								<td>
									'.getWowheadLink($row['item_id'], $lang['tooltip_locale']).'
								</td>
								<td>
									'.$row['value'].'
								</td>
							</tr>';
					}
				}
				else
				{
					echo '<tr>
							<td colspan="4" class="info">
								'.$lang['error']['noloot']['text'].'
							</td>
						</tr>';
				}
		echo '</tbody>
			</table>
		</fieldset>';
	}
}

if (isset($tpl['search']['error']) && 2 == $tpl['search']['error'])
{
	echo '<div class="info">
			<h1>'.$lang['search']['error']['header'].'</h1>
			<p>
				'.$lang['search']['error']['text'].'
			</p>
			<p>
				<a href="?ilp='.ilpUrlEncode('search').'">&lt;&lt; '.$lang['page']['back'].'</a>
			</p>
		</div>';
}
?>
Return current item: iLP System