Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #479 from milkyway-git/patch-1
Browse files Browse the repository at this point in the history
Dont allow disabled theme to add menu item or link
  • Loading branch information
zegenie committed Dec 4, 2016
2 parents de0663d + b46b14b commit 049381a
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions modules/agile/Agile.php
Expand Up @@ -72,9 +72,12 @@ protected function _uninstall()
*/
public function userDashboardProjectButtonLinks(framework\Event $event)
{
$routing = framework\Context::getRouting();
$i18n = framework\Context::getI18n();
$event->addToReturnList(array('url' => $routing->generate('agile_index', array('project_key' => '%project_key%')), 'text' => $i18n->__('Planning')));
if ($this->isEnabled())
{
$routing = framework\Context::getRouting();
$i18n = framework\Context::getI18n();
$event->addToReturnList(array('url' => $routing->generate('agile_index', array('project_key' => '%project_key%')), 'text' => $i18n->__('Planning')));
}
}

/**
Expand All @@ -86,11 +89,14 @@ public function userDashboardProjectButtonLinks(framework\Event $event)
*/
public function projectHeaderLinks(framework\Event $event)
{
$board = entities\AgileBoard::getB2DBTable()->selectById(framework\Context::getRequest()->getParameter('board_id'));
if ($board instanceof entities\AgileBoard)
{
framework\ActionComponent::includeComponent('agile/projectheaderstriplinks', array('project' => $event->getSubject(), 'board' => $board));
}
if ($this->isEnabled())
{
$board = entities\AgileBoard::getB2DBTable()->selectById(framework\Context::getRequest()->getParameter('board_id'));
if ($board instanceof entities\AgileBoard)
{
framework\ActionComponent::includeComponent('agile/projectheaderstriplinks', array('project' => $event->getSubject(), 'board' => $board));
}
}
}

/**
Expand Down Expand Up @@ -120,7 +126,7 @@ public function milestoneSave(framework\Event $event)
*/
public function headerMenuProjectLinks(framework\Event $event)
{
if (framework\Context::isProjectContext())
if ($this->isEnabled() && framework\Context::isProjectContext())
{
$boards = \thebuggenie\modules\agile\entities\AgileBoard::getB2DBTable()->getAvailableProjectBoards(framework\Context::getUser()->getID(), framework\Context::getCurrentProject()->getID());
framework\ActionComponent::includeComponent('agile/headermenuprojectlinks', array('project' => $event->getSubject(), 'boards' => $boards));
Expand All @@ -136,8 +142,11 @@ public function headerMenuProjectLinks(framework\Event $event)
*/
public function dashboardProjectLinks(framework\Event $event)
{
$boards = \thebuggenie\modules\agile\entities\AgileBoard::getB2DBTable()->getAvailableProjectBoards(framework\Context::getUser()->getID(), $event->getSubject()->getID());
framework\ActionComponent::includeComponent('agile/projectlinks', array('project' => $event->getSubject(), 'boards' => $boards));
if ($this->isEnabled())
{
$boards = \thebuggenie\modules\agile\entities\AgileBoard::getB2DBTable()->getAvailableProjectBoards(framework\Context::getUser()->getID(), $event->getSubject()->getID());
framework\ActionComponent::includeComponent('agile/projectlinks', array('project' => $event->getSubject(), 'boards' => $boards));
}
}

/**
Expand Down

0 comments on commit 049381a

Please sign in to comment.