public function __construct() { parent::__construct('delete_venue', 'Delete Venue', 'Admin/delete_venue.php'); if ($this->loginError) { return; } $this->loadHttpVars(); if (!isset($this->venue_id) || !is_numeric($this->venue_id)) { $this->pageError = true; return; } $venue = new pdVenue(); $result = $venue->dbLoad($this->db, $this->venue_id); if (!$result) { $this->pageError = true; return; } $pub_list = pdPubList::create($this->db, array('venue_id' => $this->venue_id)); if (isset($pub_list) && count($pub_list) > 0) { echo 'Cannot delete venue <b>', $venue->nameGet(), '</b>.<p/>', 'The venue is used by the following ', 'publications:', "\n", displayPubList($this->db, $pub_list, true, -1, null, null, '../'); return; } $form =& $this->confirmForm('deleter'); $form->addElement('hidden', 'venue_id', $venue->venue_id); if ($form->validate()) { $venue->dbDelete($this->db); echo 'Venue <b>', $venue->title, '</b> successfully removed from database.'; } else { $renderer =& $form->defaultRenderer(); $form->accept($renderer); if ($venue->title != '') { $disp_name = $venue->title; } else { $disp_name = $venue->nameGet(); } echo '<h3>Confirm</h3><p/>', 'Delete Venue <b>', $disp_name, '</b> from the database?'; $this->form =& $form; $this->renderer =& $renderer; } }
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', '', ' ', 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, ' ', false); } if ($form->validate()) { $this->processForm(); } else { $this->renderForm(); } }
$venue->dbLoad($db, $pub_id); if (pdDB::venueTableUpgraded() == 0 && !empty($venue->data)) { $op = array($pub_id, $venue->nameGet()); if (!empty($venue->cat_id)) { $op[] = $venue->cat_id; } else { $op[] = '*'; } $op[] = $venue->data; echo '<pre>', implode("\t", $op), '</pre>', "\n"; } $venue->dbSave($db); } } else { foreach ($venues as $pub_id => $title) { $venue = new pdVenue(); $venue->dbLoad($db, $pub_id); if (pdDB::venueTableUpgraded() == 0 && !empty($venue->data)) { $op = array($pub_id, $venue->nameGet()); if (!empty($venue->cat_id)) { $op[] = $venue->cat_id; } else { $op[] = '*'; } if (is_array($venue->options)) { foreach ($venue->options as $vopt) { if (!empty($vopt)) { $op[] = $vopt; } } }