Source for file view.html.php

Documentation is available at view.html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_media
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * HTML View class for the Media component
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_media
  17.  * @since       1.0
  18.  */
  19. class MediaViewMedia extends JViewLegacy
  20. {
  21.     public function display($tpl null)
  22.     {
  23.         $app    JFactory::getApplication();
  24.         $config JComponentHelper::getParams('com_media');
  25.  
  26.         if (!$app->isAdmin())
  27.         {
  28.             return $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR')'warning');
  29.         }
  30.  
  31.         $lang    JFactory::getLanguage();
  32.  
  33.         $style $app->getUserStateFromRequest('media.list.layout''layout''thumbs''word');
  34.  
  35.         $document JFactory::getDocument();
  36.  
  37.         JHtml::_('behavior.framework'true);
  38.  
  39.         JHtml::_('script''media/mediamanager.js'truetrue);
  40.         /*
  41.         JHtml::_('stylesheet', 'media/mediamanager.css', array(), true);
  42.         if ($lang->isRTL()) :
  43.             JHtml::_('stylesheet', 'media/mediamanager_rtl.css', array(), true);
  44.         endif;
  45.         */
  46.         JHtml::_('behavior.modal');
  47.         $document->addScriptDeclaration("
  48.         window.addEvent('domready', function()
  49.         {
  50.             document.preview = SqueezeBox;
  51.         });");
  52.  
  53.         // JHtml::_('script', 'system/mootree.js', true, true, false, false);
  54.         JHtml::_('stylesheet''system/mootree.css'array()true);
  55.         if ($lang->isRTL()) :
  56.             JHtml::_('stylesheet''media/mootree_rtl.css'array()true);
  57.         endif;
  58.  
  59.         if (DIRECTORY_SEPARATOR == '\\')
  60.         {
  61.             $base str_replace(DIRECTORY_SEPARATOR"\\\\"COM_MEDIA_BASE);
  62.         }
  63.         else
  64.         {
  65.             $base COM_MEDIA_BASE;
  66.         }
  67.  
  68.         $js "
  69.             var basepath = '".$base."';
  70.             var viewstyle = '".$style."';
  71.         ";
  72.         $document->addScriptDeclaration($js);
  73.  
  74.         /*
  75.          * Display form for FTP credentials?
  76.          * Don't set them here, as there are other functions called before this one if there is any file write operation
  77.          */
  78.         $ftp !JClientHelper::hasCredentials('ftp');
  79.  
  80.         $session    JFactory::getSession();
  81.         $state        $this->get('state');
  82.         $this->session $session;
  83.         $this->config &$config;
  84.         $this->state &$state;
  85.         $this->require_ftp $ftp;
  86.         $this->folders_id ' id="media-tree"';
  87.         $this->folders $this->get('folderTree');
  88.  
  89.         // Set the toolbar
  90.         $this->addToolbar();
  91.  
  92.         parent::display($tpl);
  93.         echo JHtml::_('behavior.keepalive');
  94.     }
  95.  
  96.     /**
  97.      * Add the page title and toolbar.
  98.      *
  99.      * @since   1.6
  100.      */
  101.     protected function addToolbar()
  102.     {
  103.         // Get the toolbar object instance
  104.         $bar JToolBar::getInstance('toolbar');
  105.         $user JFactory::getUser();
  106.  
  107.         // The toolbar functions depend on Bootstrap JS
  108.         JHtml::_('bootstrap.framework');
  109.  
  110.         // Set the titlebar text
  111.         JToolbarHelper::title(JText::_('COM_MEDIA')'images mediamanager');
  112.  
  113.         // Add a upload button
  114.         if ($user->authorise('core.create''com_media'))
  115.         {
  116.             // Instantiate a new JLayoutFile instance and render the layout
  117.             $layout new JLayoutFile('toolbar.uploadmedia');
  118.  
  119.             $bar->appendButton('Custom'$layout->render(array())'upload');
  120.             JToolbarHelper::divider();
  121.         }
  122.  
  123.         // Add a create folder button
  124.         if ($user->authorise('core.create''com_media'))
  125.         {
  126.             // Instantiate a new JLayoutFile instance and render the layout
  127.             $layout new JLayoutFile('toolbar.newfolder');
  128.  
  129.             $bar->appendButton('Custom'$layout->render(array())'upload');
  130.             JToolbarHelper::divider();
  131.         }
  132.  
  133.         // Add a delete button
  134.         if ($user->authorise('core.delete''com_media'))
  135.         {
  136.             // Instantiate a new JLayoutFile instance and render the layout
  137.             $layout new JLayoutFile('toolbar.deletemedia');
  138.  
  139.             $bar->appendButton('Custom'$layout->render(array())'upload');
  140.             JToolbarHelper::divider();
  141.         }
  142.  
  143.         // Add a preferences button
  144.         if ($user->authorise('core.admin''com_media'))
  145.         {
  146.             JToolbarHelper::preferences('com_media');
  147.             JToolbarHelper::divider();
  148.         }
  149.  
  150.         JToolbarHelper::help('JHELP_CONTENT_MEDIA_MANAGER');
  151.     }
  152.  
  153.     function getFolderLevel($folder)
  154.     {
  155.         $this->folders_id null;
  156.         $txt null;
  157.         if (isset($folder['children']&& count($folder['children']))
  158.         {
  159.             $tmp $this->folders;
  160.             $this->folders $folder;
  161.             $txt $this->loadTemplate('folders');
  162.             $this->folders $tmp;
  163.         }
  164.         return $txt;
  165.     }
  166. }

Documentation generated on Tue, 19 Nov 2013 15:18:07 +0100 by phpDocumentor 1.4.3