예제 #1
0
 protected function hasNumerousDirectlyRelatedRecords(array &$record)
 {
     $creditsPackageDAO = new CreditsPackageDAO();
     $downloadDAO = new DownloadDAO();
     $clipboardDAO = new ClipboardDAO();
     $fileDAO = new FileDAO();
     $forumThreadDAO = new ForumThreadDAO();
     $forumPostDAO = new ForumPostDAO();
     $authorDAO = new AuthorDAO();
     return $creditsPackageDAO->getCountByForeignKey('userId', $record['id']) > 0 || $downloadDAO->getCountByForeignKey('userId', $record['id']) > 0 || $clipboardDAO->getCountByForeignKey('userId', $record['id']) > 0 || $fileDAO->getCountByRecord('user', $record['id']) > 0 || $forumThreadDAO->getCountByForeignKey('userId', $record['id']) > 0 || $forumPostDAO->getCountByForeignKey('userId', $record['id']) > 0 || $authorDAO->getCountByForeignKey('userId', $record['id']) > 0;
 }
 protected function checkDataConsistency()
 {
     $attachmentTypes = CoreConfig::get('FileUpload', 'swfUploadAttachmentTypes');
     $fileCategory = $this->fileRecord['fileCategory'];
     $recordType = $this->fileRecord['recordType'];
     if ($recordType == '_tmpRecord') {
         return;
     }
     $filePosition = $this->fileRecord['filePosition'];
     CoreUtils::checkConstraint(is_array($attachmentTypes[$recordType][$filePosition]));
     $minItems = $attachmentTypes[$recordType][$filePosition]['minItems'];
     if (!empty($minItems)) {
         $currentItems = $this->fileDAO->getCountByRecord($recordType, $this->baseRecord['id'], $fileCategory, $filePosition);
         if ($currentItems - 1 < $minItems) {
             $this->messageManager->addMessage('fileDeleteErrorTooFewAttachments');
             return;
         }
     }
 }
 protected function checkDataConsistency()
 {
     $attachmentTypes = CoreConfig::get('FileUpload', 'swfUploadAttachmentTypes');
     $fileCategory = $this->form->getField('fileCategory')->getValue();
     $recordType = $this->form->getField('recordType')->getValue();
     CoreUtils::checkConstraint($recordType != '_tmpRecord');
     $filePosition = $this->form->getField('filePosition')->getValue();
     $record = $this->getBaseRecord();
     if (empty($record)) {
         $this->messageManager->addMessage('fileUploadErrorInvalidBaseRecordId');
         return;
     }
     if (!$this->hasUserPermissionsForRecord($recordType, $record)) {
         $this->messageManager->addMessage('fileUploadErrorNoPermission');
         return;
     }
     if (!array_key_exists($recordType, $attachmentTypes)) {
         $this->messageManager->addMessage('fileUploadErrorInvalidRecordType');
         return;
     }
     if (!array_key_exists($filePosition, $attachmentTypes[$recordType])) {
         $this->messageManager->addMessage('fileUploadErrorInvalidFilePosition');
         return;
     }
     if ($fileCategory != $attachmentTypes[$recordType][$filePosition]['fileCategory']) {
         $this->messageManager->addMessage('fileUploadErrorWrongCategory');
         return;
     }
     $maxItems = $attachmentTypes[$recordType][$filePosition]['maxItems'];
     if (!empty($maxItems)) {
         $currentItems = $this->fileDAO->getCountByRecord($recordType, $record['id'], $fileCategory, $filePosition);
         if ($currentItems + 1 > $maxItems) {
             $this->messageManager->addMessage('fileUploadErrorTooManyAttachments');
             return;
         }
     }
 }
 protected function hasNumerousDirectlyRelatedRecords(array &$record)
 {
     $fileDAO = new FileDAO();
     return $fileDAO->getCountByRecord('subpage', $record['id']) > 0 || $this->getChildrenCount($record) > 0;
 }
 protected function hasNumerousDirectlyRelatedRecords(array &$record)
 {
     $fileDAO = new FileDAO();
     return $fileDAO->getCountByRecord('_tmpRecord', $record['id']) > 0;
 }