'',
'icon' => '',
'description' => '',
);
}
}
abstract class DashboardLayoutMultiCol extends DashboardLayout
{
protected $iNbCols;
public function __construct()
{
$this->iNbCols = 1;
}
public function Render($oPage, $aDashlets, $bEditMode = false, $aExtraParams = array())
{
$oPage->add('
');
$iDashletIdx = 0;
$sStyle = $bEditMode ? 'style="border: 1px #ccc dashed;" class="layout_cell edit_mode"' : '';
$iNbRows = ceil(count($aDashlets) / $this->iNbCols);
for($iRows = 0; $iRows < $iNbRows; $iRows++)
{
$oPage->add('');
for($iCols = 0; $iCols < $this->iNbCols; $iCols++)
{
$oPage->add("");
if ($iDashletIdx <= count($aDashlets))
{
$oDashlet = $aDashlets[$iDashletIdx];
$oDashlet->Render($oPage, $bEditMode, $aExtraParams);
}
else
{
$oPage->add(' ');
}
$oPage->add(' | ');
$iDashletIdx++;
}
$oPage->add('
');
}
if ($bEditMode) // Add one row for extensibility
{
$oPage->add('');
for($iCols = 0; $iCols < $this->iNbCols; $iCols++)
{
$oPage->add("");
$oPage->add(' ');
$oPage->add(' | ');
}
$oPage->add('
');
}
$oPage->add('
');
}
}
class DashboardLayoutOneCol extends DashboardLayoutMultiCol
{
public function __construct()
{
parent::__construct();
$this->iNbCols = 1;
}
static public function GetInfo()
{
return array(
'label' => 'One Column',
'icon' => 'images/layout_1col.png',
'description' => '',
);
}
}
class DashboardLayoutTwoCols extends DashboardLayoutMultiCol
{
public function __construct()
{
parent::__construct();
$this->iNbCols = 2;
}
static public function GetInfo()
{
return array(
'label' => 'Two Columns',
'icon' => 'images/layout_2col.png',
'description' => '',
);
}
}
class DashboardLayoutThreeCols extends DashboardLayoutMultiCol
{
public function __construct()
{
parent::__construct();
$this->iNbCols = 3;
}
static public function GetInfo()
{
return array(
'label' => 'Two Columns',
'icon' => 'images/layout_3col.png',
'description' => '',
);
}
}