예제 #1
0
 /**
  * @return bool
  */
 public function execute()
 {
     $zeroResults = array();
     $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->persistenceManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager');
     $this->storeRepository = $objectManager->get('Aijko\\StoreLocator\\Domain\\Repository\\StoreRepository');
     $extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['store_locator']);
     $stores = $this->storeRepository->findAllStoresWithoutLatLong($this->storagePid);
     foreach ($stores as $store) {
         try {
             $data = \Aijko\StoreLocator\Utility\GoogleUtility::getLatLongFromAddress($store->getAddress(), $extensionConfiguration['googleApiKey']);
             if (isset($data['ZERO_RESULTS'])) {
                 $zeroResults[] = $data['ZERO_RESULTS'];
                 $store->setHidden(TRUE);
             } else {
                 $store->setLatitude($data['latitude']);
                 $store->setLongitude($data['longitude']);
             }
             $this->storeRepository->update($store);
             sleep(2);
             // Usage limits exceeded - https://developers.google.com/maps/documentation/business/articles/usage_limits
         } catch (\Aijko\StoreLocator\Task\Store\GoogleException $e) {
             $this->addMessage($e->getMessage(), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
             return FALSE;
         }
     }
     $this->addMessage('Bei folgenden Adressen wurde der Datensatz deaktiviert da keine Lat/Long dazu vorhanden sind:<br> - ' . implode('<br> - ', $zeroResults), \TYPO3\CMS\Core\Messaging\FlashMessage::INFO);
     $this->persistenceManager->persistAll();
     return TRUE;
 }
 /**
  * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
  * @return void
  */
 public function cleanupCommand()
 {
     $entriesToCleanUp = $this->entryRepository->findEntriesToCleanUp($this->configuration->get(System\Configuration::CONF_SECONDS_TILL_RESET), $this->configuration->get(System\Configuration::CONF_MAX_FAILURES), $this->configuration->get(System\Configuration::CONF_RESTRICTION_TIME));
     foreach ($entriesToCleanUp as $entryToCleanUp) {
         $this->entryRepository->remove($entryToCleanUp);
     }
     $this->persistenceManager->persistAll();
 }
예제 #3
0
 /**
  * @test
  */
 public function addSimpleObjectTest()
 {
     $newBlogTitle = 'aDi1oogh';
     $newBlog = $this->objectManager->create('ExtbaseTeam\\BlogExample\\Domain\\Model\\Blog');
     $newBlog->setTitle($newBlogTitle);
     /** @var \ExtbaseTeam\BlogExample\Domain\Repository\BlogRepository $blogRepository */
     $this->blogRepository->add($newBlog);
     $this->persistentManager->persistAll();
     $newBlogCount = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'tx_blogexample_domain_model_blog', 'title = \'' . $newBlogTitle . '\'');
     $this->assertSame(1, $newBlogCount);
 }
 /**
  * @return \WHO\WhoShop\Domain\Model\Order
  * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
  */
 private function saveOrder()
 {
     $newOrder = new \WHO\WhoShop\Domain\Model\Order();
     $newOrder->setUser($this->frontendUserRepository->findById($GLOBALS['TSFE']->fe_user->user['uid']));
     $newOrder->setOrderDate(time());
     $newOrder->setState(1);
     $this->orderRepository->add($newOrder);
     $this->persistenceManager->persistAll();
     foreach ($this->basketHandler->getOrder() as $productUid => $orderParams) {
         if ($productUid == 'count') {
             continue;
         }
         $newOrderItem = new \WHO\WhoShop\Domain\Model\OrderItem();
         $newOrderItem->setOrderSize($orderParams['orderSize']);
         $newOrderItem->setorderValue($orderParams['orderValue']);
         DebuggerUtility::var_dump($productUid);
         $newOrderItem->addProduct($this->productRepository->findById($productUid)->getFirst());
         $this->orderItemRepository->add($newOrderItem);
         $this->persistenceManager->persistAll();
         $newOrder->addOrderItem($newOrderItem);
         $this->orderRepository->update($newOrder);
         $this->persistenceManager->persistAll();
     }
     return $newOrder;
 }
