$directory = new UserDirectory();
				$shelf->setUserID($user_id);
				$shelf->setShelf_id($shelf_id);
				$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;
		}
	$home = $ini['this']['url'];

	ob_start("ob_gzhandler");
	session_start();

	$cgi = array_merge($_GET,$_POST);
	$acao = $cgi["acao"];

	$user_id = $_COOKIE['userID'];
	$shelf_id = $cgi["shelf_id"];
	$directory_id = $cgi["directory_id"];

		switch($acao)
		{
			case "mover":	
				$shelf = new Shelf();
				$shelf->setUserID($user_id);
				$shelf->setShelf_id($shelf_id);
				$shelf->setDirectory($directory_id);
				$directoryList = $shelf->updateShelfDirectory();
				?>
					<script language="javascript">
						opener.location.reload(true);
						window.close();
					</script>
				<?
			break;
		}

?>
<html>
Example #3
0
echo MY_SHELF;
?>
 
					</div>
					<div class="content">
							<h3>
								<span>
									<?php 
echo MY_SHELF;
?>
								</span>
							</h3>
						<div class="articleList">
							<ul>
							<?
							$shelf = new Shelf();
		
							$shelf->setUserID($_COOKIE['userID']);
		
							$shelfList = $shelf->getListShelf();
		
							for($i = 0; $i < count($shelfList); $i++)
							{
								$article = $shelfList[$i]->getArticle();
								echo '<li><b><a target="_blank" href="'.$article->getURL().'">';
		
		/*
		pegando o título do artigo no Lang corrente, se não pega o titulo q tiver hehehe
		do arquivo functions.php
		*/
								echo getTitle($article->getTitle());
/*
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->setCitedStat($_data['cited_stat']);

	if($shelf->isInShelf()){
		$shelf->updateArticleInShelf();	
	}else{
		$shelf->setVisible(0);
		$shelf->addArticleToShelf();
	}
	$message = ALERT_CITED_OK;
}else{
	$message = NOT_LOGED;
}
 public function search_products()
 {
     $store_id = Request::segment(2);
     $this->store = Store::find($store_id);
     if (!$this->store) {
         if (Request::format() == 'html') {
             // Not Found Page
             die;
         } else {
             $response_array = array('success' => 'false', 'error_code' => '404', 'error' => 'Store not Found');
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         }
     }
     if (Input::has('per_page')) {
         $per_page = Input::get('per_page');
     } else {
         $per_page = 20;
     }
     if (Input::has('page')) {
         $page = Input::get('page');
     } else {
         $page = 0;
     }
     $shelf_data['products'] = array();
     $query = Product::where('store_id', $store_id);
     if (Input::has('q')) {
         $q = Input::get('q');
         $query = $query->where('products.name', 'LIKE', '%' . $q . '%');
     }
     $brands = $query->leftJoin('brands', 'products.brand_id', '=', 'brands.id')->select(DB::raw('distinct brands.*'))->get();
     $query = Product::where('store_id', $store_id);
     if (Input::has('q')) {
         $q = Input::get('q');
         $query = $query->where('products.name', 'LIKE', '%' . $q . '%');
     }
     $options = $query->leftJoin('product_tag', 'products.id', '=', 'product_tag.product_id')->Join('options', 'product_tag.option_id', '=', 'options.id')->select(DB::raw('distinct options.*'))->get();
     $query = Product::where('store_id', $store_id);
     $base_search_url = web_url() . "/store/" . $store_id . "/search?q=" . Input::get('q');
     if (Input::has('q')) {
         $q = Input::get('q');
         $query = $query->where('products.name', 'LIKE', '%' . $q . '%');
     }
     $base_search_url_options = $base_search_url;
     if (Input::has('options')) {
         $option_ids = Input::get('options');
         $query = $query->leftJoin('product_tag', 'products.id', '=', 'product_tag.product_id')->whereIn('product_tag.option_id', Input::get('options'));
         foreach (Input::get('options') as $option) {
             $base_search_url_options .= "&options[]=" . $option;
         }
     } else {
         $option_ids = array();
     }
     $base_search_url_brand = $base_search_url;
     if (Input::has('brand')) {
         $brand_id = Input::get('brand');
         $query = $query->where('brand_id', Input::get('brand'));
         $base_search_url_brand .= "&brand=" . Input::get('brand');
     } else {
         $brand_id = 0;
     }
     /*
     		if(Input::has('sort_by') && Input::get('sort_by') == 'price'){
     			$query = $query->orderBy('price');
     		} else {
     			$query = $query->orderBy('total_sale','desc');
     		} */
     $query = $query->orderBy('shelf_id');
     $products = $query->select('products.*')->distinct()->get();
     $shelves = array();
     $shelf_id = 0;
     foreach ($products as $product) {
         if ($product->shelf_id != $shelf_id) {
             $shelf = Shelf::find($product->shelf_id);
             $shelf_id = $product->shelf_id;
             $shelves[$shelf_id] = $shelf->toArray();
             $shelves[$shelf_id]['products'] = array();
         }
         $shelf_product = $product->toArray();
         array_push($shelves[$shelf_id]['products'], $shelf_product);
     }
     $response_array['shelves'] = $shelves;
     $response_array['brands'] = $brands->toArray();
     $response_array['options'] = $options->toArray();
     if (Request::format() == 'html' && $page == 0) {
         Session::put('store_id', $store_id);
         return View::make('search')->with('data', $response_array)->with('store', $this->store)->with('departments', $this->departments)->with('zipcode', $this->zipcode)->with('city', $this->city)->with('stores', $this->stores)->with('q', Input::get('q'))->with('base_search_url_brand', $base_search_url_brand)->with('base_search_url_options', $base_search_url_options)->with('option_ids', $option_ids)->with('brand_id', $brand_id);
     } else {
         $response_array['success'] = 'true';
         $response_code = 200;
         $response = Response::json($response_array, $response_code);
         return $response;
     }
 }
