Exemplo n.º 1
0
 public function __construct()
 {
     parent::__construct('tag_ml_submit', 'Submit ML Paper Entries', 'diag/tag_ml_submit.php');
     if ($this->loginError) {
         return;
     }
     $this->loadHttpVars();
     $pubs_tagged = array();
     foreach ($this->pub_tag as $pub_id => $tag) {
         if ($tag != 'yes') {
             continue;
         }
         $pub = new pdPublication();
         $pub->dbLoad($this->db, $pub_id);
         if (strpos(strtolower($pub->keywords), 'machine learning' !== false)) {
             echo 'Error: paper titled<br/>', $pub->title, '<br/>is already a machine learning paper.<br/>';
             continue;
         }
         $pub->keywordAdd('machine learning');
         $pub->dbSave($this->db);
         $pubs_tagged[$pub_id] = $pub;
     }
     pdTagMlHistory::dbSave($this->db, array_keys($pubs_tagged));
     if (count($pubs_tagged) == 0) {
         echo 'No publication entries tagged<br>/';
         return;
     }
     echo 'The following publication entries are now tagged as ' . '<i>machine learning</i>:<ul>';
     foreach ($pubs_tagged as $pub_id => $pub) {
         echo '<li>', $pub->title, '</li>';
     }
     echo '</ul>';
 }
Exemplo n.º 2
0
 public static function &newFromDb(&$db, $pub_id, $flags = self::DB_LOAD_ALL)
 {
     assert('is_numeric($pub_id)');
     $pub = new pdPublication();
     $pub->dbLoad($db, $pub_id, $flags);
     return $pub;
 }
Exemplo n.º 3
0
 public static function similarPubsHtml($db)
 {
     if (!isset($_SESSION['similar_pubs'])) {
         return;
     }
     $html = '<h3>Similar Publications in Database</h3>';
     foreach ($_SESSION['similar_pubs'] as $sim_pub_id) {
         $sim_pub = new pdPublication();
         $sim_pub->dbLoad($db, $sim_pub_id);
         $html .= $sim_pub->getCitationHtml('..', false) . '<p/>';
         unset($sim_pub);
     }
     return $html;
 }
Exemplo n.º 4
0
 public function __construct()
 {
     parent::__construct('delete_publication', 'Delete Publication', 'Admin/delete_pbublication.php');
     if ($this->loginError) {
         return;
     }
     $this->loadHttpVars();
     if (isset($this->pub_id) && !is_numeric($this->pub_id)) {
         $this->pageError = true;
         return;
     }
     $form =& $this->confirmForm('deleter');
     $form->addElement('hidden', 'pub_id', $this->pub_id);
     if ($form->validate()) {
         $values = $form->exportValues();
         $pub = new pdPublication();
         $result = $pub->dbLoad($this->db, $values['pub_id']);
         if (!$result) {
             $this->pageError = true;
             return;
         }
         $title = $pub->title;
         $pub->dbDelete($this->db);
         echo 'You have successfully removed the following ', 'publication from the database: <p/><b>', $title, '</b>';
     } else {
         if ($this->pub_id == null) {
             echo 'No pub id defined';
             $this->pageError = true;
             return;
         }
         $pub = new pdPublication();
         $result = $pub->dbLoad($this->db, $this->pub_id);
         if (!$result) {
             $this->pageError = true;
             return;
         }
         $renderer =& $form->defaultRenderer();
         $form->accept($renderer);
         echo '<h3>Delete Publication</h3>Delete the following paper?<p/>', $pub->getCitationHtml();
         $this->form =& $form;
         $this->renderer =& $renderer;
     }
 }
Exemplo n.º 5
0
 private static function arrayPubsDBLoadByCategory($db, $pub_ids)
 {
     assert('is_object($db)');
     assert('is_array($pub_ids)');
     $list = array();
     if (count($pub_ids) == 0) {
         return $list;
     }
     foreach ($pub_ids as $pub_id) {
         if (!is_numeric($pub_id)) {
             continue;
         }
         $pub = new pdPublication();
         $result = $pub->dbLoad($db, $pub_id, pdPublication::DB_LOAD_BASIC | pdPublication::DB_LOAD_CATEGORY);
         if ($result !== false) {
             $pubs[] = $pub;
         }
     }
     return self::arrayPubsSortByCategory($db, $pubs);
 }
Exemplo n.º 6
0
    public function formRelatedPubs()
    {
        $form =& $this->form;
        $num_related_pubs = count($this->pub->related_pubs);
        $form->addElement('header', 'related_pubs_hdr', 'Related Publication(s)', null);
        $tooltip = 'Pub Link::Creates a relationship between this publication
and another publication that already has an entry in the database.';
        if (count($this->pub->related_pubs) > 0) {
            $c = 0;
            foreach ($this->pub->related_pubs as $pub_id) {
                $intPub = new pdPublication();
                $result = $intPub->dbLoad($this->db, $pub_id);
                if (!$result) {
                    continue;
                }
                $form->addGroup(array(HTML_QuickForm::createElement('static', 'curr_related_pub' . $c, null, $intPub->title), HTML_QuickForm::createElement('submit', 'remove_related_pub' . $c, 'Remove'), HTML_QuickForm::createElement('hidden', 'related_pub_id' . $c, $intPub->pub_id)), 'curr_related_pubs_group', "<span class=\"Tips1\" title=\"{$tooltip}\">Pub " . ($c + 1) . '</span>:', '&nbsp;', false);
                $label = '';
                $c++;
            }
        }
        $pub_list = pdPubList::create($this->db);
        if (!empty($pub_list) && count($pub_list) > 0) {
            $options[''] = '--- select publication --';
            foreach ($pub_list as $p) {
                if (strlen($p->title) > 70) {
                    $options[$p->pub_id] = substr($p->title, 0, 67) . '...';
                } else {
                    $options[$p->pub_id] = $p->title;
                }
            }
            $form->addElement('select', 'new_related_pub', "<span class=\"Tips1\" title=\"{$tooltip}\">New Pub </span>:", $options);
        }
        $form->addElement('submit', 'add_related_pubs', 'Add Related Publication');
        $form->addElement('hidden', 'num_related_pubs', $num_related_pubs);
    }
