Location: PHPKode > projects > Protoforge > protoforge_v1.2/protoforge/user_resources/User_Resource.php
<?php $deb = false;
require_once('../config.inc.php');

session_start();

$uid = '';
if (isset($_SESSION['user'])) {
	$uid = $_SESSION['user']->get_user_id();
}

$User_Resource = new User_Resource();
try {
	if (isset($_GET['id']) && (trim($_GET['id']) != "")) {
		if (require_once(PF_BASE.'connect.php'))
			$link = connect();
		$User_Resource->dbPopulate($_GET['id'],$link);
		//echo $User_Resource->toString().'<br/>';
		if ($User_Resource->is_error())
			throw new Exception($User_Resource->get_error_string());
	} else {
		throw new Exception( 'No User Resource selected.<br/><a href="index.php">Search User Resources</a>' );
	}
} catch (Exception $e) {
	$pfutil = new PFUtil();
	$pfutil->error_page( $e->getMessage() );
}

$User = new User();
$User->dbPopulate($User_Resource->get_user_id(),$link);

$pageTitle=PF_SITENAME.' Resource';
require(PF_BASE.'Header.php');
?>
	<?php include(PF_BASE.'users/user_menu.php'); ?>
	<table border="0" width="100%" cellpadding="5" cellspacing="0">
		<tr class="action">
			<td class="oi" align="left" width="16">
				<img class="icon" src="<?php echo PF_ROOT;?>images/package.png"/>
			</td>
			<td class="action" align="right">
				<?php if ($User_Resource->get_user_id() == $uid) { ?>
					<a class="action" href="edit_User_Resource.php?id=<?php echo $User_Resource->get_user_res_id();?>&redirect=<?php echo urlencode($_SERVER['REQUEST_URI']);?>&">
						<img class="icon" title="Edit" src="<?php echo PF_ROOT;?>images/edit.png"/>
						Edit</a>
					&nbsp;&nbsp;
					<a class="action" href="delete_User_Resource.php?id=<?php echo $User_Resource->get_user_res_id();?>&">
						<img class="icon" title="Delete" src="<?php echo PF_ROOT;?>images/delete.png"/>
						Delete</a>
					&nbsp;&nbsp;
				<?php } ?>
				<a class="action" href="<?php echo PF_ROOT;?>linklist_add.php?ot=User_Resource&id1=<?php echo $User_Resource->get_user_res_id();?>&">
					<img class="icon" title="Add to link list" src="<?php echo PF_ROOT;?>images/link.png"/>
					Link</a>
				&nbsp;&nbsp;
			</td>
		</tr>
	</table>
	<table border="0" cellpadding="5" cellspacing="0" width="100%">
		<tr class="title">
			<td class="title bBorderBlack" align="center">
				Personal Resource
			</td>
		</tr>
	</table>
	<?php include(PF_INCLUDE.'ttt.php'); ?>
	<br/>


<table border="0" cellpadding="0" cellspacing="0">
	<tr class="round1" height="16">
		<td width="16" height="16"><img src="<?php echo PF_ROOT;?>images/corners/1tl.gif"/></td>
		<td><font size="1">&nbsp;</font></td>
		<td width="16" height="16"><img src="<?php echo PF_ROOT;?>images/corners/1tr.gif"/></td>
	</tr>
	<tr class="round1">
		<td width="16"><font size="1">&nbsp;</font></td>
		<td align="center">

	<table border="0" width="100%" cellpadding="5" cellspacing="0">
		<tr>
			<td width="25%" class="result" align="right" valign="top">
				<a class="ott" href="javascript:showTooltip('user_resources','TITLE');">
					Title:</a>
			</td>
			<td width="75%" class="result" align="left">
				<?php echo $User_Resource->get_title();?>
			</td>
		</tr>
		<tr>
			<td width="25%" class="result" align="right" valign="top">
				<a class="ott" href="javascript:showTooltip('user_resources','USER_ID');">
					Owner:</a>
			</td>
			<td width="75%" class="result" align="left">
				<a class="result" href="<?php echo PF_ROOT;?>users/User.php?id=<?php echo $User_Resource->get_user_id();?>&">
					<img class="icon" title="" src="<?php echo PF_ROOT.'images/ui/'.$User_Resource->user_icon;?>.png"/>
					<?php echo $User_Resource->user_username;?></a>
			</td>
		</tr>
		<tr>
			<td width="25%" class="result" align="right" valign="top">
				<a class="ott" href="javascript:showTooltip('user_resources','STATUS_ID');">
					Status:</a>
			</td>
			<td width="75%" class="result" align="left">
				<?php echo $User_Resource->resource_status_status;?>
			</td>
		</tr>
		<tr>
			<td width="25%" class="result" align="right" valign="top">
				<a class="ott" href="javascript:showTooltip('user_resources','RES_TYPE_ID');">
					Type:</a>
			</td>
			<td width="75%" class="result" align="left">
				<?php echo $User_Resource->resource_type_res_type;?>
			</td>
		</tr>
	</table>

		</td>
		<td width="16"><font size="1">&nbsp;</font></td>
	</tr>
	<tr class="round1" height="16">
		<td width="16" height="16"><img src="<?php echo PF_ROOT;?>images/corners/1bl.gif"/></td>
		<td><font size="1">&nbsp;</font></td>
		<td width="16" height="16"><img src="<?php echo PF_ROOT;?>images/corners/1br.gif"/></td>
	</tr>
