mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-21 16:22:20 +02:00
Merge remote-tracking branch 'origin/support/2.5' into release/2.6
# Conflicts: # datamodels/2.x/itop-portal-base/portal/src/controllers/browsebrickcontroller.class.inc.php
This commit is contained in:
@@ -19,21 +19,22 @@
|
||||
|
||||
namespace Combodo\iTop\Portal\Controller;
|
||||
|
||||
use BinaryExpression;
|
||||
use Combodo\iTop\Portal\Brick\AbstractBrick;
|
||||
use Combodo\iTop\Portal\Brick\BrowseBrick;
|
||||
use Combodo\iTop\Portal\Helper\ApplicationHelper;
|
||||
use Combodo\iTop\Portal\Helper\ContextManipulatorHelper;
|
||||
use Combodo\iTop\Portal\Helper\SecurityHelper;
|
||||
use DBObjectSet;
|
||||
use DBSearch;
|
||||
use Dict;
|
||||
use FieldExpression;
|
||||
use MetaModel;
|
||||
use Silex\Application;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use UserRights;
|
||||
use Dict;
|
||||
use MetaModel;
|
||||
use AttributeImage;
|
||||
use DBSearch;
|
||||
use DBObjectSet;
|
||||
use BinaryExpression;
|
||||
use FieldExpression;
|
||||
use VariableExpression;
|
||||
use Combodo\iTop\Portal\Helper\ApplicationHelper;
|
||||
use Combodo\iTop\Portal\Helper\SecurityHelper;
|
||||
use Combodo\iTop\Portal\Helper\ContextManipulatorHelper;
|
||||
use Combodo\iTop\Portal\Brick\AbstractBrick;
|
||||
use Combodo\iTop\Portal\Brick\BrowseBrick;
|
||||
|
||||
/**
|
||||
* Class BrowseBrickController
|
||||
@@ -653,34 +654,41 @@ class BrowseBrickController extends BrickController
|
||||
);
|
||||
|
||||
// Adding optional attributes if necessary
|
||||
foreach (static::$aOptionalAttributes as $sOptionalAttribute)
|
||||
{
|
||||
if ($aLevelsProperties[$key][$sOptionalAttribute] !== null)
|
||||
{
|
||||
$sPropertyName = substr($sOptionalAttribute, 0, -4);
|
||||
$oAttDef = MetaModel::GetAttributeDef(get_class($value), $aLevelsProperties[$key][$sOptionalAttribute]);
|
||||
foreach(static::$aOptionalAttributes as $sOptionalAttribute)
|
||||
{
|
||||
if ($aLevelsProperties[$key][$sOptionalAttribute] !== null)
|
||||
{
|
||||
$sPropertyName = substr($sOptionalAttribute, 0, -4);
|
||||
$oAttDef = MetaModel::GetAttributeDef(get_class($value), $aLevelsProperties[$key][$sOptionalAttribute]);
|
||||
|
||||
$tmpAttValue = $value->GetAsHTML($aLevelsProperties[$key][$sOptionalAttribute]);
|
||||
if ($sOptionalAttribute === 'image_att')
|
||||
{
|
||||
if (is_object($tmpAttValue) && !$tmpAttValue->IsEmpty())
|
||||
{
|
||||
$tmpAttValue = $oApp['url_generator']->generate('p_object_document_display', array(
|
||||
'sObjectClass' => get_class($value),
|
||||
'sObjectId' => $value->GetKey(),
|
||||
'sObjectField' => $aLevelsProperties[$key][$sOptionalAttribute],
|
||||
'cache' => 86400,
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmpAttValue = $oAttDef->Get('default_image');
|
||||
}
|
||||
}
|
||||
if($oAttDef instanceof AttributeImage)
|
||||
{
|
||||
$tmpAttValue = $value->Get($aLevelsProperties[$key][$sOptionalAttribute]);
|
||||
if ($sOptionalAttribute === 'image_att')
|
||||
{
|
||||
if (is_object($tmpAttValue) && !$tmpAttValue->IsEmpty())
|
||||
{
|
||||
$tmpAttValue = $oApp['url_generator']->generate('p_object_document_display', array(
|
||||
'sObjectClass' => get_class($value),
|
||||
'sObjectId' => $value->GetKey(),
|
||||
'sObjectField' => $aLevelsProperties[$key][$sOptionalAttribute],
|
||||
'cache' => 86400
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmpAttValue = $oAttDef->Get('default_image');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmpAttValue = $value->GetAsHTML($aLevelsProperties[$key][$sOptionalAttribute]);
|
||||
}
|
||||
|
||||
$aRow[$key][$sPropertyName] = $tmpAttValue;
|
||||
}
|
||||
}
|
||||
$aRow[$key][$sPropertyName] = $tmpAttValue;
|
||||
}
|
||||
}
|
||||
// Adding fields attributes if necessary
|
||||
if (!empty($aLevelsProperties[$key]['fields']))
|
||||
{
|
||||
@@ -770,36 +778,37 @@ class BrowseBrickController extends BrickController
|
||||
'action_rules_token' => static::PrepareActionRulesForItems($aCurrentRowObjects, $aCurrentRowKeys[0], $aLevelsProperties)
|
||||
);
|
||||
|
||||
// Adding optional attributes if necessary
|
||||
foreach (static::$aOptionalAttributes as $sOptionalAttribute)
|
||||
{
|
||||
if ($aLevelsProperties[$aCurrentRowKeys[0]][$sOptionalAttribute] !== null)
|
||||
{
|
||||
$sPropertyName = substr($sOptionalAttribute, 0, -4);
|
||||
$oAttDef = MetaModel::GetAttributeDef(get_class($aCurrentRowValues[0]),
|
||||
$aLevelsProperties[$aCurrentRowKeys[0]][$sOptionalAttribute]);
|
||||
// Adding optional attributes if necessary
|
||||
foreach(static::$aOptionalAttributes as $sOptionalAttribute)
|
||||
{
|
||||
if ($aLevelsProperties[$aCurrentRowKeys[0]][$sOptionalAttribute] !== null)
|
||||
{
|
||||
$sPropertyName = substr($sOptionalAttribute, 0, -4);
|
||||
$oAttDef = MetaModel::GetAttributeDef(get_class($aCurrentRowValues[0]), $aLevelsProperties[$aCurrentRowKeys[0]][$sOptionalAttribute]);
|
||||
|
||||
$tmpAttValue = $aCurrentRowValues[0]->GetAsHTML($aLevelsProperties[$aCurrentRowKeys[0]][$sOptionalAttribute]);
|
||||
if ($sOptionalAttribute === 'image_att')
|
||||
{
|
||||
if (is_object($tmpAttValue) && !$tmpAttValue->IsEmpty())
|
||||
{
|
||||
$tmpAttValue = $oApp['url_generator']->generate('p_object_document_display', array(
|
||||
'sObjectClass' => get_class($aCurrentRowValues[0]),
|
||||
'sObjectId' => $aCurrentRowValues[0]->GetKey(),
|
||||
'sObjectField' => $aLevelsProperties[$aCurrentRowKeys[0]][$sOptionalAttribute],
|
||||
'cache' => 86400,
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmpAttValue = $oAttDef->Get('default_image');
|
||||
}
|
||||
}
|
||||
if($oAttDef instanceof AttributeImage)
|
||||
{
|
||||
$tmpAttValue = $aCurrentRowValues[0]->Get($aLevelsProperties[$aCurrentRowKeys[0]][$sOptionalAttribute]);
|
||||
if($sOptionalAttribute === 'image_att')
|
||||
{
|
||||
if (is_object($tmpAttValue) && !$tmpAttValue->IsEmpty())
|
||||
{
|
||||
$tmpAttValue = $oApp['url_generator']->generate('p_object_document_display', array('sObjectClass' => get_class($aCurrentRowValues[0]), 'sObjectId' => $aCurrentRowValues[0]->GetKey(), 'sObjectField' => $aLevelsProperties[$aCurrentRowKeys[0]][$sOptionalAttribute], 'cache' => 86400));
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmpAttValue = $oAttDef->Get('default_image');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmpAttValue = $aCurrentRowValues[0]->GetAsHTML($aLevelsProperties[$aCurrentRowKeys[0]][$sOptionalAttribute]);
|
||||
}
|
||||
|
||||
$aItems[$sCurrentIndex][$sPropertyName] = $tmpAttValue;
|
||||
}
|
||||
}
|
||||
$aItems[$sCurrentIndex][$sPropertyName] = $tmpAttValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$aCurrentRowSliced = array_slice($aCurrentRow, 1);
|
||||
|
||||
Reference in New Issue
Block a user