芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/cepali/user/filters/user_filter_forms.php
. /** * This file contains forms used to filter user. * * @package core_user * @category user * @copyright 1999 Martin Dougiamas http://dougiamas.com * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once($CFG->libdir.'/formslib.php'); /** * Class user_add_filter_form * @copyright 1999 Martin Dougiamas http://dougiamas.com * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class user_add_filter_form extends moodleform { /** * Form definition. */ public function definition() { $mform =& $this->_form; $fields = $this->_customdata['fields']; $extraparams = $this->_customdata['extraparams']; $mform->addElement('header', 'newfilter', get_string('newfilter', 'filters')); foreach ($fields as $ft) { $ft->setupForm($mform); } // In case we wasnt to track some page params. if ($extraparams) { foreach ($extraparams as $key => $value) { $mform->addElement('hidden', $key, $value); $mform->setType($key, PARAM_RAW); } } // Add button. $mform->addElement('submit', 'addfilter', get_string('addfilter', 'filters')); } } /** * Class user_active_filter_form * @copyright 1999 Martin Dougiamas http://dougiamas.com * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class user_active_filter_form extends moodleform { /** * Form definition. */ public function definition() { global $SESSION; // This is very hacky :-(. $mform =& $this->_form; $fields = $this->_customdata['fields']; $extraparams = $this->_customdata['extraparams']; if (!empty($SESSION->user_filtering)) { // Add controls for each active filter in the active filters group. $mform->addElement('header', 'actfilterhdr', get_string('actfilterhdr', 'filters')); foreach ($SESSION->user_filtering as $fname => $datas) { if (!array_key_exists($fname, $fields)) { continue; // Filter not used. } $field = $fields[$fname]; foreach ($datas as $i => $data) { $description = $field->get_label($data); $mform->addElement('checkbox', 'filter['.$fname.']['.$i.']', null, $description); } } if ($extraparams) { foreach ($extraparams as $key => $value) { $mform->addElement('hidden', $key, $value); $mform->setType($key, PARAM_RAW); } } $objs = array(); $objs[] = &$mform->createElement('submit', 'removeselected', get_string('removeselected', 'filters')); $objs[] = &$mform->createElement('submit', 'removeall', get_string('removeall', 'filters')); $mform->addElement('group', 'actfiltergrp', '', $objs, ' ', false); } } }