Пример #1
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();
 }
Пример #2
0
    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.
&lt;p/&gt;
Select the appropriate category from the drop down menu';
        $form->addGroup($category, null, "<span class=\"Tips1\" title=\"{$tooltip}\">Category</span>:", '&nbsp;&nbsp;', 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, &quot;with student&quot; or &quot;best
paper&quot;, etc.
&lt;p/&gt;
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', '', '&nbsp;', false);
        $this->form =& $form;
        if ($form->validate()) {
            $this->processForm();
        } else {
            $this->renderForm();
        }
    }
Пример #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;
 }