<?php
require_once('./admin.php');
$Display->Title = 'Profile';
$Display->Subtitle = 'Browse Categories';
require('./admin-display-header.php');
if(!empty($_GET['category']))
{
$Category = $_GET['category'];
?>
<h2> Category: "<?php echo $Category; ?>" </h2>
<p>
<a href="./profile-category.php">View all categories.</a> <br />
<a href="./profile-new.php?category=<?php _p($Category); ?>">Add profile element.</a>
</p>
<?php
$GetData = $DC->Result('SELECT * FROM '.PR_DATABASE_PREFIX."profile WHERE profile_category = '{$Category}'");
if($GetData === false)
{
die('the category you specified does not exists, <a href=\'./profile.php\'>Go back to Profile General</a>');
}
?>
<table cellspacing="4px">
<?php
foreach($GetData as $Key => $Value)
{
print " <tr>
<td width='auto' bgcolor='#3371A3'> <strong> {$Value['profile_name']}» </strong> </td>
<td width='70%' bgcolor='#6DA6D1'> {$Value['profile_value']} </td>
<td bgcolor='#3371A3'> <a href='profile-edit.php?id={$Value['profile_id']}' style='color:black'>Edit</a> </td>
<td bgcolor='#6DA6D1'> <a href='profile-edit-update.php?action=delete&id={$Value['profile_id']}' style='color:black'>Delete</a> </td>
</tr> ";
}
print " </table> ";
}
//if no category selected
else
{
$Categories = $DC->Result('SELECT DISTINCT profile_category FROM '.PR_DATABASE_PREFIX.'profile');
?>
<h2> Manage Categories » </h2>
<?php
if($Categories == false)
die('No categories yet <a href="profile-new.php">Create new profile element</a> </body> </html>');
?>
<ol>
<?php
foreach($Categories as $Key => $KeyValue)
{
print " <li> <a href='profile-category.php?category={$KeyValue['profile_category']}'>{$KeyValue['profile_category']}</a> </li> ";
}
print " </ol> ";
}
?>
<?php require('./admin-display-footer.php'); ?>