示例#1
0
 public function removeLicense()
 {
     //delete all documents and associated expressions and SFX providers
     $document = new Document();
     foreach ($this->getDocuments() as $document) {
         //delete all expressions and expression notes
         $expression = new Expression();
         foreach ($document->getExpressions() as $expression) {
             $expressionNote = new ExpressionNote();
             foreach ($expression->getExpressionNotes() as $expressionNote) {
                 $expressionNote->delete();
             }
             $expression->removeQualifiers();
             $expression->delete();
         }
         $sfxProvider = new SFXProvider();
         foreach ($document->getSFXProviders() as $sfxProvider) {
             $sfxProvider->delete();
         }
         $signature = new Signature();
         foreach ($document->getSignatures() as $signature) {
             $signature->delete();
         }
         $document->delete();
     }
     //delete all attachments
     $attachment = new Attachment();
     foreach ($this->getAttachments() as $attachment) {
         $attachmentFile = new AttachmentFile();
         foreach ($attachment->getAttachmentFiles() as $attachmentFile) {
             $attachmentFile->delete();
         }
         $attachment->delete();
     }
     $this->delete();
 }
     $attachment = new Attachment(new NamedArguments(array('primaryKey' => $_GET['attachmentID'])));
     //first delete attachments
     foreach ($attachment->getAttachmentFiles() as $attachmentFile) {
         $attachmentFile->delete();
     }
     try {
         $attachment->delete();
         echo "Attachment successfully deleted";
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     break;
 case 'deleteAttachmentFile':
     $attachmentFile = new AttachmentFile(new NamedArguments(array('primaryKey' => $_GET['attachmentFileID'])));
     try {
         $attachmentFile->delete();
         echo "Attachment file successfully deleted";
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     break;
     //updates license status when a new one is selected in dropdown box
 //updates license status when a new one is selected in dropdown box
 case 'updateStatus':
     $licenseID = $_GET['licenseID'];
     $statusID = $_GET['statusID'];
     $statusDate = date('Y-m-d H:i:s');
     //update license
     $license = new License(new NamedArguments(array('primaryKey' => $_GET['licenseID'])));
     $license->statusID = $statusID;
     $license->statusDate = $statusDate;