Top  Branding  Banner 
blank.gif
blank.gif
triangle.gif Du er her: /  Forsiden  /  Kildekoden  /  Layout  /  Line   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 tls.gif     Layout  trs.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
MenuLink  MenuLeft  
Tilbage

Skjul: Navn

Line.php


Vis: Sample code, tutorial

Line, Sample code, tutorial

Sådan benyttes komponenten Line klassen

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

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

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

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

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

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

Skjul: Sådan vises komponenten

Line, Sådan vises komponenten

Sådan vises komponenten Line klassen

blank.gif

Vis: PHP source code

Line, PHP source code

Den fulde PHP kildekode for Line klassen

<?php
/**
 * @package layout
 * @see HTML_LAYOUT_UTIL_PATH.'/Line.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_TABLE_COMPONENT_PATH.'/TableHeader.php');
require_once(
HTML_TABLE_COMPONENT_PATH.'/Table.php');
require_once(
HTML_BASE_UTIL_PATH.'/Images.php');

/**
 * Used to draw a line, in order to show some visual effects
 * <code>
 * Usage:
 *   $datareader  = null;
 *   $text        = "10px"; // In fact, this is the height of the gif
 *   $width       = "100%";
 *   $class       = "theTable";
 *   $border      = "1";
 *   $cellpadding = "5"
 *   $cellspacing = "0";
 *   $summary     = "";
 *   $caption     = "";
 *   $id          = "";
 *   
 *   $line = new Line($datareader, $text, $width, $class, $border, $cellpadding, $cellspacing, $summary, $caption, $id);
 *   print $line->getHtml();
 * Or
 *   Line::display($datareader, $text, $width, $class, $border, $cellpadding, $cellspacing, $summary, $caption, $id);
 * </code>
 * @package layout
 */

class Line extends Table {
   private 
$height    '';
   private 
$lineclass '';

   
/**
    * 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 of the table, default 100%
    * @param String $class  The css class to use
    * @param String $border The table border
    * @param String $cellpadding The CellSpacing
    * @param String $cellspacing The CellPadding
    * @param String $summary The Summary
    * @param String $caption The Caption 
    */
   
function __construct($datareader=null$text=''$width=''$class=''$border=''$cellpadding=''$cellspacing=''$summary=''$caption=''$id='') {
        
$theText    '';   // NOT USED, because it is in fact the 'height' parameter
        
$theClass   CSS_PRINTER;
        
$theWidth   $width  != '' $width  LINE_VIEW_WIDTH;
        
$theBorder  $border != '' $border LINE_VIEW_BORDER
        
$theId      $id     != '' $id     $this->getClassName()."Id";
        
$theCellPadding $cellpadding != '' $cellpadding LINE_VIEW_CELLPADDING
        
$theCellSpacing $cellspacing != '' $cellspacing LINE_VIEW_CELLSPACING;
        
parent::__construct($datareader$theText$theWidth$theClass$theBorder$theCellPadding$theCellSpacing$summary$caption$theId);
        
$this->height    $text   != '' $text LINE_VIEW_HEIGHT;
        
$this->lineclass $class  != '' LINE_VIEW_CLASS.' '.$class LINE_VIEW_CLASS;
   }
   
    
/**
     * Get the CSS class Name for this component
     * @return String The CSS class name
     */
    
function getCssClass() {
        return 
$this->lineclass;
    }

    
/**
     * Return the content as an object
     * Note: have to subtract 2px from the width, because of the border on the table
     * @return Object The content as an object
     */
    
function newContent() {
        
$tr = new Tr();
        
$border $this->border// Like border="10", however problem if 10px etc.
        
if ($border === "" || $border === || $border === "0") {
            
$border 0;
        } else {
            
        }
        
$img = new Images(IMAGE_BLANK$this->width - ($border), $this->height);
        
$td = new Raw('<td class="'.$this->getCssClass().'">'.$img->getHtml().'</td>');
        
$tr->add($td);
        return 
$tr;
    }

   
/**
    * Builds the html, and return it for a Line object
    * @return String The html
    */
   
function getHtml() {
      
$html  $this->html;
      if (
defined('LAYOUT_SHOW') && LAYOUT_SHOW LAYOUT_SHOW_LINE && HTTP_USER_AGENT!=HTTP_USER_AGENT_P900) {
        
$this->add($this->newContent());
        
// Render it
        
if ($this->text != '') {
            
$html .= $this->getTableHeader();
        }
        
$html .= $this->getStart();
        
$html .= $this->getEnd();
      }
      return 
$html;
   }

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

Vis: HTML source code

Line, HTML source code

Den fulde HTML kildekode for Line klassen

<?
<!-- DEBUGLine -->

<
table id="LineId" width="100%" class="basePrinter" border="1" cellpadding="0" cellspacing="0">
 <
tr>
<
td class="tableBorderLeft tableBorderRight basePrinter layoutLineBanner"><!-- DEBUGImages -->
<
img src="http://myrer.info/images/blank.gif" width="96" height="5px" alt="blank.gif" /></td>
 </
tr>

</
table>

?>

Vis: Class methods

Line, Class methods

Her er 'klasse metoderne' for Line klassen:

  • __construct
  • getCssClass
  • newContent
  • getHtml
  • display
  • 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

Line, Object vars

Her er 'objekt variable' for Line 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+squeeze9) 1.11
blank.gif