From e4f7072e4d23f603bb5474313604a66e7bccbc0d Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Fri, 2 Dec 2011 17:46:42 -0400 Subject: [PATCH] BUG 0000 Incorporation of dashlet ProcessMakerCommunity --- .../class.dashletProcessMakerCommunity.php | 313 +++++++----------- workflow/engine/templates/dashboard/index.js | 83 +++-- 2 files changed, 172 insertions(+), 224 deletions(-) diff --git a/workflow/engine/classes/class.dashletProcessMakerCommunity.php b/workflow/engine/classes/class.dashletProcessMakerCommunity.php index 50be0c057..165542131 100644 --- a/workflow/engine/classes/class.dashletProcessMakerCommunity.php +++ b/workflow/engine/classes/class.dashletProcessMakerCommunity.php @@ -4,218 +4,133 @@ require_once 'interfaces/dashletInterface.php'; class dashletProcessMakerCommunity implements DashletInterface { - private $value; - private $open; - private $completed; - private $centerLabel; - private $redFrom; - private $redTo; - private $yellowFrom; - private $yellowTo; - private $greenFrom; - private $greenTo; - public static function getAdditionalFields($className) { $additionalFields = array(); - /*$contextTimeStore = new stdclass(); - $contextTimeStore->xtype = 'arraystore'; - $contextTimeStore->fields = array('id', 'value'); - $contextTimeStore->data = array(array('TODAY', 'Today'), - array('YESTERDAY', 'Yesterday'), - array('THIS_WEEK', 'This week'), - array('PREVIOUS_WEEK', 'Previous Week'), - array('THIS_MONTH', 'This Month'), - array('PREVIOUS_MONTH', 'Previous Month'), - array('THIS_YEAR', 'This Year'), - array('PREVIOUS_YEAR', 'Previous Year')); - - $contextTime = new stdclass(); - $contextTime->xtype = 'combo'; - $contextTime->name = 'DAS_INS_CONTEXT_TIME'; - $contextTime->fieldLabel = 'Period'; - $contextTime->editable = false; - $contextTime->width = 325; - $contextTime->store = $contextTimeStore; - $contextTime->mode = 'local'; - $contextTime->triggerAction = 'all'; - $contextTime->value = 'TODAY'; - $contextTime->valueField = 'id'; - $contextTime->displayField = 'value'; - $additionalFields[] = $contextTime; - - $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'); - $lastMonth = date('M', strtotime( "31 days ago") ); - - $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")); - $yesterdayEnd = date('Y-m-d H:i:s', strtotime( "yesterday 23:59:59")); - $thisWeekIni = date('Y-m-d H:i:s', strtotime( "monday 00:00:00")); - $thisWeekEnd = date('Y-m-d H:i:s', strtotime( "sunday 23:59:59")); - $previousWeekIni = date('Y-m-d H:i:s', strtotime( "last monday 00:00:00")); - $previousWeekEnd = date('Y-m-d H:i:s', strtotime( "last sunday 23:59:59")); - - $thisMonthIni = date('Y-m-d H:i:s', strtotime( "$thisMonth 1st 00:00:00")); - $thisMonthEnd = date('Y-m-d H:i:s', strtotime( "$thisMonth last day 23:59:59")); - - $previousMonthIni = date('Y-m-d H:i:s', strtotime( "$lastMonth 1st 00:00:00")); - $previousMonthEnd = date('Y-m-d H:i:s', strtotime( "$lastMonth last day 23:59:59")); - - $thisYearIni = date('Y-m-d H:i:s', strtotime( "jan $thisYear 00:00:00")); - $thisYearEnd = date('Y-m-d H:i:s', strtotime( "Dec 31 $thisYear 23:59:59")); - $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'] ) { - case 'TODAY' : $dateIni = $todayIni; $dateEnd = $todayEnd; break; - 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; - } - - $con = Propel::getConnection("workflow"); - $stmt = $con->createStatement(); - $sql = "select count(*) as CANT from APPLICATION where APP_STATUS in ( 'DRAFT', 'TO_DO' ) "; - $sql .= "and APP_CREATE_DATE > '$dateIni' and APP_CREATE_DATE <= '$dateEnd' "; - $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $casesTodo = $row['CANT']; - - $stmt = $con->createStatement(); - $sql = "select count(*) as CANT from APPLICATION where APP_STATUS = 'COMPLETED' "; - $sql .= "and APP_CREATE_DATE > '$dateIni' and APP_CREATE_DATE <= '$dateEnd' "; - $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $casesCompleted = $row['CANT']; - if ( $casesCompleted + $casesTodo != 0 ) { - $this->value = $casesCompleted / ($casesCompleted + $casesTodo)*100; - } - else { - $this->value = 0; - } - $this->open = $casesCompleted; - $this->completed = $casesCompleted + $casesTodo; - 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; - case 'PREVIOUS_WEEK' : $this->centerLabel = 'Previous week'; break; - case 'THIS_MONTH' : $this->centerLabel = 'This month'; break; - case 'PREVIOUS_MONTH' : $this->centerLabel = 'Previous month'; break; - case 'THIS_QUARTER' : $this->centerLabel = 'This quarter'; break; - case 'PREVIOUS_QUARTER' : $this->centerLabel = 'Previous quarter'; break; - case 'THIS_YEAR' : $this->centerLabel = 'This year'; break; - case 'PREVIOUS_YEAR' : $this->centerLabel = 'Previous year'; break; - default : $this->centerLabel = '';break; - }*/ return true; } public function render ($width = 300) { - /*G::LoadClass('pmGauge'); - $g = new pmGauge(); - $g->w = $width; - $g->value = $this->value; + $html = " + - $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; - $g->completed = $this->completed; - $g->render();*/ + + + + + + +
+
+
+ FORUM - http://forum.processmaker.com +
+ Discuss ProcessMaker issues, interact with the PMOS community, and get support from fellow developers and community members in the ProcessMaker Forum. +
+
+ +
+
+ WIKI - http://wiki.processmaker.com +
+ The Wiki is your first stop for ProcessMaker information, including user guides, documentation, community projects, release notes, and FAQ. +
+
+ +
+
+ LIBRARY - http://library.processmaker.com +
+ Download Process Map templates from the Library for use in ProcessMaker.  We're adding new processes all the time, so look out for new templates! +
+
+ +
+
+ BLOG - http://processmakerblog.com +
+ Get our BPM tips in the ProcessMaker blog. +
+
+ +
+
+ BUG TRACKER - http://bugs.processmaker.com +
+ Help our development team to improve ProcessMaker by reporting your bugs and issues in the Bug Tracker.  Monitor and track issue reports and solutions. +
+
+
+ + + + "; + + echo $html; } } \ No newline at end of file diff --git a/workflow/engine/templates/dashboard/index.js b/workflow/engine/templates/dashboard/index.js index 93fe77e79..20a2ecf88 100644 --- a/workflow/engine/templates/dashboard/index.js +++ b/workflow/engine/templates/dashboard/index.js @@ -136,31 +136,64 @@ 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[i % 3].add( np ); - } //for - pd.doLayout(); + var dashletClass = ""; + for ( var i = 0; i < dashletsInstances.length; i++ ) { + dashletClass = dashletsInstances[i].DAS_CLASS; + + switch (dashletClass) { + case "dashletOpenVSCompleted": + 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); + } + } + }); + break; + + case "dashletProcessMakerCommunity": + 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 img = new Ext.XTemplate("").apply({ + page: "dashboard/renderDashletInstance", + id: p.dasInsUid + }) + + p.update(img); + } + } + }); + break; + } + + pd.items.items[i % 3].add( np ); + } //for + + pd.doLayout(); });