Exemplo n.º 1
0
        echo "<script>window.location='../../'</script>";
    }
});
$app->post('/brands/updateImage', function () use($brand, $app) {
    if (isset($_SESSION['app']) && isset($_COOKIE['app'])) {
        $brand->updateImage();
    } else {
        echo "<script>window.location='../../'</script>";
    }
});
// GET
$app->get('/brands', function () use($brand) {
    $brand->getBrands();
});
$app->get('/brands/:id', function ($id) use($brand) {
    $brand->getBrand($id);
});
$app->delete('/brands/:id', function ($id) use($brand) {
    if (isset($_SESSION['app']) && isset($_COOKIE['app'])) {
        $brand->delete($id);
    } else {
        echo "<script>window.location='../../'</script>";
    }
});
// $app->post('/brands', function() use($brand, $app) {
//   $request = $app->request();
//   $body = $request->getBody();
//   $data = json_decode($body);
//   $brand->insert($data);
// });
$app->put('/brands/:id', function ($id) use($brand, $app) {
Exemplo n.º 2
0
                 $Brand->setLogoURL($_POST["txtLogoURL_Old"]);
             }
             if (isset($_POST["chkStatus"])) {
                 $Brand->setStatus($_POST["chkStatus"]);
             } else {
                 $Brand->setStatus(0);
             }
             $Brand->update();
             addLogo($Brand);
             $update = true;
         }
     }
 } else {
     if (isset($_GET["BraID"]) && isset($_GET["control"])) {
         $control->setValue($_GET["control"]);
         $Brand = Brand::getBrand($_GET["BraID"]);
         if ($Brand != null) {
             if ($control == Controls::Update) {
                 echo "<script> \$(function () { \$(window).load(function(){ \$('#modalBra').modal( { backdrop: 'static', keyboard: false }, 'show');});  });</script>";
             } else {
                 if ($control == Controls::Delete) {
                     $Brand->delete();
                     $path = '../assets/images/logoBrands/' . $Brand->getBraID();
                     if (file_exists($path)) {
                         File::removeDirectoryAllFiles($path);
                     }
                     $delete = true;
                 }
             }
         } else {
             require_once '../helper/Utils.php';
Exemplo n.º 3
0
    $p->setCatPro($c);
    $flag = 1;
}
if (isset($_GET["DeviceID"]) && !empty($_GET["DeviceID"])) {
    $devID = $_GET["DeviceID"];
    $c->setDevice(new Device($devID));
    require_once 'entities/Device.php';
    $device = Device::getDevice($devID);
    $p->setCatPro($c);
    $flag = 2;
}
if (isset($_GET["BraID"]) && !empty($_GET["BraID"])) {
    $braID = $_GET["BraID"];
    $c->setBrand(new Brand($braID));
    require_once 'entities/Brand.php';
    $bra = Brand::getBrand($braID);
    $p->setCatPro($c);
    $flag = 3;
}
if ($flag != 0) {
    $ListPro = $p->loadLimit($rowsPerPage, $offset, "CatProID");
    $numberOfRows = $p->countRecords();
    ?>
    <form id="addToCart-form" method="post" action=""><input type="hidden" id="txtProID" name="txtProID"/></form>
    <!--PRODUCTS-->
    <div class="box clearfix">
        <ol class="breadcrumb box-top">
            <li><a href="index.php"><i class="fa fa-home"></i></a></li>
            <?php 
    if ($flag == 1) {
        echo '<li><a href="productsByCat.php?DeviceID=' . $c->getDevice()->getDeviceID() . '">' . $c->getDevice()->getDeviceName() . '</a></li>';