Пример #1
0
 public function __construct()
 {
     parent::__construct('delete_author', 'Delete Author', 'Admin/delete_author.php');
     if ($this->loginError) {
         return;
     }
     $this->loadHttpVars();
     if (!isset($this->author_id) || !is_numeric($this->author_id)) {
         $this->pageError = true;
         return;
     }
     $author = new pdAuthor();
     $result = $author->dbLoad($this->db, $this->author_id);
     if (!$result) {
         $this->pageError = true;
         return;
     }
     $pub_list = pdPubList::create($this->db, array('author_id' => $this->author_id));
     if (isset($pub_list) && count($pub_list) > 0) {
         echo 'Cannot delete Author <b>', $author->name, '</b>.<p/>', 'The author has the following publications in the database:', displayPubList($this->db, $pub_list, true, -1, null, null, '../');
         return;
     }
     $form =& $this->confirmForm('deleter');
     $form->addElement('hidden', 'author_id', $this->author_id);
     if ($form->validate()) {
         $values = $form->exportValues();
         // This is where the actual deletion happens.
         $name = $author->name;
         $author->dbDelete($this->db);
         echo 'You have successfully removed the following author from the database:', '<p/><b>', $name, '</b>';
     } else {
         if (!isset($this->author_id) || !is_numeric($this->author_id)) {
             $this->pageError = true;
             return;
         }
         $renderer = new HTML_QuickForm_Renderer_QuickHtml();
         $form->accept($renderer);
         $table = new HTML_Table(array('width' => '100%', 'border' => '0', 'cellpadding' => '6', 'cellspacing' => '0'));
         $table->addRow(array('Name:', $author->name));
         if (isset($author->title) && trim($author->title != '')) {
             $table->addRow(array('Title:', $author->title));
         }
         $table->addRow(array('Email:', $author->email));
         $table->addRow(array('Organization:', $author->organization));
         $cell = '';
         if (isset($author->webpage) && trim($author->webpage != '')) {
             $cell = '<a href="' . $author->webpage . '">' . $author->webpage . '</a>';
         } else {
             $cell = "none";
         }
         $table->addRow(array('Web page:', $cell));
         $table->updateColAttributes(0, array('class' => 'emph', 'width' => '25%'));
         echo '<h3>Delete Author</h3><p/>Delete the following author?';
         $this->form =& $form;
         $this->renderer =& $renderer;
         $this->table =& $table;
     }
 }
Пример #2
0
 private function recentAdditions()
 {
     $pub_list = pdPubList::create($this->db, array('sort_by_updated' => true));
     if (empty($pub_list) || count($pub_list) == 0) {
         return;
     }
     echo '<h2>Recent Additions:</h2>';
     echo displayPubList($this->db, $pub_list, false, 6);
 }
Пример #3
0
 public function __construct()
 {
     parent::__construct('publist_citations', 'Publication List Citations', 'diag/publist_citations.php', pdNavMenuItem::MENU_NEVER);
     if ($this->loginError) {
         return;
     }
     $pub_ids = array(736, 737, 807, 828, 842, 858, 870, 871, 874, 875, 876, 877, 879, 894, 895, 896, 898, 900, 901, 906, 907, 908, 910, 911, 912, 914, 915, 916, 917, 921, 922, 923, 925, 926, 927, 928, 929, 930, 936, 941);
     $additional = array();
     foreach ($pub_ids as $pub_id) {
         $additional[$pub_id] = $pub_id;
     }
     $pub_list = pdPubList::create($this->db, array('pub_ids' => $pub_ids, 'sort' => false));
     uasort($pub_list, array('pdPublication', 'pubsDateSortDesc'));
     echo displayPubList($this->db, $pub_list, true, -1, $additional);
 }
Пример #4
0
 public function renderForm()
 {
     $sp =& $_SESSION['search_params'];
     $renderer =& $this->form->defaultRenderer();
     $this->form->accept($renderer);
     $pubs = pdPubList::create($this->db, array('cat_pub_ids' => $_SESSION['search_results']));
     if ($pubs == null) {
         return;
     }
     echo $renderer->toHtml();
     echo displayPubList($this->db, $pubs, true, -1, null, array('show_internal_info' => $sp->show_internal_info == 'yes'));
     $searchLinkTable = new HTML_Table(array('id' => 'searchlink', 'border' => '0', 'cellpadding' => '0', 'cellspacing' => '0'));
     $search_url =& $_SESSION['search_url'];
     $searchLinkTable->addRow(array('<a href="' . $search_url . '">' . '<img src="images/link.gif" title="view" alt="view" ' . 'height="16" width="16" border="0" align="top" />' . ' Link to this search</a></div><br/>'));
     echo '<hr/>', $searchLinkTable->toHtml();
 }
