Exemplo n.º 1
0
 public function gallery_delete()
 {
     $product_image_collection = new ProductImageCollection($_GET['id']);
     $product_image_collection->delete($_GET['id']);
     $galleries = $product_image_collection->get_all();
     header('Location: index.php?controller=products&action=gallery&id=' . $_GET['product_id']);
 }
Exemplo n.º 2
0
 public function index()
 {
     $pic = new ProductImageCollection($_GET['id']);
     $gallery = $pic->get_latest(3);
     $products_collection = new ProductsCollection();
     $product = $products_collection->get($_GET['id']);
     $this->loadView('website/product', array('product' => $product, 'gallery' => $gallery));
 }
Exemplo n.º 3
0
<?php

require_once __DIR__ . '/../common/autoload_cms.php';
$productImageCollection = new ProductImageCollection();
$image = $productImageCollection->one(array('id' => $_GET['id']));
if (isset($_GET['id']) && isset($_GET['confirm'])) {
    $productImageCollection->remove(array('id' => $_GET['id']));
    header('Location: product_image_list.php?product_id=' . $image->getProductId());
}
require_once 'include/header.php';
?>

<div class="container">
    <h1>Are you sure you want to delete this address?</h1>

    <a href="product_image_delete.php?id=<?php 
echo $_GET['id'];
?>
&confirm=1" class="btn btn-danger">Yes</a>
    <a href="product_image_list.php?product_id=<?php 
echo $image->getProductId();
?>
" class="btn btn-default">No</a>
</div>

<?php 
require_once 'include/footer.php';
Exemplo n.º 4
0
<?php

require_once __DIR__ . '/../common/autoload_cms.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $entity = new ProductImage();
    $entity->setName($_POST['name'])->setProductId($_GET['product_id'])->setDateAdded(date('Y-m-d H:i:s'))->saveImage($_FILES['image']);
    $productImageCollection = new ProductImageCollection();
    $productImageCollection->save($entity);
    header('Location: product_image_list.php?product_id=' . $_GET['product_id']);
    exit;
}
require_once 'include/header.php';
?>

<div class="container">
    <form method="post" action="" enctype="multipart/form-data">
        <div class="form-group">
            <label for="name">Name:</label>
            <input type="text" name="name" id="name" class="form-control">
        </div>

        <div class="form-group">
            <label for="image">Image:</label>
            <input type="file" name="image" id="image" class="form-control">
        </div>

        <button type="submit" class="btn btn-default">Submit</button>
    </form>
</div>

<?php 
Exemplo n.º 5
0
<?php

require_once __DIR__ . '/../common/autoload_cms.php';
require_once 'include/header.php';
$productImageCollection = new ProductImageCollection();
$images = $productImageCollection->all(array('product_id' => $_GET['product_id']));
?>

<div class="container">
    <a href="product_image_add.php?product_id=<?php 
echo $_GET['product_id'];
?>
" class="btn btn-info">Add Image</a>
    <div class="row">
        <?php 
foreach ($images as $image) {
    ?>
        <div class="col-sm-6 col-md-4">
            <div class="thumbnail">
                <img src="../resources/storage/<?php 
    echo $image->getImage();
    ?>
" style="height: 200px; width: 100%; display: block;">
                <div class="caption">
                    <h3><?php 
    echo $image->getName();
    ?>
</h3>
                    <p>
                        <a href="product_image_edit.php?id=<?php 
    echo $image->getId();