mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
User editable dashboards... implementation in progress
SVN:trunk[2040]
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user