createNewSignatureImage() публичный Метод

Creates a new ProtectedFile for the new signature image
public createNewSignatureImage ( $imageData, $fileId ) : ProtectedFile
$imageData
Результат ProtectedFile
Пример #1
0
 public function actionGetSignatureFromPortal()
 {
     if (Yii::app()->user->id) {
         // TODO: query the portal here:
         // TODO: get current unique ID for the user
         // TODO: query the portal with the current unique ID
         // TODO: if successfull save the signature as a ProtectedFile
         // from the portal we receive binary data:
         $user = User::model()->findByPk(Yii::app()->user->id);
         $portal_conn = new OptomPortalConnection();
         if ($portal_conn) {
             $signature_data = $portal_conn->signatureSearch(null, $user->generateUniqueCodeWithChecksum($this->getUniqueCodeForUser()));
             if (is_array($signature_data) && isset($signature_data["image"])) {
                 $signature_file = $portal_conn->createNewSignatureImage($signature_data["image"], Yii::app()->user->id);
                 if ($signature_file) {
                     $user->signature_file_id = $signature_file->id;
                     if ($user->save()) {
                         echo true;
                     }
                 }
             }
         }
     }
     echo false;
 }
Пример #2
0
 /**
  * @param $signatureFile
  * @param \Event $event
  * @throws \Exception
  */
 public function saveUserSignature($signatureFile, \Event $event)
 {
     $portal_connection = new \OptomPortalConnection();
     if ($new_file = $portal_connection->createNewSignatureImage($signatureFile, $event->id)) {
         if ($clinic_element = $this->getClinicalElementForEvent($event)) {
             $clinic_element->consultant_signature_file_id = $new_file->id;
             $clinic_element->consultant_id = \Yii::app()->user->id;
             $clinic_element->save();
         } else {
             throw new \Exception("Could not find clinical element for event " . $event->id);
         }
     } else {
         throw new \Exception("could not create event signature file");
     }
 }