コード例 #1
0
 private function setSettings()
 {
     if ($this->apikey) {
         $c = array();
         $api = new GetResponse($this->apikey);
         $this->campaigns = $api->getCampaigns();
         $this->active_on_registration = $this->getActiveOnRegistration();
         $this->old_webforms = array();
         $this->new_webforms = array();
         if (!empty($this->campaigns)) {
             $this->campaign_id = $this->getCampaignId();
             foreach ($this->campaigns as $v) {
                 $c[$v->campaignId] = $v->name;
             }
             $webforms = $api->getWebforms();
             foreach ($webforms as $id => $webform) {
                 if ('enabled' == $webform->status) {
                     $this->old_webforms[$webform->webformId] = $webform->name . ' (' . $c[$webform->campaign->campaignId] . ')';
                 }
             }
             $webforms = $api->getForms();
             foreach ($webforms as $id => $webform) {
                 if ('deleted' != $webform->status) {
                     $this->new_webforms[$webform->formId] = $webform->name . ' (' . $c[$webform->campaign->campaignId] . ')';
                 }
             }
         }
         $this->is_active = $this->isActive();
         $this->css_style = $this->getCssStyle();
         $this->webform = $this->getWebform($this->apikey);
         $this->webform_id = $this->webform->webform_id;
         if ($this->webform) {
             //for old webforms
             if ($this->web_form_generation_first == $this->webform->webform_generation) {
                 $webform = $api->getWebform($this->webform->webform_id);
             } else {
                 $webform = $api->getForm($this->webform->webform_id);
             }
             if (!empty($webform->scriptUrl)) {
                 $this->setWebformUrl($webform->scriptUrl);
             }
         }
     }
 }