updated new iframe
This commit is contained in:
@@ -38,6 +38,27 @@ class PreorderIFrameController extends mfBaseController
|
||||
self::returnJson(['clusters' => $this->preorderIFrameModel->getClusters($_SERVER['HTTP_X_FRAME_REFERRER'])]);
|
||||
}
|
||||
|
||||
public function getClusterInfoAction()
|
||||
{
|
||||
$clusterId = $this->request->get('cluster_id');
|
||||
if (!$clusterId) self::sendError("Cluster ID is required.");
|
||||
|
||||
$allClusters = $this->preorderIFrameModel->getClusters($_SERVER['HTTP_X_FRAME_REFERRER']);
|
||||
if (!$allClusters) self::sendError("No cluster found for the given ID.");
|
||||
|
||||
$clusterInfo = null;
|
||||
foreach ($allClusters as $cluster) {
|
||||
if ($cluster['id'] == $clusterId) {
|
||||
$clusterInfo = $cluster;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$preorderCampaign = new Preordercampaign($clusterInfo['campaign_id']);
|
||||
|
||||
self::returnJson(['iframe_consents' => json_decode($preorderCampaign->iframe_consents ?? '[]')]);
|
||||
}
|
||||
|
||||
public function findCityAction()
|
||||
{
|
||||
$allowedClusters = $this->preorderIFrameModel->getClusters($_SERVER['HTTP_X_FRAME_REFERRER']);
|
||||
|
||||
@@ -47,7 +47,7 @@ class PreorderIFrameModel extends mfBaseModel
|
||||
public function getClusters($frame_referrer): array
|
||||
{
|
||||
$query = "
|
||||
SELECT n.adb_netzgebiet_id as id, ng.name
|
||||
SELECT n.adb_netzgebiet_id as id, ng.name, pc.id as campaign_id, pc.name as campaign_name
|
||||
FROM thetool.Preordercampaign pc
|
||||
JOIN thetool.Network n ON pc.Network_id = n.id
|
||||
JOIN addressdb.Netzgebiet ng ON n.adb_netzgebiet_id = ng.id
|
||||
|
||||
Reference in New Issue
Block a user