Example #1
0
 /**
  * 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);
     }
 }
Example #2
0
 /**
  * hasDisplayTitle 
  * @param integer $intFileId
  * @return boolean
  * @author Thomas Schedler <*****@*****.**>   
  */
 public function hasDisplayTitle($intFileId)
 {
     $this->core->logger->debug('core->models->Model_Files->hasDisplayTitle(' . $intFileId . ')');
     try {
         $this->getFileTable();
         if ($intFileId != '' && $intFileId > 0) {
             $objSelect = $this->objFileTable->select();
             $objSelect->setIntegrityCheck(false);
             $objSelect->from('files', array('id'));
             $objSelect->join('fileTitles', 'fileTitles.idFiles = files.id AND fileTitles.isDisplayTitle = 1', array('title'));
             $objSelect->where('files.id = ?', $intFileId);
             $objRowset = $this->objFileTable->fetchAll($objSelect);
             return count($objRowset) > 0 ? true : false;
         }
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }