| <?php |
| /* |
| * Copyright (c) Eclipse Foundation and others. |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| */ |
| |
| require_once dirname(__FILE__) . '/Project.class.php'; |
| require_once dirname(__FILE__) . '/database.inc'; |
| |
| /** |
| * Lightweight representation of a release to let us work with release |
| * data in an abstract manner. |
| */ |
| class Release { |
| public static function getFutureReleases() { |
| |
| /* |
| * The ProjectReleases table in the dashboard database contains |
| * a cache of the release information. This cache is generated by |
| * the /capture/php/projects.php script in the project-services |
| * repository. |
| */ |
| $sql = " |
| select |
| project as id, name, date, url |
| from ProjectReleases |
| where date > date(now()) |
| order by date"; |
| |
| $releases = array (); |
| query ( 'dashboard', $sql, array (), function ($row) use (&$releases) { |
| if ($project = Project::getProject ( $row ['id'] )) { |
| $name = $row ['name']; |
| $releases[] = new Release ( $project, $row ); |
| } |
| } ); |
| |
| return $releases; |
| } |
| |
| var $project; |
| var $data; |
| |
| private function __construct(Project $project, $data) { |
| $this->project = $project; |
| $this->data = $data; |
| } |
| |
| function getId() { |
| return $this->project->getId (); |
| } |
| |
| function getUrl() { |
| return $this->data['url']; |
| } |
| |
| function getName() { |
| return $this->project->getFormalName () . ' ' . $this->data['name']; |
| } |
| |
| function getDate() { |
| return strtotime ( $this->data['date'] ); |
| } |
| } |