Customer portal : Added description to bricks. Displayed only in the home tiles.

SVN:trunk[4080]
This commit is contained in:
Guillaume Lajarige
2016-05-13 13:43:10 +00:00
parent 73274ec461
commit 760f3a788e
2 changed files with 39 additions and 1 deletions

View File

@@ -45,6 +45,7 @@ abstract class AbstractBrick
const DEFAULT_RANK = 1.0;
const DEFAULT_PAGE_TEMPLATE_PATH = null;
const DEFAULT_TITLE = '';
const DEFAULT_DESCRIPTION = null;
const DEFAULT_DATA_LOADING = self::ENUM_DATA_LOADING_AUTO;
const DEFAULT_ALLOWED_PROFILES_OQL = '';
const DEFAULT_DENIED_PROFILES_OQL = '';
@@ -55,6 +56,7 @@ abstract class AbstractBrick
protected $fRank;
protected $sPageTemplatePath;
protected $sTitle;
protected $sDescription;
protected $sDataLoading;
protected $aAllowedProfiles;
protected $aDeniedProfiles;
@@ -81,6 +83,7 @@ abstract class AbstractBrick
$this->fRank = static::DEFAULT_RANK;
$this->sPageTemplatePath = static::DEFAULT_PAGE_TEMPLATE_PATH;
$this->sTitle = static::DEFAULT_TITLE;
$this->sDescription = static::DEFAULT_DESCRIPTION;
$this->sDataLoading = static::DEFAULT_DATA_LOADING;
$this->aAllowedProfiles = array();
$this->aDeniedProfiles = array();
@@ -148,6 +151,16 @@ abstract class AbstractBrick
return $this->sTitle;
}
/**
* Returns the brick description
*
* @return string
*/
public function GetDescription()
{
return $this->sDescription;
}
/**
* Returns the brick data loading mode
*
@@ -264,6 +277,17 @@ abstract class AbstractBrick
return $this;
}
/**
* Sets the description of the brick
*
* @param string $sDescription
*/
public function SetDescription($sDescription)
{
$this->sDescription = $sDescription;
return $this;
}
/**
* Sets the data loading mode of the brick
*
@@ -450,6 +474,15 @@ abstract class AbstractBrick
return $bGranted;
}
/**
*
* @return boolean
*/
public function HasDescription()
{
return ($this->sDescription !== null && $this->sDescription !== '');
}
/**
* Load the brick's data from the xml passed as a ModuleDesignElement.
* This is used to set all the brick attributes at once.
@@ -491,6 +524,9 @@ abstract class AbstractBrick
case 'title':
$this->SetTitle($oBrickSubNode->GetText(static::DEFAULT_TITLE));
break;
case 'description':
$this->SetDescription($oBrickSubNode->GetText(static::DEFAULT_DESCRIPTION));
break;
case 'data_loading':
$this->SetDataLoading($oBrickSubNode->GetText(static::DEFAULT_DATA_LOADING));
break;

View File

@@ -28,7 +28,9 @@
<div class="tile_decoration"><img src="{{ app['combodo.portal.base.absolute_url'] }}img/icons/{{sIcon}}" /></div>
<div clss="tile_body">
<div class="tile_title">{{ brick.GetTitle|dict_s }}</div>
<div class="tile_description"></div>
{% if brick.HasDescription %}
<div class="tile_description">{{ brick.GetDescription }}</div>
{% endif %}
</div>
</a>
{% endblock %}