/** * @see \str\pathToType() pathToType */ public static function pathToType($string_) { return \str\pathToType($string_); }
/** * @return \Components\Ui_Panel[] */ protected function dispatchImpl() { $isHtml = $this->response->getMimetype()->isHtml(); $params = $this->request->getParams(); $path = $params->get('ui-panel-path'); if ($scope = $params->get('ui-panel-scope')) { session_name($scope); } if (!(self::$transactionId = $params->get('ui-panel-tx'))) { self::$transactionId = \math\random_sha1_weak(); } self::$submittedPanelId = $params->get('ui-panel-submitted'); // static callback if ($params->containsKey('ui-panel-callback')) { $callback = $params->get('ui-panel-callback'); if (false !== ($pos = strpos($callback, '::'))) { $type = substr($callback, 0, $pos); $method = substr($callback, $pos + 2); // TODO [CSH] Runtime_Classloader::lookupClass(class/name). if (class_exists($type) && method_exists($type, $method)) { return $type::$method($this->request, $this->response); } } } if (null === $path) { throw new Http_Exception('ui/scriptlet', null, Http_Exception::NOT_FOUND); } // embedded mode $path = json_decode($path); $i = 0; $panels = []; foreach ($path as $name => $type) { $type = \str\pathToType($type); if (0 === $i) { $this->panel = $panels[$i] = new $type($name); $this->panel->scriptlet = $this; } else { if (isset($panels[$i - 1]->{$name})) { $panels[$i] = $panels[$i - 1]->{$name}; } else { $panels[$i - 1]->add($panels[$i] = new $type($name)); } } $i++; } $panels = []; foreach ($this->panel->redrawPanels() as $panel) { $panels[$panel->id()] = $panel->fetch(); } return json_encode(['p' => $panels]); }