Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added workflow functions #6

Merged
merged 1 commit into from
Aug 7, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions cascade_soap_lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* PHP SOAP Library for Cascade
*
* Earl Fogel, September 2009
* Last Modified by Josh LaMar, August 2014
*/

class CascadeSoapClient {
Expand Down Expand Up @@ -90,6 +91,56 @@ function read($id) {
$this->response = $this->client->__getLastResponse() . "\n";
}
}


/* Read the workflow settings from an asset (e.g. folder) in Cascade with web services.
*/
function readWorkflowSettings($id) {

if (isset($id->id)) {
$identifier = array(
'type' => $id->type,
'id' => $id->id,
);
} else if (isset($id->siteId)) {
$identifier = array(
'type' => $id->type,
'path' => array( 'path' => $id->path, 'siteId' => $id->siteId ),
);
} else {
$identifier = array(
'type' => $id->type,
'path' => array( 'path' => $id->path, 'siteName' => $id->siteName ),
);
}
$params = array (
'authentication' => array(
'username' => $this->username,
'password' => $this->password,
),
'identifier' => $identifier,
);

try {
/* Pass the parameters to the PHP SOAP client. */
$this->success = false;
$this->response = $this->client->readWorkflowSettings($params);

if ($this->response->readWorkflowSettingsReturn->success == 'true') {
$type = $id->type;
$this->asset = $this->response->readWorkflowSettingsReturn->asset;
clean_asset($this->asset);
$this->success = true;
}

} catch (Exception $e) {

}
if ($this->success != true) {
$this->response = $this->client->__getLastResponse() . "\n";
}
}



/* Add an asset (page, file, folder, ...) to Cascade with web services.
Expand Down Expand Up @@ -167,6 +218,41 @@ function edit($asset) {
$this->response = $this->client->__getLastResponse() . "\n";
}
}

/* Update a folder's workflow settings in Cascade with web services.
* The asset's information should be stored in an associative array, $asset.
*/
function editWorkflowSettings($workflowSettings, $applyInheritWorkflowsToChildren, $applyRequireWorkflowToChildren) {

/* Construct the parameters for editting the workflow
*/
$params =
array (
'authentication' => array(
'username' => $this->username,
'password' => $this->password,
),
'workflowSettings' => $workflowSettings,
'applyInheritWorkflowsToChildren' => $applyInheritWorkflowsToChildren,
'applyRequireWorkflowToChildren' => $applyRequireWorkflowToChildren,
);

try {
$this->success = false;
$this->response = $this->client->editWorkflowSettings($params);

if ($this->response->editWorkflowSettingsReturn->success == 'true') {
$this->success = true;
}

} catch (Exception $e) {

}
if ($this->success != true) {
$this->response = $this->client->__getLastResponse() . "\n";
}
}



/*
Expand Down