Location: PHPKode > projects > Katyshop > katyshop_ro_0.3.2.1/web/admin/manufacturer.php
<?php
/**
 * Product: Katyshop
 * @version 0.3.2.1
 * @author Catalin Hulea - hide@address.com
 * @copyright Copyright (C) 2007 Catalin Hulea
 * @license GNU General Public License version 3
 * 			You can find a copy of GNU GPL v3 at this path: /docs/LICENSE
 * @link https://sourceforge.net/projects/katyshop
 *
 * 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 3 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, see <http://www.gnu.org/licenses/>.
 *
 */
require_once(dirname(dirname(__FILE__)) . "/init.php");
require_once(WEB_DIR . "/includes/req_admin.php");
?>
<html>
<head>
<title><?php echo APP_NAME; ?></title>
<?php require_once(WEB_DIR . "/includes/html_head.php"); ?>
</head>

<body>
<div id="container">
<?php require_once(WEB_DIR . "/includes/header.php"); ?>
<div id="middle">
<div id="left_vertical_line">
<?php require_once(WEB_DIR . "/admin/includes/left.php"); ?>
<div id="content">
<h1>Administrare producatori</h1>

<form action="admin/formparser/manufacturer.php?action=delete" method="post" id="frm_delete_manufacturer">
<input type="hidden" name="id" value="0">
</form>

<?php require_once(WEB_DIR . "/includes/print_messages.php"); ?>

<?php
$db = Application::getDb();
if(@$_GET["action"] == "detail")
{
	?>
	<dl>
	<dt class="title"><b>Detalii producator</b></dt>
	<dd>
	<a href="admin/manufacturer.php">Inapoi la lista de producatori</a>
	<?php
	if(isset($_GET["id"]))
	{
		$m = $db->tbManufacturer->getManufacturerById($_GET["id"]);
	}
	else
	{
		$m = SessionHandler::get("editManufacturer");
		if(!is_a($m, "Manufacturer"))
			$m = new Manufacturer();
	}
	?>
	<h2><?php echo ($m->id == 0) ? "Adaugare producator nou" : "Editare detalii producator"; ?></h2>
	<form action="admin/formparser/manufacturer.php?action=save" method="post" enctype="multipart/form-data">
	<input type="hidden" name="MAX_FILE_SIZE" value="8000000">
	<input type="hidden" name="id" value="<?php echo Escape::htmlValue($m->id); ?>">
	<table>
	<tr>
	<td>Titlu</td><td><input type="text" name="title" value="<?php echo Escape::htmlValue($m->title); ?>"></td>
	</tr>
	<tr>
	<td>Descriere</td><td><textarea name="description" cols="30" rows="5"><?php echo Escape::html($m->description); ?></textarea></td>
	</tr>
	<tr>
	<td>Imagine</td>
	<td>
		<?php
		if(!empty($m->picture))
		{
			?>
			<a href="img/manufacturers/<?php echo Escape::htmlValue($m->picture); ?>" target="_blank"><?php echo Escape::html($m->picture); ?></a>
			<br>
			<?php
		}
		?>
		<a href="javascript:changeManufacturerPicture(); " id="the_picture_link">click here to change the image</a>
		<br>
		<input type="file" name="picture" disabled style="display: none; " id="the_picture">
	</td>
	</tr>
	<tr>
	<td>&nbsp;</td>
	<td>
		<input type="submit" value="Salvati" class="button">
		<input type="button" value="Cancel" class="button" onclick="redirect('admin/manufacturer.php'); ">
	</td>
	</tr>
	</table>
	</form>
	</dd>
	</dl>
	<?php
}
else
{
	?>
	<dl>
	<dt class="title"><b>Lista producatori</b></dt>
	<dd>
	<a href="admin/manufacturer.php?action=detail&id=0">click aici pentru a adauga un nou producator</a>
	<?php
	$list = $db->tbManufacturer->search(@$_GET, @$_GET["start"], @$_GET["rowsPerPage"], @$_GET["order_by"], @$_GET["order_direction"]);
	$manufacturersCount = $db->tbManufacturer->getCount(@$_GET, @$_GET["start"], @$_GET["rowsPerPage"], @$_GET["order_by"], @$_GET["order_direction"]);
	if($manufacturersCount == 0)
	{
		?>
		<p>Nu exista producatori in lista</p>
		<?php
	}
	else
	{
		?>
		<table>
		<tr>
		<td>&nbsp;</td>
		<td><?php echo pagination_columnHead("Titlu", "title") ?></td>
		<td><?php echo pagination_columnHead("Descriere", "description") ?></td>
		<td>&nbsp;</td>
		</tr>
		<?php
		for($i = 0; $i < count($list); $i++)
		{
			$m = $list[$i];
			?>
			<tr>
			<td>
				<?php
				if(!empty($m->picture) && is_file(WEB_DIR . "/img/manufacturers/{$m->picture}"))
				{
					?>
					<a href="admin/manufacturer.php?action=detail&id=<?php echo Escape::htmlValue($m->id); ?>">
					<img src="img/manufacturers/<?php echo Escape::htmlValue($m->picture); ?>">
					</a>
					<?php
				}
				?>
				&nbsp;
			</td>
			<td><a href="admin/manufacturer.php?action=detail&id=<?php echo Escape::htmlValue($m->id); ?>"><?php echo Escape::html($m->title); ?></a></td>
			<td><a href="admin/manufacturer.php?action=detail&id=<?php echo Escape::htmlValue($m->id); ?>"><?php echo Escape::html(Tools::limitString($m->description)); ?></a></td>
			<td><a href="javascript:deleteManufacturer('<?php echo Escape::htmlValue($m->id); ?>'); "><img src="img/icons/delete.png"></a></td>
			</tr>
			<?php
		}
		?>
		<tr>
		<td colspan="4">
		<?php
		echo pagination_listPages($manufacturersCount);
		echo pagination_rowsPerPage();
		?>
		</td>
		</tr>
		</table>
		<?php
	}
	?>
	</dd>
	</dl>
	<?php
}
?>

</div>
<?php require_once(WEB_DIR . "/includes/right.php"); ?>
<?php require_once(WEB_DIR . "/includes/footer.php"); ?>
</div>
</div>
</div>
</body>
</html>
Return current item: Katyshop