/** * get container path * * @param Tinebase_Model_Container $container * @return string */ public function getContainerPath(Tinebase_Model_Container $container) { $treeNodePath = new Tinebase_Model_Tree_Node_Path(array('application' => Tinebase_Application::getInstance()->getApplicationById($container->application_id))); $treeNodePath->setContainer($container); return $treeNodePath->statpath; }
/** * move folder container * * @param Tinebase_Model_Tree_Node_Path $source * @param Tinebase_Model_Tree_Node_Path $destination * @param boolean $forceOverwrite * @return Tinebase_Model_Tree_Node */ protected function _moveFolderContainer($source, $destination, $forceOverwrite = FALSE) { if ($source->isToplevelPath()) { if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Moving container ' . $source->container->name . ' to ' . $destination->flatpath); } $this->_checkACLContainer($source->container, 'update'); $container = $source->container; if ($container->name !== $destination->name) { try { $existingContainer = Tinebase_Container::getInstance()->getContainerByName($this->_applicationName, $destination->name, $destination->containerType, Tinebase_Core::getUser()); if (!$forceOverwrite) { $fene = new Filemanager_Exception_NodeExists('container exists'); $fene->addExistingNodeInfo($this->_backend->stat($destination->statpath)); throw $fene; } else { if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) { Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Removing existing folder node and container ' . $destination->flatpath); } $this->_backend->rmdir($destination->statpath, TRUE); } } catch (Tinebase_Exception_NotFound $tenf) { // ok } $container->name = $destination->name; $container = Tinebase_Container::getInstance()->update($container); } } else { if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Creating container ' . $destination->name); } $container = $this->_createContainer($destination->name, $destination->containerType); } $destination->setContainer($container); }
/** * move folder container * * @param Tinebase_Model_Tree_Node_Path $source * @param Tinebase_Model_Tree_Node_Path $destination * @return Tinebase_Model_Tree_Node */ protected function _moveFolderContainer($source, $destination) { if ($source->isToplevelPath()) { if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Moving container ' . $source->container->name . ' to ' . $destination->flatpath); } $this->_checkACLContainer($source->container, 'update'); $container = $source->container; if ($container->name !== $destination->name) { $container->name = $destination->name; $container = Tinebase_Container::getInstance()->update($container); } } else { if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Creating container ' . $destination->name); } $container = $this->_createContainer($destination->name, $destination->containerType); } $destination->setContainer($container); }