// Sponsor: Oregon Dept. of Administrative Services, State Data Center // Original Author of file: Ryan Foster // Contact: Matt Hoover <*****@*****.**> // Project Website: http://www.opensourcegov.net // Purpose of file: Perform update, add, and delete actions // ---------------------------------------------------------------------- include '../../../inc/includes.php'; if (!isset($_GET['id'])) { $_GET['id'] = ''; } if (!isset($_GET['withtemplate'])) { $_GET['withtemplate'] = ''; } if (isset($_POST['delete'])) { // Delete custom field $PluginItem = new PluginCustomfieldsItemtype($_REQUEST['itemtype']); $PluginItem->check($_POST['id'], 'w'); $PluginItem->delete($_POST); Html::redirect($_SERVER['HTTP_REFERER']); } elseif (isset($_POST['update'])) { // Update custom field $PluginItem = new PluginCustomfieldsItemtype($_REQUEST['itemtype']); $PluginItem->update($_POST); Html::redirect($_SERVER['HTTP_REFERER']); } elseif (isset($_GET['add']) && isset($_REQUEST['itemtype']) && isset($_GET['id'])) { // Add custom field $PluginItem = new PluginCustomfieldsItemtype($_REQUEST['itemtype']); $PluginItem->getRestricted($_REQUEST['itemtype']); $newID = $PluginItem->add($_GET, false); Html::redirect($_SERVER['HTTP_REFERER']); }
static function uninstall() { global $DB; // Remove unicity constraints on simcards FieldUnicity::deleteForItemtype("SimcardSimcard"); foreach (array('Notepad', 'DisplayPreference', 'Contract_Item', 'Infocom', 'Fieldblacklist', 'Document_Item', 'Bookmark', 'Log') as $itemtype) { $item = new $itemtype(); $item->deleteByCriteria(array('itemtype' => __CLASS__)); } $plugin = new Plugin(); if ($plugin->isActivated('datainjection') && class_exists('PluginDatainjectionModel')) { PluginDatainjectionModel::clean(array('itemtype' => __CLASS__)); } if ($plugin->isInstalled('customfields') && $plugin->isActivated('customfields')) { PluginCustomfieldsItemtype::unregisterItemtype('PluginSimcardSimcard'); } $table = getTableForItemType(__CLASS__); $DB->query("DROP TABLE IF EXISTS `{$table}`"); }
/** * * Determine if the plugin should be installed or upgraded * * Returns 0 if the plugin is not yet installed * Returns 1 if the plugin is already installed * * @since 1.3 */ function plugin_simcard_postinit() { global $UNINSTALL_TYPES, $ORDER_TYPES, $ALL_CUSTOMFIELDS_TYPES, $DB; $plugin = new Plugin(); if ($plugin->isInstalled('uninstall') && $plugin->isActivated('uninstall')) { array_push($UNINSTALL_TYPES, 'PluginSimcardSimcard'); } if ($plugin->isInstalled('order') && $plugin->isActivated('order')) { array_push($ORDER_TYPES, 'PluginSimcardSimcard'); } if ($plugin->isInstalled('customfields') && $plugin->isActivated('customfields')) { PluginCustomfieldsItemtype::registerItemtype('PluginSimcardSimcard'); } }
function uninstall() { global $DB; foreach (array('DisplayPreference', 'Document_Item', 'Bookmark', 'Log') as $itemtype) { $item = new $itemtype(); $item->deleteByCriteria(array('itemtype' => __CLASS__)); } $plugin = new Plugin(); if ($plugin->isActivated('datainjection') && class_exists('PluginDatainjectionModel')) { PluginDatainjectionModel::clean(array('itemtype' => __CLASS__)); } if ($plugin->isInstalled('customfields') && $plugin->isActivated('customfields')) { PluginCustomfieldsItemtype::unregisterItemtype('PluginSimcardSimcard'); } $table = getTableForItemType(__CLASS__); $DB->query("DROP TABLE IF EXISTS `{$table}`"); }