├── delete.php ├── read.php ├── create.php ├── list-sites.php ├── copy.php ├── edit.php ├── list-subscribers.php ├── move.php ├── publish.php ├── read-access-rights.php ├── README.md ├── edit-access-rights.php ├── read-workflow-settings.php ├── edit-workflow-settings.php └── cascade.php /delete.php: -------------------------------------------------------------------------------- 1 | 1, 'location' => str_replace('?wsdl', '', $soapURL)) 7 | ); 8 | $auth = array ('username' => 'admin', 'password' => 'admin' ); 9 | 10 | $identifier = array 11 | ( 12 | 'path' => array('path' => '/my-xml-block', 'siteName' => 'nameOfSite'), 13 | 'type' => 'block' 14 | ); 15 | 16 | $deleteParams = array ('authentication' => $auth, 'identifier' => $identifier); 17 | $reply = $client->delete($deleteParams); 18 | 19 | if ($reply->deleteReturn->success=='true') 20 | echo "Success."; 21 | else 22 | echo "Error occurred when deleting: " . $reply->deleteReturn->message; 23 | ?> 24 | -------------------------------------------------------------------------------- /read.php: -------------------------------------------------------------------------------- 1 | 1, 'location' => str_replace('?wsdl', '', $soapURL)) 7 | ); 8 | $auth = array ('username' => 'admin', 'password' => 'admin' ); 9 | 10 | $identifier = array 11 | ( 12 | 'path' => array('path' => '/my-xml-block','siteName' => 'nameOfSite'), 13 | //OR 'id' => 'string', and then the type 14 | 'type' => 'block' 15 | ); 16 | 17 | $readParams = array ('authentication' => $auth, 'identifier' => $identifier); 18 | $reply = $client->read($readParams); 19 | 20 | if ($reply->readReturn->success=='true') 21 | echo "Success. Block's xml: " . $reply->readReturn->asset->xmlBlock->xml; 22 | else 23 | echo "Error occurred: " . $reply->readReturn->message; 24 | ?> 25 | -------------------------------------------------------------------------------- /create.php: -------------------------------------------------------------------------------- 1 | 1, 'location' => str_replace('?wsdl', '', $soapURL)) 7 | ); 8 | $auth = array ('username' => 'admin', 'password' => 'admin' ); 9 | 10 | $xmlBlock = array 11 | ( 12 | 'xml' => 'Test', 13 | 'metadataSetPath' => '/Default', 14 | 'parentFolderPath' => '/', 15 | 'name' => 'my-xml-block', 16 | 'siteName' => 'nameOfSite' 17 | ); 18 | 19 | $asset = array('xmlBlock' => $xmlBlock); 20 | $createParams = array ('authentication' => $auth, 'asset' => $asset); 21 | $reply = $client->create ($createParams); 22 | 23 | if ($reply->createReturn->success=='true') 24 | echo "Success. Created asset's id is " . $reply->createReturn->createdAssetId; 25 | else 26 | echo "Error occurred: " . $reply->createReturn->message; 27 | ?> 28 | -------------------------------------------------------------------------------- /list-sites.php: -------------------------------------------------------------------------------- 1 | 1, 'location' => str_replace('?wsdl', '', $soapURL)) 7 | ); 8 | $auth = array ('username' => 'admin', 'password' => 'admin' ); 9 | 10 | $listSitesParams = array ('authentication' => $auth); 11 | $reply = $client->listSites($listSitesParams); 12 | 13 | if ($reply->listSitesReturn->success=='true') 14 | { 15 | $sites = $reply->listSitesReturn->sites->assetIdentifier; 16 | if (sizeof($sites)==0) 17 | $sites = array(); 18 | else if (!is_array($sites)) // For less than 2 eleements, the returned object isn't an array 19 | $sites=array($sites); 20 | 21 | echo "Sites:\r\n"; 22 | foreach($sites as $site) 23 | echo $site->path->path . " (" . $site->id . ")\r\n"; 24 | } 25 | else 26 | echo "Error occurred when getting a list of sites: " . $reply->listSitesReturn->message; 27 | ?> -------------------------------------------------------------------------------- /copy.php: -------------------------------------------------------------------------------- 1 | 1, 'location' => str_replace('?wsdl', '', $soapURL)) 7 | ); 8 | $auth = array ('username' => 'admin', 'password' => 'admin' ); 9 | 10 | $identifier = array 11 | ( 12 | 'path' => array('path' => '/my-xml-block', 'siteName' => 'nameOfSite'), 13 | 'type' => 'block' 14 | ); 15 | 16 | $destFolderIdentifier = array 17 | ( 18 | 'path' => array('path' => '/my-folder', 'siteName' => 'nameOfSite'), 19 | 'type' => 'folder' 20 | ); 21 | 22 | $copyParams = array 23 | ( 24 | 'authentication' => $auth, 25 | 'identifier' => $identifier, 26 | 'copyParameters' => array 27 | ( 28 | 'destinationContainerIdentifier' => $destFolderIdentifier, 29 | 'doWorkflow' => false, 30 | 'newName' => 'my-xml-block-copy', 31 | ) 32 | ); 33 | 34 | $reply = $client->copy($copyParams); 35 | 36 | if ($reply->copyReturn->success=='true') 37 | echo "Success."; 38 | else 39 | echo "Error occurred when copying: " . $reply->copyReturn->message; 40 | ?> 41 | -------------------------------------------------------------------------------- /edit.php: -------------------------------------------------------------------------------- 1 | 1, 'location' => str_replace('?wsdl', '', $soapURL)) 7 | ); 8 | $auth = array ('username' => 'admin', 'password' => 'admin' ); 9 | 10 | $identifier = array 11 | ( 12 | 'path' => array('path' => '/my-xml-block', 'siteName'=> 'nameOfSite'), 13 | 'type' => 'block' 14 | ); 15 | 16 | $readParams = array ('authentication' => $auth, 'identifier' => $identifier); 17 | $reply = $client->read($readParams); 18 | 19 | if ($reply->readReturn->success=='true') 20 | { 21 | $xmlBlock = $reply->readReturn->asset->xmlBlock; 22 | $xmlBlock->metadata->title="A new title"; 23 | $editParams = array ('authentication' => $auth, 'asset' => array('xmlBlock' => $xmlBlock)); 24 | $reply = $client->edit($editParams); 25 | if ($reply->editReturn->success=='true') 26 | echo "Success."; 27 | else 28 | echo "Error occurred when issuing an edit: " . $reply->editReturn->message; 29 | } 30 | else 31 | echo "Error occurred when reading: " . $reply->readReturn->message; 32 | ?> 33 | -------------------------------------------------------------------------------- /list-subscribers.php: -------------------------------------------------------------------------------- 1 | 1, 'location' => str_replace('?wsdl', '', $soapURL)) 7 | ); 8 | $auth = array ('username' => 'admin', 'password' => 'admin' ); 9 | 10 | $identifier = array 11 | ( 12 | 'id' => 'your-asset-id', 13 | 'type' => 'your-asset-type' 14 | ); 15 | 16 | $listSubscribersParams = array ('authentication' => $auth, 'identifier' => $identifier); 17 | $reply = $client->listSubscribers($listSubscribersParams); 18 | 19 | if ($reply->listSubscribersReturn->success=='true') 20 | { 21 | echo "Subscribers:\r\n"; 22 | $subscribers = $reply->listSubscribersReturn->subscribers->assetIdentifier; 23 | if (sizeof($subscribers)==0) 24 | { 25 | echo "NONE\r\n"; 26 | exit; 27 | } 28 | else if (!is_array($subscribers)) // For less than 2 elements, the returned object isn't an array 29 | $subscribers=array($subscribers); 30 | 31 | foreach($subscribers as $identifier) 32 | echo "[".$identifier->type."] site://".$identifier->path->siteName."/".$identifier->path->path."\r\n"; 33 | } 34 | else 35 | echo "Error occurred: " . $reply->listSubscribersReturn->message; 36 | ?> -------------------------------------------------------------------------------- /move.php: -------------------------------------------------------------------------------- 1 | 1, 'location' => str_replace('?wsdl', '', $soapURL)) 9 | ); 10 | $auth = array ('username' => 'admin', 'password' => 'admin' ); 11 | 12 | $identifier = array 13 | ( 14 | // ID or path of the asset 15 | 'id' =>'Your-Page-ID-Here', 16 | 'type' => 'page' 17 | ); 18 | 19 | $destFolderIdentifier = array 20 | // Optional if you're renaming not moving 21 | ( 22 | 'id' =>'Your-New-Folder-ID', 23 | 'type' => 'folder' 24 | ); 25 | 26 | $moveParams = array 27 | ( 28 | 'authentication' => $auth, 29 | 'identifier' => $identifier, 30 | 'moveParameters' => array 31 | ( 32 | // Must specify a new name and/or new container for the asset - only one is required 33 | 'destinationContainerIdentifier' => $destFolderIdentifier, 34 | 'newName' => 'New-Page-Name', 35 | // Required: true or false 36 | 'doWorkflow' => false, 37 | ) 38 | ); 39 | 40 | $reply = $client->move($moveParams); 41 | 42 | if ($reply->moveReturn->success=='true') 43 | echo "Success."; 44 | else 45 | echo "Error occurred when moving/renaming: " . $reply->moveReturn->message; 46 | ?> 47 | -------------------------------------------------------------------------------- /publish.php: -------------------------------------------------------------------------------- 1 | 1, 'location' => str_replace('?wsdl', '', $soapURL)) 9 | ); 10 | $auth = array ('username' => 'admin', 'password' => 'admin' ); 11 | 12 | $identifier = array 13 | ( 14 | // ID or path of the asset 15 | 'id' =>'Your-Page-ID-Here', 16 | 'type' => 'page' 17 | ); 18 | 19 | $destinationIdentifier = array 20 | ( 21 | // ID or path of the destination 22 | 'id' => 'Your-Destination-ID-Here', 23 | 'type' => 'destination' 24 | ); 25 | 26 | $publishInformation = array 27 | ( 28 | 'identifier' => $identifier, 29 | 'destinations' => array ($destinationIdentifier), // This is optional, not providing this will result in publishing to all enabled destinations available to authenticating user 30 | 'unpublish' => false // This is optional, default is false 31 | ); 32 | 33 | $publishParams = array ('authentication' => $auth, 'publishInformation' => $publishInformation); 34 | $reply = $client->publish($publishParams); 35 | 36 | if ($reply->publishReturn->success=='true') 37 | echo "Success: Published."; 38 | else 39 | echo "Error occurred when publishing: " . $reply->publishReturn->message; 40 | 41 | ?> 42 | -------------------------------------------------------------------------------- /read-access-rights.php: -------------------------------------------------------------------------------- 1 | 1, 'location' => str_replace('?wsdl', '', $soapURL)) 7 | ); 8 | $auth = array ('username' => 'admin', 'password' => 'admin' ); 9 | 10 | $identifier = array 11 | ( 12 | 'path' => array('path' => '/my-xml-block', 'siteName' => 'nameOfSite'), 13 | 'type' => 'block' 14 | ); 15 | 16 | $readParams = array ('authentication' => $auth, 'identifier' => $identifier); 17 | $reply = $client->readAccessRights($readParams); 18 | 19 | if ($reply->readAccessRightsReturn->success=='true') 20 | { 21 | $aclEntries = $reply->readAccessRightsReturn->accessRightsInformation->aclEntries->aclEntry; 22 | 23 | if (!is_array($aclEntries)) // For less than 2 elements, the returned object isn't an array 24 | $aclEntries=array($aclEntries); 25 | 26 | for($i=0; $iname=='admin' && $aclEntry->type=='user') 30 | { 31 | echo 'User admin has acl entry level of '.$aclEntry->level; 32 | exit; 33 | } 34 | } 35 | 36 | echo 'Could not find an acl entry for user admin'; 37 | } 38 | else 39 | echo "Error occurred: " . $reply->readAccessRightsReturn->message; 40 | ?> 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Webservices-PHP-Sample-Project 2 | ============================== 3 | 4 | This project contains example operations that can be executed through Cascade Server 5 | Web Services using PHP. 6 | 7 | ------------------------------ 8 | 9 | The php_soap library needs to be enabled to be able to execute the code. 10 | 11 | To be able to connect to your Cascade Server instance, you should update the $soapURL 12 | with the URL to your instance's WSDL and the $auth with your username and password. 13 | 14 | ------------------------------ 15 | 16 | The "location" parameter in $client is optional - it is only needed when you are getting 17 | "Could not connect to host" error when performing operations. In that case most likely 18 | Cascade Server is using apache proxy (using mod_proxy). Sometimes when running 19 | through a proxy, the returned service endpoint (at the very bottom of the WSDL 20 | response) points to a location that is an internal hostname/port. 21 | 22 | In that case, the PHP SoapClient is parsing the WSDL and using that service endpoint 23 | to issue requests. So even though it looks like you're connecting to the soapURL, 24 | you're actually connecting to an internal hostname/port so you might get: Could not 25 | connect to host. 26 | 27 | The "location" param is way to manually set the service endpoint instead of letting 28 | the SoapClient figure it out from the WSDL. -------------------------------------------------------------------------------- /edit-access-rights.php: -------------------------------------------------------------------------------- 1 | 1, 'location' => str_replace('?wsdl', '', $soapURL)) 7 | ); 8 | $auth = array ('username' => 'admin', 'password' => 'admin' ); 9 | 10 | $identifier = array 11 | ( 12 | 'path' => array('path' => '/my-xml-block', 'siteName' => 'nameOfSite'), 13 | 'type' => 'block' 14 | ); 15 | 16 | $readParams = array ('authentication' => $auth, 'identifier' => $identifier); 17 | $reply = $client->readAccessRights($readParams); 18 | 19 | if ($reply->readAccessRightsReturn->success=='true') 20 | { 21 | $accessRightsInformation = $reply->readAccessRightsReturn->accessRightsInformation; 22 | $aclEntries = $accessRightsInformation->aclEntries->aclEntry; 23 | 24 | if (sizeof($aclEntries)==0) 25 | $aclEntries = array(); 26 | else if (!is_array($aclEntries)) // For less than 2 eleements, the returned object isn't an array 27 | $aclEntries=array($aclEntries); 28 | 29 | $aclEntries[] = array('level' => 'read', 'type' => 'user', 'name' => 'admin'); 30 | $accessRightsInformation->aclEntries->aclEntry=$aclEntries; 31 | 32 | $editParams = array 33 | ( 34 | 'authentication' => $auth, 35 | 'accessRightsInformation' => $accessRightsInformation 36 | ); 37 | 38 | $reply = $client->editAccessRights($editParams); 39 | if ($reply->editAccessRightsReturn->success=='true') 40 | echo "Success."; 41 | else 42 | echo "Error occurred when editing access rights: " . $reply->editAccessRightsReturn->message; 43 | } 44 | else 45 | echo "Error occurred: " . $reply->readAccessRightsReturn->message; 46 | ?> 47 | -------------------------------------------------------------------------------- /read-workflow-settings.php: -------------------------------------------------------------------------------- 1 | 1, 'location' => str_replace('?wsdl', '', $soapURL)) 7 | ); 8 | $auth = array ('username' => 'admin', 'password' => 'admin' ); 9 | 10 | $identifier = array 11 | ( 12 | 'id' => 'folder-id-here', 13 | 'type' => 'folder' 14 | ); 15 | 16 | $readParams = array ('authentication' => $auth, 'identifier' => $identifier); 17 | $reply = $client->readWorkflowSettings($readParams); 18 | 19 | if ($reply->readWorkflowSettingsReturn->success=='true') 20 | { 21 | echo "Inherit workflows: ".($reply->readWorkflowSettingsReturn->workflowSettings->inheritWorkflows?"true":"false"); 22 | echo "\r\nRequired workflow: ".($reply->readWorkflowSettingsReturn->workflowSettings->requireWorkflow?"true":"false"); 23 | 24 | $workflowDefinitions = $reply->readWorkflowSettingsReturn->workflowSettings->workflowDefinitions->assetIdentifier; 25 | if (sizeof($workflowDefinitions)==0) 26 | $workflowDefinitions = array(); 27 | else if (!is_array($workflowDefinitions)) // For less than 2 elements, the returned object isn't an array 28 | $workflowDefinitions=array($workflowDefinitions); 29 | echo "\r\nWorkflow definitions: "; 30 | foreach($workflowDefinitions as $identifier) 31 | echo "site://" .$identifier->path->siteName."/".$identifier->path->path . " "; 32 | 33 | $inheritedWorkflowDefinitions = $reply->readWorkflowSettingsReturn->workflowSettings->inheritedWorkflowDefinitions->assetIdentifier; 34 | if (sizeof($inheritedWorkflowDefinitions)==0) 35 | $inheritedWorkflowDefinitions = array(); 36 | else if (!is_array($inheritedWorkflowDefinitions)) // For less than 2 elements, the returned object isn't an array 37 | $inheritedWorkflowDefinitions=array($inheritedWorkflowDefinitions); 38 | echo "\r\nInherited workflow definitions: "; 39 | foreach($inheritedWorkflowDefinitions as $identifier) 40 | echo "site://" .$identifier->path->siteName."/".$identifier->path->path . " "; 41 | 42 | echo "\r\n"; 43 | } 44 | else 45 | echo "Error occurred: " . $reply->readWorkflowSettingsReturn->message; 46 | ?> -------------------------------------------------------------------------------- /edit-workflow-settings.php: -------------------------------------------------------------------------------- 1 | 1, 'location' => str_replace('?wsdl', '', $soapURL)) 7 | ); 8 | $auth = array ('username' => 'admin', 'password' => 'admin' ); 9 | 10 | $identifier = array 11 | ( 12 | 'id' => '69b7e3140a00016c5e4c03d46a931aed', 13 | 'type' => 'folder' 14 | ); 15 | 16 | $workflowDefinitionIdentifier = array 17 | ( 18 | 'id' => '3591e3107f0000010020a239a209a2e2', 19 | 'type' => 'workflowdefinition' 20 | ); 21 | 22 | $readParams = array ('authentication' => $auth, 'identifier' => $identifier); 23 | $reply = $client->readWorkflowSettings($readParams); 24 | 25 | if ($reply->readWorkflowSettingsReturn->success=='true') 26 | { 27 | $workflowDefinitions = $reply->readWorkflowSettingsReturn->workflowSettings->workflowDefinitions->assetIdentifier; 28 | if (sizeof($workflowDefinitions)==0) 29 | $workflowDefinitions = array(); 30 | else if (!is_array($workflowDefinitions)) // For less than 2 eleements, the returned object isn't an array 31 | $workflowDefinitions=array($workflowDefinitions); 32 | $alreadyContains = false; 33 | foreach($workflowDefinitions as $identifier) 34 | if($identifier->id==$workflowDefinitionIdentifier->id) 35 | $alreadyContains = true; 36 | 37 | if ($alreadyContains) 38 | { 39 | echo "Workflow definition is alraedy assigned"; 40 | } 41 | else 42 | { 43 | $workflowDefinitions[] = $workflowDefinitionIdentifier; 44 | $reply->readWorkflowSettingsReturn->workflowSettings->workflowDefinitions->assetIdentifier=$workflowDefinitions; 45 | $editParams = array 46 | ( 47 | 'authentication' => $auth, 48 | 'workflowSettings' => $reply->readWorkflowSettingsReturn->workflowSettings, 49 | 'applyInheritWorkflowsToChildren' => false, // Optional, false is default 50 | 'applyRequireWorkflowToChildren' => false, // Optional, false is default 51 | ); 52 | $reply = $client->editWorkflowSettings($editParams); 53 | 54 | if ($reply->editWorkflowSettingsReturn->success=='true') 55 | echo "Success."; 56 | else 57 | echo "Error occurred when editing workflow settings: " . $reply->editWorkflowSettingsReturn->message; 58 | } 59 | } 60 | else 61 | echo "Error occurred: " . $reply->readWorkflowSettingsReturn->message; 62 | ?> -------------------------------------------------------------------------------- /cascade.php: -------------------------------------------------------------------------------- 1 | changeAuth($username, $password); //wrap in try/catch 6 | $identifier = $obj->identifier($type, $path, $siteName); 7 | $identifier = $obj->identifierByPath($type, $path, $siteName); 8 | $identifier = $obj->identifier($type, $id); 9 | $identifier = $obj->identifierById($type, $id); 10 | $acl= $obj->createACL($name, $level, $type); 11 | $bool = $obj->result($reply); 12 | $reply = $obj->listSites(); 13 | $reply = $obj->listSubscribers($identifier); 14 | $reply = $obj->read($identifier); 15 | $reply = $obj->readWorkflowSettings($identifier); 16 | $reply = $obj->readAccessRights($identifier); 17 | $reply = $obj->search($searchInfo); 18 | $reply = $obj->edit($asset); 19 | $reply = $obj->editWorkflowSettings($workflowSettings, $childrenInherit, $childrenRequire); 20 | $reply = $obj->editAccessRights($acls, $children); 21 | $reply = $obj->move($identifier, $destIdentifier, $newName, $doWorkflow = false); 22 | $reply = $obj->create($asset); 23 | $reply = $obj->copy($identifier, $destIdentifier, $newName); 24 | $reply = $obj->delete($identifier); 25 | $reply = $obj->publish($identifier, $destIdentifiers, $unpublish); 26 | 27 | $array = $obj->objectToArray($object); 28 | $object = $obj->arrayToObject($array); 29 | $obj->test($arr); 30 | */ 31 | class Cascade 32 | { 33 | private $auth; 34 | private $client; 35 | /* 36 | Builds $auth and $client, then tests authentication 37 | NOTE:Wrap in try/catch 38 | */ 39 | function __construct($username, $password, $domain) 40 | { 41 | $this->auth = array ('username' => $username, 'password' => $password ); 42 | $soapURL = "https://".$domain."/ws/services/AssetOperationService?wsdl"; 43 | $this->client = new SoapClient 44 | ( 45 | $soapURL, 46 | array ('trace' => 1, 'location' => str_replace('?wsdl', '', $soapURL)) 47 | ); 48 | $this->testAuth(); 49 | } 50 | /* 51 | Allows: identifier($type,$path,$siteName); 52 | Allows: identifier($type,$id); 53 | */ 54 | function __call($method, $arguments) 55 | { 56 | /* 57 | Allows: 58 | $obj->identifier($type,$path,$siteName); 59 | $obj->identifier($type,$id); 60 | */ 61 | if($method == 'identifier') 62 | { 63 | if(count($arguments) == 2) 64 | return call_user_func_array(array ($this,'identifierById'), $arguments); 65 | elseif(count($arguments) == 3) 66 | return call_user_func_array(array ($this,'identifierByPath'), $arguments); 67 | } 68 | } 69 | /* 70 | Changes the authenticated user, and test the authentication 71 | NOTE:Wrap in try/catch 72 | */ 73 | function changeAuth($username, $password) 74 | { 75 | $this->auth = array ('username' => $username, 'password' => $password ); 76 | $this->testAuth(); 77 | } 78 | /* 79 | Tests authentication using listSites() 80 | Throws an exception on failure 81 | */ 82 | private function testAuth() 83 | { 84 | if(!$this->result($this->listSites())) 85 | throw new Exception('Invalid Username/Password'); 86 | } 87 | /* 88 | Return boolean on $reply->success 89 | */ 90 | function result($reply) 91 | { 92 | return ($reply->success == "true"); 93 | } 94 | /* 95 | Builds path based identifier 96 | */ 97 | function identifierByPath($type, $path, $siteName) 98 | { 99 | return array( 100 | 'path' => array( 101 | 'path' => $path, 102 | 'siteName' => $siteName), 103 | 'type' => $type 104 | ); 105 | } 106 | /* 107 | Builds id based identifier 108 | */ 109 | function identifierById($type, $id) 110 | { 111 | return array( 112 | 'id' => $id, 113 | 'type' => $type 114 | ); 115 | } 116 | /* 117 | Builds single ACL 118 | */ 119 | function createACL($name, $level = 'read', $type = 'group') 120 | { 121 | return array( 122 | 'name' => $name, 123 | 'level' => $level, 124 | 'type' => $type 125 | ); 126 | } 127 | /* 128 | Returns list of sites 129 | */ 130 | function listSites() 131 | { 132 | $params = array ('authentication' => $this->auth); 133 | $reply = $this->client->listSites($params); 134 | return $reply->listSitesReturn; 135 | } 136 | /* 137 | Returns list of subscribers 138 | */ 139 | function listSubscribers($identifier) 140 | { 141 | $params = array ('authentication' => $this->auth, 'identifier' => $identifier); 142 | $reply = $this->client->listSubscribers($params); 143 | return $reply->listSubscribersReturn; 144 | } 145 | /* 146 | Returns readReturn from identifier 147 | */ 148 | function read($identifier) 149 | { 150 | $params = array ('authentication' => $this->auth, 'identifier' => $identifier); 151 | $reply = $this->client->read($params); 152 | return $reply->readReturn; 153 | } 154 | /* 155 | Returns readWorkflowSettingsReturn from identifier 156 | */ 157 | function readWorkflowSettings($identifier) 158 | { 159 | $params = array ('authentication' => $this->auth, 'identifier' => $identifier); 160 | $reply = $this->client->readWorkflowSettings($params); 161 | return $reply->readWorkflowSettingsReturn; 162 | } 163 | /* 164 | Returns readAccessRightsReturn from identifier 165 | */ 166 | function readAccessRights($identifier) 167 | { 168 | $params = array ('authentication' => $this->auth, 'identifier' => $identifier); 169 | $reply = $this->client->readAccessRights($params); 170 | return $reply->readAccessRightsReturn; 171 | } 172 | /* 173 | Returns searchReturn from identifier 174 | */ 175 | function search($searchInfo) 176 | { 177 | $params = array ('authentication' => $this->auth, 'searchInformation' => $searchInfo); 178 | $reply = $this->client->search($params); 179 | return $reply->searchReturn; 180 | } 181 | /* 182 | Returns editReturn from identifier 183 | */ 184 | function edit($asset) 185 | { 186 | $params = array ('authentication' => $this->auth, 'asset' => $asset); 187 | $reply = $this->client->edit($params); 188 | return $reply->editReturn; 189 | } 190 | /* 191 | Returns editWorkflowSettingsReturn from identifier 192 | */ 193 | function editWorkflowSettings($workflowSettings, $childrenInherit, $childrenRequire) 194 | { 195 | $params = array ('authentication' => $this->auth, 'workflowSettings' => $workflowSettings, 'applyInheritWorkflowsToChildren' => $childrenInherit, 'applyRequireWorkflowToChildren' => $childrenRequire); 196 | $reply = $this->client->editWorkflowSettings($params); 197 | return $reply->editWorkflowSettingsReturn; 198 | } 199 | /* 200 | Returns editAccessRightsReturn from identifier 201 | */ 202 | function editAccessRights($acls, $children) 203 | { 204 | $params = array ('authentication' => $this->auth, 'accessRightsInformation' => $acls, 'applyToChildren' => $children); 205 | $reply = $this->client->editAccessRights($params); 206 | return $reply->editAccessRightsReturn; 207 | } 208 | /* 209 | Returns moveReturn from identifier 210 | */ 211 | function move($identifier, $destIdentifier, $newName, $doWorkflow = false) 212 | { 213 | $params = array ('authentication' => $this->auth, 'identifier' => $identifier, 'moveParameters' => array('destinationContainerIdentifier' => $destIdentifier, 'newName' => $newName, 'doWorkflow' => $doWorkflow)); 214 | $reply = $this->client->move($params); 215 | return $reply->moveReturn; 216 | } 217 | /* 218 | Returns createReturn from identifier 219 | */ 220 | function create($asset) 221 | { 222 | $params = array ('authentication' => $this->auth, 'asset' => $asset); 223 | $reply = $this->client->create($params); 224 | return $reply->createReturn; 225 | } 226 | /* 227 | Returns copyReturn from identifier 228 | */ 229 | function copy($identifier, $destIdentifier, $newName) 230 | { 231 | $params = array ('authentication' => $this->auth, 'identifier' => $identifier, 'copyParameters' => array('destinationContainerIdentifier' => $destIdentifier, 'newName' => $newName, 'doWorkflow' => false)); 232 | $reply = $this->client->copy($params); 233 | return $reply->copyReturn; 234 | } 235 | /* 236 | Returns deleteReturn from identifier 237 | */ 238 | function delete($identifier) 239 | { 240 | $params = array ('authentication' => $this->auth, 'identifier' => $identifier); 241 | $reply = $this->client->delete($params); 242 | return $reply->deleteReturn; 243 | } 244 | /* 245 | Returns publishReturn from identifier 246 | */ 247 | function publish($identifier, $destIdentifiers = false, $unpublish = false) 248 | { 249 | $publishInformation = array 250 | ( 251 | 'identifier' => $identifier, 252 | 'unpublish' => $unpublish 253 | ); 254 | if($destIdentifiers) 255 | { 256 | if(is_array($destIdentifiers)) 257 | $publishInformation['destinations'] = $destIdentifiers; 258 | else 259 | $publishInformation['destinations'] = array($destIdentifiers); 260 | } 261 | $params = array ('authentication' => $this->auth, 'publishInformation' => $publishInformation); 262 | $reply = $this->client->publish($params); 263 | return $reply->publishReturn; 264 | } 265 | /* 266 | For converting the multi-dimensional object to a multi-dimensional array 267 | */ 268 | function objectToArray($object) 269 | { 270 | if (is_object($object)) 271 | $object = get_object_vars($object); 272 | if (is_array($object)) 273 | return array_map(array ($this,'objectToArray'), $object); 274 | else 275 | return $object; 276 | } 277 | /* 278 | For converting the a multi-dimensional array to a multi-dimensional object 279 | */ 280 | function arrayToObject($array) 281 | { 282 | if (is_array($array) && (bool)count(array_filter(array_keys($array), 'is_string'))) 283 | return (object) array_map(array ($this,'arrayToObject'), $array); 284 | elseif(is_array($array) && !(bool)count(array_filter(array_keys($array), 'is_string'))) 285 | { 286 | $temp = array(); 287 | foreach($array as $arr) 288 | { 289 | if(is_array($arr)) 290 | $temp[] = (object) array_map(array ($this,'arrayToObject'), $arr); 291 | else 292 | $temp[] = $arr; 293 | } 294 | return $temp; 295 | } 296 | else 297 | return $array; 298 | } 299 | /* 300 | For checking values in array/object 301 | */ 302 | function test($arr) 303 | { 304 | echo "
";
305 | 		print_r($arr);
306 | 		echo "
"; 307 | } 308 | } 309 | ?> 310 | --------------------------------------------------------------------------------