예제 #1
0
 public function getRelatedDocuments()
 {
     $app = JFactory::getApplication();
     $doc_id = $app->input->getInt('id', 0);
     $relatedDocumentIds = $app->getUserState("com_judownload.edit.document.related_documents", array());
     $related_documents = array();
     if ($relatedDocumentIds) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('d.id, d.title, d.icon');
         $query->from('#__judownload_documents AS d');
         $query->where('d.id IN (' . implode(',', $relatedDocumentIds) . ')');
         $db->setQuery($query);
         $related_documents = $db->loadObjectList();
     } elseif ($doc_id) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('d.id, d.title, d.icon');
         $query->from('#__judownload_documents_relations AS drel');
         $query->join('INNER', '#__judownload_documents AS d ON drel.doc_id_related = d.id');
         $query->where('drel.doc_id = ' . $doc_id);
         $query->order('drel.ordering ASC');
         $db->setQuery($query);
         $related_documents = $db->loadObjectList();
     }
     if ($related_documents) {
         foreach ($related_documents as $document) {
             $document->icon_src = JUDownloadHelper::getDocumentIcon($document->icon);
         }
     }
     return $related_documents;
 }
예제 #2
0
	protected function _prepareDocument()
	{
		$document = JFactory::getDocument();
		$uri      = clone JUri::getInstance();

		
		$domain        = $uri->toString(array('scheme', 'host', 'port'));
		$canonicalLink = $domain . JRoute::_(JUDownloadHelperRoute::getDocumentRoute($this->item->id, $this->_layout), false);

		JUDownloadFrontHelper::setCanonical($canonicalLink);

		$imageUrl = JUDownloadHelper::getDocumentIcon($this->item->icon);
		
		$document->addCustomTag('<meta property="og:title" content="' . $this->item->title . '" />');
		$document->addCustomTag('<meta property="og:type" content="website" />');
		if ($imageUrl)
		{
			$document->addCustomTag('<meta property="og:image" content="' . JUri::root(true) . "/media/com_judownload/images/document/" . $this->item->icon . '" />');
		}
		$document->addCustomTag('<meta property="og:url" content="' . $canonicalLink . '" />');

		JUDownloadFrontHelperSeo::seo($this);
	}
예제 #3
0
	public function getOutput($options = array())
	{
		if (!$this->isPublished())
		{
			return "";
		}

		if (!$this->value)
		{
			return "";
		}

		$icon_src = JUDownloadHelper::getDocumentIcon($this->value);

		if (!$this->doc_id || !$icon_src)
		{
			return '';
		}

		$isDetailsView = $this->isDetailsView($options);

		$this->setVariable('icon_src', $icon_src);
		$this->setVariable('isDetailsView', $isDetailsView);

		return $this->fetch('output.php', __CLASS__);
	}