예제 #1
0
 /**
  * Modifies edit icon array
  *
  * @param array                        $cells        Array of edit icons
  * @param \TYPO3\CMS\Filelist\FileList $parentObject Parent object
  *
  * @return void
  */
 public function manipulateEditIcons(&$cells, &$parentObject)
 {
     try {
         $metaUid = $this->getFileMetaUidByCells($cells);
         $file = FileUtility::getFileByMetaData($metaUid);
     } catch (\Exception $ex) {
         $cells['focuspoint'] = $this->getEmptyIcon();
         return;
     }
     // no Image?
     if ($file->getType() !== AbstractFile::FILETYPE_IMAGE) {
         $cells['focuspoint'] = $this->getEmptyIcon();
         return;
     }
     $wizardArguments = array('P' => array('uid' => $metaUid, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')));
     $wizardUri = BackendUtility::getModuleUrl('focuspoint', $wizardArguments);
     $cells['focuspoint'] = '<a href="' . $wizardUri . '" class="btn btn-default">' . IconUtility::getSpriteIcon('extensions-focuspoint-focuspoint') . '</a>';
 }
예제 #2
0
 /**
  * Modifies edit icon array
  *
  * @param array $cells Array of edit icons
  * @param \TYPO3\CMS\Filelist\FileList $parentObject Parent object
  *
  * @return void
  */
 public function manipulateEditIcons(&$cells, &$parentObject)
 {
     /** @var WizardService $wizardService */
     $wizardService = GeneralUtility::makeInstance('HDNET\\Focuspoint\\Service\\WizardService');
     try {
         $metaUid = $this->getFileMetaUidByCells($cells);
         $file = FileUtility::getFileByMetaData($metaUid);
     } catch (\Exception $ex) {
         $cells['focuspoint'] = $wizardService->getWizardButton();
         return;
     }
     if (!ImageUtility::isValidFileExtension($file->getExtension())) {
         $cells['focuspoint'] = $wizardService->getWizardButton();
         return;
     }
     $wizardArguments = ['P' => ['metaUid' => $metaUid, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]];
     $wizardUri = BackendUtility::getModuleUrl('focuspoint', $wizardArguments);
     $cells['focuspoint'] = $wizardService->getWizardButton($wizardUri);
 }
예제 #3
0
 /**
  * Main action
  *
  * @throws \Exception
  */
 public function main()
 {
     $parameter = GeneralUtility::_GET();
     $fileObject = FileUtility::getFileByMetaData((int) $parameter['P']['uid']);
     if (isset($parameter['save']) && $fileObject) {
         $values = array('focus_point_y' => $parameter['yValue'] * 100, 'focus_point_x' => $parameter['xValue'] * 100);
         $uid = (int) $parameter['P']['uid'];
         GlobalUtility::getDatabaseConnection()->exec_UPDATEquery('sys_file_metadata', 'uid=' . $uid, $values);
         HttpUtility::redirect($parameter['P']['returnUrl']);
     }
     $saveArguments = array('save' => 1, 'P' => array('uid' => $parameter['P']['uid'], 'returnUrl' => $parameter['P']['returnUrl']));
     $saveUri = BackendUtility::getModuleUrl('focuspoint', $saveArguments);
     // current point
     $information = $this->getCurrentFocusPoint($parameter['P']['uid']);
     /** @var \TYPO3\CMS\Fluid\View\StandaloneView $template */
     $template = GeneralUtility::makeInstance('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
     $template->setTemplatePathAndFilename(ExtensionManagementUtility::extPath('focuspoint', 'Resources/Private/Templates/Wizard/Focuspoint.html'));
     $template->assign('filePath', $fileObject->getPublicUrl(TRUE));
     $template->assign('saveUri', $saveUri);
     $template->assign('currentLeft', ($information['focus_point_x'] + 100) / 2 . '%');
     $template->assign('currentTop', ($information['focus_point_y'] - 100) / -2 . '%');
     echo $template->render();
 }
예제 #4
0
파일: File.php 프로젝트: mcmz/focuspoint
 /**
  * Get the public URL for the current handler
  *
  * @return string
  */
 public function getPublicUrl()
 {
     $fileObject = FileUtility::getFileByMetaData($this->getMataDataUid());
     return $fileObject->getPublicUrl(true);
 }