Save and load the additional fields for the dashlets
This commit is contained in:
@@ -5,41 +5,11 @@ require_once 'interfaces/dashletInterface.php';
|
||||
class dashletOpenVSCompleted implements DashletInterface {
|
||||
|
||||
function setup($config) {
|
||||
/*
|
||||
Array
|
||||
(
|
||||
[DAS_UID] => 00000000000000000000000000000001
|
||||
[DAS_CLASS] => dashletOpenVSCompleted
|
||||
[DAS_TITLE] => Open Cases VS Complete Cases
|
||||
[DAS_DESCRIPTION] => Open Cases VS Complete Cases
|
||||
[DAS_VERSION] => 1.0
|
||||
[DAS_CREATE_DATE] => 2011-10-28 00:00:00
|
||||
[DAS_UPDATE_DATE] => 2011-10-28 00:00:00
|
||||
[DAS_STATUS] => 1
|
||||
[DAS_INS_UID] => 00000000000000000000000000000001
|
||||
[DAS_INS_TYPE] => OPEN_CASES
|
||||
[DAS_INS_CONTEXT_TIME] => MONTH
|
||||
[DAS_INS_START_DATE] =>
|
||||
[DAS_INS_END_DATE] =>
|
||||
[DAS_INS_OWNER_TYPE] => DEPARTMENT
|
||||
[DAS_INS_OWNER_UID] => 2502663244e6f5e1e3c2254024148892
|
||||
[DAS_INS_PROCESSES] =>
|
||||
[DAS_INS_TASKS] =>
|
||||
[DAS_INS_ADDITIONAL_PROPERTIES] =>
|
||||
[DAS_INS_CREATE_DATE] => 2011-10-28 00:00:00
|
||||
[DAS_INS_UPDATE_DATE] => 2011-10-28 00:00:00
|
||||
[DAS_INS_STATUS] => 1
|
||||
)
|
||||
*/
|
||||
|
||||
//$this->w = $config['w'];
|
||||
//loadData
|
||||
$thisYear = date('Y');
|
||||
$lastYear = $thisYear -1;
|
||||
$thisMonth = date('M');
|
||||
$lastMonth = date('M', strtotime( "31 days ago") );
|
||||
//print "$thisMonth $lastMonth"; die;
|
||||
|
||||
|
||||
$todayIni = date('Y-m-d H:i:s', strtotime( "today 00:00:00"));
|
||||
$todayEnd = date('Y-m-d H:i:s', strtotime( "today 23:59:59"));
|
||||
$yesterdayIni = date('Y-m-d H:i:s', strtotime( "yesterday 00:00:00"));
|
||||
@@ -60,7 +30,7 @@ Array
|
||||
$previousYearIni = date('Y-m-d H:i:s', strtotime( "jan $lastYear 00:00:00"));
|
||||
$previousYearEnd = date('Y-m-d H:i:s', strtotime( "Dec 31 $lastYear 23:59:59"));
|
||||
|
||||
switch ( $config['DAS_INS_CONTEXT_TIME'] ) {
|
||||
switch ( $config['DAS_INS_CONTEXT_TIME'] ) {
|
||||
case 'TODAY' : $dateIni = $todayIni; $dateEnd = $todayEnd; break;
|
||||
case 'YESTERDAY' : $dateIni = $yesterdayIni; $dateEnd = $yesterdayEnd; break;
|
||||
case 'THIS_WEEK' : $dateIni = $thisWeekIni; $dateEnd = $thisWeekEnd; break;
|
||||
@@ -91,7 +61,7 @@ Array
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
$casesCompleted = $row['CANT'];
|
||||
if ( $casesCompleted + $casesTodo != 0 ) {
|
||||
if ( $casesCompleted + $casesTodo != 0 ) {
|
||||
$this->value = $casesCompleted / ($casesCompleted + $casesTodo)*100;
|
||||
}
|
||||
else {
|
||||
@@ -99,7 +69,7 @@ Array
|
||||
}
|
||||
$this->open = $casesCompleted;
|
||||
$this->completed = $casesCompleted + $casesTodo;
|
||||
switch ( $config['DAS_INS_CONTEXT_TIME'] ) {
|
||||
switch ( $config['DAS_INS_CONTEXT_TIME'] ) {
|
||||
case 'TODAY' : $this->centerLabel = 'Today'; break;
|
||||
case 'YESTERDAY' : $this->centerLabel = 'Yesterday'; break;
|
||||
case 'THIS_WEEK' : $this->centerLabel = 'This week'; break;
|
||||
@@ -115,18 +85,52 @@ Array
|
||||
return true;
|
||||
}
|
||||
|
||||
function getAdditionalFields() {
|
||||
$additionalFields = array();
|
||||
$greenFrom = new stdclass();
|
||||
$greenFrom->xtype = 'textfield';
|
||||
$greenFrom->name = 'DAS_RED_FROM';
|
||||
$greenFrom->fieldLabel = 'Red Starts In';
|
||||
$greenFrom->width = 50;
|
||||
$additionalFields[] = $greenFrom;
|
||||
$greenFrom = new stdclass();
|
||||
$greenFrom->xtype = 'textfield';
|
||||
$greenFrom->name = 'DAS_RED_TO';
|
||||
$greenFrom->fieldLabel = 'Red Ends In';
|
||||
$greenFrom->width = 50;
|
||||
$additionalFields[] = $greenFrom;
|
||||
$greenFrom = new stdclass();
|
||||
$greenFrom->xtype = 'textfield';
|
||||
$greenFrom->name = 'DAS_YELLOW_FROM';
|
||||
$greenFrom->fieldLabel = 'Yellow Starts In';
|
||||
$greenFrom->width = 50;
|
||||
$additionalFields[] = $greenFrom;
|
||||
$greenFrom = new stdclass();
|
||||
$greenFrom->xtype = 'textfield';
|
||||
$greenFrom->name = 'DAS_YELLOW_TO';
|
||||
$greenFrom->fieldLabel = 'Yellow Ends In';
|
||||
$greenFrom->width = 50;
|
||||
$additionalFields[] = $greenFrom;
|
||||
$greenFrom = new stdclass();
|
||||
$greenFrom->xtype = 'textfield';
|
||||
$greenFrom->name = 'DAS_GREEN_FROM';
|
||||
$greenFrom->fieldLabel = 'Green Starts In';
|
||||
$greenFrom->width = 50;
|
||||
$additionalFields[] = $greenFrom;
|
||||
$greenFrom = new stdclass();
|
||||
$greenFrom->xtype = 'textfield';
|
||||
$greenFrom->name = 'DAS_GREEN_TO';
|
||||
$greenFrom->fieldLabel = 'Green Ends In';
|
||||
$greenFrom->width = 50;
|
||||
$additionalFields[] = $greenFrom;
|
||||
return $additionalFields;
|
||||
}
|
||||
|
||||
function render ($width = 300) {
|
||||
G::LoadClass('pmGauge');
|
||||
$g = new pmGauge();
|
||||
$g->w = $width;
|
||||
$g->value = $this->value;
|
||||
$g->maxValue = 100;
|
||||
$g->greenFrom = 90;
|
||||
$g->greenTo = 100;
|
||||
$g->yellowFrom = 70;
|
||||
$g->yellowTo = 90;
|
||||
$g->redFrom = 100;
|
||||
$g->redTo = 100;
|
||||
|
||||
$g->greenFrom = 50;
|
||||
$g->greenTo = 100;
|
||||
@@ -136,8 +140,8 @@ Array
|
||||
$g->redTo = 30;
|
||||
|
||||
$g->centerLabel = $this->centerLabel;
|
||||
$g->open = $this->open;
|
||||
$g->completed = $this->completed;
|
||||
$g->open = $this->open;
|
||||
$g->completed = $this->completed;
|
||||
$g->render();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user