コード例 #1
0
ファイル: add_author.php プロジェクト: papersdb/papersdb
 public function renderForm($author)
 {
     $form =& $this->form;
     foreach (array_keys(get_class_vars(get_class($this))) as $member) {
         $defaults[$member] = $this->{$member};
     }
     if ($author->author_id != '') {
         $defaults = array_merge($defaults, $author->asArray());
         // override interests
         if (count($author->interests) > 0) {
             $defaults['interests'] = array_keys($author->interests);
         }
     }
     if (isset($_SESSION['state']) && $_SESSION['state'] == 'pub_add') {
         assert('isset($_SESSION["pub"])');
         $pub =& $_SESSION['pub'];
         if (isset($pub->pub_id)) {
             echo '<h3>Editing Publication Entry</h3>';
         } else {
             echo '<h3>Adding Publication Entry</h3>';
         }
         echo $pub->getCitationHtml('..', false), '<p/>', add_pub_base::similarPubsHtml($this->db);
     }
     //debugVar('defaults', $defaults);
     $form->setDefaults($defaults);
     $renderer =& $form->defaultRenderer();
     $form->accept($renderer);
     $this->renderer =& $renderer;
     $this->javascript();
 }
コード例 #2
0
ファイル: add_pub3.php プロジェクト: papersdb/papersdb
 public function renderForm()
 {
     $form =& $this->form;
     foreach (array_keys(get_class_vars(get_class($this))) as $member) {
         $defaults[$member] = $this->{$member};
     }
     if (isset($this->pub->pub_id)) {
         echo '<h3>Editing Publication Entry</h3>';
     } else {
         echo '<h3>Adding Publication Entry</h3>';
     }
     echo $this->pub->getCitationHtml('..', false), '&nbsp;', getPubIcons($this->db, $this->pub, 0x1), '<p/>', add_pub_base::similarPubsHtml($this->db);
     if (is_object($this->pub->category)) {
         $defaults['cat_id'] = $this->pub->category->cat_id;
     }
     if (is_object($this->pub->venue)) {
         $defaults['venue_id'] = $this->venue_id;
     }
     $defaults['used_by_me'] = $this->used_by_me;
     if (isset($this->pub->rank_id)) {
         if ($this->pub->rank_id > 4) {
             $defaults['paper_rank'] = -1;
             $defaults['paper_rank_other'] = $this->pub->ranking;
         } else {
             $defaults['paper_rank'] = $this->pub->rank_id;
         }
     } else {
         if (is_object($this->pub->venue)) {
             // Use ranking from venue
             if ($this->pub->venue->rank_id > 4) {
                 $defaults['paper_rank'] = -1;
                 $defaults['paper_rank_other'] = $this->pub->venue->ranking;
             } else {
                 $defaults['paper_rank'] = $this->pub->venue->rank_id;
             }
         }
     }
     $defaults['extra_info'] = $this->pub->extra_info;
     // assign category info items
     if (count($this->pub->info) > 0 && is_object($this->pub->category) && count($this->pub->category->info) > 0) {
         foreach ($this->formInfoElementsGet() as $element => $name) {
             if (isset($this->pub->info[$name])) {
                 $defaults[$element] = $this->pub->info[$name];
             }
         }
     }
     if (!isset($this->pub->published) || $this->pub->published == '') {
         $defaults['pub_date'] = array('Y' => date('Y'), 'M' => date('m'));
     } else {
         $date = explode('-', $this->pub->published);
         $defaults['pub_date']['Y'] = $date[0];
         $defaults['pub_date']['M'] = $date[1];
     }
     $form->setDefaults($defaults);
     $renderer =& $form->defaultRenderer();
     $form->accept($renderer);
     $this->renderer =& $renderer;
     $this->javascript();
 }
コード例 #3
0
ファイル: add_pub1.php プロジェクト: papersdb/papersdb
 /**
  * Called to render the form.
  */
 public function renderForm()
 {
     assert('isset($_SESSION["pub"])');
     $form =& $this->form;
     $defaults = array('title' => $this->pub->title, 'abstract' => $this->pub->abstract, 'keywords' => $this->pub->keywords, 'user' => $this->pub->user);
     $this->form->setDefaults($defaults);
     if (isset($_SESSION['pub']) && $_SESSION['pub']->title != '') {
         $this->pub =& $_SESSION['pub'];
         if (isset($this->pub->pub_id)) {
             echo '<h3>Editing Publication Entry</h3>';
         } else {
             echo '<h3>Adding Publication Entry</h3>';
         }
         echo $this->pub->getCitationHtml('..', false), '&nbsp;', getPubIcons($this->db, $this->pub, 0x1), '<p/>', add_pub_base::similarPubsHtml($this->db);
     }
     $renderer =& $this->form->defaultRenderer();
     $this->form->accept($renderer);
     $this->renderer =& $renderer;
     $this->javascript();
 }
コード例 #4
0
ファイル: add_pub2.php プロジェクト: papersdb/papersdb
 public function renderForm()
 {
     assert('isset($_SESSION["pub"])');
     $form =& $this->form;
     $defaults = array();
     if (count($this->pub->authors) > 0) {
         foreach ($this->pub->authors as $author) {
             $auth_names[] = $author->firstname . ' ' . $author->lastname;
         }
         $defaults['authors'] = implode(', ', $auth_names);
     }
     if (is_array($this->pub->collaborations) && count($this->pub->collaborations) > 0) {
         foreach ($this->pub->collaborations as $col_id) {
             $defaults['paper_col'][$col_id] = 1;
         }
     }
     $form->setDefaults($defaults);
     if (isset($this->pub->pub_id)) {
         echo '<h3>Editing Publication Entry</h3>';
     } else {
         echo '<h3>Adding Publication Entry</h3>';
     }
     echo $this->pub->getCitationHtml('', false), '&nbsp;', getPubIcons($this->db, $this->pub, 0x1), '<p/>', add_pub_base::similarPubsHtml($this->db);
     $renderer =& $form->defaultRenderer();
     $form->accept($renderer);
     $this->renderer =& $renderer;
     $this->javascript();
 }
