By normal, Joomla media manager does not default display the documents manager.
In some cases we need to show them in media manager to link to document.
In some cases we need to show them in media manager to link to document.
- In administrator/com_media/views/imagelist.php, add the following function
function setDocument($index = 0)
{
if (isset($this->documents[$index]))
{
$this->_tmp_document = &$this->documents[$index];
}
else
{
$this->_tmp_document = new JObject;
}
}
Add this in in the apt place in display function
# Test to list PDF files
$documents = $this->get('documents');
$this->documents = &$documents;
Add this in in the apt place in display function
# Test to list PDF files
$documents = $this->get('documents');
$this->documents = &$documents;
2. In administrator/com_media/views/tmpl/default.php, add this snippet next to image block
<?php for ($i = 0, $n = count($this->documents); $i < $n; $i++) :
$this->setDocument($i);
echo $this->loadTemplate('document');
endfor; ?>
3. Create a file 'default_document.php' inside administrator/com_media/views/tmpl/, and add this code
<?php
defined('_JEXEC') or die;
defined('_JEXEC') or die;
$params = new JRegistry;
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$this->_tmp_document, &$params));
?>
<li class="imgOutline thumbnail height-80 width-80 center">
<a class="img-preview" href="javascript:ImageManager.populateFields('<?php echo $this->_tmp_document->path_relative; ?>')" title="<?php echo $this->_tmp_document->name; ?>" >
<div class="height-50">
<!--<?php echo JHtml::_('image', $this->baseURL . '/' . $this->_tmp_document->path_relative, JText::sprintf('COM_MEDIA_IMAGE_TITLE', $this->_tmp_document->title, JHtml::_('number.bytes', $this->_tmp_document->size)), array('width' => $this->_tmp_document->width_60, 'height' => $this->_tmp_document->height_60)); ?>-->
<?php echo JHtml::_('image', $this->_tmp_document->icon_32, $this->_tmp_document->name, null, true, true) ? JHtml::_('image', $this->_tmp_document->icon_32, $this->_tmp_document->title, null, true) : JHtml::_('image', 'media/con_info.png', $this->_tmp_document->name, null, true); ?></a>
</div>
<div class="small">
<?php echo JHtml::_('string.truncate', $this->_tmp_document->name, 10, false); ?>
</div>
</a>
</li>
<?php
$dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$this->_tmp_document, &$params));
?>
No comments:
Post a Comment