getRepositories(); // fetch for default first repo; NOTE that this will probably have to change at some point, quick and dirty for now $this->repositoryInfo = $RepositoryService->getRepositoryInfo($repositories[0]['repositoryId']); } } public function serviceDocument() { $service = new KT_cmis_atom_serviceDoc(KT_APP_BASE_URI); foreach($this->services as $workspace => $collection) { //Creating the Default Workspace for use with standard atomPub Clients $ws = $service->newWorkspace(); $hadDetail=false; if(isset($this->workspaceDetail[$workspace]))if(is_array($this->workspaceDetail[$workspace])){ foreach ($this->workspaceDetail[$workspace] as $wsTag=>$wsValue){ $ws->appendChild($service->newElement($wsTag,$wsValue)); $hadDetail=true; } } if(!$hadDetail){ $ws->appendChild($service->newElement('atom:title',$workspace)); } $ws->appendChild($service->newAttr('cmis:repositoryRelationship', $this->repositoryInfo['repositoryRelationship'])); // repository information $element = $service->newElement('cmis:repositoryInfo'); foreach($this->repositoryInfo as $key => $repoData) { if ($key == 'rootFolderId') { $repoData = CMIS_APP_BASE_URI . 'folder/' . $repoData; } if (!is_array($repoData)) { $element->appendChild($service->newElement('cmis:' . $key, $repoData)); } else { $elementSub = $service->newElement('cmis:' . $key); foreach($repoData as $key2 => $data) { $elementSub->appendChild($service->newElement('cmis:' . $key2, CMISUtil::boolToString($data))); } $element->appendChild($elementSub); } } $ws->appendChild($element); foreach($collection as $serviceName => $serviceInstance) { foreach($serviceInstance as $instance) { $collectionStr = CMIS_APP_BASE_URI . $workspace . '/' . $serviceName . '/' . (is_array($instance['parameters']) ? implode('/', $instance['parameters']).'/' : ''); $col = $service->newCollection($collectionStr, $instance['title'], $instance['collectionType'], $ws); } } } $this->output = $service->getAPPdoc(); } public function registerService($workspace = NULL, $serviceName = NULL, $serviceClass = NULL, $title = NULL, $serviceParameters = NULL, $collectionType = NULL) { $workspace = strtolower(trim($workspace)); $serviceName = strtolower(trim($serviceName)); $serviceRecord = array( 'fileName' => $fileName, 'serviceClass' => $serviceClass, 'title' => $title, 'parameters' => $serviceParameters, 'collectionType' => $collectionType ); $this->services[$workspace][$serviceName][] = $serviceRecord; } } ?>