コード例 #5
0
ファイル: add_venue.php プロジェクト: papersdb/papersdb
 private function renderForm()
 {
     $form =& $this->form;
     foreach (array_keys(get_object_vars($this)) as $member) {
         $defaults[$member] = $this->{$member};
     }
     if (isset($this->venue->rank_id)) {
         if ($this->venue->rank_id > 4) {
             $defaults['venue_rank'] = -1;
             $defaults['venue_rank_other'] = $this->venue->ranking;
         } else {
             $defaults['venue_rank'] = $this->venue->rank_id;
         }
     }
     $form->setConstants($defaults);
     if (!empty($this->venue_id)) {
         $arr = array('title' => $this->venue->title, 'name' => $this->venue->nameGet(), 'url' => $this->venue->urlGet(), 'data' => $this->venue->data, 'editor' => $this->venue->editor, 'venue_date' => $this->venue->date, 'v_usage' => $this->venue->v_usage);
         if (empty($this->cat_id)) {
             $arr['cat_id'] = -1;
         } else {
             if ($this->cat_id > 0) {
                 $arr['cat_id'] = $this->cat_id;
             }
         }
         if (!empty($this->venue->options)) {
             $vopt_names = $this->venue->voptsGet();
             foreach ($this->venue->options as $vopt_id => $value) {
                 $name = strtolower(preg_replace('/\\s+/', '_', $vopt_names[$vopt_id]));
                 if ($name == 'location' && $this->newOccurrences > 0) {
                     continue;
                 }
                 $arr[$name] = $value;
             }
         }
         if (isset($this->numNewOccurrences)) {
             for ($i = 0; $i < $this->numNewOccurrences; $i++) {
                 if (isset($this->newOccurrenceLocation[$i])) {
                     $arr['newOccurrenceLocation'][$i] = $this->newOccurrenceLocation[$i];
                     $arr['newOccurrenceDate'][$i] = $this->newOccurrenceDate[$i];
                     $arr['newOccurrenceUrl'][$i] = $this->newOccurrenceUrl[$i];
                 }
             }
         } else {
             if (count($this->venue->occurrences) > 0) {
                 $c = 0;
                 foreach ($this->venue->occurrences as $o) {
                     $arr['newOccurrenceLocation'][$c] = $o->location;
                     $arr['newOccurrenceDate'][$c] = $o->date;
                     $arr['newOccurrenceUrl'][$c] = $o->url;
                     $c++;
                 }
             }
         }
         // set the default date for the new occurrences
         if (count($this->venue->occurrences) < $this->newOccurrences) {
             $curdate = array('Y' => date('Y'), 'M' => date('m'));
             for ($i = count($this->venue->occurrences); $i < $this->newOccurrences; ++$i) {
                 $arr['newOccurrenceDate'][$i] = $curdate;
             }
         }
         $form->setConstants($arr);
     } else {
         $curdate = array('Y' => date('Y'), 'M' => date('m'));
         $arr = array('venue_date' => $curdate);
         for ($i = 0; $i < $this->newOccurrences; ++$i) {
             if (isset($this->newOccurrenceLocation[$i])) {
                 $arr['newOccurrenceLocation'][$i] = $this->newOccurrenceLocation[$i];
                 $arr['newOccurrenceDate'][$i] = $this->newOccurrenceDate[$i];
                 $arr['newOccurrenceUrl'][$i] = $this->newOccurrenceUrl[$i];
             } else {
                 $arr['newOccurrenceDate'][$i] = $curdate;
             }
         }
         $form->setConstants($arr);
     }
     if (isset($_SESSION['state']) && $_SESSION['state'] == 'pub_add') {
         assert('isset($_SESSION["pub"])');
         $pub =& $_SESSION['pub'];
         if (isset($pub->pub_id)) {
             echo '<h3>Editing Publication Entry</h3>';
         } else {
             echo '<h3>Adding Publication Entry</h3>';
         }
         echo $pub->getCitationHtml('..', false), '<p/>', add_pub_base::similarPubsHtml($this->db);
     }
     $renderer =& $form->defaultRenderer();
     $form->accept($renderer);
     $this->renderer =& $renderer;
     $this->javascript();
 }
コード例 #6
0
ファイル: add_pub4.php プロジェクト: papersdb/papersdb
 public function renderForm()
 {
     assert('isset($_SESSION["pub"])');
     $form =& $this->form;
     $defaults = array();
     $web_links = $this->pub->getWebLinks();
     if (count($web_links) > 0) {
         $c = 0;
         foreach ($web_links as $text => $url) {
             $defaults['curr_web_link_text' . $c] = $text;
             $defaults['curr_web_link_url' . $c] = $url;
             $c++;
         }
     }
     $form->setDefaults($defaults);
     if (isset($this->pub->pub_id)) {
         echo '<h3>Editing Publication Entry</h3>';
     } else {
         echo '<h3>Adding Publication Entry</h3>';
     }
     echo $this->pub->getCitationHtml('', false), '&nbsp;', getPubIcons($this->db, $this->pub, 0x1), '<p/>', add_pub_base::similarPubsHtml($this->db);
     $renderer =& $form->defaultRenderer();
     $form->accept($renderer);
     $this->renderer =& $renderer;
     $this->javascript();
 }