Ejemplo n.º 1
0
 public function __construct()
 {
     parent::__construct('all_categories');
     if ($this->loginError) {
         return;
     }
     $cat_list = pdCatList::create($this->db);
     echo '<h1>Publication Categories</h1>';
     foreach (array_keys($cat_list) as $cat_id) {
         unset($fields);
         unset($cells);
         $category = new pdCategory();
         $result = $category->dbLoad($this->db, $cat_id);
         assert('$result');
         $table = new HTML_Table(array('class' => 'publist'));
         $table->setAutoGrow(true);
         $cells[] = '<b>' . $category->category . '</b><br/>';
         if (count($category->info) > 0) {
             foreach ($category->info as $info_id => $name) {
                 $fields[] = $name;
             }
             $cells[] = 'Fields: ' . implode(', ', $fields);
         } else {
             $cells[] = '';
         }
         if ($this->access_level > 0) {
             $cells[] = $this->getCategoryIcons($category);
         }
         $table->addRow($cells);
         $table->updateColAttributes(0, array('class' => 'category'), NULL);
         $table->updateColAttributes(2, array('class' => 'icons'), NULL);
         echo $table->toHtml();
         unset($table);
     }
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
0
 public function venueCategories()
 {
     $bad_cat = array();
     $additional = array();
     $categories = pdCatList::create($this->db);
     foreach ($this->getAllPubIds() as $pub_id) {
         $pub = pdPublication::newFromDb($this->db, $pub_id);
         if (is_object($pub->venue) && is_object($pub->category)) {
             if ($pub->venue->cat_id == 0) {
                 $bad_cat[] = $pub->pub_id;
                 $additional[$pub->pub_id] = 'Venue has no category';
             } else {
                 if ($pub->venue->cat_id != $pub->category->cat_id) {
                     $bad_cat[] = $pub->pub_id;
                     $additional[$pub->pub_id] = 'Venue category is: ' . $categories[$pub->venue->cat_id] . '<br/> Pub entry category is: ' . $categories[$pub->category->cat_id];
                 }
             }
         }
     }
     echo '<h2>Non Matching Venue Category</h1>';
     $pub_list = pdPubList::create($this->db, array('pub_ids' => $bad_cat));
     echo displayPubList($this->db, $pub_list, true, -1, $additional, null, '../');
 }
Ejemplo n.º 4
0
 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>&nbsp;&nbsp; ';
                     }
                 }
                 $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>&nbsp;&nbsp; ';
                     }
                 }
                 $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>&nbsp;&nbsp; ';
                     }
                 }
                 $table->addRow(array(chr($c), $text));
                 $table->updateColAttributes(0, array('class' => 'item'), NULL);
                 echo $table->toHtml();
             }
             break;
         default:
             $this->pageError = true;
     }
 }
Ejemplo n.º 5
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();
        }
    }
Ejemplo n.º 6
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();
 }
