diff --git a/workflow/engine/classes/class.pmGauge.php b/workflow/engine/classes/class.pmGauge.php index 669b8cea9..396422dea 100755 --- a/workflow/engine/classes/class.pmGauge.php +++ b/workflow/engine/classes/class.pmGauge.php @@ -56,25 +56,57 @@ $arrowBody = ImageColorAllocate($im, 228, 114, 86); $arrowLine = ImageColorAllocate($im, 207, 74, 42); $redArc = ImageColorAllocate($im, 220, 57, 18); - $yellowArc = ImageColorAllocate($im, 255, 153, 0); + $yellowArc = ImageColorAllocate($im, 255, 153, 0); $black = ImageColorAllocate($im, 0,0,0); $white = ImageColorAllocate($im, 255, 255, 255); $gray = ImageColorAllocate($im, 190, 190, 190); $fontArial = PATH_THIRDPARTY . 'html2ps_pdf/fonts/arial.ttf'; - $fontCourier = PATH_THIRDPARTY . 'html2ps_pdf/fonts/cour.ttf'; - $fontCourbd = PATH_THIRDPARTY . 'html2ps_pdf/fonts/courbd.ttf'; ImageFilledRectangle($im, 0, 0, $width-1, $height-1, $white); ImageRectangle ($im, 0, 0, $width-1, $height-1, $gray); //center coords - $cX = intval($this->w /2); + $cX = intval($this->w /4); $cY = intval($this->h /2); //diameter for gauge $diameter = intval( $this->h * 4/5 ); + + $this->renderGauge($im, $cX, $cY, $diameter); + + //center coords + $cX = intval($this->w * 3/4); + $cY = intval($this->h /2); + + //diameter for gauge + $diameter = intval( $this->h * 4/5 ); + + $this->renderGauge($im, $cX, $cY, $diameter); + + Header("Content-type: image/png"); + ImagePng($im); + + } + + function renderGauge($im, $cX, $cY, $diameter) { + //gauge color + $bgcolor = ImageColorAllocate($im, 247, 247, 247); + $extRing = ImageColorAllocate($im, 214, 214, 214); + $blueRing = ImageColorAllocate($im, 70, 132, 238); + $blueRingLine = ImageColorAllocate($im, 106, 114, 127); + $arrowBody = ImageColorAllocate($im, 228, 114, 86); + $arrowLine = ImageColorAllocate($im, 207, 74, 42); + $redArc = ImageColorAllocate($im, 220, 57, 18); + $yellowArc = ImageColorAllocate($im, 255, 153, 0); + + $black = ImageColorAllocate($im, 0,0,0); + $white = ImageColorAllocate($im, 255, 255, 255); + $gray = ImageColorAllocate($im, 190, 190, 190); + + $fontArial = PATH_THIRDPARTY . 'html2ps_pdf/fonts/arial.ttf'; + $dX = intval($diameter *8/7 ); //for now ratio aspect is 8:7 $dY = intval($diameter); $dXRing = intval($dX * 0.90); @@ -194,8 +226,6 @@ $centerY = $cY+$dYRing/2+3-abs($bbox[5]); imagettftext ( $im, 9, 0, $centerX, $centerY, $black, $fontArial, $textToDisplay ); - Header("Content-type: image/png"); - ImagePng($im); } diff --git a/workflow/engine/controllers/dashboard.php b/workflow/engine/controllers/dashboard.php index 97305d95e..e4a1bce9b 100644 --- a/workflow/engine/controllers/dashboard.php +++ b/workflow/engine/controllers/dashboard.php @@ -44,7 +44,7 @@ class Dashboard extends Controller { $width = 300; } else { - $width = $_REQUEST['w']; + $width = $_REQUEST['w']-10; } $this->pmDashlet->render( $width); } diff --git a/workflow/engine/templates/dashboard/index.js b/workflow/engine/templates/dashboard/index.js index 896afbfd8..0b39c5091 100644 --- a/workflow/engine/templates/dashboard/index.js +++ b/workflow/engine/templates/dashboard/index.js @@ -132,5 +132,35 @@ Ext.onReady(function(){ // } }] }); + +//var dashletsInstances = [{"DAS_INS_UID":"00000000000000000000000000000001","DAS_TITLE":"Open Cases VS Complete Cases"}]; + + var pd = Ext.getCmp('portalDashboard'); + for ( var i = 0; i < dashletsInstances.length; i++ ) { + var np = new Ext.ux.Portlet ( { + title: dashletsInstances[i].DAS_TITLE, + dasInsUid : dashletsInstances[i].DAS_INS_UID, + html: 'gauge placeholder', + listeners: { + 'render': function(p){ + p.html = 'hello ' + p.getWidth(); + }, + 'move' : function(p){ + Ext.Msg.alert('Portlet ', 'move ' + p.getWidth() ); + p.html = 'show ' + p.getWidth(); + }, + 'resize' : function(p,w,h){ + var randomnumber=Math.floor(Math.random()*1000000) + var img = new Ext.XTemplate("").apply({ + page: 'dashboard/renderDashletInstance', width:w, random: randomnumber, id: p.dasInsUid }) + p.update(img ); + } + } + }); + + pd.items.items[0].add( np ); + } //for + pd.doLayout(); + });