修改数据可视化时元数据读取来源

This commit is contained in:
Li Jianxuan 2014-06-12 01:51:59 +00:00
parent 5791184f19
commit f86001f75d
1 changed files with 14 additions and 2 deletions

View File

@ -6,17 +6,29 @@ use Helpers\dbh;
class Visual class Visual
{ {
public $db; private $db;
private $config;
protected $events; protected $events;
private $metadataTable;
function __construct() function __construct()
{ {
$this->db = \Zend_Registry::get('db'); $this->db = \Zend_Registry::get('db');
$this->config = \Zend_Registry::get('config');
$this->mainTable = "datavisual"; $this->mainTable = "datavisual";
$Listener = new Listener(); $Listener = new Listener();
@$this->getEventManager()->attachAggregate($Listener); @$this->getEventManager()->attachAggregate($Listener);
if(isset($this->config->sub->metadata) && !empty($this->config->sub->metadata))
{
$this->metadataTable = $this->config->sub->metadata;
}else{
$this->metadataTable = 'metadata';
}
} }
public function getEventManager(\Zend_EventManager_EventCollection $events = NULL) public function getEventManager(\Zend_EventManager_EventCollection $events = NULL)
@ -101,7 +113,7 @@ class Visual
//获得可以可视化的元数据 //获得可以可视化的元数据
public function getVisualMetadata() public function getVisualMetadata()
{ {
$sql = "SELECT * FROM metadata md $sql = "SELECT * FROM {$this->metadataTable} md
LEFT JOIN {$this->mainTable} v ON v.uuid = md.uuid LEFT JOIN {$this->mainTable} v ON v.uuid = md.uuid
WHERE v.uuid IS NOT NULL"; WHERE v.uuid IS NOT NULL";