Top  Branding  Banner 
blank.gif
blank.gif
triangle.gif Du er her: /  Forsiden  /  Kildekoden  /  Layout  /  Locator   Logoff nu   Logoff : xxx
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

Locator.php


Vis: Sample code, tutorial

Locator, Sample code, tutorial

Sådan benyttes komponenten Locator klassen

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

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

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

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

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

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

Skjul: Sådan vises komponenten

Locator, Sådan vises komponenten

Sådan vises komponenten Locator klassen

triangle.gif Du er her: /  Forsiden  /  Kildekoden  /  Layout  /  Locator   Logoff nu   Logoff : xxx

Vis: PHP source code

Locator, PHP source code

Den fulde PHP kildekode for Locator klassen

<?php
/**
 * @package layout
 * @see HTML_LAYOUT_PAGE_PATH.'/Locator.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.'/TableDataReader.php');
if (
defined('HTML_BASE_UTIL_PATH')) {
    require_once(
HTML_BASE_UTIL_PATH.'/Div.php');
}
if (
defined('HTML_LANGUAGE_UTIL_PATH')) {
    require_once(
HTML_LANGUAGE_UTIL_PATH.'/Translate.php');
}

/**
 * Display the navigation path
 * <code>
 * Usage:
 *   $rows = array(
 *     array(
 *         KEY_LINK=>LINK_COPYRIGHT,
 *         KEY_POWERED=>LINK_POWERED_BY,
 *         KEY_VERSION=>CURRENT_VERSION,
 *     ),
 *   );
 *   $header  = ''; // The header meta data
 *   $default = ''; // The default meta data array
 *   $limit   = ''; // The limit to use for the array
 *   $sort    = true;
 *   $datareader = DataReaderFactory::newDataReader($rows, $header, $default, $limit, $sort);
 *   $locator = new Locator($datareader, $text, $width, $class, $border,
 *                          $cellpadding, $cellspacing, $summary, $caption, $layout);
 *   print $locator->getHtml();
 * Or
 *   Locator::display($datareader, $text, $width, $class, $border,
 *                    $cellpadding, $cellspacing, $summary, $caption, $layout);
 * </code>
 * @package layout
 */

