Пример #1
0
<?php

include_once getcwd() . "/classes/BLCarFile.php";
$blCarFile = new BLCarFile();
if (isset($_GET["id"]) && isset($_POST["text"])) {
    $id = $_GET["id"];
    $text = $_POST["text"];
    $carfile = $blCarFile->getCarFile($id);
    if (trim($text) != "") {
        $carfile->setText($text);
        $blCarFile->updateCarFile($carfile);
    } else {
        echo "Text is a required field!";
    }
}
Пример #2
0
include_once getcwd() . "/classes/BLBlobs.php";
$blCarPicture = new BLCarPicture();
$blCarFile = new BLCarFile();
$blBlobs = new BLBlobs();
$files = $blCarFile->getCarFiles();
$pictures = $blCarPicture->getCarPictures();
echo '<h1>Files</h1>';
foreach ($files as $file) {
    if ($file->getBlobId() == null) {
        //Import file
        try {
            echo "Start: " . $file->getName() . "<br />";
            $path = getcwd() . "/files/" . $file->getName() . "." . $file->getType();
            $blobId = $blBlobs->uploadBlobs($path);
            $file->setBlobId($blobId);
            $blCarFile->updateCarFile($file);
            echo "End: " . $file->getName() . " uploaded!<br /><hr />";
        } catch (Exception $ex) {
            echo $ex;
        }
    }
}
echo '<h1>Pictures</h1>';
foreach ($pictures as $picture) {
    if ($picture->getBlobId() == null) {
        //Import picture
        try {
            echo "Start: " . $picture->getName() . "<br />";
            $path = getcwd() . "/pictures/" . $picture->getName() . "." . $picture->getType();
            $blobId = $blBlobs->uploadBlobs($path);
            $picture->setBlobId($blobId);