Location: PHPKode > projects > AxcotoCart > admin/themes/items.php
<?php
if (!defined("VCL")) {
	echo "Don't try to hack me :D";
	exit;
};

function themeadditem() {
  global $context;
  themedisplayheader("add item");
  echo "
	<form onKeyUp=\"highlight(event)\" onClick=\"highlight(event)\" name='additems' action='?act=additem2' method=POST onsubmit='submit_form();'  enctype='multipart/form-data'>	
    <input type=hidden name='CatId' value='{$context['CatId']}'>
    <table width=770 hegight=800 border=0 cellpadding=0 cellspacing=2>
    	<tr>
    		<td>Name</td>	
    		<td><input type=text name='name' size=50></td>
    	</tr>
    	<tr>
    		<td>Short  description</td>
    		<td>";
	
    //Output Editor
    global $sBasePath;
	$oFCKeditor = new FCKeditor('des') ;
	$oFCKeditor->BasePath	= $sBasePath ;
	$oFCKeditor->Height = "400" ;
	$oFCKeditor->Value = '' ;
	$oFCKeditor->Create() ;
	echo "
    		</td>
    	</tr>
    	<tr>
    		<td>Content</td>
    		<td>";
	
	$oFCKeditor = new FCKeditor('content') ;
	$oFCKeditor->BasePath	= $sBasePath ;
	$oFCKeditor->Height = "400" ;
	$oFCKeditor->Value = '' ;
	$oFCKeditor->Create() ;
	echo "
    		</td>
    	</tr>
      <tr>
        <td>
          Price
        </td>
         <td>
          <input type=text name='price' size=20>
        </td>
      </tr>
      <tr>
        <td>
          Quantity
        </td>
         <td>
          <input type=text name='quantity' size=20>
        </td>
      </tr>
      <tr>
        <td>
          Pictures
        </td>
         <td>
          <input type=file name='picture' size=20>
        </td>
      </tr>            
      ";
    	
  echo "  	
    	<tr>
    		<td>sdsa</td>
    		<td><input type=submit name=save value='save'></td>
    	</tr>
    </table>
	</form>";
  
  
};

function themeadditem2() {
	global $context;
	
	themedisplayheader("Add item");
	if ($context['result']) {
		echo "Add item finished";
	} else {
		echo "Failt";	
	};
};

function thememanitem() {
	global $context;
	global $boardurl,$settings;
	themedisplayheader("manager products");
	
	if (isset($context['items'])) {
		echo "
<table border=0 cellpadding=2 cellspacing=2>
	<tr bgcolor='#D3DCE3'>
		<td>Picture</td>
		<td>Title</td>
		<td>Price</td>
		<td>Quantity</td>
		<td>Delete</td>
		<td>Edit</td>		
	</tr>";		
		
	foreach ($context['items'] as $item) {
		echo "
	<tr bgcolor='#D5D5D5' onmouseover=\"this.style.backgroundColor='#CCFFCC';\" onmouseout=\"this.style.backgroundColor='#D5D5D5'\" width=430>
		<td>
			<a href=\"{$boardurl}?i={$item['id']}\">
			<img align='top' alt='{$item['title']}' title='{$item['title']}' src='{$boardurl}data/items/small/{$item['picture']}' border=0></a>
		</td>	
		<td>{$item['title']}</td>		
		<td>{$item['price']}</td>
		<td>{$item['quantity']}</td>
		<td><a href='?act=edititem&id={$item['id']}'>Edit</a></td>
		<td><a href='?act=deleteitem&id={$item['id']}'>Delete</a></td>		
	</tr>";
	};
				
		echo "
</table>";				
	};	

	echo "
<table width=100% class='' border='0'>
	<tr><td>";
	writelinkpage("{$boardurl}/admin/index.php?act=manitem&cid={$context['catid']}",$context['news_page_link']);
	echo "
	</td></tr>
</table>";
	
};

function themeedititem() {
	global $boardurl;
	global $context;
	
	themedisplayheader("edit item");
  	echo "
	<form onKeyUp=\"highlight(event)\" onClick=\"highlight(event)\" name='additems' action='?act=edititem2' method=POST onsubmit='submit_form();'  enctype='multipart/form-data'>	
    <input type=hidden name='id' value='{$context['id']}'>
    <input type=hidden name='old_picture' value='{$context['item']['picture']}'>
    <table width=770 hegight=800 border=0 cellpadding=0 cellspacing=2>
    	<tr>
    		<td>Title</td>	
    		<td><input type=text name='name' size=50 value='{$context['item']['title']}'></td>
    	</tr>
    	<tr>
    		<td>Short  description</td>
    		<td>";
	//Output Editor
    global $sBasePath;
	$oFCKeditor = new FCKeditor('des') ;
	$oFCKeditor->BasePath	= $sBasePath ;
	$oFCKeditor->Height = "400" ;
	$oFCKeditor->Value = $context['item']['descript'] ;
	$oFCKeditor->Create() ;
	echo "
    		</td>
    	</tr>
    	<tr>
    		<td>Content</td>
    		<td>";
	
	//Output Editor
	$oFCKeditor = new FCKeditor('content') ;
	$oFCKeditor->BasePath	= $sBasePath ;
	$oFCKeditor->Height = "400" ;
	$oFCKeditor->Value = $context['item']['content'] ;
	$oFCKeditor->Create() ;
	echo "
    		</td>
    	</tr>
      <tr>
        <td>
          Price
        </td>
         <td>
          <input type=text name='price' size=20 value='{$context['item']['price']}'>
        </td>
      </tr>
      <tr>
        <td>
          Quantity
        </td>
         <td>
          <input type=text name='quantity' size=20 value='{$context['item']['quantity']}'>
        </td>
      </tr>
      <tr>
        <td>
          Pictures:<img src='{$boardurl}data/items/small/{$context['item']['picture']}' alt='' title=''>
        </td>
         <td>
          <input type=file name='picture' size=20>
        </td>
      </tr>            
      ";
    	
  echo "  	
    	<tr>
    		<td>sdsa</td>
    		<td><input type=submit name=save value='save'></td>
    	</tr>
    </table>
	</form>";	
};

function themeedititem2() {	
	global $boardurl;
	global $context;
	if ($context['result']) {
		echo "Update successfully";
	};
	themedisplayheader("Edit item");
};

function themedeleteitem() {
	global $context;
	themedisplayheader("DELETE ITEN");
	echo "SDA xoa<br />
	<script language=javascript>
		history.go(-1);
	</script>";
	
};
?>
Return current item: AxcotoCart