Esempio n. 1
0
function storeFilesLocal($item, $reviewlocation)
{
    if (isset($reviewlocation)) {
        foreach ($item->getComponents()->getList() as $component) {
            if ($component->getContent()->getStorage() === StorageType::INTERNAL_MANAGED) {
                $file["item"] = preg_replace("|^(\\w+:\\d+):\\d+|", '${1}', $item->getObjid());
                //cut version information
                $md = new FileMetadata($component->getMetadataRecords()->get("escidoc")->getContent());
                $file["size"] = $md->getFilesize();
                $file["name"] = $md->getFilename();
                //copy file to harddisc
                $fh = fopen($reviewlocation . '/' . $file["name"], "w");
                set_time_limit(4 * 30);
                fputs($fh, $_SESSION["itemhandler"]->retrieveContent($file["item"], $component->getObjid()));
                fclose($fh);
            }
        }
    }
}