public function __construct($id = 0)
 {
     parent::__construct($id = 0);
     $this->frequency = SponsorshipDashboardDateProvider::getProvider();
     $this->recalculateDateVariables();
     $this->fromYear = 2010;
     $this->startDate = $this->frequency->getGapiStartDate($this->lastDateUnits);
     $this->account = $this->getAccount();
 }
Beispiel #2
0
 public function fillFromSerializedData($serializedData)
 {
     Wikia::log(__METHOD__, 'Depreciated?');
     $deserializedData = unserialize($serializedData);
     parse_str($deserializedData[0], $mainSerie);
     if (isset($mainSerie[SponsorshipDashboardSource::SD_PARAMS_LASTUNITDATE])) {
         $this->setLastDateUnits((int) $mainSerie[SponsorshipDashboardSource::SD_PARAMS_LASTUNITDATE]);
     }
     if (isset($mainSerie['mainTitle'])) {
         $this->name = stripslashes($mainSerie['mainTitle']);
     }
     if (isset($mainSerie['mainDescription'])) {
         $this->description = stripslashes($mainSerie['mainDescription']);
     }
     if (isset($mainSerie['mainId'])) {
         $this->id = $mainSerie['mainId'];
     }
     if (isset($mainSerie[SponsorshipDashboardSource::SD_PARAMS_FREQUENCY])) {
         if (in_array($mainSerie[SponsorshipDashboardSource::SD_PARAMS_FREQUENCY], array(SponsorshipDashboardDateProvider::SD_FREQUENCY_MONTH, SponsorshipDashboardDateProvider::SD_FREQUENCY_DAY))) {
             $this->frequency = $mainSerie[SponsorshipDashboardSource::SD_PARAMS_FREQUENCY];
         } else {
             $this->frequency = SponsorshipDashboardDateProvider::SD_FREQUENCY_MONTH;
         }
     }
     foreach ($deserializedData as $serie) {
         parse_str($serie, $serie);
         $serie[SponsorshipDashboardSource::SD_PARAMS_FREQUENCY] = $this->frequency;
         if (isset($serie['sourceType']) && $this->isValidSource($serie['sourceType'])) {
             if ($this->newSource(SponsorshipDashboardSource::sourceClassFromDBKey($serie['sourceType']))) {
                 $this->tmpSource->fillFromArray($serie);
                 $this->acceptSource($this->getCitiesList($this->tmpSource));
             }
         }
     }
 }