diff --git a/models/adobe_connect_sco.php b/models/adobe_connect_sco.php index dbf5c69..7bc8fe8 100755 --- a/models/adobe_connect_sco.php +++ b/models/adobe_connect_sco.php @@ -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); diff --git a/readme.textile b/readme.textile index d318c67..3e7199f 100755 --- a/readme.textile +++ b/readme.textile @@ -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');@ diff --git a/tests/cases/models/adobe_connect_sco.test.php b/tests/cases/models/adobe_connect_sco.test.php index a11a3af..95fc345 100755 --- a/tests/cases/models/adobe_connect_sco.test.php +++ b/tests/cases/models/adobe_connect_sco.test.php @@ -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 + } } ?>