Exemple #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();
 }
     }
     $signature->signerName = $_POST['signerName'];
     $signature->signatureTypeID = $_POST['signatureTypeID'];
     $signature->documentID = $_POST['documentID'];
     $signature->signatureDate = $signatureDate;
     try {
         $signature->save();
         echo "Document Saved Successfully.";
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     break;
 case 'deleteSignature':
     $signature = new Signature(new NamedArguments(array('primaryKey' => $_GET['signatureID'])));
     try {
         $signature->delete();
         echo "Signature Deleted Successfully.";
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     break;
     //add/update expression
 //add/update expression
 case 'submitExpression':
     //if expressionID is sent then this is an update
     if (isset($_POST['expressionID']) && $_POST['expressionID'] != '') {
         $expressionID = $_POST['expressionID'];
         $expression = new Expression(new NamedArguments(array('primaryKey' => $expressionID)));
     } else {
         $expression = new Expression();
         //default production use (terms tool indicator) to off if this is an add, otherwise we leave it alone