示例#1
0
文件: Xml.php 项目: Doluci/tomatocart
 protected function renderTable($table)
 {
     $renderer = new Piwik_DataTable_Renderer_Php($table, $serialize = false);
     $array = $renderer->flatRender(null, (bool) Piwik_Common::getRequestVar('expanded', false));
     // case DataTable_Array
     if ($table instanceof Piwik_DataTable_Array) {
         return $this->renderDataTableArray($table, $array);
     }
     // integer value of ZERO is a value we want to display
     if ($array != 0 && empty($array)) {
         $out = "<result />";
         return $this->output($out);
     }
     if ($table instanceof Piwik_DataTable_Simple) {
         if (is_array($array)) {
             $out = $this->renderDataTableSimple($array);
             $out = "<result>\n" . $out . "</result>";
         } else {
             $out = "<result>" . $array . "</result>";
         }
         return $this->output($out);
     }
     if ($table instanceof Piwik_DataTable) {
         $out = $this->renderDataTable($array);
         $out = "<result>\n{$out}</result>";
         return $this->output($out);
     }
 }
示例#2
0
文件: Xml.php 项目: klando/pgpiwik
 protected function getArrayFromDataTable($table)
 {
     $renderer = new Piwik_DataTable_Renderer_Php();
     $renderer->setRenderSubTables($this->isRenderSubtables());
     $renderer->setSerialize(false);
     $renderer->setTable($table);
     return $renderer->flatRender();
 }
示例#3
0
 protected function renderTable($table)
 {
     $renderer = new Piwik_DataTable_Renderer_Php($table, $serialize = false);
     $array = $renderer->flatRender(null, (bool) Piwik_Common::getRequestVar('expanded', false));
     if (!is_array($array)) {
         $array = array('value' => $array);
     }
     $str = json_encode($array);
     if (($jsonCallback = Piwik_Common::getRequestVar('jsoncallback', false)) !== false) {
         if (preg_match('/^[0-9a-zA-Z]*$/', $jsonCallback) > 0) {
             $str = $jsonCallback . "(" . $str . ")";
         }
     }
     return $str;
 }
示例#4
0
 protected function renderTable($table)
 {
     $renderer = new Piwik_DataTable_Renderer_Php();
     $renderer->setTable($table);
     $renderer->setRenderSubTables($this->isRenderSubtables());
     $renderer->setSerialize(false);
     $renderer->setHideIdSubDatableFromResponse($this->hideIdSubDatatable);
     $array = $renderer->flatRender();
     if (!is_array($array)) {
         $array = array('value' => $array);
     }
     // decode all entities
     $callback = create_function('&$value,$key', 'if(is_string($value)){$value = html_entity_decode($value, ENT_QUOTES, "UTF-8");}');
     array_walk_recursive($array, $callback);
     $str = Piwik_Common::json_encode($array);
     return $this->jsonpWrap($str);
 }
示例#5
0
 protected function renderTable($table)
 {
     $renderer = new Piwik_DataTable_Renderer_Php();
     $renderer->setTable($table);
     $renderer->setRenderSubTables($this->isRenderSubtables());
     $renderer->setSerialize(false);
     $array = $renderer->flatRender();
     if (!is_array($array)) {
         $array = array('value' => $array);
     }
     $str = json_encode($array);
     if (($jsonCallback = Piwik_Common::getRequestVar('jsoncallback', false)) !== false) {
         if (preg_match('/^[0-9a-zA-Z]*$/', $jsonCallback) > 0) {
             $str = $jsonCallback . "(" . $str . ")";
         }
     }
     return $str;
 }