/**
  * Handle a module+method call.
  *
  * @param string $moduleName
  * @param string $methodName
  *
  * @return mixed
  */
 public function anyMethod($moduleName, $methodName)
 {
     $result = $this->renderDashboard($this->dashboard->run($this->request, $this->context, $moduleName, $methodName));
     $this->context->clearLastUrl();
     $this->context->setLastUrl($moduleName, $methodName, $this->request->query->all());
     return $result;
 }
示例#2
0
 /**
  * Render the object into a string.
  *
  * @return mixed
  */
 public function render()
 {
     $title = 'Illuminated';
     $dashboardUrl = $this->context->url();
     $modulesUrl = $this->context->method('illuminated.conference.front', 'modules');
     $modulesDropdown = Std::foldr(function (NavbarDropdownFactory $factory, Module $module) {
         return $factory->addOption($this->context->module($module->getName()), $module->getLabel());
     }, new NavbarDropdownFactory(), $this->dashboard->getModules())->setContent([new Italic(['class' => 'fa fa-rocket']), ' Launchpad'])->make();
     $innerPage = new Page([new Container(['class' => 'p-t p-b'], [new Navigation(['class' => 'navbar navbar-dark bg-inverse'], [new Anchor(['class' => 'navbar-brand', 'href' => $dashboardUrl], 'Illuminated'), new UnorderedList(['class' => 'nav navbar-nav'], [new ListItem(['class' => 'nav-item'], new Anchor(['href' => $dashboardUrl, 'class' => 'nav-link'], 'Home')), $modulesDropdown, new ListItem(['class' => 'nav-item'], new Anchor(['href' => $modulesUrl, 'class' => 'nav-link'], [new Italic(['class' => 'fa fa-asterisk']), ' Meta']))])])]), $this->renderContent(), new Container(['class' => 'p-t p-b'], [new Paragraph([], [new Small([], 'Keep building awesome stuff. 👍 ')])]), new Script(['src' => 'https://ajax.googleapis.com/ajax/libs/jquery/' . '2.1.4/jquery.min.js']), new Script(['src' => 'https://cdn.rawgit.com/twbs/bootstrap/v4-dev/' . 'dist/js/bootstrap.js'])], [new Meta(['charset' => 'utf-8']), new Meta(['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1']), new Meta(['http-equiv' => 'x-ua-compatible', 'content' => 'ie=edge']), new Title([], 'Illuminated - Conference'), new Link(['rel' => 'stylesheet', 'href' => 'https://maxcdn.bootstrapcdn.com/bootstrap' . '/4.0.0-alpha.2/css/bootstrap.min.css']), new Link(['rel' => 'stylesheet', 'href' => 'https://maxcdn.bootstrapcdn.com/font-awesome' . '/4.5.0/css/font-awesome.min.css']), new Link(['rel' => 'stylesheet', 'href' => $dashboardUrl . '/css/main.css'])]);
     return $innerPage->render();
 }
 /**
  * Get problematic modules.
  *
  * @param DashboardInterface $dashboard
  *
  * @return Div
  */
 public function getIssues(DashboardInterface $dashboard)
 {
     $exceptions = Std::map(function (Exception $exception, $moduleName) {
         return new Div([], [new Div(['class' => 'card card-inverted'], [new CardBlock([], [new HeaderSix(['class' => 'text-muted'], $moduleName), new Bold([], get_class($exception) . ': '), $exception->getMessage(), new Div(['class' => 'collapse p-t', 'id' => 'stack'], new PreformattedText(['class' => 'pre-scrollable'], $exception->getTraceAsString()))]), new Div(['class' => 'card-footer text-muted'], [new Row([], [new Column(['medium' => 6], [basename($exception->getFile()) . ':' . $exception->getLine()]), new Column(['medium' => 6, 'class' => 'text-xs-right'], new Button(['href' => '#', 'class' => ['btn', 'btn-sm', 'btn-primary-outline'], 'data-toggle' => 'collapse', 'data-target' => '#stack', 'aria-expanded' => 'false', 'aria-controls' => '#stack'], 'Toggle stacktrace'))])])])]);
     }, $dashboard->getFailedModules());
     return new Div([], [new Div(['class' => 'card'], [new Div(['class' => 'card-header'], 'Module issues'), new Div(['class' => 'card-block'], ['Below you will find a list of all the modules that ', 'failed to load. If one or more failed to load, it is ', 'not necessarily a bad thing. If you do not intend to ', 'use the component covered by the module, you may ', 'safely ignore it.'])]), new HorizontalLine([]), new Div([], Std::firstBias(count($dashboard->getFailedModules()) > 0, $exceptions, function () {
         return new Card(['class' => 'card card-block text-center'], ['All modules seem fine!']);
     }))]);
 }