Skip to content

Commit

Permalink
Add AdobeConnectSco->move()
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Reishus committed Aug 16, 2012
1 parent 62c2b4e commit 8e7e854
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
25 changes: 23 additions & 2 deletions models/adobe_connect_sco.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,30 @@ public function delete($id = 0) {
return true;
}
return false;

}

/**
* Moves an SCO $sco_id to $folder_id
**/
public function move($sco_id, $folder_id) {
if (empty($sco_id)) {
$sco_id = $this->id;
}
if (empty($sco_id) || empty($folder_id)) {
return false;
}
$this->request['action'] = "sco-move";
$this->request['sco-id'] = $sco_id;
$this->request['folder-id'] = $folder_id;
$db =& ConnectionManager::getDataSource($this->useDbConfig);
$response = $db->request($this);
if (!empty($response)) {
return true;
}
if (isset($this->response['Status']['code']) && $this->response['Status']['code']=="no-data") {
return true;
}
return false;
}
/**
* Custom Find: akin to 'first', requires ID for input. see read()
* $this->AdobeConnectSco->find('info', 12345);
Expand Down
1 change: 1 addition & 0 deletions readme.textile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Once initilized, you can use it like any other Model. There are several exposed
* @$this->AdobeConnectSco->find('searchcontent', 'welcome training');@
* @$this->AdobeConnectSco->find('searchcontent', array('query' => 'welcome training', 'conditions' => array('type' => 'content')));@
* @$this->AdobeConnectSco->find('path', $sco_id);@
* @$this->AdobeConnectSco->move($sco_id, $folder_id;@
* @$this->AdobeConnectPrincipal->save();@
* @$this->AdobeConnectPrincipal->delete();@
* @$this->AdobeConnectPrincipal->find('search', 'my login');@
Expand Down
3 changes: 3 additions & 0 deletions tests/cases/models/adobe_connect_sco.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,8 @@ function testFindContentsSco() {
function testFindSearchcontentSco() {
// don't really know how to test this one... not terribly important to me either.
}
function testMoveSco() {
// create sco, move it, look for it in the new location, look for it in the old location
}
}
?>

0 comments on commit 8e7e854

Please sign in to comment.