User editable dashboards... implementation in progress

SVN:trunk[2040]
This commit is contained in:
Denis Flaven
2012-05-25 15:59:24 +00:00
parent a40e902808
commit 2c00c115d6
5 changed files with 219 additions and 4 deletions

View File

@@ -134,6 +134,11 @@ EOF
}
}
public function SetID($sId)
{
$this->sId = $sId;
}
public function GetID()
{
return $this->sId;
@@ -201,6 +206,16 @@ EOF
{
return true;
}
static public function CanCreateFromOQL()
{
return false;
}
public function GetPropertiesFieldsFromOQL(DesignerForm $oForm, $sOQL)
{
// Default: do nothing since it's not supported
}
}
class DashletEmptyCell extends Dashlet
@@ -311,6 +326,23 @@ class DashletObjectList extends Dashlet
'description' => 'Object list dashlet',
);
}
static public function CanCreateFromOQL()
{
return true;
}
public function GetPropertiesFieldsFromOQL(DesignerForm $oForm, $sOQL)
{
$oField = new DesignerTextField('title', 'Title', '');
$oForm->AddField($oField);
$oField = new DesignerHiddenField('query', 'Query', $sOQL);
$oForm->AddField($oField);
$oField = new DesignerBooleanField('menu', 'Menu', $this->aProperties['menu']);
$oForm->AddField($oField);
}
}
abstract class DashletGroupBy extends Dashlet
@@ -474,6 +506,45 @@ abstract class DashletGroupBy extends Dashlet
'description' => 'Grouped objects dashlet',
);
}
static public function CanCreateFromOQL()
{
return true;
}
public function GetPropertiesFieldsFromOQL(DesignerForm $oForm, $sOQL)
{
$oField = new DesignerTextField('title', 'Title', '');
$oForm->AddField($oField);
$oField = new DesignerHiddenField('query', 'Query', $sOQL);
$oForm->AddField($oField);
// Group by field: build the list of possible values (attribute codes + ...)
$oSearch = DBObjectSearch::FromOQL($this->aProperties['query']);
$sClass = $oSearch->GetClass();
$aGroupBy = array();
foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef)
{
if (!$oAttDef->IsScalar()) continue; // skip link sets
if ($oAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) continue; // skip external keys
$aGroupBy[$sAttCode] = $oAttDef->GetLabel();
if ($oAttDef instanceof AttributeDateTime)
{
//date_format(start_date, '%d')
$aGroupBy['date_of_'.$sAttCode] = 'Day of '.$oAttDef->GetLabel();
}
}
$oField = new DesignerComboField('group_by', 'Group by', $this->aProperties['group_by']);
$oField->SetAllowedValues($aGroupBy);
$oForm->AddField($oField);
$oField = new DesignerHiddenField('style', '', $this->aProperties['style']);
$oForm->AddField($oField);
}
}
class DashletGroupByPie extends DashletGroupBy