|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00003 // // 00004 // NOTICE OF COPYRIGHT // 00005 // // 00006 // Moodle - Modular Object-Oriented Dynamic Learning Environment // 00007 // http://moodle.org // 00008 // // 00009 // Copyright (C) 1999-onwards Moodle Pty Ltd http://moodle.com // 00010 // // 00011 // This program is free software; you can redistribute it and/or modify // 00012 // it under the terms of the GNU General Public License as published by // 00013 // the Free Software Foundation; either version 2 of the License, or // 00014 // (at your option) any later version. // 00015 // // 00016 // This program is distributed in the hope that it will be useful, // 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of // 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 00019 // GNU General Public License for more details: // 00020 // // 00021 // http://www.gnu.org/copyleft/gpl.html // 00022 // // 00024 00025 class data_field_text extends data_field_base { 00026 00027 var $type = 'text'; 00028 00029 function display_search_field($value = '') { 00030 return '<input type="text" size="16" name="f_'.$this->field->id.'" value="'.$value.'" />'; 00031 } 00032 00033 function parse_search_field() { 00034 return optional_param('f_'.$this->field->id, '', PARAM_NOTAGS); 00035 } 00036 00037 function generate_sql($tablealias, $value) { 00038 global $DB; 00039 00040 static $i=0; 00041 $i++; 00042 $name = "df_text_$i"; 00043 return array(" ({$tablealias}.fieldid = {$this->field->id} AND ".$DB->sql_like("{$tablealias}.content", ":$name", false).") ", array($name=>"%$value%")); 00044 } 00045 00046 } 00047 00048