From e610a1e553c05a80ebd50552785377c9c05c1d3a Mon Sep 17 00:00:00 2001 From: Tazzios <23451105+Tazzios@users.noreply.github.com> Date: Sun, 10 Oct 2021 11:12:24 +0200 Subject: [PATCH] button check if jdownloads exists --- editor_button/tmpl/default.php | 136 ++++++++++++++++++--------------- 1 file changed, 75 insertions(+), 61 deletions(-) diff --git a/editor_button/tmpl/default.php b/editor_button/tmpl/default.php index 9652c13..9e69d26 100644 --- a/editor_button/tmpl/default.php +++ b/editor_button/tmpl/default.php @@ -19,22 +19,34 @@ $document->addScript( JUri::root() .'/plugins/editors-xtd/pdfviewer/assets/pdfviewer.js'); -//$document->setTitle('pdf viewer'); - -// get all published jdownloads files -$db = JFactory::getDbo(); -$query = "SELECT id, title FROM #__jdownloads_files WHERE published = 1 ORDER BY publish_up desc"; -$db->setQuery($query); -$fields = $db->loadAssocList(); - -// create an one row array with paramtofind to use for the while check +//check if jdownloads is installed +$path= JPATH_ROOT . '/administrator/components/com_jdownloads'; $dropdown = ''; -foreach ($fields as $field) { +$radiojdownload = ''; +$radioexternalpdf = ''; +if (file_exists( $path )) { + // get all published jdownloads files + $db = JFactory::getDbo(); + $query = "SELECT id, title FROM #__jdownloads_files WHERE published = 1 ORDER BY publish_up desc"; + $db->setQuery($query); + $fields = $db->loadAssocList(); + + // create dropdown with jdownloads files + $dropdown = '