예제 #5
0
 /**
  * Some additional actions after profile creation
  *
  * @param User $user
  * @param string $action
  * @param string $redirectByActionName Action to redirect
  * @param bool $login Login after creation
  * @param string $status
  * @return void
  */
 public function finalCreate($user, $action, $redirectByActionName, $login = TRUE, $status = '')
 {
     // persist user (otherwise login is not possible if user is still disabled)
     $this->userRepository->update($user);
     $this->persistenceManager->persistAll();
     // login user
     if ($login) {
         $this->loginAfterCreate($user);
     }
     // send notify email to user
     $this->sendMail->send('createUserNotify', Div::makeEmailArray($user->getEmail(), $user->getFirstName() . ' ' . $user->getLastName()), array($this->settings['new']['email']['createUserNotify']['sender']['email']['value'] => $this->settings['settings']['new']['email']['createUserNotify']['sender']['name']['value']), 'Profile creation', array('user' => $user, 'settings' => $this->settings), $this->config['new.']['email.']['createUserNotify.']);
     // send notify email to admin
     if ($this->settings['new']['notifyAdmin']) {
         $this->sendMail->send('createNotify', Div::makeEmailArray($this->settings['new']['notifyAdmin'], $this->settings['new']['email']['createAdminNotify']['receiver']['name']['value']), Div::makeEmailArray($user->getEmail(), $user->getUsername()), 'Profile creation', array('user' => $user, 'settings' => $this->settings), $this->config['new.']['email.']['createAdminNotify.']);
     }
     // sendpost: send values via POST to any target
     Div::sendPost($user, $this->config, $this->cObj);
     // store in database: store values in any wanted table
     Div::storeInDatabasePreflight($user, $this->config, $this->cObj, $this->objectManager);
     // add signal after user generation
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'AfterPersist', array($user, $action, $this));
     // frontend redirect (if activated via TypoScript)
     $this->redirectByAction($action, $status ? $status . 'Redirect' : 'redirect');
     // go to an action
     $this->redirect($redirectByActionName);
 }
예제 #6
0
 /**
  * one (of likely many) loops of processing a given
  * chunk of events 
  * 
  * @param $events
  */
 protected function indexEvents($events)
 {
     foreach ($events as $event) {
         $this->indexer->update($event);
     }
     $this->persistenceManager->persistAll();
 }
 /**
  * One week, two weeks and one month before a panel, the teacher organizing the panel
  * is reminded of the upcoming panel.
  *
  * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
  */
 public function sendReminderForPanelsCommand()
 {
     $reminders = array('oneweek', 'twoweeks', 'onemonth');
     foreach ($reminders as $reminder) {
         $affectedPanels = $this->panelRepository->findPanelsWithinDateConstraintWithoutReminderEmailSent($reminder);
         $this->outputLine('Panels due in ' . $reminder . ': ' . count($affectedPanels));
         foreach ($affectedPanels as $panel) {
             /** @var $panel \Visol\EasyvoteEducation\Domain\Model\Panel */
             if (is_null($panel->getDate())) {
                 // If panel has not date, we don't send a reminder (obviously)
                 return TRUE;
             }
             $this->outputLine($panel->getDate()->format('Y-m-d') . ' | ' . $panel->getTitle() . ' | Sending reminder to ' . $panel->getCommunityUser()->getEmail());
             // Send reminder e-mail to teacher
             /** @var \Visol\Easyvote\Service\TemplateEmailService $templateEmail */
             $templateEmail = $this->objectManager->get('Visol\\Easyvote\\Service\\TemplateEmailService');
             $templateEmail->addRecipient($panel->getCommunityUser());
             $templateEmail->setTemplateName('panelReminder' . ucfirst($reminder) . 'Teacher');
             $templateEmail->setExtensionName('easyvote_education');
             $templateEmail->assign('panel', $panel);
             $templateEmail->enqueue();
             $setter = 'setReminder' . ucfirst($reminder) . 'Sent';
             $panel->{$setter}(TRUE);
             $this->panelRepository->update($panel);
             $this->persistenceManager->persistAll();
         }
     }
 }
