From b63b46bcff8ac52eb0e225df57195334a6eaaa98 Mon Sep 17 00:00:00 2001 From: Julio Cesar Laura Date: Mon, 31 Oct 2011 15:58:51 -0400 Subject: [PATCH] Progress 6 for the dashboards --- workflow/engine/classes/class.pmDashlet.php | 14 ++++++-------- workflow/engine/controllers/dashboard.php | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/workflow/engine/classes/class.pmDashlet.php b/workflow/engine/classes/class.pmDashlet.php index fe81384e7..253953378 100644 --- a/workflow/engine/classes/class.pmDashlet.php +++ b/workflow/engine/classes/class.pmDashlet.php @@ -14,26 +14,24 @@ class PMDashlet extends DashletInstance implements DashletInterface { public function setup($dasInsUid) { try { $dashletInstance = $this->getDashletInstance($dasInsUid); - //$this->dashletObject = new $dashletInstance['DAS_CLASS'](); + $this->dashletObject = new $dashletInstance['DAS_CLASS'](); + $this->dashletObject->setup($dashletInstance); } catch (Exception $error) { throw $error; } - //recupera el registro - /*$array = loadDB() - //merge - $c = new $className(); - $c->setup($array);*/ } public function render() { try { - // + if (is_null($this->dashletObject)) { + throw new Exception('Please call to the function "setup" before call the function "render".'); + } + $this->dashletObject->render(); } catch (Exception $error) { throw $error; } - //$this->c->render(); } // Own functions diff --git a/workflow/engine/controllers/dashboard.php b/workflow/engine/controllers/dashboard.php index 940c03219..1aa575c88 100644 --- a/workflow/engine/controllers/dashboard.php +++ b/workflow/engine/controllers/dashboard.php @@ -96,7 +96,7 @@ class Dashboard extends Controller { $this->setJSVar('dashletInstance', $this->pmDashlet->getDashletInstance($dasInsUid)); } else { - $this->setJSVar('dashletInstance', new stdclass()); + $this->setJSVar('dashletInstance', ''); } G::RenderPage('publish', 'extJs'); }