Example #6
0
    /*
    a url do serviço que retorna os meta-dados do artigo
    é o domínio de onde o usuário esta vendo o artigo
    */
    $domain = str_replace("http://", "", $_data['url']);
    $domain = substr($domain, 0, strpos($domain, "/"));
    $scielodef = parse_ini_file(dirname(__FILE__) . "/../scielo.def.php", true);
    /*
    chamando o serviço (ele devolve um objeto Article)
    */
    $articleService = new ArticleService($domain);
    $articleService->setParams($_data['PID']);
    $article = $articleService->getArticle();
    $article->setURL($domain);
    $article->addArticle();
    $shelf = new Shelf();
    $shelf->setUserID($_data['userID']);
    $shelf->setPID($_data['PID']);
    $shelf->setVisible(1);
    if ($shelf->isInShelf()) {
        $shelf->updateArticleInShelf();
    } else {
        $shelf->addArticleToShelf();
    }
    $message = ADD_TO_SHELF_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">
*@author       André Otero(andre.otero@bireme.org)
*@copyright     BIREME
*/

ini_set("display_errors","1");
error_reporting(1);

require_once(dirname(__FILE__)."/../classes/Article.php");
require_once(dirname(__FILE__)."/../classes/Shelf.php");
require_once(dirname(__FILE__)."/../users/langs.php");
require_once(dirname(__FILE__)."/../classes/services/ArticleServices.php");
$scielodef = parse_ini_file(dirname(__FILE__) . '/../scielo.def', true);

$_data['PID'] = $_REQUEST['pid'];

$shelf = new Shelf();

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

$cited_stat = intval($shelf->getCitedStat());

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

$visible = $shelf->getVisible();

if($visible || $access_stat)
{
	$shelf->setCitedStat(0);
	$shelf->UpdateArticleInShelf();
Example #8
0
    /*
    a url do serviço que retorna os meta-dados do artigo
    é o domínio de onde o usuário esta vendo o artigo
    */
    $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" 
 public function get_shelf_ajax()
 {
     $department_id = Input::get('department_id');
     $shelves = Shelf::where('department_id', $department_id)->get()->toArray();
     $response_code = 200;
     $response = Response::json($shelves, $response_code);
     return $response;
 }
*@copyright     BIREME
*/

ini_set("display_errors","1");
error_reporting(1);

require_once(dirname(__FILE__)."/../classes/Article.php");
require_once(dirname(__FILE__)."/../classes/Shelf.php");
require_once(dirname(__FILE__)."/../users/langs.php");
require_once(dirname(__FILE__)."/../classes/services/ArticleServices.php");
$scielodef = parse_ini_file(dirname(__FILE__) . '/../scielo.def', true);

$_data['PID'] = $_REQUEST['PID'];
$_data['url'] = $scielodef['scielo_org_urls']['home']."/users/shelf.php";

$shelf = new Shelf();

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

if($shelf->hasAlerts())
{
	$shelf->setVisible(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">
<?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();
Example #12
0
<?php

// create some quick books for testing
$books[0] = new stdClass();
$books[0]->title = "101 Fun Facts about Rocks";
$books[1] = new stdClass();
$books[1]->title = "Don't Touch that Button";
$books[2] = new stdClass();
$books[2]->title = "Coding for Dummies";
// instantiate shelf
require 'shelf.php';
$shelf = new Shelf();
// loop through book array
foreach ($books as $book) {
    $shelf->addToTop($book);
    // add to shelf
}
echo "<strong>Add All Books:</strong> ";
echo "<pre>" . print_r($shelf, 1) . "</pre>";
// take one from stack
$bookFromShelf = $shelf->removeFromTop();
echo "<strong>Grab Top Book:</strong> ";
echo "<pre>" . print_r($bookFromShelf, 1) . "</pre>";
echo "<strong>Remaining Books:</strong> ";
echo "<pre>" . print_r($shelf, 1) . "</pre>";
Example #13
0
						&gt; <?php 
echo MY_ALERTS;
?>
 
					</div>
					<div class="content">
							<h3>
								<span>
									<?php 
echo MY_ALERTS;
?>
								</span>
							</h3>
						<div class="articleList">
						<?
							$shelf = new Shelf();
		
							$shelf->setUserID($_COOKIE['userID']);
		
							$cited = $shelf->getCitedAlertList();
		
							$count_cited = count($cited);

							if($count_cited)
							{
								echo("<h5>".CITATIONS."</h5>");
								echo '<ul>'."\n";						
							}
		
							
							for($i = 0; $i < $count_cited; $i++)
Example #14
0
 /**
 *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;
 }