blob: 1e19d682fcb76aa9d84eeda45b5d3e791720c302 [file] [log] [blame]
<?php 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()); # All on the same line to unclutter the user's desktop'
$pageTitle = "Eclipse Web Tools Community Resources";
$pageKeywords = "";
$pageAuthor = "Bob Fraser";
$root = $_SERVER['DOCUMENT_ROOT'];
require_once ($root . '/webtools/common.php');
# Functions
function date_cmp($a, $b) {
// sort descending by publicationDate
$a = strtotime($a['publicationDate']);
$b = strtotime($b['publicationDate']);
return $b - $a;
}
function title_cmp($a, $b) {
// sort by title
$a = $a['title'];
$b = $b['title'];
return strcmp($a, $b);
}
# Main
# Build an assoc array of bio pages
$xml = simplexml_load_file('biopages.xml');
foreach ($xml->bio as $bio) {
$bios[(string)$bio['name']] = (string)$bio['link'];
}
# Books
$xml = simplexml_load_file('books.xml');
# Generate the books section
$book_h = "<a name=\"books\"></a><h3>Books</h3>";
$book_h .= "<ul>";
foreach ($xml->book as $book) {
$book_h .= "<li>";
$title = $book['title'];
$link = $book['link'];
$image = $book['image'];
$date = date("(M d, Y)", strtotime($book['publicationDate']));
if ($image) {
$book_h .= "<span class=\"sectionimage\">";
if ($link) {
$book_h .= "<a href=\"$link\"><img src=\"$image\"></a>";
} else {
$book_h .= "<img src=\"$image\">";
}
$book_h .= "</span>";
}
if ($link) {
$book_h .= "<a href=\"$link\">$title</a>";
} else {
$book_h .= $title;
}
$book_h .= "<br /><br />by: ";
$count = count($book->author);
foreach ($book->author as $author) {
$count--;
$name = (string)$author['name'];
// see if we have a bio for this person
if (isset($bios[$name])) {
$book_h .= "<a href=\"$bios[$name]\">$name</a>";
} else {
$book_h .= $name;
}
if ($count) $book_h .= ", ";
}
$book_h .= "<br /><br />Publisher: ";
$name = $book->publisher['name'];
$link = $book->publisher['link'];
if ($link) {
$book_h .= "<a href=\"$link\">$name</a>";
} else {
$book_h .= $name;
}
if ($image) {
$book_h .= "<div class=\"clearall\" />";
}
$book_h .= "</li>";
}
$book_h .= "</ul>";
# Articles
# Get articles array
$xml = simplexml_load_file('articles.xml');
$articles = $xml->xpath('/articles:articles/articles:article');
# Sort desending by publication date;
usort($articles, "date_cmp");
# Generate the articles section
$art_h = "<a name=\"articles\"></a><h3>Articles</h3>";
$art_h .= "<ul>";
foreach ($articles as $article) {
$art_h .= "<li>";
$title = $article['title'];
$link = $article['link'];
$date = date("(M d, Y)", strtotime($article['publicationDate']));
$art_h .= "<a href=\"$link\" target=\"_blank\">$title</a> $date<br />";
$name = $article->publication['name'];
$link = $article->publication['link'];
if ($link) {
$art_h .= "<a href=\"$link\" target=\"_blank\">$name</a>";
} else {
$art_h .= "$name";
}
$art_h .= " by ";
$count = count($article->author);
foreach ($article->author as $author) {
$count--;
$name = (string)$author['name'];
// see if we have a bio for this person
if (isset($bios[$name])) {
$art_h .= "<a href=\"$bios[$name]\">$name</a>";
} else {
$art_h .= $name;
}
if ($count) $art_h .= ", ";
}
$art_h .= "</li>";
}
$art_h .= "</ul>";
# Tutorials
$xml = simplexml_load_file('tutorials.xml');
# Generate the tutorials section
$tut_h = <<<EOHTML
<a name="tutorials"></a>
<h3>Tutorials</h3>
<ul>
<p>
Interested in writing a new WTP tutorial? Download the
<a href="tutorials/WTPTutorialTemplate.zip">WTP tutorial template</a>
and get started!
</p>
EOHTML;
$count = count($xml->category);
foreach ($xml->category as $category) {
$count--;
$name = $category['name'];
$link = "#" . $category['id'];
$tut_h .= "<a href=\"$link\">$name</a>";
if ($count) $tut_h .= " | ";
}
$tut_h .= "<br />";
foreach ($xml->category as $category) {
$name = $category['name'];
$id = $category['id'];
$tut_h .= "<br /><a name=\"$id\"></a><b>$name</b>";
// Get all tutorias for a category
$tutorials = $xml->xpath("/tutorials:tutorials/tutorials:tutorial[contains(@categories, \"$id\")]");
// Sort by title
usort($tutorials, "title_cmp");
foreach ($tutorials as $tutorial) {
$tut_h .= "<li>";
$title = $tutorial['title'];
$link = $tutorial['link'];
$date = date("(M d, Y)", strtotime($tutorial['lastUpdated']));
$tut_h .= "<a href=\"$link\">$title</a> $date";
$tut_h .= "<br /><br />";
$tut_h .= $tutorial->abstract;
$tut_h .= "</li>";
}
}
$tut_h .= "</ul>";
# White papers
# Get white papers array
$xml = simplexml_load_file('whitepapers.xml');
$papers = $xml->xpath('/whitepapers:whitepapers/whitepapers:paper');
# Sort desending by publication date;
usort($papers, "date_cmp");
# Generate the white papers section
$paper_h = "<a name=\"whitepapers\"></a><h3>White Papers</h3>";
$paper_h .= "<ul>";
foreach ($papers as $paper) {
$paper_h .= "<li>";
$title = $paper['title'];
$link = $paper['link'];
$date = date("(M d, Y)", strtotime($paper['publicationDate']));
$paper_h .= "<a href=\"$link\" target=\"_blank\">$title</a> $date";
$paper_h .= "</li>";
}
$paper_h .= "</ul>";
# Generate the web page
$html = <<<EOHTML
<div id="maincontent">
<div id="midcolumn">
<table>
<tr>
<td width="60%">
<h1>WTP community resources</h1>
<div class="wtpsubtitle">$pageTitle</div>
</td>
<td>
<img src="/webtools/images/wtplogosmall.jpg"
align="middle" height="129" hspace="50" width="207" />
</td>
</tr>
</table>
<div class="homeitem3col">
<h3>Resources from around the WTP community...</h3>
<p>
This page is about finding more information about WTP from around the WTP community.
The community has provided many
<a href="#articles">articles</a>,
<a href="#books">books</a>,
<a href="#tutorials">tutorials</a>, and
<a href="#whitepapers">white papers</a>
that are dedicated to WTP and can help you to make the most of the WTP platform and tools.
</p>
<p>
WTP presentation material can be found on the
<a href="presentations.html">WTP presentations archive</a>.
</p>
<p>
We'd like these pages to be useful to you - so please open a
<a href="https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Web%20Tools&amp;component=website">
bug report</a> for any corrections, additions, pointers, or comments!
</p>
</div>
<div class="homeitem3col">
$book_h
</div>
<div class="homeitem3col">
$art_h
</div>
<div class="homeitem3col">
$tut_h
</div>
<div class="homeitem3col">
$paper_h
</div>
</div>
</div>
EOHTML;
$App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html);
?>