Ferreteria/v2/class/fcDynamicLink

From Woozle Writes Code
< Ferreteria‎ | v2‎ | class
Jump to navigation Jump to search

Template:Page/code/class

/*::::
  PURPOSE: selectable link that isn't dropin-specific
  ABSTRACT: n/i = GetLinkURL()
*/
abstract class fcDynamicLink extends fcLink_fromArray {

    // ++ CALCULATIONS ++ //
    
    private $isSel;
    // PUBLIC so other objects can see whether menu options are activated
    public function GetIsSelected() {
	if (empty($this->isSel)) {
	    $sKeyValue = $this->GetKeyValue();
	    $sKeyName = $this->GetKeyName();
	    $oPathIn = $this->GetKioskObject()->GetInputObject();
	    if ($sKeyValue === TRUE || is_null($sKeyValue)) {
		// if key name is TRUE or NULL, we use the presence of the value as a flag
		$this->isSel = $oPathIn->GetBool($sKeyName);
	    } else {
		$sInValue = $oPathIn->GetString($sKeyName);
		$this->isSel = ($sInValue == $sKeyValue);
	    }
	}
	return $this->isSel;
    }
    
    // -- CALCULATIONS -- //

}