1
0

BxBaseFileHandlerGoogleViewer.php 929 B

12345678910111213141516171819202122232425262728293031
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaBaseView UNA Base Representation Classes
  7. * @{
  8. */
  9. /**
  10. * Google Viewer can preview pdf,doc,docx,xls,xlsx,ppt,pptx,pages,ai,psd,dxf,svg,eps,ps,ttf,xps,tif,tiff,zip,rar,txt,css,html,php,c,cpp,h,hpp,js files.
  11. * @see BxDolFileHandler
  12. */
  13. class BxBaseFileHandlerGoogleViewer extends BxBaseFileHandler
  14. {
  15. public function __construct ($aObject, $oTemplate)
  16. {
  17. parent::__construct ($aObject, $oTemplate);
  18. }
  19. public function display ($sFileUrl, $aFile)
  20. {
  21. $this->addCssJs();
  22. return $this->_oTemplate->parseHtmlByName('file_handler_iframe.html', array(
  23. 'class' => 'bx_file_handler_google_viewer',
  24. 'src' => 'https://docs.google.com/gview?url=' . rawurlencode($sFileUrl),
  25. ));
  26. }
  27. }
  28. /** @} */