Пример #1
0
 /**
  * Delete PMGmail integration labels getting the list of labels in an email account.
  * @param string $mail User mail adress.
  *
  */
 public function deletePMGmailLabels($mail)
 {
     require_once PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.pmGoogleApi.php";
     $pmGoogle = new PMGoogleApi();
     $pmGoogle->setUser($mail);
     $pmGoogle->setScope('https://www.googleapis.com/auth/gmail.modify');
     $client = $pmGoogle->serviceClient();
     $service = new Google_Service_Gmail($client);
     $count = 0;
     $listlabels = $this->listLabels($service);
     foreach ($listlabels as $label) {
         if ($label->getName() == '* Inbox' || $label->getName() == '* Participated' || $label->getName() == '* Unassigned' || $label->getName() == '* Draft' || $label->getName() == '* Inbox' || $label->getName() == '*-- ProcessMaker --*' || $label->getName() == '* Paused') {
             $oresp = $this->deleteLabel($service, 'me', $label->getId());
             $count++;
         }
     }
     return $count . ' labels successfully deleted.';
 }
Пример #2
0
 /**
  * @param $httpData
  */
 public function testConfigPmGmail($httpData)
 {
     G::LoadClass("pmGoogleApi");
     $pmGoogle = new PMGoogleApi();
     $result = new stdClass();
     $result->typeAuth = empty($httpData->typeAuth) ? $pmGoogle->getTypeAuthentication() : $httpData->typeAuth;
     if ($result->typeAuth == 'webApplication') {
         $result->pathFileJson = empty($_FILES['file_json']['tmp_name']) ? PATH_DATA_SITE . $pmGoogle->getAccountJson() : $_FILES['file_json']['tmp_name'];
     } else {
         $result->emailServiceAccount = empty($httpData->email_service_account) ? $pmGoogle->getServiceAccountEmail() : $httpData->email_service_account;
         $result->pathServiceAccountP12 = empty($_FILES['file_p12']['tmp_name']) ? PATH_DATA_SITE . $pmGoogle->getserviceAccountP12() : $_FILES['file_p12']['tmp_name'];
     }
     print G::json_encode($pmGoogle->testService($result));
 }