$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>
	<head>
Пример #2
0
 /**
 *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;
 }