[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Yes/No (boolean) filter. 19 * 20 * @package core_user 21 * @category user 22 * @copyright 1999 Martin Dougiamas http://dougiamas.com 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 /** 27 * Generic yes/no filter with radio buttons for integer fields. 28 * @copyright 1999 Martin Dougiamas http://dougiamas.com 29 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 30 */ 31 class user_filter_yesno extends user_filter_simpleselect { 32 33 /** 34 * Constructor 35 * @param string $name the name of the filter instance 36 * @param string $label the label of the filter instance 37 * @param boolean $advanced advanced form element flag 38 * @param string $field user table filed name 39 */ 40 public function user_filter_yesno($name, $label, $advanced, $field) { 41 parent::user_filter_simpleselect($name, $label, $advanced, $field, array(0 => get_string('no'), 1 => get_string('yes'))); 42 } 43 44 /** 45 * Returns the condition to be used with SQL 46 * 47 * @param array $data filter settings 48 * @return array sql string and $params 49 */ 50 public function get_sql_filter($data) { 51 static $counter = 0; 52 $name = 'ex_yesno'.$counter++; 53 54 $value = $data['value']; 55 $field = $this->_field; 56 if ($value == '') { 57 return array(); 58 } 59 return array("$field=:$name", array($name => $value)); 60 } 61 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |