Пример #1
0
 /**
  * @test
  */
 public function setUrlForStringSetsUrl()
 {
     $this->fixture->setUrl('Conceived at T3CON10');
     $this->assertSame('Conceived at T3CON10', $this->fixture->getUrl());
 }
Пример #2
0
 /**
  * action update
  *
  * @param \GK\Stdapp\Domain\Model\Resource $banner
  * @return void
  */
 public function updateBannerAction(\GK\Stdapp\Domain\Model\Resource $banner)
 {
     $data = $_FILES['tx_' . strtolower($this->request->getControllerExtensionName()) . '_' . strtolower($this->request->getPluginName())];
     if (($url = trim($banner->getUrl())) && !preg_match('/^https?:/', $url)) {
         $banner->setUrl('http://' . $url);
     }
     if ($banner->getUid() > 0) {
         $this->resourceRepository->update($banner);
         $this->flashMessageContainer->add('Your Resource was updated.');
         if ($data['error']['file'] == UPLOAD_ERR_NO_FILE) {
             $this->redirect('editBanner');
         }
     } else {
         $this->resourceRepository->add($banner);
         $this->flashMessageContainer->add('Your Resource was added.');
     }
     if (is_array($data) && count($data) > 0) {
         //Enforce persistence
         $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager')->persistAll();
         if (($err = $this->handleUpload("file", $this->settings['uploadPath'], $banner->getType()->getName() . '_' . $banner->getUid(), $filepath)) == 0) {
             $banner->setPath('{baseurl}' . $this->settings['uploadPath'] . $filepath);
             $this->resourceRepository->update($banner);
             $this->flashMessageContainer->add('Banner saved');
         } else {
             $this->resourceRepository->remove($banner);
             if ($err == 2) {
                 $this->flashMessageContainer->add('File too big.', "", \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
             } else {
                 $this->flashMessageContainer->add("ERROR(" . $err . ") when saving file!", "", \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
             }
         }
     }
     $this->redirect('editBanner');
 }