Example #1
0
 function addToFolderAction()
 {
     $targetGuid = $this->_getParam('targetGuid') ? $this->_getParam('targetGuid') : '';
     $currentGuid = $this->_getParam('folderGuid') ? $this->_getParam('folderGuid') : '';
     $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
     $tblCatalogFolder = new Pandamp_Modules_Dms_Catalog_Model_CatalogFolder();
     if (empty($currentGuid) || $currentGuid == 'root') {
         $this->view->success = false;
         $this->view->error = "Can't move ROOT";
     } else {
         $newRow = $tblFolder->createRow();
         $newContent = $tblCatalogFolder->createRow();
         try {
             $newRow->copy($targetGuid, $currentGuid);
             $this->view->success = true;
             $this->view->message = "Copy to Folder Success";
         } catch (Exception $e) {
             $this->view->success = false;
             $this->view->error = $e->getMessage();
         }
     }
 }
 function saveAction()
 {
     $parentGuid = $this->_getParam('parentGuid') ? $this->_getParam('parentGuid') : '';
     $guid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $title = $this->_getParam('title') ? $this->_getParam('title') : '';
     $description = $this->_getParam('description') ? $this->_getParam('description') : '';
     $type = $this->_getParam('type') ? $this->_getParam('type') : '';
     $viewOrder = $this->_getParam('viewOrder') ? $this->_getParam('viewOrder') : 0;
     $cmsParams = $this->_getParam('cmsParams') ? $this->_getParam('cmsParams') : '';
     $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
     if (empty($guid)) {
         if (empty($parentGuid)) {
             throw new Zend_Exception('parentGuid must be supplied!');
         }
         $newRow = $tblFolder->createRow();
         $newRow->parentGuid = $parentGuid;
         $newRow->title = $title;
         $newRow->description = $description;
         $newRow->type = $type;
         $newRow->viewOrder = $viewOrder;
         $newRow->cmsParams = $cmsParams;
         $newRow->save();
     } else {
         $rowset = $tblFolder->find($guid);
         if (count($rowset)) {
             $row = $rowset->current();
             $row->title = $title;
             $row->description = $description;
             $row->type = $type;
             $row->viewOrder = $viewOrder;
             $row->cmsParams = $cmsParams;
             $row->save();
         }
     }
 }