Example #1
0
// Exhibit object
$exhibit = new stdclass();
// Set plurals label
$articleType = new stdclass();
$articleType->pluralLabel = "articles";
$exhibit->types = array();
$exhibit->types['article'] = $articleType;
// Items will hold the references
$exhibit->items = array();
$id = 0;
if (isset($_GET['id'])) {
    $id = $_GET['id'];
}
if ($id != 0) {
    $refs = db_retrieve_authored_references($id);
    $coauthors = db_retrieve_coauthors($id);
    $c = array();
    foreach ($coauthors->coauthors as $co) {
        $c[] = $co->id;
    }
    $journal_names = array();
    foreach ($refs as $reference_id) {
        global $config;
        $reference = db_retrieve_reference($reference_id);
        $item = new stdclass();
        $item->uri = $config['web_root'] . 'reference/' . $reference_id;
        $item->type = $reference->genre;
        $item->label = $reference->title;
        // Group journals
        if (!isset($journal_names[$reference->issn])) {
            $journal_names[$reference->issn] = $reference->secondary_title;
Example #2
0
/**
 * @file coauthor_graph.php
 *
 * Output DOT format file of coauthors
 *
 */
require_once '../db.php';
require_once '../graph.php';
$author_id = 0;
if (isset($_GET['author_id'])) {
    $author_id = $_GET['author_id'];
}
if ($author_id != 0) {
    // 1. get coauthors
    $coauthors = db_retrieve_coauthors($author_id);
    //print_r($coauthors);
    $n = count($coauthors->coauthors);
    $G = new Graph();
    for ($i = 0; $i < $n; $i++) {
        $sourceNode = $G->AddNode($coauthors->coauthors[$i]->cluster_id, $coauthors->coauthors[$i]->forename . ' ' . $coauthors->coauthors[$i]->lastname);
        for ($j = $i + 1; $j < $n; $j++) {
            if ($coauthors->coauthors[$i]->cluster_id != $coauthors->coauthors[$j]->cluster_id) {
                $num = db_number_coauthored_references($coauthors->coauthors[$i]->id, $coauthors->coauthors[$j]->id);
                if ($num > 0) {
                    $targetNode = $G->AddNode($coauthors->coauthors[$j]->cluster_id, $coauthors->coauthors[$j]->forename . ' ' . $coauthors->coauthors[$j]->lastname);
                    $G->AddEdge($sourceNode, $targetNode, $num);
                }
            }
        }
    }