⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.php

📁 完美的在线教育系统
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/* vim: set expandtab tabstop=4 shiftwidth=4: */// +----------------------------------------------------------------------+// | PHP version 4.0                                                      |// +----------------------------------------------------------------------+// | Copyright (c) 1997-2003 The PHP Group                                |// +----------------------------------------------------------------------+// | This source file is subject to version 2.0 of the PHP license,       |// | that is bundled with this package in the file LICENSE, and is        |// | available at through the world-wide-web at                           |// | http://www.php.net/license/2_02.txt.                                 |// | If you did not receive a copy of the PHP license and are unable to   |// | obtain it through the world-wide-web, please send a note to          |// | license@php.net so we can mail you a copy immediately.               |// +----------------------------------------------------------------------+// | Authors: Alexey Borzov <borz_off@cs.msu.su>                          |// |          Adam Daniel <adaniel1@eesus.jnj.com>                        |// |          Bertrand Mansion <bmansion@mamasam.com>                     |// +----------------------------------------------------------------------+//// $Id: Default.php 9612 2006-10-20 11:56:44Z bmol $require_once('HTML/QuickForm/Renderer.php');/** * A concrete renderer for HTML_QuickForm, * based on QuickForm 2.x built-in one *  * @access public */class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer{   /**    * The HTML of the form      * @var      string    * @access   private    */    var $_html;   /**    * Header Template string    * @var      string    * @access   private    */    var $_headerTemplate =         "\n\t<tr>\n\t\t<td style=\"white-space: nowrap; background-color: #CCCCCC;\" align=\"left\" valign=\"top\" colspan=\"2\"><b>{header}</b></td>\n\t</tr>";   /**    * Element template string    * @var      string    * @access   private    */    var $_elementTemplate =         "\n\t<tr>\n\t\t<td align=\"right\" valign=\"top\"><!-- BEGIN required --><span style=\"color: #ff0000\">*</span><!-- END required --><b>{label}</b></td>\n\t\t<td valign=\"top\" align=\"left\"><!-- BEGIN error --><span style=\"color: #ff0000\">{error}</span><br /><!-- END error -->\t{element}</td>\n\t</tr>";   /**    * Form template string    * @var      string    * @access   private    */    var $_formTemplate =         "\n<form{attributes}>\n<div>\n{hidden}<table border=\"0\">\n{content}\n</table>\n</div>\n</form>";   /**    * Required Note template string    * @var      string    * @access   private    */    var $_requiredNoteTemplate =         "\n\t<tr>\n\t\t<td></td>\n\t<td align=\"left\" valign=\"top\">{requiredNote}</td>\n\t</tr>";   /**    * Array containing the templates for customised elements    * @var      array    * @access   private    */    var $_templates = array();   /**    * Array containing the templates for group wraps.    *     * These templates are wrapped around group elements and groups' own    * templates wrap around them. This is set by setGroupTemplate().    *     * @var      array    * @access   private    */    var $_groupWraps = array();   /**    * Array containing the templates for elements within groups    * @var      array    * @access   private    */    var $_groupTemplates = array();   /**    * True if we are inside a group     * @var      bool    * @access   private    */    var $_inGroup = false;   /**    * Array with HTML generated for group elements    * @var      array    * @access   private    */    var $_groupElements = array();   /**    * Template for an element inside a group    * @var      string    * @access   private    */    var $_groupElementTemplate = '';   /**    * HTML that wraps around the group elements    * @var      string    * @access   private    */    var $_groupWrap = '';   /**    * HTML for the current group    * @var      string    * @access   private    */    var $_groupTemplate = '';       /**    * Collected HTML of the hidden fields    * @var      string    * @access   private    */    var $_hiddenHtml = '';   /**    * Constructor    *    * @access public    */    function HTML_QuickForm_Renderer_Default()    {        $this->HTML_QuickForm_Renderer();    } // end constructor   /**    * returns the HTML generated for the form    *    * @access public    * @return string    */    function toHtml()    {        // _hiddenHtml is cleared in finishForm(), so this only matters when        // finishForm() was not called (e.g. group::toHtml(), bug #3511)        return $this->_hiddenHtml . $this->_html;    } // end func toHtml       /**    * Called when visiting a form, before processing any form elements    *    * @param    object      An HTML_QuickForm object being visited    * @access   public    * @return   void    */    function startForm(&$form)    {        $this->_html = '';        $this->_hiddenHtml = '';    } // end func startForm   /**    * Called when visiting a form, after processing all form elements    * Adds required note, form attributes, validation javascript and form content.    *     * @param    object      An HTML_QuickForm object being visited    * @access   public    * @return   void    */    function finishForm(&$form)    {        // add a required note, if one is needed        if (!empty($form->_required) && !$form->_freezeAll) {            $this->_html .= str_replace('{requiredNote}', $form->getRequiredNote(), $this->_requiredNoteTemplate);        }        // add form attributes and content        $html = str_replace('{attributes}', $form->getAttributes(true), $this->_formTemplate);        if (strpos($this->_formTemplate, '{hidden}')) {            $html = str_replace('{hidden}', $this->_hiddenHtml, $html);        } else {            $this->_html .= $this->_hiddenHtml;        }        $this->_hiddenHtml = '';        $this->_html = str_replace('{content}', $this->_html, $html);        // add a validation script        if ('' != ($script = $form->getValidationScript())) {            $this->_html = $script . "\n" . $this->_html;        }    } // end func finishForm         /**    * Called when visiting a header element    *    * @param    object     An HTML_QuickForm_header element being visited    * @access   public    * @return   void    */    function renderHeader(&$header)    {        $name = $header->getName();        if (!empty($name) && isset($this->_templates[$name])) {            $this->_html .= str_replace('{header}', $header->toHtml(), $this->_templates[$name]);        } else {            $this->_html .= str_replace('{header}', $header->toHtml(), $this->_headerTemplate);        }    } // end func renderHeader   /**    * Helper method for renderElement    *    * @param    string      Element name    * @param    mixed       Element label (if using an array of labels, you should set the appropriate template)    * @param    bool        Whether an element is required    * @param    string      Error message associated with the element    * @access   private    * @see      renderElement()    * @return   string      Html for element    */    function _prepareTemplate($name, $label, $required, $error)    {        if (is_array($label)) {            $nameLabel = array_shift($label);        } else {            $nameLabel = $label;        }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -