/**
  * destroys singleton instance from cache
  */
 public static function resetInstance()
 {
     try {
         self::$instance = NULL;
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #2
0
 /**
  * Getter na komponentu referencovanou v sablone
  * @param string $id
  * @return Component
  * @throws Exception
  */
 public function getComponentById($id = "")
 {
     try {
         if (strlen($id) < 1) {
             throw new LBoxExceptionFront(LBoxExceptionFront::MSG_PARAM_STRING_NOTNULL, LBoxExceptionFront::CODE_BAD_PARAM);
         }
         // zvolime spravne page pro konstruktor komponenty
         if ($this instanceof LBoxPage || $this instanceof PageList) {
             $page = $this;
         } else {
             $page = $this->page;
         }
         $componentCfg = LBoxConfigManagerComponents::getInstance()->getComponentById($id);
         $className = $componentCfg->getClassName();
         $instance = new $className($componentCfg, $page);
         if (!$instance instanceof self) {
             throw new LBoxExceptionFront("Problem with component class '{$className}': " . LBoxExceptionFront::MSG_COMPONENT_BAD_TYPE, LBoxExceptionFront::CODE_COMPONENT_BAD_TYPE);
         }
         return $instance;
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #3
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;
    }
}