예제 #1
0
 /**
  * Return the edit wizard.
  *
  * @param \DC_Table $dataContainer The data container.
  *
  * @param string    $table         The table name.
  *
  * @return string
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  * @SuppressWarnings(PHPMD.CamelCaseVariableName)
  */
 public function editRenderSettingButton(\DC_Table $dataContainer, $table)
 {
     if ($dataContainer->value < 1) {
         return '';
     }
     $event = new GenerateHtmlEvent('alias.gif', $GLOBALS['TL_LANG'][$table]['editrendersetting'][0], 'style="vertical-align:top"');
     $dispatcher = $this->getEventDispatcher();
     $dispatcher->dispatch(ContaoEvents::IMAGE_GET_HTML, $event);
     $url = BackendUrlBuilder::fromUrl('contao/main.php?do=metamodels&table=tl_metamodel_rendersetting')->setQueryParameter('pid', ModelId::fromValues('tl_metamodel_rendersettings', $dataContainer->value)->getSerialized());
     return sprintf('<a href="%s" title="%s" style="padding-left:3px">%s</a>', $url->getUrl(), sprintf(specialchars($GLOBALS['TL_LANG'][$table]['editrendersetting'][1]), $dataContainer->value), $event->getHtml());
 }
예제 #2
0
 /**
  * Redirect to edit mask.
  *
  * @param EnvironmentInterface $environment   The environment.
  * @param ModelIdInterface     $copiedModelId The model id.
  *
  * @return void
  */
 protected function redirect($environment, $copiedModelId)
 {
     // Build a clean url to remove the copy related arguments instad of using the AddToUrlEvent.
     $url = new BackendUrlBuilder();
     $url->setPath('contao/main.php')->setQueryParameter('do', $environment->getInputProvider()->getParameter('do'))->setQueryParameter('table', $copiedModelId->getDataProviderName())->setQueryParameter('act', 'edit')->setQueryParameter('id', $copiedModelId->getSerialized());
     $redirectEvent = new RedirectEvent($url->getUrl());
     $environment->getEventDispatcher()->dispatch(ContaoEvents::CONTROLLER_REDIRECT, $redirectEvent);
 }
예제 #3
0
 /**
  * Redirect to the child table.
  *
  * @param EnvironmentInterface $environment The environment.
  * @param boolean              $doNotCopy   The boolean do not copy.
  *
  * @return void
  */
 protected function redirectToChildTable(EnvironmentInterface $environment, $doNotCopy = false)
 {
     $redirectUrl = new BackendUrlBuilder();
     $redirectUrl->setPath('contao/main.php')->setQueryParameter('do', $environment->getInputProvider()->getParameter('do'));
     if ($doNotCopy === false) {
         $redirectUrl->setQueryParameter('act', $environment->getInputProvider()->getParameter('act'))->setQueryParameter('ctable', $environment->getInputProvider()->getParameter('ctable'))->setQueryParameter('table', $environment->getInputProvider()->getParameter('ctable'))->setQueryParameter('id', $environment->getInputProvider()->getParameter('id'))->setQueryParameter('pid', $environment->getInputProvider()->getParameter('id'));
     }
     if ($doNotCopy) {
         // TODO go to the right table
         /*$redirectUrl
           ->setQueryParameter('act', 'edit')
           ->setQueryParameter('table', $environment->getInputProvider()->getParameter('table'))
           ->setQueryParameter('pid', $environment->getInputProvider()->getParameter('id'));*/
     }
     $redirectEvent = new RedirectEvent($redirectUrl->getUrl());
     $environment->getEventDispatcher()->dispatch(ContaoEvents::CONTROLLER_REDIRECT, $redirectEvent);
 }