public function pubSelect($viewCat = null) { assert('is_object($this->db)'); echo $this->pubSelMenu($viewCat), '<br/>'; $text = ''; switch ($viewCat) { case "year": $pub_years = pdPubList::create($this->db, array('year_list' => true)); echo '<h2>Publications by Year:</h2>'; if (count($pub_years) > 0) { $table = new HTML_Table(array('class' => 'nomargins', 'width' => '100%')); $table->addRow(array('Year', 'Num. Publications'), array('class' => 'emph')); foreach (array_values($pub_years) as $item) { $cells = array(); $cells[] = '<a href="list_publication.php?year=' . $item['year'] . '">' . $item['year'] . '</a>'; $cells[] = $item['count']; $table->addRow($cells); } echo $table->toHtml(); } else { echo 'No publication entries.'; } break; case 'author': echo '<h2>Publications by Author:</h2>'; $al = pdAuthorList::create($this->db); for ($c = 65; $c <= 90; ++$c) { $table = new HTML_Table(array('class' => 'publist')); $text = ''; foreach ($al as $auth_id => $name) { if (substr($name, 0, 1) == chr($c)) { $text .= '<a href="list_publication.php?author_id=' . $auth_id . '">' . $name . '</a> '; } } $table->addRow(array(chr($c), $text)); $table->updateColAttributes(0, array('class' => 'item'), NULL); echo $table->toHtml(); } break; case 'venue': // publications by keyword unset($table); $vl = pdVenueList::create($this->db); echo '<h2>Publications by Venue:</h2>'; for ($c = 65; $c <= 90; ++$c) { $table = new HTML_Table(array('class' => 'publist')); $text = ''; foreach ($vl as $vid => $v) { if (substr($v, 0, 1) == chr($c)) { $text .= '<a href="list_publication.php?venue_id=' . $vid . '">' . $v . '</a> '; } } $table->addRow(array(chr($c), $text)); $table->updateColAttributes(0, array('class' => 'item'), NULL); echo $table->toHtml(); } break; case 'category': $table = new HTML_Table(array('class' => 'nomargins', 'width' => '100%')); $cl = pdCatList::create($this->db); $table->addRow(array('Category', 'Num. Publications'), array('class' => 'emph')); foreach ($cl as $cat_id => $category) { $cells = array(); $cells[] = '<a href="list_publication.php?cat_id=' . $cat_id . '">' . $category . '</a><br/>'; $cells[] = pdCatList::catNumPubs($this->db, $cat_id); $table->addRow($cells); } echo '<h2>Publications by Category:</h2>', $table->toHtml(); break; case 'keywords': // publications by keyword unset($table); $kl = pdPubList::create($this->db, array('keywords_list' => true)); echo '<h2>Publications by Keyword:</h2>'; for ($c = 65; $c <= 90; ++$c) { $table = new HTML_Table(array('class' => 'publist')); $text = ''; foreach ($kl as $kw) { if (substr($kw, 0, 1) == chr($c)) { $text .= '<a href="list_publication.php?keyword=' . $kw . '">' . $kw . '</a> '; } } $table->addRow(array(chr($c), $text)); $table->updateColAttributes(0, array('class' => 'item'), NULL); echo $table->toHtml(); } break; default: $this->pageError = true; } }
public function __construct() { parent::__construct('list_venues'); if ($this->loginError) { return; } $this->loadHttpVars(true, false); if (!isset($this->tab)) { $this->tab = 'A'; } else { if (strlen($this->tab) != 1 || ord($this->tab) < ord('A') || ord($this->tab) > ord('Z')) { $this->pageError = true; return; } } $venue_list = pdVenueList::create($this->db, array('starting_with' => $this->tab, 'cat_id' => $this->cat_id)); $this->category = new pdCategory(); $this->category->dbLoad($this->db, $this->cat_id); $form = new HTML_QuickForm('cat_selection', 'get', 'list_venues.php'); $form->addElement('hidden', 'tab', $this->tab); $form->addElement('select', 'cat_id', 'Category:', array('' => '-- All Categories --') + pdCatList::create($this->db), array('onchange' => 'update();')); $renderer =& $form->defaultRenderer(); $form->accept($renderer); $form->setDefaults(array('cat_id' => '')); $alpha_menu = $this->alphaSelMenu($this->tab, get_class($this) . '.php'); // put category id in the alpha menu if (!empty($this->cat_id)) { $alpha_menu = preg_replace('/tab=(\\w)/', "tab=\\1&cat_id={$this->cat_id}", $alpha_menu); } $this->javascript(); echo $alpha_menu; echo '<h2>Publication Venues</h2>'; echo $renderer->toHtml(); if (empty($venue_list) || count($venue_list) == 0) { echo 'No venues with name starting with ', $this->tab, '<br/>'; return; } foreach ($venue_list as $venue) { // only show global venues if ($venue->v_usage == 'single') { continue; } $venue->dbLoad($this->db, $venue->venue_id); $table = new HTML_Table(array('class' => 'publist')); $cells = array(); $text = ''; if ($venue->title != '') { $text .= '<b>' . $venue->title . '</b><br/>'; } $v_cat = $venue->categoryGet(); if (!empty($v_cat)) { $text .= '<b>' . ucfirst($v_cat) . '</b>: '; } $url = $venue->urlGet(); if ($url != null) { $text .= '<a href="' . $url . '" target="_blank">'; } $text .= $venue->nameGet(); if ($url != null) { $text .= '</a>'; } if (!empty($venue->options)) { $vopt_names = $venue->voptsGet(); foreach ($venue->options as $vopt_id => $value) { if (!empty($value)) { $text .= '<br/><b>' . $vopt_names[$vopt_id] . '</b>: ' . $value; } } } if ($venue->editor != '') { $text .= "<br/><b>Editor: </b>" . $venue->editor; } if (isset($venue->ranking)) { $text .= '<br/><b>Ranking</b>: ' . $venue->ranking; } // display occurrences if (count($venue->occurrences) > 0) { foreach ($venue->occurrences as $occ) { $text .= '<br/>'; $date = explode('-', $occ->date); if ($occ->url != '') { $text .= '<a href="' . $occ->url . '" target="_blank">'; } $text .= $date[0]; if ($occ->url != '') { $text .= '</a>'; } if ($occ->location != '') { $text .= ', ' . $occ->location; } } } else { if ($venue->date != '' && $venue->date != '0000-00-00') { $date = explode('-', $venue->date); $text .= "<br/><b>Date: </b>" . $date[0] . '-' . $date[1]; } } $pub_count = pdPubList::create($this->db, array('venue_id_count' => $venue->venue_id)); $text .= '<a href="list_publication.php?venue_id=' . $venue->venue_id . '&menu=0"><span class="small" style="color:#000;font-weight:normal;">' . '<br/>Publication entries: ' . $pub_count . '</span></a>'; $cells[] = $text; if ($this->access_level > 0) { $cells[] = $this->getVenueIcons($venue); } $table->addRow($cells); $table->updateColAttributes(1, array('class' => 'icons'), NULL); echo $table->toHtml(); unset($table); } }
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(); } }
<?php //#!/usr/bin/env php require_once '../includes/defines.php'; require_once 'includes/functions.php'; require_once 'includes/pdDb.php'; require_once 'includes/pdVenue.php'; require_once 'includes/pdVenueList.php'; $db = new pdDb(array('name' => 'pubDB')); $venues = pdVenueList::create($db); if (count($venues) == 0) { echo 'No venues in database'; $db->close(); exit; } if (0) { foreach ($venues as $pub_id => $title) { $venue = new pdVenue(); $venue->dbLoad($db, $pub_id); if (pdDB::venueTableUpgraded() == 0 && !empty($venue->data)) { $op = array($pub_id, $venue->nameGet()); if (!empty($venue->cat_id)) { $op[] = $venue->cat_id; } else { $op[] = '*'; } $op[] = $venue->data; echo '<pre>', implode("\t", $op), '</pre>', "\n"; } $venue->dbSave($db); }