Exemplo n.º 7
0
 private function showPublication(&$pub)
 {
     $content = "<h2>" . $pub->title;
     if ($this->access_level > 0) {
         $content .= getPubIcons($this->db, $pub, 0xc);
     }
     $content .= "</h2>\n" . $pub->authorsToHtml();
     if (isset($pub->paper) && strtolower($pub->paper) != 'no paper' && basename($pub->paper) != 'paper_') {
         if ($pub->paperExists()) {
             $content .= 'Full Text: <a href="' . $pub->paperAttGetUrl() . '">';
             $name = split('paper_', $pub->paper);
             if ($name[1] != '') {
                 $content .= $name[1];
             }
             $content .= '</a>&nbsp;';
             $content .= getPubIcons($this->db, $pub, 0x1) . "<br/>\n";
         }
     }
     // Show Additional Materials
     $att_types = pdAttachmentTypesList::create($this->db);
     if (count($pub->additional_info) > 0) {
         $table = new HTML_Table(array('width' => '350', 'border' => '0', 'cellpadding' => '6', 'cellspacing' => '0'));
         $heading = 'Other Attachments:';
         $add_count = 1;
         foreach ($pub->additional_info as $att) {
             $cell = '';
             if ($pub->attExists($att)) {
                 $name = split('additional_', $att->location);
                 $cell .= '<a href="' . $pub->attachmentGetUrl($add_count - 1) . '">';
                 if ($name[1] != '') {
                     $cell .= $name[1];
                 }
                 $cell .= '</a>';
                 if (in_array($att->type, $att_types)) {
                     $cell .= '&nbsp;[' . $att->type . ']';
                 }
                 $cell .= '&nbsp;<a href="' . $pub->attachmentGetUrl($add_count - 1) . '">' . $this->getPubAddAttIcons($att) . '</a>';
                 $add_count++;
             }
             $table->addRow(array($heading, $cell));
             $heading = '';
         }
         $content .= $table->toHtml();
     }
     $content .= '<p/>' . stripslashes($pub->abstract) . '<p/>' . '<h3>Citation</h3>' . $pub->getCitationHtml() . '<p/>';
     $table = new HTML_Table(array('width' => '600', 'border' => '0', 'cellpadding' => '6', 'cellspacing' => '0'));
     $category = '';
     if (isset($pub->category) && isset($pub->category->category)) {
         $category = $pub->category->category;
     }
     $table->addRow(array('Keywords:', $pub->keywordsGet()));
     $table->addRow(array('Category:', $category));
     if (isset($_SESSION['user']) && $_SESSION['user']->showInternalInfo()) {
         $table->addRow(array('Ranking:', $pub->ranking));
         if (is_array($pub->collaborations) && count($pub->collaborations) > 0) {
             $col_desciptions = $pub->collaborationsGet($this->db);
             foreach ($pub->collaborations as $col_id) {
                 $values[] = $col_desciptions[$col_id];
             }
             $table->addRow(array('Collaboration:', implode(', ', $values)));
         }
         $table->addRow(array('Extra Info:', $pub->extraInfoGet()));
     }
     if (isset($_SESSION['user']) && $_SESSION['user']->showUserInfo()) {
         $table->addRow(array('User Info:', $pub->user));
     }
     $web_links = $pub->getWebLinks();
     if (count($web_links) > 0) {
         $c = 0;
         foreach ($web_links as $name => $url) {
             if ($c == 0) {
                 $label = 'Web Links:';
             } else {
                 $label = '';
             }
             $table->addRow(array($label, '<a href="' . $url . '" ' . 'target="_blank">' . $name . '</a>'));
             $c++;
         }
     }
     if (count($pub->relatedPubsGet()) > 0) {
         $c = 0;
         foreach ($pub->relatedPubsGet() as $related_pub_id) {
             if ($c == 0) {
                 $label = 'Related Publication(s):';
             } else {
                 $label = '';
             }
             $rel_pub = new pdPublication();
             $rel_pub->dbLoad($this->db, $related_pub_id);
             $table->addRow(array($label, '<a href="view_publication.php?' . 'pub_id=' . $rel_pub->pub_id . '" ' . ' target="_blank">' . $rel_pub->title . '</a>'));
             $c++;
         }
     }
     $table->updateColAttributes(0, array('class' => 'emph', 'width' => '25%'));
     $content .= $table->toHtml();
     $bibtex = $pub->getBibtex();
     if ($bibtex !== false) {
         $content .= '<h3>BibTeX</h3><pre class="bibtex">' . $bibtex . '</pre><p/>';
     }
     $updateStr = $this->lastUpdateGet($pub);
     if ($updateStr != '') {
         $updateStr = 'Last Updated: ' . $updateStr . '<br/>';
     }
     $updateStr .= 'Submitted by ' . $pub->submit;
     echo $content, '<span class="small">', $updateStr, '</span>';
 }