ViewDetail
ViewDetail Du er her: /  Forsiden  /  Kildekoden  /  Mvc  /  Viewdetail   Login nu   Login
ViewDetail
ViewDetail
ViewDetail Basic ViewDetail ViewDetail Base ViewDetail ViewDetail Component ViewDetail ViewDetail Db ViewDetail ViewDetail Dto ViewDetail ViewDetail Form ViewDetail ViewDetail Form-elements ViewDetail ViewDetail Jquery ViewDetail ViewDetail Layout ViewDetail ViewDetail Menu ViewDetail ViewDetail Menu-fisheye ViewDetail ViewDetail Mvc  ViewDetail ViewDetail Tab ViewDetail ViewDetail Table ViewDetail ViewDetail Template ViewDetail ViewDetail Util ViewDetail
ViewDetail
ViewDetail
ViewDetail Index
 
Tilbage

Navn : ViewDetail.php


Sample code, tutorial

Sådan benyttes komponenten ViewDetail klassen

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

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

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

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

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

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

Parent html

Sådan vises komponenten ViewDetail klassen

private_phone  48246030
contact_person  Finn Rasmussen 
company_name  HvepseEksperten.dk ApS 
address  Kongens Vænge 79 
city  3400&nbsp;Hillerød 
country  Denmark 

PHP source code

Den fulde PHP kildekode for ViewDetail klassen

<?
/**
* @package mvc
* @see HTML_MVC_VIEW_PATH.'/ViewDetail.php'
* @copyright (c) http://Finn-Rasmussen.com
* @license http://Finn-Rasmussen.com/license/ myPHP License conditions
* @author http://Finn-Rasmussen.com
* @version 1.10
* @since 22-feb-2007
*/

/**
* The required files
*/
require_once(HTML_MVC_VIEW_PATH.'/ViewSimple.php');

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

class ViewDetail extends ViewSimple {
    
/**
     * Constructor
     * @param DataReader $datareader The Data Reader object
     * @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
     */
    
function ViewDetail($datareader,$text='',$width='',$class='',$border='',$cellpadding='',$cellspacing='',$summary='',$caption='') {
        
$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;
        
$this->ViewSimple($datareader,$theText,$theWidth,$theClass,$theBorder,$theCellPadding,$theCellSpacing,$summary,$caption);
    }

    
/**
     * Return the content as an object
     * @return Object The content as an object
     */
    
function newContent() {
        
$object = new Tr();
        
$numrows = $this->datareader->getNumRows();
        if (
$numrows > 0) {
            if (
$numrows>1) {
                
$this->text .= $this->text!=''?" ($numrows)":'';
                
$td = new Td('','','',"TODO More than one ...<br />\r\n");
                
$object->add($td);
                
$link  = new Links(LINK_BACK);
                
$td = new Td('','','',$link);
                
$object->add($td);
            }
            
$count = 0;
            foreach(
$this->datareader->getRows() as $no=>$row) {
                
$rowcolor = Rowcolor::get($count++);
                if (
$count > 1) {
                    
$td = new Td(CSS_COLOR_HEADERA);
                    
$td->add(new Hr());
                    
$object->add($td);
                    
$td = new Td($rowcolor);
                    
$td->add(new Hr());
                    
$object->add($td);
                }
                
$object->add($this->newRow($row,CSS_COLOR_HEADER,$rowcolor));
            }
        } else {
            
$object->add($this->newTextRow(TEXT_NO_DATA, LINK_BACK));
        }
        return
$object;
    }

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

    
/**
     * Display html
     * <code>
     * Usage:
     *    ViewDetail::display($datareader,$text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
     * </code>
     * @static
     * @param DataReader $datareader The Data Reader object
     * @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
     */
    
function display($datareader,$text='',$width='',$class='',$border='',$cellpadding='',$cellspacing='',$summary='',$caption='') {
        
$html = new ViewDetail($datareader,$text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
        
$html->addHtml();
    }
}
?>

HTML source code

Den fulde HTML kildekode for ViewDetail klassen

<?

<table width="100%" class="tableListView baseBorder" border="0" cellpadding="2" cellspacing="0">
<
tr>
<
tr>
  <
th class="baseColorHeader" valign="top">private_phone&nbsp;</th>