예제 #8
0
 /**
  * Helper method for persisting blog
  */
 protected function updateAndPersistBlog()
 {
     /** @var \ExtbaseTeam\BlogExample\Domain\Repository\BlogRepository $blogRepository */
     $blogRepository = $this->objectManager->get('ExtbaseTeam\\BlogExample\\Domain\\Repository\\BlogRepository');
     $blogRepository->update($this->blog);
     $this->persistentManager->persistAll();
 }
 /**
  * Creates a new bookmark and forwards to show action
  *
  * @param Tx_PtExtlist_Domain_Model_Bookmark_Bookmark $bookmark
  */
 public function createAction(Tx_PtExtlist_Domain_Model_Bookmark_Bookmark $bookmark)
 {
     // Check whether user is allowed to create public bookmarks
     if ($this->request->hasArgument('isPublic') && $this->request->getArgument('isPublic') == '1') {
         if ($this->userIsAllowedToCreatePublicBookmarks()) {
             $bookmark->setIsPublic(true);
         } else {
             // TODO show some message, that user is not allowed to create public bookmarks
             $this->forward('show');
         }
     }
     // Check, whether user is allowed to create group bookmarks
     if ($this->request->hasArgument('feGroup') && $this->request->getArgument('feGroup') > 0) {
         if ($this->userIsAllowedToCreateGroupBookmarks()) {
             $bookmark->setFeGroup($this->request->getArgument('feGroup'));
         } else {
             $this->forward('show');
         }
     }
     $bookmark->setPid($this->settings['bookmarks']['bookmarksPid']);
     $this->bookmarkManager->addContentToBookmark($bookmark);
     $this->bookmarksRepository->add($bookmark);
     $this->persistenceManager->persistAll();
     $this->forward('show');
 }
 /**
  * @param EventDate            $date
  * @param RecurrenceCollection $recurrences
  */
 protected function mergeUpdatesWithExistingRecurrences(EventDate $date, RecurrenceCollection $recurrences)
 {
     $oldDates = $this->eventDateRepository->findRecurrencesByUid($date->getUid())->toArray();
     foreach ($recurrences as $recurrence) {
         $updated = false;
         $start = $recurrence->getStart();
         $end = $recurrence->getEnd();
         if ($start == $end) {
             $end = null;
         }
         foreach ($oldDates as $eKey => $old) {
             if ($old->getStart() == $start && $old->getEnd() == $end) {
                 $old->setIsFullDay($date->getIsFullDay());
                 $this->eventDateRepository->update($old);
                 unset($oldDates[$eKey]);
                 $updated = true;
                 break;
             }
         }
         if (!$updated) {
             $new = $this->cloneDateAsRecurrence($date, $start, $end);
             $this->eventDateRepository->add($new);
         }
     }
     foreach ($oldDates as $old) {
         $this->eventDateRepository->remove($old);
     }
     $this->persistenceManager->persistAll();
 }
예제 #11
0
 /**
  * Return data to the client and shudown
  *
  * @param string $content
  */
 protected function returnDataAndShutDown($content = '')
 {
     $this->persistenceManager->persistAll();
     \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
     echo $content;
     exit;
 }
