mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-21 09:38:48 +02:00
Customer portal : Added possibility to give a controller action for a brick tile. This allows to use some logic in order to make a specific render relying for example on DB dataobjects
SVN:trunk[4300]
This commit is contained in:
@@ -37,8 +37,17 @@ class DefaultController
|
||||
// Doing it only for tile visible on home page to avoid unnecessary rendering
|
||||
if (($oBrick->GetVisibleHome() === true) && ($oBrick->GetTileControllerAction() !== null))
|
||||
{
|
||||
$oController = new \Combodo\iTop\Portal\Controller\ManageBrickController($oRequest, $oApp);
|
||||
$aData['aTilesRendering'][$oBrick->GetId()] = $oController->HomeAction($oRequest, $oApp);
|
||||
$aControllerActionParts = explode('::', $oBrick->GetTileControllerAction());
|
||||
if (count($aControllerActionParts) !== 2)
|
||||
{
|
||||
$oApp->abort(500, 'Tile controller action must be of form "\Namespace\ControllerClass::FunctionName" for brick "' . $oBrick->GetId() . '"');
|
||||
}
|
||||
|
||||
$sControllerName = $aControllerActionParts[0];
|
||||
$sControllerAction = $aControllerActionParts[1];
|
||||
|
||||
$oController = new $sControllerName($oRequest, $oApp, $oBrick->GetId());
|
||||
$aData['aTilesRendering'][$oBrick->GetId()] = $oController->$sControllerAction($oRequest, $oApp, $oBrick->GetId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -493,6 +493,9 @@ abstract class PortalBrick extends AbstractBrick
|
||||
$this->SetDecorationClassNavigationMenu($optionalNodeValue);
|
||||
}
|
||||
break;
|
||||
case 'tile_controller_action':
|
||||
$this->SetTileControllerAction($oBrickSubNode->GetText(static::DEFAULT_TILE_CONTROLLER_ACTION));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user