// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Provides data for the jQuery UI autocomplete dropdowns. * * @package local_bulk_email_directory * @copyright Anthony Kuske <www.anthonykuske.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'; $directory = new local_bulk_email_directory\local\directory(); $type = required_param('type', PARAM_RAW); $term = required_param('term', PARAM_RAW); header('Content-Type: application/json'); if ($type === 'list') { $data = $directory->search_lists($term, true); echo json_encode($data); } else { if ($type === 'email') { $data = $directory->search_emails($term); echo json_encode($data); } }