diff --git a/administrator/components/com_finder/models/maps.php b/administrator/components/com_finder/models/maps.php index dc9bbec232db4..c60e7383a4945 100644 --- a/administrator/components/com_finder/models/maps.php +++ b/administrator/components/com_finder/models/maps.php @@ -164,17 +164,39 @@ protected function getListQuery() // Select all fields from the table. $query->select('a.*') + ->select('s.count_published') + ->select('s.count_unpublished') ->from($db->quoteName('#__finder_taxonomy', 'a')) ->where($db->quoteName('a.parent_id') . ' <> 0'); // Self-join to get children. $query->select('COUNT(b.id) AS num_children') - ->join('LEFT', $db->quoteName('#__finder_taxonomy', 'b') . ' ON ' . $db->quoteName('b.parent_id') . ' = ' . $db->quoteName('a.id')); - - // Join to get the map links - $query->select('COUNT(c.node_id) AS num_nodes') - ->join('LEFT', $db->quoteName('#__finder_taxonomy_map', 'c') . ' ON ' . $db->quoteName('c.node_id') . ' = ' . $db->quoteName('a.id')) - ->group('a.id, a.parent_id, a.title, a.state, a.access, a.ordering'); + ->join('LEFT', $db->quoteName('#__finder_taxonomy', 'b') . ' ON ' . $db->qn('b.parent_id') . ' = ' . $db->qn('a.id')); + + // Join to get the map links. + $stateSubQuery1 = $db->getQuery(true); + $stateSubQuery1->select($db->quoteName('mp.node_id')) + ->select('COUNT(mp.node_id) AS count_published') + ->from($db->quoteName('#__finder_links', 'lp')) + ->join('LEFT', $db->quoteName('#__finder_taxonomy_map', 'mp') . ' ON ' . $db->qn('lp.link_id') . ' = ' . $db->qn('mp.link_id')) + ->where($db->quoteName('lp.published') . ' = 1') + ->group($db->quoteName('mp.node_id')); + + $stateSubQuery2 = $db->getQuery(true); + $stateSubQuery2->select($db->quoteName('mu.node_id')) + ->select('COUNT(mu.node_id) AS count_unpublished') + ->from($db->quoteName('#__finder_links', 'lu')) + ->join('LEFT', $db->quoteName('#__finder_taxonomy_map', 'mu') . ' ON ' . $db->qn('lu.link_id') . ' = ' . $db->qn('mu.link_id')) + ->where($db->quoteName('lu.published') . ' = 0') + ->group($db->quoteName('mu.node_id')); + + $stateQuery = $db->getQuery(true); + $stateQuery->select('s1.*') + ->select('s2.count_unpublished') + ->from('(' . $stateSubQuery1 . ') AS s1') + ->join('LEFT', '(' . $stateSubQuery2 . ') AS s2 ON ' . $db->qn('s1.node_id') . ' = ' . $db->qn('s2.node_id')); + + $query->join('LEFT', '(' . $stateQuery . ') AS s ON ' . $db->qn('s.node_id') . ' = ' . $db->qn('a.id')); // Calculate levels. $levelQuery = $db->getQuery(true); @@ -186,13 +208,16 @@ protected function getListQuery() $levelQuery2->select('b.title AS branch_title, 2 as level') ->select($db->quoteName('a.id')) ->from($db->quoteName('#__finder_taxonomy', 'a')) - ->join('LEFT', $db->quoteName('#__finder_taxonomy', 'b') . ' ON ' . $db->quoteName('a.parent_id') . ' = ' . $db->quoteName('b.id')) + ->join('LEFT', $db->quoteName('#__finder_taxonomy', 'b') . ' ON ' . $db->qn('a.parent_id') . ' = ' . $db->qn('b.id')) ->where($db->quoteName('a.parent_id') . ' NOT IN (0, 1)'); $levelQuery->union($levelQuery2); // Join to get the levels. - $query->join('LEFT', '(' . $levelQuery . ') AS d ON ' . $db->quoteName('d.id') . ' = ' . $db->quoteName('a.id')); + $query->join('LEFT', '(' . $levelQuery . ') AS d ON ' . $db->qn('d.id') . ' = ' . $db->qn('a.id')); + + // Group + $query->group('a.id, a.parent_id, a.title, a.state, a.access, a.ordering'); // Self-join to get the parent title. $query->select('e.title AS parent_title') diff --git a/administrator/components/com_finder/views/maps/tmpl/default.php b/administrator/components/com_finder/views/maps/tmpl/default.php index c8d5aeb1fb3fa..d3d9fcf912ce2 100644 --- a/administrator/components/com_finder/views/maps/tmpl/default.php +++ b/administrator/components/com_finder/views/maps/tmpl/default.php @@ -12,10 +12,11 @@ JHtml::_('formbehavior.chosen', 'select'); JHtml::_('bootstrap.tooltip'); -$listOrder = $this->escape($this->state->get('list.ordering')); -$listDirn = $this->escape($this->state->get('list.direction')); -$lang = JFactory::getLanguage(); - +$listOrder = $this->escape($this->state->get('list.ordering')); +$listDirn = $this->escape($this->state->get('list.direction')); +$lang = JFactory::getLanguage(); +$branchFilter = $this->escape($this->state->get('filter.branch')); +$colSpan = $branchFilter ? 5 : 6; JText::script('COM_FINDER_MAPS_CONFIRM_DELETE_PROMPT'); JFactory::getDocument()->addScriptDeclaration(' @@ -64,17 +65,24 @@ + + + + + + - + + - + pagination->getListFooter(); ?> @@ -90,9 +98,6 @@ state, $i, 'maps.', $canChange, 'cb'); ?> - num_children === 0) : ?> - - parent_title, '**') == 'Language') { @@ -103,24 +108,41 @@ $key = FinderHelperLanguage::branchSingular($item->title); $title = $lang->hasKey($key) ? JText::_($key) : $item->title; } - echo $title; ?> + num_children === 0) : ?> + + + escape(trim($title, '**')) == 'Language' && JLanguageMultilang::isEnabled()) : ?> + num_children !== 0) : ?> - ">num_children; ?> + + ">num_children; ?> + + - + + + + + num_children === 0) : ?> + " title="" href="id); ?>"> + count_published; ?> -   + - num_children === 0) : ?> - ">num_nodes; ?> + " title="" href="id); ?>"> + count_unpublished; ?> -   + - diff --git a/administrator/language/en-GB/en-GB.com_finder.ini b/administrator/language/en-GB/en-GB.com_finder.ini index b55dc83979896..255dec4c21593 100644 --- a/administrator/language/en-GB/en-GB.com_finder.ini +++ b/administrator/language/en-GB/en-GB.com_finder.ini @@ -189,6 +189,8 @@ COM_FINDER_MAPS="Maps" COM_FINDER_MAPS_BRANCH_LINK="Select to show the children in this branch." COM_FINDER_MAPS_BRANCHES="Branches Only" COM_FINDER_MAPS_CONFIRM_DELETE_PROMPT="Are you sure you want to delete the selected maps(s)?" +COM_FINDER_MAPS_COUNT_PUBLISHED_ITEMS="Published Indexed Content" +COM_FINDER_MAPS_COUNT_UNPUBLISHED_ITEMS="Unpublished Indexed Content" COM_FINDER_MAPS_MULTILANG="Note: Language filter system plugin has been enabled, so this branch will not be used." COM_FINDER_MAPS_NO_CONTENT="No results to display. Either no content has been indexed or no content meets your filter criteria." COM_FINDER_MAPS_RETURN_TO_BRANCHES="Return to Map Groups"