public function testGetFullPathWithComlpexStructureFromFileAndOtherUpload() { $this->prepareUploadTree($this->getTestFileStructure()); $this->prepareModularTable(array(array(6, 5, 1, 0, 0, 5, 6, "file", 6))); $cover = $this->treeDao->getMinimalCoveringItem(32, "uploadtree"); assertThat($cover, equalTo(3652)); assertThat($this->treeDao->getFullPath(3665, "uploadtree", $cover), equalTo("L/L2/L2a")); assertThat($this->treeDao->getFullPath(3665, "uploadtree"), equalTo("uploadDaoTest.tar/uploadDaoTest/L/L2/L2a")); }
protected function changeTreeIdsToPaths(&$ungrupedStatements, $uploadTreeTableName, $uploadId) { $parentId = $this->treeDao->getMinimalCoveringItem($uploadId, $uploadTreeTableName); foreach ($ungrupedStatements as &$statement) { $uploadTreeId = $statement['uploadtree_pk']; unset($statement['uploadtree_pk']); if (!array_key_exists($uploadTreeId, $this->fileNameCache)) { $this->fileNameCache[$uploadTreeId] = $this->treeDao->getFullPath($uploadTreeId, $uploadTreeTableName, $parentId); } $statement['fileName'] = $this->fileNameCache[$uploadTreeId]; } unset($statement); }
/** * @brief write out text in format 'filepath: copyright list' */ private function printRow($row, $uploadtree_tablename, &$allCopyrightEntries, $parentId = 0) { $filepath = $this->treeDao->getFullPath($row['uploadtree_pk'], $uploadtree_tablename, $parentId); $copyrightArray = array(); foreach ($allCopyrightEntries as $entry) { if ($entry['uploadtree_pk'] == $row['uploadtree_pk']) { $copyrightArray[] = $entry['content']; } } $copyright = implode(', ', $copyrightArray); /** include and exclude together */ if (-1 != $this->includingCopyright && -1 != $this->excludingCopyright && !empty($this->includingCopyright) && !empty($this->excludingCopyright)) { if (empty($copyright) || stristr($copyright, $this->includingCopyright) || stristr($copyright, $this->excludingCopyright)) { return; } } else { if (!(-1 == $this->includingCopyright && -1 == $this->excludingCopyright) && !(empty($this->includingCopyright) && empty($this->excludingCopyright)) && !(empty($this->includingCopyright) && empty($copyright)) && !(empty($this->excludingCopyright) && !empty($copyright)) && !(-1 != $this->includingCopyright && !empty($this->includingCopyright) && !empty($copyright) && stristr($copyright, $this->includingCopyright)) && !(-1 != $this->excludingCopyright && !empty($this->excludingCopyright) && !empty($copyright) && !stristr($copyright, $this->excludingCopyright))) { return; } } print "{$filepath}: {$copyright}\n"; }