/** * Main function, rendering the content of the rename form * * @return void */ function main() { global $LANG; $content = ''; $items = $this->pObj->compileFilesAndRecordsData(); // // perform copy files(s) // if (count($items) and is_array($this->pObj->data) and $this->pObj->target and $this->pObj->data[$this->copyOrMove]) { $errors = array(); foreach ($this->pObj->data[$this->copyOrMove] as $id => $filepath) { if ($items[$id] and $items[$id]['file_accessable']) { if ($this->copyOrMove == 'copy') { if ($error = tx_dam::process_copyFile($items[$id], $this->pObj->target)) { $errors[] = htmlspecialchars($error); } } else { if ($error = tx_dam::process_moveFile($items[$id], $this->pObj->target)) { $errors[] = htmlspecialchars($error); } } } else { $errors[] = $LANG->getLL('accessDenied', true) . htmlspecialchars(' (' . $filepath . ')'); } } if ($errors) { $content .= $GLOBALS['SOBE']->getMessageBox($LANG->getLL('error'), implode('<br />', $errors), $this->pObj->buttonBack(0), 2); } else { $this->pObj->redirect(); } } // // display forms // if (!$this->pObj->target) { $content .= $this->renderTargetFolderSelect(); } elseif (count($items) == 1) { reset($items); $item = current($items); if ($item['file_accessable']) { $content .= $this->renderFormSingle(key($items), $item, $this->pObj->target); } else { // this should have happen in index.php already $content .= $this->pObj->accessDeniedMessageBox($item['file_name']); } } elseif (count($items) > 1) { // multi action $content .= $this->renderFormMulti($items, $this->pObj->target); } return $content; }