server.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. $students = [
  3. 'hugo',
  4. 'susannadiv',
  5. 'rainydaysavings',
  6. ];
  7. $start_month_offset = 5; // Things started in May
  8. ?>
  9. <!DOCTYPE html>
  10. <html lang="en">
  11. <head>
  12. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  13. <title>Daily Report Viewer | GS SoC 2020</title>
  14. <link rel="icon" href="../../../favicon.png">
  15. <meta charset="utf-8">
  16. <meta name="robots" content="noindex, nofollow, nosnippet">
  17. <meta name="viewport" content="width=device-width, initial-scale=1">
  18. <link rel="stylesheet" href="https://hackersatporto.com/assets/css/main.css">
  19. <style>
  20. #side-menu #menu-title {
  21. color: #7a7a7a !important;
  22. font-weight: 700;
  23. }
  24. @media screen and (max-width: 1200px) {
  25. #side-menu #menu-title {
  26. display:none;
  27. }
  28. }
  29. </style>
  30. </head>
  31. <body>
  32. <header id="header">
  33. <nav id="side-menu">
  34. <label for="show-menu" id="menu-button">Menu</label>
  35. <input id="show-menu" role="button" type="checkbox">
  36. <ul id="menu">
  37. <li><a href="../"><strong>&larr; GS GSoC 2020</strong></a></li>
  38. <li><a href="archive">Previous Months</a></li>
  39. <li id="menu-title">STUDENTS</li>
  40. <?php
  41. foreach ($students as $s)
  42. {
  43. echo '<li><a'.((!empty($_GET['student']) && $s == $_GET['student']) ? ' class="current"' : '').' href="index.php?student='.$s.'">'.$s.'</a></li>';
  44. }
  45. ?>
  46. </ul>
  47. </nav>
  48. <h1>Daily Report Viewer | GS SoC 2020</h1>
  49. <p>Organized by <strong><a href="https://www.diogo.site/">Diogo Cordeiro</a></strong></p>
  50. <p>Mentors: <a href="https://www.diogo.site/">Diogo Cordeiro</a>, <a href="https://loadaverage.org/XRevan86">Alexei Sorokin</a>, <a href="https://dansup.com">Daniel Supernault</a>, <a href="http://status.hackerposse.com/rozzin">Joshua Judson Rosen</a> and <a href="https://github.com/phablulo">Phablulo Joel</a></p>
  51. </header>
  52. <?php
  53. if (!empty($_GET['student']) && in_array($_GET['student'], $students))
  54. {
  55. echo '<article id="student_report">';
  56. $month = (string)(date('m')-$start_month_offset);
  57. $nday = (string)(date('d')-1);
  58. echo '<h2>Showing reports for '.$_GET['student'].'</h2>';
  59. $total_hours_this_week = 0;
  60. for ($i = 0; $i <= $nday ; ++$i)
  61. {
  62. echo "<h3 id=\"day-$i\">Day $i</h3>";
  63. $rand = ($i == $nday) ?? rand(0,31337);
  64. $report_raw = file_get_contents('https://notabug.org/diogo/gnu-social-soc-2020-daily-report/raw/master/'.$_GET['student'].'/'.$month.'/'.$i.'?rand='.$rand);
  65. if ($report_raw)
  66. {
  67. $re = '/{[^}]*}/s';
  68. preg_match_all($re, $report_raw, $matches, PREG_SET_ORDER, 0);
  69. $report = json_decode($matches[0][0]);
  70. $report_content_start = strlen($matches[0][0]);
  71. $report_content = substr($report_raw, $report_content_start);
  72. $total_hours_this_week += $report->dedicated_hours;
  73. echo '<p><strong>Summary:</strong> '.$report->summary.'</p>';
  74. echo '<p><strong>Dedicated Time (in hours):</strong> '.$report->dedicated_hours.'</p>';
  75. echo '<pre>'.$report_content.'</pre>';
  76. }
  77. else
  78. {
  79. echo "<p><b>No report.</b></p>";
  80. }
  81. // Break weeks
  82. if (($i+1) % 7 == 0)
  83. {
  84. echo "<hr>";
  85. echo "<p><strong>Total hours this week:</strong> $total_hours_this_week</p>";
  86. echo "<hr>";
  87. $total_hours_this_week = 0;
  88. }
  89. }
  90. echo '</article>';
  91. }
  92. else
  93. {
  94. echo '<h2>Select the student to view a report on the left menu.</h2>
  95. <article id="time_and_instructions">
  96. <p>With respect to the time you will have to dedicate, GSoC demands 30h to 40h of work per week. <strong>GNU social\'s Summer of Code expects you to work between [32, 36.5]h/week</strong>, you can organize that time as you please, but you must be sure to dedicate that in your weekly work or to be overly productive.</p>
  97. <p>We suggest you to do a four-day work week with 6h of work/day + <strong>2h to document, review and test</strong> and report the progress you\'ve done. As breaks are important, we recommend a 1h lunch break, 15min break after 4h of continuous work and a further 15mins break after 6h of work. These breaks won\'t be considered as part of your work time.</p>
  98. <p>In some places, GSoC starts in the middle of college\'s last exam season, if that\'s your case, we accept that you start doing some hours of work in May (bonding month) and debit those in June (first coding month) weeks.</p>
  99. <p>In average, you will work 146h/month, ideally 128h/month will be enough (maybe even only 96h/month, if you\'re special). We do not accept that you transfer expected work time from a month to another. <strong>An under-performing week will make us request more hours from you either in the same week or the one immediately after.</strong></p>
  100. <h2>How to submit a report?</h2>
  101. <p>Follow the instructions available <a href="https://notabug.org/diogo/gnu-social-soc-2020-daily-report">here</a>.</p>
  102. </article>';
  103. }
  104. ?>
  105. </body>
  106. </html>