Support Joomla!
Main
News
Help
Forum
Extensions
Shop
Developers
Joomla! 1.5 Documentation
Home
API reference wiki
Browse SVN repository
Packages
Select a package...
Unknown
Cache_Lite
com-tecnick-tcpdf
core
Joomla-Framework
OpenID
patError
patTemplate
PEAR
phpGACL
PHPMailer
PHP_Compat
utf8
Yadis
Package: Joomla-Framework
Other documents
Changelog
To do
To do (2)
Element index (all)
Error log
Install
Copyright
License
Developer Network License
The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the
Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /joomla/application/pathway.php
Documentation is available at
pathway.php
<?php
/**
*
@version
$Id: pathway.php 6472 2007-02-03 10:47:26Z pasamio $
*
@package
Joomla.Framework
*
@subpackage
Application
*
@copyright
Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
*
@license
GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// Check to ensure this file is within the rest of the framework
defined
(
'JPATH_BASE'
)
or
die
(
)
;
jimport
(
'joomla.filter.output'
)
;
/**
* Class to maintain a pathway.
*
* Main example of use so far is the mod_breadcrumbs module that keeps track of
* the user's navigated path within the Joomla application.
*
*
@author
Louis Landry <
[email protected]
>
*
@package
Joomla.Framework
*
@subpackage
Application
*
@since
1.5
*/
class
JPathWay
extends
JObject
{
/**
* Array to hold the pathway item objects
*
@access
private
*/
var
$_pathway
=
null
;
/**
* Integer number of items in the pathway
*
@access
private
*/
var
$_count
=
0
;
/**
* Class constructor
*/
function
__construct
(
)
{
}
/**
* Return the JPathWay items array
*
*
@access
public
*
@param
boolean
$showHome
True to show the home element of the JPathWay array
*
@param
boolean
$showComponent
True to show the component element of the JPathWay array
*
@return
array
Array of pathway items
*
@since
1.5
*/
function
getPathWay
(
$showHome
=
true
,
$showComponent
=
true
)
{
$pw
=
$this
->
_pathway
;
if
(
$showComponent
==
false
)
{
unset
(
$pw
[
1
]
)
;
}
if
(
$showHome
==
false
)
{
unset
(
$pw
[
0
]
)
;
}
// Use array_values to reset the array keys numerically
return
array_values
(
$pw
)
;
}
/**
* Create and return an array of the pathway names.
*
*
@access
public
*
@param
boolean
$showHome
True to show the home element of the JPathWay array
*
@param
boolean
$showComponent
True to show the component element of the JPathWay array
*
@return
array
Array of names of pathway items
*
@since
1.5
*/
function
getPathWayNames
(
$showHome
=
true
,
$showComponent
=
true
)
{
// Initialize variables
$names
=
array
(
null
)
;
// Build the names array using just the names of each pathway item
foreach
(
$this
->
_pathway
as
$item
)
{
$names
[
]
=
$item
->
name
;
}
if
(
$showComponent
==
false
)
{
unset
(
$names
[
1
]
)
;
}
if
(
$showHome
==
false
)
{
unset
(
$names
[
0
]
)
;
}
//Use array_values to reset the array keys numerically
return
array_values
(
$names
)
;
}
/**
* Create and add an item to the pathway.
*
*
@access
public
*
@param
string
$name
*
@param
string
$link
*
@return
boolean
True on success
*
@since
1.5
*/
function
addItem
(
$name
,
$link
=
''
)
{
// Initalize variables
$ret
=
false
;
if
(
$this
->
_pathway
[
]
=
$this
->
_makeItem
(
$name
,
$link
))
{
$ret
=
true
;
$this
->
_count
++
;
}
return
$ret
;
}
/**
* Set item name.
*
*
@access
public
*
@param
integer
$id
*
@param
string
$name
*
@return
boolean
True on success
*
@since
1.5
*/
function
setItemName
(
$id
,
$name
)
{
// Initalize variables
$ret
=
false
;
if
(
isset
(
$this
->
_pathway
[
$id
]
))
{
$this
->
_pathway
[
$id
]
->
name
=
$name
;
$ret
=
true
;
}
return
$ret
;
}
/**
* Create and return a new pathway object.
*
*
@access
private
*
@param
string
$name
Name of the item
*
@param
string
$link
Link to the item
*
@return
object
Pathway
item object
*
@since
1.5
*/
function
_makeItem
(
$name
,
$link
)
{
$item
=
new
stdClass
(
)
;
$item
->
name
=
JOutputFilter
::
ampReplace
(
html_entity_decode
(
$name
))
;
$item
->
link
=
$link
;
return
$item
;
}
}
?>
Documentation generated on Mon, 05 Mar 2007 21:13:55 +0000 by
phpDocumentor 1.3.1