summaryrefslogtreecommitdiff
path: root/app/views/helpers/export
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-03-18 22:42:47 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-03-18 22:42:47 +0100
commitd1c5db7461ecb69c529149536718baf9b73a1f2c (patch)
treec880b6d1b7eebb6481d3525b2e0ed80b959b452e /app/views/helpers/export
parente685b541487b814cbab87ea2b6a6a4d12cd72f06 (diff)
New version to export articles + opml
It does not work yet! A lot of work has still to be done. Next versions should fix TODOs - OPML export works fine but can be improved - a framework has been created for articles export
Diffstat (limited to 'app/views/helpers/export')
-rw-r--r--app/views/helpers/export/articles.phtml30
-rw-r--r--app/views/helpers/export/opml.phtml15
2 files changed, 45 insertions, 0 deletions
diff --git a/app/views/helpers/export/articles.phtml b/app/views/helpers/export/articles.phtml
new file mode 100644
index 000000000..b7df58caf
--- /dev/null
+++ b/app/views/helpers/export/articles.phtml
@@ -0,0 +1,30 @@
+<?php
+ // TODO: A lot have to be done!
+ $username = Minz_Session::param('currentUser', '_');
+ $type_id = "TODO";
+ $title = Minz_Translate::t("TODO");
+ $entries = [];
+?>{
+ "id": "user/<?php echo str_replace("\"", "", $username); ?>/state/org.freshrss/<?php echo $type_id; ?>",
+ "title": "<?php echo addslashes($title); ?>",
+ "author": "<?php echo addslashes($username); ?>",
+ "items": [
+ <?php $i = 0; foreach($entries as $entry) { $i++;
+ echo $i > 1 ? ', ': ''; ?>{
+ "id": "<?php echo $entry->id(); ?>",
+ "categories": [<?php /* TODO */ ?>],
+ "title": "<?php echo addslashes($entry->title()); ?>",
+ "published": <?php echo $entry->date(true); ?>,
+ "updated": <?php echo $entry->date(true); ?>,
+ "content": "<?php echo addslashes($entry->content()); ?>",
+ "origin": {
+ <?php /* TODO */ ?>
+ "streamId": "",
+ "title": "",
+ "htmlUrl": "",
+ "feedUrl": ""
+ }
+ }
+ <?php } ?>
+ ]
+} \ No newline at end of file
diff --git a/app/views/helpers/export/opml.phtml b/app/views/helpers/export/opml.phtml
new file mode 100644
index 000000000..2e66e5054
--- /dev/null
+++ b/app/views/helpers/export/opml.phtml
@@ -0,0 +1,15 @@
+<?php
+require_once(LIB_PATH . '/lib_opml.php');
+
+echo '<?xml version="1.0" encoding="UTF-8" ?>';
+?>
+<!-- Generated by <?php echo Minz_Configuration::title (); ?> -->
+<opml version="2.0">
+ <head>
+ <title><?php echo Minz_Configuration::title (); ?> OPML Feed</title>
+ <dateCreated><?php echo date('D, d M Y H:i:s'); ?></dateCreated>
+ </head>
+ <body>
+<?php echo opml_export ($this->categories); ?>
+ </body>
+</opml>