$shelf = new Shelf();

$shelf->setUserID($_COOKIE['userID']);
$shelf->setPID($_data['PID']);
$shelf->getShelfItem();

$cited_stat = $shelf->getCitedStat();

$access_stat = intval($shelf->getAccessStat());

$visible = intval($shelf->getVisible());

if($visible || $cited_stat)
{
	$shelf->setAccessStat(0);
	$shelf->UpdateArticleInShelf();

}else{
	$shelf->removeArticleFromShelf();
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	    <meta http-equiv="Pragma" content="no-cache">
	    <meta http-equiv="Expires" content="Mon, 06 Jan 1990 00:00:01 GMT">
예제 #2
0
    */
    $domain = str_replace("http://", "", $_data['url']);
    $domain = substr($domain, 0, strpos($domain, "/"));
    /*
    chamando o serviço (ele devolve um objeto Article)
    */
    $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->setAccessStat($_data['access_stat']);
    if ($shelf->isInShelf()) {
        $shelf->updateArticleInShelf();
    } else {
        $shelf->setVisible(0);
        $shelf->addArticleToShelf();
    }
    $message = ALERT_ACCESSED_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">
<html>
	<head>
예제 #3
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;
 }