Beispiel #1
0
<?php

require_once './config.php';
//library credentials
require_once '../build/libZoteroSingle.php';
$library = new Zotero_Library($libraryType, $libraryID, $librarySlug, $apiKey);
//load all itemkeys in the library
$itemKeys = $library->fetchItemKeys();
?>
<!DOCTYPE html>
<html>
<head>
    <title>Item Keys</title>
    <meta charset="utf-8">
</head>
<body>
    <p>List of all item keys in the library.</p>
    <p>There are a total of <?php 
echo count($itemKeys);
?>
 items in this library/collection, including top level items and their children (notes/attachments).</p>
    <ul>
        <?php 
foreach ($itemKeys as $itemKey) {
    ?>
        <li><?php 
    echo $itemKey;
    ?>
</li>
        <?php 
}
Beispiel #2
0
        if (file_exists($librarySaveFilePath)) {
            $lcacheString = file_get_contents($librarySaveFilePath);
        }
        if ($lcacheString) {
            $library = unserialize($lcacheString);
        }
    } elseif ($libraryCacheType == 'apc') {
        $library = apc_fetch('zreportlibrarycache');
    }
} else {
    apc_clear_cache('user');
}
if (empty($library)) {
    $library = new Zotero_Library($libraryType, $libraryID, $librarySlug, $apiKey, "http://www.zotero.org", 3600);
}
$itemKeys = $library->fetchItemKeys(array('collectionKey' => $reportCollectionKey, 'order' => 'date', 'sort' => 'desc'));
$unknownItemKeys = array();
foreach ($itemKeys as $key) {
    if ($library->items->getItem($key) === false && $key != '') {
        $unknownItemKeys[] = $key;
    }
}
$offset = 0;
$length = 50;
$index = count($unknownItemKeys);
try {
    while ($offset < $index) {
        if ($index - $offset > $length) {
            $uindex = $offset + $length;
        } else {
            $uindex = $index;