[Chameleon-dev] [Bug 1127] New: Missing Method in AppContext::
getContextName()
bugzilla-daemon at bugzilla.maptools.org
bugzilla-daemon at bugzilla.maptools.org
Fri Aug 19 05:54:49 EDT 2005
http://bugzilla.maptools.org/show_bug.cgi?id=1127
Summary: Missing Method in AppContext:: getContextName()
Product: Chameleon
Version: 2.2
Platform: PC
OS/Version: Windows 2000
Status: NEW
Severity: normal
Priority: P2
Component: Core
AssignedTo: chameleon-dev at lists.maptools.org
ReportedBy: uzde083 at syncera.nl
There seems to be a method missing in AppContext to retrieve the param-name of a
parameter: getContextName()
It is a neccessity if you want to walk through all contexts after retrieving the
params by using getContextParams()
Suggested code:
/**
* return the name of a context parameter from the parameter's name
* this is a method the Chameleon class was missing
*
* @param szParam the name of the parameter to query
*
* @return mixed, the string value or false if not set
*/
function getContextName( $szParam, $szDefault=false )
{
//log entry
$this->logFuncStart( LOG_VERBOSE, "getContextName( $szParam ) starting" );
$result = false;
//implementation
if ( isset($this->aContext[strtolower($szParam)]))
{
$result = $this->aContext[strtolower($szParam)]['param-name'];
$this->log( LOG_ALL, "$szParam name is $result" );
}
else
{
// Check all sub context
foreach ($this->aoContext as $oContext)
{
$result = $oContext->getContextValue( $szParam );
if ($result !== false)
break;
}
}
if ($result === false)
{
$this->error( 1, "$szParam not found. Returning default name.");
$result = $szDefault;
}
//log exit
$this->logFuncEnd( LOG_ALL, "getContextName( $szParam ) done" );
return $result;
}
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
Please do NOT reply to this email, use the link above instead to
login to bugzilla and submit your comment. Any email reply to this
address will be lost.
More information about the Chameleon-dev
mailing list