Example #1
0
<?php

include_once getcwd() . "/classes/BLCarPicture.php";
include_once getcwd() . "/classes/BLPictureOrder.php";
$blCarPicture = new BlCarPicture();
$blPictureOrder = new BLPictureOrder();
if (isset($_GET["id"])) {
    $id = $_GET["id"];
    $carpicture = $blCarPicture->getCarPicture($id);
    $max = $blPictureOrder->getMaxPictureOrderByCar($carpicture->getCarId());
    $nr = $blPictureOrder->getPictureOrderByCarPicture($id);
    if ($nr < $max) {
        $blPictureOrder->moveUpPictureOrder($id);
    }
}
Example #2
0
        $errorim = upload($_FILES[$upload_name]['tmp_name'], $path, $file, 1600, 1600);
        chmod($path . $file, 0777);
        //class
        if ($errorim[0] == true) {
            //Insert blob in table
            $blobId = $blBlobs->uploadBlobs($path . $file);
            $carpicture = new CarPicture(0, str_replace("." . findexts($file), "", $file), findexts($file), $_POST["CARID"], $blobId);
            $carpicture->setId($blCarPicture->insertCarPicture($carpicture));
            $car = $blCar->getCar($_POST["CARID"]);
            //default
            if ($car->getDefaultPictureId() == null) {
                $car->setDefaultPictureId($carpicture->getId());
                $blCar->updateCar($car);
            }
            //pictureorder
            $max = $blPictureOrder->getMaxPictureOrderByCar($car->getId()) + 1;
            $pictureorder = new PictureOrder(0, $max, $car->getId(), $carpicture->getId());
            $blPictureOrder->insertPictureOrder($pictureorder);
            //success
            //HandleError('<span style="color:green">' . $file . ' saved!</span><br />');
            $carpicturelist[] = $carpicture;
        } else {
            HandleError('Error: ' . $errorim[2] . ' (' . $file . ')');
        }
    } else {
        HandleError('Error: No Image File. (' . $_FILES[$upload_name]['name'] . ')');
    }
} else {
    HandleError("No file selected.");
}
function HandleError($message)