/** * Show document field value on frontend * * @param stdClass $field * @param stdClass $document * @return string */ public static function showfield($field, $document) { $name = 'field' . $field->id; if (isset($document->{$name})) { $value = JString::trim($document->{$name}); switch ($field->type) { case JOOMDOC_FIELD_TEXT: return $value; case JOOMDOC_FIELD_TEXTAREA: return $value ? nl2br($value) : ''; case JOOMDOC_FIELD_EDITOR: return $value ? JoomDOCHelper::applyContentPlugins($value) : ''; case JOOMDOC_FIELD_DATE: switch ($value) { case '': case '0000-00-00': case '0000-00-00 00:00:00': return ''; default: return JHtml::date($value, JText::_('DATE_FORMAT_LC4')); } case JOOMDOC_FIELD_RADIO: switch ($value) { case '0': return JText::_('JNO'); case '1': return JText::_('JYES'); default: return ''; } case JOOMDOC_FIELD_CHECKBOX: case JOOMDOC_FIELD_MULTI_SELECT: case JOOMDOC_FIELD_SUGGEST: $registry = new JRegistry($value); $array = $registry->toArray(); $data = array(); if (is_array($array)) { foreach ($array as $var => $val) { foreach ($field->options as $option) { if ($option->value == $val && JString::trim($option->label)) { $data[] = $option->label; } } } } return implode(', ', $data); case JOOMDOC_FIELD_SELECT: foreach ($field->options as $option) { if ($option->value == $value && JString::trim($option->label)) { return $option->label; } } } } return ''; }
<?php /** * @version $Id$ * @package Joomla.Administrator * @subpackage JoomDOC * @author ARTIO s.r.o., info@artio.net, http:://www.artio.net * @copyright Copyright (C) 2011 Artio s.r.o.. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /* @var $this JoomDOCViewDocuments */ JHtml::_('behavior.modal'); $config = JoomDOCConfig::getInstance(); if ($this->access->docid) { $this->root->document->description = JoomDOCHelper::applyContentPlugins($this->root->document->description, $this->root->getRelativePath(), $config->edocsDetail); } echo '<form action="' . JRoute::_(JoomDOCRoute::viewDocuments($this->access->relativePath, $this->access->alias)) . '" method="post" name="adminForm" id="adminForm">'; echo '<div id="document"' . ($this->access->isFavorite ? 'class="favorite"' : '') . '>'; if (!$this->access->inRoot && $this->access->relativePath) { echo '<a class="back" href="' . JRoute::_(JoomDOCRoute::viewDocuments(JoomDOCFileSystem::getParentPath($this->access->relativePath), $this->root->parent ? $this->root->parent->full_alias : null)) . '" title="">' . JText::_('JOOMDOC_BACK') . '</a>'; } echo '<h1>'; if ($this->access->canDownload) { if ($this->access->licenseID) { echo '<a class="modal download" rel="{handler: \'iframe\', size: {x: ' . JOOMDOC_LIGHTBOX_WIDTH . ', y: ' . JOOMDOC_LIGHTBOX_HEIGHT . '}, onClose: function() {}}" href="' . JRoute::_(JoomDOCRoute::viewLicense($this->access->licenseID, $this->access->licenseAlias, $this->access->relativePath, $this->access->alias)) . '">'; } else { echo '<a class="download" href="' . JRoute::_(JoomDOCRoute::download($this->access->relativePath, $this->access->alias)) . '" title="">'; } } //display document title only if published for current user.
<?php /** * @version $Id$ * @package Joomla.Administrator * @subpackage JoomDOC * @author ARTIO s.r.o., info@artio.net, http:://www.artio.net * @copyright Copyright (C) 2011 Artio s.r.o.. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /* @var $this JoomDOCViewLicense */ // test if property realy exist in request $path = JRequest::getVar('path', false) !== false ? JoomDOCRequest::getPath() : null; echo '<h1>' . $this->license->title . '</h1>'; if ($path) { echo '<h2>' . JText::_('JOOMDOC_MUST_CONFIRM') . '</h2>'; } echo JoomDOCHelper::applyContentPlugins($this->license->text); if ($path) { echo '<div class="confirm">'; echo '<input type="checkbox" name="confirm" id="confirm" value="1" onclick="JoomDOC.confirmLicense(this)" />'; echo '<label for="confirm">' . JText::_('JOOMDOC_CONFIRM') . '</label>'; echo '<a id="download" class="blind" href="' . JRoute::_(JoomDOCRoute::download($path)) . '" title="">' . JText::_('JOOMDOC_DOWNLOAD_FILE') . '</a>'; echo '</div>'; }
$filesWithouDoc = (int) $params->get('files_without_doc', 1); } $filesWithouDoc = $config->filesWithoutDoc || $filesWithouDoc; $class = null; if (!$this->root->hasNext()) { // folder is empty echo '<p class="empty">' . JText::_('JOOMDOC_EMPTY_FOLDER') . '</p>'; } $files = $folders = array(); $i = -1; while ($this->root->hasNext()) { $i++; $item = $this->root->getNext(); $access = new JoomDOCAccessHelper($item); if ($access->docid) { $item->document->description = JoomDOCHelper::applyContentPlugins($item->document->description, $access->isFile ? $access->relativePath : null, $config->edocsList); } // save files/folders names for next using $access->isFile ? $files[] = $item->getFileName() : ($folders[] = $item->getFileName()); // no subfolders if ($access->isFolder && !$config->showSubfolders) { continue; } // no display files without doc if (!$filesWithouDoc && !$access->docid && $access->isFile) { continue; } // document is unpublish and user cannot edit document or document is trashed if ($access->docid && $item->document->published == JOOMDOC_STATE_UNPUBLISHED && !$access->canAnyEditOp) { continue; }