Ejemplo n.º 7
0
 public function __construct()
 {
     parent::__construct('add_venue');
     if ($this->loginError) {
         return;
     }
     $this->loadHttpVars();
     if (!isset($this->referer)) {
         $referer = getenv('HTTP_REFERER');
         if (strpos($referer, 'list_venues.php') !== false) {
             $this->referer = $referer;
         }
     }
     $this->venue = new pdVenue();
     if ($this->venue_id != null) {
         $this->venue->dbLoad($this->db, $this->venue_id);
     }
     if (!empty($this->cat_id)) {
         $this->venue->categoryAdd($this->db, $this->cat_id);
     } else {
         if (is_object($this->venue->category)) {
             $this->cat_id = $this->venue->category->cat_id;
         }
     }
     $this->newOccurrences = 0;
     if (is_object($this->venue->category) && ($this->venue->category->category == 'In Conference' || $this->venue->category->category == 'In Workshop')) {
         if (isset($this->numNewOccurrences) && is_numeric($this->numNewOccurrences)) {
             $this->newOccurrences = intval($this->numNewOccurrences);
         } else {
             $this->newOccurrences = count($this->venue->occurrences);
         }
     }
     $this->form = new HTML_QuickForm('venueForm', 'post', './add_venue.php?submit=true');
     $form =& $this->form;
     if (isset($_SESSION['state']) && $_SESSION['state'] == 'pub_add') {
         $pub =& $_SESSION['pub'];
         if (isset($pub->pub_id)) {
             $this->page_title = 'Edit Publication';
         } else {
             $this->page_title = 'Add Publication';
         }
         $label = 'Add Venue';
     } else {
         if (!empty($this->venue_id)) {
             $this->page_title = 'Edit Venue';
             $label = 'Edit Venue';
         } else {
             $this->page_title = 'Add Venue';
             $label = 'Add Venue';
         }
     }
     $form->addElement('header', null, $label);
     if (!empty($this->venue_id)) {
         $form->addElement('hidden', 'venue_id', $this->venue_id);
     }
     $form->addElement('hidden', 'referer', $this->referer);
     // category
     $category_list = pdCatList::create($this->db);
     // Remove "In " from category names
     foreach ($category_list as $key => $category) {
         if (strpos($category, 'In ') === 0) {
             $category_list[$key] = substr($category, 3);
         }
     }
     $onchange = 'javascript:dataKeep(' . $this->newOccurrences . ');';
     $form->addElement('select', 'cat_id', $this->helpTooltip('Category', 'categoryHelp') . ':', array('' => '--- Please Select a Category ---', '-1' => '-- No Category --') + $category_list, array('onchange' => $onchange));
     if (isset($_SESSION['state']) && $_SESSION['state'] == 'pub_add') {
         $form->addElement('advcheckbox', 'v_usage', 'Usage:', 'Use for this Publication only', null, array('all', 'single'));
     }
     $form->addElement('text', 'title', 'Acronym:', array('size' => 50, 'maxlength' => 250));
     $form->addGroup(array(HTML_QuickForm::createElement('text', 'name', null, array('size' => 50, 'maxlength' => 250)), HTML_QuickForm::createElement('static', null, null, '<span style="font-size:0.85em;">' . 'If venue has an acronym please append it to the Venue ' . 'Name in parenthesis,<br/>eg. International Joint ' . 'Conference on Artificial Intelligence (IJCAI).</span>')), 'venue_name_group', 'Venue Name:', '<br/>', false);
     $form->addGroupRule('venue_name_group', array('name' => array(array('a venue name is required', 'required', null, 'client'))));
     $form->addElement('text', 'url', 'Venue URL:', array('size' => 50, 'maxlength' => 250));
     // rankings radio selections
     $rankings = pdVenue::rankingsGlobalGet($this->db);
     foreach ($rankings as $rank_id => $description) {
         $radio_rankings[] = HTML_QuickForm::createElement('radio', 'venue_rank', null, $description, $rank_id);
     }
     $radio_rankings[] = HTML_QuickForm::createElement('radio', 'venue_rank', null, 'other (fill in box below)', -1);
     $radio_rankings[] = HTML_QuickForm::createElement('text', 'venue_rank_other', null, array('size' => 30, 'maxlength' => 250));
     $form->addGroup($radio_rankings, 'group_rank', 'Ranking:', '<br/>', false);
     if (is_object($this->venue->category)) {
         $vopts = $this->venue->voptsGet($this->venue->category->cat_id);
         if (!empty($vopts) && count($vopts) > 0) {
             foreach ($vopts as $vopt) {
                 $name = strtolower(preg_replace('/\\s+/', '_', $vopt));
                 if ($name == 'location' && $this->newOccurrences > 0) {
                     continue;
                 }
                 $form->addElement('text', $name, $vopt . ':', array('size' => 50, 'maxlength' => 250));
             }
         }
         if ($this->venue->category->category == 'In Workshop') {
             $form->addElement('text', 'editor', 'Editor:', array('size' => 50, 'maxlength' => 250));
             $form->addElement('date', 'venue_date', 'Date:', array('format' => 'YM', 'minYear' => pdPublication::MIN_YEAR, 'maxYear' => pdPublication::MAX_YEAR));
         }
         if ($this->venue->category->category == 'In Conference' || $this->venue->category->category == 'In Workshop') {
             $form->addElement('hidden', 'numNewOccurrences', $this->newOccurrences);
             for ($i = 0; $i < $this->newOccurrences; $i++) {
                 $form->addElement('header', null, 'Occurrence ' . ($i + 1));
                 $form->addElement('text', 'newOccurrenceLocation[' . $i . ']', 'Location:', array('size' => 50, 'maxlength' => 250));
                 $form->addRule('newOccurrenceLocation[' . $i . ']', 'venue occurrence ' . ($i + 1) . ' location cannot be left blank', 'required', null, 'client');
                 $form->addElement('date', 'newOccurrenceDate[' . $i . ']', 'Date:', array('format' => 'YM', 'minYear' => pdPublication::MIN_YEAR, 'maxYear' => pdPublication::MAX_YEAR));
                 $form->addElement('text', 'newOccurrenceUrl[' . $i . ']', 'URL:', array('size' => 50, 'maxlength' => 250));
                 $form->addElement('button', 'delOccurrence[' . $i . ']', 'Delete Occurrence', 'onClick=dataRemove(' . $i . ');');
             }
         }
     }
     if (isset($_SESSION['state']) && $_SESSION['state'] == 'pub_add') {
         $pos = strpos($_SERVER['PHP_SELF'], 'papersdb');
         $prev_page = substr($_SERVER['PHP_SELF'], 0, $pos) . 'papersdb/Admin/add_pub3.php';
         $url = substr($_SERVER['PHP_SELF'], 0, $pos) . 'papersdb';
         $buttons[] = HTML_QuickForm::createElement('button', 'prev_step', '<< Previous Step', array('onClick' => "location.href='" . $prev_page . "';"));
         $buttons[] = HTML_QuickForm::createElement('button', 'cancel', 'Cancel', array('onclick' => "location.href='" . $url . "';"));
         $buttons[] = HTML_QuickForm::createElement('reset', 'reset', 'Reset');
         if (is_object($this->venue->category) && ($this->venue->category->category == 'In Conference' || $this->venue->category->category == 'In Workshop')) {
             $buttons[] = HTML_QuickForm::createElement('button', 'addOccurrence', 'Add Occurrence', 'onClick=dataKeep(' . ($this->newOccurrences + 1) . ');');
         }
         $buttons[] = HTML_QuickForm::createElement('submit', 'next_step', 'Next Step >>');
         if ($pub->pub_id != '') {
             $buttons[] = HTML_QuickForm::createElement('submit', 'finish', 'Finish');
         }
         $form->addGroup($buttons, 'buttons', '', '&nbsp', false);
         add_pub_base::addPubDisableMenuItems();
     } else {
         if (!empty($this->venue_id)) {
             $label = 'Submit';
         } else {
             $label = 'Add Venue';
         }
         $buttons[] = HTML_QuickForm::createElement('reset', 'Reset', 'Reset');
         if (is_object($this->venue->category) && ($this->venue->category->category == 'In Conference' || $this->venue->category->category == 'In Workshop')) {
             $buttons[] = HTML_QuickForm::createElement('button', 'addOccurrence', 'Add Occurrence', 'onClick=dataKeep(' . ($this->newOccurrences + 1) . ');');
         }
         $buttons[] = HTML_QuickForm::createElement('submit', 'Submit', $label);
         $form->addGroup($buttons, 'submit_group', null, '&nbsp;', false);
     }
     if ($form->validate()) {
         $this->processForm();
     } else {
         $this->renderForm();
     }
 }
Ejemplo n.º 8
0
 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>:&nbsp;';
         }
         $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>:&nbsp;' . $value;
                 }
             }
         }
         if ($venue->editor != '') {
             $text .= "<br/><b>Editor:&nbsp;</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:&nbsp;</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);
     }
 }