From c5f2be4f9a21736f45a843de222b546aed760d2e Mon Sep 17 00:00:00 2001 From: Pranoti Patil Date: Thu, 8 Aug 2019 15:48:08 +0530 Subject: [PATCH 01/38] Task #148927 feat: Add reports API plugin in TJReport package --- .../language/en-GB/en-GB.plg_api_reports.ini | 7 ++ .../en-GB/en-GB.plg_api_reports.sys.ini | 7 ++ tjreports/plugins/api/reports/reports.php | 43 ++++++++ tjreports/plugins/api/reports/reports.xml | 21 ++++ .../plugins/api/reports/reports/filters.php | 61 ++++++++++++ .../plugins/api/reports/reports/report.php | 97 +++++++++++++++++++ tjreports/script.tjreports.php | 3 + 7 files changed, 239 insertions(+) create mode 100644 tjreports/plugins/api/reports/language/en-GB/en-GB.plg_api_reports.ini create mode 100644 tjreports/plugins/api/reports/language/en-GB/en-GB.plg_api_reports.sys.ini create mode 100644 tjreports/plugins/api/reports/reports.php create mode 100644 tjreports/plugins/api/reports/reports.xml create mode 100644 tjreports/plugins/api/reports/reports/filters.php create mode 100644 tjreports/plugins/api/reports/reports/report.php diff --git a/tjreports/plugins/api/reports/language/en-GB/en-GB.plg_api_reports.ini b/tjreports/plugins/api/reports/language/en-GB/en-GB.plg_api_reports.ini new file mode 100644 index 0000000..c01b6f1 --- /dev/null +++ b/tjreports/plugins/api/reports/language/en-GB/en-GB.plg_api_reports.ini @@ -0,0 +1,7 @@ +; @package Com_Tjreports +; @copyright Copyright © 2009-2018 Techjoomla. All rights reserved. +; @license GNU General Public License version 2, or later +; Note: All ini files need to be saved as UTF-8 + +PLG_API_REPORTS_REPORT_NAME_MISSSING="Please enter report name" +PLG_API_REPORTS_REPORT_NAME_INVALID="Please enter valid report name" diff --git a/tjreports/plugins/api/reports/language/en-GB/en-GB.plg_api_reports.sys.ini b/tjreports/plugins/api/reports/language/en-GB/en-GB.plg_api_reports.sys.ini new file mode 100644 index 0000000..5dc53f0 --- /dev/null +++ b/tjreports/plugins/api/reports/language/en-GB/en-GB.plg_api_reports.sys.ini @@ -0,0 +1,7 @@ +; @package Com_Tjreports +; @copyright Copyright © 2009-2018 Techjoomla. All rights reserved. +; @license GNU General Public License version 2, or later +; Note: All ini files need to be saved as UTF-8 + +PLG_API_REPORTS="TJ Reports Api Plugin" +PLG_API_REPORTS_DESCRIPTION="TJ Reports Api Plugin" diff --git a/tjreports/plugins/api/reports/reports.php b/tjreports/plugins/api/reports/reports.php new file mode 100644 index 0000000..5d4a54b --- /dev/null +++ b/tjreports/plugins/api/reports/reports.php @@ -0,0 +1,43 @@ + + * @copyright Copyright (C) 2009 - 2018 Techjoomla. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access. +defined('_JEXEC') or die; + +jimport('joomla.plugin.plugin'); +JLoader::import('components.com_tjreports.models.report', JPATH_SITE); + +/** + * Tjreports API plugin + * + * @since 1.0 + */ +class PlgAPIReports extends ApiPlugin +{ + /** + * Constructor + * + * @param STRING &$subject subject + * @param array $config config + * + * @since 1.0 + */ + public function __construct(&$subject, $config = array()) + { + parent::__construct($subject, $config = array()); + + // Set resource path + ApiResource::addIncludePath(dirname(__FILE__) . '/reports'); + + // Load language files + $lang = JFactory::getLanguage(); + $lang->load('plg_api_reports', JPATH_SITE . "/plugins/api/reports/", 'en-GB', true); + } +} diff --git a/tjreports/plugins/api/reports/reports.xml b/tjreports/plugins/api/reports/reports.xml new file mode 100644 index 0000000..6bf8411 --- /dev/null +++ b/tjreports/plugins/api/reports/reports.xml @@ -0,0 +1,21 @@ + + + PLG_API_REPORTS + 1.0 + 28th May 2018 + Techjoomla + extensions@techjoomla.com + https://techjoomla.com + Techjoomla. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + PLG_API_REPORTS_DESCRIPTION + + reports.php + reports + language + + + en-GB/en-GB.plg_api_reports.ini + en-GB/en-GB.plg_api_reports.sys.ini + + diff --git a/tjreports/plugins/api/reports/reports/filters.php b/tjreports/plugins/api/reports/reports/filters.php new file mode 100644 index 0000000..c6ff182 --- /dev/null +++ b/tjreports/plugins/api/reports/reports/filters.php @@ -0,0 +1,61 @@ + + * @copyright Copyright (C) 2009 - 2018 Techjoomla. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access. +defined('_JEXEC') or die; + +/** + * Tjreports API report class + * + * @since 1.0.0 + */ +class ReportsApiResourceFilters extends ApiResource +{ + /** + * Function get filters data + * + * @return boolean + */ + public function get() + { + $app = JFactory::getApplication(); + $jinput = $app->input; + $reportName = $jinput->getString('id'); + + if (!isset($reportName)) + { + ApiError::raiseError(400, JText::_('PLG_API_REPORTS_REPORT_NAME_MISSSING'), 'APIValidationException'); + } + + $lang = JFactory::getLanguage(); + //load default joomla language file + $lang->load('', JPATH_ADMINISTRATOR, 'en-GB', true); + + // Make object of the tjreports plugin to load filters for + JLoader::import('plugins.tjreports.' . $reportName . "." . $reportName, JPATH_SITE); + $className = 'TjreportsModel' . ucfirst($reportName); + + if (!class_exists($className)) + { + ApiError::raiseError(400, JText::_('PLG_API_REPORTS_REPORT_NAME_INVALID'), 'APIValidationException'); + } + + $reportPlugin = new $className; + + $filters = $reportPlugin->displayFilters(); + $filter_array = []; + foreach ($filters[0] as $key => $value) { + $value['name'] = $key; + $filter_array[] = $value; + } + + $this->plugin->setResponse($filter_array); + } +} diff --git a/tjreports/plugins/api/reports/reports/report.php b/tjreports/plugins/api/reports/reports/report.php new file mode 100644 index 0000000..3ba048c --- /dev/null +++ b/tjreports/plugins/api/reports/reports/report.php @@ -0,0 +1,97 @@ + + * @copyright Copyright (C) 2009 - 2018 Techjoomla. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access. +defined('_JEXEC') or die; + +/** + * Tjreports API report class + * + * @since 1.0.0 + */ +class ReportsApiResourceReport extends ApiResource +{ + /** + * Function to get report data from tjreports plugin + * + * @return json + */ + public function post() + { + $app = JFactory::getApplication(); + $jinput = $app->input; + $formData = $jinput->post; + $reportName = $app->input->getString('id'); + + if (empty($reportName)) + { + $reportName = $formData->getString('report'); + } + + if (!isset($reportName)) + { + ApiError::raiseError(400, JText::_('PLG_API_REPORTS_REPORT_NAME_MISSSING'), 'APIValidationException'); + } + + // Create object of tjreports plugin class + + JLoader::import('plugins.tjreports.' . $reportName . "." . $reportName, JPATH_SITE); + $className = 'TjreportsModel' . ucfirst($reportName); + + if (!class_exists($className)) + { + ApiError::raiseError(400, JText::_('PLG_API_REPORTS_REPORT_NAME_INVALID'), 'APIValidationException'); + } + + $reportPlugin = new $className; + + // Load language files + $lang = JFactory::getLanguage(); + $lang->load('com_tjreports', JPATH_ADMINISTRATOR, 'en-GB', true); + $lang->load('plg_tjreports_' . $reportName, JPATH_SITE . "/plugins/tjreports/" . $reportName, 'en-GB', true); + + // Get filters and cols + $reportId = $reportPlugin->getDefaultReport($reportName); + $reportFilters = ($formData->get('filters')) ? $formData->get('filters') : []; + $reportCols = ($formData->get('colToshow')) ? $formData->get('colToshow') : []; + + $reportPlugin->setState('filters', $reportFilters); + $reportPlugin->setState('colToshow', $reportCols); + $reportPlugin->setState('reportId', $reportId); + + // Get results and errors if any + $report = $reportPlugin->getItems(); + $errors = $reportPlugin->getTJRMessages(); + + if (!empty($errors)) + { + ApiError::raiseError(400, $errors[0], 'APIValidationException'); + } + + // @TODO Handle else condition first to reduce nesting + if (!empty($reportCols)) + { + foreach ($report as $key => $value) + { + foreach ($value as $k => $v) + { + if (!in_array($k, $reportCols)) + { + unset($value[$k]); + } + } + + $report[$key] = $value; + } + } + + $this->plugin->setResponse($report); + } +} diff --git a/tjreports/script.tjreports.php b/tjreports/script.tjreports.php index 7d95be2..1585029 100755 --- a/tjreports/script.tjreports.php +++ b/tjreports/script.tjreports.php @@ -59,6 +59,9 @@ class Com_TjreportsInstallerScript ), 'user' => array( 'tjreportsindexer' => 0 + ), + 'api' => array( + 'reports' => 1 ) ) ); From dacff3d5e945a20d0bb2dee3e51488dfb5e7b410 Mon Sep 17 00:00:00 2001 From: vaishali k Date: Thu, 2 Jan 2020 19:00:40 +0530 Subject: [PATCH 02/38] Issue #155499 task:write a function in tjreports to get the reports that support google data studio connector --- tjreports/site/controllers/reports.json.php | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tjreports/site/controllers/reports.json.php b/tjreports/site/controllers/reports.json.php index 2dfa861..d9bf082 100644 --- a/tjreports/site/controllers/reports.json.php +++ b/tjreports/site/controllers/reports.json.php @@ -131,4 +131,37 @@ public function deleteQuery() echo new JResponseJson($e); } } + + /** + * Get the reports with function that sends fields in the form Google Data suit wants + * + * @return array + * + * @since __DEPLOY_VERSION__ + */ + public function getGoogleDsReports() + { + try + { + $model = $this->getModel('reports'); + $reports = $model->getenableReportPlugins(); + $reportsArray = array(); + + foreach ($reports as $report) + { + $pluginModel = $model->getPluginModel($report['plugin']); + + if (method_exists($pluginModel, 'getGoogleDsFields')) + { + $reportsArray[] = $report; + } + } + + echo new JResponseJson($reportsArray); + } + catch (Exception $e) + { + echo new JResponseJson($e); + } + } } From 32f6eaccefc3f973440f2b55eecf47d9ae68fe43 Mon Sep 17 00:00:00 2001 From: Nitesh Prakash Kesarkar Date: Fri, 10 Jan 2020 11:34:54 +0530 Subject: [PATCH 03/38] Issue #172 Fix: Notice: Undefined index in reports model & reports default view (#173) * Issue #172 Fix: Notice: Undefined index in reports model & reports default view * Issue #172 Fix: Notice: Undefined index in reports model & reports default view * Issue #172 Fix: Scrutinizer changes and namespaces * Issue #172 Fix: Scrutinizer changes --- tjreports/site/models/reports.php | 216 ++++++++++-------- tjreports/site/views/reports/tmpl/default.php | 82 ++++--- tjreports/site/views/reports/view.base.php | 81 ++++--- 3 files changed, 211 insertions(+), 168 deletions(-) diff --git a/tjreports/site/models/reports.php b/tjreports/site/models/reports.php index 2472f24..70728a6 100755 --- a/tjreports/site/models/reports.php +++ b/tjreports/site/models/reports.php @@ -10,6 +10,14 @@ // No direct access defined('_JEXEC') or die('Restricted access'); +Use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Factory; +Use Joomla\Registry\Registry; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\HTML\HTMLHelper; + jimport('joomla.application.component.modellist'); // Load TJReports db helper @@ -21,7 +29,7 @@ * * @since 1.0.0 */ -class TjreportsModelReports extends JModelList +class TjreportsModelReports extends ListModel { // Default ordering of Data protected $default_order = ''; @@ -114,14 +122,17 @@ public function __construct($config = array()) // Get email column $this->emailColumn = array_search( - 1, array_map( - function ($ar) { - if (!empty($ar['emailColumn'])) - { - return $ar['emailColumn']; - } - }, $this->columns - ) + 1, + array_map( + function ($ar) + { + if (!empty($ar['emailColumn'])) + { + return $ar['emailColumn']; + } + }, + $this->columns + ) ); // Check PII data permission @@ -154,7 +165,7 @@ protected function setCustomFieldsColumns() } // Get column name, type for custom fields index table - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $columnsDetails = $db->getTableColumns($this->customFieldsTable); // If no columns, return @@ -179,9 +190,9 @@ protected function setCustomFieldsColumns() foreach ($columnNames as $columnName) { $customField = array ( - 'title' => ($columnLabels[$columnName]) ? $columnLabels[$columnName] : $columnName, - 'table_column' => $this->customFieldsTableAlias . '.' . $columnName, - 'not_show_hide' => false + 'title' => isset($columnLabels[$columnName]) ? $columnLabels[$columnName] : $columnName, + 'table_column' => $this->customFieldsTableAlias . '.' . $columnName, + 'not_show_hide' => false ); // Eg. tuf.dob @@ -214,7 +225,7 @@ protected function setCustomFieldsDisplayFilters(&$displayFilters) } // Get column name, type for custom fields index table - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $columnsDetails = $db->getTableColumns($this->customFieldsTable); // If no columns, return @@ -275,13 +286,13 @@ protected function setCustomFieldsDisplayFilters(&$displayFilters) $this->customFieldsTableAlias . '.' . $key . '_from' => array ( 'attrib' => array ( 'placeholder' => 'YYYY-MM-DD', - 'onChange' => 'tjrContentUI.report.attachCalSubmit(this);' + 'onChange' => 'tjrContentUI.report.attachCalSubmit(this);' ) ), $this->customFieldsTableAlias . '.' . $key . '_to' => array ( 'attrib' => array ( 'placeholder' => 'YYYY-MM-DD', - 'onChange' => 'tjrContentUI.report.attachCalSubmit(this);' + 'onChange' => 'tjrContentUI.report.attachCalSubmit(this);' ) ) ); @@ -328,14 +339,14 @@ protected function setCustomFieldsDisplayFilters(&$displayFilters) */ protected function getCustomFieldsDisplayFilterOptions($column) { - $objArray = array(); - $obj = new stdClass; - $obj->text = JText::_('- Select ' . $column . ' -'); - $obj->value = ''; - $objArray[] = $obj; + $objArray = array(); + $obj = new stdClass; + $obj->text = Text::_('- Select ' . $column . ' -'); + $obj->value = ''; + $objArray[] = $obj; // Get column name, type for custom fields index table - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Get column labels from #__fields table for all indexed custom fields from this table $query = $db->getQuery(true); @@ -359,10 +370,11 @@ protected function getCustomFieldsDisplayFilterOptions($column) * */ private function initData() { - $columns = $this->columns; - $columnsKeys = array_keys($columns); + $columns = $this->columns; + $columnsKeys = array_keys($columns); + $this->sortableWoQuery = array(); + $this->defaultColToShow = $this->sortableColumns = $this->showhideCols = array_combine($columnsKeys, $columnsKeys); - $this->sortableWoQuery = array(); foreach ($columns as $key => $column) { @@ -430,9 +442,12 @@ public function getTJRMessages() public function getValidRequestVars() { $validVars = array( - 'colToshow' => 'ARRAY', 'filters' => 'ARRAY', - 'limit' => 'INT', 'limitstart' => 'INT', - 'filter_order' => 'STRING', 'filter_order_Dir' => 'STRING' + 'colToshow' => 'ARRAY', + 'filters' => 'ARRAY', + 'limit' => 'INT', + 'limitstart' => 'INT', + 'filter_order' => 'STRING', + 'filter_order_Dir' => 'STRING' ); return $validVars; @@ -524,8 +539,8 @@ protected function _getList($query, $limitstart = 0, $limit = 0) protected function populateState($ordering = '', $direction = 'ASC') { // List state information - $app = JFactory::getApplication(); - $input = JFactory::getApplication()->input; + $app = Factory::getApplication(); + $input = $app->input; if (!($reportId = $input->get('reportId', 0, 'uint'))) { @@ -542,13 +557,13 @@ protected function populateState($ordering = '', $direction = 'ASC') if (empty($colToshow)) { $reportParams = $this->getReportParams($reportId); - - $colToshow = $reportParams->get("colToshow"); - $piiColumns = array_flip($reportParams->get("piiColumns")); + $colToshow = (array) $reportParams->get("colToshow"); + $piiColumns = (array) $reportParams->get("piiColumns"); + $piiColumns = array_flip($piiColumns); if (!empty($piiColumns)) { - $colToshow = (object) array_diff_key((array) $colToshow, $piiColumns); + $colToshow = (object) array_diff_key($colToshow, $piiColumns); } } @@ -561,7 +576,7 @@ protected function populateState($ordering = '', $direction = 'ASC') $this->setState('colToshow', $colToshow); - $filters = $input->get('filters', array(), 'ARRAY'); + $filters = $input->get('filters', array(), 'ARRAY'); $this->setState('filters', $filters); // List state information @@ -620,7 +635,7 @@ protected function populateState($ordering = '', $direction = 'ASC') */ protected function getListQuery() { - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $filters = (array) $this->getState('filters'); $displayFilters = (array) $this->displayFilters(); @@ -762,9 +777,9 @@ protected function sortCustomColumns($items) if (!empty($items) && !empty($sortKey) && in_array($sortKey, $this->sortableWoQuery) && $limit) { - $orderDir = $this->getState('list.direction', $this->default_order_dir); + $orderDir = $this->getState('list.direction', $this->default_order_dir); $this->multi_d_sort($items, $sortKey, $orderDir); - $items = array_splice($items, $limitstart, $limit); + $items = array_splice($items, $limitstart, $limit); } return $items; @@ -809,7 +824,7 @@ private function multi_d_sort(&$array, $column, $order) * * @param INT $reportToBuild report to build * - * @return object + * @return Mixed * * @since 1.0 */ @@ -817,7 +832,7 @@ public function getSavedQueries($user_id, $reportToBuild) { if (!empty($reportToBuild) && !empty($user_id)) { - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select('*'); $query->from('#__tj_reports'); @@ -843,7 +858,7 @@ public function getSavedQueries($user_id, $reportToBuild) */ public function getQueryData($queryId) { - $ol_user = JFactory::getUser()->id; + $ol_user = Factory::getUser()->id; $query = $this->_db->getQuery(true); $query->select('*'); $query->from('#__tj_reports'); @@ -859,23 +874,23 @@ public function getQueryData($queryId) /** * Get all plugins names * - * @return object + * @return Array * * @since 1.0 */ public function getenableReportPlugins() { - $user = JFactory::getUser(); - $input = JFactory::getApplication()->input; + $user = Factory::getUser(); + $input = Factory::getApplication()->input; $client = $input->get('client', '', 'STRING'); // Get all report plugin $dispatcher = JEventDispatcher::getInstance(); - $plugins = JPluginHelper::getPlugin('tjreports'); + $plugins = PluginHelper::getPlugin('tjreports'); $pluginExists = json_decode(json_encode($plugins), true); - $pluginNames = array_column($pluginExists, 'name'); + $pluginNames = array_column($pluginExists, 'name'); - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select(array('id as reportId, title, plugin, ordering')); @@ -905,7 +920,10 @@ public function getenableReportPlugins() // In view layouts - reports[0] is used, and since array indexes are unset above, // Let's re-arrange index accordingly - $reports = array_values($reports); + if (is_array($reports)) + { + $reports = array_values($reports); + } return $reports; } @@ -919,7 +937,7 @@ public function getenableReportPlugins() */ public function getUserFilter() { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select('u.id,u.username'); @@ -929,13 +947,13 @@ public function getUserFilter() $db->setQuery($query); $users = $db->loadObjectList(); - $userFilter[] = JHTML::_('select.option', '', JText::_('COM_TJREPORTS_FILTER_SELECT_USER')); + $userFilter[] = HTMLHelper::_('select.option', '', Text::_('COM_TJREPORTS_FILTER_SELECT_USER')); if (!empty($users)) { foreach ($users as $eachUser) { - $userFilter[] = JHTML::_('select.option', $eachUser->id, $eachUser->username); + $userFilter[] = HTMLHelper::_('select.option', $eachUser->id, $eachUser->username); } } @@ -952,9 +970,9 @@ public function getUserFilter() public function getreportoptions() { // Initialize variables. - $db = JFactory::getDbo(); - $query = $db->getQuery(true); - $user_id = JFactory::getUser()->id; + $db = Factory::getDbo(); + $query = $db->getQuery(true); + $user_id = Factory::getUser()->id; $clients = $this->getState('client'); @@ -984,11 +1002,11 @@ public function getreportoptions() $db->setQuery($query); $reports = $db->loadObjectList(); - $options[] = JHTML::_('select.option', 0, JText::_('COM_TJREPORTS_SELONE_REPORTS')); + $options[] = HTMLHelper::_('select.option', 0, Text::_('COM_TJREPORTS_SELONE_REPORTS')); foreach ($reports as $repo) { - $options[] = JHtml::_('select.option', $repo->value, $repo->text); + $options[] = HTMLHelper::_('select.option', $repo->value, $repo->text); } return $options; @@ -1014,14 +1032,14 @@ public function canViewPiiData() * * @param INT $reportId report id * - * @return object + * @return Mixed * - * @since 1.0 + * @since 1.0 */ public function checkpermissions($reportId) { - $user = JFactory::getUser(); + $user = Factory::getUser(); if ($reportId) { @@ -1042,8 +1060,8 @@ public function checkpermissions($reportId) */ public function getUserGroupFilter($includeSuperAdmin = true) { - $groups = JHtml::_('user.groups', $includeSuperAdmin); - array_unshift($groups, JHtml::_('select.option', '', JText::_('JGLOBAL_FILTER_GROUPS_LABEL'))); + $groups = HTMLHelper::_('user.groups', $includeSuperAdmin); + array_unshift($groups, HTMLHelper::_('select.option', '', Text::_('JGLOBAL_FILTER_GROUPS_LABEL'))); return $groups; } @@ -1057,25 +1075,25 @@ public function getUserGroupFilter($includeSuperAdmin = true) */ public function datadenyset() { - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $reportId = $input->get('reportId', '0', 'int'); if ($reportId) { $this->model = $this->getModel('reports'); - $reportData = $this->model->getReportNameById($reportId); - $reportName = $reportData->title; + $reportData = $this->model->getReportNameById($reportId); + $reportName = $reportData->title; } else { return false; } - $user_id = JFactory::getUser()->id; + $user_id = Factory::getUser()->id; if ($reportName && $user_id && $reportId) { - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select(array('param')); $query->from($db->quoteName('#__tj_reports')); @@ -1113,7 +1131,7 @@ public function loadLanguage($name, $type = 'tjreports', $extension = '', $baseP } $extension = strtolower($extension); - $lang = JFactory::getLanguage(); + $lang = Factory::getLanguage(); // If language already loaded, don't load it again. if ($lang->getPaths($extension)) @@ -1210,12 +1228,12 @@ private function processSavedReportColumns($queryId, &$selColToshow) ->from('#__tj_reports') ->where('id=' . (int) $queryId); $this->_db->setQuery($query); - $queryData = $this->_db->loadObject(); - $i = $parent = 0; + $queryData = $this->_db->loadObject(); + $i = $parent = 0; if (!empty($queryData->param)) { - $param = json_decode($queryData->param, true); + $param = json_decode($queryData->param, true); if (isset($param['showHideColumns'])) { @@ -1270,9 +1288,8 @@ private function processSavedReportColumns($queryId, &$selColToshow) /* Checked the columns which are hide(false) in load params & if set them as piiColumns * then it only returns the columns which are not available in piiColumns. */ $this->filterDefaultColToHide = array_diff($this->filterDefaultColToHide, $param['piiColumns']); - - $this->filterParamColToshow = array_diff($this->filterParamColToshow, $param['piiColumns']); - $this->filterShowhideCols = array_diff($this->filterShowhideCols, $param['piiColumns']); + $this->filterParamColToshow = array_diff($this->filterParamColToshow, $param['piiColumns']); + $this->filterShowhideCols = array_diff($this->filterShowhideCols, $param['piiColumns']); } $parent = $queryData->parent; @@ -1283,7 +1300,7 @@ private function processSavedReportColumns($queryId, &$selColToshow) if (!empty($this->piiColumns) && !$this->piiPermission) { $this->defaultColToShow = array_diff($this->defaultColToShow, $this->piiColumns); - $this->showhideCols = array_diff($this->showhideCols, $this->piiColumns); + $this->showhideCols = array_diff($this->showhideCols, $this->piiColumns); } } @@ -1295,15 +1312,15 @@ private function processSavedReportColumns($queryId, &$selColToshow) * * @param INT $reportId Report Id * - * @return Object + * @return Mixed * * @since 3.0 */ public function getReportNameById($reportId) { - $db = JFactory::getDBO(); - JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); - $reportTable = JTable::getInstance('Tjreport', 'TjreportsTable', array('dbo', $db)); + $db = Factory::getDBO(); + Table::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); + $reportTable = Table::getInstance('Tjreport', 'TjreportsTable', array('dbo', $db)); $reportTable->load(array('id' => $reportId)); return $reportTable; @@ -1321,9 +1338,8 @@ public function getReportNameById($reportId) */ public function getReportLink($reportToLink, $filters) { - $user = JFactory::getUser(); - - $reports = $this->getPluginReport($reportToLink); + $user = Factory::getUser(); + $reports = $this->getPluginReport($reportToLink); $filterLink = ''; foreach ($filters as $key => $value) @@ -1349,18 +1365,18 @@ public function getReportLink($reportToLink, $filters) * * @param STRING $reportId Report id * - * @return Integer + * @return Object * * @since 1.1.0 */ public function getReportParams($reportId) { - $db = JFactory::getDBO(); - JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); - $reportTable = JTable::getInstance('Tjreport', 'TjreportsTable', array('dbo', $db)); + $db = Factory::getDBO(); + Table::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); + $reportTable = Table::getInstance('Tjreport', 'TjreportsTable', array('dbo', $db)); $reportTable->load($reportId); - return new JRegistry($reportTable->param); + return new Registry($reportTable->param); } /** @@ -1374,9 +1390,9 @@ public function getReportParams($reportId) */ public function getDefaultReport($pluginName) { - $db = JFactory::getDBO(); - JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); - $reportTable = JTable::getInstance('Tjreport', 'TjreportsTable', array('dbo', $db)); + $db = Factory::getDBO(); + Table::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); + $reportTable = Table::getInstance('Tjreport', 'TjreportsTable', array('dbo', $db)); $reportTable->load(array('plugin' => $pluginName, 'default' => 1)); return $reportTable->id; @@ -1397,7 +1413,7 @@ public function getPluginReport($pluginName) if (!isset($reports[$pluginName])) { - $db = JFactory::getDBO(); + $db = Factory::getDBO(); $query = $db->getQuery(true); $query->select(array('id as reportId', 'client')); $query->from($db->quoteName('#__tj_reports')); @@ -1459,7 +1475,7 @@ public function getPluginInstallationDetail($pluginName) if ($pluginName && !isset($clients[$pluginName])) { $clients[$pluginName] = ''; - $model = $this->getPluginModel($pluginName); + $model = $this->getPluginModel($pluginName); if ($model) { @@ -1477,7 +1493,7 @@ public function getPluginInstallationDetail($pluginName) */ public function addTjReportsPlugins() { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select( $db->quoteName( @@ -1509,21 +1525,21 @@ public function addTjReportsPlugins() foreach ($plugins as $plugin) { - $pluginName = $plugin->name; - JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); - $reportTable = JTable::getInstance('Tjreport', 'TjreportsTable'); - $details = $this->getPluginInstallationDetail($pluginName); + $pluginName = $plugin->name; + Table::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjreports/tables'); + $reportTable = Table::getInstance('Tjreport', 'TjreportsTable'); + $details = $this->getPluginInstallationDetail($pluginName); $reportTable->load(array('plugin' => $pluginName, 'userid' => 0)); if (!$reportTable->id) { - $data = array(); - $data['title'] = $details['title']; + $data = array(); + $data['title'] = $details['title']; $data['plugin'] = $pluginName; - $data['alias'] = $pluginName; + $data['alias'] = $pluginName; $data['client'] = $details['client']; $data['parent'] = 0; - $data['default'] = 1; + $data['default'] = 1; $reportTable->save($data); $count++; diff --git a/tjreports/site/views/reports/tmpl/default.php b/tjreports/site/views/reports/tmpl/default.php index b63d2b3..284e142 100644 --- a/tjreports/site/views/reports/tmpl/default.php +++ b/tjreports/site/views/reports/tmpl/default.php @@ -10,11 +10,18 @@ // no direct access defined('_JEXEC') or die; -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +use Joomla\CMS\Factory; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Filter\OutputFilter; + +HTMLHelper::addIncludePath(JPATH_COMPONENT . '/helpers/html'); $emailColmClass = 'td-sendemail'; -$app = JFactory::getApplication(); +$app = Factory::getApplication(); $headerLevel = $this->headerLevel; $this->listOrder = $this->state->get('list.ordering'); $this->listDirn = $this->state->get('list.direction'); @@ -32,25 +39,25 @@ } } -$input = JFactory::getApplication()->input; +$input = Factory::getApplication()->input; $displayFilters = $this->userFilters; $totalHeadRows = count($displayFilters); $reportId = $app->getUserStateFromRequest('reportId', 'reportId', ''); -$user = JFactory::getUser(); +$user = Factory::getUser(); $userAuthorisedExport = $user->authorise('core.export', 'com_tjreports.tjreport.' . $reportId); -if ($app->isSite()) +if ($app->isClient('site')) { - $siteUrl = JUri::root(); - $message = array(); - $message['success'] = JText::_("COM_TJREPORTS_EXPORT_FILE_SUCCESS"); - $message['error'] = JText::_("COM_TJREPORTS_EXPORT_FILE_ERROR"); - $message['inprogress'] = JText::_("COM_TJREPORTS_EXPORT_FILE_NOTICE"); - $message['text'] = JText::_("COM_TJREPORTS_CSV_EXPORT"); + $siteUrl = Uri::root(); + $message = array(); + $message['success'] = Text::_("COM_TJREPORTS_EXPORT_FILE_SUCCESS"); + $message['error'] = Text::_("COM_TJREPORTS_EXPORT_FILE_ERROR"); + $message['inprogress'] = Text::_("COM_TJREPORTS_EXPORT_FILE_NOTICE"); + $message['text'] = Text::_("COM_TJREPORTS_CSV_EXPORT"); - JHtml::script(JUri::base() . 'libraries/techjoomla/assets/js/tjexport.js'); - $document = JFactory::getDocument(); - $csv_url = 'index.php?option=' . $input->get('option') . '&view=' . $input->get('view') . '&format=csv'; + HTMLHelper::script(Uri::base() . 'libraries/techjoomla/assets/js/tjexport.js'); + $document = Factory::getDocument(); + $csv_url = 'index.php?option=' . $input->get('option') . '&view=' . $input->get('view') . '&format=csv'; $document->addScriptDeclaration("var csv_export_url='{$csv_url}';"); $document->addScriptDeclaration("var csv_export_success='{$message['success']}';"); @@ -75,14 +82,14 @@ isSite() && isset($this->reportData->title)) + if ($app->isClient('site') && isset($this->reportData->title)) { ?>

