/** * @static * @todo document this */ function _insertPluginOptions($context, $contextid = 0) { // get all current values for this contextid // (note: this might contain doubles for overlapping contextids) $aIdToValue = array(); $res = sql_query('SELECT oid, ovalue FROM ' . sql_table('plugin_option') . ' WHERE ocontextid=' . intval($contextid)); while ($o = sql_fetch_object($res)) { $aIdToValue[$o->oid] = $o->ovalue; } // get list of oids per pid $query = 'SELECT * FROM ' . sql_table('plugin_option_desc') . ',' . sql_table('plugin') . ' WHERE opid=pid and ocontext=\'' . sql_real_escape_string($context) . '\' ORDER BY porder, oid ASC'; $res = sql_query($query); $aOptions = array(); while ($o = sql_fetch_object($res)) { if (in_array($o->oid, array_keys($aIdToValue))) { $value = $aIdToValue[$o->oid]; } else { $value = $o->odef; } array_push($aOptions, array('pid' => $o->pid, 'pfile' => $o->pfile, 'oid' => $o->oid, 'value' => $value, 'name' => $o->oname, 'description' => $o->odesc, 'type' => $o->otype, 'typeinfo' => $o->oextra, 'contextid' => $contextid, 'extra' => '')); } global $manager; $manager->notify('PrePluginOptionsEdit', array('context' => $context, 'contextid' => $contextid, 'options' => &$aOptions)); $iPrevPid = -1; foreach ($aOptions as $aOption) { // new plugin? if ($iPrevPid != $aOption['pid']) { $iPrevPid = $aOption['pid']; if (!defined('_PLUGIN_OPTIONS_TITLE')) { define('_PLUGIN_OPTIONS_TITLE', 'Options for %s'); } echo '<tr><th colspan="2">' . sprintf(_PLUGIN_OPTIONS_TITLE, htmlspecialchars($aOption['pfile'], ENT_QUOTES)) . '</th></tr>'; } $meta = NucleusPlugin::getOptionMeta($aOption['typeinfo']); if (@$meta['access'] != 'hidden') { echo '<tr>'; listplug_plugOptionRow($aOption); echo '</tr>'; } } }
function listplug_table_plugoptionlist($template, $type) { global $manager; switch ($type) { case 'HEAD': echo '<th>' . _LISTS_INFO . '</th><th>' . _LISTS_VALUE . '</th>'; break; case 'BODY': $current = $template['current']; listplug_plugOptionRow($current); break; case 'FOOT': ?> <tr> <th colspan="2"><?php echo _PLUGS_SAVE; ?> </th> </tr><tr> <td><?php echo _PLUGS_SAVE; ?> </td> <td><input type="submit" value="<?php echo _PLUGS_SAVE; ?> " /></td> </tr> <?php break; } }