</table>
<br/>
<?php if (!is_null($User_Resource->get_description())) { ?>
	<table border="0" width="100%" cellpadding="5" cellspacing="0">
		<tr>
			<td align="left">
				<a class="ott" href="javascript:showTooltip('user_resources','DESCRIPTION');">
					Description:</a>
				<hr>
				<?php echo (is_null($User_Resource->get_description()) ?  '&nbsp;' : $User_Resource->get_description() );?>
			</td>
		</tr>
	</table>
<?php } ?>
<br/>
<?php
	$comment_query = 'SELECT ';
	$comment_query .='  `user_resource_comments`.`COMMENT` as COMMENT, ';
	$comment_query .='  `user_resource_comments`.USER_RES_ID as USER_RES_ID, ';
	$comment_query .='  `user_resource_comments`.USER_ID as USER_ID, ';
	$comment_query .='  `user_resource_comments`.USER_RES_COM_ID as USER_RES_COM_ID, ';
	$comment_query .='  `users`.USERNAME as USERNAME, ';
	$comment_query .='  `users`.ICON as ICON ';
	$comment_query .='FROM ';
	$comment_query .='  `user_resource_comments` ';
	$comment_query .='  INNER JOIN `users` ON (`user_resource_comments`.USER_ID = `users`.USER_ID) ';
	$comment_query .='WHERE ';
	$comment_query .='  (`user_resource_comments`.USER_RES_ID = '.$User_Resource->get_user_res_id().') ';
	$comment_query .='ORDER BY ';
	$comment_query .='  `user_resource_comments`.TIME_STAMP ASC';
	if ($deb) echo $comment_query.'<br/>';
	$comment_result = mysql_query($comment_query);
	if (!$comment_result) {
		echo 'Error selecting comments';
	} else {
?>

    <table border="0" cellpadding="10" cellspacing="0" width="100%">
		<tr class="header">
			<td class="header tBorderBlack bBorderBlue" align="left">
				Comments
			</td>
			<td class="header tBorderBlack bBorderBlue" align="right">
				<a class="action" href="<?php echo PF_ROOT;?>user_resources/User_Resource_Comment/create_User_Resource_Comment.php?id=<?php echo $User_Resource->get_user_res_id();?>&redirect=<?php echo urlencode($_SERVER['REQUEST_URI']);?>&">
					<img class="icon" title="" src="<?php echo PF_ROOT;?>images/comment_add.png"/>
					Add comment</a>
			</td>
		</tr>
	</table>
	<?php if (mysql_num_rows($comment_result) > 0) { ?>
		<table border="0" cellspacing="0" cellpadding="8" width="100%">
			<?php $alternate=1; while ($row = mysql_fetch_assoc($comment_result)) { ?>
				<?php if ($alternate==0) { ?>
					<tr class="resultalt">
				<?php } else { ?>
					<tr class="result">
				<?php } ?>
					<td class="result" valign="top" align="left">
						<?php echo $row['COMMENT']; ?>
					</td>
				</tr>
				<?php if ($alternate==0) { ?>
					<tr class="resultalt">
				<?php $alternate++; } else { ?>
					<tr class="result">
				<?php $alternate--; } ?>
					<td class="result bBorderBlue" valign="top" align="right">
						<a class="result" href="<?php echo PF_ROOT; ?>users/User.php?id=<?php echo $row['USER_ID'];?>&">
							<img class="icon" title="" src="<?php echo PF_ROOT.'images/ui/'.$row['ICON'];?>.png"/>
							<?php echo $row['USERNAME']; ?></a>
						&nbsp;&nbsp;
						<?php if ($row['USER_ID'] == $uid) { ?>
							<a class="header" href="User_Resource_Comment/edit_User_Resource_Comment.php?id=<?php echo $row['USER_RES_COM_ID'];?>&redirect=<?php echo urlencode($_SERVER['REQUEST_URI']);?>&">
								<img class="icon" src="<?php echo PF_ROOT;?>images/edit.png"/>
								Edit</a>
							&nbsp;&nbsp;
						<?php } ?>
					</td>
				</tr>
			<?php } ?>
		</table>
	<?php } ?>
<?php
	}
include(PF_BASE.'Footer.php');
?>
Return current item: Protoforge