- Added comprehensive AI Assistant system (aiassist/ directory): * Vector search and embedding capabilities * Typebot proxy integration * Elastic search functionality * Message classification and chat history * MCP proxy for external integrations - Implemented Court Status API (GetCourtStatus.php): * Real-time court document status checking * Integration with external court systems * Comprehensive error handling and logging - Enhanced S3 integration: * Improved file backup system with metadata * Batch processing capabilities * Enhanced error logging and recovery * Copy operations with URL fixing - Added Telegram contact creation API - Improved error logging across all modules - Enhanced callback system for AI responses - Extensive backup file storage with timestamps - Updated documentation and README files - File storage improvements: * Thousands of backup files with proper metadata * Fix operations for broken file references * Project-specific backup and recovery systems * Comprehensive file integrity checking Total: 26,461+ files added/modified including AWS SDK, vendor dependencies, and extensive backup system.
123 lines
4.2 KiB
PHP
123 lines
4.2 KiB
PHP
<?php
|
|
/*+**********************************************************************************
|
|
* The content of this file is subject to the ITS4GoogleCalendarSync license.
|
|
* ("License"); You may not use this file except in compliance with the License
|
|
* The Initial Developer of the Original Code is IT-Solutions4You s.r.o.
|
|
* Portions created by IT-Solutions4You s.r.o. are Copyright(C) IT-Solutions4You s.r.o.
|
|
* All Rights Reserved.
|
|
************************************************************************************/
|
|
|
|
if (file_exists('modules/WSAPP/WSAPPLogs.php')) {
|
|
require_once 'modules/WSAPP/WSAPPLogs.php';
|
|
}
|
|
require_once 'modules/WSAPP/synclib/controllers/SynchronizeController.php';
|
|
|
|
class ITS4YouGoogleCalendarSync_Calendar_Controller extends WSAPP_SynchronizeController
|
|
{
|
|
public $sourceType = 'Events';
|
|
public $userid;
|
|
|
|
public function getSourceConnector()
|
|
{
|
|
$connector = new ITS4YouGoogleCalendarSync_Vtiger_Connector();
|
|
$connector->setSynchronizeController($this);
|
|
$targetName = $this->targetConnector->getName();
|
|
|
|
if (empty($targetName)) {
|
|
throw new Exception('Target Name cannot be empty');
|
|
}
|
|
|
|
return $connector->setName('ITS4You_' . $targetName);
|
|
}
|
|
|
|
public function getSourceType()
|
|
{
|
|
return $this->sourceType;
|
|
}
|
|
|
|
public function getSyncType()
|
|
{
|
|
return WSAPP_SynchronizeController::WSAPP_SYNCHRONIZECONTROLLER_USER_SYNCTYPE;
|
|
}
|
|
|
|
/**
|
|
* Synchronize function use pull or push function in class ITS4YouGoogleCalendarSync_Vtiger_Connector
|
|
* Transform record between pull or push function to vtiger or google is in ITS4YouGoogleCalendarSync_Calendar_Connector
|
|
* Then again pull or push function
|
|
* @param string $type
|
|
* @return array
|
|
* @throws Exception
|
|
*/
|
|
public function getSynchronizedRecords($type = 'default')
|
|
{
|
|
$syncDirection = ITS4YouGoogleCalendarSync_Utils_Helper::getSyncDirectionForUser($this->user);
|
|
|
|
if ($syncDirection) {
|
|
$modules = [
|
|
'ITS4YouCalendar',
|
|
'Calendar',
|
|
'Events',
|
|
];
|
|
$push = [];
|
|
$pull = [];
|
|
|
|
foreach ($modules as $module) {
|
|
if (!ITS4YouGoogleCalendarSync_Utils_Helper::isModuleActive($module)) {
|
|
continue;
|
|
}
|
|
|
|
$this->setSourceType($module);
|
|
|
|
if ('afterSaveHandler' === $type) {
|
|
$calendarRecords = $this->synchronize(true, false, $syncDirection[1]);
|
|
} else {
|
|
$calendarRecords = $this->synchronize(true, $syncDirection[0], $syncDirection[1]);
|
|
}
|
|
|
|
$calendarPush = !empty($calendarRecords['push']) ? (array)$calendarRecords['push'] : [];
|
|
$calendarPull = !empty($calendarRecords['pull']) ? (array)$calendarRecords['pull'] : [];
|
|
|
|
$push = array_merge($push, $calendarPush);
|
|
$pull = array_merge($pull, $calendarPull);
|
|
}
|
|
|
|
$records = array(
|
|
'push' => $push,
|
|
'pull' => $pull,
|
|
);
|
|
} else {
|
|
$records = array();
|
|
}
|
|
|
|
return $records;
|
|
}
|
|
|
|
public function getTargetConnector()
|
|
{
|
|
$credentials = ITS4YouGoogleCalendarSync_UserCredentials_Model::getInstance($this->userid);
|
|
|
|
if (!$credentials) {
|
|
return false;
|
|
}
|
|
|
|
$oauth2Connector = new ITS4YouGoogleCalendarSync_Oauth2_Connector($credentials->getClientId(), $credentials->getClientSecret(), $this->userid);
|
|
$oauth2Connection = $oauth2Connector->authorize();
|
|
$connector = new ITS4YouGoogleCalendarSync_Calendar_Connector($oauth2Connection);
|
|
$connector->setSynchronizeController($this);
|
|
|
|
return $connector;
|
|
}
|
|
|
|
public function setSourceType($value)
|
|
{
|
|
vglobal('GOOGLE_SYNC_SOURCE_TYPE', $value);
|
|
|
|
$this->sourceType = $value;
|
|
}
|
|
|
|
public function __construct($user)
|
|
{
|
|
$this->userid = $user->getId();
|
|
parent::__construct($user);
|
|
}
|
|
} |