/** * * Save changes analytic setting * */ public function analyticSettingAction() { $this->view->disable(); if ($this->request->getPost('save')) { $obj = explode("_._", $this->request->getPost('selectView')); $trackingID = $obj[0]; $accountID = $obj[1]; if (Settings::setAnalyticTrackingID($trackingID)) { if (Settings::setAnalyticAccountID($accountID)) { $analytic = new Analytic(); $profile = $analytic->getViewInfo($accountID, $trackingID); if ($profile['state']) { if ($this->phanbook->saveConfig(['googleAnalytic' => $profile['profile']['trackingID']])) { if (Settings::setAnalyticProfileID($profile['profile']['profileID'])) { $this->flashSession->success(t('Save Analytic setting success!')); } } else { $this->flashSession->error(t('An error occured, We can\'t save tracking ID!')); } } else { $this->flashSession->error(t('An error occured, We can\'t find Profile information!')); } return $this->currentRedirect(); } } $this->flashSession->error(t('An error occured when save setting!')); } return $this->currentRedirect(); }