Exemple #1
0
 /**
  * @param string $name
  * @return string
  */
 public function getPresenterClass(&$name)
 {
     $mapping = $this->mapping;
     $presenter = $name;
     while ($presenter) {
         if (isset($this->mapping[$presenter])) {
             $module = substr($presenter, 0, strpos($presenter, ':'));
             $mapping = array($module => $this->mapping[$presenter]);
             break;
         }
         $presenter = substr($presenter, 0, strrpos($presenter, ':'));
     }
     $this->resetMappingToPresenterFactory();
     $this->presenterFactory->setMapping($mapping);
     return $this->presenterFactory->getPresenterClass($name);
 }
 public function createXTestingDataGrid()
 {
     $presenterFactory = new Nette\Application\PresenterFactory();
     $presenterFactory->setMapping(['*' => 'Ublaboo\\DataGrid\\Tests\\Files\\*Presenter']);
     $presenter = $presenterFactory->createPresenter('XTesting');
     $url = new Http\UrlScript('localhost');
     $request = new Http\Request($url);
     $response = new Http\Response();
     $session = new Http\Session($request, $response);
     $presenter->injectPrimary(NULL, NULL, NULL, $request, $response, $session);
     return new DataGrid($presenter, 'XTestingGrid');
 }
 public function setMapping($module, $mapping)
 {
     $this->presenterFactory->setMapping([$module => $mapping]);
 }