sLayoutClass = null;
$this->aDashlets = array();
$this->oDOMNode = null;
$this->sId = $sId;
}
public function FromXml($sXml)
{
$oDoc = new DOMDocument();
$oDoc->loadXML($sXml);
$this->oDOMNode = $oDoc->getElementsByTagName('dashboard')->item(0);
$oLayoutNode = $this->oDOMNode->getElementsByTagName('layout')->item(0);
$this->sLayoutClass = $oLayoutNode->textContent;
$oTitleNode = $this->oDOMNode->getElementsByTagName('title')->item(0);
$this->sTitle = $oTitleNode->textContent;
$oDashletsNode = $this->oDOMNode->getElementsByTagName('dashlets')->item(0);
$oDashletList = $oDashletsNode->getElementsByTagName('dashlet');
foreach($oDashletList as $oDomNode)
{
$sDashletClass = $oDomNode->getAttribute('xsi:type');
$oNewDashlet = new $sDashletClass;
$oNewDashlet->FromDOMNode($oDomNode);
$this->aDashlets[] = $oNewDashlet;
}
}
public function FromParams($aParams)
{
}
public function Save()
{
}
public function GetLayout()
{
return $this->sLayoutClass;
}
public function SetLayout($sLayoutClass)
{
$this->sLayoutClass = $sLayoutClass;
}
public function GetTitle()
{
return $this->sTitle;
}
public function SetTitle($sTitle)
{
$this->sTitle = $sTitle;
}
public function AddDashlet()
{
}
public function Render($oPage, $bEditMode = false, $aExtraParams = array())
{
$oPage->add('
'.$this->sTitle.'
');
$oLayout = new $this->sLayoutClass;
$oLayout->Render($oPage, $this->aDashlets, $bEditMode, $aExtraParams);
}
public function RenderProperties($oPage)
{
// menu to pick a layout and edit other properties of the dashboard
$oPage->add('
');
foreach( get_declared_classes() as $sLayoutClass)
{
if (is_subclass_of($sLayoutClass, 'DashboardLayout'))
{
$oReflection = new ReflectionClass($sLayoutClass);
if (!$oReflection->isAbstract())
{
$aInfo = $sLayoutClass::GetInfo();
$oPage->add(''); // title="" on either the img or the label does nothing !
}
}
}
$oPage->add('
');
$oPage->add('
');
$oPage->add_ready_script("$('#select_layout').buttonset();");
}
public function RenderDashletsSelection($oPage)
{
// Toolbox/palette to drag and drop dashlets
$oPage->add('
');
foreach( get_declared_classes() as $sDashletClass)
{
if (is_subclass_of($sDashletClass, 'Dashlet'))
{
$oReflection = new ReflectionClass($sDashletClass);
if (!$oReflection->isAbstract())
{
$aInfo = $sDashletClass::GetInfo();
$oPage->add('');
}
}
}
$oPage->add('
');
$oPage->add('
');
$oPage->add_ready_script("$('.dashlet_icon').draggable({helper: 'clone', appendTo: 'body', zIndex: 10000, revert:'invalid'});");
$oPage->add_ready_script("$('.layout_cell').droppable({accept:'.dashlet_icon', hoverClass:'dragHover'});");
}
public function RenderDashletsProperties($oPage)
{
// Toolbox/palette to edit the properties of each dashlet
$oPage->add('