Ferreteria/v2/class/fcDynamicLink: Difference between revisions

From Woozle Writes Code
< Ferreteria‎ | v2‎ | class
Jump to navigation Jump to search
(Created page with "{{page/code/class}} <source lang=php> →‎:::: PURPOSE: selectable link that isn't dropin-specific ABSTRACT: n/i = GetLinkURL(): abstract class fcDynamicLink extends fcLin...")
 
No edit summary
Line 1: Line 1:
{{page/code/class}}
{{page/code/class}}
* '''file''': {{l/ferreteria/file|menu/items.php}}
* '''extends''': {{l/version|class|fcLink_fromArray}}
* '''extender''': {{l/version|class|fcToggleLink}}
<source lang=php>
<source lang=php>
/*::::
/*::::
Line 31: Line 34:
}
}
</source>
</source>
* '''file''': {{l/ferreteria/file|menu/items.php}}
* '''extends''': {{l/version|class|fcLink_fromArray}}
* '''extender''': {{l/version|class|fcToggleLink}}

Revision as of 17:09, 19 January 2019

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 -- //

}