Location: PHPKode > projects > PhpInv > phpInv-0.8.0/admin/group.php
<?

// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 of the License, or (at your option)
// any later version.

// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.

// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the Free Software Foundation, Inc., 59 Temple
// Place - Suite 330, Boston, MA 02111-1307, USA.

// Copyright: (C) 2002/2003 Stefan Cyris 


require("./global.php");

if (isset($action) & !isset($noconfirm)) {
	// new, edit, delete
	include("inc/group_$action.php");
} else {
	// order by
	if (!isset($sortby)) {
		$querysortby = " ORDER BY usergroupid";
	} else {
		$querysortby=" ORDER BY ".str_prepare($sortby)."";
	}

	// sort order
	if (empty($sortorder)) {
		$sortorder = "DESC";
		$querysortorder=" ASC";
	} else {
		$sortorder="";
		$querysortorder=" DESC";
	}
	
	print "<table><tr>";
	print "<th><a href=\"$url?hash=$hash&sortby=usergrouptitle&sortorder=$sortorder\">Title</a></th>";
	print "<th><a href=\"$url?hash=$hash&sortby=canview&sortorder=$sortorder\">View</a></th>";
	print "<th><a href=\"$url?hash=$hash&sortby=cannew&sortorder=$sortorder\">New</a></th>";
	print "<th><a href=\"$url?hash=$hash&sortby=canedit&sortorder=$sortorder\">Edit</a></th>";
	print "<th><a href=\"$url?hash=$hash&sortby=candelete&sortorder=$sortorder\">Delete</a></th>";
	print "<th></th></tr>\n";

	# get cols information
	$result = $DB->query("SELECT * FROM ".$DB->tableprefix."usergroup ".$querysortby.$querysortorder);
	while ($row = $DB->fetch_array($result)){
		print "<tr>";
		print "<td>".$row["usergrouptitle"]."</td>";
		print "<td>".$row["canview"]."</td>";
		print "<td>".$row["cannew"]."</td>";
		print "<td>".$row["canedit"]."</td>";
		print "<td>".$row["candelete"]."</td>";
		print "<td>[<a href=\"$url?hash=$hash&action=edit&id=".$row["usergroupid"]."\">Edit</a>] [<a href=\"$url?hash=$hash&action=delete&id=".$row["usergroupid"]."\">Remove</a>]";
		print " </td></tr>";

	}
	print "</table>";
	$DB->free_result($result);

	print "<p><a href=\"$url?hash=$hash&action=new\">New Group</a></p>";
}


?>
Return current item: PhpInv