Exemplo n.º 1
0
    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', '', '&nbsp;', false);
        $this->form =& $form;
        if ($form->validate()) {
            $this->processForm();
        } else {
            $this->renderForm();
        }
    }
Exemplo n.º 2
0
 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();
 }
Exemplo n.º 3
0
 /**
  * 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:', '&nbsp;', 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', '', '&nbsp;', false);
     return $form;
 }
Exemplo n.º 4
0
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) . '&nbsp;' . 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;
}