/**
  * Handle the delete all action.
  *
  * @param ModelIdInterface[] $modelIds The list of model ids.
  *
  * @return void
  */
 protected function handleCopyAllAction($modelIds)
 {
     if (ViewHelpers::getManualSortingProperty($this->getEnvironment())) {
         $clipboard = $this->getEnvironment()->getClipboard();
         $parentId = $this->getParentId();
         foreach ($modelIds as $modelId) {
             $item = new Item(Item::COPY, $parentId, $modelId);
             $clipboard->push($item);
         }
         $clipboard->saveTo($this->getEnvironment());
     } else {
         $handler = new CopyHandler();
         $handler->setEnvironment($this->getEnvironment());
         foreach ($modelIds as $modelId) {
             $handler->copy($modelId);
         }
     }
     ViewHelpers::redirectHome($this->getEnvironment());
 }
Esempio n. 2
0
 /**
  * The copy handler.
  *
  * @param ModelIdInterface     $modelId     The model id.
  * @param EnvironmentInterface $environment The environment.
  *
  * @return ModelInterface
  */
 protected function copyHandler(ModelIdInterface $modelId, EnvironmentInterface $environment)
 {
     $copyHandler = new CopyHandler();
     $copyHandler->setEnvironment($environment);
     return $copyHandler->copy($modelId);
 }