/**
  * Make the "from cms" folder use the saved folder
  *
  * @param int $parentID
  */
 public function updateAttachParentID(&$parentID)
 {
     // If given assume that a folder has been posted
     if ($parentID) {
         FolderDropdownField::set_last_folder($parentID);
     } else {
         $parentID = FolderDropdownField::get_last_folder();
     }
 }
 public function getFolderName()
 {
     // Ensure that, if this member is allowed, the persistant folder overrides any default set
     if ($this->canSelectFolder()) {
         $path = $this->folderPathFromID($this->selectField->Value());
         if ($path !== false) {
             return $path;
         }
     }
     return $this->getDefaultFolderName();
 }
 public function setUp()
 {
     parent::setUp();
     // Clear saved folder
     FolderDropdownField::set_last_folder(0);
     if (!file_exists(ASSETS_PATH)) {
         mkdir(ASSETS_PATH);
     }
     /* Create a test folders for each of the fixture references */
     $folderIDs = $this->allFixtureIDs('Folder');
     foreach ($folderIDs as $folderID) {
         $folder = DataObject::get_by_id('Folder', $folderID);
         if (!file_exists(BASE_PATH . "/{$folder->Filename}")) {
             mkdir(BASE_PATH . "/{$folder->Filename}");
         }
     }
     /* Create a test files for each of the fixture references */
     $fileIDs = $this->allFixtureIDs('File');
     foreach ($fileIDs as $fileID) {
         $file = DataObject::get_by_id('File', $fileID);
         $fh = fopen(BASE_PATH . "/{$file->Filename}", "w");
         fwrite($fh, str_repeat('x', 1000000));
         fclose($fh);
     }
 }