예제 #12
0
 /**
  * Unsubscribe the given user from the given list.
  *
  * @param  \TYPO3\CMS\Extbase\Domain\Model\FrontendUser        $user User to unsubscribe from list
  * @param  \Tev\TevMailchimp\Domain\Model\Mlist                $list List to unsubscribe user from
  * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface       All lists the user is subscribed to
  */
 public function unsubscribeUserFromList(FrontendUser $user, Mlist $list)
 {
     $user = $this->castUser($user);
     $this->unsubscribeFromList($this->getEmailFromUser($user), $list);
     $list->removeFeUser($user);
     $this->mListRepo->update($list);
     $this->pm->persistAll();
 }
 /**
  * action create
  *
  * @param \Interain\Interform\Domain\Model\WeddingForm $newWeddingForm
  * @return void
  */
 public function createAction(\Interain\Interform\Domain\Model\WeddingForm $newWeddingForm)
 {
     $this->weddingFormRepository->add($newWeddingForm);
     $this->persistenceManager->persistAll();
     // Usercopy E-Mail versenden
     //	if($newWeddingForm->getMailcopy()){
     //	$this->sendEmail($newWeddingForm, 'Mail.html', $newWeddingForm->getMail(), $newWeddingForm->getVorname().' '.$newWeddingForm->getNachname());
     //	}
     // Admin E-Mail versenden
     if ($this->sendEmail($newWeddingForm, 'MailWedding.html', $this->settings['mailto_mail'], $this->settings['mailto_name'])) {
         $targetUri = $this->uriBuilder->reset()->setLinkAccessRestrictedPages(true)->setTargetPageUid($this->settings['page_success'])->setNoCache(true)->buildFrontendUri();
         $this->redirectToUri($targetUri, 0, 200);
     } else {
         $targetUri = $this->uriBuilder->reset()->setLinkAccessRestrictedPages(true)->setTargetPageUid($this->settings['page_error'])->setNoCache(true)->buildFrontendUri();
         $this->redirectToUri($targetUri, 0, 200);
     }
 }
예제 #14
0
 /**
  * Return data to the client and shudown
  * TODO: refactor this to a real javascript-and-nothing-else module?
  *
  * @param string $content
  */
 protected function returnDataAndShutDown($content = 'OK')
 {
     $this->persistenceManager->persistAll();
     $this->lifecycleManager->updateState(Tx_PtExtbase_Lifecycle_Manager::END);
     GeneralUtility::cleanOutputBuffers();
     echo $content;
     exit;
 }
예제 #15
0
 /**
  * Create new fileReference for later use
  * @param  integer $fileReferenceUid
  * @param  \TYPO3\CMS\Core\Resource\FileReference $fileUid
  * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference
  */
 protected function updateFileReference($fileReferenceUid, \TYPO3\CMS\Core\Resource\FileReference $falFileRefence)
 {
     $fileReference = $this->persistenceManager->getObjectByIdentifier($fileReferenceUid, 'TYPO3\\CMS\\Extbase\\Domain\\Model\\FileReference', FALSE);
     // Generate Core FileReference
     $fileReference->setOriginalResource($falFileRefence);
     // Persist
     $this->fileReferenceRepository->update($fileReference);
     return $fileReference;
 }
 /**
  * @return void
  */
 private function saveEntry()
 {
     if ($this->entry->getFailures() > 0) {
         $this->entry->setTstamp(time());
     }
     $this->entryRepository->add($this->entry);
     $this->persistenceManager->persistAll();
     if ($this->hasMaximumNumberOfFailuresReached($this->entry)) {
         $this->clientRestricted = true;
     }
 }
 /**
  * @param CoreFileReference $coreFileReference
  * @param int $resourcePointer
  * @return ExtbaseFileReference
  */
 protected function createFileReferenceFromFalFileReferenceObject(CoreFileReference $coreFileReference, $resourcePointer = null)
 {
     if ($resourcePointer === null) {
         /** @var $extbaseFileReference ExtbaseFileReference */
         $extbaseFileReference = $this->objectManager->get(ExtbaseFileReference::class);
     } else {
         $extbaseFileReference = $this->persistenceManager->getObjectByIdentifier($resourcePointer, ExtbaseFileReference::class, false);
     }
     $extbaseFileReference->setOriginalResource($coreFileReference);
     return $extbaseFileReference;
 }
