[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/data/field/text/ -> field.class.php (source)

   1  <?php
   2  ///////////////////////////////////////////////////////////////////////////
   3  //                                                                       //
   4  // NOTICE OF COPYRIGHT                                                   //
   5  //                                                                       //
   6  // Moodle - Modular Object-Oriented Dynamic Learning Environment         //
   7  //          http://moodle.org                                            //
   8  //                                                                       //
   9  // Copyright (C) 1999-onwards Moodle Pty Ltd  http://moodle.com          //
  10  //                                                                       //
  11  // This program is free software; you can redistribute it and/or modify  //
  12  // it under the terms of the GNU General Public License as published by  //
  13  // the Free Software Foundation; either version 2 of the License, or     //
  14  // (at your option) any later version.                                   //
  15  //                                                                       //
  16  // This program is distributed in the hope that it will be useful,       //
  17  // but WITHOUT ANY WARRANTY; without even the implied warranty of        //
  18  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
  19  // GNU General Public License for more details:                          //
  20  //                                                                       //
  21  //          http://www.gnu.org/copyleft/gpl.html                         //
  22  //                                                                       //
  23  ///////////////////////////////////////////////////////////////////////////
  24  
  25  class data_field_text extends data_field_base {
  26  
  27      var $type = 'text';
  28  
  29      function display_search_field($value = '') {
  30          return '<label class="accesshide" for="f_' . $this->field->id . '">'. $this->field->name.'</label>' . '<input type="text" size="16" id="f_'.$this->field->id.'" name="f_'.$this->field->id.'" value="'.s($value).'" />';
  31      }
  32  
  33      function parse_search_field() {
  34          return optional_param('f_'.$this->field->id, '', PARAM_NOTAGS);
  35      }
  36  
  37      function generate_sql($tablealias, $value) {
  38          global $DB;
  39  
  40          static $i=0;
  41          $i++;
  42          $name = "df_text_$i";
  43          return array(" ({$tablealias}.fieldid = {$this->field->id} AND ".$DB->sql_like("{$tablealias}.content", ":$name", false).") ", array($name=>"%$value%"));
  44      }
  45  
  46      /**
  47       * Check if a field from an add form is empty
  48       *
  49       * @param mixed $value
  50       * @param mixed $name
  51       * @return bool
  52       */
  53      function notemptyfield($value, $name) {
  54          return strval($value) !== '';
  55      }
  56  }
  57  
  58  


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1