first version of pmGauge and open vs completed dashlet
This commit is contained in:
@@ -34,13 +34,37 @@ Array
|
||||
|
||||
//$this->w = $config['w'];
|
||||
//loadData
|
||||
|
||||
$con = Propel::getConnection("workflow");
|
||||
$stmt = $con->createStatement();
|
||||
$sql = "select count(*) as CANT from APPLICATION where APP_STATUS = 'TO_DO' ";
|
||||
$rs1 = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM);
|
||||
$rs1->next();
|
||||
$row = $rs1->getRow();
|
||||
$casesTodo = $row['CANT'];
|
||||
|
||||
$stmt = $con->createStatement();
|
||||
$sql = "select count(*) as CANT from APPLICATION where APP_STATUS = 'COMPLETED' ";
|
||||
$rs1 = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM);
|
||||
$rs1->next();
|
||||
$row = $rs1->getRow();
|
||||
$casesCompleted = $row['CANT'];
|
||||
|
||||
if ( $casesCompleted + $casesTodo != 0 ) {
|
||||
$this->value = $casesTodo / ($casesCompleted + $casesTodo);
|
||||
}
|
||||
else {
|
||||
$this->value = 0;
|
||||
}
|
||||
return $row[0];
|
||||
}
|
||||
|
||||
function render ($width = 300) {
|
||||
G::LoadClass('gauge');
|
||||
G::LoadClass('pmGauge');
|
||||
$g = new pmGauge();
|
||||
$g->w = $width;
|
||||
//others
|
||||
$g->value = $this->value;
|
||||
//$g->maxValue = $this->value + 5; //default 100 is ok,
|
||||
$g->render();
|
||||
}
|
||||
|
||||
|
||||
@@ -91,13 +91,21 @@
|
||||
imagefilledellipse($im, $cX, $cY, $dXRing, $dYRing, $bgcolor);
|
||||
|
||||
//drawing the red arc
|
||||
if ( $this->redFrom > $maxValue ) $this->redFrom = $maxValue;
|
||||
if ( $this->redTo > $maxValue ) $this->redTo = $maxValue;
|
||||
if ( $this->yellowFrom > $maxValue ) $this->yellowFrom = $maxValue;
|
||||
if ( $this->yellowTo > $maxValue ) $this->yellowTo = $maxValue;
|
||||
|
||||
$redFrom = $this->redFrom/$this->maxValue*300 - 240 ;
|
||||
$redTo = $this->redTo/$this->maxValue*300 - 240;
|
||||
$yellowFrom = $this->yellowFrom/$this->maxValue*300 - 240;
|
||||
$yellowTo = $this->yellowTo/$this->maxValue*300 - 240;
|
||||
if ( $this->redFrom != $this->redTo && $this->redTo != $maxValue ) {
|
||||
imagefilledarc ($im, $cX, $cY, $dXRingColor, $dYRingColor, $redFrom, $redTo, $redArc, IMG_ARC_PIE );
|
||||
}
|
||||
if ( $this->yellowFrom != $this->yellowTo && $this->yellowTo != $maxValue ) {
|
||||
imagefilledarc ($im, $cX, $cY, $dXRingColor, $dYRingColor, $yellowFrom, $yellowTo, $yellowArc, IMG_ARC_PIE );
|
||||
|
||||
}
|
||||
imagefilledellipse($im, $cX, $cY, $dXRingCenter, $dYRingCenter, $bgcolor);
|
||||
|
||||
//ticks
|
||||
Reference in New Issue
Block a user