Пример #1
0
	public function canView($options = array())
	{
		$storeId = md5(__METHOD__ . "::" . $this->doc_id . "::" . $this->id . "::" . serialize($options));

		if (!isset(self::$cache[$storeId]))
		{
			if (!$this->isPublished())
			{
				self::$cache[$storeId] = false;

				return self::$cache[$storeId];
			}

			
			if (isset($this->doc) && $this->doc->cat_id)
			{
				$params = JUDownloadHelper::getParams($this->doc->cat_id);
			}
			else
			{
				$params = JUDownloadHelper::getParams(null, $this->doc_id);
			}

			$show_empty_field = $params->get('show_empty_field', 0);
			
			if ($this->doc_id && !$show_empty_field)
			{
				$app = JFactory::getApplication();
				if ($app->isSite())
				{
					if (!is_object($this->value) || !$this->value->published)
					{
						self::$cache[$storeId] = false;

						return self::$cache[$storeId];
					}
				}
				else
				{
					if (!is_object($this->value))
					{
						self::$cache[$storeId] = false;

						return self::$cache[$storeId];
					}
				}
			}

			self::$cache[$storeId] = parent::canView($options);

			return self::$cache[$storeId];
		}

		return self::$cache[$storeId];
	}
Пример #2
0
	public function canView($options = array())
	{
		$params       = JUDownloadHelper::getParams(null, $this->doc_id);
		$default_icon = JUDownloadHelper::getDefaultDocumentIcon();
		if ($this->value == "" && $default_icon)
		{
			$this->value = "default/" . $params->get('listing_default_icon', 'default-document.png');
		}

		return parent::canView($options);
	}