Ejemplo n.º 1
0
 public function getPreview($iSize = 190, $bRefresh = true, $bMayReturnTemplate = false)
 {
     $aOptions = array();
     $aOptions['document_id'] = $this->getId();
     if ($this->getDocumentType()->getDocumentKind() === 'image') {
         // Objects don’t get displayed otherwise
         $aOptions['max_width'] = $iSize;
         $aOptions['max_height'] = $iSize;
         $aOptions['force_refresh'] = $bRefresh;
     } else {
         $aOptions['width'] = $iSize;
         $aOptions['height'] = $iSize * 0.747;
     }
     $aFallback = $aOptions;
     $aFallback['document_id'] = '';
     $aFallback['height'] = $iSize;
     $aFallback['url'] = LinkUtil::link(array('document_type_preview', $this->getDocumentTypeId()), 'FileManager', array('size' => $iSize));
     $oModule = FrontendModule::getModuleInstance('media_object', serialize(array($aOptions, $aFallback)));
     $oResult = $oModule->renderFrontend();
     if ($bMayReturnTemplate) {
         return $oResult;
     }
     return $oResult->render();
 }
Ejemplo n.º 2
0
 public function fillAutofill()
 {
     $bIsPreview = $this->isPreview();
     $this->oTemplate->replaceIdentifierCallback("autofill", function ($oTemplateIdentifier, $iFlags) use($bIsPreview) {
         $oModule = FrontendModule::getModuleInstance($oTemplateIdentifier->getValue(), $oTemplateIdentifier->getParameter('data'));
         $mResult = $oModule->cachedFrontend($bIsPreview);
         if (($sCss = $oModule->getCssForFrontend()) !== null) {
             ResourceIncluder::defaultIncluder()->addCustomCss($sCss);
         }
         if (($sJs = $oModule->getJsForFrontend()) !== null) {
             ResourceIncluder::defaultIncluder()->addCustomJs($sJs);
         }
         return $mResult;
     }, null, Template::NO_HTML_ESCAPE);
 }
Ejemplo n.º 3
0
 private function backendModuleInstanceByLanguageObject($oLanguageObject)
 {
     return FrontendModule::getModuleInstance($oLanguageObject->getContentObject()->getObjectType(), $oLanguageObject->getDraft());
 }
Ejemplo n.º 4
0
 public function getAdminWidget()
 {
     return WidgetModule::getWidget('language_object_control', null, $this, FrontendModule::getModuleInstance($this->getContentObject()->getObjectType(), $this));
 }
 public function renderPreview($aPostData)
 {
     $sModuleData = $this->oFrontendModule->dataFromPost($aPostData);
     $oModule = FrontendModule::getModuleInstance('media_object', $sModuleData);
     return $oModule->renderFrontend()->render();
 }