コード例 #1
0
 /**
  * Gets the memberData from association.typo3.org and uses this data to
  * - update membership level and amount of caseStudies allowed in agency
  * - deactivates caseStudies if allowed amount is lower than activated caseStudies
  *
  * @return void
  */
 protected function updateAgenciesByMemberDataAction()
 {
     $memberDataUtility = $this->objectManager->get('Tx_Typo3Agencies_Utility_MemberData');
     $memberDataArray = $memberDataUtility->getAllMemberData();
     foreach ($memberDataArray as $memberData) {
         $agency = $this->agencyRepository->findOneByCode($memberData['code']);
         if ($agency) {
             /** @var $agency Tx_Typo3Agencies_Domain_Model_Agency */
             $approved = $memberData['isApproved'] == 1 ? true : false;
             $allowedCaseStudies = $approved ? (int) $memberData['caseStudies'] : 0;
             $agency->setApproved($approved);
             $agency->setCaseStudies($allowedCaseStudies);
             $agency->setMember($memberData['membershipLevel']);
             $references = $this->referenceRepository->findAllByAgency($agency);
             foreach ($references as $reference) {
                 /** @var $reference Tx_Typo3Agencies_Domain_Model_Reference */
                 if ($allowedCaseStudies <= 0) {
                     $reference->setDeactivated(true);
                 }
                 $allowedCaseStudies--;
                 $this->referenceRepository->update($reference);
             }
             $this->agencyRepository->update($agency);
         }
     }
     $GLOBALS['TSFE']->clearPageCacheContent_pidList($this->clearCachePids);
 }
コード例 #2
0
 /**
  * Initializes the current action
  *
  * @return void
  */
 public function initializeAction()
 {
     $this->agencyRepository = t3lib_div::makeInstance('Tx_Typo3Agencies_Domain_Repository_AgencyRepository');
     $this->referenceRepository = t3lib_div::makeInstance('Tx_Typo3Agencies_Domain_Repository_ReferenceRepository');
     $this->localization = t3lib_div::makeInstance('Tx_Extbase_Utility_Localization');
     $this->countryRepository = t3lib_div::makeInstance('Tx_Typo3Agencies_Domain_Repository_CountryRepository');
     $this->industryRepository = t3lib_div::makeInstance('Tx_Typo3Agencies_Domain_Repository_IndustryRepository');
     $this->categoryRepository = t3lib_div::makeInstance('Tx_Typo3Agencies_Domain_Repository_CategoryRepository');
     $this->revenueRepository = t3lib_div::makeInstance('Tx_Typo3Agencies_Domain_Repository_RevenueRepository');
     $this->showDeactivated = false;
     if ($GLOBALS['TSFE']->loginUser) {
         $uid = intval($GLOBALS['TSFE']->fe_user->user['uid']);
         $result = $this->agencyRepository->findByAdministrator($uid);
         if (count($result) > 0) {
             $this->administrator = $uid;
             $this->agency = $result->getFirst();
             if ($this->agency->getAdministrator() == $this->administrator) {
                 $this->showDeactivated = true;
             }
         }
     }
 }