public function __construct() { parent::__construct('tag_ml_submit', 'Submit ML Paper Entries', 'diag/tag_ml_submit.php'); if ($this->loginError) { return; } $this->loadHttpVars(); $pubs_tagged = array(); foreach ($this->pub_tag as $pub_id => $tag) { if ($tag != 'yes') { continue; } $pub = new pdPublication(); $pub->dbLoad($this->db, $pub_id); if (strpos(strtolower($pub->keywords), 'machine learning' !== false)) { echo 'Error: paper titled<br/>', $pub->title, '<br/>is already a machine learning paper.<br/>'; continue; } $pub->keywordAdd('machine learning'); $pub->dbSave($this->db); $pubs_tagged[$pub_id] = $pub; } pdTagMlHistory::dbSave($this->db, array_keys($pubs_tagged)); if (count($pubs_tagged) == 0) { echo 'No publication entries tagged<br>/'; return; } echo 'The following publication entries are now tagged as ' . '<i>machine learning</i>:<ul>'; foreach ($pubs_tagged as $pub_id => $pub) { echo '<li>', $pub->title, '</li>'; } echo '</ul>'; }
public static function &newFromDb(&$db, $pub_id, $flags = self::DB_LOAD_ALL) { assert('is_numeric($pub_id)'); $pub = new pdPublication(); $pub->dbLoad($db, $pub_id, $flags); return $pub; }
public static function similarPubsHtml($db) { if (!isset($_SESSION['similar_pubs'])) { return; } $html = '<h3>Similar Publications in Database</h3>'; foreach ($_SESSION['similar_pubs'] as $sim_pub_id) { $sim_pub = new pdPublication(); $sim_pub->dbLoad($db, $sim_pub_id); $html .= $sim_pub->getCitationHtml('..', false) . '<p/>'; unset($sim_pub); } return $html; }
public function __construct() { parent::__construct('delete_publication', 'Delete Publication', 'Admin/delete_pbublication.php'); if ($this->loginError) { return; } $this->loadHttpVars(); if (isset($this->pub_id) && !is_numeric($this->pub_id)) { $this->pageError = true; return; } $form =& $this->confirmForm('deleter'); $form->addElement('hidden', 'pub_id', $this->pub_id); if ($form->validate()) { $values = $form->exportValues(); $pub = new pdPublication(); $result = $pub->dbLoad($this->db, $values['pub_id']); if (!$result) { $this->pageError = true; return; } $title = $pub->title; $pub->dbDelete($this->db); echo 'You have successfully removed the following ', 'publication from the database: <p/><b>', $title, '</b>'; } else { if ($this->pub_id == null) { echo 'No pub id defined'; $this->pageError = true; return; } $pub = new pdPublication(); $result = $pub->dbLoad($this->db, $this->pub_id); if (!$result) { $this->pageError = true; return; } $renderer =& $form->defaultRenderer(); $form->accept($renderer); echo '<h3>Delete Publication</h3>Delete the following paper?<p/>', $pub->getCitationHtml(); $this->form =& $form; $this->renderer =& $renderer; } }
public function __construct() { parent::__construct(); if ($this->loginError) { return; } $this->use_mootools = true; $this->pub =& $_SESSION['pub']; if (isset($this->pub->pub_id)) { $this->page_title = 'Edit Publication'; } $this->authors = pdAuthorList::create($this->db, null, null, true); $form = new HTML_QuickForm('add_pub2', 'post', '', '', array('onsubmit' => 'return check_authors("add_pub2");')); $form->addElement('header', null, 'Select from Authors in Database'); $tooltip = 'Authors::The authors of the publication. Listed in the same order as in the publication <p/> If an author is not already in the database press the <b>Add Author not in DB</b> button.'; $form->addElement('textarea', 'authors', "<div id=\"MYCUSTOMFLOATER\" class=\"myCustomFloater\" style=\"position:absolute;top:200px;left:600px;background-color:#cecece;display:none;visibility:hidden\"><div class=\"myCustomFloaterContent\"></div></div>" . "<span class=\"Tips1\" title=\"{$tooltip}\">Authors</span>:", array('cols' => 60, 'rows' => 5, 'class' => 'wickEnabled:MYCUSTOMFLOATER', 'wrap' => 'virtual')); $form->addElement('static', null, null, '<span class="small">' . 'There are ' . count($this->authors) . ' authors in the database. Type a partial name to ' . 'see a list of matching authors. Separate names ' . 'using commas.</span>'); $form->addElement('submit', 'add_new_author', 'Add Author not in DB'); // collaborations radio selections $tooltip = 'Collaborations::If the publication is a collaboration, select the options that apply to this paper.'; $form->addElement('header', null, "<span class=\"Tips1\" title=\"{$tooltip}\">Collaborations</span>"); $collaborations = pdPublication::collaborationsGet($this->db); foreach ($collaborations as $col_id => $description) { $radio_cols[] = HTML_QuickForm::createElement('checkbox', 'paper_col[' . $col_id . ']', null, $description, 1); } $form->addGroup($radio_cols, 'group_collaboration', null, '<br/>', false); $pos = strpos($_SERVER['PHP_SELF'], 'papersdb'); $url = substr($_SERVER['PHP_SELF'], 0, $pos) . 'papersdb'; $buttons[] = HTML_QuickForm::createElement('submit', 'prev_step', '<< Previous Step'); $buttons[] = HTML_QuickForm::createElement('button', 'cancel', 'Cancel', array('onclick' => "cancelConfirm();")); $buttons[] = HTML_QuickForm::createElement('submit', 'next_step', 'Next Step >>'); if ($this->pub->pub_id != '') { $buttons[] = HTML_QuickForm::createElement('submit', 'finish', 'Finish'); } $form->addGroup($buttons, 'buttons', '', ' ', false); $this->form =& $form; if ($form->validate()) { $this->processForm(); } else { $this->renderForm(); } }
public function venuePosterRank() { $bad_rank = array(); foreach ($this->getAllPubIds() as $pub_id) { $pub = pdPublication::newFromDb($this->db, $pub_id); // if the ranking does not match the venue if (is_object($pub->category) && $pub->category->cat_id == 12 && $pub->rank_id != 4) { $bad_rank[] = $pub->pub_id; } unset($pub); } echo '<h2>Poster publication entries with suspect rankings</h1>'; $pub_list = pdPubList::create($this->db, array('pub_ids' => $bad_rank)); echo displayPubList($this->db, $pub_list, true, -1, null, null, '../'); }
public function __construct() { parent::__construct(); if ($this->loginError) { return; } $this->use_mootools = true; $this->loadHttpVars(true, false); $this->pub =& $_SESSION['pub']; if (isset($this->pub->pub_id)) { $this->page_title = 'Edit Publication'; } if (empty($this->venue_id) && is_object($this->pub->venue) && !empty($this->pub->venue->venue_id)) { $this->venue_id = $this->pub->venue->venue_id; } if (isset($this->venue_id)) { if ($this->venue_id >= 0) { $this->pub->addVenue($this->db, $this->venue_id); } else { $this->pub->venue = null; } } if (isset($this->cat_id)) { $this->pub->addCategory($this->db, $this->cat_id); } else { if (is_object($this->pub->category)) { $this->cat_id = $this->pub->category->cat_id; } } $this->addPubDisableMenuItems(); $form = new HTML_QuickForm('add_pub3'); $form->addElement('header', null, 'Category Information'); // category $category_list = pdCatList::create($this->db); $category[] = HTML_QuickForm::createElement('select', 'cat_id', null, array('' => '--- Please Select a Category ---') + $category_list, array('onchange' => 'dataKeep();')); $text = ''; if (is_object($this->pub->venue) && is_object($this->pub->category) && $this->pub->venue->cat_id != 0 && $this->pub->venue->cat_id != $this->pub->category->cat_id) { $text = '<span class="emph">(venue default is: ' . $category_list[$this->pub->venue->cat_id] . ')</span>'; } $category[] = HTML_QuickForm::createElement('static', null, null, $text); $tooltip = 'Category::The type of publication entry being submitted to the database. For example this could be a conference paper, a journal entry, a book chapter, etc. <p/> Select the appropriate category from the drop down menu'; $form->addGroup($category, null, "<span class=\"Tips1\" title=\"{$tooltip}\">Category</span>:", ' ', false); // Venue if (is_object($this->pub->category) && in_array($this->cat_id, array(1, 3, 4))) { $vlist = pdVenueList::create($this->db, array('cat_id' => $this->cat_id, 'concat' => true)); } else { $vlist = pdVenueList::create($this->db, array('concat' => true)); } $venues[''] = '--Select Venue--'; $venues['-1'] = '--No Venue--'; // check if user info has 'Venues previously used by me' checked if ($this->used_by_me == 'yes') { $user =& $_SESSION['user']; $user->venueIdsGet($this->db); foreach ($vlist as $venue_id => $name) { if (isset($user->venue_ids[$venue_id])) { $venues[$venue_id] = htmlentities($name); } } } else { foreach ($vlist as $venue_id => $name) { $venues[$venue_id] = htmlentities($name); } } $tooltip = 'Venue::Where the paper was published -- specific journal, conference, workshop, etc. If many of the database papers are in the same venue, you can create a single <b>label</b> for that venue, to specify name of the venue, location, date, editors and other common information. You will then be able to use and re-use that information.'; $form->addElement('select', 'venue_id', "<span class=\"Tips1\" title=\"{$tooltip}\">Venue</span>:", $venues, array('style' => 'width: 70%;', 'onchange' => 'dataKeep();')); $form->addElement('submit', 'add_venue', 'Add New Venue'); $form->addElement('advcheckbox', 'used_by_me', null, 'Only show venues previously used by me', array('onchange' => 'dataKeep();'), array('', 'yes')); // rankings radio selections $rankings = pdPublication::rankingsGlobalGet($this->db); foreach ($rankings as $rank_id => $description) { $text = $description; if (is_object($this->pub->venue)) { if ($this->pub->venue->rank_id == $rank_id) { $text .= ' <span class="emph">(venue default)</span>'; } } else { if (is_object($this->pub->category) && ($this->pub->category->cat_id == 1 && $rank_id == 2 || $this->pub->category->cat_id == 3 && $rank_id == 2 || $this->pub->category->cat_id == 4 && $rank_id == 3)) { $text .= ' <span class="emph">(category default)</span>'; } } $radio_rankings[] = HTML_QuickForm::createElement('radio', 'paper_rank', null, $text, $rank_id); } $radio_rankings[] = HTML_QuickForm::createElement('radio', 'paper_rank', null, 'other (fill in box below)', -1); $radio_rankings[] = HTML_QuickForm::createElement('text', 'paper_rank_other', null, array('size' => 30, 'maxlength' => 250)); $tooltip = 'Ranking::Select the ranking of the venue. If the venue is already in the database the ranking should be selected automatically. Sometimes the paper may have a ranking different from the venue ranking.'; $form->addGroup($radio_rankings, 'group_rank', "<span class=\"Tips1\" title=\"{$tooltip}\">Ranking</span>:", '<br/>', false); if ($this->cat_id > 0 && is_object($this->pub->category) && is_array($this->pub->category->info) && count($this->pub->category->info) > 0) { foreach ($this->formInfoElementsGet() as $element => $name) { $form->addElement('text', $element, $name . ':', array('size' => 50, 'maxlength' => 250)); } } $tooltip = 'Date::The date the publication was published.'; $form->addElement('date', 'pub_date', "<span class=\"Tips1\" title=\"{$tooltip}\">Date</span>:", array('format' => 'YM', 'minYear' => pdPublication::MIN_YEAR, 'maxYear' => pdPublication::MAX_YEAR)); $form->addElement('header', 'other_info', 'Other information', null); $tooltip = 'Extra Information::Specify auxiliary information to help classify this publication. Eg, "with student" or "best paper", etc. <p/> Note: by default this information will NOT be shown when this publication entry is displayed.'; $form->addElement('textarea', 'extra_info', "<span class=\"Tips1\" title=\"{$tooltip}\">Extra Information</span>:", array('cols' => 60, 'rows' => 5)); $form->addElement('static', null, null, '<span class="small">' . 'Separate using semicolons.' . ' See help text for examples of what goes here ' . '(use mouse to hover over \'Extra Information\' ' . 'text).' . '</span>'); $pos = strpos($_SERVER['PHP_SELF'], 'papersdb'); $url = substr($_SERVER['PHP_SELF'], 0, $pos) . 'papersdb'; $buttons[] = HTML_QuickForm::createElement('submit', 'prev_step', '<< Previous Step'); $buttons[] = HTML_QuickForm::createElement('button', 'cancel', 'Cancel', array('onclick' => "cancelConfirm();")); $buttons[] = HTML_QuickForm::createElement('reset', 'reset', 'Reset'); $buttons[] = HTML_QuickForm::createElement('submit', 'next_step', 'Next Step >>'); if ($this->pub->pub_id != '') { $buttons[] = HTML_QuickForm::createElement('submit', 'finish', 'Finish'); } $form->addGroup($buttons, 'buttons', '', ' ', false); $this->form =& $form; if ($form->validate()) { $this->processForm(); } else { $this->renderForm(); } }
private static function arrayPubsDBLoadByCategory($db, $pub_ids) { assert('is_object($db)'); assert('is_array($pub_ids)'); $list = array(); if (count($pub_ids) == 0) { return $list; } foreach ($pub_ids as $pub_id) { if (!is_numeric($pub_id)) { continue; } $pub = new pdPublication(); $result = $pub->dbLoad($db, $pub_id, pdPublication::DB_LOAD_BASIC | pdPublication::DB_LOAD_CATEGORY); if ($result !== false) { $pubs[] = $pub; } } return self::arrayPubsSortByCategory($db, $pubs); }
public function showSearchParams() { $sp =& $_SESSION['search_params']; $table = new HTML_Table(array('class' => 'nomargins', 'width' => '90%')); if ($sp->search != '') { $table->addRow(array($sp->search)); } else { // check each field of the search parameter except the dates and // authors foreach (array_diff(array_keys(get_class_vars(get_class($sp))), array('startdate', 'enddate', 'author_myself', 'authors', 'paper_rank', 'paper_rank_other', 'paper_col')) as $param) { if ($sp->{$param} != '') { $name = ''; if ($param == 'cat_id') { $cl = pdCatList::create($this->db); $name = 'Category'; $value =& $cl[$sp->cat_id]; } else { $name = preg_replace('/_/', ' ', ucwords($param)); $value = $sp->{$param}; } if ($param == 'show_internal_info' && $sp->{$param} == 'no') { continue; } if ($name != '') { $table->addRow(array($name . ':', $value)); } } } $al = null; $values = array(); if (!empty($_SESSION['user']) && $sp->author_myself != '' && $_SESSION['user']->author_id != '') { $authors = pdAuthorList::create($this->db, null, null, true); $values[] = $authors[$_SESSION['user']->author_id]; } if (!empty($sp->authors)) { $values[] = $sp->authors; } if (count($values) > 0) { $table->addRow(array('<b>Author(s)</b>:', implode(' AND ', $values))); } if (isset($_SESSION['user']) && $_SESSION['user']->showInternalInfo()) { if (!empty($sp->paper_rank)) { // ranking $label = 'Ranking:'; $rankings = pdPublication::rankingsGlobalGet($this->db); foreach ($sp->paper_rank as $rank_id => $value) { if ($value != 'yes') { continue; } $table->addRow(array($label, $rankings[$rank_id])); $label = ''; } if ($sp->paper_rank_other != '') { $table->addRow(array($label, $sp->paper_rank_other)); } } if (!empty($sp->paper_col)) { // collaboration $label = 'Collaboration:'; $collaborations = pdPublication::collaborationsGet($this->db); foreach ($sp->paper_col as $col_id => $value) { if ($value != 'yes') { continue; } $table->addRow(array($label, $collaborations[$col_id])); $label = ''; } } } if ($sp->startdate != '' && $sp->enddate != '') { $stime = strtotime(implode('-', $sp->startdate) . '-1'); $etime = strtotime(implode('-', $sp->enddate) . '-1'); // now check the dates if ($etime > $stime) { $table->addRow(array('<b>Start date</b>:', $sp->startdate['Y'] . '-' . sprintf("%02d", $sp->startdate['M']))); $table->addRow(array('<b>End date</b>:', $sp->enddate['Y'] . '-' . sprintf("%02d", $sp->enddate['M']))); } } } $table->updateColAttributes(0, array('class' => 'emph'), true); echo '<h3>SEARCH RESULTS FOR</h3>'; echo $table->toHtml(); }
/** * Creates the from used on this page. The renderer is then used to * display the form correctly on the page. */ private function createForm() { $user = null; $form = new HTML_QuickForm('advSearchForm', 'get', 'search_publication_db.php', '_self', array('onsubmit' => 'return check_authors("advSearchForm");')); $form->addElement('text', 'title', 'Title:', array('size' => 60, 'maxlength' => 250)); $form->addElement('text', 'venue', 'Venue:', array('size' => 60, 'maxlength' => 250)); $form->addElement('select', 'cat_id', 'Category:', array('' => '-- All Categories --') + pdCatList::create($this->db)); $form->addElement('text', 'abstract', 'Abstract:', array('size' => 60, 'maxlength' => 250)); $auth_list = pdAuthorList::create($this->db); if ($this->access_level > 0 && $_SESSION['user']->author_id != '') { $user =& $_SESSION['user']; unset($auth_list[$user->author_id]); } $form->addElement('textarea', 'authors', 'Authors:', array('cols' => 60, 'rows' => 5, 'class' => 'wickEnabled:MYCUSTOMFLOATER', 'wrap' => 'virtual')); $form->addElement('static', null, null, '<span class="small">' . 'There are ' . count($this->db_authors) . ' authors in the database. Type a partial name to ' . 'see a list of matching authors. Separate names ' . 'using commas.</span>'); if ($user != null) { $form->addElement('advcheckbox', 'author_myself', null, 'add me to the search', null, array('', $user->author_id)); } if (isset($_SESSION['user']) && $_SESSION['user']->showInternalInfo()) { // rankings selections $rankings = pdPublication::rankingsGlobalGet($this->db); foreach ($rankings as $rank_id => $description) { $radio_rankings[] = HTML_QuickForm::createElement('advcheckbox', 'paper_rank[' . $rank_id . ']', null, $description, null, array('', 'yes')); } $radio_rankings[] = HTML_QuickForm::createElement('static', 'paper_ranking_label', null, 'other', -1); $radio_rankings[] = HTML_QuickForm::createElement('text', 'paper_rank_other', null, array('size' => 30, 'maxlength' => 250)); $form->addGroup($radio_rankings, 'group_rank', 'Ranking:', '<br/>', false); // collaborations radio selections $collaborations = pdPublication::collaborationsGet($this->db); foreach ($collaborations as $col_id => $description) { $radio_cols[] = HTML_QuickForm::createElement('advcheckbox', 'paper_col[' . $col_id . ']', null, $description, null, array('', 'yes')); } $form->addGroup($radio_cols, 'group_collaboration', 'Collaboration:', '<br/>', false); } $form->addElement('text', 'paper', 'Paper filename:', array('size' => 60, 'maxlength' => 250)); $kwElement[0] =& HTML_QuickForm::createElement('text', 'keywords', null, array('size' => 60, 'maxlength' => 250)); $kwElement[1] =& HTML_QuickForm::createElement('static', 'auth_label', null, '<span class="small">seperate using semi-colon (;)</span>'); $form->addGroup($kwElement, 'keywordsGroup', 'Keywords:', '<br/>', false); if (isset($_SESSION['user']) && $_SESSION['user']->showUserInfo()) { $form->addElement('text', 'user_info', 'User Info:', array('size' => 60, 'maxlength' => 250)); } $form->addGroup(array(HTML_QuickForm::createElement('date', 'startdate', 'Start Date:', array('format' => 'YM', 'minYear' => pdPublication::MIN_YEAR, 'maxYear' => pdPublication::MAX_YEAR)), HTML_QuickForm::createElement('static', null, null, 'and'), HTML_QuickForm::createElement('date', 'enddate', 'End Date:', array('format' => 'YM', 'minYear' => pdPublication::MIN_YEAR, 'maxYear' => pdPublication::MAX_YEAR))), null, 'Published between:', ' ', false); if (isset($_SESSION['user'])) { $form->addElement('advcheckbox', 'show_internal_info', 'Options:', 'show internal information', null, array('no', 'yes')); } $form->addGroup(array(HTML_QuickForm::createElement('button', 'fill_last', 'Load Previous Search Terms', array('onClick' => 'lastSearchUse();')), HTML_QuickForm::createElement('submit', 'Submit', 'Search')), 'buttonsGroup', '', ' ', false); return $form; }
public function formRelatedPubs() { $form =& $this->form; $num_related_pubs = count($this->pub->related_pubs); $form->addElement('header', 'related_pubs_hdr', 'Related Publication(s)', null); $tooltip = 'Pub Link::Creates a relationship between this publication and another publication that already has an entry in the database.'; if (count($this->pub->related_pubs) > 0) { $c = 0; foreach ($this->pub->related_pubs as $pub_id) { $intPub = new pdPublication(); $result = $intPub->dbLoad($this->db, $pub_id); if (!$result) { continue; } $form->addGroup(array(HTML_QuickForm::createElement('static', 'curr_related_pub' . $c, null, $intPub->title), HTML_QuickForm::createElement('submit', 'remove_related_pub' . $c, 'Remove'), HTML_QuickForm::createElement('hidden', 'related_pub_id' . $c, $intPub->pub_id)), 'curr_related_pubs_group', "<span class=\"Tips1\" title=\"{$tooltip}\">Pub " . ($c + 1) . '</span>:', ' ', false); $label = ''; $c++; } } $pub_list = pdPubList::create($this->db); if (!empty($pub_list) && count($pub_list) > 0) { $options[''] = '--- select publication --'; foreach ($pub_list as $p) { if (strlen($p->title) > 70) { $options[$p->pub_id] = substr($p->title, 0, 67) . '...'; } else { $options[$p->pub_id] = $p->title; } } $form->addElement('select', 'new_related_pub', "<span class=\"Tips1\" title=\"{$tooltip}\">New Pub </span>:", $options); } $form->addElement('submit', 'add_related_pubs', 'Add Related Publication'); $form->addElement('hidden', 'num_related_pubs', $num_related_pubs); }
private function showPublication(&$pub) { $content = "<h2>" . $pub->title; if ($this->access_level > 0) { $content .= getPubIcons($this->db, $pub, 0xc); } $content .= "</h2>\n" . $pub->authorsToHtml(); if (isset($pub->paper) && strtolower($pub->paper) != 'no paper' && basename($pub->paper) != 'paper_') { if ($pub->paperExists()) { $content .= 'Full Text: <a href="' . $pub->paperAttGetUrl() . '">'; $name = split('paper_', $pub->paper); if ($name[1] != '') { $content .= $name[1]; } $content .= '</a> '; $content .= getPubIcons($this->db, $pub, 0x1) . "<br/>\n"; } } // Show Additional Materials $att_types = pdAttachmentTypesList::create($this->db); if (count($pub->additional_info) > 0) { $table = new HTML_Table(array('width' => '350', 'border' => '0', 'cellpadding' => '6', 'cellspacing' => '0')); $heading = 'Other Attachments:'; $add_count = 1; foreach ($pub->additional_info as $att) { $cell = ''; if ($pub->attExists($att)) { $name = split('additional_', $att->location); $cell .= '<a href="' . $pub->attachmentGetUrl($add_count - 1) . '">'; if ($name[1] != '') { $cell .= $name[1]; } $cell .= '</a>'; if (in_array($att->type, $att_types)) { $cell .= ' [' . $att->type . ']'; } $cell .= ' <a href="' . $pub->attachmentGetUrl($add_count - 1) . '">' . $this->getPubAddAttIcons($att) . '</a>'; $add_count++; } $table->addRow(array($heading, $cell)); $heading = ''; } $content .= $table->toHtml(); } $content .= '<p/>' . stripslashes($pub->abstract) . '<p/>' . '<h3>Citation</h3>' . $pub->getCitationHtml() . '<p/>'; $table = new HTML_Table(array('width' => '600', 'border' => '0', 'cellpadding' => '6', 'cellspacing' => '0')); $category = ''; if (isset($pub->category) && isset($pub->category->category)) { $category = $pub->category->category; } $table->addRow(array('Keywords:', $pub->keywordsGet())); $table->addRow(array('Category:', $category)); if (isset($_SESSION['user']) && $_SESSION['user']->showInternalInfo()) { $table->addRow(array('Ranking:', $pub->ranking)); if (is_array($pub->collaborations) && count($pub->collaborations) > 0) { $col_desciptions = $pub->collaborationsGet($this->db); foreach ($pub->collaborations as $col_id) { $values[] = $col_desciptions[$col_id]; } $table->addRow(array('Collaboration:', implode(', ', $values))); } $table->addRow(array('Extra Info:', $pub->extraInfoGet())); } if (isset($_SESSION['user']) && $_SESSION['user']->showUserInfo()) { $table->addRow(array('User Info:', $pub->user)); } $web_links = $pub->getWebLinks(); if (count($web_links) > 0) { $c = 0; foreach ($web_links as $name => $url) { if ($c == 0) { $label = 'Web Links:'; } else { $label = ''; } $table->addRow(array($label, '<a href="' . $url . '" ' . 'target="_blank">' . $name . '</a>')); $c++; } } if (count($pub->relatedPubsGet()) > 0) { $c = 0; foreach ($pub->relatedPubsGet() as $related_pub_id) { if ($c == 0) { $label = 'Related Publication(s):'; } else { $label = ''; } $rel_pub = new pdPublication(); $rel_pub->dbLoad($this->db, $related_pub_id); $table->addRow(array($label, '<a href="view_publication.php?' . 'pub_id=' . $rel_pub->pub_id . '" ' . ' target="_blank">' . $rel_pub->title . '</a>')); $c++; } } $table->updateColAttributes(0, array('class' => 'emph', 'width' => '25%')); $content .= $table->toHtml(); $bibtex = $pub->getBibtex(); if ($bibtex !== false) { $content .= '<h3>BibTeX</h3><pre class="bibtex">' . $bibtex . '</pre><p/>'; } $updateStr = $this->lastUpdateGet($pub); if ($updateStr != '') { $updateStr = 'Last Updated: ' . $updateStr . '<br/>'; } $updateStr .= 'Submitted by ' . $pub->submit; echo $content, '<span class="small">', $updateStr, '</span>'; }
public function testBibtexPages() { $pub = new pdPublication(); $pub->title = uniqid('pub_title_'); $pub->addCategory($this->db, 1); $pub->info['Editor'] = 'test'; $pub->info['Pages'] = '22-23'; $pub->dbSave($this->db); //var_dump($pub); var_dump($pub->getBibtex()); }
function displayPubListByCategory(&$db, &$pub_list, $enumerate = true, $max = -1, $options = null, $url_prefix = '') { assert('is_object($db)'); assert('is_array($pub_list)'); $result = ''; $count = 0; $col_desciptions = pdPublication::collaborationsGet($db); foreach (pdPubList::catDisplayOrder() as $category) { $pubs =& $pub_list[$category]; if (empty($pubs)) { continue; } if ($category == 'Other') { $result .= "<h3>Other Categories</h3>\n"; } else { $result .= '<h3>' . $category . "</h3>\n"; } foreach ($pubs as $pub) { ++$count; $pub->dbLoad($db, $pub->pub_id); $cells = array(); $table = new HTML_Table(array('class' => 'publist', 'cellpadding' => '0', 'cellspacing' => '0')); $table->setAutoGrow(true); $citation = $pub->getCitationHtml($url_prefix) . ' ' . getPubIcons($db, $pub, 0xf, $url_prefix); if (is_array($options) && !empty($options['show_internal_info']) && $options['show_internal_info'] || isset($_SESSION['user']) && $_SESSION['user']->showInternalInfo()) { $citation .= '<br/><span style="font-size:80%">'; if (isset($pub->ranking)) { $citation .= 'Ranking: ' . $pub->ranking; } if (is_array($pub->collaborations) && count($pub->collaborations) > 0) { $values = array(); foreach ($pub->collaborations as $col_id) { $values[] = $col_desciptions[$col_id]; } $citation .= '<br/>Collaboration:' . implode(', ', $values); } if (isset($_SESSION['user']) && $_SESSION['user']->showUserInfo()) { $citation .= "<br/>User Info: {$pub->user}"; } $citation .= '</span>'; } if ($enumerate) { $cells[] = $count . '.'; } $cells[] = $citation; $table->addRow($cells); if ($enumerate) { $table->updateColAttributes(0, array('class' => 'item'), NULL); } $result .= $table->toHtml(); unset($table); if ($max > 0 && $count >= $max) { break; } } } return $result; }