/** * remove app id (base path) from filter * * @param array $_result * * @todo is this really needed? perhaps we can set the correct path in Tinebase_Model_Tree_Node_PathFilter::toArray */ protected function _removeAppIdFromPathFilter(&$_result) { $app = Tinebase_Application::getInstance()->getApplicationByName($this->_applicationName); foreach ($_result['filter'] as $idx => &$filter) { if ($filter['field'] === 'path') { if (is_array($filter['value'])) { $filter['value']['path'] = Tinebase_Model_Tree_Node_Path::removeAppIdFromPath($filter['value']['path'], $app); } else { $filter['value'] = Tinebase_Model_Tree_Node_Path::removeAppIdFromPath($filter['value'], $app); } } } }
/** * copy folder node * * @param Tinebase_Model_Tree_Node_Path $_source * @param Tinebase_Model_Tree_Node_Path $_destination * @return Tinebase_Model_Tree_Node * @throws Filemanager_Exception_NodeExists * * @todo add $_forceOverwrite? */ protected function _copyFolderNode(Tinebase_Model_Tree_Node_Path $_source, Tinebase_Model_Tree_Node_Path $_destination) { $newNode = $this->_createNode($_destination, Tinebase_Model_Tree_Node::TYPE_FOLDER); // recursive copy for (sub-)folders/files $filter = new Tinebase_Model_Tree_Node_Filter(array(array('field' => 'path', 'operator' => 'equals', 'value' => Tinebase_Model_Tree_Node_Path::removeAppIdFromPath($_source->flatpath, Tinebase_Application::getInstance()->getApplicationByName($this->_applicationName))))); $result = $this->search($filter); if (count($result) > 0) { $this->copyNodes($result->path, $newNode->path); } return $newNode; }