Locator
Locator Du er her: /  Forsiden  /  Kildekoden  /  Layout  /  Locator   Logoff nu   Logoff
Locator
 ««« Se kilde koden
Locator
Locator Basic Locator Locator Base Locator Locator Component Locator Locator Db Locator Locator Dto Locator Locator Form Locator Locator Form-elements Locator Locator Jquery Locator Locator Layout  Locator Locator Menu Locator Locator Menu-fisheye Locator Locator Mvc Locator Locator Tab Locator Locator Table Locator Locator Template Locator Locator Util Locator
Locator
Locator
Locator Index
 
Tilbage

Navn : Locator.php


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();
    ?>

Parent html

Sådan vises komponenten Locator klassen

Locator Du er her: /  Forsiden  /  Kildekoden  /  Layout  /  Locator   Logoff nu   Logoff

PHP source code

Den fulde PHP kildekode for Locator klassen

<?
/**
* @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.10
* @since 22-feb-2007
*/

/**
* 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,
*     ),
*   );
*   $datareader = DataReaderFactory::newDataReader($rows);
*   $locator = new Locator($datareader,$text,$width,$class,$border,$cellPadding,$cellSpacing);
*   print $locator->getHtml();
* Or
*   Locator::display($datareader,$text,$width,$class,$border,$cellPadding,$cellSpacing);
* </code>
* @package layout
*/

class Locator extends TableDataReader {
    
/**
     * Constructor
     * @param DataReader $datareader The Data Reader object
     * @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
     * @param String $cellSpacing
     */
    
function Locator($datareader='',$text='',$width='',$class='',$border='',$cellPadding='',$cellSpacing='') {
        
$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;
        
$theDatareader = $datareader;
        if (
$theDatareader == '') {
            
$theDatareader = $this->getDirs();
        }
        
$this->layout = LINK_LAYOUT_TRIANGLE;
        
$this->TableDataReader($theDatareader,$theText,$theWidth,$theClass,$theBorder,$theCellPadding,$theCellSpacing);
    }

    
/**
     * 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;
            
}
            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')) {
                
$image = new Images(IMAGE_LOGIN,'','','',CSS_LOCATOR);
                
$link  = new Links (LINK_LOGIN,'',CSS_LOCATOR);
               if (
defined('LOGIN_USERNAME') && LOGIN_USERNAME!=DEFAULT_LOGIN_USERNAME) {
                    
$image = new Images(IMAGE_LOGOFF,'','','',CSS_LOCATOR);
                    
$link  = new Links (LINK_LOGOFF,'',CSS_LOCATOR);
                } else {
                    
// Not logged in
                
}
                
$dirs = array('href'=>$link->get('href'),'class'=>$link->get('class'),'title'=>$link->get('title'),
                      
'src'=>$image->getSrcName(),'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')) {
                
$link  = new Links(LINK_LOGIN,'',CSS_LOCATOR);
               if (
defined('LOGIN_USERNAME') && LOGIN_USERNAME!=DEFAULT_LOGIN_USERNAME) {
                    
$link  = new Links(LINK_LOGOFF,'',CSS_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_SHOW, LAYOUT_SHOW, LAYOUT_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 .= '<?'.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($html, CACHE_LAYOUT_PATH);
                    }
                }
            }
        } else {
               
$html .= $this->getMaximize();
        }
        return
$html;
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Locator::display($width,$class);
     * </code>
     * @static
     * @param String $width The width of the table
     * @param String $class The css class of the table
     */
    
function display($width='',$class='') {
        
$html = new Locator($width,$class);
        
$html->addHtml();
    }
}
?>

HTML source code

Den fulde HTML kildekode for Locator klassen

<?

<table width="100%" class="tableBorderLeft tableBorderRight basePrinter" border="0" cellpadding="0" cellspacing="0">
<
tr>
    <
td class="layoutLocator baseOnepc" valign="middle"><img src="/images/triangle.gif" width="10" height="10" alt="Locator" class="layoutLocator" />
</
td>
    <
td class="layoutLocator" valign="middle">Du&nbsp;er&nbsp;her:&nbsp;/&nbsp;</td>
    <
td class="layoutLocator" valign="middle"><!-- Forsiden --><a id="Link44" class="layoutLocator" href="/" title="Bes&oslash;g vores hjemmeside: Forsiden">Forsiden</a>
</
td>
    <
td class="layoutLocator" valign="middle">&nbsp;/&nbsp;</td>
    <
td class="layoutLocator" valign="middle"><!-- Kildekoden --><a id="Link45" class="layoutLocator" href="/source-code/" title="Bes&oslash;g vores hjemmeside: Kildekoden">Kildekoden</a>
</
td>
    <
td class="layoutLocator" valign="middle">&nbsp;/&nbsp;</td>
    <
td class="layoutLocator" valign="middle"><!-- Layout --><a id="Link46" class="layoutLocator" href="/source-code/layout/" title="Bes&oslash;g vores hjemmeside: Layout">Layout</a>
</
td>
    <
