コード例 #1
0
	$articleService = new ArticleService($domain);

	$articleService->setParams($_data['PID']);

	$article = 	$articleService->getArticle();

	$article->setURL($domain);

//die(var_dump($article->getPID()));

	$article->addArticle();

	$shelf = new Shelf();

	$shelf->setUserID($_data['userID']);
	$shelf->setPID($_data['PID']);
	$shelf->setCitedStat($_data['cited_stat']);

	if($shelf->isInShelf()){
		$shelf->updateArticleInShelf();	
	}else{
		$shelf->setVisible(0);
		$shelf->addArticleToShelf();
	}
	$message = ALERT_CITED_OK;
}else{
	$message = NOT_LOGED;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
コード例 #2
0
ファイル: ShelfDAO.php プロジェクト: Ethennoob/Web
 /**
 *Retorna um array de objetos Shelf
 *Lê a base de dados, e retorna um array de objetos Shelf dos artigos marcados para alerta de acesso
 *@param Shelf shelf objeto shelf que contém o ID do usuário que se quer ter a shelf carregada
 *@returns mixed Array de objetos Shelf
 */
 function getAccessedAlertList($shelf)
 {
     $strsql = "SELECT * FROM user_shelf, articles WHERE user_id = '" . $shelf->getUserID() . "' and user_shelf.pid = articles.pid and user_shelf.access_stat = 1";
     $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->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->setArticle($article);
         array_push($shelfList, $shelf);
     }
     return $shelfList;
 }