store = $store; } // Must be redefined at the subclass level public function load_query() { } // Loading data from the triple store // TODO - clean the tmp bugfix public function load() { $query = $this->load_query(); $res = $this->store->do_query($query); $out = ' { "items" : [ '; foreach($res['result']['rows'] as $row) { $graph = $row['graph']; $title = str_replace('"','\"', $row['title']); $source = $row['source']; $content = str_replace('”','\"', $row['content']); $created = $row['created']; $day = strftime('%Y-%m-%d', strtotime($created)); $icon = LODrTools::get_icon($source); $user = $row['user']; $url = $row['url']; $lat = @$row['lat']; $long = @$row['long']; $latlng = ($lat && $long) ? "latlng : \"$lat, $long\",": ''; $link = array_pop(explode('/', $graph)); $uri2 = $row['uri2']; $u2 = $uri2 ? "uri: \"$uri2\"," : ''; $out .= <<<_END_ { type : "item", url: "$url", label : "$title", graph : "$graph", source: "$source", icon : "$icon", $latlng $u2 created : "$created", day : "$day" }, _END_; //$item = new LODrItem($this->store, $graph, $url); //$item->set_details($title, $user, $content, $source, $created, array()); //if($lat && $long) $item->set_geo($lat, $long); //$this->items[] = $item; } $out = substr($out, 0, -1). "\n] }"; echo $out; } // Render the list of data public function go($format) { if($format == 'html') { return $this->html_output(); } elseif($format == 'exhibit') { $this->load(); //return $this->exhibit_output(); } } // Generic Exhibit output public function exhibit_output() { $out = ' { "items" : [ '; if($this->items) { foreach($this->items as $item) { $out .= $item->exhibit(); } } $out = substr($out, 0, -1). "\n] }"; echo $out; } public function html_output() { return $this->exhibit_panel(); } // Exhibit panel for HTML view public function exhibit_panel() { global $action; $out = '

Items

  [details]
'; if($action == 'uri') { $out .= '
'; } $out .= '
'; return $out; } } ?>