Пример #5
0
 public function __construct()
 {
     parent::__construct('delete_category', 'Delete Category', 'Admin/delete_category.php');
     if ($this->loginError) {
         return;
     }
     $this->loadHttpVars();
     if (!isset($this->cat_id)) {
         echo 'No category id defined';
         $this->pageError = true;
         return;
     } else {
         if (!is_numeric($this->cat_id)) {
             $this->pageError = true;
             return;
         }
     }
     $category = new pdCategory();
     $result = $category->dbLoad($this->db, $this->cat_id);
     if (!$result) {
         $this->pageError = true;
         return;
     }
     $pub_list = pdPubList::create($this->db, array('cat_id' => $this->cat_id));
     if (isset($pub_list) && count($pub_list) > 0) {
         echo 'Cannot delete category <b>', $category->category, '</b>.<p/>', 'The category is used by the following publications:', "\n", displayPubList($this->db, $pub_list);
         return;
     }
     $form =& $this->confirmForm('deleter');
     $form->addElement('hidden', 'cat_id', $this->cat_id);
     $renderer =& $form->defaultRenderer();
     $form->accept($renderer);
     if ($form->validate()) {
         $values = $form->exportValues();
         // This is where the actual deletion happens.
         $category->dbDelete($this->db);
         echo 'Category <b>', $category->category, '</b> removed from the database.';
     } else {
         echo '<h3>Confirm</h3>Delete category <b>', $category->category, '</b>?<p/>';
         $this->form =& $form;
         $this->renderer =& $renderer;
     }
 }
Пример #6
0
 public function __construct()
 {
     parent::__construct('delete_venue', 'Delete Venue', 'Admin/delete_venue.php');
     if ($this->loginError) {
         return;
     }
     $this->loadHttpVars();
     if (!isset($this->venue_id) || !is_numeric($this->venue_id)) {
         $this->pageError = true;
         return;
     }
     $venue = new pdVenue();
     $result = $venue->dbLoad($this->db, $this->venue_id);
     if (!$result) {
         $this->pageError = true;
         return;
     }
     $pub_list = pdPubList::create($this->db, array('venue_id' => $this->venue_id));
     if (isset($pub_list) && count($pub_list) > 0) {
         echo 'Cannot delete venue <b>', $venue->nameGet(), '</b>.<p/>', 'The venue is used by the following ', 'publications:', "\n", displayPubList($this->db, $pub_list, true, -1, null, null, '../');
         return;
     }
     $form =& $this->confirmForm('deleter');
     $form->addElement('hidden', 'venue_id', $venue->venue_id);
     if ($form->validate()) {
         $venue->dbDelete($this->db);
         echo 'Venue <b>', $venue->title, '</b> successfully removed from database.';
     } else {
         $renderer =& $form->defaultRenderer();
         $form->accept($renderer);
         if ($venue->title != '') {
             $disp_name = $venue->title;
         } else {
             $disp_name = $venue->nameGet();
         }
         echo '<h3>Confirm</h3><p/>', 'Delete Venue <b>', $disp_name, '</b> from the database?';
         $this->form =& $form;
         $this->renderer =& $renderer;
     }
 }
Пример #7
0
 public function __construct()
 {
     parent::__construct('validate_publications');
     if ($this->loginError) {
         return;
     }
     $pub_ids = array();
     $q = $this->db->select('pub_pending', 'pub_id');
     if (count($q) == 0) {
         echo 'There are no publicaiton entries requiring validation.';
         return;
     }
     foreach ($q as $r) {
         $pub = new pdPublication($r);
         $pub_ids[] = $r->pub_id;
     }
     $pub_list = pdPubList::create($this->db, array('pub_ids' => $pub_ids, 'sort' => false));
     uasort($pub_list, array('pdPublication', 'pubsDateSortDesc'));
     echo "<h3>The following publications requrie validation</h3>\n", "Please view or edit each entry separately.<br/>\n";
     // add additional parameter to the view icon
     echo preg_replace('/pub_id=(\\d+)/', 'pub_id=${1}&submit_pending=true', displayPubList($this->db, $pub_list, true, -1, null, null, '../'));
 }
Пример #8
0
 public function nonML()
 {
     foreach ($this->pi_authors as $name => &$dates) {
         $all_pubs = pdPubList::create($this->db, array('author_name' => $name, 'date_start' => $dates[0], 'date_end' => date('Y-m-d')));
         if (count($all_pubs) == 0) {
             continue;
         }
         $non_ml = array();
         foreach ($all_pubs as &$pub) {
             $keywords = strtolower($pub->keywords);
             if (strpos($keywords, 'machine learning') === false) {
                 $non_ml[] = $pub->pub_id;
             }
         }
         echo '<h2>Non Machine Learning papers for ', $name, '</h1>';
         $pub_list = pdPubList::create($this->db, array('pub_ids' => $non_ml));
         echo displayPubList($this->db, $pub_list, true, -1, null, null, '../');
         unset($all_pubs);
     }
 }
