add links to calendar and plain text on html page
authorChristian Weiske <cweiske@cweiske.de>
Fri, 21 Mar 2014 19:39:54 +0000 (20:39 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Fri, 21 Mar 2014 19:39:54 +0000 (20:39 +0100)
src/bdrem/Renderer/Html.php
src/bdrem/Renderer/Ical.php

index 428f819..91f059d 100644 (file)
@@ -53,6 +53,24 @@ class Renderer_Html extends Renderer
      */
     public function render($arEvents)
     {
      */
     public function render($arEvents)
     {
+        $links = '';
+        if (isset($_SERVER['HTTP_HOST'])) {
+            $links = '  <link rel="alternate" type="text/calendar" href="'
+                . $_SERVER['REQUEST_SCHEME'] . '://'
+                . $_SERVER['HTTP_HOST']
+                . preg_replace('#\?.+$#', '', $_SERVER['REQUEST_URI'])
+                . '?renderer=ical'
+                . '"/>'
+                . "\n";
+            $links .= '  <link rel="alternate" type="text/plain" href="'
+                . $_SERVER['REQUEST_SCHEME'] . '://'
+                . $_SERVER['HTTP_HOST']
+                . preg_replace('#\?.+$#', '', $_SERVER['REQUEST_URI'])
+                . '?renderer=console'
+                . '"/>'
+                . "\n";
+        }
+
         $tr = new Renderer_HtmlTable();
         $table = $tr->render($arEvents);
         $s = <<<HTM
         $tr = new Renderer_HtmlTable();
         $table = $tr->render($arEvents);
         $s = <<<HTM
@@ -63,7 +81,7 @@ class Renderer_Html extends Renderer
  <head>
   <title>bdrem</title>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <head>
   <title>bdrem</title>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-  <style type="text/css">
+$links  <style type="text/css">
 table {
     border: 1px solid black;
     border-collapse: collapse;
 table {
     border: 1px solid black;
     border-collapse: collapse;
index f20e461..63a9028 100644 (file)
@@ -23,6 +23,7 @@ namespace bdrem;
  * @license   http://www.gnu.org/licenses/agpl.html GNU AGPL v3
  * @version   Release: @package_version@
  * @link      http://cweiske.de/bdrem.htm
  * @license   http://www.gnu.org/licenses/agpl.html GNU AGPL v3
  * @version   Release: @package_version@
  * @link      http://cweiske.de/bdrem.htm
+ * @link      http://severinghaus.org/projects/icv/ iCal validator
  */
 class Renderer_Ical extends Renderer
 {
  */
 class Renderer_Ical extends Renderer
 {