@@ -115,7 +122,7 @@
isAdmin())
+ if (!$app->isClient('administrator'))
{
echo $this->pagination->getPaginationLinks('joomla.pagination.links', array('showLimitBox' => false));
}
@@ -483,7 +491,7 @@
-
+
diff --git a/tjreports/site/views/reports/view.base.php b/tjreports/site/views/reports/view.base.php
index d8809a9..a355165 100644
--- a/tjreports/site/views/reports/view.base.php
+++ b/tjreports/site/views/reports/view.base.php
@@ -13,6 +13,9 @@
// No direct access
defined('_JEXEC') or die;
+use Joomla\CMS\Factory;
+use Joomla\CMS\MVC\Model\BaseDatabaseModel;
+
jimport('joomla.application.component.view');
JLoader::import('components.com_tjreports.helpers.tjreports', JPATH_ADMINISTRATOR);
JLoader::import('components.com_tjreports.models.tjreports', JPATH_SITE);
@@ -38,12 +41,28 @@ class ReportsViewBase extends JViewLegacy
protected $reportData;
- protected $savedQueries = array();
+ protected $headerLevel;
protected $reportId = 0;
protected $queryId = 0;
+ protected $savedQueries = array();
+
+ protected $defaultColToHide;
+
+ protected $columns;
+
+ protected $showhideCols;
+
+ protected $filterParamColToshow;
+
+ protected $defaultColToShow;
+
+ protected $sortableColumns;
+
+ protected $showSearchResetButton;
+
/**
* Execute and display a template script.
*
@@ -53,15 +72,14 @@ class ReportsViewBase extends JViewLegacy
*/
public function processData($type = 'html')
{
- $app = JFactory::getApplication();
- $canDo = TjreportsHelper::getActions();
- $input = JFactory::getApplication()->input;
- $user = JFactory::getUser();
+ $canDo = TjreportsHelper::getActions();
+ $input = Factory::getApplication()->input;
+ $user = Factory::getUser();
$this->reportId = $input->get('reportId', 0, 'INT');
- $this->model = $this->getModel('reports');
+ $this->model = $this->getModel('reports');
- $reports = $this->model->getenableReportPlugins();
+ $reports = $this->model->getenableReportPlugins();
$this->reportId = $this->reportId ? $this->reportId : (isset($reports['0']['reportId']) ? $reports['0']['reportId'] : '');
$this->reportData = $this->model->getReportNameById($this->reportId);
@@ -81,7 +99,11 @@ public function processData($type = 'html')
}
$this->model = $this->getModel($this->pluginName);
- $this->setModel($this->model, true);
+
+ if ($this->model)
+ {
+ $this->setModel($this->model, true);
+ }
if ($this->reportId)
{
@@ -131,8 +153,8 @@ public function processData($type = 'html')
if (!empty($savedQueries))
{
- $qOptions = array();
- $qOptions[] = JHTML::_('select.option', '', JText::_('COM_TJREPORTS_SELONE_QUERY'));
+ $qOptions = array();
+ $qOptions[] = JHTML::_('select.option', '', JText::_('COM_TJREPORTS_SELONE_QUERY'));
foreach ($savedQueries as $savedQuery)
{
@@ -154,25 +176,46 @@ public function processData($type = 'html')
}
$this->model->loadLanguage($this->pluginName);
- $this->state = $this->get('State');
- $this->items = $this->model->getItems();
- $this->pagination = $this->get('pagination');
-
- $this->headerLevel = $this->model->headerLevel;
- $this->columns = $this->model->columns;
+ $this->state = $this->get('State');
+ $this->items = $this->model->getItems();
+ $this->pagination = $this->get('pagination');
+ $this->headerLevel = $this->model->headerLevel;
+
+ // Array_key - defaultColToHide column are present then get the key as value.
+ $defaultColToHide = (array) $this->model->getState('defaultColToHide');
+ $this->defaultColToHide = array_keys($defaultColToHide);
+ $this->columns = $this->model->columns;
+
+ /* Array_merge - here colToshow means get all true value array so want to mearg defaultColToHide column and then using
+ * array_intersect - only remove those column which is force fully added in load param in showhideCols config
+ */
$this->showHideColumns = $this->model->showhideCols;
- $this->sortable = $this->model->sortableColumns;
- $this->emailColumn = $this->model->getState('emailColumn');
- $this->srButton = $this->model->showSearchResetButton;
- $this->colToshow = $this->model->getState('colToshow');
- $this->filterValues = $this->model->getState('filters');
+ /* To get the columns from loadparams*/
+ $this->defaultColToshow = $this->model->filterParamColToshow;
+
+ /* Check the columns in loadparams are available or not & show plugin level columns & custom field columns
+ * in case if load params are not available*/
+ if (empty($this->defaultColToshow))
+ {
+ $this->defaultColToshow = $this->model->defaultColToShow;
+ }
+
+ if (!empty($this->defaultColToHide))
+ {
+ $this->showHideColumns = array_intersect($this->model->showhideCols, array_merge($this->defaultColToshow, $this->defaultColToHide));
+ }
- $this->userFilters = $this->model->displayFilters();
- $this->messages = $this->model->getTJRMessages();
+ $this->sortable = $this->model->sortableColumns;
+ $this->emailColumn = $this->model->getState('emailColumn');
+ $this->srButton = $this->model->showSearchResetButton;
+ $this->colToshow = $this->model->getState('colToshow');
+ $this->filterValues = $this->model->getState('filters');
+ $this->userFilters = $this->model->displayFilters();
+ $this->messages = $this->model->getTJRMessages();
$this->enableReportPlugins = $this->model->getenableReportPlugins($this->client);
- $this->isExport = $user->authorise('core.export', 'com_tjreports.tjreport.' . $this->reportId);
+ $this->isExport = $user->authorise('core.export', 'com_tjreports.tjreport.' . $this->reportId);
return true;
}
@@ -184,14 +227,14 @@ public function processData($type = 'html')
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
- * @return JModelLegacy|boolean Model object on success; otherwise false on failure.
+ * @return BaseDatabaseModel|boolean Model object on success; otherwise false on failure.
*
* @since 3.0
*/
public function getModel($name = '', $prefix = '', $config = array())
{
- JModelLegacy::addIncludePath(JPATH_SITE . '/plugins/tjreports/' . $name);
+ BaseDatabaseModel::addIncludePath(JPATH_SITE . '/plugins/tjreports/' . $name);
- return JModelLegacy::getInstance($name, 'TjreportsModel', $config);
+ return BaseDatabaseModel::getInstance($name, 'TjreportsModel', $config);
}
}
diff --git a/tjreports/tjreports.xml b/tjreports/tjreports.xml
index 3ddde42..ae12368 100644
--- a/tjreports/tjreports.xml
+++ b/tjreports/tjreports.xml
@@ -6,8 +6,8 @@
https://techjoomla.com
Copyright (C) 2016 - 2019 Techjoomla. All rights reserved.
http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
-
12th Jul 2019
-
1.1.1
+
11th Nov 2019
+
1.1.4
This component is used to access all the report at single place.