Exemplo n.º 1
0
function createreview($escidocid, $layout)
{
    $item = $_SESSION["itemhandler"]->retrieve($escidocid);
    $modtime = preg_replace("/\\+00:00/", "Z", $item->getLastModificationDate()->format(DateTime::W3C));
    $exposedlinkbase = md5($item->getObjid()) . md5($modtime);
    $base = "../../";
    $reviewlocation = $base . "review/" . $exposedlinkbase;
    if (strlen($layout) > 0 && $layout != "null") {
        $reviewlocation .= "-" . $layout;
    }
    if (file_exists($reviewlocation)) {
        throw new Exception("There already exists a review of this dataset.");
    }
    mkdir($reviewlocation);
    $filesrc = $base;
    if ($layout && file_exists("../../../" . $layout) && is_dir("../../../" . $layout)) {
        $filesrc = "../../../" . $layout . "/";
    }
    recurse_copy($filesrc . "/css", $reviewlocation . "/css");
    rename($reviewlocation . "/css/datasetoverview_review.css", $reviewlocation . "/css/datasetoverview.css");
    recurse_copy($filesrc . "/xsl", $reviewlocation . "/xsl");
    recurse_copy($filesrc . "/images", $reviewlocation . "/images");
    copy($filesrc . "getcitationinfo.php", $reviewlocation . "/getcitationinfo.php");
    copy($base . "review/index.php", $reviewlocation . "/index.php");
    $fh = fopen($reviewlocation . '/item.xml', "w");
    fputs($fh, DOMMapper::marshal($item));
    fclose($fh);
    storeFilesLocal($item, $reviewlocation);
}
Exemplo n.º 2
0
         $content = new DOMDocument();
         $childnode = $content->importNode($mdrecord->getContent(), true);
         $content->appendChild($childnode);
         if ($mdrecord->getName() === "datacite") {
             $xpath = new DOMXPath($content);
             $res = $xpath->query("//*[local-name() = 'identifier' and @identifierType='DOI']");
             if ($res->length > 0) {
                 $doi = $res->item(0)->nodeValue;
             }
         }
         $fulltext .= $xsl->transformToXML($content);
     }
     try {
         $dbo->beginTransaction();
         $sthds = $dbo->prepare('REPLACE INTO ' . $pmdinstance . 'dataset (id,item,lastmodified,doi) VALUES (?,?,?,?)');
         $sthds->execute(array($newitem->getObjId(), DOMMapper::marshal($newitem), DateTimeFormatter::ISO8601($newitem->getLastModificationDate()), $doi));
         $sthmd = $dbo->prepare('REPLACE INTO ' . $pmdinstance . 'mdrecords (datasetid,name,content) VALUES (?,?,?)');
         foreach ($newitem->getMetadataRecords()->getList() as $mdrecord) {
             $content = new DOMDocument();
             $childnode = $content->importNode($mdrecord->getContent(), true);
             $content->appendChild($childnode);
             $sthmd->execute(array($newitem->getObjId(), $mdrecord->getName(), $content->saveXML()));
         }
         $sthft = $dbo->prepare('REPLACE INTO ' . $pmdinstance . 'fullidx (datasetid,fullidx) VALUES (?,?)');
         $sthft->execute(array($newitem->getObjId(), $fulltext));
         $dbo->commit();
     } catch (PDOException $e) {
         $dbo->rollback();
         throw $e;
     }
 }
Exemplo n.º 3
0
                $item = $_SESSION["itemhandler"]->retrieve($urlparam[3]);
                $components = $item->getComponents();
                echo DOMMapper::marshal($components);
            } else {
                $item = $_SESSION["itemhandler"]->retrieve($urlparam[3]);
                $xmldom = new DOMDocument();
                if ($mdrecord && strlen($mdrecord) > 0) {
                    $records = $item->getMetaDataRecords();
                    $mdrecord = $records->get($mdrecord);
                    $domelement = $mdrecord->getContent();
                    $xmldom->appendChild($xmldom->importNode($domelement, true));
                    outdom($xmldom);
                } else {
                    $mdrecords = $item->getMetaDataRecords();
                    $mdrecords->remove("escidoc");
                    $outobj = DOMMapper::marshal($mdrecords);
                    $outxml = new DOMDocument();
                    $outxml->loadXML($outobj);
                    outdom($outxml);
                }
            }
        }
    }
} catch (AuthorizationException $e) {
}
function outdom($xmldom)
{
    $xsl = new XSLTProcessor();
    $xsldom = new DOMDocument();
    $xsldom->load("convert-remove-namespace.xslt");
    $xsl->importStyleSheet($xsldom);