/** * Verschiebt die angegebene Datei in das neue Verzeichnis und nennt sie entsprechend um. * * @param string $uploadFileName - Name der Datei die verschoben werden soll. * @param string $dir - Zielverzeichnis * @param string $name - Zieldateiname * * @return File::moveTo * * @author Werner Liemberger <*****@*****.**> * @version 1.0, 14.03.2011<br> * @version 1.1, 14.08.2012 (Change to new File-/Folder-class)<br> * @veriosn 1.2, 14.09.2012 (Removed bug for moving file with File-Folder-Class)<br> * @version 1.3, 19.09.2012 (Create the disered directory and open it instead of just open it)<br> */ public function moveFile($uploadFileName, $dir, $name) { $File = new File(); //open File $File->open($this->getUploadPath() . '/' . $uploadFileName); //rename File $File->renameTo($name); //delete File from session $this->deleteFileFromSession($uploadFileName); //move File and return it $targetDir = new Folder(); $targetDir->create($dir); //Create directory if not already done return $File->moveTo($targetDir); }
/** * Creates a new file for each the base class and the DO class with the code for * the object with the given name. Will overwrite existing file! * * @param string $name The object's name. * @param string $baseFileName The file name the base class will be written to. * @param string $fileName The file name the class will be written to. * * @author Ralf Schubert * @version * Version 0.1, 15.01.2011<br /> * Version 0.2, 24.06.2014 (ID#194: split base class and DO class into separate files to better support auto loading.)<br /> */ protected function createNewServiceObject($name, $baseFileName, $fileName) { $namespace = $this->getNamespaceByObjectName($name); $path = dirname($fileName); if (!file_exists($path)) { $folder = new Folder(); $folder->create($path); } // create base class file $content = '<?php' . PHP_EOL . 'namespace ' . $namespace . ';' . PHP_EOL . PHP_EOL . $this->generateBaseObjectCode($name) . PHP_EOL; $baseFile = new File(); $baseFile->create($baseFileName)->writeContent($content); // create class file $content = '<?php' . PHP_EOL . 'namespace ' . $namespace . ';' . PHP_EOL . PHP_EOL . $this->generateObjectCode($name) . PHP_EOL; $file = new File(); $file->create($fileName)->writeContent($content); }