Top  Branding  Banner 
blank.gif
blank.gif
triangle.gif Du er her: /  Forsiden  /  Kildekoden  /  Mvc  /  Viewplain   Login nu   Login
blank.gif
««« Se kilde koden
blank.gif
tl.gif Base tr.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 tls.gif     Mvc  trs.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
MenuLink  MenuLeft  
Tilbage

Skjul: Navn

ViewPlain.php


Vis: Sample code, tutorial

ViewPlain, Sample code, tutorial

Sådan benyttes komponenten ViewPlain klassen

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

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

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

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

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

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

Skjul: Sådan vises komponenten

ViewPlain, Sådan vises komponenten

Sådan vises komponenten ViewPlain klassen

1
"private_phone","contact_person","company_name","address","zip","city","country" "48246030","Finn Rasmussen","HvepseEksperten.dk ApS","Kongens Vænge 79","3400","Hillerød","Denmark"

Vis: PHP source code

ViewPlain, PHP source code

Den fulde PHP kildekode for ViewPlain klassen

<?php
/**
 * @package mvc
 * @see HTML_MVC_VIEW_PATH.'/ViewPlain.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.'/Htmlspecialchars.php');
require_once(
HTML_MVC_VIEW_PATH.'/ViewCommon.php');

/**
 * Generates the html for a View Plain
 * <code>
 * Usage:
 *   $view = new ViewPlain($datareader, $text, $width, $class, $border, $cellpadding, $cellspacing, $summary, $caption, $layout);
 *   print $view->getHtml();
 * Or
 *   ViewPlain::display($datareader, $text, $width, $class, $border, $cellpadding, $cellspacing, $summary, $caption, $layout);
 *
 * Generates a complete View Plain interface
 * head1, head2, etc
 * data1, data2, etc
 * </code>
 * @package mvc
 */

class ViewPlain extends ViewCommon {
    
/**
     * Constructor
     * @param DataReader / array $datareader The Data Reader object OR an array
     * @param String $text    The text header for the table
     * @param String $width   The Width for the table
     * @param String $class   The Class
     * @param String $border  The Border
     * @param String $cellpadding The CellSpacing
     * @param String $cellspacing The CellPadding
     * @param String $summary The Summary
     * @param String $caption The Caption 
     * @param String $layout  The layout to use 
     */
    
function __construct($datareader=null$text=''$width=''$class=''$border=''$cellpadding=''$cellspacing=''$summary=''$caption=''$layout='') {
        
$theText        $text != '' $text '';

        
// Global table characteristics
        
$theWidth       $width  != '' $width  LIST_VIEW_WIDTH;
        
$theClass       $class  != '' $class  LIST_VIEW_CLASS;
        
$theBorder      $border != '' $border LIST_VIEW_BORDER;
        
$theCellPadding $cellpadding != '' $cellpadding LIST_VIEW_CELLPADDING;
        
$theCellSpacing $cellspacing != '' $cellspacing LIST_VIEW_CELLSPACING;
        
parent::__construct($datareader$theText$theWidth$theClass$theBorder$theCellPadding$theCellSpacing$summary$caption$layout);
    }

    
/**
     * Return the content as an object
     * @return Object The content as an object
     */
    
function newContent() {
        
$object = new Raw();
        
$numrows $this->datareader->getNumRows();
        
$this->text .= $numrows;
        
$html $this->text."<br />\r\n";
        
$header  '';
        
$data    '';
        if (
$numrows 0) {
            
$i 0;
            foreach(
$this->datareader->getRows() as $no=>$row) {
                if (
$i === 0) {
                    foreach(
$row as $key=>$rawvalue) {
                        
$value $this->strip($rawvalue__FILE____LINE__);
                        
$header .= ($header != '' ',' '').'"'.$key.'"';
                    }
                    
$html  .= "$header\r\n";
                    
$header '';
                }
                foreach(
$row as $key=>$rawvalue) {
                    
$value $this->strip($rawvalue__FILE____LINE__);
                    
$data .= ($data != '' ',' '').'"'.$value.'"';
                }
                
$html .= "$data\r\n";
                
$data  '';
                
$i++;
            }
        } else {
            
$html .= TEXT_NO_DATA."<br />\r\n";
        }
        
// TODO, should be more object
        
$object->add(new Raw($html));
        return 
$object;
    }

    
/**
     * Return the html
     * @return String The html
     */
    
function getHtml() {
        
$html $this->html;
        
$this->add($this->newContent());
        
// Render it
        
if ($this->getSizeof() > 0) {
            
$html .= $this->getElements();
        }
        
//$html .= $this->getTableHeader();
        //$html .= $this->getStart();
        //$html .= $this->getEnd();
        
return $html;
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    ViewPlain::display($datareader, $text, $width, $class, $border, $cellpadding, $cellspacing, $summary, $caption, $layout); 
     * </code>
     * @static
     * @param DataReader / array $datareader The Data Reader object OR an array
     * @param String $text    The text header for the table
     * @param String $width   The width of the table
     * @param String $class   The class of the table
     * @param String $border  The border of the table
     * @param String $cellpadding The CellSpacing
     * @param String $cellspacing The CellPadding
     * @param String $summary The Summary
     * @param String $caption The Caption 
     * @param String $layout  The layout to use 
     */
    
public static function display($datareader=null$text=''$width=''$class=''$border=''$cellpadding=''$cellspacing=''$summary=''$caption=''$layout='') {
        
$html = new ViewPlain($datareader$text$width$class$border$cellpadding$cellspacing$summary$caption$layout);
        
$html->addHtml();
    }
}
?>

Vis: HTML source code

ViewPlain, HTML source code

Den fulde HTML kildekode for ViewPlain klassen

<?
<!-- DEBUGViewPlain -->
1<br />
"private_phone","contact_person","company_name","address","zip","city","country"
"48246030"
,"Finn Rasmussen","HvepseEksperten.dk ApS","Kongens Vænge 79","3400","Hillerød","Denmark"



?>

Vis: Class methods

ViewPlain, Class methods

Her er 'klasse metoderne' for ViewPlain klassen:

  • __construct
  • newContent
  • getHtml
  • display
  • setStriphttp
  • setStriptags
  • setEncode
  • setMultipleEditColumns
  • setTable
  • newHiddens
  • newButtons
  • newData
  • getCssClass
  • newColumn
  • isActive
  • isActiveTab
  • isActiveIndex
  • newColumns
  • adjustColumns
  • newCorner
  • getColumns
  • newTextRow
  • getTableHeader
  • getStart
  • getEnd
  • start
  • end
  • 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

ViewPlain, Object vars

Her er 'objekt variable' for ViewPlain klassen:

  • html =>
  • sql =>

MenuRight 
triangle.gif

Dansk

Deutch

English (UK)

France

Italy

Norsk

Svensk

English (USA)


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