td class="layoutLocator" valign="middle">&nbsp;/&nbsp;</td>
    <
td class="layoutLocator" valign="middle"><!-- Locator --><a id="Link47" class="layoutLocator" href="/source-code/layout/Locator/" title="Bes&oslash;g vores hjemmeside: Locator">Locator</a>
</
td>
    <
td class="layoutLocator baseFillOut" valign="middle">&nbsp;</td>
    <
td class="layoutLocator" valign="middle"><a id="Link48" class="layoutLocator" href="/Login/?baseCOMMAND=3658c8b6000fa4bb49f881e093187d3c" title="Logoff nu"><img src="/images/logoff.gif" width="13" height="13" alt="Logoff nu" class="layoutLocator" />
</
a>
</
td>
    <
td class="layoutLocator" valign="middle">&nbsp;</td>
    <
td class="layoutLocator" valign="middle"><!-- Logoff --><a id="Link49" class="layoutLocator" href="/Login/?baseCOMMAND=3658c8b6000fa4bb49f881e093187d3c" title="Logoff nu">Logoff</a>
</
td>
</
tr>

<
tr>
    <
td class="layoutLocator baseOnepc" valign="middle"><img src="/images/triangle.gif" width="10" height="10" alt="Locator" class="layoutLocator" />
</
td>
    <
td class="layoutLocator" valign="middle">Du&nbsp;er&nbsp;her:&nbsp;/&nbsp;</td>
    <
td class="layoutLocator" valign="middle"><!-- Forsiden --><a id="Link50" class="layoutLocator" href="/" title="Bes&oslash;g vores hjemmeside: Forsiden">Forsiden</a>
</
td>
    <
td class="layoutLocator" valign="middle">&nbsp;/&nbsp;</td>
    <
td class="layoutLocator" valign="middle"><!-- Kildekoden --><a id="Link51" class="layoutLocator" href="/source-code/" title="Bes&oslash;g vores hjemmeside: Kildekoden">Kildekoden</a>
</
td>
    <
td class="layoutLocator" valign="middle">&nbsp;/&nbsp;</td>
    <
td class="layoutLocator" valign="middle"><!-- Layout --><a id="Link52" class="layoutLocator" href="/source-code/layout/" title="Bes&oslash;g vores hjemmeside: Layout">Layout</a>
</
td>
    <
td class="layoutLocator" valign="middle">&nbsp;/&nbsp;</td>
    <
td class="layoutLocator" valign="middle"><!-- Locator --><a id="Link53" class="layoutLocator" href="/source-code/layout/Locator/" title="Bes&oslash;g vores hjemmeside: Locator">Locator</a>
</
td>
    <
td class="layoutLocator baseFillOut" valign="middle">&nbsp;</td>
    <
td class="layoutLocator" valign="middle"><a id="Link54" class="layoutLocator" href="/Login/?baseCOMMAND=3658c8b6000fa4bb49f881e093187d3c" title="Logoff nu"><img src="/images/logoff.gif" width="13" height="13" alt="Logoff nu" class="layoutLocator" />
</
a>
</
td>
    <
td class="layoutLocator" valign="middle">&nbsp;</td>
    <
td class="layoutLocator" valign="middle"><!-- Logoff --><a id="Link55" class="layoutLocator" href="/Login/?baseCOMMAND=3658c8b6000fa4bb49f881e093187d3c" title="Logoff nu">Logoff</a>
</
td>
</
tr>

</
table>

?>

Class methods

Her er 'klasse metoderne' for Locator klassen:

  • object
  • getclassname
  • getmsg
  • addhtml
  • gethtml
  • tostring
  • getcachefilename
  • save
  • content
  • stop
  • html
  • setobject
  • set
  • get
  • getattribute
  • gettag
  • add
  • getsizeof
  • getelement
  • getelements
  • gettoogle
  • getmaximize
  • getminimize
  • newtriangle
  • display
  • showsource
  • table
  • newtextrow
  • gettableheader
  • getstart
  • getend
  • start
  • end
  • tabledatareader
  • getdatareader
  • newdata
  • getcssclass
  • newcolumn
  • isactive
  • isactivetab
  • isactiveindex
  • newcolumns
  • adjustcolumns
  • newcorner
  • getcolumns
  • locator
  • getdirs
  • getloginimage
  • getloginlink

Object vars

Her er 'objekt variable' for Locator klassen:

  • html =>
  • sql =>
  • elements => Array
  • sizeof => 2
  • text =>
  • width => 100%
  • class => tableBorderLeft tableBorderRight basePrinter
  • border => 0
  • cellpadding => 0
  • cellspacing => 0
  • summary =>
  • caption =>
  • datareader => Object
  • layout => 8

DataReader.php

Her er felterne i DataReader for Locator klassen:

  0   


  1   




  2   








  3   




  4   








  5   




  6   








  7   




  8   








  9   




  10   














  11   




  12   








Locator

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


 
Locator