示例#1
0
 /**
  * Constructor
  * 
  * @param userName the user name
  * @param ticket the currenlty authenticated users ticket
  */
 public function __construct($repository, $ticket)
 {
     $this->nodeCache = array();
     $this->_repository = $repository;
     $this->_ticket = $ticket;
     $this->repositoryService = WebServiceFactory::getRepositoryService($this->_repository->connectionUrl, $this->_ticket);
     $this->contentService = WebServiceFactory::getContentService($this->_repository->connectionUrl, $this->_ticket);
 }
示例#2
0
 /**
  * Populate the version history
  */
 private function populateVersionHistory()
 {
     // Use the web service API to get the version history for this node
     $client = WebServiceFactory::getAuthoringService($this->_node->session->repository->connectionUrl, $this->_node->session->ticket);
     $result = $client->getVersionHistory(array("node" => $this->_node->__toArray()));
     //var_dump($result);
     // TODO populate the version history from the result of the web service call
 }
示例#3
0
 public function authenticate($userName, $password)
 {
     // TODO need to handle exceptions!
     $authenticationService = WebServiceFactory::getAuthenticationService($this->_connectionUrl);
     $result = $authenticationService->startSession(array("username" => $userName, "password" => $password));
     // Get the ticket and sessionId
     $ticket = $result->startSessionReturn->ticket;
     $sessionId = $result->startSessionReturn->sessionid;
     // Store the session id for later use
     if ($sessionId != null) {
         $sessionIds = null;
         if (isset($_SESSION["sessionIds"]) == false) {
             $sessionIds = array();
         } else {
             $sessionIds = $_SESSION["sessionIds"];
         }
         $sessionIds[$ticket] = $sessionId;
         $_SESSION["sessionIds"] = $sessionIds;
     }
     return $ticket;
 }
示例#4
0
 public function createVersion($description = null, $major = false)
 {
     // We can only create a version if there are no outstanding changes for this node
     if ($this->isDirty() == true) {
         throw new Exception("You must save any outstanding modifications before a new version can be created.");
     }
     // TODO implement major flag ...
     $client = WebServiceFactory::getAuthoringService($this->_session->repository->connectionUrl, $this->_session->ticket);
     $result = $client->createVersion(array("items" => array("nodes" => $this->__toArray()), "comments" => array("name" => "description", "value" => $description), "versionChildren" => false));
     // Clear the properties and aspects
     $this->_properties = null;
     $this->_aspects = null;
     // Get the version details
     // TODO get some of the other details too ...
     $versionId = $result->createVersionReturn->versions->id->uuid;
     $versionStoreScheme = $result->createVersionReturn->versions->id->store->scheme;
     $versionStoreAddress = $result->createVersionReturn->versions->id->store->address;
     // Create the version object to return
     return new Version($this->_session, new Store($this->_session, $versionStoreAddress, $versionStoreScheme), $versionId);
 }