Пример #9
0
 public function __construct()
 {
     parent::__construct('view_publications');
     if ($this->loginError) {
         return;
     }
     $this->loadHttpVars();
     if (!isset($this->menu)) {
         $this->menu = 1;
     }
     if (isset($this->year)) {
         $pub_list = pdPubList::create($this->db, array('year_cat' => $this->year));
         $title = '<h1>Publications in ' . $this->year . '</h1>';
     } else {
         if (isset($this->venue_id)) {
             $vl = pdVenueList::create($this->db);
             if (!array_key_exists($this->venue_id, $vl)) {
                 $this->pageError = true;
                 return;
             }
             $pub_list = pdPubList::create($this->db, array('venue_id' => $this->venue_id));
             $title = '<h1>Publications in Venue "' . $vl[$this->venue_id] . '"</h1>';
         } else {
             if (isset($this->cat_id)) {
                 $cl = pdCatList::create($this->db);
                 if (!array_key_exists($this->cat_id, $cl)) {
                     $this->pageError = true;
                     return;
                 }
                 $pub_list = pdPubList::create($this->db, array('cat_id' => $this->cat_id));
                 $title = '<h1>Publications in Category "' . $cl[$this->cat_id] . '"</h1>';
             } else {
                 if (isset($this->keyword)) {
                     $pub_list = pdPubList::create($this->db, array('keyword' => $this->keyword));
                     $title = '<h1>Publications with keyword "' . $this->keyword . '"</h1>';
                 } else {
                     if (isset($this->author_id)) {
                         // If there exists an author_id, only extract the publications for
                         // that author
                         //
                         // This is used when viewing an author.
                         $pub_list = pdPubList::create($this->db, array('author_id_cat' => $this->author_id));
                         $auth = new pdAuthor();
                         $auth->dbLoad($this->db, $this->author_id, pdAuthor::DB_LOAD_BASIC);
                         $title = '<h1>Publications by ' . $auth->name . '</h1>';
                     } else {
                         if (isset($this->by) || !isset($_GET) == 0) {
                             if (count($_GET) == 0) {
                                 $viewCat = 'year';
                             } else {
                                 $viewCat = $this->by;
                             }
                             $this->pubSelect($viewCat);
                             return;
                         } else {
                             $this->pageError = true;
                         }
                     }
                 }
             }
         }
     }
     if ($this->menu) {
         echo $this->pubSelMenu(), "<br/>\n";
     }
     echo $title;
     echo displayPubList($this->db, $pub_list);
 }
Пример #10
0
 public function authorShow($auth)
 {
     $result = '';
     $table = new HTML_Table(array('width' => '600', 'border' => '0', 'cellpadding' => '6', 'cellspacing' => '0'));
     $table->setAutoGrow(true);
     $table->addRow(array('Name:', $auth->name));
     if (isset($auth->title) && trim($auth->title) != "") {
         $table->addRow(array('Title:', $auth->title));
     }
     $table->addRow(array('Email:', "<a href='mailto:" . $auth->email . "'>" . $auth->email . "</a>"));
     $table->addRow(array('Organization:', $auth->organization));
     $webpage = str_replace('http://', '', $auth->webpage);
     if (isset($auth->webpage) && !empty($webpage)) {
         $webpage = "<a href=\"" . $auth->webpage . "\" target=\"_blank\">" . $auth->webpage . "</a>";
     } else {
         $webpage = "none";
     }
     $table->addRow(array('Webpage:', $webpage));
     $interestsStr = '';
     if (isset($auth->interests) && is_array($auth->interests)) {
         $interestsStr = implode('; ', array_values($auth->interests));
     }
     $table->addRow(array('Interest(s):', $interestsStr));
     if ($auth->totalPublications == 0) {
         $table->addRow(array('No publications by this author'), array('colspan' => 2));
     } else {
         if ($auth->totalPublications <= 6) {
             assert('is_array($auth->pub_list)');
             $headingCell = 'Publications:';
             $table->addRow(array($headingCell));
         } else {
             $table->addRow(array('Publications:', '<a id="start" href="#">Show Publications by this author</a>'));
         }
     }
     $table->updateColAttributes(0, array('class' => 'emph', 'width' => '25%'));
     $result .= $table->toHtml();
     if ($auth->totalPublications > 0 && $auth->totalPublications <= 6) {
         $result .= displayPubList($this->db, $auth->pub_list);
     } else {
         $result .= "<div id=\"publist\">&nbsp;</div>";
     }
     $this->css();
     $this->javascript();
     return $result;
 }
Пример #11
0
<?php

/**
 * This script is meant to be called in response to an AJAX request.
 * 
 * It returns a listing of all the publication by a specified author. The
 * author is specified in the URL query string.
 */
require_once '../includes/defines.php';
require_once 'includes/functions.php';
require_once 'includes/htmlUtils.php';
require_once 'includes/pdDb.php';
require_once 'includes/pdAuthor.php';
if (!isset($_GET['author_id'])) {
    exit('script called with invalid arguments');
}
$db = pdDb::defaultNew();
$auth = new pdAuthor();
$auth->dbLoad($db, $_GET['author_id'], pdAuthor::DB_LOAD_PUBS_ALL | pdAuthor::DB_LOAD_INTERESTS);
if (!is_array($auth->pub_list)) {
    exit('Author with id ' . $_GET['author_id'] . ' does not have any publication entries in the database');
}
echo displayPubList($db, $auth->pub_list);