Skip to content

Commit

Permalink
Added a json export option to be able to implement a future ajax solu…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
Egil Moeller committed Aug 29, 2010
1 parent cf9e95c commit 8df4e61
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
23 changes: 23 additions & 0 deletions views/json.php
@@ -0,0 +1,23 @@
<?php
/*
DemoWave
Copyright (C) 2006 RedHog (Egil Möller) <redhog@redhog.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
*/

header("Content-Type: text/json; charset=UTF-8");
require("views/json/{$_GET['view']}.php");
24 changes: 24 additions & 0 deletions views/json/category.php
@@ -0,0 +1,24 @@
<?php /*
DemoWave
Copyright (C) 2006 RedHog (Egil Möller) <redhog@redhog.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
*/

if ( !isset($_GET['categoryview'])
|| $category_type != 'law') $_GET['categoryview'] = 'referendums';
require("views/json/{$_GET['categoryview']}.php");
?>
22 changes: 22 additions & 0 deletions views/json/law.php
@@ -0,0 +1,22 @@
<?php
/*
DemoWave
Copyright (C) 2006 RedHog (Egil Möller) <redhog@redhog.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
*/

echo json_encode($laws);
22 changes: 22 additions & 0 deletions views/json/referendums.php
@@ -0,0 +1,22 @@
<?php
/*
DemoWave
Copyright (C) 2006 RedHog (Egil Möller) <redhog@redhog.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
*/

echo json_encode($referendums);

0 comments on commit 8df4e61

Please sign in to comment.