예제 #18
0
 /**
  * Handle a successful unsubscription by updating the local database.
  *
  * @param  string $email    Email address that was unsubscribed
  * @param  string $mcListId Mailchimp list ID (remote)
  * @return void
  */
 private function unsubscribe($email, $mcListId)
 {
     $method = 'findOneBy' . $this->emailUtil->getFieldNameUpperCamel();
     $list = $this->mListRepo->findOneByMcListId($mcListId);
     $user = $this->feUserRepo->{$method}($email);
     if ($list && $user) {
         $list->removeFeUser($user);
         $this->mListRepo->update($list);
         $this->pm->persistAll();
     }
 }
예제 #19
0
 /**
  * @test
  */
 public function addObjectSetsDefinedLanguageTest()
 {
     $newBlogTitle = 'aDi1oogh';
     $newBlog = $this->objectManager->get('ExtbaseTeam\\BlogExample\\Domain\\Model\\Blog');
     $newBlog->setTitle($newBlogTitle);
     $newBlog->_setProperty('_languageUid', -1);
     /** @var \ExtbaseTeam\BlogExample\Domain\Repository\BlogRepository $blogRepository */
     $this->blogRepository->add($newBlog);
     $this->persistentManager->persistAll();
     $newBlogRecord = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('*', 'tx_blogexample_domain_model_blog', 'title = \'' . $newBlogTitle . '\'');
     $this->assertEquals(-1, $newBlogRecord['sys_language_uid']);
 }
예제 #20
0
 /**
  * Log user in
  *
  * @param User $user
  * @param $login
  * @throws IllegalObjectTypeException
  */
 protected function loginPreflight(User $user, $login)
 {
     if ($login) {
         // persist user (otherwise login may not be possible)
         $this->userRepository->update($user);
         $this->persistenceManager->persistAll();
         if ($this->config['new.']['login'] === '1') {
             UserUtility::login($user, $this->allConfig['persistence']['storagePid']);
             $this->addFlashMessage(LocalizationUtility::translate('login'), '', FlashMessage::NOTICE);
         }
     }
 }
예제 #21
0
 /**
  * @return \Aijko\Paypal\Domain\Model\Order
  */
 protected function storeAndGetOrder()
 {
     $orderObject = $this->objectManager->get('Aijko\\Paypal\\Domain\\Model\\Order');
     $orderObject->setPid($this->settings['storagePid']);
     $orderObject->setCrdate(time());
     $orderObject->setTxnid($this->txnIdentifier);
     $orderObject->setIdentifier($this->timeIdentifier . '_' . $this->txnIdentifier);
     $orderObject->setResponse($this->ipnListener->getTextReport());
     $this->orderRepository->add($orderObject);
     $this->persistenceManager->persistAll();
     return $orderObject;
 }
 /**
  * @param FalFileReference $falFileReference
  * @param int $resourcePointer
  * @return \Visol\Easyvote\Domain\Model\FileReference
  */
 protected function createFileReferenceFromFalFileReferenceObject(FalFileReference $falFileReference, $resourcePointer = null)
 {
     if ($resourcePointer === null) {
         /** @var $fileReference \Visol\Easyvote\Domain\Model\FileReference */
         $fileReference = $this->objectManager->get('Visol\\Easyvote\\Domain\\Model\\FileReference');
     } else {
         $fileReference = $this->persistenceManager->getObjectByIdentifier($resourcePointer, 'Visol\\Easyvote\\Domain\\Model\\FileReference', false);
     }
     $fileReference->setOriginalResource($falFileReference);
     $fileReference->_setProperty('_languageUid', -1);
     return $fileReference;
 }
예제 #23
0
 /** 
  * Actions to be done after a sign up process
  * 
  * @param \SLUB\Vk2\Domain\Model\User $user
  * @param bool $login Login after creation
  * @return void
  */
 public function afterSignupDo(\SLUB\Vk2\Domain\Model\User $user, $login = TRUE)
 {
     // persist user (otherwise login is not possible if user is still disabled)
     $this->userRepository->update($user);
     $this->persistenceManager->persistAll();
     // login user
     if ($login) {
         $this->loginAfterCreate($user);
     }
     // redirect
     $this->redirect('show', 'Main', NULL);
 }
