/** * deleteFiles * @param string $strFiledIds * @author Cornelius Hansjakob <*****@*****.**> * @version 1.0 */ public function deleteFiles($strFileIds) { $this->core->logger->debug('core->models->Model_Files->deleteFiles(' . $strFileIds . ')'); try { $this->getFileTable(); $strTmpFileIds = trim($strFileIds, '[]'); $arrFileIds = array(); $arrFileIds = split('\\]\\[', $strTmpFileIds); $strWhere = ''; $intCounter = 0; if (count($arrFileIds) > 0) { foreach ($arrFileIds as $intFileId) { if ($intFileId != '') { $intCounter++; if ($intCounter == 1) { $strWhere .= $this->objFileTable->getAdapter()->quoteInto('id = ?', $intFileId); } else { $strWhere .= $this->objFileTable->getAdapter()->quoteInto(' OR id = ?', $intFileId); } } } } /** * delete files */ if ($strWhere != '') { return $this->objFileTable->delete($strWhere); } return false; } catch (Exception $exc) { $this->core->logger->err($exc); } }
/** * changeParentFolderId * @author Cornelius Hansjakob <*****@*****.**> * @version 1.0 */ public function changeParentFolderId($strFileIds, $intParentFolderId) { $this->core->logger->debug('core->models->Model_Files->changeParentFolderId(' . $strFileIds . ',' . $intParentFolderId . ')'); try { $this->getFileTable(); $strTmpFileIds = trim($strFileIds, '[]'); $arrFileIds = array(); $arrFileIds = split('\\]\\[', $strTmpFileIds); $strWhere = ''; $intCounter = 0; if (count($arrFileIds) > 0) { foreach ($arrFileIds as $intFileId) { $intCounter++; if ($intCounter == 1) { $strWhere .= $this->objFileTable->getAdapter()->quoteInto('id = ?', $intFileId); } else { $strWhere .= $this->objFileTable->getAdapter()->quoteInto(' OR id = ?', $intFileId); } } $this->objFileTable->update(array('idParent' => $intParentFolderId), $strWhere); } } catch (Exception $exc) { $this->core->logger->err($exc); } }