Beispiel #1
0
 /**
  * getter na metanode
  * @param string $callname
  * return LBoxMetanode
  */
 protected function getMetanodeByCallName($callname = "")
 {
     try {
         //LBoxFirePHP::log($callname);
         if (array_key_exists($callname, $this->metanodesByCallnames) && $this->metanodesByCallnames[$callname] instanceof LBoxMetanode) {
             // dalsi instance metanodu v komponente / strance zobrazime uz jen pasivni
             $this->metanodesByCallnames[$callname]->setActive(false);
             return $this->metanodesByCallnames[$callname];
         }
         $parts = explode("_", $callname);
         if (count($parts) < 3) {
             throw new LBoxExceptionComponent("Wrong metanode callname '{$callname}'", LBoxExceptionComponent::CODE_BAD_PARAM);
         }
         $seq = (int) $parts[1];
         $type = $parts[2];
         $this->metanodesByCallnames[$callname] = LBoxMetanodeManager::getNode($type, $seq, $this);
         return $this->metanodesByCallnames[$callname];
     } catch (Exception $e) {
         throw $e;
     }
 }
Beispiel #2
0
/**
 * getter na motanodes podle predanych dat
 * @param array $data
 * @return LBoxMetanode
 */
function getMetanodeByPostData($data = array())
{
    try {
        if (count($data) < 1) {
            throw new LBoxException(LBoxException::MSG_PARAM_ARRAY_NOTNULL, LBoxException::CODE_BAD_PARAM);
        }
        // page metanode
        if ($data["caller_type"] == "page") {
            $callerConfig = LBoxConfigManagerStructure::getInstance()->getPageById($data["caller_id"]);
            $callerClassName = strlen($callerConfig->class) > 0 ? $callerConfig->class : "PageDefault";
            $caller = new $callerClassName($callerConfig);
        } else {
            $callerConfig = LBoxConfigManagerComponents::getInstance()->getComponentById($data["caller_id"]);
            $caller = new LBoxComponentMetanodeCaller($callerConfig);
        }
        $node = LBoxMetanodeManager::getNode($data["type"], (int) $data["seq"], $caller, $data["lng"]);
        return $node;
    } catch (Exception $e) {
        throw $e;
    }
}