Edit Product';
$posts = Mirror::get_one_product($_POST['product_id']);
form_start();
include_once(INC.'/forms/product.php');
form_hidden('doit','1');
form_hidden('action','edit');
form_hidden('product_id',$_POST['product_id']);
form_submit('submit','','button1','Update');
form_end();
require_once(FOOTER);
exit;
}
break;
case 'delete':
if (!record_exists('mirror_locations','product_id',$_POST['product_id'])&&Mirror::delete_product($_POST['product_id'])) {
set_msg('Product deleted successfully.');
} else {
set_error('Product cannot be deleted because it is being used by a file location.');
}
break;
}
} else {
set_error('You must select a product to continue.');
}
}
$title = 'Products';
$nav = INC.'/admin_nav.php';
require_once(HEADER);
echo '
Products';
show_error();
show_msg();
$products = Mirror::get_products();
$_GET['sort']=(!empty($_GET['sort']))?$_GET['sort']:'product_name';
$_GET['order']=(!empty($_GET['order']))?$_GET['order']:'ASC';
$products=array_order_by($products,$_GET['sort'],$_GET['order']);
$headers = array(
'product_id'=>'',
'product_name'=>'Product Name',
'product_priority'=>'Priority',
'product_count'=>'Downloads'
);
$actions = array(
'edit'=>'Edit',
'delete'=>'Delete'
);
form_start();
ListOut::show($products,$headers,'radio',$actions);
form_end();
echo 'Add a Product
';
form_start();
$posts = ['product_name'=>'', 'product_priority'=>'']; //sane defaults
include_once(INC.'/forms/product.php');
form_submit('add-submit','','button1','Add Product');
form_end();
require_once(FOOTER);