BUG 0000 Incorporation of dashlet ProcessMakerCommunity
This commit is contained in:
@@ -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 = "
|
||||
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
|
||||
|
||||
$g->redFrom = $this->redFrom;
|
||||
$g->redTo = $this->redTo;
|
||||
$g->yellowFrom = $this->yellowFrom;
|
||||
$g->yellowTo = $this->yellowTo;
|
||||
$g->greenFrom = $this->greenFrom;
|
||||
$g->greenTo = $this->greenTo;
|
||||
<html xmlns=\"http://www.w3.org/1999/xhtml\">
|
||||
<head>
|
||||
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
|
||||
|
||||
$g->centerLabel = $this->centerLabel;
|
||||
$g->open = $this->open;
|
||||
$g->completed = $this->completed;
|
||||
$g->render();*/
|
||||
<title></title>
|
||||
|
||||
<style type=\"text/css\">
|
||||
body{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
background: #FFFFFF;
|
||||
font: 100% arial, verdana, helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#container{
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.clearf{
|
||||
clear: both;
|
||||
|
||||
height: 0;
|
||||
line-height: 0;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.icon{
|
||||
float:left;
|
||||
|
||||
margin-left: 0.5em;
|
||||
|
||||
width: 2.5em;
|
||||
}
|
||||
|
||||
.description{
|
||||
float: right;
|
||||
|
||||
margin-right: 0.5em;
|
||||
|
||||
width: 26.5em;
|
||||
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
.icon img{
|
||||
width: 35px;
|
||||
}
|
||||
|
||||
.description strong{
|
||||
color: #2C2C2C;
|
||||
}
|
||||
|
||||
.description a{
|
||||
color: #1A4897;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.icon, .description{
|
||||
margin-top: 0.65em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id=\"container\">
|
||||
<div class=\"icon\"><img src=\"http://www.processmaker.com/uploads/u3/community_forum.png\" /></div>
|
||||
<div class=\"description\">
|
||||
<strong>FORUM - </strong><a href=\"http://forum.processmaker.com/\" target=\"_blank\" title=\"http://forum.processmaker.com\">http://forum.processmaker.com</a>
|
||||
<br />
|
||||
Discuss ProcessMaker issues, interact with the PMOS community, and get support from fellow developers and community members in the ProcessMaker Forum.
|
||||
</div>
|
||||
<div class=\"clearf\"></div>
|
||||
|
||||
<div class=\"icon\"><img src=\"http://www.processmaker.com/uploads/u3/community_wiki.png\" style=\"border: medium none;\"></div>
|
||||
<div class=\"description\">
|
||||
<strong>WIKI - </strong><a href=\"http://wiki.processmaker.com/\" target=\"_blank\" title=\"http://wiki.processmaker.com\">http://wiki.processmaker.com</a>
|
||||
<br />
|
||||
The Wiki is your first stop for ProcessMaker information, including user guides, documentation, community projects, release notes, and FAQ.
|
||||
</div>
|
||||
<div class=\"clearf\"></div>
|
||||
|
||||
<div class=\"icon\"><img src=\"http://www.processmaker.com/uploads/u3/community_library.png\" style=\"border: medium none;\"></div>
|
||||
<div class=\"description\">
|
||||
<strong>LIBRARY - </strong><a href=\"http://library.processmaker.com/\" target=\"_blank\" title=\"http://library.processmaker.com\">http://library.processmaker.com</a>
|
||||
<br />
|
||||
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!
|
||||
</div>
|
||||
<div class=\"clearf\"></div>
|
||||
|
||||
<div class=\"icon\"><img src=\"http://www.processmaker.com/uploads/u3/community_blog.png\" style=\"border: medium none;\"></div>
|
||||
<div class=\"description\">
|
||||
<strong>BLOG - </strong><a href=\"http://blog.processmaker.com/\" target=\"_blank\" title=\"http://blog.processmaker.com\">http://processmakerblog.com</a>
|
||||
<br />
|
||||
Get our BPM tips in the ProcessMaker blog.
|
||||
</div>
|
||||
<div class=\"clearf\"></div>
|
||||
|
||||
<div class=\"icon\"><img src=\"http://www.processmaker.com/uploads/u3/community_bug_tracker.png\" style=\"border: medium none;\"></div>
|
||||
<div class=\"description\">
|
||||
<strong>BUG TRACKER - </strong><a href=\"http://bugs.processmaker.com/\" target=\"_blank\">http://bugs.processmaker.com</a>
|
||||
<br />
|
||||
Help our development team to improve ProcessMaker by reporting your bugs and issues in the Bug Tracker. Monitor and track issue reports and solutions.
|
||||
</div>
|
||||
<div class=\"clearf\"></div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
";
|
||||
|
||||
echo $html;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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("<img src='{page}?w={width}&r={random}&DAS_INS_UID={id}'>").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("<img src='{page}?w={width}&r={random}&DAS_INS_UID={id}'>").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("<iframe src=\"{page}?DAS_INS_UID={id}\" width=\"422\" height=\"217\" frameborder=\"0\"></iframe>").apply({
|
||||
page: "dashboard/renderDashletInstance",
|
||||
id: p.dasInsUid
|
||||
})
|
||||
|
||||
p.update(img);
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
pd.items.items[i % 3].add( np );
|
||||
} //for
|
||||
|
||||
pd.doLayout();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user