andre 7 месяцев назад
Родитель
Сommit
4a0191ead1
1 измененных файлов с 44 добавлено и 8 удалено
  1. 44 8
      siteBuilder.php

+ 44 - 8
siteBuilder.php

@@ -39,25 +39,61 @@ function siteBuilder_MetaData() {
 
 function siteBuilder_ConfigOptions() {
 	siteBuilderCreateTables();
+	$api = new SiteProApiClient('https://site.pro/', 'apikey0', '993yVHwC05TLsx2JI2XFlAhkkPUxR6JbQUYbI.a5HiRtmNV9');
+
+	try {
+		// this call is used to open builder, so you need to set correct parameters to represent users website you want to open
+		// this data usually comes from your user/hosting manager system
+		$res = $api->remoteCall('api/builder/plans', array(
+			'action' => 'read',
+			'brandId' => '852604',
+			'builderPlan' => 'ThurBuilder'
+		));
+		if (!$res || !is_object($res)) {
+			logModuleCall(
+				'siteBuilder',
+				__FUNCTION__,
+				$params,
+				'Error: Response format error',
+				$res
+				);
+			return 'Error: Response format error';
+		} else {
+			logModuleCall(
+				'siteBuilder',
+				__FUNCTION__,
+				$params,
+				'Debug',
+				$res
+				);
+		}
+	}  catch (\Exception $e) {
+		logModuleCall(
+			'siteBuilder',
+			__FUNCTION__,
+			$params,
+			'Error: Request error',
+			$e->getMessage()
+			);
+		return 'Error: Request error';
+	}
     return ["BuilderURL" => [
 				"FriendlyName" => "Builder URL", # Full Builder URL (prefix//hostname:port/)
 				"Type" => "text", # Text Box
 				"Size" => "25", # Defines the Field Width
 				"Description" => "Full Builder URL (prefix//hostname:port/)",
 				"Default" => "https://builder.thurdata.ch/",
-			],
-			"HostingPlanID" => [
+			], [
 				"FriendlyName" => "Hosting Plan ID", 
 				"Type" => "text", # Text Box
-				"Size" => "10", # Defines the Field Width
+				"Size" => "25", # Defines the Field Width
 				"Description" => "Set the hostingPlan ID for this Product",
-				"Default" => "0",
-			],
-			"quotaConfig" => [
+				"Default" => "https://builder.thurdata.ch/",
+			], [
 				"FriendlyName" => "Quota in MB", 
 				"Type" => "text", # Text Box
-				"Size" => "10", # Defines the Field Width
-				"Description" => "Set the Quota matching Your HostingPlan (MB)",
+				"Size" => "25", # Defines the Field Width
+				"Description" => "Set the Quoat matching Your HostingPlan (MB)",
 				"Default" => "512",
 			]
 		];