|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 /* vim: set expandtab tabstop=4 shiftwidth=4: */ 00003 // +----------------------------------------------------------------------+ 00004 // | PHP version 4.0 | 00005 // +----------------------------------------------------------------------+ 00006 // | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | 00007 // +----------------------------------------------------------------------+ 00008 // | This source file is subject to version 2.0 of the PHP license, | 00009 // | that is bundled with this package in the file LICENSE, and is | 00010 // | available at through the world-wide-web at | 00011 // | http://www.php.net/license/2_02.txt. | 00012 // | If you did not receive a copy of the PHP license and are unable to | 00013 // | obtain it through the world-wide-web, please send a note to | 00014 // | license@php.net so we can mail you a copy immediately. | 00015 // +----------------------------------------------------------------------+ 00016 // | Authors: Adam Daniel <adaniel1@eesus.jnj.com> | 00017 // | Bertrand Mansion <bmansion@mamasam.com> | 00018 // +----------------------------------------------------------------------+ 00019 // 00020 // $Id: hiddenselect.php,v 1.2 2010/12/14 17:35:24 moodlerobot Exp $ 00021 00022 require_once('HTML/QuickForm/select.php'); 00023 00037 class HTML_QuickForm_hiddenselect extends HTML_QuickForm_select 00038 { 00039 // {{{ constructor 00040 00052 function HTML_QuickForm_hiddenselect($elementName=null, $elementLabel=null, $options=null, $attributes=null) 00053 { 00054 HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes); 00055 $this->_persistantFreeze = true; 00056 $this->_type = 'hiddenselect'; 00057 if (isset($options)) { 00058 $this->load($options); 00059 } 00060 } //end constructor 00061 00062 // }}} 00063 // {{{ toHtml() 00064 00073 function toHtml() 00074 { 00075 $tabs = $this->_getTabs(); 00076 $name = $this->getPrivateName(); 00077 $strHtml = ''; 00078 00079 foreach ($this->_values as $key => $val) { 00080 for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) { 00081 if ($val == $this->_options[$i]['attr']['value']) { 00082 $strHtml .= $tabs . '<input' . $this->_getAttrString(array( 00083 'type' => 'hidden', 00084 'name' => $name, 00085 'value' => $val 00086 )) . " />\n" ; 00087 } 00088 } 00089 } 00090 00091 return $strHtml; 00092 } //end func toHtml 00093 00094 // }}} 00095 // {{{ accept() 00096 00100 function accept(&$renderer) 00101 { 00102 $renderer->renderHidden($this); 00103 } 00104 00105 // }}} 00106 } //end class HTML_QuickForm_hiddenselect 00107 ?>