<?php ini_set("include_path", "."); require_once "../classes/Shelf.php"; require_once "../../../php/include.php"; require_once "langs.php"; require_once "functions.php"; $site = parse_ini_file(dirname(__FILE__) . "/../../../ini/" . $lang . "/bvs.ini", true); $ini = parse_ini_file("../scielo.def", true); $home = $ini['this']['url']; if (!isset($_COOKIE['userID'])) { header("Location: " . $home); } ob_start("ob_gzhandler"); session_start(); $shelf = new Shelf(); $shelf->setUserID($_COOKIE['userID']); $shelf->setShelf_id($_GET['shelf']); $shelf->setRate($_GET['rate']); $result = $shelf->updateArticleRate(); echo "Content-type: text/plain \n"; echo "true"; ob_end_flush();
$shelf->setDirectory($directory_id); $directoryList = $shelf->deleteAllOfDirectory($removeDir); $directory->setDirectory_id($removeDir); $directory->removeDirectoryFromShelf(); ?> <script language="javascript"> opener.location.reload(true); window.close(); </script> <? break; case "move": $shelf = new Shelf(); $directory = new UserDirectory(); $shelf->setUserID($user_id); $shelf->setShelf_id($shelf_id); $shelf->setDirectory($directory_id); $directoryList = $shelf->moveAllToAnotherDirectory($removeDir); $directory->setDirectory_id($removeDir); $directory->removeDirectoryFromShelf(); ?> <script language="javascript"> opener.location.reload(true); window.close(); </script> <? break; } ?> <html>
/** *Retorna um array de objetos Shelf * *Lê a base de dados, e retorna um array de objetos Shelf *@param Shelf shelf objeto shelf que contém o ID do usuário que se quer ter a shelf carregada *@param integer from *@param integer count * *@returns mixed Array de objetos Shelf */ function getListShelf($shelf, $from = 0, $count = -1, $params) { $directory_id = $shelf->getDirectory(); if (isset($directory_id)) { if ($directory_id == 0) { $filter = " and user_shelf.directory_id=" . $directory_id; } else { $filterTb = ", directories"; $filter = " and user_shelf.directory_id=directories.directory_id and user_shelf.directory_id=" . $directory_id; } } switch ($params["sort"]) { case "rate": $sort = "rate desc"; break; case "date": $sort = "shelf_id desc"; break; default: $sort = "rate desc"; break; } $strsql = "SELECT * FROM user_shelf, articles" . $filterTb . " WHERE user_shelf.user_id = '" . $shelf->getUserID() . "' and user_shelf.pid = articles.pid and user_shelf.visible = 1 " . $filter . " order by user_shelf." . $sort; if ($count > 0) { $strsql .= " LIMIT {$from},{$count}"; } $result = $this->_db->databaseQuery($strsql); $shelfList = array(); for ($i = 0; $i < count($result); $i++) { $shelf = new Shelf(); $article = new Article(); $article->setPID($result[$i]['PID']); $article->setURL($result[$i]['url']); $article->setTitle($result[$i]['title']); $article->setSerial($result[$i]['serial']); $article->setVolume($result[$i]['volume']); $article->setNumber($result[$i]['number']); $article->setSuppl($result[$i]['suppl']); $article->setYear($result[$i]['year']); $article->setAuthorXML($result[$i]['authors_xml']); $article->setKeywordXML($result[$i]['keywords_xml']); $shelf->setShelf_id($result[$i]['shelf_id']); $shelf->setPID($result[$i]['PID']); $shelf->setCitedStat($result[$i]['cited_stat']); $shelf->setAccessStat($result[$i]['access_stat']); $shelf->setUserID($result[$i]['user_id']); $shelf->setVisible($result[$i]['visible']); $shelf->setRate($result[$i]['rate']); $shelf->setDirectory($result[$i]['directory_id']); $shelf->setArticle($article); array_push($shelfList, $shelf); } return $shelfList; }