class Locator extends TableDataReader {
    
/**
     * 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 Cell Padding
     * @param String $cellspacing The Cell Spacing
     * @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   ''
        
$theWidth  $width  != '' $width  LOCATOR_VIEW_WIDTH
        
$theClass  $class  != '' $class  LOCATOR_VIEW_CLASS
        
$theBorder $border != '' $border LOCATOR_VIEW_BORDER
        
$theCellPadding $cellpadding != '' $cellpadding LOCATOR_VIEW_CELLPADDING
        
$theCellSpacing $cellspacing != '' $cellspacing LOCATOR_VIEW_CELLSPACING;
        
$theLayout      $layout != '' $layout LOCATOR_VIEW_LAYOUT;
        
$theDatareader  $datareader
        if (
$theDatareader == '') {
            
$theDatareader $this->getDirs();
        }
        
parent::__construct($theDatareader$theText$theWidth$theClass$theBorder$theCellPadding$theCellSpacing$summary$caption$theLayout);
    }

    
/**
     * Get a dirview of the Disk
     * <code>
     * The path info looks like i.e. /dir1/dir2/dir3/file.php
     * $url[0] is empty, 
     * $url[1]..$url[3] is the dir path 
     * $url[4] is the filename
     * </code>
     * @return array The array of dir links
     */
    
function getDirs() {
        
$dirs  = array();
        
$url   explode('/'LINK_TEXT_HOME.$_SERVER['PHP_SELF']);
        
$count count($url)-1// Skip filename
        
$root  '';
        for (
$i 0$i $count$i++) {
            if (
$i==0) {
                
$dash  TEXT_LOCATOR.": /&nbsp;";
            } else {
                
$root .= '/'.$url[$i]; // Next dir
                
$dash  "&nbsp;/&nbsp;"// &nbsp;&#187; OR &raquo;
            
}
            if (
defined('HTML_LANGUAGE_UTIL_PATH')) {
                
$text  ucfirst(Translate::get($url[$i]));
            } else {
                
$text  ucfirst($url[$i]);
            }
            
//$text  = str_replace('-',"&#187;", $text); // In order to avoid line breaks
            
$dash  str_replace(' ',"&nbsp;"$dash); // In order to avoid line breaks
            
$href  $root.'/';
            
$title LINK_TITLE_VISIT_US.$text;
            
$dirs[] = array(KEY_PLAIN=>$dash,'class'=>CSS_LOCATOR);
            
$dirs[] = array('text'=>$text,'href'=>$href,'class'=>CSS_LOCATOR,'title'=>$title);
        }
        
$dirs[] = array(KEY_PLAIN=>'&nbsp;','class'=>CSS_LOCATOR.' '.CSS_FILL_OUT);
        
$dirs[] = $this->getLoginImage();
        
$dirs[] = array(KEY_PLAIN=>'&nbsp;','class'=>CSS_LOCATOR);
        
$dirs[] = $this->getLoginLink();
        return 
$dirs;
    }

    
/**
     * Get the Login Image if supplied
     * @return String The login name
     */
    
function getLoginImage() {
        
$dirs = array();
        if (
defined('LOGIN_REQUIRED') && LOGIN_REQUIRED) {
            
// Login/Logoff required
            
if (defined('LOGIN_USERNAME')) {
                
$text "";
                
$href "";
                
$name IMAGE_LOGIN;
                
$image = new Images($name''''''CSS_LOCATOR);
                
$link  = new Links (LINK_LOGIN$text$hrefCSS_LOCATOR);
                if (
defined('LOGIN_USERNAME') && LOGIN_USERNAME !== @DEFAULT_LOGIN_USERNAME) {
                    
$name IMAGE_LOGOFF;
                    
$image = new Images($name''''''CSS_LOCATOR);
                    
$link  = new Links(LINK_LOGOFF$text$hrefCSS_LOCATOR);
                } else {
                    
// Not logged in
                
}
                
$src '';
                
$dirs = array('href'=>$link->get('href'),'class'=>$link->get('class'),'title'=>$link->get('title'),
                      
'src'=>$image->getSrc($src$name),'width'=>$image->get('width'),'height'=>$image->get('height'),'alt'=>$image->get('alt'));
             }
        } else {
            
// Login not required
        
}
        return 
$dirs;
    }

    
/**
     * Get the Login Link if supplied
     * @return String The login name
     */
    
function getLoginLink() {
        
$dirs = array();
        if (
defined('LOGIN_REQUIRED') && LOGIN_REQUIRED) {
            
// Login/Logoff required
            
if (defined('LOGIN_USERNAME')) {
                
$text "";
                
$href "";
                
$link  = new Links(LINK_LOGIN$text$hrefCSS_LOCATOR);
                if (
defined('LOGIN_USERNAME') && LOGIN_USERNAME !== @DEFAULT_LOGIN_USERNAME) {
                    
$link  = new Links(LINK_LOGOFF$text$hrefCSS_LOCATOR);
                } else {
                    
// Not logged in
                
}
                
$dirs = array('text'=>$link->get('text'),'href'=>$link->get('href'),'class'=>$link->get('class'),'title'=>$link->get('title'));
             }
        } else {
            
// Login not required
        
}
        return 
$dirs;
    }

    
/**
     * Get the CSS class Name for this component
     * @return String The CSS class name
     */
    
function getCssClass() {
        return 
CSS_LOCATOR;
    }

    
/**
     * Toogle the request parameters which will minimize or maximize this component
     * @return array The array of key=>value pair
     */
    
function getMinimize() {
        return 
$this->getToogle(REQUEST_LAYOUT_SHOWLAYOUT_SHOWLAYOUT_SHOW_LOCATOR);
    }

    
/**
     * Get the html, and return it for a location
     * @return String The html
     */
    
function getHtml() {
        
$html  $this->html;
        if (
LAYOUT_SHOW LAYOUT_SHOW_LOCATOR && HTTP_USER_AGENT!=HTTP_USER_AGENT_P900) {
            if (
defined('CREATE_RUNTIME_KERNEL') && CREATE_RUNTIME_KERNEL) {
                
$html .= '<?php'.ucfirst($this->getClassName()).'::display()?>';
            } else {
                if (
defined('LOGIN_USERNAME') && LOGIN_USERNAME === '' && CACHE_LAYOUT && $this->getCacheFileName(CACHE_LAYOUT_PATH) != '' && file_exists($this->getCacheFileName(CACHE_LAYOUT_PATH))) {
                    
$html .= $this->content($this->getCacheFileName(CACHE_LAYOUT_PATH));
                } else {
                    
$html .= $this->getColumns();
                    if (
CACHE_LAYOUT && defined('LOGIN_USERNAME') && LOGIN_USERNAME === '') {
                        
$this->save($htmlCACHE_LAYOUT_PATH);
                    }
                }
            }
        } else {
               
$html .= $this->getMaximize();
        }
        return 
$html;
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Locator::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, default 100%
     * @param String $class   The css class to use
     * @param String $border  The table border
     * @param String $cellpadding The Cell Padding
     * @param String $cellspacing The Cell Spacing
     * @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 Locator($datareader$text$width$class$border$cellpadding$cellspacing$summary$caption$layout);
        
$html->addHtml();
    }
}
?>

