2011-10-28 12:20:45 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
require_once 'interfaces/dashletInterface.php';
|
|
|
|
|
require_once 'model/Dashlet.php';
|
|
|
|
|
require_once 'model/DashletInstance.php';
|
|
|
|
|
|
|
|
|
|
class PMDashlet extends DashletInstance implements DashletInterface {
|
|
|
|
|
|
2011-10-31 14:39:52 -04:00
|
|
|
// Own properties
|
2011-10-31 15:14:01 -04:00
|
|
|
private $dashletObject;
|
2011-10-31 14:39:52 -04:00
|
|
|
|
|
|
|
|
// Interface functions
|
|
|
|
|
|
|
|
|
|
public function setup($dasInsUid) {
|
|
|
|
|
try {
|
2011-10-31 15:51:23 -04:00
|
|
|
$dashletInstance = $this->getDashletInstance($dasInsUid);
|
2011-10-31 15:58:51 -04:00
|
|
|
$this->dashletObject = new $dashletInstance['DAS_CLASS']();
|
|
|
|
|
$this->dashletObject->setup($dashletInstance);
|
2011-10-31 14:39:52 -04:00
|
|
|
}
|
|
|
|
|
catch (Exception $error) {
|
|
|
|
|
throw $error;
|
|
|
|
|
}
|
2011-10-28 12:20:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function render() {
|
2011-10-31 14:39:52 -04:00
|
|
|
try {
|
2011-10-31 15:58:51 -04:00
|
|
|
if (is_null($this->dashletObject)) {
|
|
|
|
|
throw new Exception('Please call to the function "setup" before call the function "render".');
|
|
|
|
|
}
|
|
|
|
|
$this->dashletObject->render();
|
2011-10-31 14:39:52 -04:00
|
|
|
}
|
|
|
|
|
catch (Exception $error) {
|
|
|
|
|
throw $error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Own functions
|
|
|
|
|
|
|
|
|
|
public function getDashletsInstances() {
|
|
|
|
|
try {
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
catch (Exception $error) {
|
|
|
|
|
throw $error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getDashletsInstancesQuantity() {
|
|
|
|
|
try {
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
catch (Exception $error) {
|
|
|
|
|
throw $error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-31 15:14:01 -04:00
|
|
|
public function getDashletInstance($dasInsUid) {
|
|
|
|
|
try {
|
2011-10-31 15:51:23 -04:00
|
|
|
$dashletInstance = $this->load($dasInsUid);
|
|
|
|
|
if (!isset($dashletInstance['DAS_UID'])) {
|
|
|
|
|
new Exception('Error load the Dashlet Instance "' . $dasInsUid . '".');
|
|
|
|
|
}
|
|
|
|
|
$dashlet = new Dashlet();
|
|
|
|
|
$dashletFields = $dashlet->load($dashletInstance['DAS_UID']);
|
|
|
|
|
return array_merge($dashletFields, $dashletInstance);
|
2011-10-31 15:14:01 -04:00
|
|
|
}
|
|
|
|
|
catch (Exception $error) {
|
|
|
|
|
throw $error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-31 14:39:52 -04:00
|
|
|
public function saveDashletInstance($data) {
|
|
|
|
|
try {
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
catch (Exception $error) {
|
|
|
|
|
throw $error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function deleteDashletInstance($dasInsUid) {
|
|
|
|
|
try {
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
catch (Exception $error) {
|
|
|
|
|
throw $error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getDashletsInstancesForUser($userUid) {
|
|
|
|
|
try {
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
catch (Exception $error) {
|
|
|
|
|
throw $error;
|
|
|
|
|
}
|
2011-10-28 12:20:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|