Location: PHPKode > projects > Prsaar Social Networking Platform > PrsaarColour-0.7.alpha.6.3/pr-admin/option-link.php
<?php
	require_once('admin.php');
	//_________________________________________________________________
	$Display->Title = 'Options';
	$Display->Subtitle = 'Manage links';
	//______________________________________________________________________
	require('./admin-display-header.php');
	
	//Database quries for link page------------
	$Category = $DC->Result("SELECT DISTINCT link_category FROM ".PR_DATABASE_PREFIX."link");
	if($Category != false)
	{
		foreach($Category as $Key => $KeyValue)
		{
			$LinkCategory[$Key] = " <a href='option-link.php?category={$KeyValue['link_category']}' style='font-size:xx-large; text-decoration:underline; color:#0000FF;'> {$KeyValue['link_category']} </a> &nbsp; ";
		}
		$Category = implode(" ", $LinkCategory);
	}
	$Link = $DC->Result("SELECT * FROM ".PR_DATABASE_PREFIX."link");
	//----------------------------------------
	print "<h2> Link Options &raquo; </h2> ".$Category." <hr /> <ul> <li> <a href='option-link-edit.php?action=new'> Add new link </a> </li> <li> <a href='option-link.php'> View all </a> </li> </ul> <hr /> ";
	
	if(isset($_GET['category']))
	{
		$Category2 = $DC->Result("SELECT * FROM ".PR_DATABASE_PREFIX."link WHERE link_category = '{$_GET['category']}'");	
?>
<p> Displaying links from category: <strong><?php _P($_GET['category']); ?> </strong> </p>
<?php
	}
	else
	{
		$Category2 = $DC->Result("SELECT * FROM ".PR_DATABASE_PREFIX."link");
	}
	if($Category2 == false)
	{
		$Link = "<p> no links in this category. </p> <p> <a href='option-link-edit.php?action=new'> Add new link </a> ";
	}
	else
	{
//coloumn headings
?>
<table>
<tr>
	<th> Name </th>
	<th> URL </th>
	<th> Category </th>
	<th colspan="2"> Action </th>
</tr>
<?php
		foreach($Category2 as $Key => $KeyValue)
		{
?>
<tr>
	<td> <?php _P($KeyValue['link_name']); ?> </td>
	<td><a href='<?php _P($KeyValue['link_url']); ?>'> <?php _P($KeyValue['link_url']); ?> </a> </td>
	<td> <?php _P($KeyValue['link_category']); ?> </td>
	<td> <a href='option-link-update.php?action=link_delete&id=<?php _P($KeyValue['link_id']); ?>' >Delete</a> </td>
	<td> <a href='option-link-edit.php?action=edit&id=<?php _P($KeyValue['link_id']); ?>'>Edit</a> </td>
</tr>
<?php
		}
?>
</table>
<?php
	}
	
_foot();
?>
Return current item: Prsaar Social Networking Platform