adding width in the controller and pmDashlet class
This commit is contained in:
@@ -4,56 +4,42 @@ require_once 'interfaces/dashletInterface.php';
|
||||
|
||||
class dashletOpenVSCompleted implements DashletInterface {
|
||||
|
||||
/**
|
||||
width
|
||||
*/
|
||||
var $w = 610;
|
||||
|
||||
/**
|
||||
height
|
||||
*/
|
||||
var $h = 300;
|
||||
|
||||
/**
|
||||
value of gauge
|
||||
*/
|
||||
var $value = 50;
|
||||
|
||||
/**
|
||||
maxValue
|
||||
*/
|
||||
var $maxValue = 100;
|
||||
|
||||
/**
|
||||
redFrom
|
||||
*/
|
||||
var $redFrom = 80;
|
||||
|
||||
/**
|
||||
redTo
|
||||
*/
|
||||
var $redTo = 100;
|
||||
|
||||
/**
|
||||
yellowFrom
|
||||
*/
|
||||
var $yellowFrom = 60;
|
||||
|
||||
/**
|
||||
yellowTo
|
||||
*/
|
||||
var $yellowTo = 80;
|
||||
|
||||
function setup($config) {
|
||||
/*
|
||||
Array
|
||||
(
|
||||
[DAS_UID] => 00000000000000000000000000000001
|
||||
[DAS_CLASS] => dashletOpenVSCompleted
|
||||
[DAS_TITLE] => Open Cases VS Complete Cases
|
||||
[DAS_DESCRIPTION] => Open Cases VS Complete Cases
|
||||
[DAS_VERSION] => 1.0
|
||||
[DAS_CREATE_DATE] => 2011-10-28 00:00:00
|
||||
[DAS_UPDATE_DATE] => 2011-10-28 00:00:00
|
||||
[DAS_STATUS] => 1
|
||||
[DAS_INS_UID] => 00000000000000000000000000000001
|
||||
[DAS_INS_TYPE] => OPEN_CASES
|
||||
[DAS_INS_CONTEXT_TIME] => MONTH
|
||||
[DAS_INS_START_DATE] =>
|
||||
[DAS_INS_END_DATE] =>
|
||||
[DAS_INS_OWNER_TYPE] => DEPARTMENT
|
||||
[DAS_INS_OWNER_UID] => 2502663244e6f5e1e3c2254024148892
|
||||
[DAS_INS_PROCESSES] =>
|
||||
[DAS_INS_TASKS] =>
|
||||
[DAS_INS_ADDITIONAL_PROPERTIES] =>
|
||||
[DAS_INS_CREATE_DATE] => 2011-10-28 00:00:00
|
||||
[DAS_INS_UPDATE_DATE] => 2011-10-28 00:00:00
|
||||
[DAS_INS_STATUS] => 1
|
||||
)
|
||||
*/
|
||||
|
||||
//$this->w = $config['w'];
|
||||
//loadData
|
||||
}
|
||||
|
||||
function render () {
|
||||
print "hola"; die;
|
||||
function render ($width = 300) {
|
||||
G::LoadClass('gauge');
|
||||
$g = new Gauge();
|
||||
//$g->w = $w;
|
||||
$g = new pmGauge();
|
||||
$g->w = $width;
|
||||
//others
|
||||
$g->render();
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@ class PMDashlet extends DashletInstance implements DashletInterface {
|
||||
}
|
||||
}
|
||||
|
||||
public function render() {
|
||||
public function render($width = 300) {
|
||||
try {
|
||||
if (is_null($this->dashletObject)) {
|
||||
throw new Exception('Please call to the function "setup" before call the function "render".');
|
||||
}
|
||||
$this->dashletObject->render();
|
||||
$this->dashletObject->render($width);
|
||||
}
|
||||
catch (Exception $error) {
|
||||
throw $error;
|
||||
|
||||
@@ -39,7 +39,14 @@ class Dashboard extends Controller {
|
||||
throw new Exception('Parameter "DAS_INS_UID" is empty.');
|
||||
}
|
||||
$this->pmDashlet->setup($data->DAS_INS_UID);
|
||||
$this->pmDashlet->render();
|
||||
|
||||
if (!isset($_REQUEST['w']) ) {
|
||||
$width = 300;
|
||||
}
|
||||
else {
|
||||
$width = $_REQUEST['w'];
|
||||
}
|
||||
$this->pmDashlet->render( $width);
|
||||
}
|
||||
catch (Exception $error) {
|
||||
//ToDo: Render a image with the error message
|
||||
|
||||
@@ -77,7 +77,7 @@ Ext.onReady(function(){
|
||||
'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:'123456ABCDEF' })
|
||||
page: 'dashboard/renderDashletInstance', width:w, random: randomnumber, id:'00000000000000000000000000000001' })
|
||||
|
||||
p.update(img );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user