/** * add base path * * @param Tinebase_Model_Tree_Node_PathFilter $_pathFilter * @return string */ public function addBasePath($_path) { $basePath = $this->_backend->getApplicationBasePath(Tinebase_Application::getInstance()->getApplicationByName($this->_applicationName)); $basePath .= '/folders'; $path = strpos($_path, '/') === 0 ? $_path : '/' . $_path; // only add base path once $result = !preg_match('@^' . preg_quote($basePath) . '@', $path) ? $basePath . $path : $path; return $result; }
/** * get path for record attachments * * @param Tinebase_Record_Abstract $record * @param boolean $createDirIfNotExists * @throws Tinebase_Exception_InvalidArgument * @return string */ public function getRecordAttachmentPath(Tinebase_Record_Abstract $record, $createDirIfNotExists = FALSE) { if (!$record->getId()) { throw new Tinebase_Exception_InvalidArgument('record needs an identifier'); } $parentPath = $this->_fsController->getApplicationBasePath($record->getApplication(), Tinebase_FileSystem::FOLDER_TYPE_RECORDS); $recordPath = $parentPath . '/' . get_class($record) . '/' . $record->getId(); if ($createDirIfNotExists && !$this->_fsController->fileExists($recordPath)) { $this->_fsController->mkdir($recordPath); } return $recordPath; }