/**
  * 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;
 }
 /**
  * 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();
 }
 /**
  * @param ConferenceContext $context
  * @param ResourceFactory $factory
  * @param bool $reflect
  * @param int $id
  *
  * @return Div
  */
 protected function renderResource(ConferenceContext $context, ResourceFactory $factory, $reflect = false, $id = 0)
 {
     return new Div([], [new Card([], [new CardHeader([], [Std::coalesce($factory->getPrefix(), '/'), ' ', new Italic(['class' => ['fa', 'fa-arrow-circle-right ']]), ' ', new Anchor(['href' => $context->method('illuminated.conference.application', 'single', ['resource' => $id])], new Bold([], $factory->getController()))]), new CardBlock([], [new Paragraph([], [new Bold([], 'Middleware: '), implode(', ', $factory->getMiddleware())]), new Div([], Std::map(function (ResourceMethod $method) use($factory, $reflect) {
         return $this->renderRoute($factory, $method, $reflect);
     }, $factory->getMethods()))])])]);
 }
 /**
  * @return string
  */
 protected function getRedirectUrl()
 {
     return $this->context->lastUrl();
 }
Example #5
0
 /**
  * Render the sidebar for this module.
  *
  * If null is returned, we won't display one.
  *
  * @param ConferenceContext $context
  *
  * @return SafeHtmlWrapper
  */
 public function renderSidebar(ConferenceContext $context)
 {
     return Html::safe((new UnorderedList(['class' => 'nav nav-pills nav-stacked'], Std::map(function (Method $method, $methodName) use($context) {
         return new ListItem(['class' => 'nav-item'], [new Anchor(['href' => $context->method($this->getName(), $methodName), 'class' => 'nav-link'], Std::coalesce($method->getLabel(), $methodName))]);
     }, Std::filter(function (Method $method) {
         return !$method->isHidden();
     }, $this->getMethods()))))->render());
 }
 public function getReference(HandlerResolverInterface $resolver, ConferenceContext $context)
 {
     return new Card([], [new CardHeader([], 'Task Reference'), new SimpleTable(['Task', 'Description'], Std::map(function ($taskName) use($resolver, $context) {
         $instance = $resolver->instantiate($taskName);
         return [new Anchor(['href' => $context->method('illuminated.jobs', 'reference.single', ['id' => $taskName])], $taskName), $instance->getDescription()];
     }, $resolver->getAvailableTasks()))]);
 }
 /**
  * Render the launch bar.
  *
  * @param DashboardInterface $dashboard
  * @param ConferenceContext $context
  *
  * @return Div
  */
 protected function renderLaunchpad(DashboardInterface $dashboard, ConferenceContext $context)
 {
     return new Div(['class' => 'card-columns'], [new Div(['class' => 'card-stack'], Std::map(function (Module $module) use($context) {
         return new Div(['class' => 'card'], [new Div(['class' => 'card-block'], [new Anchor(['href' => $context->module($module->getName())], [new HeaderFour(['class' => 'card-title'], [$module->getLabel(), new Italic(['class' => 'pull-right fa ' . $module->getIcon()])])]), new Paragraph(['class' => 'card-text'], $module->getDescription()), new Paragraph(['class' => 'card-text'], new Small(['class' => 'text-muted'], [$module->getName()]))])]);
     }, $dashboard->getModules()))]);
 }