예제 #24
0
 /**
  * add action - adds an author to the repository
  *
  * @param \Vendor\Guestbook\Domain\Model\Author $author
  */
 public function addAction(\Vendor\Guestbook\Domain\Model\Author $author)
 {
     $this->fillInAuthData($author);
     $author->setDisable(1);
     $this->authorRepository->add($author);
     $baseURL = $this->request->getBaseUri();
     $this->persistenceManager->persistAll();
     $emailConfirmationURL = $baseURL . $this->getControllerContext()->getUriBuilder()->reset()->uriFor('activate', array('author' => $author), 'Author', $this->getControllerContext()->getRequest()->getControllerExtensionName());
     $this->sendEmail($emailConfirmationURL);
     file_put_contents('./debug.txt', print_r("\n-----------------\n", true), FILE_APPEND);
     file_put_contents('./debug.txt', print_r($emailConfirmationURL, true), FILE_APPEND);
     $this->redirect('list', 'Comment', NULL, NULL);
 }
예제 #25
0
 /**
  * @return bool
  */
 public function execute()
 {
     $csvData = $this->getCsvData($this->csvPath);
     if (count($csvData) > 0) {
         $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
         $propertyMapper = $objectManager->get('TYPO3\\CMS\\Extbase\\Property\\PropertyMapper');
         $this->persistenceManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager');
         $this->storeRepository = $objectManager->get('Aijko\\StoreLocator\\Domain\\Repository\\StoreRepository');
         $this->countryRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\CountryRepository');
         if ($this->truncate) {
             // Remove all stores
             $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_storelocator_domain_model_store', 'pid = ' . $this->storagePid);
         }
         foreach ($csvData as $row) {
             $setCountry = FALSE;
             if (array_key_exists('country', $row)) {
                 $country = $this->countryRepository->findOneByIsoCodeA2($row['country']);
                 if ($country) {
                     $setCountry = TRUE;
                 }
                 unset($row['country']);
             }
             $store = $propertyMapper->convert($row, 'Aijko\\StoreLocator\\Domain\\Model\\Store');
             $address = \Aijko\StoreLocator\Utility\GoogleUtility::getFullAddressFromUserData($row);
             // Import with task:GeoTask
             #$data = \Aijko\StoreLocator\Utility\GoogleUtility::getLatLongFromAddress($address);
             #$store->setLatitude($data['latitude']);
             #$store->setLongitude($data['longitude']);
             $store->setAddress($address);
             $store->setPid($this->storagePid);
             if (TRUE === $setCountry) {
                 $store->setCountry($country);
             }
             $this->storeRepository->add($store);
         }
         $this->persistenceManager->persistAll();
     }
     return TRUE;
 }
 /**
  * @param \CIC\Cicregister\Domain\Model\FrontendUser $frontendUser
  * @return mixed
  */
 protected function createAndPersistUser(\CIC\Cicregister\Domain\Model\FrontendUser $frontendUser)
 {
     // add the user to the default group
     $defaultGroup = $this->frontendUserGroupRepository->findByUid($this->settings['defaults']['globalGroupId']);
     if ($defaultGroup instanceof \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup) {
         $frontendUser->addUsergroup($defaultGroup);
     }
     $this->decorateUser($frontendUser, 'created');
     // add the user to the repository
     $this->frontendUserRepository->add($frontendUser);
     $this->flashMessageContainer->add('Your account has been created.');
     // persist the user
     $this->persistenceManager->persistAll();
     return $this->doBehaviors($frontendUser, 'created', 'createConfirmation');
 }
 /**
  * action feeditAction
  * Bearbeiten eines bestehenden Datensatzes aus fremder Tabelle starten. 
  * Dazu Kopie in tx_nnfesubmit_domain_model_entry anlegen und zum Formular weiterleiten
  *
  * @return array
  */
 public function feeditAction($params)
 {
     $this->settings = $this->settingsUtility->getSettings();
     $uid = intval($params['uid']);
     $type = $params['type'];
     $settings = $this->settings[$type];
     $extName = $settings['extension'];
     // Prüfen, ob Datensatz in fremder Tabelle exisitert
     if (!($data = $this->tableService->getEntry($settings, $uid))) {
         return $this->anyHelper->addFlashMessage('Kein Eintrag gefunden', "In der Tabelle {$settings['tablename']} wurde kein Datensatz mit der uid={$uid} gefunden.", 'ERROR');
     }
     // Datensatz zum Bearbeiten anlegen
     if (!($entry = $this->entryRepository->getEntryForExt($uid, $type))) {
         $entry = $this->objectManager->get('\\Nng\\Nnfesubmit\\Domain\\Model\\Entry');
         $this->entryRepository->add($entry);
         $this->persistenceManager->persistAll();
         //$unique_filename = $this->basicFileFunctions->getUniqueName($file, 'uploads/tx_nnfesubmit/');
         //if (\TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move($files['tmp_name'][$k], $unique_filename)) {
     }
     // Media zurück in den Ordner uploads/tx_nnfesubmit kopieren
     $media = $settings['media'];
     foreach ($media as $k => $path) {
         if ($data[$k]) {
             $unique_filename = $this->basicFileFunctions->getUniqueName(trim(basename($data[$k])), 'uploads/tx_nnfesubmit/');
             \TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move($path . $data[$k], $unique_filename);
             if (!file_exists($unique_filename)) {
                 $this->anyHelper->addFlashMessage('Datei nicht kopiert', 'Die Datei ' . $data[$k] . ' konnte nicht kopiert werden.', 'WARNING');
             }
         }
     }
     //$entry->setFeUser( $GLOBALS['TSFE']->fe_user->user['uid'] );
     $entry->setCruserId($GLOBALS['TSFE']->fe_user->user['uid']);
     $entry->setSrcuid($uid);
     $entry->setExt($type);
     $entry->setData(json_encode($data));
     $this->entryRepository->update($entry);
     $this->persistenceManager->persistAll();
     $entryUid = $entry->getUid();
     $newAdminKey = '';
     if ($params['adminKey'] && $this->anyHelper->validateKeyForUid($uid, $params['adminKey'], 'admin')) {
         $newAdminKey = $this->anyHelper->createKeyForUid($entryUid, 'admin');
     }
     //http://adhok.99grad.de/index.php?id=17&id=17&nnf%5B193%5D%5Buid%5D=3&cHash=f14da214fc18a7f53b4da7342f3abe64&eID=nnfesubmit&action=feedit&type=nnfilearchive&uid=21&key=02bc7442
     $this->anyHelper->httpRedirect($settings['editPid'], array('nnf' => $params['nnf'], 'tx_nnfesubmit_nnfesubmit[key]' => $this->anyHelper->createKeyForUid($entryUid), 'tx_nnfesubmit_nnfesubmit[adminKey]' => $newAdminKey, 'tx_nnfesubmit_nnfesubmit[entry]' => $entryUid, 'tx_nnfesubmit_nnfesubmit[pluginUid]' => intval($params['pluginUid']), 'tx_nnfesubmit_nnfesubmit[returnUrl]' => $params['returnUrl']));
     //		\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($entry);
     //		$this->editAction( $entry->getUid() );
     die;
 }
 /**
  * Run importer
  *
  * @param int $limit number of sources to check
  */
 public function runCommand($limit = 1)
 {
     $importSources = $this->importSourceRepository->findSourcesToImport($limit);
     $importReport = array();
     if (isset($this->settings['filter']['searchFields']) && is_array($this->settings['filter']['searchFields'])) {
         $searchFields = $this->settings['filter']['searchFields'];
     } else {
         $searchFields = array('title', 'bodytext');
     }
     $this->outputLine();
     /** @var ImportSource $importSource */
     foreach ($importSources as $importSource) {
         $this->outputLine($importSource->getTitle());
         $this->outputDashedLine();
         $this->extractorService->setSource($importSource->getUrl());
         $this->extractorService->setMapping($importSource->getMapping());
         $items = $this->extractorService->getItems();
         foreach ($items as $item) {
             if ($this->importService->alreadyImported($importSource->getStoragePid(), $item->getGuid())) {
                 $this->outputLine('Already imported: ' . $item->getGuid());
             } elseif ($importSource->getFilterWords() && !$this->importService->matchFilter($item, $importSource->getFilterWords(), $searchFields)) {
                 $this->outputLine('Skipped: ' . $item->getGuid() . '; Filter mismatch');
             } else {
                 $this->importService->importItem($importSource, $item);
                 $this->outputLine('Imported: ' . $item->getGuid());
                 $importReport[] = $item->extractValue('title') . '; ' . $item->getGuid();
             }
         }
         if (!$items) {
             $this->outputLine('No items found');
         }
         $importSource->setLastRun(new \DateTime());
         $this->importSourceRepository->update($importSource);
         $this->persistenceManager->persistAll();
     }
     if ($importReport !== array() && !empty($this->settings['notification']['recipients'])) {
         /** @var MailMessage $message */
         $message = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
         $message->setTo($this->settings['notification']['recipients'])->setSubject($this->settings['notification']['subject'] ?: 'New items imported');
         if ($GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress']) {
             $message->setFrom($GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'], $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromName'] ?: NULL);
         }
         $message->setBody(vsprintf($this->settings['notification']['body'] ?: 'Imported %1$d items: %2$s', array(count($importReport), PHP_EOL . PHP_EOL . implode(PHP_EOL, $importReport))));
         $message->send();
     }
 }
 /**
  * action createParticipant
  *
  * @param Reservation $reservation
  * @param Person $newParticipant
  * @return void
  */
 public function createParticipantAction(Reservation $reservation, Person $newParticipant)
 {
     if (!$reservation->getStatus() == Reservation::STATUS_DRAFT) {
         $reservation->setStatus(Reservation::STATUS_DRAFT);
     }
     if ($reservation->getLesson()->getFreePlaces()) {
         $newParticipant->setReservation($reservation);
         $newParticipant->setType(Person::PERSON_TYPE_PARTICIPANT);
         $reservation->addParticipant($newParticipant);
         $reservation->getLesson()->addParticipant($newParticipant);
         $this->reservationRepository->update($reservation);
         $this->lessonRepository->update($reservation->getLesson());
         $this->persistenceManager->persistAll();
         $this->addFlashMessage($this->translate('message.reservation.createParticipant.success'));
     }
     $this->redirect('edit', null, null, ['reservation' => $reservation]);
 }
예제 #30
0
 /**
  * Auto Generate Documents
  *
  * @param \Extcode\Cart\Domain\Model\Order\Item $orderItem
  * @param $pluginSettings
  *
  * @return void
  */
 public function autoGenerateDocuments(\Extcode\Cart\Domain\Model\Order\Item $orderItem, $pluginSettings)
 {
     if ($pluginSettings['autoGenerateDocuments']) {
         foreach ($pluginSettings['autoGenerateDocuments'] as $documentType => $documentData) {
             $getterForNumber = 'get' . ucfirst($documentType) . 'Number';
             $setterForNumber = 'set' . ucfirst($documentType) . 'Number';
             $setterForDate = 'set' . ucfirst($documentType) . 'Date';
             if (!$orderItem->{$getterForNumber}()) {
                 $documentNumber = $this->getNumber($pluginSettings, $documentType);
                 $orderItem->{$setterForNumber}($documentNumber);
                 $orderItem->{$setterForDate}(new \DateTime());
             }
             $this->generatePdfDocument($orderItem, $documentType);
         }
         $this->orderItemRepository->update($orderItem);
         $this->persistenceManager->persistAll();
     }
 }