]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12786 admin search in configselect choices; merged from MOODLE_19_STABLE
authorskodak <skodak>
Mon, 31 Dec 2007 15:55:36 +0000 (15:55 +0000)
committerskodak <skodak>
Mon, 31 Dec 2007 15:55:36 +0000 (15:55 +0000)
lib/adminlib.php

index 29943d1753a7cb4963b6dca5a02428c8b33c1f84..e7ec76b0090cd262059b55507e2c253d1fdc8b9a 100644 (file)
@@ -2151,6 +2151,25 @@ class admin_setting_configselect extends admin_setting {
         return true;
     }
 
+    function is_related($query) {
+        if (parent::is_related($query)) {
+            return true;
+        }
+        if (!$this->load_choices()) {
+            return false;
+        }
+        $textlib = textlib_get_instance();
+        foreach ($this->choices as $key=>$value) {
+            if (strpos($textlib->strtolower($key), $query) !== false) {
+                return true;
+            }
+            if (strpos($textlib->strtolower($value), $query) !== false) {
+                return true;
+            }
+        }         
+        return false;
+    }
+
     function get_setting() {
         return $this->config_read($this->name);
     }