WIP report
authorCameron Ball <cameron@cameron1729.xyz>
Tue, 15 Jan 2019 18:21:05 +0000 (02:21 +0800)
committerCameron Ball <cameron@cameron1729.xyz>
Tue, 15 Jan 2019 18:21:05 +0000 (02:21 +0800)
src/bootstrap.php
src/report.php
src/test.php

index 3f79d78..b414267 100644 (file)
@@ -6,17 +6,23 @@ function tabs($headings, $contents) {
     $slug = function($string) {
         return str_replace(' ', '', $string);
     };
-    $headingAndContent = zipWith(function($heading, $content) use ($slug) {
-        return [
-            'heading' => '<li class="nav-item"><a class="nav-link" data-toggle="pill" href="#' . $slug($heading) . '">' . $heading . '</a></li>',
-            'content' => '<div class="container-fluid drivers-main tab-pane" id="' . $slug($heading) . '" role="tabpanel">' . $content . '</div>'
-        ];
+
+    $heading = function($heading, $tabid, $active = false) {
+        return '<li class="nav-item"><a class="nav-link' . ($active ? ' active' : '')  . '" data-toggle="pill" href="#' . $tabid . '">' . $heading . '</a></li>';
+    };
+
+    $content = function($content, $id, $active = false) {
+        return '<div class="container-fluid drivers-main tab-pane' . ($active ? ' active' : '')  . '" id="' . $id  . '" role="tabpanel">' . $content . '</div>';
+    };
+
+    $headingAndContent = zipWith(function($heading, $content) {
+        return ['heading' => $heading, 'content' => $content];
     }, $headings, $contents);
 
-    $smushenated = array_reduce($headingAndContent, function($c, $v) {
+    $smushenated = array_reduce($headingAndContent, function($c, $v) use ($slug, $heading, $content) {
         return [
-            'headings' => $c['headings'] . $v['heading'],
-            'contents' => $c['contents'] . $v['content']
+            'headings' => $c['headings'] . $heading($v['heading'], $slug($v['heading']), !$c['headings']),
+            'contents' => $c['contents'] . $content($v['content'], $slug($v['heading']), !$c['contents'])
         ];
     }, ['headings' => '', 'contents' => '']);
 
index 04ee18c..a4d5192 100644 (file)
@@ -21,7 +21,7 @@
     </head>
     <body>
         <div class="container">
-            <?php echo     tabs(['my name jeff'], ['hell my name is jeff']); ?>
+<?php echo     tabs(['my name jeff', 'myname jaaaaa'], ['hell my name is jeff', 'oaaaa']); ?>
         </div>
 
         <!-- <div class="container">
index fcb4bb6..c10605b 100644 (file)
@@ -2,5 +2,5 @@
 
 require_once('common.php');
 
-//print_r(getDayNumber(2019, 1, 5));
-print_r(getTasksForTheSeason('autumn', require 'taskMatrix.php'));
+trigger_error("Fatal error", E_USER_DEPRECATED);
+$a[0];