/** * makeStatisticsReportsCommand * * @param int stroagePid * @param string senderEmailAddress * @param string receiverEmailAddress list of receiver email addresses separated by comma * @return void */ public function makeStatisticsReportsCommand($storagePid, $senderEmailAddress = '', $receiverEmailAddress = '') { // do some init work... $this->initializeAction(); // abort if no storagePid is found if (!t3lib_utility_Math::canBeInterpretedAsInteger($storagePid)) { echo 'NO storagePid given. Please enter the storagePid in the scheduler task.'; exit(1); } // abort if no senderEmailAddress is found if (empty($senderEmailAddress)) { echo 'NO senderEmailAddress given. Please enter the senderEmailAddress in the scheduler task.'; exit(1); } // abort if no senderEmailAddress is found if (empty($receiverEmailAddress)) { echo 'NO receiverEmailAddress given. Please enter the receiverEmailAddress in the scheduler task.'; exit(1); } else { $receiverEmailAddress = explode(', ', $receiverEmailAddress); } // set storagePid to point extbase to the right repositories $configurationArray = array('persistence' => array('storagePid' => $storagePid)); $this->configurationManager->setConfiguration($configurationArray); // start the work... // 1. get the categories $categories = $this->categoryRepository->findAll(); foreach ($categories as $uid => $category) { $searchParameter['category'][$uid] = $uid; } // 2. get events of last month $startDateTime = strtotime('first day of last month 00:00:00'); $endDateTime = strtotime('last day of last month 23:59:59'); $allevents = $this->eventRepository->findAllByCategoriesAndDateInterval($searchParameter['category'], $startDateTime, $endDateTime); // used to name the csv file... $helper['nameto'] = strftime('%Y%m', $startDateTime); // email to all receivers... $out = $this->sendTemplateEmail($receiverEmailAddress, array($senderEmailAddress => 'WÖHRL Akademie - noreply'), 'Statistik Report Veranstaltungen: ' . ': ' . strftime('%x', $startDateTime) . ' - ' . strftime('%x', $endDateTime), 'Statistics', array('events' => $allevents, 'categories' => $categories, 'helper' => $helper, 'attachCsv' => TRUE, 'attachIcs' => FALSE)); return; }