| <?php |
| /******************************************************************************* |
| * Copyright (c) 2016 Eclipse Foundation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Wayne Beaton (Eclipse Foundation)- initial API and implementation |
| *******************************************************************************/ |
| |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php"); |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php"); |
| $App = new App(); |
| $Nav = new Nav(); |
| $Menu = new Menu(); |
| include($App->getProjectCommon()); |
| |
| require_once (dirname ( __FILE__ ) . '/../classes/Review.class.php'); |
| require_once (dirname ( __FILE__ ) . '/../classes/Proposal.class.php'); |
| require_once (dirname ( __FILE__ ) . '/../classes/debug.php'); |
| |
| mustBeFoundationEmployee(); |
| |
| $pageTitle = "Open Source Project Announcements"; |
| $pageKeywords = ""; |
| $pageAuthor = "Wayne Beaton"; |
| |
| function getFutureReviews() { |
| $reviews = array(); |
| foreach(getReviews('upcoming') as $review) { |
| if ($review->getReviewDate() < strtotime("now")) continue; |
| if ($review->getReviewDate() > strtotime("+2 weeks")) continue; |
| |
| $reviews[] = $review; |
| } |
| return $reviews; |
| } |
| |
| function dumpInfo() { |
| global $App; |
| |
| dumpReviews($references); |
| dumpProposals($references); |
| |
| $candidates = get_candidate_dates("+1 week"); |
| $next = $App->getFormattedDate ($candidates[0], 'long' ); |
| $afterThat = $App->getFormattedDate ($candidates[1], 'long' ); |
| |
| print "<p>We run reviews ending on the first and third Wednesday of each month. Our next scheduled review dates are $next and $afterThat.</p>"; |
| |
| $url= "https://www.eclipse.org/projects/handbook/#release"; |
| |
| print "For more information about releases and reviews, please see the <a href=\"$url\">Eclipse Project Handbook</a>."; |
| } |
| |
| function get_candidate_dates($date = "now", $max=5) { |
| $date = strtotime($date); |
| $diff = 3 - date('w', $date); // '3' means Wednesday |
| if ($diff < 0) $diff += 7; |
| if ($diff < 7) $diff += 7; |
| |
| $date = strtotime("+$diff days", $date); |
| $dates = array(); |
| while (true) { |
| if (count($dates) >= $max) break; |
| // There's probably a better way to do this, but |
| // the month boundaries are icky, this works, and is simple. |
| if (project_reviews__is_first_or_third_week($date)) { |
| $dates[] = $date; |
| } |
| $date = strtotime("+1 week", $date); |
| } |
| return $dates; |
| } |
| function project_reviews__is_first_or_third_week($date) { |
| $day = date('j', $date) - 1; // 0-based day of the month |
| if (floor($day / 7) == 0) return true; // first week |
| if (floor($day / 7) == 2) return true; // third week |
| return false; |
| } |
| |
| function sortReviewsByType (Review $a, Review $b) { |
| if ($a->getReviewDate() == $b->getReviewDate()) |
| if ($a->getType() == $b->getType()) |
| return strcasecmp($a->getTitle(), $b->getTitle()); |
| else |
| return $a->getType() < $b->getType() ? - 1 : 1; |
| else |
| return $a->getReviewDate() < $b->getReviewDate() ? - 1 : 1; |
| } |
| |
| function dumpReviews(&$references) { |
| global $App; |
| if (!$reviews = getFutureReviews ()) return; |
| |
| usort($reviews, 'sortReviewsByType'); |
| |
| $lastDate = null; |
| /** @var \Review $review */ |
| foreach ( $reviews as $review ) { |
| $date = $App->getFormattedDate ( $review->getDate(), 'long' ); |
| |
| if ($date != $lastDate) { |
| if ($lastDate) print "</ul>"; |
| print "<p>There are some reviews concluding on $date:</p>"; |
| print "<ul>"; |
| } |
| |
| $lastDate = $date; |
| |
| $title = trim($review->getTitle()); |
| $url = $review->getLink(); |
| print "<li><a href=\"$url\">$title</a></li>"; |
| } |
| print "</ul>"; |
| } |
| |
| function dumpProposals() { |
| if (!$proposals = getProposals()) return; |
| |
| print "<p>We have several proposals open for community review:<p>"; |
| print "<ul>"; |
| foreach($proposals as $proposal) { |
| $title = $proposal->getName(); |
| $url = $proposal->getProposalUrl(); |
| |
| print "<li><a href=\"$url\">$title</a></li>"; |
| } |
| print "</ul>"; |
| |
| $url = "https://www.eclipse.org/forums/eclipse.proposals"; |
| |
| print "<p>Please add your comments either directly on the proposal or in the <a href=\"$url\">Proposals forum</a>.</p>"; |
| } |
| |
| ob_start(); |
| |
| ?> |
| <div id="maincontent"> |
| <div id="midcolumn"> |
| <h1><?= $pageTitle ?></h1> |
| |
| <?php dumpInfo(); ?> |
| |
| </div> |
| </div> |
| |
| <?php |
| $html = ob_get_contents(); |
| ob_end_clean(); |
| $App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html); |
| ?> |