Vis: HTML source code

Locator, HTML source code

Den fulde HTML kildekode for Locator klassen

<?
<!-- DEBUGLocator -->

<
table id="LocatorId" width="100%" class="tableBorderLeft tableBorderRight basePrinter" border="0" cellpadding="0" cellspacing="0">
 <
tr>
    <
td class="layoutLocator baseOnepc" valign="top"><!-- DEBUGLink -->
<
class="layoutLocator" href="?layoutLAYOUT_SHOW=641" title="Klik her for at Minimere ...  Locator"><!-- DEBUGImages -->
<
img src="http://myrer.info/images/triangle.gif" width="10" height="10" alt="triangle.gif" class="layoutLocator" />
</
a>
</
td>

    <
td class="layoutLocator" valign="top">Du&nbsp;er&nbsp;her:&nbsp;/&nbsp;
</
td>

    <
td class="layoutLocator" valign="top"><!-- DEBUGLink -->
<!-- 
Forsiden --><class="layoutLocator" href="/" title="Bes&oslash;g vores hjemmeside: Forsiden">Forsiden</a>
</
td>

    <
td class="layoutLocator" valign="top">&nbsp;/&nbsp;
</
td>

    <
td class="layoutLocator" valign="top"><!-- DEBUGLink -->
<!-- 
Kildekoden --><class="layoutLocator" href="/source-code/" title="Bes&oslash;g vores hjemmeside: Kildekoden">Kildekoden</a>
</
td>

    <
td class="layoutLocator" valign="top">&nbsp;/&nbsp;
</
td>

    <
td class="layoutLocator" valign="top"><!-- DEBUGLink -->
<!-- 
Layout --><class="layoutLocator" href="/source-code/layout/" title="Bes&oslash;g vores hjemmeside: Layout">Layout</a>
</
td>

    <
td class="layoutLocator" valign="top">&nbsp;/&nbsp;
</
td>

    <
td class="layoutLocator" valign="top"><!-- DEBUGLink -->
<!-- 
Locator --><class="layoutLocator" href="/source-code/layout/Locator/" title="Bes&oslash;g vores hjemmeside: Locator">Locator</a>
</
td>

    <
td class="layoutLocator baseFillOut" valign="top">&nbsp;
</
td>

    <
td class="layoutLocator" valign="top"><!-- DEBUGLink -->
<
class="layoutLocator" href="?baseCOMMAND=3658c8b6000fa4bb49f881e093187d3c" title="Logoff nu"><!-- DEBUGImage -->
<
img src="http://myrer.info/images/logoff.gif" width="13" height="13" alt="Logoff nu" class="layoutLocator" />
</
a>
</
td>

    <
td class="layoutLocator" valign="top">&nbsp;
</
td>

    <
td class="layoutLocator" valign="top"><!-- DEBUGLink -->
<!-- 
Logoff&nbsp;:&nbsp;xxx --><class="layoutLocator" href="?baseCOMMAND=3658c8b6000fa4bb49f881e093187d3c" title="Logoff nu">Logoff&nbsp;:&nbsp;xxx</a>
</
td>

 </
tr>

</
table>

?>

Vis: Class methods

Locator, Class methods

Her er 'klasse metoderne' for Locator klassen:

  • __construct
  • getDirs
  • getLoginImage
  • getLoginLink
  • getCssClass
  • getMinimize
  • getHtml
  • display
  • newData
  • 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
  • newTriangle
  • getStartHtml
  • getEndHtml
  • showsource
  • getClassName
  • getMsg
  • addHtml
  • __toString
  • getCacheFileName
  • save
  • content

Vis: Object vars

Locator, Object vars

Her er 'objekt variable' for Locator 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