Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/4.0-dev' into 4.0-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
hardik-codes committed Jan 26, 2019
2 parents bfa6160 + d0c00c5 commit d81a3b8
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 28 deletions.
54 changes: 36 additions & 18 deletions administrator/components/com_workflow/View/Workflows/HtmlView.php
Expand Up @@ -13,6 +13,7 @@
use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Workflow\Administrator\Helper\WorkflowHelper;

Expand Down Expand Up @@ -123,40 +124,57 @@ protected function addToolbar()
{
$canDo = ContentHelper::getActions($this->extension);

// Get the toolbar object instance
$toolbar = Toolbar::getInstance('toolbar');

ToolbarHelper::title(Text::_('COM_WORKFLOW_WORKFLOWS_LIST'), 'address contact');

if ($canDo->get('core.create'))
{
ToolbarHelper::addNew('workflow.add');
$toolbar->addNew('workflow.add');
}

if ($canDo->get('core.edit.state'))
{
ToolbarHelper::publishList('workflows.publish');
ToolbarHelper::unpublishList('workflows.unpublish');
ToolbarHelper::makeDefault('workflows.setDefault', 'COM_WORKFLOW_TOOLBAR_DEFAULT');
}

if ($canDo->get('core.admin'))
{
ToolbarHelper::checkin('workflows.checkin', 'JTOOLBAR_CHECKIN', true);
if ($canDo->get('core.edit.state') || $user->authorise('core.admin'))
{
$dropdown = $toolbar->dropdownButton('status-group')
->text('JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('fa fa-globe')
->buttonClass('btn btn-info')
->listCheck(true);

$childBar = $dropdown->getChildToolbar();

$childBar->publish('workflows.publish');
$childBar->unpublish('workflows.unpublish');
$childBar->makeDefault('workflows.setDefault', 'COM_WORKFLOW_TOOLBAR_DEFAULT');

if ($canDo->get('core.admin'))
{
// @Todo implement the checked_out/checkin feature
// $childBar->checkin('workflows.checkin');
}

if ($canDo->get('core.edit.state') && $this->state->get('filter.published') != -2)
{
$childBar->trash('workflows.trash');
}
}

if ($this->state->get('filter.published') === '-2' && $canDo->get('core.delete'))
{
ToolbarHelper::deleteList(Text::_('COM_WORKFLOW_ARE_YOU_SURE'), 'workflows.delete');
}
elseif ($canDo->get('core.edit.state'))
{
ToolbarHelper::trash('workflows.trash');
$toolbar->delete('workflows.delete')
->text('JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}

if ($canDo->get('core.admin') || $canDo->get('core.options'))
{
ToolbarHelper::preferences($this->extension);
$toolbar->preferences($this->extension);
}

ToolbarHelper::help('JHELP_WORKFLOWS_LIST');
$toolbar->help('JHELP_WORKFLOWS_LIST');
}

/**
Expand Down
1 change: 0 additions & 1 deletion administrator/templates/atum/templateDetails.xml
Expand Up @@ -23,7 +23,6 @@
<folder>css</folder>
<folder>html</folder>
<folder>images</folder>
<folder>img</folder>
<folder>js</folder>
<folder>language</folder>
<folder>scss</folder>
Expand Down
24 changes: 15 additions & 9 deletions components/com_finder/Model/SearchModel.php
Expand Up @@ -171,13 +171,15 @@ protected function getListQuery()
{
// Convert the associative array to a numerically indexed array.
$groups = array_values($this->searchquery->filters);
$taxonomies = call_user_func_array('array_merge', array_values($this->searchquery->filters));

// Iterate through each taxonomy group and add the join and where.
$query->join('INNER', $db->quoteName('#__finder_taxonomy_map') . ' AS t ON t.link_id = l.link_id')
->where('t.node_id IN (' . implode(',', array_unique($taxonomies)) . ')');

// Iterate through each taxonomy group.
for ($i = 0, $c = count($groups); $i < $c; $i++)
{
// We use the offset because each join needs a unique alias.
$query->join('INNER', $db->quoteName('#__finder_taxonomy_map') . ' AS t' . $i . ' ON t' . $i . '.link_id = l.link_id')
->where('t' . $i . '.node_id IN (' . implode(',', $groups[$i]) . ')');
$query->having('SUM(t.node_id IN (' . implode(',', $groups[$i]) . ')) > 0');
}
}

Expand Down Expand Up @@ -283,6 +285,7 @@ protected function getListQuery()
// Since we need to return a query, we simplify this one.
$query->clear('join')
->clear('where')
->clear('having')
->clear('group')
->where('false');

Expand All @@ -308,13 +311,16 @@ protected function getListQuery()
*/
if (count($this->requiredTerms))
{
$i = 0;

foreach ($this->requiredTerms as $terms)
{
$query->join('INNER', $this->_db->quoteName('#__finder_links_terms') . ' AS r' . $i . ' ON r' . $i . '.link_id = l.link_id')
->where('r' . $i . '.term_id IN (' . implode(',', $terms) . ')');
$i++;
if (count($terms))
{
$query->having('SUM(m.term_id IN (' . implode(',', $terms) . ')) > 0');
}
else
{
$query->where('false');
}
}
}

Expand Down

0 comments on commit d81a3b8

Please sign in to comment.