reportData->title, ENT_COMPAT, 'UTF-8'); ?>

-
+
@@ -115,7 +122,7 @@
isAdmin()) + if (!$app->isClient('administrator')) { echo $this->pagination->getPaginationLinks('joomla.pagination.links', array('showPagesLinks' => false,'showLimitStart' => false)); } @@ -136,7 +143,7 @@ { ?>
- savedQueries, "queryId", 'class="" size="1" onchange="tjrContentUI.report.getQueryResult(this.value);" name="filter_saveQuery"', "value", "text", $this->queryId); + savedQueries, "queryId", 'class="" size="1" onchange="tjrContentUI.report.getQueryResult(this.value);" name="filter_saveQuery"', "value", "text", $this->queryId); ?> queryId) @@ -153,7 +160,7 @@ isSite()) + if ($app->isClient('site')) { if ($this->isExport) { @@ -165,7 +172,7 @@ - +
@@ -183,7 +190,7 @@ ?>
@@ -192,7 +199,7 @@ ?>
- +
    showHideColumns as $colKey) @@ -210,13 +217,13 @@ if (in_array($colKey, $this->colToshow)) { - $checked = 'checked="checked"'; + $checked = 'checked="checked"'; } ?>
  • isAdmin() && $userAuthorisedExport && $user) + if (!$app->isClient('administrator') && $userAuthorisedExport && $user) { ?> srButton !== -1) { ?> - -
@@ -323,15 +330,15 @@ echo ''; - $colTitle = JText::sprintf($subTextTitle, $keyDetails[1]) ; + $colTitle = Text::sprintf($subTextTitle, $keyDetails[1]) ; if (in_array($subKey, $this->sortable)) { - echo $sortHtml = JHtml::_('grid.sort', $colTitle, $subKey, $this->listDirn, $this->listOrder); + echo $sortHtml = HTMLHelper::_('grid.sort', $colTitle, $subKey, $this->listDirn, $this->listOrder); } else { - echo '
' . JText::_($colTitle) . '
'; + echo '
' . Text::_($colTitle) . '
'; } echo ''; @@ -340,7 +347,7 @@ else { $colKey = $detail; - $colKeyClass = JFilterOutput::stringURLSafe($colKey); + $colKeyClass = OutputFilter::stringURLSafe($colKey); if (!isset($this->columns[$colKey]['title'])) { $colTitle = 'PLG_TJREPORTS_' . strtoupper($this->pluginName . '_' . $colKey . '_TITLE'); @@ -359,11 +366,11 @@ if (in_array($colKey, $this->sortable)) { - echo $sortHtml = JHtml::_('grid.sort', $colTitle, $colKey, $this->listDirn, $this->listOrder); + echo $sortHtml = HTMLHelper::_('grid.sort', $colTitle, $colKey, $this->listDirn, $this->listOrder); } else { - echo '
' . JText::_($colTitle) . '
'; + echo '
' . Text::_($colTitle) . '
'; } if ($hasFilter) { @@ -434,7 +441,8 @@ else { $isSendEmailClass = ($key == $this->emailColumn) ? $emailColmClass : ''; - echo "{$item[$key]}"; + $value = isset($item[$key]) ? $item[$key] : ''; + echo "{$value}"; } } @@ -463,7 +471,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 9e14e42..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,15 +176,15 @@ 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->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. - $this->defaultColToHide = array_keys($this->model->getState('defaultColToHide')); - $this->columns = $this->model->columns; + $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 @@ -184,19 +206,16 @@ public function processData($type = 'html') $this->showHideColumns = array_intersect($this->model->showhideCols, array_merge($this->defaultColToshow, $this->defaultColToHide)); } - $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->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; } @@ -208,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); } } From d6397abd761a157b11659015d1d17faae057e255 Mon Sep 17 00:00:00 2001 From: Prav Date: Wed, 22 Jan 2020 17:35:43 +0530 Subject: [PATCH 04/38] Task #176 chore: Compatible date field filter for any date format and modified in query --- tjreports/site/models/reports.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tjreports/site/models/reports.php b/tjreports/site/models/reports.php index 70728a6..d1fb879 100755 --- a/tjreports/site/models/reports.php +++ b/tjreports/site/models/reports.php @@ -24,6 +24,8 @@ JLoader::import('database', JPATH_SITE . '/components/com_tjreports/helpers'); JLoader::import('components.com_tjreports.helpers.tjreports', JPATH_ADMINISTRATOR); +use Joomla\CMS\Date\Date; + /** * Methods supporting a list of Tjreports records. * @@ -687,12 +689,14 @@ protected function getListQuery() if (!empty($filters[$fromCol])) { $fromTime = $filters[$fromCol] . ' 00:00:00'; + $fromTime = new Date($fromTime, 'UTC'); $query->where($dispFilter['searchin'] . ' >= ' . $db->quote($fromTime)); } if (!empty($filters[$toCol])) { $toTime = $filters[$toCol] . ' 23:59:59'; + $toTime = new Date($toTime, 'UTC'); $query->where($dispFilter['searchin'] . ' <= ' . $db->quote($toTime)); } } @@ -1363,7 +1367,7 @@ public function getReportLink($reportToLink, $filters) /** * Method to get id of the report having default set as 1 * - * @param STRING $reportId Report id + * @param STRING $reportId Report Id * * @return Object * From 65f9c63626d94f36f481458df8748ec3049af842 Mon Sep 17 00:00:00 2001 From: Prav Date: Wed, 22 Jan 2020 18:03:01 +0530 Subject: [PATCH 05/38] Issue #145 feat: to get usergoups title based on user id --- tjreports/site/models/reports.php | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tjreports/site/models/reports.php b/tjreports/site/models/reports.php index d1fb879..4385512 100755 --- a/tjreports/site/models/reports.php +++ b/tjreports/site/models/reports.php @@ -1552,4 +1552,38 @@ public function addTjReportsPlugins() return $count; } + + /** + * Method to get report plugin of particular type for inter linking + * + * @param Int $userId User Id + * + * @return Array + * + * @since __DEPLOY_VERSION__ + */ + protected function getUserGroups($userId) + { + if (!$userId) + { + return array(); + } + + $db = JFactory::getDbo(); + $query = $db->getQuery(true); + + // Get the titles for the user groups. + $query = $db->getQuery(true) + ->select($db->quoteName('ug.id')) + ->select($db->quoteName('ug.title')) + ->from($db->quoteName('#__usergroups', 'ug')) + ->join('INNER', $db->qn('#__user_usergroup_map', 'ugm') . ' ON (' . + $db->qn('ugm.group_id') . ' = ' . $db->qn('ug.id') . ')') + ->where($db->quoteName('ugm.user_id') . ' = ' . (int) $userId); + + $db->setQuery($query); + + // Set the titles for the user groups. + return $db->loadAssocList('id', 'title'); + } } From 5b45b4e1d4c70c8ab1829f90730feb2f190c2019 Mon Sep 17 00:00:00 2001 From: vaishali k Date: Tue, 4 Feb 2020 18:21:03 +0530 Subject: [PATCH 06/38] Issue #155716 fix: check for getGDSFields function to get reports --- .../plugins/api/reports/reports/filters.php | 14 ++-- .../plugins/api/reports/reports/gdsfields.php | 69 +++++++++++++++++++ .../api/reports/reports/gdsreports.php | 48 +++++++++++++ .../plugins/api/reports/reports/report.php | 24 ++++--- 4 files changed, 140 insertions(+), 15 deletions(-) create mode 100644 tjreports/plugins/api/reports/reports/gdsfields.php create mode 100644 tjreports/plugins/api/reports/reports/gdsreports.php diff --git a/tjreports/plugins/api/reports/reports/filters.php b/tjreports/plugins/api/reports/reports/filters.php index c6ff182..76226e5 100644 --- a/tjreports/plugins/api/reports/reports/filters.php +++ b/tjreports/plugins/api/reports/reports/filters.php @@ -1,15 +1,17 @@ - * @copyright Copyright (C) 2009 - 2018 Techjoomla. All rights reserved. + * @copyright Copyright (C) 2009 - 2020 Techjoomla. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // No direct access. defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; /** * Tjreports API report class @@ -25,16 +27,16 @@ class ReportsApiResourceFilters extends ApiResource */ public function get() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; $reportName = $jinput->getString('id'); if (!isset($reportName)) { - ApiError::raiseError(400, JText::_('PLG_API_REPORTS_REPORT_NAME_MISSSING'), 'APIValidationException'); + ApiError::raiseError(400, Text::_('PLG_API_REPORTS_REPORT_NAME_MISSSING'), 'APIValidationException'); } - $lang = JFactory::getLanguage(); + $lang = Factory::getLanguage(); //load default joomla language file $lang->load('', JPATH_ADMINISTRATOR, 'en-GB', true); @@ -44,7 +46,7 @@ public function get() if (!class_exists($className)) { - ApiError::raiseError(400, JText::_('PLG_API_REPORTS_REPORT_NAME_INVALID'), 'APIValidationException'); + ApiError::raiseError(400, Text::_('PLG_API_REPORTS_REPORT_NAME_INVALID'), 'APIValidationException'); } $reportPlugin = new $className; diff --git a/tjreports/plugins/api/reports/reports/gdsfields.php b/tjreports/plugins/api/reports/reports/gdsfields.php new file mode 100644 index 0000000..5115102 --- /dev/null +++ b/tjreports/plugins/api/reports/reports/gdsfields.php @@ -0,0 +1,69 @@ + + * @copyright Copyright (C) 2009 - 2020 Techjoomla. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access. +defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; + +/** + * Tjreports API Gs fields class + * This is used to get the fields for the Google studio connector + * + * @since __DEPLOY_VERSION__ + */ +class ReportsApiResourceGdsfields extends ApiResource +{ + /** + * Function to get fields + * + * @return json + */ + public function get() + { + $app = Factory::getApplication(); + $jinput = $app->input; + $reportName = $app->input->getString('id'); + + if (empty($reportName)) + { + $reportName = $app->input->getString('report'); + } + + if (!isset($reportName)) + { + ApiError::raiseError(400, Text::_('PLG_API_REPORTS_REPORT_NAME_MISSSING'), 'APIValidationException'); + } + + // Create object of tjreports plugin class + JLoader::import('plugins.tjreports.' . $reportName . "." . $reportName, JPATH_SITE); + $className = 'TjreportsModel' . ucfirst($reportName); + + if (!class_exists($className)) + { + ApiError::raiseError(400, Text::_('PLG_API_REPORTS_REPORT_NAME_INVALID'), 'APIValidationException'); + } + + $reportPlugin = new $className; + + // If plugin does not have getGoogleDsFields throw error + if (!method_exists($reportPlugin, 'getGDSFields')) + { + ApiError::raiseError(400, Text::_('PLG_API_REPORTS_REPORT_NO_GOOGLESTUDIO_SUPPORT'), 'APIValidationException'); + } + + // Load language files + $lang = Factory::getLanguage(); + $lang->load('com_tjreports', JPATH_ADMINISTRATOR, 'en-GB', true); + $lang->load('plg_tjreports_' . $reportName, JPATH_SITE . "/plugins/tjreports/" . $reportName, 'en-GB', true); + + $this->plugin->setResponse($reportPlugin->getGDSFields()); + } +} diff --git a/tjreports/plugins/api/reports/reports/gdsreports.php b/tjreports/plugins/api/reports/reports/gdsreports.php new file mode 100644 index 0000000..25f2056 --- /dev/null +++ b/tjreports/plugins/api/reports/reports/gdsreports.php @@ -0,0 +1,48 @@ + + * @copyright Copyright (C) 2009 - 2020 Techjoomla. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access. +defined('_JEXEC') or die; +use Joomla\CMS\Factory; + +/** + * Tjreports API to get the tjreports plugin those support Google studio connector + * + * @since __DEPLOY_VERSION__ + */ +class ReportsApiResourceGdsreports extends ApiResource +{ + /** + * Function get reports + * + * @return boolean + */ + public function get() + { + // Create object of tjreports plugin class + JLoader::import('components.com_tjreports.models.reports', JPATH_SITE); + $reportModel = new TjreportsModelreports; + + $reports = $reportModel->getenableReportPlugins(); + $reportsArray = array(); + + foreach ($reports as $report) + { + $pluginModel = $reportModel->getPluginModel($report['plugin']); + + if (method_exists($pluginModel, 'getGDSFields')) + { + $reportsArray[] = $report; + } + } + + $this->plugin->setResponse($reportsArray); + } +} diff --git a/tjreports/plugins/api/reports/reports/report.php b/tjreports/plugins/api/reports/reports/report.php index 3ba048c..d9eeac0 100644 --- a/tjreports/plugins/api/reports/reports/report.php +++ b/tjreports/plugins/api/reports/reports/report.php @@ -1,15 +1,17 @@ - * @copyright Copyright (C) 2009 - 2018 Techjoomla. All rights reserved. + * @copyright Copyright (C) 2009 - 2020 Techjoomla. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // No direct access. defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; /** * Tjreports API report class @@ -25,7 +27,7 @@ class ReportsApiResourceReport extends ApiResource */ public function post() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $jinput = $app->input; $formData = $jinput->post; $reportName = $app->input->getString('id'); @@ -37,23 +39,23 @@ public function post() if (!isset($reportName)) { - ApiError::raiseError(400, JText::_('PLG_API_REPORTS_REPORT_NAME_MISSSING'), 'APIValidationException'); + ApiError::raiseError(400, Text::_('PLG_API_REPORTS_REPORT_NAME_MISSSING'), 'APIValidationException'); } // Create object of tjreports plugin class - + JLoader::import('plugins.tjreports.' . $reportName . "." . $reportName, JPATH_SITE); $className = 'TjreportsModel' . ucfirst($reportName); if (!class_exists($className)) { - ApiError::raiseError(400, JText::_('PLG_API_REPORTS_REPORT_NAME_INVALID'), 'APIValidationException'); + ApiError::raiseError(400, Text::_('PLG_API_REPORTS_REPORT_NAME_INVALID'), 'APIValidationException'); } $reportPlugin = new $className; - + // Load language files - $lang = JFactory::getLanguage(); + $lang = Factory::getLanguage(); $lang->load('com_tjreports', JPATH_ADMINISTRATOR, 'en-GB', true); $lang->load('plg_tjreports_' . $reportName, JPATH_SITE . "/plugins/tjreports/" . $reportName, 'en-GB', true); @@ -61,7 +63,10 @@ public function post() $reportId = $reportPlugin->getDefaultReport($reportName); $reportFilters = ($formData->get('filters')) ? $formData->get('filters') : []; $reportCols = ($formData->get('colToshow')) ? $formData->get('colToshow') : []; - + + // Set reportId in input + $app->input->set('reportId', $reportId); + $reportPlugin->setState('filters', $reportFilters); $reportPlugin->setState('colToshow', $reportCols); $reportPlugin->setState('reportId', $reportId); @@ -92,6 +97,7 @@ public function post() } } + $this->plugin->customAttributes->set("total", $reportPlugin->getTotal()); $this->plugin->setResponse($report); } } From 714cac6be5624af4458c169e8991351692b588a9 Mon Sep 17 00:00:00 2001 From: Vaishali K Date: Tue, 4 Feb 2020 18:24:32 +0530 Subject: [PATCH 07/38] Update reports.json.php --- tjreports/site/controllers/reports.json.php | 33 --------------------- 1 file changed, 33 deletions(-) diff --git a/tjreports/site/controllers/reports.json.php b/tjreports/site/controllers/reports.json.php index d9bf082..2dfa861 100644 --- a/tjreports/site/controllers/reports.json.php +++ b/tjreports/site/controllers/reports.json.php @@ -131,37 +131,4 @@ public function deleteQuery() echo new JResponseJson($e); } } - - /** - * Get the reports with function that sends fields in the form Google Data suit wants - * - * @return array - * - * @since __DEPLOY_VERSION__ - */ - public function getGoogleDsReports() - { - try - { - $model = $this->getModel('reports'); - $reports = $model->getenableReportPlugins(); - $reportsArray = array(); - - foreach ($reports as $report) - { - $pluginModel = $model->getPluginModel($report['plugin']); - - if (method_exists($pluginModel, 'getGoogleDsFields')) - { - $reportsArray[] = $report; - } - } - - echo new JResponseJson($reportsArray); - } - catch (Exception $e) - { - echo new JResponseJson($e); - } - } } From 2bab0bc89aa619678357754c8a6aa8d7b1906e72 Mon Sep 17 00:00:00 2001 From: vaishali k Date: Mon, 10 Feb 2020 19:14:31 +0530 Subject: [PATCH 08/38] Task #156044 Fix : TjReport Bulk Email sending --- tjreports/site/assets/js/tjrContentUI.js | 5 +++-- tjreports/site/views/reports/tmpl/default.php | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/tjreports/site/assets/js/tjrContentUI.js b/tjreports/site/assets/js/tjrContentUI.js index a76c1af..161a132 100755 --- a/tjreports/site/assets/js/tjrContentUI.js +++ b/tjreports/site/assets/js/tjrContentUI.js @@ -49,11 +49,12 @@ jQuery.extend(tjrContentUI.report, { // If sendEmail plug is enabled then try to add a column of checkboxes if ( - typeof window.tjSendEmail != 'undefined' && + typeof tjutilitysendemail != 'undefined' && jQuery('body').find('.td-sendemail').length > 0 ) { - window.tjemail = new window.tjSendEmail.UI("report-table", "td-sendemail", "cid"); + tjutilitysendemail.addColumn('report-table'); + tjutilitysendemail.btnSendEmail(); } // Reinitialze some js like for calandar, tooltip, chosen diff --git a/tjreports/site/views/reports/tmpl/default.php b/tjreports/site/views/reports/tmpl/default.php index b63d2b3..4442bdf 100644 --- a/tjreports/site/views/reports/tmpl/default.php +++ b/tjreports/site/views/reports/tmpl/default.php @@ -13,7 +13,7 @@ JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); $emailColmClass = 'td-sendemail'; - +$emailColumCnt = 0; $app = JFactory::getApplication(); $headerLevel = $this->headerLevel; $this->listOrder = $this->state->get('list.ordering'); @@ -433,7 +433,14 @@ } else { - $isSendEmailClass = ($key == $this->emailColumn) ? $emailColmClass : ''; + $isSendEmailClass = ''; + + if ($key == $this->emailColumn) + { + $isSendEmailClass = $emailColmClass; + $emailColumCnt++; + } + echo "{$item[$key]}"; } } @@ -493,3 +500,11 @@
+ + 0 && JPluginHelper::isEnabled('system', 'tjsendemail')) +{ + JHtml::script('media/editors/tinymce/tinymce.min.js'); + JHtml::script('plugins/system/tjsendemail/bulksendemail.min.js'); +} From 5ce4b7cf6315390fed384931080219999bf46544 Mon Sep 17 00:00:00 2001 From: vaishali k Date: Mon, 10 Feb 2020 19:21:28 +0530 Subject: [PATCH 09/38] Task #156044 Fix : TjReport Bulk Email sending --- tjreports/site/views/reports/tmpl/default.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tjreports/site/views/reports/tmpl/default.php b/tjreports/site/views/reports/tmpl/default.php index 4442bdf..140e98f 100644 --- a/tjreports/site/views/reports/tmpl/default.php +++ b/tjreports/site/views/reports/tmpl/default.php @@ -224,6 +224,8 @@ ?>
+ + isAdmin() && $userAuthorisedExport && $user) From 82c60f80966bcf0166272fc48959ed7e0f5db925 Mon Sep 17 00:00:00 2001 From: Vaishali K Date: Tue, 11 Feb 2020 14:16:58 +0530 Subject: [PATCH 10/38] Update default.php --- tjreports/site/views/reports/tmpl/default.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tjreports/site/views/reports/tmpl/default.php b/tjreports/site/views/reports/tmpl/default.php index 0949c86..7ae0bb5 100644 --- a/tjreports/site/views/reports/tmpl/default.php +++ b/tjreports/site/views/reports/tmpl/default.php @@ -21,8 +21,7 @@ $emailColmClass = 'td-sendemail'; $emailColumCnt = 0; -$app = JFactory::getApplication(); - +$app = Factory::getApplication(); $headerLevel = $this->headerLevel; $this->listOrder = $this->state->get('list.ordering'); $this->listDirn = $this->state->get('list.direction'); From 92e93c5aa9ad8e5ce96bad5fd2d4f32a28156095 Mon Sep 17 00:00:00 2001 From: Vaishali K Date: Thu, 13 Feb 2020 15:39:24 +0530 Subject: [PATCH 11/38] Update default.php --- tjreports/site/views/reports/tmpl/default.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tjreports/site/views/reports/tmpl/default.php b/tjreports/site/views/reports/tmpl/default.php index 7ae0bb5..843783d 100644 --- a/tjreports/site/views/reports/tmpl/default.php +++ b/tjreports/site/views/reports/tmpl/default.php @@ -515,6 +515,6 @@ // If plg_system_sendemail enable then load following js if ($emailColumCnt > 0 && JPluginHelper::isEnabled('system', 'tjsendemail')) { - JHtml::script('media/editors/tinymce/tinymce.min.js'); - JHtml::script('plugins/system/tjsendemail/bulksendemail.min.js'); + HTMLHelper::script('media/editors/tinymce/tinymce.min.js'); + HTMLHelper::script('plugins/system/tjsendemail/bulksendemail.min.js'); } From fe9417f4c02a513837b64feb8ec2fa8f70d55d40 Mon Sep 17 00:00:00 2001 From: Nitesh Kesarkar Date: Mon, 17 Feb 2020 23:48:51 +0530 Subject: [PATCH 12/38] Issue #180 Fix: Added missing language constants for column wise sorting --- .../languages/administrator/en-GB/en-GB.com_tjreports.ini | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tjreports/languages/administrator/en-GB/en-GB.com_tjreports.ini b/tjreports/languages/administrator/en-GB/en-GB.com_tjreports.ini index cfbb861..de9713a 100755 --- a/tjreports/languages/administrator/en-GB/en-GB.com_tjreports.ini +++ b/tjreports/languages/administrator/en-GB/en-GB.com_tjreports.ini @@ -139,3 +139,11 @@ COM_TJREPORTS_QUERY_DELETE_SUCCESS="Query deleted successfully." ;Added in v1.0.2 COM_TJREPORTS_NOTHING_TO_DISCOVER_PLUGINS="Nothing to discover" COM_TJREPORTS_DISCOVER_NEW_PLUGINS="%d new plugin(s) discovered" + +; Column wise sorting +COM_TJREPORTS_PLUGIN_ASC="Plugin ascending" +COM_TJREPORTS_PLUGIN_DESC="Plugin descending" +COM_TJREPORTS_CLIENT_ASC="Client ascending" +COM_TJREPORTS_CLIENT_DESC="Client descending" +COM_TJREPORTS_SAVED_QUERY_ASC="Saved Query ascending" +COM_TJREPORTS_SAVED_QUERY_DESC="Saved Query descending" From c55fa1eb36146b82a1eeefb1154bc83a4c60626e Mon Sep 17 00:00:00 2001 From: Pranoti Patil Date: Mon, 20 Apr 2020 15:00:51 +0530 Subject: [PATCH 13/38] Task #153710 feat: Show summary report for Feedback --- tjreports/administrator/models/tjreport.php | 18 ++-- .../views/reports/tmpl/default_summary.php | 21 ++++ .../views/tjreport/view.html.php | 44 +++++---- .../en-GB/en-GB.com_tjreports.ini | 5 + .../site/assets/js/tjrContentService.min.js | 1 + tjreports/site/assets/js/tjrContentUI.js | 95 ++++++++++++------- tjreports/site/assets/js/tjrContentUI.min.js | 1 + tjreports/site/models/reports.php | 47 +++++++-- tjreports/site/views/reports/tmpl/default.php | 27 +++++- .../views/reports/tmpl/default_summary.php | 66 +++++++++++++ tjreports/site/views/reports/view.base.php | 43 +++++---- tjreports/site/views/reports/view.html.php | 69 ++++++++------ tjreports/site/views/reports/view.json.php | 6 ++ 13 files changed, 324 insertions(+), 119 deletions(-) create mode 100644 tjreports/administrator/views/reports/tmpl/default_summary.php create mode 100644 tjreports/site/assets/js/tjrContentService.min.js create mode 100644 tjreports/site/assets/js/tjrContentUI.min.js create mode 100644 tjreports/site/views/reports/tmpl/default_summary.php diff --git a/tjreports/administrator/models/tjreport.php b/tjreports/administrator/models/tjreport.php index 5ed7eeb..08b823a 100644 --- a/tjreports/administrator/models/tjreport.php +++ b/tjreports/administrator/models/tjreport.php @@ -175,13 +175,17 @@ public function getReportPluginData($pluginId, $pluginName = null) $defaultColToHide = $plgModel->getState('defaultColToHide'); - $params = array(); - $params['filter_order'] = $plgModel->getState('list.ordering'); - $params['filter_order_Dir'] = $plgModel->getState('list.direction'); - $params['limit'] = $plgModel->getState('list.limit'); - $params['emailColumn'] = $plgModel->getState('emailColumn'); - $params['colToshow'] = $plgModel->getState('colToshow'); - $params['colToshow'] = array_combine($params['colToshow'], array_fill(0, count($params['colToshow']), true)); + $params = array(); + $params['filter_order'] = $plgModel->getState('list.ordering'); + $params['filter_order_Dir'] = $plgModel->getState('list.direction'); + $params['limit'] = $plgModel->getState('list.limit'); + + // Show summary report configuration in params + $params['showSummaryReport'] = $plgModel->getState('showSummaryReport'); + + $params['emailColumn'] = $plgModel->getState('emailColumn'); + $params['colToshow'] = $plgModel->getState('colToshow'); + $params['colToshow'] = array_combine($params['colToshow'], array_fill(0, count($params['colToshow']), true)); /* Here merge colToshow (array value is true) with defaultColToHide (array value is false) column - * so false value column not display on report by default.*/ diff --git a/tjreports/administrator/views/reports/tmpl/default_summary.php b/tjreports/administrator/views/reports/tmpl/default_summary.php new file mode 100644 index 0000000..a1cdd8f --- /dev/null +++ b/tjreports/administrator/views/reports/tmpl/default_summary.php @@ -0,0 +1,21 @@ + + * @copyright Copyright (C) 2009 - 2020 Techjoomla. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access +defined('_JEXEC') or die; + +// Load the layout & push variables + +$path = $this->tjreportsHelper->getViewpath('com_tjreports', 'reports', 'default_summary', 'SITE', 'SITE'); +ob_start(); +include $path; +$html = ob_get_contents(); +ob_end_clean(); +echo $html; diff --git a/tjreports/administrator/views/tjreport/view.html.php b/tjreports/administrator/views/tjreport/view.html.php index f28c31b..a7f8fac 100644 --- a/tjreports/administrator/views/tjreport/view.html.php +++ b/tjreports/administrator/views/tjreport/view.html.php @@ -8,7 +8,15 @@ */ // No direct access to this file defined('_JEXEC') or die; + +Use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Toolbar\ToolbarHelper; + require_once JPATH_COMPONENT . '/helpers/tjreports.php'; + /** * tjreport View * @@ -44,7 +52,7 @@ public function display($tpl = null) return false; } - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $extension = $input->get('extension', '', 'STRING'); $this->addToolBar(); @@ -63,7 +71,7 @@ public function display($tpl = null) */ protected function addToolBar() { - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; // Hide Joomla Administrator Main menu $input->set('hidemainmenu', true); @@ -71,17 +79,17 @@ protected function addToolBar() if ($isNew) { - $title = JText::_('COM_TJREPORTS_NEW'); + $title = Text::_('COM_TJREPORTS_NEW'); } else { - $title = JText::_('COM_TJREPORTS_EDIT'); + $title = Text::_('COM_TJREPORTS_EDIT'); } - JToolBarHelper::title($title, 'tjreport'); - JToolBarHelper::apply('tjreport.apply'); - JToolBarHelper::save('tjreport.save'); - JToolBarHelper::cancel( + ToolbarHelper::title($title, 'tjreport'); + ToolbarHelper::apply('tjreport.apply'); + ToolbarHelper::save('tjreport.save'); + ToolbarHelper::cancel( 'tjreport.cancel', $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE' ); @@ -96,14 +104,16 @@ protected function addToolBar() */ protected function addDocumentHeaderData() { - JHtml::_('jquery.framework'); - JText::script('COM_TJREPORTS_FORM_DEFAULT_OPTION'); - JText::script('COM_TJREPORTS_INVALID_JSON_VALUE'); - $document = JFactory::getDocument(); - $document->addScript(JURI::root() . '/components/com_tjreports/assets/js/tjrContentService.js'); - $document->addScript(JURI::root() . '/components/com_tjreports/assets/js/tjrContentUI.js'); - $document->addStylesheet(JURI::root() . '/components/com_tjreports/assets/css/tjreports.css'); - $document->addScriptDeclaration('tjrContentUI.base_url = "' . Juri::base() . '"'); - $document->addScriptDeclaration('tjrContentUI.root_url = "' . Juri::root() . '"'); + HTMLHelper::_('jquery.framework'); + Text::script('COM_TJREPORTS_FORM_DEFAULT_OPTION'); + Text::script('COM_TJREPORTS_INVALID_JSON_VALUE'); + + $document = Factory::getDocument(); + $document->addScript(Uri::root() . '/components/com_tjreports/assets/js/tjrContentService.js'); + $document->addScript(Uri::root() . '/components/com_tjreports/assets/js/tjrContentUI.js'); + $document->addStylesheet(Uri::root() . '/components/com_tjreports/assets/css/tjreports.css'); + + $document->addScriptDeclaration('tjrContentUI.base_url = "' . Uri::base() . '"'); + $document->addScriptDeclaration('tjrContentUI.root_url = "' . Uri::root() . '"'); } } diff --git a/tjreports/languages/administrator/en-GB/en-GB.com_tjreports.ini b/tjreports/languages/administrator/en-GB/en-GB.com_tjreports.ini index de9713a..1a57c2e 100755 --- a/tjreports/languages/administrator/en-GB/en-GB.com_tjreports.ini +++ b/tjreports/languages/administrator/en-GB/en-GB.com_tjreports.ini @@ -147,3 +147,8 @@ COM_TJREPORTS_CLIENT_ASC="Client ascending" COM_TJREPORTS_CLIENT_DESC="Client descending" COM_TJREPORTS_SAVED_QUERY_ASC="Saved Query ascending" COM_TJREPORTS_SAVED_QUERY_DESC="Saved Query descending" + +; Added in __DEPLOY_VERSION__ +COM_TJREPORTS_REPORT_SUMMARY="Summary Report" +COM_TJREPORTS_REPORT_DETAILS="Details Report" +COM_TJREPORTS_NO_RECORDS_FOUND_SUMMARY="No records found. Either you do not have any records or fields types found in records are not supported for showing summary report." diff --git a/tjreports/site/assets/js/tjrContentService.min.js b/tjreports/site/assets/js/tjrContentService.min.js new file mode 100644 index 0000000..d5c040d --- /dev/null +++ b/tjreports/site/assets/js/tjrContentService.min.js @@ -0,0 +1 @@ +var tjrContentService={postData:function(t,e,a){return a||(a={}),a.url=this.getBaseUrl()+t,a.data=e,a.type=void 0!==a.type?a.type:"POST",a.async=void 0===a.async||a.async,a.dataType=void 0!==a.datatype?a.datatype:"json",jQuery.ajax(a)},getBaseUrl:function(){return"undefined"!=typeof tjrContentUI?tjrContentUI.base_url:""}}; diff --git a/tjreports/site/assets/js/tjrContentUI.js b/tjreports/site/assets/js/tjrContentUI.js index 161a132..62e53b4 100755 --- a/tjreports/site/assets/js/tjrContentUI.js +++ b/tjreports/site/assets/js/tjrContentUI.js @@ -19,6 +19,26 @@ jQuery.extend(tjrContentUI.report, { url: 'index.php?option=com_tjreports&view=reports&format=json', querySaveUrl: 'index.php?option=com_tjreports&format=json', submitTJRData: function(task) { + + // Set the view layout on the basis of task + task = (typeof task == 'undefined' ) ? 'default' : task; + + // Default layout + + var layout = 'default'; + + if (task == "summary") + { + layout = 'summary'; + jQuery('#reportPagination').hide(); + jQuery('#pagination').hide(); + } + else + { + jQuery('#reportPagination').show(); + jQuery('#pagination').show(); + } + jQuery('#reports-container .hasTooltip').tooltip('destroy'); this.searchToggle = jQuery('div#topFilters').is(':visible'); tjrContentUI.utility.loadingLayer('show'); @@ -28,7 +48,7 @@ jQuery.extend(tjrContentUI.report, { return false; } jQuery(".hasPopover").popover('destroy') - var promise = tjrContentService.postData(this.url, this.$form.serialize());//, {'datatype':'html'} + var promise = tjrContentService.postData(this.url+'&tpl='+layout, this.$form.serialize());//, {'datatype':'html'} promise.fail( function(response) { @@ -42,47 +62,56 @@ jQuery.extend(tjrContentUI.report, { } ).done( function(response) { - var containerSel = '#j-main-container'; + tjrContentUI.utility.loadingLayer('hide'); - var responseHTML = jQuery(response['html']).find(containerSel).html(); - jQuery(containerSel).html(responseHTML); - - // If sendEmail plug is enabled then try to add a column of checkboxes - if ( - typeof tjutilitysendemail != 'undefined' && - jQuery('body').find('.td-sendemail').length > 0 - ) + + if (layout == 'summary') { - tjutilitysendemail.addColumn('report-table'); - tjutilitysendemail.btnSendEmail(); + jQuery("#report-containing-div").html(response['html']); } + else + { + var containerSel = '#j-main-container'; + var responseHTML = jQuery(response['html']).find(containerSel).html(); + jQuery(containerSel).html(responseHTML); + + // If sendEmail plug is enabled then try to add a column of checkboxes + if ( + typeof tjutilitysendemail != 'undefined' && + jQuery('body').find('.td-sendemail').length > 0 + ) + { + tjutilitysendemail.addColumn('report-table'); + } - // Reinitialze some js like for calandar, tooltip, chosen - jQuery(".hasPopover").popover({"html": true,"trigger": "hover focus","container": "body"}); + // Reinitialze some js like for calandar, tooltip, chosen + jQuery(".hasPopover").popover({"html": true,"trigger": "hover focus","container": "body"}); - if (task == "showHide") - { - tjrContentUI.report.getColNames(); - } + if (task == "showHide") + { + tjrContentUI.report.getColNames(); + } - var elements = jQuery(containerSel + " .field-calendar"); - for (i = 0; i < elements.length; i++) { - JoomlaCalendar.init(elements[i]); - } + var elements = jQuery(containerSel + " .field-calendar"); + for (i = 0; i < elements.length; i++) { + JoomlaCalendar.init(elements[i]); + } - if(jQuery.prototype.chosen){ - jQuery(containerSel + ' select').chosen(); - } + if(jQuery.prototype.chosen){ + jQuery(containerSel + ' select').chosen(); + } - if (task == 'reset') - { - tjrContentUI.report.searchToggle = false; - } + if (task == 'reset') + { + tjrContentUI.report.searchToggle = false; + } - if (tjrContentUI.report.searchToggle) - { - jQuery('#show-filter').addClass('btn-primary').find('i').removeClass('fa-caret-down').addClass('fa-caret-up'); - jQuery('#topFilters').show(); + if (tjrContentUI.report.searchToggle) + { + jQuery('#show-filter').addClass('btn-primary').find('i').removeClass('fa-caret-down').addClass('fa-caret-up'); + jQuery('#topFilters').show(); + } + jQuery('.btn-displayReport').toggleClass('active btn-success'); } } ).always( diff --git a/tjreports/site/assets/js/tjrContentUI.min.js b/tjreports/site/assets/js/tjrContentUI.min.js new file mode 100644 index 0000000..e6796bb --- /dev/null +++ b/tjreports/site/assets/js/tjrContentUI.min.js @@ -0,0 +1 @@ +if(void 0===tjrContentUI)var tjrContentUI={};tjrContentUI.root_url="undefined"==typeof root_url?"":root_url,tjrContentUI.base_url="undefined"==typeof root_url?"":root_url,tjrContentUI.report=tjrContentUI.report?tjrContentUI.report:{},jQuery.extend(tjrContentUI.report,{searchToggle:!0,$form:null,url:"index.php?option=com_tjreports&view=reports&format=json",querySaveUrl:"index.php?option=com_tjreports&format=json",submitTJRData:function(e){var t="default";if("summary"==(e=void 0===e?"default":e)?(t="summary",jQuery("#reportPagination").hide(),jQuery("#pagination").hide()):(jQuery("#reportPagination").show(),jQuery("#pagination").show()),jQuery("#reports-container .hasTooltip").tooltip("destroy"),this.searchToggle=jQuery("div#topFilters").is(":visible"),tjrContentUI.utility.loadingLayer("show"),this.$form=jQuery("#adminForm"),!this.validate())return!1;jQuery(".hasPopover").popover("destroy"),tjrContentService.postData(this.url+"&tpl="+t,this.$form.serialize()).fail(function(e){console.log("Something went wrong."),tjrContentUI.utility.loadingLayer("hide"),403==e.status&&alert(Joomla.JText._("JERROR_ALERTNOAUTHOR"))}).done(function(r){if(tjrContentUI.utility.loadingLayer("hide"),"summary"==t)jQuery("#report-containing-div").html(r.html);else{var o=jQuery(r.html).find("#j-main-container").html();jQuery("#j-main-container").html(o),"undefined"!=typeof tjutilitysendemail&&jQuery("body").find(".td-sendemail").length>0&&tjutilitysendemail.addColumn("report-table"),jQuery(".hasPopover").popover({html:!0,trigger:"hover focus",container:"body"}),"showHide"==e&&tjrContentUI.report.getColNames();var n=jQuery("#j-main-container .field-calendar");for(i=0;i").html(e);return t.find("script").remove(),e=t.html()},displayMessage:function(e,t,r){this.parent.validation.messages={},this.parent.validation.addMessage(e,t),this.displayMessages()},displayMessages:function(e){Joomla.removeMessages(),Joomla.renderMessages(this.parent.validation.messages),e&&jQuery("body").animate({scrollTop:jQuery("#system-message-container").offset().top},500)},setJSCookie:function(e,t,r){var o="";if(r){var n=new Date;n.setTime(n.getTime()+24*r*60*60*1e3),o="; expires="+n.toUTCString()}document.cookie=e+"="+t+o+"; path=/"},getJSCookie:function(e){for(var t=e+"=",r=document.cookie.split(";"),o=0;oget('limitstart', 0, 'uint'); $this->setState('list.start', $value); + // Set show summary report configuration in params + if (!empty($this->showSummaryReport)) + { + $this->setState('showSummaryReport', $this->showSummaryReport); + } + if (!empty($this->piiColumns)) { $this->setState('piiColumns', $this->piiColumns); @@ -637,6 +650,7 @@ protected function populateState($ordering = '', $direction = 'ASC') */ protected function getListQuery() { + $input = Factory::getApplication()->input; $db = Factory::getDBO(); $query = $db->getQuery(true); $filters = (array) $this->getState('filters'); @@ -730,6 +744,15 @@ protected function getListQuery() $this->canLimitQuery = true; } + // Remove limit while showing summary report + $tpl = $input->get('tpl', 'default', 'string'); + $tpl = ($tpl == 'default' || $tpl == 'submit') ? null : $tpl; + + if ($tpl != null) + { + $this->canLimitQuery = false; + } + // Joomla fields integration - Get custom fields data // Proceed if table exists, and at least one custom field is seleced for showing if ($this->customFieldsTableExists && !empty($this->customFieldsTableColumnsForQuery) && !empty($this->customFieldsQueryJoinOn)) @@ -1251,6 +1274,12 @@ private function processSavedReportColumns($queryId, &$selColToshow) } } + // Set the value of show summary report from param to variable + if (isset($param['showSummaryReport'])) + { + $this->showSummaryReport = $param['showSummaryReport']; + } + if (isset($param['piiColumns'])) { if (empty($this->filterPiiColumns)) @@ -1437,16 +1466,16 @@ public function getPluginReport($pluginName) * @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 getPluginModel($name = '', $prefix = '', $config = array()) { - JModelLegacy::addIncludePath(JPATH_SITE . '/plugins/tjreports/' . $name); + BaseDatabaseModel::addIncludePath(JPATH_SITE . '/plugins/tjreports/' . $name); $this->loadLanguage($name, 'tjreports'); - return JModelLegacy::getInstance($name, 'TjreportsModel', $config); + return BaseDatabaseModel::getInstance($name, 'TjreportsModel', $config); } /** diff --git a/tjreports/site/views/reports/tmpl/default.php b/tjreports/site/views/reports/tmpl/default.php index 843783d..d3e9954 100644 --- a/tjreports/site/views/reports/tmpl/default.php +++ b/tjreports/site/views/reports/tmpl/default.php @@ -10,10 +10,9 @@ // no direct access defined('_JEXEC') or die; +Use Joomla\CMS\Uri\Uri; use Joomla\CMS\Factory; -use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Router\Route; -use Joomla\CMS\Uri\Uri; use Joomla\CMS\Language\Text; use Joomla\CMS\Filter\OutputFilter; @@ -27,7 +26,7 @@ $this->listDirn = $this->state->get('list.direction'); $totalCount = 0; -foreach ($this->colToshow as $key=>$data) +foreach ($this->colToshow as $key => $data) { if (is_array($data)) { @@ -65,6 +64,12 @@ $document->addScriptDeclaration("var csv_export_inprogress='{$message['inprogress']}';"); $document->addScriptDeclaration("var tj_csv_site_root='{$siteUrl}';"); } + +if ($this->showSummaryReport == 'Yes') +{ + HTMLHelper::_('script', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.bundle.min.js'); +} + ?>
@@ -234,6 +239,22 @@ + + + showSummaryReport == 'Yes') + { + $reportContainer = "hide"; + ?> +
+ + + +
+ + + isClient('administrator') && $userAuthorisedExport && $user) { diff --git a/tjreports/site/views/reports/tmpl/default_summary.php b/tjreports/site/views/reports/tmpl/default_summary.php new file mode 100644 index 0000000..c87079a --- /dev/null +++ b/tjreports/site/views/reports/tmpl/default_summary.php @@ -0,0 +1,66 @@ + + * @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// no direct access +defined('_JEXEC') or die; +use Joomla\CMS\Language\Text; + +$chartdata = $this->items; + +if (count($chartdata) > 0) +{ + foreach ($chartdata as $chart) + { + $chartType = ($chart['fieldType'] == 'radio' || $chart['fieldType'] == 'checkbox' || $chart['fieldType'] == 'rating') ? 'pie' : 'bar'; + ?> +
+ + + +
+ + +
+ diff --git a/tjreports/site/views/reports/view.base.php b/tjreports/site/views/reports/view.base.php index a355165..43f2ab1 100644 --- a/tjreports/site/views/reports/view.base.php +++ b/tjreports/site/views/reports/view.base.php @@ -13,7 +13,11 @@ // No direct access defined('_JEXEC') or die; +Use Joomla\CMS\Uri\Uri; use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\MVC\Model\BaseDatabaseModel; jimport('joomla.application.component.view'); @@ -93,7 +97,7 @@ public function processData($type = 'html') if (!$canDo->get('core.view') || !$this->pluginName) { - JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR')); + JError::raiseWarning(403, Text::_('JERROR_ALERTNOAUTHOR')); return false; } @@ -111,14 +115,14 @@ public function processData($type = 'html') if (!$allow_permission) { - JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR')); + JError::raiseWarning(403, Text::_('JERROR_ALERTNOAUTHOR')); return false; } } else { - JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR')); + JError::raiseWarning(403, Text::_('JERROR_ALERTNOAUTHOR')); return false; } @@ -154,11 +158,11 @@ public function processData($type = 'html') if (!empty($savedQueries)) { $qOptions = array(); - $qOptions[] = JHTML::_('select.option', '', JText::_('COM_TJREPORTS_SELONE_QUERY')); + $qOptions[] = HTMLHelper::_('select.option', '', Text::_('COM_TJREPORTS_SELONE_QUERY')); foreach ($savedQueries as $savedQuery) { - $qOptions[] = JHTML::_('select.option', $savedQuery->id, $savedQuery->title); + $qOptions[] = HTMLHelper::_('select.option', $savedQuery->id, $savedQuery->title); } $this->savedQueries = $qOptions; @@ -166,20 +170,21 @@ public function processData($type = 'html') // Get all report plugin $dispatcher = JEventDispatcher::getInstance(); - $pluginExists = JPluginHelper::getPlugin('tjreports', $this->pluginName); + $pluginExists = PluginHelper::getPlugin('tjreports', $this->pluginName); if (!$pluginExists || !$this->pluginName) { - JError::raiseError(404, JText::_('COM_TJREPORTS_PLUGIN_DESABLED_OR_NOT_EXISTS')); + JError::raiseError(404, Text::_('COM_TJREPORTS_PLUGIN_DESABLED_OR_NOT_EXISTS')); return false; } $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->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'); @@ -206,14 +211,14 @@ public function processData($type = 'html') $this->showHideColumns = array_intersect($this->model->showhideCols, array_merge($this->defaultColToshow, $this->defaultColToHide)); } - $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->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->showSummaryReport = $this->model->getState('showSummaryReport'); $this->enableReportPlugins = $this->model->getenableReportPlugins($this->client); $this->isExport = $user->authorise('core.export', 'com_tjreports.tjreport.' . $this->reportId); diff --git a/tjreports/site/views/reports/view.html.php b/tjreports/site/views/reports/view.html.php index 094a890..fffbcad 100755 --- a/tjreports/site/views/reports/view.html.php +++ b/tjreports/site/views/reports/view.html.php @@ -13,6 +13,12 @@ // No direct access defined('_JEXEC') or die; +Use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Component\ComponentHelper; + require_once __DIR__ . '/view.base.php'; jimport('techjoomla.tjtoolbar.button.csvexport'); @@ -32,7 +38,7 @@ class TjreportsViewReports extends ReportsViewBase */ public function display($tpl = null) { - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $result = $this->processData(); if (!$result) @@ -55,16 +61,16 @@ public function display($tpl = null) */ protected function addToolbar() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $reportId = $app->getUserStateFromRequest('reportId', 'reportId', ''); - $user = JFactory::getUser(); + $user = Factory::getUser(); $userAuthorisedExport = $user->authorise('core.export', 'com_tjreports.tjreport.' . $reportId); $bar = JToolBar::getInstance('toolbar'); $canDo = TjreportsHelper::getActions(); if ($app->isAdmin()) { - $title = JText::_('COM_TJREPORTS_TITLE_REPORT'); + $title = Text::_('COM_TJREPORTS_TITLE_REPORT'); if (isset($this->reportData->title)) { @@ -100,11 +106,11 @@ protected function addToolbar() if ($canDo->get('core.export') && $userAuthorisedExport) { - $message = array(); - $message['success'] = JText::_("COM_TJREPORTS_EXPORT_FILE_SUCCESS"); - $message['error'] = JText::_("COM_TJREPORTS_EXPORT_FILE_ERROR"); - $message['inprogress'] = JText::_("COM_TJREPORTS_EXPORT_FILE_NOTICE"); - $message['text'] = JText::_("COM_TJREPORTS_CSV_EXPORT"); + $message = array(); + $message['success'] = Text::_("COM_TJREPORTS_EXPORT_FILE_SUCCESS"); + $message['error'] = Text::_("COM_TJREPORTS_EXPORT_FILE_ERROR"); + $message['inprogress'] = Text::_("COM_TJREPORTS_EXPORT_FILE_NOTICE"); + $message['text'] = Text::_("COM_TJREPORTS_CSV_EXPORT"); $bar->appendButton('CsvExport', $message); } @@ -113,7 +119,7 @@ protected function addToolbar() ' - . JText::_('COM_TJREPORTS_SAVE_THIS_QUERY') . ' + . Text::_('COM_TJREPORTS_SAVE_THIS_QUERY') . '
';var a=e.childNodes[0],r=e.childNodes[1];e._reset=function(){a.scrollLeft=1e6,a.scrollTop=1e6,r.scrollLeft=1e6,r.scrollTop=1e6};var o=function(){e._reset(),t()};return y(a,"scroll",o.bind(a,"expand")),y(r,"scroll",o.bind(r,"shrink")),e}((r=!(i=function(){if(h.resizer)return t(x("resize",n))}),o=[],function(){o=Array.prototype.slice.call(arguments),a=a||this,r||(r=!0,f.requestAnimFrame.call(window,function(){r=!1,i.apply(a,o)}))}));l=function(){if(h.resizer){var t=e.parentNode;t&&t!==c.parentNode&&t.insertBefore(c,t.firstChild),c._reset()}},u=(s=e)[g]||(s[g]={}),d=u.renderProxy=function(t){t.animationName===v&&l()},f.each(b,function(t){y(s,t,d)}),u.reflow=!!s.offsetParent,s.classList.add(p)}function r(t){var e,n,i,a=t[g]||{},r=a.resizer;delete a.resizer,n=(e=t)[g]||{},(i=n.renderProxy)&&(f.each(b,function(t){o(e,t,i)}),delete n.renderProxy),e.classList.remove(p),r&&r.parentNode&&r.parentNode.removeChild(r)}e.exports={_enabled:"undefined"!=typeof window&&"undefined"!=typeof document,initialize:function(){var t,e,n,i="from{opacity:0.99}to{opacity:1}";e="@-webkit-keyframes "+v+"{"+i+"}@keyframes "+v+"{"+i+"}."+p+"{-webkit-animation:"+v+" 0.001s;animation:"+v+" 0.001s;}",n=(t=this)._style||document.createElement("style"),t._style||(e="/* Chart.js */\n"+e,(t._style=n).setAttribute("type","text/css"),document.getElementsByTagName("head")[0].appendChild(n)),n.appendChild(document.createTextNode(e))},acquireContext:function(t,e){"string"==typeof t?t=document.getElementById(t):t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas);var n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(function(t,e){var n=t.style,i=t.getAttribute("height"),a=t.getAttribute("width");if(t[g]={initial:{height:i,width:a,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",null===a||""===a){var r=l(t,"width");void 0!==r&&(t.width=r)}if(null===i||""===i)if(""===t.style.height)t.height=t.width/(e.options.aspectRatio||2);else{var o=l(t,"height");void 0!==r&&(t.height=o)}}(t,e),n):null},releaseContext:function(t){var n=t.canvas;if(n[g]){var i=n[g].initial;["height","width"].forEach(function(t){var e=i[t];f.isNullOrUndef(e)?n.removeAttribute(t):n.setAttribute(t,e)}),f.each(i.style||{},function(t,e){n.style[e]=t}),n.width=n.width,delete n[g]}},addEventListener:function(r,t,o){var e=r.canvas;if("resize"!==t){var n=o[g]||(o[g]={});y(e,t,(n.proxies||(n.proxies={}))[r.id+"_"+t]=function(t){var e,n,i,a;o((n=r,i=s[(e=t).type]||e.type,a=f.getRelativePosition(e,n),x(i,n,a.x,a.y,e)))})}else a(e,o,r)},removeEventListener:function(t,e,n){var i=t.canvas;if("resize"!==e){var a=((n[g]||{}).proxies||{})[t.id+"_"+e];a&&o(i,e,a)}else r(i)}},f.addEvent=y,f.removeEvent=o},{46:46}],49:[function(t,e,n){"use strict";var i=t(46),a=t(47),r=t(48),o=r._enabled?r:a;e.exports=i.extend({initialize:function(){},acquireContext:function(){},releaseContext:function(){},addEventListener:function(){},removeEventListener:function(){}},o)},{46:46,47:47,48:48}],50:[function(t,e,n){"use strict";e.exports={},e.exports.filler=t(51),e.exports.legend=t(52),e.exports.title=t(53)},{51:51,52:52,53:53}],51:[function(t,e,n){"use strict";var u=t(26),c=t(41),d=t(46);u._set("global",{plugins:{filler:{propagate:!0}}});var f={dataset:function(t){var e=t.fill,n=t.chart,i=n.getDatasetMeta(e),a=i&&n.isDatasetVisible(e)&&i.dataset._children||[],r=a.length||0;return r?function(t,e){return e');for(var n=0;n'),t.data.datasets[n].label&&e.push(t.data.datasets[n].label),e.push("");return e.push(""),e.join("")}});var o=i.extend({initialize:function(t){C.extend(this,t),this.legendHitBoxes=[],this.doughnutMode=!1},beforeUpdate:r,update:function(t,e,n){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=n,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:r,beforeSetDimensions:r,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:r,beforeBuildLabels:r,buildLabels:function(){var e=this,n=e.options.labels||{},t=C.callback(n.generateLabels,[e.chart],e)||[];n.filter&&(t=t.filter(function(t){return n.filter(t,e.chart.data)})),e.options.reverse&&t.reverse(),e.legendItems=t},afterBuildLabels:r,beforeFit:r,fit:function(){var i=this,t=i.options,a=t.labels,e=t.display,r=i.ctx,n=D.global,o=C.valueOrDefault,s=o(a.fontSize,n.defaultFontSize),l=o(a.fontStyle,n.defaultFontStyle),u=o(a.fontFamily,n.defaultFontFamily),d=C.fontString(s,l,u),h=i.legendHitBoxes=[],c=i.minSize,f=i.isHorizontal();if(c.height=f?(c.width=i.maxWidth,e?10:0):(c.width=e?10:0,i.maxHeight),e)if(r.font=d,f){var g=i.lineWidths=[0],m=i.legendItems.length?s+a.padding:0;r.textAlign="left",r.textBaseline="top",C.each(i.legendItems,function(t,e){var n=P(a,s)+s/2+r.measureText(t.text).width;g[g.length-1]+n+a.padding>=i.width&&(m+=s+a.padding,g[g.length]=i.left),h[e]={left:0,top:0,width:n,height:s},g[g.length-1]+=n+a.padding}),c.height+=m}else{var p=a.padding,v=i.columnWidths=[],b=a.padding,y=0,x=0,_=s+p;C.each(i.legendItems,function(t,e){var n=P(a,s)+s/2+r.measureText(t.text).width;x+_>c.height&&(b+=y+a.padding,v.push(y),x=y=0),y=Math.max(y,n),x+=_,h[e]={left:0,top:0,width:n,height:s}}),b+=y,v.push(y),c.width+=b}i.width=c.width,i.height=c.height},afterFit:r,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var h=this,c=h.options,f=c.labels,g=D.global,m=g.elements.line,p=h.width,v=h.lineWidths;if(c.display){var b,y=h.ctx,x=C.valueOrDefault,t=x(f.fontColor,g.defaultFontColor),_=x(f.fontSize,g.defaultFontSize),e=x(f.fontStyle,g.defaultFontStyle),n=x(f.fontFamily,g.defaultFontFamily),i=C.fontString(_,e,n);y.textAlign="left",y.textBaseline="middle",y.lineWidth=.5,y.strokeStyle=t,y.fillStyle=t,y.font=i;var k=P(f,_),w=h.legendHitBoxes,M=h.isHorizontal();b=M?{x:h.left+(p-v[0])/2,y:h.top+f.padding,line:0}:{x:h.left+f.padding,y:h.top+f.padding,line:0};var S=_+f.padding;C.each(h.legendItems,function(t,e){var n,i,a,r,o,s=y.measureText(t.text).width,l=k+_/2+s,u=b.x,d=b.y;M?p<=u+l&&(d=b.y+=S,b.line++,u=b.x=h.left+(p-v[b.line])/2):d+S>h.bottom&&(u=b.x=u+h.columnWidths[b.line]+f.padding,d=b.y=h.top+f.padding,b.line++),function(t,e,n){if(!(isNaN(k)||k<=0)){y.save(),y.fillStyle=x(n.fillStyle,g.defaultColor),y.lineCap=x(n.lineCap,m.borderCapStyle),y.lineDashOffset=x(n.lineDashOffset,m.borderDashOffset),y.lineJoin=x(n.lineJoin,m.borderJoinStyle),y.lineWidth=x(n.lineWidth,m.borderWidth),y.strokeStyle=x(n.strokeStyle,g.defaultColor);var i=0===x(n.lineWidth,m.borderWidth);if(y.setLineDash&&y.setLineDash(x(n.lineDash,m.borderDash)),c.labels&&c.labels.usePointStyle){var a=_*Math.SQRT2/2,r=a/Math.SQRT2,o=t+r,s=e+r;C.canvas.drawPoint(y,n.pointStyle,a,o,s)}else i||y.strokeRect(t,e,k,_),y.fillRect(t,e,k,_);y.restore()}}(u,d,t),w[e].left=u,w[e].top=d,n=t,i=s,r=k+(a=_/2)+u,o=d+a,y.fillText(n.text,r,o),n.hidden&&(y.beginPath(),y.lineWidth=2,y.moveTo(r,o),y.lineTo(r+i,o),y.stroke()),M?b.x+=l+f.padding:b.y+=S})}},handleEvent:function(t){var e=this,n=e.options,i="mouseup"===t.type?"click":t.type,a=!1;if("mousemove"===i){if(!n.onHover)return}else{if("click"!==i)return;if(!n.onClick)return}var r=t.x,o=t.y;if(r>=e.left&&r<=e.right&&o>=e.top&&o<=e.bottom)for(var s=e.legendHitBoxes,l=0;l=u.left&&r<=u.left+u.width&&o>=u.top&&o<=u.top+u.height){if("click"===i){n.onClick.call(e,t.native,e.legendItems[l]),a=!0;break}if("mousemove"===i){n.onHover.call(e,t.native,e.legendItems[l]),a=!0;break}}}return a}});function s(t,e){var n=new o({ctx:t.ctx,options:e,chart:t});a.configure(t,n,e),a.addBox(t,n),t.legend=n}e.exports={id:"legend",_element:o,beforeInit:function(t){var e=t.options.legend;e&&s(t,e)},beforeUpdate:function(t){var e=t.options.legend,n=t.legend;e?(C.mergeIf(e,D.global.legend),n?(a.configure(t,n,e),n.options=e):s(t,e)):n&&(a.removeBox(t,n),delete t.legend)},afterEvent:function(t,e){var n=t.legend;n&&n.handleEvent(e)}}},{26:26,27:27,31:31,46:46}],53:[function(t,e,n){"use strict";var _=t(26),i=t(27),k=t(46),a=t(31),r=k.noop;_._set("global",{title:{display:!1,fontStyle:"bold",fullWidth:!0,lineHeight:1.2,padding:10,position:"top",text:"",weight:2e3}});var o=i.extend({initialize:function(t){k.extend(this,t),this.legendHitBoxes=[]},beforeUpdate:r,update:function(t,e,n){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=n,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:r,beforeSetDimensions:r,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:r,beforeBuildLabels:r,buildLabels:r,afterBuildLabels:r,beforeFit:r,fit:function(){var t=k.valueOrDefault,e=this.options,n=e.display,i=t(e.fontSize,_.global.defaultFontSize),a=this.minSize,r=k.isArray(e.text)?e.text.length:1,o=k.options.toLineHeight(e.lineHeight,i),s=n?r*o+2*e.padding:0;this.isHorizontal()?(a.width=this.maxWidth,a.height=s):(a.width=s,a.height=this.maxHeight),this.width=a.width,this.height=a.height},afterFit:r,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var t=this.ctx,e=k.valueOrDefault,n=this.options,i=_.global;if(n.display){var a,r,o,s=e(n.fontSize,i.defaultFontSize),l=e(n.fontStyle,i.defaultFontStyle),u=e(n.fontFamily,i.defaultFontFamily),d=k.fontString(s,l,u),h=k.options.toLineHeight(n.lineHeight,s),c=h/2+n.padding,f=0,g=this.top,m=this.left,p=this.bottom,v=this.right;t.fillStyle=e(n.fontColor,i.defaultFontColor),t.font=d,this.isHorizontal()?(r=m+(v-m)/2,o=g+c,a=v-m):(r="left"===n.position?m+c:v-c,o=g+(p-g)/2,a=p-g,f=Math.PI*("left"===n.position?-.5:.5)),t.save(),t.translate(r,o),t.rotate(f),t.textAlign="center",t.textBaseline="middle";var b=n.text;if(k.isArray(b))for(var y=0,x=0;xo.max&&(o.max=n))})});o.min=isFinite(o.min)&&!isNaN(o.min)?o.min:0,o.max=isFinite(o.max)&&!isNaN(o.max)?o.max:1,this.handleTickRangeOptions()},getTickLimit:function(){var t,e=this.options.ticks;if(this.isHorizontal())t=Math.min(e.maxTicksLimit?e.maxTicksLimit:11,Math.ceil(this.width/50));else{var n=h.valueOrDefault(e.fontSize,i.global.defaultFontSize);t=Math.min(e.maxTicksLimit?e.maxTicksLimit:11,Math.ceil(this.height/(2*n)))}return t},handleDirectionalChanges:function(){this.isHorizontal()||this.ticks.reverse()},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForValue:function(t){var e=this.start,n=+this.getRightValue(t),i=this.end-e;return this.isHorizontal()?this.left+this.width/i*(n-e):this.bottom-this.height/i*(n-e)},getValueForPixel:function(t){var e=this.isHorizontal(),n=e?this.width:this.height,i=(e?t-this.left:this.bottom-t)/n;return this.start+(this.end-this.start)*i},getPixelForTick:function(t){return this.getPixelForValue(this.ticksAsNumbers[t])}});a.registerScaleType("linear",n,e)}},{26:26,34:34,35:35,46:46}],56:[function(t,e,n){"use strict";var h=t(46),i=t(33);e.exports=function(t){var e=h.noop;t.LinearScaleBase=i.extend({getRightValue:function(t){return"string"==typeof t?+t:i.prototype.getRightValue.call(this,t)},handleTickRangeOptions:function(){var t=this,e=t.options.ticks;if(e.beginAtZero){var n=h.sign(t.min),i=h.sign(t.max);n<0&&i<0?t.max=0:0=t.max&&(a?t.max=t.min+1:t.min=t.max-1),t.min===t.max&&(t.max++,e.beginAtZero||t.min--)},getTickLimit:e,handleDirectionalChanges:e,buildTicks:function(){var t=this,e=t.options.ticks,n=t.getTickLimit(),i={maxTicks:n=Math.max(2,n),min:e.min,max:e.max,precision:e.precision,stepSize:h.valueOrDefault(e.fixedStepSize,e.stepSize)},a=t.ticks=function(t,e){var n,i,a,r=[];if(t.stepSize&&0o.max&&(o.max=n),0!==n&&(null===o.minNotZero||no.r&&(o.r=g.end,s.r=c),m.starto.b&&(o.b=m.end,s.b=c)}t.setReductions(r,o,s)}(this):(t=this,e=Math.min(t.height/2,t.width/2),t.drawingArea=Math.round(e),t.setCenterPoint(0,0,0,0))},setReductions:function(t,e,n){var i=e.l/Math.sin(n.l),a=Math.max(e.r-this.width,0)/Math.sin(n.r),r=-e.t/Math.cos(n.t),o=-Math.max(e.b-this.height,0)/Math.cos(n.b);i=s(i),a=s(a),r=s(r),o=s(o),this.drawingArea=Math.min(Math.round(t-(i+a)/2),Math.round(t-(r+o)/2)),this.setCenterPoint(i,a,r,o)},setCenterPoint:function(t,e,n,i){var a=this,r=a.width-e-a.drawingArea,o=t+a.drawingArea,s=n+a.drawingArea,l=a.height-i-a.drawingArea;a.xCenter=Math.round((o+r)/2+a.left),a.yCenter=Math.round((s+l)/2+a.top)},getIndexAngle:function(t){return t*(2*Math.PI/b(this))+(this.chart.options&&this.chart.options.startAngle?this.chart.options.startAngle:0)*Math.PI*2/360},getDistanceFromCenterForValue:function(t){if(null===t)return 0;var e=this.drawingArea/(this.max-this.min);return this.options.ticks.reverse?(this.max-t)*e:(t-this.min)*e},getPointPosition:function(t,e){var n=this.getIndexAngle(t)-Math.PI/2;return{x:Math.round(Math.cos(n)*e)+this.xCenter,y:Math.round(Math.sin(n)*e)+this.yCenter}},getPointPositionForValue:function(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))},getBasePosition:function(){var t=this.min,e=this.max;return this.getPointPositionForValue(0,this.beginAtZero?0:t<0&&e<0?e:0>1)-1]||null,r=t[i],!a)return{lo:null,hi:r};if(r[e]n))return{lo:a,hi:r};s=i-1}}return{lo:r,hi:null}}(t,e,n),r=a.lo?a.hi?a.lo:t[t.length-2]:t[0],o=a.lo?a.hi?a.hi:t[t.length-1]:t[1],s=o[e]-r[e],l=s?(n-r[e])/s:0,u=(o[i]-r[i])*l;return r[i]+u}function M(t,e){var n=e.parser,i=e.parser||e.format;return"function"==typeof n?n(t):"string"==typeof t&&"string"==typeof i?y(t,i):(t instanceof y||(t=y(t)),t.isValid()?t:"function"==typeof i?i(t):t)}function S(t,e){if(p.isNullOrUndef(t))return null;var n=e.options.time,i=M(e.getRightValue(t),n);return i.isValid()?(n.round&&i.startOf(n.round),i.valueOf()):null}function D(t){for(var e=_.indexOf(t)+1,n=_.length;e=_.indexOf(e);a--)if(r=_[a],x[r].common&&o.as(r)>=t.length)return r;return _[e?_.indexOf(e):0]}(b,p.minUnit,c.min,c.max),c._majorUnit=D(c._unit),c._table=function(t,e,n,i){if("linear"===i||!t.length)return[{time:e,pos:0},{time:n,pos:1}];var a,r,o,s,l,u=[],d=[e];for(a=0,r=t.length;ashowSummaryReport == 'Yes') { - HTMLHelper::_('script', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.bundle.min.js'); + HTMLHelper::script(Uri::root() . 'components/com_tjreports/assets/js/chartBundle.min.js'); } ?> diff --git a/tjreports/site/views/reports/view.base.php b/tjreports/site/views/reports/view.base.php index 43f2ab1..ca455f4 100644 --- a/tjreports/site/views/reports/view.base.php +++ b/tjreports/site/views/reports/view.base.php @@ -67,6 +67,8 @@ class ReportsViewBase extends JViewLegacy protected $showSearchResetButton; + protected $showSummaryReport; + /** * Execute and display a template script. * diff --git a/tjreports/site/views/reports/view.html.php b/tjreports/site/views/reports/view.html.php index fffbcad..94739d9 100755 --- a/tjreports/site/views/reports/view.html.php +++ b/tjreports/site/views/reports/view.html.php @@ -156,7 +156,7 @@ protected function addDocumentHeaderData() || ( $app->isAdmin() && $bootstrapSetting == 1 ) || ( !$app->isAdmin() && $bootstrapSetting == 2 ) ) { - $document->addStylesheet(Uri::root(true) . '/media/techjoomla_strapper/bs3/css/bootstrap.min.css'); + HTMLHelper::stylesheet(Uri::root() . '/media/techjoomla_strapper/bs3/css/bootstrap.min.css'); } $document->addScript(Uri::root() . '/components/com_tjreports/assets/js/tjrContentService.min.js'); From eb50a9fff8d54bf54af5f14099bc0c90db59b4a6 Mon Sep 17 00:00:00 2001 From: Pranoti Patil Date: Thu, 10 Sep 2020 13:09:45 +0530 Subject: [PATCH 23/38] Task #160012 feat: Show summary report for Feedback --- tjreports/administrator/views/tjreport/view.html.php | 7 ++++--- tjreports/{site/assets => media}/js/chartBundle.min.js | 0 tjreports/site/assets/css/tjreports.min.css | 1 + tjreports/site/views/reports/tmpl/default.php | 2 +- tjreports/site/views/reports/view.html.php | 6 +++--- 5 files changed, 9 insertions(+), 7 deletions(-) rename tjreports/{site/assets => media}/js/chartBundle.min.js (100%) create mode 100644 tjreports/site/assets/css/tjreports.min.css diff --git a/tjreports/administrator/views/tjreport/view.html.php b/tjreports/administrator/views/tjreport/view.html.php index c327101..cd55d2e 100644 --- a/tjreports/administrator/views/tjreport/view.html.php +++ b/tjreports/administrator/views/tjreport/view.html.php @@ -110,9 +110,10 @@ protected function addDocumentHeaderData() Text::script('COM_TJREPORTS_INVALID_JSON_VALUE'); $document = Factory::getDocument(); - HTMLHelper::script(Uri::root() . '/components/com_tjreports/assets/js/tjrContentService.min.js'); - HTMLHelper::script(Uri::root() . '/components/com_tjreports/assets/js/tjrContentUI.min.js'); - HTMLHelper::stylesheet(Uri::root() . '/components/com_tjreports/assets/css/tjreports.css'); + + HTMLHelper::_('script', 'components/com_tjreports/assets/js/tjrContentService.min.js'); + HTMLHelper::_('script', 'components/com_tjreports/assets/js/tjrContentUI.min.js'); + HTMLHelper::_('stylesheet', 'components/com_tjreports/assets/css/tjreports.min.css'); $document->addScriptDeclaration('tjrContentUI.base_url = "' . Uri::base() . '"'); $document->addScriptDeclaration('tjrContentUI.root_url = "' . Uri::root() . '"'); diff --git a/tjreports/site/assets/js/chartBundle.min.js b/tjreports/media/js/chartBundle.min.js similarity index 100% rename from tjreports/site/assets/js/chartBundle.min.js rename to tjreports/media/js/chartBundle.min.js diff --git a/tjreports/site/assets/css/tjreports.min.css b/tjreports/site/assets/css/tjreports.min.css new file mode 100644 index 0000000..1330bb9 --- /dev/null +++ b/tjreports/site/assets/css/tjreports.min.css @@ -0,0 +1 @@ +.other-filters{padding:0 14px}.hasPopover{display:block!important}a[disabled]{pointer-events:none}.show-hide-cols{position:relative}.ColVis_collection{list-style:none;min-width:150px;padding:8px 8px 4px 8px;margin:0;border:1px solid #ccc;border:1px solid rgba(0,0,0,.4);background-color:#f9f9f9;overflow:hidden;display:block;opacity:1;position:absolute;z-index:1}table#report-table .chzn-container{width:150px!important}ul#ul-columns-name li input{margin-top:0}ul#ul-columns-name li:hover label{background-color:#f0f0f0}ul#ul-columns-name li label{margin-bottom:0;padding-top:2px;padding-bottom:2px;cursor:pointer}div#report-containing-div{min-height:450px}div#reports-container .form-inline-header .controls{padding-right:5px}div#topFilters div.filter-search{display:inline-block;float:left;margin-right:5px}div#topFilters{margin-top:10px;float:left;width:100%}.ColVis_collection{display:none}#topFilters{display:none}#queryName{display:none}.header_title{display:inline-block}th.center:nth-child(odd){background-color:#d9edf7;border-left:1px solid #ddd}th.center:nth-child(even){background-color:#fcf8e3;border-left:1px solid #ddd}td.subdetails.lesson.attempts_done:nth-child(odd),th.subdetails.lesson.attempts_done:nth-child(odd){border-left:1px solid #ddd}table.tjrport-table{border-bottom:1px solid #ddd}#reportPagination .pagination.pagination-toolbar.clearfix{margin:0}#t3-content #report-table thead input{height:100%;max-width:120px}#t3-content #queryName{height:32px;font-size:14px}.report-top-bar{margin-top:10px}#t3-content .form-group{margin-bottom:15px}#reports-container h2{font-weight:500}#t3-mainbody #reports-container .field-calendar .tjrsmall-input{display:inline-block;height:32px!important;max-width:165px;font-size:14px}.report-tbl{min-height:450px;overflow-x:auto}#t3-mainbody #report-containing-div .table-responsive{margin-top:20px}#t3-content #reports-container .btn{padding:4px 12px;text-transform:none;font-size:14px}#t3-mainbody #report-table .custom-group{display:table;border-collapse:separate;margin-bottom:0}#content div.row{margin-left:0;margin-right:0}#t3-mainbody #report-table .custom-group-btn{vertical-align:baseline}.t3-content .btn-custom{color:#fff;background-color:#337ab7;border-color:#2e6da4}.t3-content .btn-custom:hover{color:#fff;background-color:#286090;border-color:#204d74}.t3-content .btn-custom:active{color:#fff;background-color:#286090;border-color:#204d74}.t3-content .btn-custom:focus{color:#fff;background-color:#286090;border-color:#204d74}.t3-content .btn-custom.active.focus,.t3-content .btn-custom.active:focus,.t3-content .btn-custom.active:hover,.t3-content .btn-custom:active.focus,.t3-content .btn-custom:active:focus,.t3-content .btn-custom:active:hover{color:#fff;background-color:#204d74;border-color:#122b40}#t3-content.chzn-container-single .chzn-single{height:32px;border-radius:0;background:no-repeat;padding-left:15px}#t3-content #report-table .chzn-container-single .chzn-single span,b{margin-top:3px}#t3-content .filter-search .chzn-container-single .chzn-single{height:32px;border-radius:0;background:no-repeat;padding-left:15px}#t3-content .filter-search .chzn-container-single .chzn-single b,#t3-content .filter-search .chzn-container-single .chzn-single span{margin-top:3px}#reports-container .ordering-select .input-group-btn,#t3-content #report-table .input-group-btn{width:0}.ordering-select a.chzn-single,.view-reports select{height:35px!important}#reports-container .input-append .field-calendar{font-size:14px}#reports-container .input-group .field-calendar .input-append,.view-reports .j-toggle-main input[type=text]{margin-bottom:0}#reports-container .filter-search .input-group-btn{border:1px solid #ccc;border-radius:0}.table-responsive.report-tbl .js-calendar{margin-top:0!important}.view-reports .chzn-container .chzn-single,.view-reports a.btn,.view-reports button,.view-reports button.btn,.view-reports input[type=button],.view-reports input[type=text],.view-reports select{height:35px;padding-top:6px!important;padding-bottom:6px!important;border-radius:0!important;box-shadow:none;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;line-height:18px!important}.view-reports #toolbar [class^=icon-]{height:28px;padding-top:5px!important}.view-reports #toolbar .export{padding-top:0!important;padding-bottom:0!important}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.show-hide-cols{margin-bottom:20px}#show-hide-cols-btn{width:100%}#queryName{margin-bottom:10px!important}.btn-csv{margin-bottom:20px}#t3-content #report-table .input-append input,#t3-content #report-table .input-append select{margin-bottom:0!important;width:auto}}@media screen and (max-width:768px){#t3-content #show-filter{margin-bottom:20px}#filterscourse_id,.ordering-select #filtersreport_filter{margin-bottom:20px}}@media (max-width:1024px) and (min-width:768px){.t3-content .row-fluid [class*=span]{margin-left:0}}.m-0{margin:0!important}.equal-height-col{display:flex;flex-wrap:wrap;margin-top:20px}.equal-height-col>.equal-items{display:flex;flex-direction:column}.tj-card{border:1px solid #f0f0f0;height:100%;-webkit-box-shadow:0 1px 4px 0 rgba(0,0,0,.3);-moz-box-shadow:0 1px 4px 0 rgba(0,0,0,.3);box-shadow:0 1px 4px 0 rgba(0,0,0,.3);border-radius:5px}.tj-card-title{border-bottom:1px solid #f0f0f0;margin:0!important;padding:15px;font-size:15px;font-weight:700}.tj-card-body{margin:15px 0}.chartItems{margin-bottom:30px} diff --git a/tjreports/site/views/reports/tmpl/default.php b/tjreports/site/views/reports/tmpl/default.php index 7c05cd7..ae47115 100644 --- a/tjreports/site/views/reports/tmpl/default.php +++ b/tjreports/site/views/reports/tmpl/default.php @@ -68,7 +68,7 @@ if ($this->showSummaryReport == 'Yes') { - HTMLHelper::script(Uri::root() . 'components/com_tjreports/assets/js/chartBundle.min.js'); + HTMLHelper::_('script', 'com_tjreports/chartBundle.min.js', array('version' => 'auto', 'relative' => true)); } ?> diff --git a/tjreports/site/views/reports/view.html.php b/tjreports/site/views/reports/view.html.php index 94739d9..9037021 100755 --- a/tjreports/site/views/reports/view.html.php +++ b/tjreports/site/views/reports/view.html.php @@ -159,9 +159,9 @@ protected function addDocumentHeaderData() HTMLHelper::stylesheet(Uri::root() . '/media/techjoomla_strapper/bs3/css/bootstrap.min.css'); } - $document->addScript(Uri::root() . '/components/com_tjreports/assets/js/tjrContentService.min.js'); - $document->addScript(Uri::root() . '/components/com_tjreports/assets/js/tjrContentUI.min.js'); - $document->addStylesheet(Uri::root() . '/components/com_tjreports/assets/css/tjreports.css'); + HTMLHelper::_('script', 'components/com_tjreports/assets/js/tjrContentService.min.js'); + HTMLHelper::_('script', 'components/com_tjreports/assets/js/tjrContentUI.min.js'); + HTMLHelper::_('stylesheet', 'components/com_tjreports/assets/css/tjreports.min.css'); $document->addScriptDeclaration('tjrContentUI.base_url = "' . Uri::base() . '"'); $document->addScriptDeclaration('tjrContentUI.root_url = "' . Uri::root() . '"'); From 66077fce129dc02e849964288da69a636962de2a Mon Sep 17 00:00:00 2001 From: Pranoti Patil Date: Fri, 11 Sep 2020 11:50:51 +0530 Subject: [PATCH 24/38] Task #160012 feat: Show summary report for Feedback --- tjreports/site/views/reports/tmpl/default.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tjreports/site/views/reports/tmpl/default.php b/tjreports/site/views/reports/tmpl/default.php index ae47115..84ad9ea 100644 --- a/tjreports/site/views/reports/tmpl/default.php +++ b/tjreports/site/views/reports/tmpl/default.php @@ -68,7 +68,7 @@ if ($this->showSummaryReport == 'Yes') { - HTMLHelper::_('script', 'com_tjreports/chartBundle.min.js', array('version' => 'auto', 'relative' => true)); + HTMLHelper::_('script', 'media/com_tjreports/js/chartBundle.min.js'); } ?> @@ -494,7 +494,7 @@ $isSendEmailClass = $emailColmClass; $emailColumCnt++; } - + $value = isset($item[$key]) ? $item[$key] : ''; echo "{$value}"; } From 289eb3d8803b5eed8232407e49b3e5d559faea95 Mon Sep 17 00:00:00 2001 From: Pranoti Patil Date: Wed, 16 Sep 2020 12:26:09 +0530 Subject: [PATCH 25/38] Task #164882 fix: Summary not showing to HTML tags in quiz --- tjreports/site/views/reports/tmpl/default_summary.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tjreports/site/views/reports/tmpl/default_summary.php b/tjreports/site/views/reports/tmpl/default_summary.php index c87079a..7cb3004 100644 --- a/tjreports/site/views/reports/tmpl/default_summary.php +++ b/tjreports/site/views/reports/tmpl/default_summary.php @@ -27,7 +27,7 @@
+ + -
+
+ From 7182b317bf13ee586b7749e2620cdd0e05c0f769 Mon Sep 17 00:00:00 2001 From: Tejashrimajage <72556485+Tejashrimajage@users.noreply.github.com> Date: Thu, 15 Oct 2020 13:00:18 +0530 Subject: [PATCH 27/38] Task #165071 style: Fix hight for column level filter in report (#195) --- tjreports/site/assets/css/tjreports.css | 2 +- tjreports/site/assets/css/tjreports.min.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tjreports/site/assets/css/tjreports.css b/tjreports/site/assets/css/tjreports.css index ef85243..f866afa 100755 --- a/tjreports/site/assets/css/tjreports.css +++ b/tjreports/site/assets/css/tjreports.css @@ -136,7 +136,7 @@ table.tjrport-table { } .report-tbl { - min-height: 450px; + min-height: 450px !important; overflow-x: auto; } diff --git a/tjreports/site/assets/css/tjreports.min.css b/tjreports/site/assets/css/tjreports.min.css index 1330bb9..8f9bad0 100644 --- a/tjreports/site/assets/css/tjreports.min.css +++ b/tjreports/site/assets/css/tjreports.min.css @@ -1 +1 @@ -.other-filters{padding:0 14px}.hasPopover{display:block!important}a[disabled]{pointer-events:none}.show-hide-cols{position:relative}.ColVis_collection{list-style:none;min-width:150px;padding:8px 8px 4px 8px;margin:0;border:1px solid #ccc;border:1px solid rgba(0,0,0,.4);background-color:#f9f9f9;overflow:hidden;display:block;opacity:1;position:absolute;z-index:1}table#report-table .chzn-container{width:150px!important}ul#ul-columns-name li input{margin-top:0}ul#ul-columns-name li:hover label{background-color:#f0f0f0}ul#ul-columns-name li label{margin-bottom:0;padding-top:2px;padding-bottom:2px;cursor:pointer}div#report-containing-div{min-height:450px}div#reports-container .form-inline-header .controls{padding-right:5px}div#topFilters div.filter-search{display:inline-block;float:left;margin-right:5px}div#topFilters{margin-top:10px;float:left;width:100%}.ColVis_collection{display:none}#topFilters{display:none}#queryName{display:none}.header_title{display:inline-block}th.center:nth-child(odd){background-color:#d9edf7;border-left:1px solid #ddd}th.center:nth-child(even){background-color:#fcf8e3;border-left:1px solid #ddd}td.subdetails.lesson.attempts_done:nth-child(odd),th.subdetails.lesson.attempts_done:nth-child(odd){border-left:1px solid #ddd}table.tjrport-table{border-bottom:1px solid #ddd}#reportPagination .pagination.pagination-toolbar.clearfix{margin:0}#t3-content #report-table thead input{height:100%;max-width:120px}#t3-content #queryName{height:32px;font-size:14px}.report-top-bar{margin-top:10px}#t3-content .form-group{margin-bottom:15px}#reports-container h2{font-weight:500}#t3-mainbody #reports-container .field-calendar .tjrsmall-input{display:inline-block;height:32px!important;max-width:165px;font-size:14px}.report-tbl{min-height:450px;overflow-x:auto}#t3-mainbody #report-containing-div .table-responsive{margin-top:20px}#t3-content #reports-container .btn{padding:4px 12px;text-transform:none;font-size:14px}#t3-mainbody #report-table .custom-group{display:table;border-collapse:separate;margin-bottom:0}#content div.row{margin-left:0;margin-right:0}#t3-mainbody #report-table .custom-group-btn{vertical-align:baseline}.t3-content .btn-custom{color:#fff;background-color:#337ab7;border-color:#2e6da4}.t3-content .btn-custom:hover{color:#fff;background-color:#286090;border-color:#204d74}.t3-content .btn-custom:active{color:#fff;background-color:#286090;border-color:#204d74}.t3-content .btn-custom:focus{color:#fff;background-color:#286090;border-color:#204d74}.t3-content .btn-custom.active.focus,.t3-content .btn-custom.active:focus,.t3-content .btn-custom.active:hover,.t3-content .btn-custom:active.focus,.t3-content .btn-custom:active:focus,.t3-content .btn-custom:active:hover{color:#fff;background-color:#204d74;border-color:#122b40}#t3-content.chzn-container-single .chzn-single{height:32px;border-radius:0;background:no-repeat;padding-left:15px}#t3-content #report-table .chzn-container-single .chzn-single span,b{margin-top:3px}#t3-content .filter-search .chzn-container-single .chzn-single{height:32px;border-radius:0;background:no-repeat;padding-left:15px}#t3-content .filter-search .chzn-container-single .chzn-single b,#t3-content .filter-search .chzn-container-single .chzn-single span{margin-top:3px}#reports-container .ordering-select .input-group-btn,#t3-content #report-table .input-group-btn{width:0}.ordering-select a.chzn-single,.view-reports select{height:35px!important}#reports-container .input-append .field-calendar{font-size:14px}#reports-container .input-group .field-calendar .input-append,.view-reports .j-toggle-main input[type=text]{margin-bottom:0}#reports-container .filter-search .input-group-btn{border:1px solid #ccc;border-radius:0}.table-responsive.report-tbl .js-calendar{margin-top:0!important}.view-reports .chzn-container .chzn-single,.view-reports a.btn,.view-reports button,.view-reports button.btn,.view-reports input[type=button],.view-reports input[type=text],.view-reports select{height:35px;padding-top:6px!important;padding-bottom:6px!important;border-radius:0!important;box-shadow:none;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;line-height:18px!important}.view-reports #toolbar [class^=icon-]{height:28px;padding-top:5px!important}.view-reports #toolbar .export{padding-top:0!important;padding-bottom:0!important}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.show-hide-cols{margin-bottom:20px}#show-hide-cols-btn{width:100%}#queryName{margin-bottom:10px!important}.btn-csv{margin-bottom:20px}#t3-content #report-table .input-append input,#t3-content #report-table .input-append select{margin-bottom:0!important;width:auto}}@media screen and (max-width:768px){#t3-content #show-filter{margin-bottom:20px}#filterscourse_id,.ordering-select #filtersreport_filter{margin-bottom:20px}}@media (max-width:1024px) and (min-width:768px){.t3-content .row-fluid [class*=span]{margin-left:0}}.m-0{margin:0!important}.equal-height-col{display:flex;flex-wrap:wrap;margin-top:20px}.equal-height-col>.equal-items{display:flex;flex-direction:column}.tj-card{border:1px solid #f0f0f0;height:100%;-webkit-box-shadow:0 1px 4px 0 rgba(0,0,0,.3);-moz-box-shadow:0 1px 4px 0 rgba(0,0,0,.3);box-shadow:0 1px 4px 0 rgba(0,0,0,.3);border-radius:5px}.tj-card-title{border-bottom:1px solid #f0f0f0;margin:0!important;padding:15px;font-size:15px;font-weight:700}.tj-card-body{margin:15px 0}.chartItems{margin-bottom:30px} +.other-filters{padding:0 14px}.hasPopover{display:block!important}a[disabled]{pointer-events:none}.show-hide-cols{position:relative}.ColVis_collection{list-style:none;min-width:150px;padding:8px 8px 4px 8px;margin:0;border:1px solid #ccc;border:1px solid rgba(0,0,0,.4);background-color:#f9f9f9;overflow:hidden;display:block;opacity:1;position:absolute;z-index:1}table#report-table .chzn-container{width:150px!important}ul#ul-columns-name li input{margin-top:0}ul#ul-columns-name li:hover label{background-color:#f0f0f0}ul#ul-columns-name li label{margin-bottom:0;padding-top:2px;padding-bottom:2px;cursor:pointer}div#report-containing-div{min-height:450px}div#reports-container .form-inline-header .controls{padding-right:5px}div#topFilters div.filter-search{display:inline-block;float:left;margin-right:5px}div#topFilters{margin-top:10px;float:left;width:100%}.ColVis_collection{display:none}#topFilters{display:none}#queryName{display:none}.header_title{display:inline-block}th.center:nth-child(odd){background-color:#d9edf7;border-left:1px solid #ddd}th.center:nth-child(even){background-color:#fcf8e3;border-left:1px solid #ddd}td.subdetails.lesson.attempts_done:nth-child(odd),th.subdetails.lesson.attempts_done:nth-child(odd){border-left:1px solid #ddd}table.tjrport-table{border-bottom:1px solid #ddd}#reportPagination .pagination.pagination-toolbar.clearfix{margin:0}#t3-content #report-table thead input{height:100%;max-width:120px}#t3-content #queryName{height:32px;font-size:14px}.report-top-bar{margin-top:10px}#t3-content .form-group{margin-bottom:15px}#reports-container h2{font-weight:500}#t3-mainbody #reports-container .field-calendar .tjrsmall-input{display:inline-block;height:32px!important;max-width:165px;font-size:14px}.report-tbl{min-height:450px !important;overflow-x:auto}#t3-mainbody #report-containing-div .table-responsive{margin-top:20px}#t3-content #reports-container .btn{padding:4px 12px;text-transform:none;font-size:14px}#t3-mainbody #report-table .custom-group{display:table;border-collapse:separate;margin-bottom:0}#content div.row{margin-left:0;margin-right:0}#t3-mainbody #report-table .custom-group-btn{vertical-align:baseline}.t3-content .btn-custom{color:#fff;background-color:#337ab7;border-color:#2e6da4}.t3-content .btn-custom:hover{color:#fff;background-color:#286090;border-color:#204d74}.t3-content .btn-custom:active{color:#fff;background-color:#286090;border-color:#204d74}.t3-content .btn-custom:focus{color:#fff;background-color:#286090;border-color:#204d74}.t3-content .btn-custom.active.focus,.t3-content .btn-custom.active:focus,.t3-content .btn-custom.active:hover,.t3-content .btn-custom:active.focus,.t3-content .btn-custom:active:focus,.t3-content .btn-custom:active:hover{color:#fff;background-color:#204d74;border-color:#122b40}#t3-content.chzn-container-single .chzn-single{height:32px;border-radius:0;background:no-repeat;padding-left:15px}#t3-content #report-table .chzn-container-single .chzn-single span,b{margin-top:3px}#t3-content .filter-search .chzn-container-single .chzn-single{height:32px;border-radius:0;background:no-repeat;padding-left:15px}#t3-content .filter-search .chzn-container-single .chzn-single b,#t3-content .filter-search .chzn-container-single .chzn-single span{margin-top:3px}#reports-container .ordering-select .input-group-btn,#t3-content #report-table .input-group-btn{width:0}.ordering-select a.chzn-single,.view-reports select{height:35px!important}#reports-container .input-append .field-calendar{font-size:14px}#reports-container .input-group .field-calendar .input-append,.view-reports .j-toggle-main input[type=text]{margin-bottom:0}#reports-container .filter-search .input-group-btn{border:1px solid #ccc;border-radius:0}.table-responsive.report-tbl .js-calendar{margin-top:0!important}.view-reports .chzn-container .chzn-single,.view-reports a.btn,.view-reports button,.view-reports button.btn,.view-reports input[type=button],.view-reports input[type=text],.view-reports select{height:35px;padding-top:6px!important;padding-bottom:6px!important;border-radius:0!important;box-shadow:none;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;line-height:18px!important}.view-reports #toolbar [class^=icon-]{height:28px;padding-top:5px!important}.view-reports #toolbar .export{padding-top:0!important;padding-bottom:0!important}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.show-hide-cols{margin-bottom:20px}#show-hide-cols-btn{width:100%}#queryName{margin-bottom:10px!important}.btn-csv{margin-bottom:20px}#t3-content #report-table .input-append input,#t3-content #report-table .input-append select{margin-bottom:0!important;width:auto}}@media screen and (max-width:768px){#t3-content #show-filter{margin-bottom:20px}#filterscourse_id,.ordering-select #filtersreport_filter{margin-bottom:20px}}@media (max-width:1024px) and (min-width:768px){.t3-content .row-fluid [class*=span]{margin-left:0}}.m-0{margin:0!important}.equal-height-col{display:flex;flex-wrap:wrap;margin-top:20px}.equal-height-col>.equal-items{display:flex;flex-direction:column}.tj-card{border:1px solid #f0f0f0;height:100%;-webkit-box-shadow:0 1px 4px 0 rgba(0,0,0,.3);-moz-box-shadow:0 1px 4px 0 rgba(0,0,0,.3);box-shadow:0 1px 4px 0 rgba(0,0,0,.3);border-radius:5px}.tj-card-title{border-bottom:1px solid #f0f0f0;margin:0!important;padding:15px;font-size:15px;font-weight:700}.tj-card-body{margin:15px 0}.chartItems{margin-bottom:30px} From e51f049af5e1a0e892366a957be3500888995083 Mon Sep 17 00:00:00 2001 From: KishoriBKarale <35763119+KishoriBKarale@users.noreply.github.com> Date: Thu, 29 Oct 2020 17:20:24 +0530 Subject: [PATCH 28/38] Task #165071 chore: Wrapping of values in report (#199) * Task #165071 chore: Wordwrap for tjreports values * Task #165071 chore: Wordwrap for tjreports values * Task #165071 chore: Wordwrap for tjreports values * Task #165071 chore: Wordwrap for tjreports values * Task #165071 chore: Wordwrap for tjreports values --- tjreports/site/views/reports/tmpl/default.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tjreports/site/views/reports/tmpl/default.php b/tjreports/site/views/reports/tmpl/default.php index 84ad9ea..23291eb 100644 --- a/tjreports/site/views/reports/tmpl/default.php +++ b/tjreports/site/views/reports/tmpl/default.php @@ -496,6 +496,9 @@ } $value = isset($item[$key]) ? $item[$key] : ''; + + // Wrap the report values + $value = wordwrap($value, 30, '
', true); echo "{$value}"; } } From 991efd1c62ca7d9db90c2ee8231cfffe5053225f Mon Sep 17 00:00:00 2001 From: Rohan Shinde <37367348+shindebalu@users.noreply.github.com> Date: Tue, 9 Feb 2021 11:02:58 +0530 Subject: [PATCH 29/38] Task #168311 feat: Remove duplicates Language constant from language files. (#202) --- .../languages/administrator/en-GB/en-GB.com_tjreports.ini | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tjreports/languages/administrator/en-GB/en-GB.com_tjreports.ini b/tjreports/languages/administrator/en-GB/en-GB.com_tjreports.ini index 1a57c2e..02170ff 100755 --- a/tjreports/languages/administrator/en-GB/en-GB.com_tjreports.ini +++ b/tjreports/languages/administrator/en-GB/en-GB.com_tjreports.ini @@ -38,7 +38,7 @@ COM_TJREPORTS_LIST_ID="Id" COM_TJREPORTS_TITLE_REPORT="Reports" COM_TJREPORTS_CSV_EXPORT="CSV Export" -COM_TJREPORTS_FILTER_SELECT_COURSE="Select Course" +COM_TJREPORTS_FILTER_SELECT_COURSE="- Select Course -" COM_TJREPORTS_FORM_DEFAULT_OPTION="- Select Plugin -" COM_TJREPORT_SAVE_ALIAS_WARNING="Alias already existed so a number was added at the end. You can re-edit the article to customise the alias." COM_TJREPORT_VIEW_WITH_SAME_ALIAS="Alias name cannot be same as view names." @@ -48,7 +48,6 @@ COM_TJREPORTS_EXPORT_FILE_SUCCESS="100% Download Complete." ;Common for reports COM_TJREPORTS_FILTER_SELECT_ACCESSLEVEL="- Select Access Level -" -COM_TJREPORTS_FILTER_SELECT_COURSE="- Select Course -" COM_TJREPORTS_FILTER_SELECT_LESSON="Select lesson -" COM_TJREPORTS_FILTER_SELECT_COURSE_CATEGORY="- Select Category -" COM_TJREPORTS_FILTER_SELECT_COURSE_TYPE="- Select Type -" From 22a813c35dbffd506d0dc19352b01fd64813e8dc Mon Sep 17 00:00:00 2001 From: MeghaBiranje <58220237+MeghaBiranje@users.noreply.github.com> Date: Wed, 3 Mar 2021 11:16:45 +0530 Subject: [PATCH 30/38] Bug #165179 Fix: Search tools on Reports not working on mobile devices. (#200) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bug #165179 Fix: Search tools on Reports not working on mobile devices. * Bug #165179 Fix: Search tools on Reports not working on mobile devices. Co-authored-by: Megha Biranje <“megha_b@techjoomla.com”> --- tjreports/site/views/reports/tmpl/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tjreports/site/views/reports/tmpl/default.php b/tjreports/site/views/reports/tmpl/default.php index 23291eb..122c5cd 100644 --- a/tjreports/site/views/reports/tmpl/default.php +++ b/tjreports/site/views/reports/tmpl/default.php @@ -217,7 +217,7 @@ if ($totalHeadRows > 1) { ?> -
+