    <
td class="baseColorDark" valign="top">48246030</td>
</
tr>

<
tr>
  <
th class="baseColorHeader" valign="top">contact_person&nbsp;</th>

    <
td class="baseColorDark" valign="top">Finn Rasmussen&nbsp;</td>
</
tr>

<
tr>
  <
th class="baseColorHeader" valign="top">company_name&nbsp;</th>

    <
td class="baseColorDark" valign="top">HvepseEksperten.dk ApS&nbsp;</td>
</
tr>

<
tr>
  <
th class="baseColorHeader" valign="top">address&nbsp;</th>

    <
td class="baseColorDark" valign="top">Kongens Vænge 79&nbsp;</td>
</
tr>

<
tr>
  <
th class="baseColorHeader" valign="top">city&nbsp;</th>

    <
td class="baseColorDark" valign="top">3400&amp;nbsp;Hillerød&nbsp;</td>
</
tr>

<
tr>
  <
th class="baseColorHeader" valign="top">country&nbsp;</th>

    <
td class="baseColorDark" valign="top">Denmark&nbsp;</td>
</
tr>

</
tr>

<
tr>
<
tr>
  <
th class="baseColorHeader" valign="top">private_phone&nbsp;</th>

    <
td class="baseColorDark" valign="top">48246030</td>
</
tr>

<
tr>
  <
th class="baseColorHeader" valign="top">contact_person&nbsp;</th>

    <
td class="baseColorDark" valign="top">Finn Rasmussen&nbsp;</td>
</
tr>

<
tr>
  <
th class="baseColorHeader" valign="top">company_name&nbsp;</th>

    <
td class="baseColorDark" valign="top">HvepseEksperten.dk ApS&nbsp;</td>
</
tr>

<
tr>
  <
th class="baseColorHeader" valign="top">address&nbsp;</th>

    <
td class="baseColorDark" valign="top">Kongens Vænge 79&nbsp;</td>
</
tr>

<
tr>
  <
th class="baseColorHeader" valign="top">city&nbsp;</th>

    <
td class="baseColorDark" valign="top">3400&amp;nbsp;Hillerød&nbsp;</td>
</
tr>

<
tr>
  <
th class="baseColorHeader" valign="top">country&nbsp;</th>

    <
td class="baseColorDark" valign="top">Denmark&nbsp;</td>
</
tr>

</
tr>

</
table>

?>

Class methods

Her er 'klasse metoderne' for ViewDetail klassen:

  • viewdetail
  • newcontent
  • gethtml
  • display
  • viewsimple
  • newheader
  • newcolumn
  • newrow
  • object
  • getclassname
  • getmsg
  • addhtml
  • tostring
  • getcachefilename
  • save
  • content
  • stop
  • html
  • setobject
  • set
  • get
  • getattribute
  • gettag
  • add
  • getsizeof
  • getelement
  • getelements
  • gettoogle
  • getmaximize
  • getminimize
  • newtriangle
  • showsource
  • table
  • newtextrow
  • gettableheader
  • getstart
  • getend
  • start
  • end
  • viewcommon
  • newhiddens
  • newbuttons
  • newelement

Object vars

Her er 'objekt variable' for ViewDetail klassen:

  • html =>
  • sql =>
  • elements => Array
  • sizeof => 2
  • text =>
  • width => 100%
  • class => tableListView baseBorder
  • border => 0
  • cellpadding => 2
  • cellspacing => 0
  • summary =>
  • caption =>
  • datareader => Object
  • id =>
  • subtotal =>

DataReader.php

Her er felterne i DataReader for ViewDetail klassen:

  0   














ViewDetail

Vis denne side på danmark

Vis denne side på Germany

Vis denne side på England

Vis denne side på France

Vis denne side på Italy

Vis denne side på Norge

Vis denne side på Sverige

Vis denne side på USA


 
ViewDetail
ViewDetail
ViewDetail