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); } }
public function __construct() { parent::__construct('duplicatePubs', 'Duplicate Publications', 'diag/duplicatePubs.php'); if ($this->loginError) { return; } echo '<h1>Publications with same title</h1>', 'Note that some publications may exist both in a conference ', 'and later in time in a journal.'; $all_pubs = pdPubList::create($this->db); $titles = array(); foreach ($all_pubs as $pub) { $titles[] = array($pub, preg_replace('/\\s\\s+/', ' ', strtolower($pub->title))); } //$this->debugVar('titles', $titles); $count = 1; for ($i = 0, $n = count($titles); $i < $n - 1; ++$i) { for ($j = $i + 1; $j < $n; ++$j) { if ($titles[$i][1] == $titles[$j][1]) { echo '<h2>Match ', $count, '</h2>'; $titles[$i][0]->dbLoad($this->db, $titles[$i][0]->pub_id); $titles[$j][0]->dbLoad($this->db, $titles[$j][0]->pub_id); echo $this->citationGet($titles[$i][0]), '<br/>', $this->citationGet($titles[$j][0]); ++$count; } } } }
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>'; }
public function __construct() { parent::__construct('authorize_new_users'); if ($this->loginError) { return; } $this->loadHttpVars(true, true); $this->users = pdUserList::getNotVerified($this->db); echo '<h2>Users Requiring Authentication</h2>'; if ($this->users == null || count($this->users) == 0) { echo 'All users authorized.'; return; } $form = new HTML_QuickForm('authorizeUsers', 'post'); foreach ($this->users as $user) { $form->addGroup(array(HTML_QuickForm::createElement('advcheckbox', "submit[auth][{$user->login}]", null, null, null, array('no', 'yes')), HTML_QuickForm::createElement('select', "submit[access][{$user->login}]", null, AccessLevel::getAccessLevels()), HTML_QuickForm::createElement('static', null, null, $user->login), HTML_QuickForm::createElement('static', null, null, $user->name), HTML_QuickForm::createElement('static', null, null, $user->email)), 'all', null, '</td><td class="stats_odd">', false); } $form->addElement('submit', null, 'Submit'); $this->form =& $form; if ($form->validate()) { $this->processForm(); } else { $this->renderForm(); } }
public function __construct() { parent::__construct('check_attachments', 'Check Attachments', 'diag/check_attachments.php'); if ($this->loginError) { return; } $pub_list = pdPubList::create($this->db); foreach ($pub_list as $pub) { $pub->dbLoad($this->db, $pub->pub_id); $paper_arr = split('paper_', $pub->paper); if (isset($paper_arr[1])) { if ($paper_arr[1] == '') { continue; } $this->checkAtt($pub->pub_id, $pub->paper, $paper_arr[1], 0); } if (count($pub->additional_info) > 0) { foreach ($pub->additional_info as $att) { $paper_arr = split('additional_', $att->location); $this->checkAtt($pub->pub_id, $att->location, $paper_arr[1], 1); } } unset($pub); } }
public function __construct() { parent::__construct('delete_interest', 'Delete Interest', 'Admin/delete_interest.php'); if ($this->loginError) { return; } $form = new HTML_QuickForm('deleter'); $interest_list = new pdAuthInterests($this->db); $form->addElement('select', 'interests', 'Select interest(s) to delete:', $interest_list->list, array('multiple' => 'multiple', 'size' => 15)); $form->addGroup(array(HTML_QuickForm::createElement('button', 'cancel', 'Cancel', array('onclick' => 'history.back()')), HTML_QuickForm::createElement('submit', 'submit', 'Delete')), null, null, ' ', false); if ($form->validate()) { $values = $form->exportValues(); foreach ($values['interests'] as $interest_id) { $names[] = $interest_list->list[$interest_id]; } $interest_list->dbDelete($this->db, $values['interests']); echo 'You have successfully removed the following interest from the ', 'database: <br/><b>', implode(', ', $names), '</b></p>', '<br><a href="', $_SERVER['PHP_SELF'], '">Delete another interest</a>'; } else { $renderer =& $form->defaultRenderer(); $form->accept($renderer); $this->form =& $form; $this->renderer =& $renderer; echo '<h3>Delete Interest </h3>'; } }
public function __construct() { parent::__construct('cv', null, false); if ($this->loginError) { return; } $this->loadHttpVars(); if (!isset($this->pub_ids)) { $this->pageError = true; return; } $pubs = explode(',', $this->pub_ids); if (!is_array($pubs) || count($pubs) == 0) { $this->pageError = true; return; } $pub_list = pdPubList::create($this->db, array('pub_ids' => $pubs)); if (empty($pub_list) || count($pub_list) == 0) { $this->pageError = true; return; } $pub_count = 0; foreach ($pub_list as $pub) { $pub_count++; $result = $pub->dbLoad($this->db, $pub->pub_id); if ($result === false) { $this->pageError = true; return; } echo '<b>[', $pub_count, ']</b> ', $pub->getCitationText(), '<p/>'; } }
public function __construct() { parent::__construct('view_authors', 'Author Information', 'view_author.php'); if ($this->loginError) { return; } $this->loadHttpVars(true, false); $this->use_mootools = true; // check if this author id is valid if (!isset($this->author_id) || !is_numeric($this->author_id)) { $this->pageError = true; return; } $auth = new pdAuthor(); $auth->dbLoad($this->db, $this->author_id, pdAuthor::DB_LOAD_PUBS_MIN | pdAuthor::DB_LOAD_INTERESTS); if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'Admin/add_author.php?author_id=') !== false) { // the user added or changed an author echo "Your change has been sumitted.<br/><hr/>\n"; } echo '<h3>', $auth->name; if ($this->access_level > 0) { echo $this->getAuthorIcons($auth, 0x6); } echo '</h3>', $this->authorShow($auth); echo "<hr><a href='list_author.php?tab=" . $auth->name[0] . "'>Author List</a>"; }
public function __construct() { parent::__construct('dbcreate', 'Create Database', 'diag/dbcreate_mysql.php'); if ($this->loginError) { return; } if (isset($_SESSION['dbcheck'])) { echo 'The database is configured correctly'; return; } $this->tblAdditionalInfo(); $this->tblAttachmentTypes(); $this->tblAuthor(); $this->tblAuthorInterest(); $this->tblCatInfo(); $this->tblCategory(); $this->tblExtraInfo(); $this->tblInfo(); $this->tblinterest(); $this->tblPointer(); $this->tblPubAdd(); $this->tblPubAuthor(); $this->tblPubCat(); $this->tblPubCatInfo(); $this->tblPublication(); $this->tblUser(); $this->tblUserAuthor(); $this->tblVenue(); $this->tblVenueOccur(); }
public function __construct() { parent::__construct('aicml_staff'); if ($this->loginError) { return; } echo '<h1>AICML Staff</h1>'; $table = new HTML_Table(array('class' => 'stats')); $table->addRow(array('Name', 'Start', 'End', 'Num Pubs', 'Pub Ids')); $table->setRowType(0, 'th'); //pdDb::debugOn(); $staff_list = pdAicmlStaffList::create($this->db); foreach ($staff_list as $staff_id => $author_id) { $staff = pdAicmlStaff::newFromDb($this->db, $staff_id, pdAicmlStaff::DB_LOAD_PUBS_MIN); $author = pdAuthor::newFromDb($this->db, $author_id, pdAuthor::DB_LOAD_MIN); //debugVar('staff', array($staff, $author)); $pub_links = array(); if (isset($staff->pub_ids)) { foreach ($staff->pub_ids as $pub_id) { $pub_links[] = '<a href="../view_publication.php?pub_id=' . $pub_id . '">' . $pub_id . '</a>'; } } $table->addRow(array($author->name, $staff->start_date, $staff->end_date, count($staff->pub_ids), implode(', ', $pub_links)), array('class' => 'stats_odd')); } echo $table->toHtml(); }
/** * Base class constructor. * * @param string $page_id The page ID. If defined in pdNavMenu then it is * displayed in the navigation menu. * @param string $title * @param string $relative_url * @param string $login_level */ public function __construct($page_id, $title = null, $relative_url = null, $login_level = pdNavMenuItem::MENU_NEVER) { parent::__construct($page_id, $title, $relative_url, $login_level); $this->fiscal_year_ts = array(); foreach (self::$fiscal_years as $key => $fy) { $this->fiscal_year_ts[$key] = array(date2Timestamp($fy[0]), date2Timestamp($fy[1])); } }
public function __construct() { parent::__construct('delete_author', 'Delete Author', 'Admin/delete_author.php'); if ($this->loginError) { return; } $this->loadHttpVars(); if (!isset($this->author_id) || !is_numeric($this->author_id)) { $this->pageError = true; return; } $author = new pdAuthor(); $result = $author->dbLoad($this->db, $this->author_id); if (!$result) { $this->pageError = true; return; } $pub_list = pdPubList::create($this->db, array('author_id' => $this->author_id)); if (isset($pub_list) && count($pub_list) > 0) { echo 'Cannot delete Author <b>', $author->name, '</b>.<p/>', 'The author has the following publications in the database:', displayPubList($this->db, $pub_list, true, -1, null, null, '../'); return; } $form =& $this->confirmForm('deleter'); $form->addElement('hidden', 'author_id', $this->author_id); if ($form->validate()) { $values = $form->exportValues(); // This is where the actual deletion happens. $name = $author->name; $author->dbDelete($this->db); echo 'You have successfully removed the following author from the database:', '<p/><b>', $name, '</b>'; } else { if (!isset($this->author_id) || !is_numeric($this->author_id)) { $this->pageError = true; return; } $renderer = new HTML_QuickForm_Renderer_QuickHtml(); $form->accept($renderer); $table = new HTML_Table(array('width' => '100%', 'border' => '0', 'cellpadding' => '6', 'cellspacing' => '0')); $table->addRow(array('Name:', $author->name)); if (isset($author->title) && trim($author->title != '')) { $table->addRow(array('Title:', $author->title)); } $table->addRow(array('Email:', $author->email)); $table->addRow(array('Organization:', $author->organization)); $cell = ''; if (isset($author->webpage) && trim($author->webpage != '')) { $cell = '<a href="' . $author->webpage . '">' . $author->webpage . '</a>'; } else { $cell = "none"; } $table->addRow(array('Web page:', $cell)); $table->updateColAttributes(0, array('class' => 'emph', 'width' => '25%')); echo '<h3>Delete Author</h3><p/>Delete the following author?'; $this->form =& $form; $this->renderer =& $renderer; $this->table =& $table; } }
public function __construct() { parent::__construct('home'); if ($this->loginError) { return; } $this->recentAdditions(); $this->pubByYears(); }
public function __construct() { parent::__construct('edit_user'); if ($this->loginError) { return; } $this->loadHttpVars(); if (isset($this->status) && $this->status == 'edit') { $this->editUser(); } else { $this->showUser(); } }
public function __construct() { parent::__construct('sanity_checks'); if ($this->loginError) { return; } echo '<h1>Sanity Checks</h1>'; echo '<ul>'; foreach ($this->sub_pages as $page_info) { echo '<li><a href="', $page_info[1], '">', $page_info[0], '</a></li>'; } echo '</ul>'; }
public function __construct() { parent::__construct(null, 'Publication Submitted', 'Admin/add_pub_submit.php', pdNavMenuItem::MENU_NEVER); if ($this->loginError) { return; } if (!isset($_SESSION['state']) || $_SESSION['state'] != 'pub_add') { $this->pageError = true; return; } $pub =& $_SESSION['pub']; $user =& $_SESSION['user']; if ($pub->pub_id != null) { echo 'The following PapersDB entry has been modified:<p/>'; } else { echo 'The following PapersDB entry has been added to the database:<p/>'; } $pub->submit = $user->name; $pub->dbSave($this->db); // deal with paper if (isset($_SESSION['paper'])) { if ($_SESSION['paper'] != 'none') { $pub->paperSave($this->db, $_SESSION['paper']); } else { $pub->deletePaper($this->db); } } if (isset($_SESSION['attachments']) && count($_SESSION['attachments']) > 0) { for ($i = 0, $n = count($_SESSION['attachments']); $i < $n; $i++) { assert('isset($_SESSION["att_types"][$i])'); $pub->attSave($this->db, $_SESSION['attachments'][$i], $_SESSION['att_types'][$i]); } } if (isset($_SESSION['removed_atts']) && count($_SESSION['removed_atts']) > 0) { foreach ($_SESSION['removed_atts'] as $filename) { $pub->deleteAttByFilename($this->db, $filename); } } if ($this->debug) { debugVar('$pub', $pub); } // does pub entry require validation? if ($pub->validationRequired($this->db) && $user->isAdministrator()) { $pub->markValid($this->db); } else { $pub->markPending($this->db); } echo $pub->getCitationHtml(), getPubIcons($this->db, $pub, 0xf, '../'); pubSessionInit(); }
public function __construct() { parent::__construct('add_publication'); if ($this->loginError) { return; } if (get_class($this) == "add_pub2" || get_class($this) == "add_pub3" || get_class($this) == "add_pub4") { if (!isset($_SESSION['state']) || $_SESSION['state'] != 'pub_add') { header('Location: add_pub1.php'); return; } } $this->addPubDisableMenuItems(); }
public function __construct() { pdHtmlPage::__construct('logout'); if ($this->access_level <= 0) { die('You are not logged in so you cannot log out.'); } unset($_SESSION['user']); searchSessionInit(); // kill session variables $_SESSION = array(); // reset session array session_destroy(); // destroy session. header('Location: index.php'); }
public function __construct() { parent::__construct('auth_success', 'Authorization Success', 'Admin/auth_success.php'); if ($this->loginError) { return; } echo "<h2>Authorization Successful</h2>" . "\n<p>The following users have been granted access.</p>"; $table = new HTML_Table(array('class' => 'stats')); $table->addRow(array('Access Level', 'Login', 'Name', 'Conf. Email')); $table->setRowType(0, 'th'); foreach ($_SESSION['auth_success'] as $auth) { $table->addRow(array(AccessLevel::getAccessLevelStr($auth['user']->access_level), $auth['user']->login, $auth['user']->name, $auth['email']), array('class' => 'stats_odd')); } echo $table->toHtml(); }
public function __construct() { parent::__construct('publist_citations', 'Publication List Citations', 'diag/publist_citations.php', pdNavMenuItem::MENU_NEVER); if ($this->loginError) { return; } $pub_ids = array(736, 737, 807, 828, 842, 858, 870, 871, 874, 875, 876, 877, 879, 894, 895, 896, 898, 900, 901, 906, 907, 908, 910, 911, 912, 914, 915, 916, 917, 921, 922, 923, 925, 926, 927, 928, 929, 930, 936, 941); $additional = array(); foreach ($pub_ids as $pub_id) { $additional[$pub_id] = $pub_id; } $pub_list = pdPubList::create($this->db, array('pub_ids' => $pub_ids, 'sort' => false)); uasort($pub_list, array('pdPublication', 'pubsDateSortDesc')); echo displayPubList($this->db, $pub_list, true, -1, $additional); }
public function __construct() { parent::__construct('auth_error', 'Authorization Error', 'Admin/auth_error.php'); if ($this->loginError) { return; } echo "<h2>Invalid Access Level</h2>" . "\n<p>The following users have incorrect access level.</p>"; $table = new HTML_Table(array('class' => 'stats')); $table->addRow(array('Access Level', 'Login', 'Name')); $table->setRowType(0, 'th'); foreach ($_SESSION['auth_errors'] as $auth_err) { $table->addRow(array(AccessLevel::getAccessLevelStr($auth_err['access']), $auth_err['user']->login, $auth_err['user']->name), array('class' => 'stats_odd')); } echo $table->toHtml(); echo '<p><a href="authorize_new_users.php">Authorize new users</a></p>'; }
public function __construct() { parent::__construct('pub_sanity_checks', 'Pub Sanity Checks', 'diag/pubSanityChecks.php'); if ($this->loginError) { return; } $this->loadHttpVars(); if (!isset($this->tab)) { $this->tab = $this->valid_tabs[0]; } else { if (!in_array($this->tab, $this->valid_tabs)) { $this->pageError = true; return; } } echo $this->selMenu(); echo '<h1>Publication Entries Sanity Checks</h1>'; switch ($this->tab) { case $this->valid_tabs[0]: $this->venueRankings(); break; case $this->valid_tabs[1]: $this->venueCategories(); break; case $this->valid_tabs[2]: $this->tier1Report(); break; case $this->valid_tabs[3]: $this->venueJournalRank(); break; case $this->valid_tabs[4]: $this->venueConferenceRank(); break; case $this->valid_tabs[5]: $this->venueWorkshopRank(); break; case $this->valid_tabs[6]: $this->venuePosterRank(); break; case $this->valid_tabs[7]: $this->nonML(); break; default: $this->pageError = true; } }
public function __construct() { parent::__construct('bibtex', null, false); if ($this->loginError) { return; } $this->loadHttpVars(); if (!isset($this->pub_ids)) { $this->pageError = true; return; } $pubs = explode(',', $this->pub_ids); if (!is_array($pubs) || count($pubs) == 0) { $this->pageError = true; return; } $pub_list = pdPubList::create($this->db, array('pub_ids' => $pubs)); if (!is_array($pub_list) || count($pub_list) == 0) { $this->pageError = true; return; } $table = new HTML_Table(array('width' => '100%', 'border' => '0', 'cellpadding' => '0', 'cellspacing' => '0')); $table->setAutoGrow(true); $pub_count = 0; foreach ($pub_list as $pub) { $pub_count++; $result = $pub->dbLoad($this->db, $pub->pub_id); if ($result === false) { $this->pageError = true; return; } $table->addRow(array('<pre>' . $pub->getBibtex() . '</pre>')); } // now assign table attributes including highlighting for even and odd // rows for ($i = 0; $i < $table->getRowCount(); $i++) { if ($i & 1) { $table->updateRowAttributes($i, array('class' => 'even'), true); } else { $table->updateRowAttributes($i, array('class' => 'odd'), true); } } $table->updateColAttributes(0, array('class' => 'publist'), true); echo $table->toHtml(); }
public function __construct() { parent::__construct('view_publication', 'View Publication', 'view_publication.php'); if ($this->loginError) { return; } $this->loadHttpVars(); if (!isset($this->pub_id) || !is_numeric($this->pub_id)) { $this->pageError = true; return; } $pub = new pdPublication(); $result = $pub->dbLoad($this->db, $this->pub_id); if (!$result) { echo 'Publication does not exist'; return; } if (isset($this->submit_pending) && $this->submit_pending) { // check if this pub entry is pending $q = $this->db->selectRow('pub_pending', '*', array('pub_id' => $this->pub_id)); assert('$q'); $form = new HTML_QuickForm('submit_pending'); $form->addElement('hidden', 'submit_pending', true); $form->addElement('hidden', 'pub_id', $this->pub_id); $elements = array(); $elements[] = HTML_QuickForm::createElement('advcheckbox', 'valid', null, 'Valid', null, array(0, 1)); $elements[] = HTML_QuickForm::createElement('submit', 'submit', 'Submit'); $form->addGroup($elements, 'elgroup', '', ' ', false); // create a new renderer because $form->defaultRenderer() creates // a single copy $renderer = new HTML_QuickForm_Renderer_Default(); $form->accept($renderer); if ($form->validate()) { $values =& $form->exportValues(); $pub->markValid($this->db); echo 'Publication entry marked as valid.'; return; } else { echo "<h2>This publication entry requires validation</h2>\n"; echo $renderer->toHtml(); } } $this->showPublication($pub); }
public function __construct() { parent::__construct('all_authors'); if ($this->loginError) { return; } $this->loadHttpVars(true, false); if (!isset($this->tab)) { $this->tab = 'A'; } else { $tab = strtoupper($this->tab); if (strlen($tab) != 1 || ord($tab) < ord('A') || ord($tab) > ord('Z')) { $this->pageError = true; return; } } $auth_list = pdAuthorList::create($this->db, null, $this->tab); echo $this->alphaSelMenu($this->tab, get_class($this) . '.php'); echo "<h2>Authors</h2>"; if (empty($auth_list) || count($auth_list) == 0) { echo 'No authors with last name starting with ', $this->tab, '<br/>'; return; } foreach ($auth_list as $author_id => $name) { $author = new pdAuthor(); $author->dbLoad($this->db, $author_id, pdAuthor::DB_LOAD_BASIC | pdAuthor::DB_LOAD_PUBS_MIN); $name = '<span class="emph"><a href="view_author.php?author_id=' . $author_id . '">' . $name . '</a> '; $icons = $this->getAuthorIcons($author) . '</span>'; $info = array(); if ($author->title != '') { $info[] = '<span class="small">' . $author->title . '</span>'; } if ($author->organization != '') { $info[] = '<span class="small">' . $author->organization . '</span>'; } $info[] .= '<a href="list_publication.php?author_id=' . $author_id . '&menu=0"><span class="small" style="color:#000;font-weight:normal;">' . 'Publication entries in database: ' . $author->totalPublications . '</span>'; $table = new HTML_Table(array('class' => 'publist')); $table->addRow(array($name . '<br/>' . implode('<br/>', $info), $icons)); $table->updateColAttributes(1, array('class' => 'icons'), NULL); echo $table->toHtml(); unset($table); } }
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; } }
public function __construct() { parent::__construct('delete_category', 'Delete Category', 'Admin/delete_category.php'); if ($this->loginError) { return; } $this->loadHttpVars(); if (!isset($this->cat_id)) { echo 'No category id defined'; $this->pageError = true; return; } else { if (!is_numeric($this->cat_id)) { $this->pageError = true; return; } } $category = new pdCategory(); $result = $category->dbLoad($this->db, $this->cat_id); if (!$result) { $this->pageError = true; return; } $pub_list = pdPubList::create($this->db, array('cat_id' => $this->cat_id)); if (isset($pub_list) && count($pub_list) > 0) { echo 'Cannot delete category <b>', $category->category, '</b>.<p/>', 'The category is used by the following publications:', "\n", displayPubList($this->db, $pub_list); return; } $form =& $this->confirmForm('deleter'); $form->addElement('hidden', 'cat_id', $this->cat_id); $renderer =& $form->defaultRenderer(); $form->accept($renderer); if ($form->validate()) { $values = $form->exportValues(); // This is where the actual deletion happens. $category->dbDelete($this->db); echo 'Category <b>', $category->category, '</b> removed from the database.'; } else { echo '<h3>Confirm</h3>Delete category <b>', $category->category, '</b>?<p/>'; $this->form =& $form; $this->renderer =& $renderer; } }
public function __construct() { parent::__construct('author_confirm', 'Author Confirm', 'Admin/author_confirm.php'); if ($this->loginError) { return; } if (!isset($_SESSION['new_author'])) { $this->pageError = true; return; } $new_author = $_SESSION['new_author']; if (isset($new_author->author_id)) { $this->pageError = true; debugVar('new_author', $new_author); return; } $this->form =& $this->confirmForm('author_confirm', null, 'Add'); if ($this->form->validate()) { $values = $this->form->exportValues(); $new_author->dbSave($this->db); if (isset($_SESSION['state']) && $_SESSION['state'] == 'pub_add') { assert('isset($_SESSION["pub"])'); $pub =& $_SESSION['pub']; $pub->addAuthor($this->db, $new_author->author_id); header('Location: add_pub2.php'); return; } echo 'Author <span class="emph">', $new_author->name, '</span> ', 'succesfully added to the database.', '<p/>', '<a href="add_author.php">', 'Add another new author</a>'; } else { $like_authors = pdAuthorList::create($this->db, $new_author->firstname, $new_author->lastname); assert('count($like_authors) > 0'); echo 'Attempting to add new author: ', '<span class="emph">', $new_author->name, "</span><p/>\n", 'The following authors, already in the database, have similar names:<ul>'; foreach ($like_authors as $auth) { echo '<li>', $auth, '</li>'; } echo '</ul>Do you really want to add this author?'; $renderer =& $this->form->defaultRenderer(); $this->form->accept($renderer); $this->renderer =& $renderer; } }
public function __construct() { parent::__construct('advanced_search'); $this->addStyleSheets('css/wick.css'); if ($this->loginError) { return; } $this->loadHttpVars(true, false); $this->db_authors = pdAuthorList::create($this->db, null, null, true); $this->category = new pdCategory(); $this->category->dbLoad($this->db, $this->cat_id); $form = $this->createForm(); $this->form =& $form; $this->form->setDefaults(array('enddate' => array('Y' => pdPublication::MAX_YEAR, 'M' => 12))); // NOTE: order is important here: this must be called after creating // the form elements, but before rendering them. $renderer =& $form->defaultRenderer(); $renderer->setElementTemplate('<tr><td><b>{label}</b></td>' . '<td><div style="position:relative;text-align:left"><table id="MYCUSTOMFLOATER" class="myCustomFloater" style="font-size:1.1em;position:absolute;top:50px;left:0;background-color:#f4f4f4;display:none;visibility:hidden"><tr><td><div class="myCustomFloaterContent"></div></td></tr></table></div>{element}</td></tr>', 'authors'); $this->javascript(); echo '<h2><a href="#">Advanced Search</a></h2>'; }
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; } }