Top  Branding  Banner 
blank.gif
blank.gif
triangle.gif Du er her: /  Forsiden  /  Kildekoden  /  Base  /  Fieldset   Login nu   Login
blank.gif
blank.gif
tls.gif     Base  trs.gif tl.gif Basic tr.gif tl.gif Dto tr.gif tl.gif Form tr.gif tl.gif Language tr.gif tl.gif Layout tr.gif tl.gif Menu tr.gif tl.gif Mvc tr.gif tl.gif Netbank.eksperter.dk tr.gif tl.gif Tab tr.gif tl.gif Table tr.gif tl.gif Util tr.gif
blank.gif
blank.gif
arrow-headline.gif Index
arrow-headline.gif Navigation
arrow-headline.gif Artikler
 
Tilbage

Skjul: Navn

Fieldset.php


Vis: Sample code, tutorial

Fieldset, Sample code, tutorial

Sådan benyttes komponenten Fieldset klassen

Først skal du inkludere den fil der beskriver komponenten, som en klasse fil

  • <?
    require_once(HTML_PACKAGE_PATH.'/Fieldset.php');
    ?>

Dernæst kan du enten benytte komponenten som et taglib (statiske metoder):

  • <?
    Fieldset
    ::display($param1$param2$param3, ...);
    ?>

eller du kan lave en instance af komponenten og benytte metoderne direkte:

  • <?
    $object 
    = new Fieldset($param1$param2$param3, ...);
    print 
    $object->getHtml();
    ?>

Skjul: Sådan vises komponenten

Fieldset, Sådan vises komponenten

Sådan vises komponenten Fieldset klassen

Finn-Rasmusssen.com

Demo of the myPHP taglib and the CMS system written in PHP (also available in C# and java)



Vis: PHP source code

Fieldset, PHP source code

Den fulde PHP kildekode for Fieldset klassen

<?php
/**
 * @package base
 * @see HTML_BASE_UTIL_PATH.'/Fieldset.php'
 * @copyright (c) http://Finn-Rasmussen.com
 * @license http://Finn-Rasmussen.com/license/ myPHP License conditions
 * @author http://Finn-Rasmussen.com
 * @version 1.11
 * @since 27-nov-2009
*/

/**
 * The required files
 */
require_once(HTML_BASE_UTIL_PATH.'/Legend.php');
require_once(
HTML_BASE_COMMON_PATH.'/Html.php');
if (
defined('HTML_LOG_UTIL_PATH')) {
    require_once(
HTML_LOG_UTIL_PATH.'/Log.php');
}

/**
 * Generates an FIELDSET form element
 * <code>
 * Usage:
 *   $legend   = new Legend($text);   
 *   $fieldset = new Fieldset($legend, $class);
 *   $element  = new Select('theSelect1');
 *   $fieldset->add($element);
 *   print $fieldset->getHtml();
 * Or
 *   Fieldset::display(new Legend($legend, $class));
 * </code>
 * @package base
 */

class Fieldset extends Html {
    
/**
     * @var String $legend The legend to show
     */
    
protected $legend null;

    
/**
     * @var String $class The CSS class name
     */
    
protected $class  '';

    
/**
     * Constructor
     * @param Object $legend The legend object to use
     * @param String $class  The css class of the link
     */
    
function __construct($legend=''$class='') {
        
parent::__construct();
        
$this->class $class != '' $class CSS_FIELDSET;
        if (
$legend !== '') {
            if (
is_object($legend)) {
                
$this->setObject('legend'$legend);
            } else {
                
$msg $this->getClassName().'(), object expected, unknown type='.gettype($legend);
                if (
defined('HTML_LOG_UTIL_PATH')) {
                    
Log::fatal($msg__FILE____LINE__); // Should be debug
                
} else {
                    
Message::add($msg__FILE____LINE__);
                }
                
//$this->getMsg(LOG_LEVEL_FATAL, $msg);
                
$this->legend = new Legend($legend); // Assume text
            
}
        }
    }

    
/**
     * Returns the start html for the fieldset control
     * @return String the complete html
     */
    
function getStart() {
        
$html  '';
        
$html .= '<fieldset';
        
$html .= $this->getAttribute('class');
        
$html .= ">";
        if (
$this->legend !== null && is_object($this->legend)) {
            
$html .= $this->legend->getHtml();
        }
        
$html .= "\r\n";
        
$html .= $this->getElements(); // as html
        
return $html;
    }

    
/**
     * Returns the end html for the fieldset control
     * @return String the complete html
     */
    
function getEnd() {
        return 
"</fieldset><br />\r\n";
    }

    
/**
     * Returns the html for the fieldset control
     * @return String the complete html
     */
    
function getHtml() {
        
$html  $this->html;
        
$html .= $this->getStart();
        
$html .= $this->getEnd();
        return 
$html;
    }

    
/**
     * Start of tag
     * <code>
     * Usage:
     *    Fieldset::start($legend, $class);
     * </code> 
     * @static
     * @param Object $legend The legend object to use
     * @param String $class  The css class of the link
     */
    
public static function start($legend=''$class='') {
        
$html = new Fieldset($legend$class);
        
$html->addHtml($html->getStart());
    }

    
/**
     * End of tag
     * <code>
     * Usage:
     *    Fieldset::end(); 
    * </code> 
    * @static
     */
    
public static function end() {
        
$legend "";
        
$class  "";
        
$html = new Fieldset($legend$class);
        
$html->addHtml($html->getEnd());
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Fieldset::display($legend, $class); 
     * </code> 
     * @static
     * @param Object $legend The legend object to use
     * @param String $class  The css class of the link
     */
    
public static function display($legend=''$class='') {
        
$html = new Fieldset($legend$class);
        
$html->addHtml();
    }
}
?>

Vis: HTML source code

Fieldset, HTML source code

Den fulde HTML kildekode for Fieldset klassen

<?
<!-- DEBUGFieldset -->
<
fieldset class="baseFieldset">
<!-- 
DEBUGLegend -->
<
legend>Finn-Rasmusssen.com
</legend>

<
p>Demo of the myPHP taglib and the CMS system written in PHP (also available in C# and java)</p>
</fieldset><br />

?>

Vis: Class methods

Fieldset, Class methods

Her er 'klasse metoderne' for Fieldset klassen:

  • __construct
  • getStart
  • getEnd
  • getHtml
  • start
  • end
  • display
  • setObject
  • set
  • get
  • getAttribute
  • getTag
  • add
  • getSizeof
  • getElement
  • getElements
  • getToogle
  • getMaximize
  • getMinimize
  • newTriangle
  • getStartHtml
  • getEndHtml
  • showsource
  • getClassName
  • getMsg
  • addHtml
  • __toString
  • getCacheFileName
  • save
  • content

Vis: Object vars

Fieldset, Object vars

Her er 'objekt variable' for Fieldset klassen:

  • html =>
  • sql =>

arrow-headline.gif Artikler

triangle.gif

Dansk

Deutch

English (UK)

France

Italy

Norsk

Svensk

English (USA)


 
blank.gif
triangle.gif Copyright @ 1999-2010 www.Finn-Rasmussen.com Powered by myPHP Version (5.3.3-7+squeeze14) 1.11
blank.gif