/**
  * Checks if $query is one of the available log plugins.
  *
  * @param string $query The string to search for
  * @return bool Returns true if found, false if not
  */
 public function is_related($query)
 {
     if (parent::is_related($query)) {
         return true;
     }
     $query = core_text::strtolower($query);
     $plugins = \tool_log\log\manager::get_store_plugins();
     foreach ($plugins as $plugin => $fulldir) {
         if (strpos(core_text::strtolower($plugin), $query) !== false) {
             return true;
         }
         $localised = get_string('pluginname', $plugin);
         if (strpos(core_text::strtolower($localised), $query) !== false) {
             return true;
         }
     }
     return false;
 }
Beispiel #2
0
 * Logging store management.
 *
 * @package    tool_log
 * @copyright  2013 Petr Skoda {@link http://skodak.org}
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once '../../../config.php';
require_once $CFG->libdir . '/adminlib.php';
$action = required_param('action', PARAM_ALPHANUMEXT);
$enrol = required_param('store', PARAM_PLUGIN);
$PAGE->set_url('/admin/tool/log/stores.php');
$PAGE->set_context(context_system::instance());
require_login();
require_capability('moodle/site:config', context_system::instance());
require_sesskey();
$all = \tool_log\log\manager::get_store_plugins();
$enabled = get_config('tool_log', 'enabled_stores');
if (!$enabled) {
    $enabled = array();
} else {
    $enabled = array_flip(explode(',', $enabled));
}
$return = new moodle_url('/admin/settings.php', array('section' => 'managelogging'));
$syscontext = context_system::instance();
switch ($action) {
    case 'disable':
        unset($enabled[$enrol]);
        set_config('enabled_stores', implode(',', array_keys($enabled)), 'tool_log');
        break;
    case 'enable':
        if (!isset($all[$enrol])) {