コード例 #1
0
ファイル: Refresher.php プロジェクト: Rademade/MedOptima
 public function refresh(Application_Model_Api_Google_AccessToken $accessToken)
 {
     $client = MedOptima_Service_Google_Config::getCalendarClient();
     $client->setAccessToken($accessToken->jsonSerialize());
     $client->refreshToken($accessToken->getRefreshToken());
     return (new MedOptima_Service_Google_AccessToken_Initializer())->updateFromEncodedData($accessToken, $client->getAccessToken());
 }
コード例 #2
0
ファイル: GoogleLink.php プロジェクト: Rademade/MedOptima
 public function __construct(Application_Model_Medical_Doctor $doctor)
 {
     parent::__construct('', '', '');
     $this->_doctor = $doctor;
     $this->_accessToken = Application_Model_Api_Google_AccessToken::getByDoctor($this->_doctor);
     if (!$this->_accessToken) {
         $this->_client = MedOptima_Service_Google_Config::getCalendarClient($this->_doctor->getId());
     }
 }
コード例 #3
0
ファイル: Calendar.php プロジェクト: Rademade/MedOptima
 public function __construct(Doctor $doctor)
 {
     $token = AccessToken::getByDoctor($doctor);
     if ($token instanceof AccessToken && !$token->isExpired()) {
         $client = MedOptima_Service_Google_Config::getCalendarClient();
         $client->setAccessToken($token->jsonSerialize());
         $this->_cal = new Google_CalendarService($client);
     }
     return $this;
 }
コード例 #4
0
ファイル: Account.php プロジェクト: Rademade/MedOptima
 public function linkDoctorAccount(Doctor $doctor)
 {
     $token = AccessToken::getByDoctor($doctor);
     if (!$token instanceof AccessToken) {
         $token = AccessToken::create();
         $token->setDoctor($doctor);
     }
     $client = MedOptima_Service_Google_Config::getCalendarClient();
     if ($this->_request->getParam('code')) {
         $client->authenticate($this->_request->getParam('code'));
         (new MedOptima_Service_Google_AccessToken_Initializer())->updateFromEncodedData($token, $client->getAccessToken());
     }
     $token->save();
     return true;
 }