Last changes for the release of November 15th

This commit is contained in:
Julio Cesar Laura
2011-11-10 21:41:39 -04:00
parent d7ba1021aa
commit 87194b7f97
6 changed files with 127 additions and 70 deletions

View File

@@ -4,7 +4,97 @@ require_once 'interfaces/dashletInterface.php';
class dashletOpenVSCompleted implements DashletInterface {
function setup($config) {
private $value;
private $open;
private $completed;
private $centerLabel;
private $redFrom;
private $redTo;
private $yellowFrom;
private $yellowTo;
private $greenFrom;
private $greenTo;
public static function getAdditionalFields() {
$additionalFields = array();
$redFrom = new stdclass();
$redFrom->xtype = 'numberfield';
$redFrom->name = 'DAS_RED_FROM';
$redFrom->fieldLabel = 'Red Starts In';
$redFrom->width = 50;
$redFrom->maxLength = 3;
$redFrom->maxValue = 100;
$redFrom->minValue = 0;
$redFrom->allowBlank = false;
$additionalFields[] = $redFrom;
$redTo = new stdclass();
$redTo->xtype = 'numberfield';
$redTo->name = 'DAS_RED_TO';
$redTo->fieldLabel = 'Red Ends In';
$redTo->width = 50;
$redTo->maxLength = 3;
$redTo->maxValue = 100;
$redTo->minValue = 0;
$redTo->allowBlank = false;
$additionalFields[] = $redTo;
$yellowFrom = new stdclass();
$yellowFrom->xtype = 'numberfield';
$yellowFrom->name = 'DAS_YELLOW_FROM';
$yellowFrom->fieldLabel = 'Yellow Starts In';
$yellowFrom->width = 50;
$yellowFrom->maxLength = 3;
$yellowFrom->maxValue = 100;
$yellowFrom->minValue = 0;
$yellowFrom->allowBlank = false;
$additionalFields[] = $yellowFrom;
$yellowTo = new stdclass();
$yellowTo->xtype = 'numberfield';
$yellowTo->name = 'DAS_YELLOW_TO';
$yellowTo->fieldLabel = 'Yellow Ends In';
$yellowTo->width = 50;
$yellowTo->maxLength = 3;
$yellowTo->maxValue = 100;
$yellowTo->minValue = 0;
$yellowTo->allowBlank = false;
$additionalFields[] = $yellowTo;
$greenFrom = new stdclass();
$greenFrom->xtype = 'numberfield';
$greenFrom->name = 'DAS_GREEN_FROM';
$greenFrom->fieldLabel = 'Green Starts In';
$greenFrom->width = 50;
$greenFrom->maxLength = 3;
$greenFrom->maxValue = 100;
$greenFrom->minValue = 0;
$greenFrom->allowBlank = false;
$additionalFields[] = $greenFrom;
$greenTo = new stdclass();
$greenTo->xtype = 'numberfield';
$greenTo->name = 'DAS_GREEN_TO';
$greenTo->fieldLabel = 'Green Ends In';
$greenTo->width = 50;
$greenTo->maxLength = 3;
$greenTo->maxValue = 100;
$greenTo->minValue = 0;
$greenTo->allowBlank = false;
$additionalFields[] = $greenTo;
return $additionalFields;
}
public function setup($config) {
$this->redFrom = isset($config['DAS_RED_FROM']) ? (int) $config['DAS_RED_FROM'] : 0;
$this->redTo = isset($config['DAS_RED_TO']) ? (int) $config['DAS_RED_TO'] : 30;
$this->yellowFrom = isset($config['DAS_YELLOW_FROM']) ? (int) $config['DAS_YELLOW_FROM'] : 30;
$this->yellowTo = isset($config['DAS_YELLOW_TO']) ? (int) $config['DAS_YELLOW_TO'] : 50;
$this->greenFrom = isset($config['DAS_GREEN_FROM']) ? (int) $config['DAS_GREEN_FROM'] : 50;
$this->greenTo = isset($config['DAS_GREEN_TO']) ? (int) $config['DAS_GREEN_TO'] : 100;
$thisYear = date('Y');
$lastYear = $thisYear -1;
$thisMonth = date('M');
@@ -35,12 +125,10 @@ class dashletOpenVSCompleted implements DashletInterface {
case 'YESTERDAY' : $dateIni = $yesterdayIni; $dateEnd = $yesterdayEnd; break;
case 'THIS_WEEK' : $dateIni = $thisWeekIni; $dateEnd = $thisWeekEnd; break;
case 'PREVIOUS_WEEK' : $dateIni = $previousWeekIni; $dateEnd = $previousWeekEnd; break;
case 'THIS_MONTH' : $dateIni = $todayIni; $dateEnd = $todayEnd; break;
case 'PREVIOUS_MONTH' : $dateIni = $todayIni; $dateEnd = $todayEnd; break;
case 'THIS_QUARTER' : $dateIni = $todayIni; $dateEnd = $todayEnd; break;
case 'PREVIOUS_QUARTER' : $dateIni = $todayIni; $dateEnd = $todayEnd; break;
case 'THIS_YEAR' : $dateIni = $thisYearIni; $dateEnd = $thisYearEnd; break;
case 'PREVIOUS_YEAR' : $dateIni = $previousYearIni; $dateEnd = $previousYearEnd; break;
}
@@ -85,59 +173,18 @@ class dashletOpenVSCompleted implements DashletInterface {
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) {
public function render ($width = 300) {
G::LoadClass('pmGauge');
$g = new pmGauge();
$g->w = $width;
$g->value = $this->value;
$g->greenFrom = 50;
$g->greenTo = 100;
$g->yellowFrom = 30;
$g->yellowTo = 50;
$g->redFrom = 0;
$g->redTo = 30;
$g->redFrom = $this->redFrom;
$g->redTo = $this->redTo;
$g->yellowFrom = $this->yellowFrom;
$g->yellowTo = $this->yellowTo;
$g->greenFrom = $this->greenFrom;
$g->greenTo = $this->greenTo;
$g->centerLabel = $this->centerLabel;
$g->open = $this->open;