/** * Move a file to another folder. * * @param String $file_id Direcory entry id of the file to move * (use 'flashed' to read ids from from flash * memory for a bulk operation) * @param mixed $source_id Optional folder id to return to after * operation has succeeded */ public function move_action($file_id, $source_id = null) { if (!$this->full_access) { throw new AccessDeniedException(); } PageLayout::setTitle(_('Datei verschieben')); if (Request::isPost()) { $folder_id = Request::option('folder_id'); if ($file_id === 'flashed') { $ids = Request::optionArray('file_id'); } else { $ids = array($file_id); } FileHelper::checkAccess($ids); foreach ($ids as $id) { $source_id = $source_id ?: FileHelper::getParentId($file_id) ?: $this->context_id; $entry = new DirectoryEntry($id); $entry->move($folder_id); } $message = ngettext('Die Datei wurde erfolgreich verschoben', 'Die Dateien wurden erfolgreich verschoben', count($ids)); PageLayout::postMessage(MessageBox::success($message)); $this->redirect('document/files/index/' . $source_id); return; } $this->file_id = $file_id; $this->dir_tree = FileHelper::getDirectoryTree($this->context_id); if ($file_id === 'flashed') { $this->flashed = $this->flash['move-ids']; $this->parent_id = $source_id; FileHelper::checkAccess($this->flashed); } else { $this->parent_id = FileHelper::getParentId($file_id) ?: $this->context_id; FileHelper::checkAccess($file_id); } $this->active_folders = array_keys(FileHelper::getBreadCrumbs($this->parent_id)); try { $parent = new DirectoryEntry($this->parent_id); $this->parent_file_id = $parent->file->id; } catch (Exception $e) { $this->parent_file_id = $this->context_id; } }