value} protected $aCSSClasses; public function __construct($sId) { $this->sId = $sId; $this->bRedrawNeeded = true; // By default: redraw each time a property changes $this->bFormRedrawNeeded = false; // By default: no need to redraw the form (independent fields) $this->aProperties = array(); // By default: there is no property $this->aCSSClasses = array('dashlet'); } // Assuming that a property has the type of its default value, set in the constructor // public function Str2Prop($sProperty, $sValue) { $refValue = $this->aProperties[$sProperty]; $sRefType = gettype($refValue); if ($sRefType == 'boolean') { $ret = ($sValue == 'true'); } else { $ret = $sValue; settype($ret, $sRefType); } return $ret; } public function Prop2Str($value) { if (gettype($value) == 'boolean') { $sRet = $value ? 'true' : 'false'; } else { $sRet = (string) $value; } return $sRet; } public function FromDOMNode($oDOMNode) { foreach ($this->aProperties as $sProperty => $value) { $this->oDOMNode = $oDOMNode->getElementsByTagName($sProperty)->item(0); if ($this->oDOMNode != null) { $newvalue = $this->Str2Prop($sProperty, $this->oDOMNode->textContent); $this->aProperties[$sProperty] = $newvalue; } } } public function ToDOMNode($oDOMNode) { foreach ($this->aProperties as $sProperty => $value) { $sXmlValue = $this->Prop2Str($value); $oPropNode = $oDOMNode->ownerDocument->createElement($sProperty, $sXmlValue); $oDOMNode->appendChild($oPropNode); } } public function FromXml($sXml) { $oDomDoc = new DOMDocument('1.0', 'UTF-8'); $oDomDoc->loadXml($sXml); $this->FromDOMNode($oDomDoc->firstChild); } public function FromParams($aParams) { foreach ($this->aProperties as $sProperty => $value) { if (array_key_exists($sProperty, $aParams)) { $this->aProperties[$sProperty] = $aParams[$sProperty]; } } } public function DoRender($oPage, $bEditMode = false, $aExtraParams = array()) { $sCSSClasses = implode(' ', $this->aCSSClasses); if ($bEditMode) { $sId = $this->GetID(); $oPage->add('
Please enter a valid OQL query
'); } elseif ($sGroupBy == '') { $oPage->add('Please select the field on which the objects will be grouped together
'); } else { switch($sStyle) { case 'bars': $sXML = '