コード例 #1
0
ファイル: sample38.php プロジェクト: groupdocs/groupdocs-php
         $url = $url . "?uid=" . $userGuid;
         //Sign iframe URL
         $url = $signer->signUrl($url);
         break;
     }
 }
 //Check whether user was founded in collaborators list
 if (strpos($url, "?uid=")) {
     //If was set variable with URL for iframe
     F3::set("url", $url);
     //If user wasn't founded in collaborators list - add him to it
 } else {
     //Create array with entered email for SetAnnotationCollaborators method
     $arrayEmail = array($email);
     //Add user as collaborators for the document
     $setCollaborator = $antApi->SetAnnotationCollaborators($clientId, $fileId, "v2.0", $arrayEmail);
     if ($setCollaborator->status == "Ok") {
         // Check the result of the request
         if (isset($setCollaborator->result)) {
             //Add user GUID as "uid" parameter to the iframe URL
             $url = $url . "?uid=" . $userGuid;
             //Sign iframe URL
             $url = $signer->signUrl($url);
             // If request was successfull - set variables for template
             F3::set('result', $setCollaborator->result);
             F3::set("url", $url);
         }
     } else {
         throw new Exception($setCollaborator->error_message);
     }
 }
コード例 #2
0
ファイル: sample22.php プロジェクト: groupdocs/groupdocs-php
 $user->lastname = $lastName;
 $user->roles = $roles;
 //Set email as entered email
 $user->primary_email = $email;
 //Creating of new user. $clientId - user id, $firstName - entered first name, $user - object with new user info
 $newUser = $mgmtApi->UpdateAccountUser($clientId, $email, $user);
 //Check the result of the request
 if ($newUser->status == "Ok") {
     //### If request was successfull
     //Create Annotation api object
     $ant = new AntApi($apiClient);
     $ant->setBasePath($basePath);
     //Create array with entered email for SetAnnotationCollaborators method
     $arrayEmail = array($email);
     //Make request to Ant api for set new user as annotation collaborator
     $addCollaborator = $ant->SetAnnotationCollaborators($clientId, $fileId, "2.0", $arrayEmail);
     if ($addCollaborator->status == "Ok") {
         //Make request to Annotation api to receive all collaborators for entered file id
         $getCollaborators = $ant->GetAnnotationCollaborators($clientId, $fileId);
         if ($getCollaborators->status == "Ok") {
             //Set reviewers rights for new user. $newUser->result->guid - GuId of created user, $fileId - entered file id,
             //$getCollaborators->result->collaborators - array of collabotors in which new user will be added
             $setReviewer = $ant->SetReviewerRights($newUser->result->guid, $fileId, $getCollaborators->result->collaborators);
             if ($setReviewer->status == "Ok") {
                 //Generating iframe for template
                 if ($basePath == "https://api.groupdocs.com/v2.0") {
                     $iframe = 'https://apps.groupdocs.com//document-annotation2/embed/' . $fileId . '?&uid=' . $newUser->result->guid . '&download=true';
                     //iframe to dev server
                 } elseif ($basePath == "https://dev-api.groupdocs.com/v2.0") {
                     $iframe = 'https://dev-apps.groupdocs.com//document-annotation2/embed/' . $fileId . '?&uid=' . $newUser->result->guid . '&download=true ';
                     //iframe to test server
コード例 #3
0
ファイル: sample41.php プロジェクト: groupdocs/groupdocs-php
     //Get all collaborators for current document
     $getCollaborators = $antApi->GetAnnotationCollaborators($clientId, $fileGuId);
     if ($getCollaborators->status == "Ok") {
         //Loop for checking all collaborators
         for ($n = 0; $n < count($getCollaborators->result->collaborators); $n++) {
             //Check is user with entered email already in collaborators
             if ($getCollaborators->result->collaborators[$n]->primary_email == $email) {
                 $collaborator[$n] = $getCollaborators->result->collaborators[$n]->guid;
             }
         }
     }
 }
 //Check whether user was founded in collaborators list
 if (count($collaborator) < 2) {
     //Add user as collaborators for the document
     $setCollaborator = $antApi->SetAnnotationCollaborators($clientId, $fileGuId, "v2.0", $emailsArray);
     if ($setCollaborator->status == "Ok") {
         // Check the result of the request
         if (isset($setCollaborator->result)) {
             //Add user GUID as "uid" parameter to the iframe URL
             $url = $url . "?uid=" . $userGuid;
             //Sign iframe URL
             $url = $signer->signUrl($url);
             // If request was successfull - set variables for template
             F3::set('result', $setCollaborator->result);
             F3::set("url", $url);
         }
     } else {
         throw new Exception($setCollaborator->error_message);
     }
 } else {
コード例 #4
0
ファイル: sample13.php プロジェクト: groupdocs/groupdocs-php
                //If it isn't uploaded throw exception to template
            } else {
                throw new Exception($uploadResult->error_message);
            }
        } catch (Exception $e) {
            $error = 'ERROR: ' . $e->getMessage() . "\n";
            F3::set('error', $error);
        }
    }
    if ($fileGuId != "") {
        $fileId = $fileGuId;
        F3::set('fileId', $fileGuId);
    }
    // Make a request to Annotation API using clientId and fileId
    try {
        $response = $antApi->SetAnnotationCollaborators($clientId, $fileId, "v2.0", $collaborations);
        if ($response->status == "Ok") {
            // Check the result of the request
            if (isset($response->result)) {
                // If request was successfull - set annotations variable for template
                F3::set('result', $response->result);
            }
        } else {
            throw new Exception($response->error_message);
        }
    } catch (Exception $e) {
        $error = 'ERROR: ' . $e->getMessage() . "\n";
        F3::set('error', $error);
    }
}
// Process template