Example #1
0
function generateObjectRow($irn)
{
    $iw = "150";
    $sirn = sqlSafe($irn);
    $query = "SELECT location_name, location_barcode, image_url, title, year, accession_no, medium, barcode FROM objects WHERE irn={$sirn}";
    $result = readQuery($query);
    if ($row = $result->fetch_assoc()) {
        $info = $row;
    } else {
        return null;
    }
    $lbarcode = generateBarcode($info['location_barcode']);
    $lname = $info['location_name'];
    $title = $info['title'];
    $year = $info['year'];
    $creators = getCreators($irn);
    $acc = $info['accession_no'];
    $medium = $info['medium'];
    $measures = getMeasurements($irn);
    $obarcode = generateBarcode($info['barcode']);
    $children = getChildren($irn);
    $html = '';
    $html .= "\n<tr>";
    //Current Location
    $html .= "\n<td width=\"16%\">";
    $html .= "\n<p>{$lname}</p>";
    $html .= "\n{$lbarcode}";
    $html .= "\n</td>";
    //Object
    $html .= "\n\t<td width=\"50%\">";
    $titlealt = htmlentities($title);
    $html .= "\n<table class=\"noborder\" summary=\"Alignment Table\">\n\t<tr>";
    if (isset($info['image_url'])) {
        $img = $info['image_url'];
        $html .= "\n\t\t<td class=\"obj-img\"><img src=\"{$img}\" width=\"{$iw}\" alt=\"{$titlealt}\"/></td>";
    }
    $html .= "\n\t\t<td class=\"obj-txt\">";
    $html .= "\n\t\t\t<p><span class=\"obj-title\">{$title},</span> <span class=\"obj-year\">{$year}</span></p>";
    foreach ($creators as $key => $c) {
        $cname = $c['name'];
        $html .= "\n\t\t\t<p><span class=\"cre-name\">{$cname}</span>";
        if (!empty($c['role'])) {
            $crole = $c['role'];
            $html .= "<span class=\"cre-role\"> ({$crole})</span>";
        }
        $html .= "</p>";
    }
    $html .= "\n\t\t\t<p class=\"obj-acc\">{$acc}</p>";
    $html .= "\n\t\t\t<p class=\"obj-med\">{$medium}</p>";
    foreach ($measures as $key => $m) {
        if (empty($m['type'])) {
            $type = 'Unknown';
        } else {
            $type = $m['type'];
        }
        $html .= "\n\t\t\t<p class=\"obj-measure\">{$type}: ";
        $first = true;
        if (!empty($m['height'])) {
            $first = false;
            $html .= "H: " . $m['height'] . " in.";
        }
        if (!empty($m['width'])) {
            if (!$first) {
                $html .= " x";
            }
            $first = false;
            $html .= " W: " . $m['width'] . " in.";
        }
        if (!empty($m['depth'])) {
            if (!$first) {
                $html .= " x";
            }
            $html .= " D: " . $m['depth'] . " in.";
        }
        $html .= "</p>";
    }
    $html .= "\n\t\t\t{$obarcode}";
    $html .= "\n\t\t</td>";
    $html .= "</tr></table>";
    if (count($children) >= 1) {
        $html .= "\n\t\t<table summary=\"Children of {$titlealt}\"class=\"obj-parts\">";
        $html .= "\n\t\t\t<tr>";
        $html .= "\n\t\t\t\t<th colspan=\"1\">Location</th>";
        $html .= "\n\t\t\t\t<th>Parts</th>";
        $html .= "\n\t\t\t</tr>";
        foreach ($children as $key => $c) {
            $bcode = generateBarcode($c['barcode']);
            $lbcode = generateBarcode($c['location_barcode']);
            $title = $c['title'];
            $accno = $c['accession_no'];
            $loc = $c['location_name'];
            $cirn = $c['irn'];
            $html .= "\n\t\t\t<tr>";
            $html .= "\n\t\t\t\t<td >";
            $html .= "\n\t\t\t\t\t<p class=\"part-loc\">{$loc}</p>";
            $html .= "\n\t\t\t\t\t{$lbcode}";
            $html .= "\n\t\t\t\t</td>";
            $html .= "\n\t\t\t\t<td><span  class=\"part-acc\">{$accno}</span> - <span class=\"part-title\">{$title}</span>";
            $html .= "\n\t\t\t\t\t{$bcode}";
            $html .= "\n\t\t\t\t</td>";
            $html .= "\n\t\t\t</tr>";
        }
        $html .= "\n\t\t</table>";
    }
    $html .= "\n\t</td>";
    //Specific Location
    $html .= "\n\t<td width=\"16%\">";
    $html .= "\n\t\t\t<p class=\"specLoc\">Building:<br>";
    $html .= "\n\t\t\tRoom / Gallery:<br>";
    $html .= "\n\t\t\tBin / Rack / Zone:<br>";
    $html .= "\n\t\t\tUnit / Cab. / Case:<br>";
    $html .= "\n\t\t\tShlf / Drwr / Rack:<br>";
    $html .= "\n\t\t\tOther:<br> </p>";
    $html .= "\n\t</td>";
    //Audit
    $html .= "\n\t<td width=\"16%\">";
    $html .= "\n\t\t<div class=\"audit\">";
    $html .= "\n\t\t\t<p>Moved By:</p>";
    $html .= "\n\t\t\t<p>Date:</p>";
    $html .= "\n\t\t\t<p>Rec. in EMu By:</p>";
    $html .= "\n\t\t\t<p>Date:</p>";
    $html .= "\n\t\t</div>";
    $html .= "\n\t</td>";
    //End
    $html .= "\n</tr>";
    /*
    $html .= "\n<tr class='pb'>";
    $html .= "\n\t<td class='pb'>";
    $html .= "\n\t\t<div class='pb'>";
    $html .= "\n\t\t</div>";
    $html .= "\n\t</td>";
    $html .= "\n</tr>";
    */
    return $html;
}
$validData = $copy->validateData();
if (!$validData) {
    $pageErrors["barcodeNmbr"] = $copy->getBarcodeNmbrError();
    $_SESSION["postVars"] = $_POST;
    $_SESSION["pageErrors"] = $pageErrors;
    header("Location: ../catalog/biblio_copy_new_form.php?bibid=" . U($bibid) . (empty($_GET['isbn']) ? '' : "&isbn={$_GET['isbn']}&hits={$_GET['hits']}"));
    exit;
}
#**************************************************************************
#*  Insert new bibliography copy
#**************************************************************************
if (0 + $_GET['hits'] > 1) {
    $i = 0;
    do {
        insertCopy();
        $copy->setBarcodeNmbr(generateBarcode());
        $i++;
    } while ($i < 0 + $_GET['hits']);
    require_once "../classes/BulkLookup.php";
    $bl = new BulkLookupQuery();
    $bl->clearManualItem($_GET['isbn'], $_GET['hits']);
} else {
    insertCopy();
    if (isset($_GET['isbn'], $_GET['hits'])) {
        require_once "../classes/BulkLookup.php";
        $bl = new BulkLookupQuery();
        $bl->clearManualItem($_GET['isbn'], $_GET['hits']);
    }
}
$copyQ->close();
#**************************************************************************