Exemplo n.º 1
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;
     }
 }