Exemplo n.º 1
0
print $code;

//test new library
$zotero = new \Zotero\Library('user', $user_ID, 'Library', $api_Key);
$permissions = $zotero->getKeyPermissions('','');
print json_encode($permissions, JSON_PRETTY_PRINT);

$items = $zotero->fetchItemsTop(array(
'format'=>'atom', 'content'=>'none', 'start'=>'0', 'limit'=>'10', 'order'=>'dateModified', 'sort'=>'desc' ));
//'limit'=>10, 'collectionKey'=>$collectionKey, 'order'=>'dateAdded', 'sort'=>'desc'));
*/
if ($step == "1") {
    //first step - info about current status
    // 1) verify connection to zotero (get total count of top-level items in zotero)
    if ($group_ID) {
        $items = $zotero->getItemsTop($group_ID, array('format' => 'atom', 'content' => 'none', 'start' => '0', 'limit' => '1', 'order' => 'dateModified', 'sort' => 'desc'), "groups");
    } else {
        $items = $zotero->getItemsTop($user_ID, array('format' => 'atom', 'content' => 'none', 'start' => '0', 'limit' => '1', 'sort' => 'dateModified', 'direction' => 'desc'));
    }
    $code = $zotero->getResponseStatus();
    if ($code > 499) {
        print "<div style='color:red'><br />Zotero Server Side Error: returns response code: {$code}.<br /><br />" . "Please try this operation later.</div>";
    } else {
        if ($code > 399) {
            $msg = "<div style='color:red'><br />Error. Cannot connect to Zotero API: returns response code: {$code}.<br /><br />";
            if ($code == 400 || $code == 401 || $code == 403) {
                $msg = $msg . "Verify API key in {$linkToAdvancedProperties}. It can be incorrect or truncated";
            } else {
                if ($code == 404) {
                    $msg = $msg . "Verify User and Group ID in " . $linkToAdvancedProperties;
                } else {