adding width in the controller and pmDashlet class

This commit is contained in:
Fernando Ontiveros
2011-10-31 17:27:26 -04:00
parent 2103c45c23
commit 2d7729ba4b
4 changed files with 41 additions and 48 deletions

View File

@@ -4,56 +4,42 @@ require_once 'interfaces/dashletInterface.php';
class dashletOpenVSCompleted implements DashletInterface { 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) { 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']; //$this->w = $config['w'];
//loadData //loadData
} }
function render () { function render ($width = 300) {
print "hola"; die;
G::LoadClass('gauge'); G::LoadClass('gauge');
$g = new Gauge(); $g = new pmGauge();
//$g->w = $w; $g->w = $width;
//others //others
$g->render(); $g->render();
} }

View File

@@ -23,12 +23,12 @@ class PMDashlet extends DashletInstance implements DashletInterface {
} }
} }
public function render() { public function render($width = 300) {
try { try {
if (is_null($this->dashletObject)) { if (is_null($this->dashletObject)) {
throw new Exception('Please call to the function "setup" before call the function "render".'); throw new Exception('Please call to the function "setup" before call the function "render".');
} }
$this->dashletObject->render(); $this->dashletObject->render($width);
} }
catch (Exception $error) { catch (Exception $error) {
throw $error; throw $error;

View File

@@ -39,7 +39,14 @@ class Dashboard extends Controller {
throw new Exception('Parameter "DAS_INS_UID" is empty.'); throw new Exception('Parameter "DAS_INS_UID" is empty.');
} }
$this->pmDashlet->setup($data->DAS_INS_UID); $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) { catch (Exception $error) {
//ToDo: Render a image with the error message //ToDo: Render a image with the error message

View File

@@ -77,7 +77,7 @@ Ext.onReady(function(){
'resize' : function(p,w,h){ 'resize' : function(p,w,h){
var randomnumber=Math.floor(Math.random()*1000000) var randomnumber=Math.floor(Math.random()*1000000)
var img = new Ext.XTemplate("<img src='{page}?w={width}&r={random}&DAS_INS_UID={id}'>").apply({ 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 ); p.update(img );
} }