<?php

$days = array(
    "1" => "May 17",
    "2" => "May 18",
    "3" => "May 19",
    "4" => "May 20",
    "5" => "May 24",
    "6" => "May 25",
    "7" => "May 26",
    "8" => "May 27",
    "9" => "May 31",
    "10" => "June 1",
    "11" => "June 2",
    "12" => "June 3",
    "13" => "June 7",
    "14" => "June 8",
    "15" => "June 9",
    "16" => "June 10",
);

$lectures = array(
);

$exercises = array(
);

$attachements = array(
    "Presentations" => array(
        "Presentations/Poland-BasicConcepts.pptx" => "Partially Ordered Sets: Basic Concepts",
        "Presentations/Poland-ComparabilityGraphs.pptx" => "Comparability Graphs",
        "Presentations/Poland-PlanarPosets.pptx" => "Planarity for Partially Ordered Sets",
        "Presentations/Poland-AdjacencyPosets.pptx" => "Adjacency Posets of Planar Graphs",
        "Presentations/Poland-Schnyder.pptx" => "Schnyder’s Theorem and Relatives",
        "Presentations/Poland-CircleOrders.pptx" => "Circle and Sphere Orders",
    ),
    "Draft chapters" => array(
        "DraftChapters/1-introduction.pdf" => "1. Introduction",
        "DraftChapters/2-chains.pdf" => "2. Chains and Antichains",
        "DraftChapters/3-comparability.pdf" => "3. Comparability Graphs, Interval Graphs and Interval Orders",
        "DraftChapters/4-extremal.pdf" => "4. Extremal Set Theory",
        "DraftChapters/7-correlation.pdf" => "7. Correlation",
        "DraftChapters/grb-wtt-8.pdf" => "8. Counting Linear Extensions: Polyhedral Methods",
    ),
    "Papers" => array(
        "Papers/8-ProcAMS-DilworthEmbed.pdf" => "A Note on Dilworth's Embedding Theorem",
        "Papers/84-SIAM-DimConvexPoly.pdf" => "The Order Dimension of Convex Polytopes",
        "Papers/89-SIAM-OnLineRecurs.pdf" => "On-line Coloring and Recursive Graph Theory",
        "Papers/92-JGT-PlanarGraphColoringWUCoPartner.pdf" => "Planar Graph Coloring with an Uncooperative Partner",
        "Papers/93-DM-FracDimension.pdf" => "On the fractional dimension of partially ordered sets",
        "Papers/94-ORD-DimensionSubordersBoolLattice.pdf" => "The Dimension of Suborders of the Boolean Lattice",
        "Papers/96-DM-AlphaSeq.pdf" => "Colorings of diagrams of interval orders and &alpha;-sequences of sets",
        "Papers/97-ORD-BalancingPairsCrossProduct.pdf" => "Balancing Pairs and the Cross Product Conjecture",
        "Papers/98-Hbk-PartiallyOrderedSets.pdf" => "Partially Ordered Sets",
        "Papers/101-SIAM-DimPlanarMaps.pdf" => "The Order Dimension of Planar Maps",
        "Papers/105-CPC-WTTandPW.pdf" => "Ramsey Theory and Sequences of Random Variables",
        "Papers/106-ORD-GeomSurvey.pdf" => "Geometric Containment Orders: A Survey",
        "Papers/108-DM-Sphere3d.pdf" => "Finite three dimensional partial orders which are not sphere orders",
        "Papers/109-DM-MaxEdge.pdf" => "The maximum number of edges in a graph of bounded dimension, with applications to ring theory",
        "Papers/112-ORD-DimColor.pdf" => "Dimension, Graph and Hypergraph Coloring",
        "Papers/117-DM-Correlation.pdf" => "A combinatorial approach to correlation inequalities",
        "Papers/118-JGT-Posetspg.pdf" => "Posets and Planar Graphs",
        "Papers/120-SegmentOrders.pdf" => "Segment Orders",
        "Papers/121-IntervalPartitionsStanleyDepth.pdf" => "Interval partitions and Stanley depth",
        "Papers/123-AdjacencyPosets.pdf" => "Adjacency posets of planar graphs",
        "Papers/124-DM-MaxChains.pdf" => "On the size of maximal antichains and the number of pairwise disjoint maximal chains",
        "Papers/126-DM-OnLineDimension.pdf" => "On-line Dimension for Posets Excluding Two Long Incomparable Chains",
        "Papers/127-OL-LinearDiscrepancy-Galleys.pdf" => "Online Linear Discrepancy of Partially Ordered Sets",
    ),
);

function video_exists($name_, $id_)
{
    global $days;

    if (($name_ != "lec") && ($name_ != "ex"))
        return false;
    
    if (!isset($days[$id_]))
        return false;

    return file_exists(dirname(__FILE__) . "/videos/" . $name_ . $id_ . ".mp4");
}

if (isset($_GET["id"]))
    $id = $_GET["id"];
else
    $id = "";

if (isset($_GET["name"]))
    $name = $_GET["name"];
else
    $name = "main";

if ((($name == "lec") || ($name == "ex")) && !video_exists($name, $id))
    $name = "main";

if (!in_array($name, array("main", "downloads", "videos", "lec", "ex")))
    $name = "main";

if (isset($_GET["seek"]))
    $noseek = ($_GET["seek"] == "no");
else
    $noseek = false;

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Posets @ TCS</title>
<link rel="shortcut icon" href="static/poset-icon.png"/> 
<script type="text/javascript" src="static/flowplayer-3.2.6.min.js"></script>
<style type="text/css">

body{
  margin:0;
  padding:0;
  line-height: 1.5em;
  font-family: arial;
}

b{font-size: 110%;}
em{color: red;}

a, a:hover {
  color: #0677BB;
}

#topsection{
  background: #56B3E6;
  background-image: url("static/sprites-horizontal.png");
  background-repeat: repeat-x;
  height: 110px; /*Height of the top section*/
  color: #FFF;
  border-bottom: 1px solid #000;
  font-family: monospace;
}

#logo{
  float: right;
  padding: 5px;
}

#topsection h1{
  margin: 0;
  padding-top: 15px;
}

#contentcolumn{
  padding-top: 16px;
  text-align: center;
}

#leftcolumn{
  width: 150px; /*Width of the left column*/
  margin-right: 10px;
  min-height: 600px;
  padding-top: 10px;
  color: #0677BB;
}

#leftcolumn ul {
  padding-left: 2em;
}

#leftcolumn h3 {
  margin: 0px;
  padding: 2px 0px;
}

.menubigger {
  font-weight: bold;
}

.menusmaller {
  padding-left: 10px;
  font-size: 90%;
}

.menuindented {
  padding-left: 10px;
}

.innertube{
  margin: 10px; /*Margins for inner DIV inside each column (to provide padding)*/
  margin-top: 0;
}

#roomstab{
  padding: 35px 5px;
}

#roomstab th, td{
  padding-left: 5px;
  padding-right: 5px;
}

#attachements {
  text-align: left;
}

#videos {
  text-align: left;
}

#videos h4 {
  margin-bottom: 0;
}

#videos ul {
  margin-top: 0;
  margin-bottom: 0;
}

table th {
  text-align: left;
}

#maintable {
  width: 100%;
}

</style>
</head>
<body>

  <div id="topsection">
    <div class="innertube">
      <img src="static/tcslogo.png" id="logo"></img>
      <h1>Partially ordered sets</h1>
      <h2>Methods and challenges</h2>
    </div>
  </div>

  <table id="maintable">
    <tr>
      <td id="leftcolumn" valign="top">
        <div class="innertube">
          <span class="menubigger">Menu</span><br/>
          <span class="menuindented"><a href="?name=main">Info</a></span><br/>
          <span class="menuindented"><a href="?name=downloads">Downloads</a></span><br/>
          <span class="menuindented"><a href="?name=videos">Video list</a></span><br/>
          <br/>
<?php foreach ($days as $id_ => $date_): ?>
            <span class="menubigger"><?= $date_ ?></span>
            <br/>
            <span class="menusmaller">
<?php     if (video_exists("lec", $id_)): ?>
              <a href="?name=lec&id=<?= $id_ ?>">lecture</a>
<?php     else: ?>
              lecture
<?php     endif; ?>
<?php     if (video_exists("ex", $id_)): ?>
              <a href="?name=ex&id=<?= $id_ ?>">exercices</a>
<?php     else: ?>
              exercises
<?php     endif; ?>
            </span>
            <br/>
<?php endforeach; ?>
        </div>
      </td>
      <td id="contentcolumn" valign="top">
        <div class="innertube">
<?php if ($name == "main"): ?>
    This site contains videos of <i>Partially orderdered sets</i> course by <b>William T. Trotter</b>.<br> 
    Course will run from May 17 to June 10 (from Tuesday to Friday). Lectures start at 10:15 and exercises at 14:15.<br>
    <table id="roomstab">
      <tr>
        <th>Day</th><th>Lecture room</th><th>Exercise room</th>
      </tr>
      <tr>
        <td>Tuesday</td><td>0083</td><td>0083</td>
      </tr>
      <tr>
        <td>Wednesday</td><td>0083</td><td>1083</td>
      </tr>
      <tr>
        <td>Thursday</td><td>1083</td><td>1086</td>
      </tr>
      <tr>
        <td>Friday</td><td>0086</td><td>0174</td>
      </tr>
    </table>
    <div id="attachements">
        <a href="attachements/poster.pdf">Poster (PDF)</a>
    </div>
<?php endif; ?>
<?php if ($name == "downloads"): ?>
    <div id="attachements">
<?php foreach ($attachements as $category_name => $category_contents): ?>
      <h3><?= $category_name ?>:</h3>
      <ul>
<?php     foreach ($category_contents as $name_ => $value_): ?>
        <li><a href="attachements/<?= $name_ ?>"><?= $value_?></a></li>
<?php     endforeach; ?>
      </ul>
<?php endforeach; ?>
    </div>
<?php endif; ?>
<?php if ($name == "videos"): ?>
    <div id="videos">
<?php foreach ($days as $id_ => $date_): ?>
            <h4><?= $date_ ?></h4>
            <ul>

              <li>
<?php     if (video_exists("lec", $id_)): ?>
                <a href="?name=lec&id=<?= $id_ ?>">Lecture</a>
<?php     else: ?>
                Lecture
<?php     endif; ?>
<?php     if (isset($lectures[$id_])): ?>
                : <?= $lectures[$id_]?>
<?php     endif; ?>
              </li>

              <li>
<?php     if (video_exists("ex", $id_)): ?>
                <a href="?name=ex&id=<?= $id_ ?>">Exercises</a>
<?php     else: ?>
                Exercises
<?php     endif; ?>
<?php     if (isset($exercises[$id_])): ?>
                : <?= $exercises[$id_]?>
<?php     endif; ?>
              </li>

            </ul>
<?php endforeach; ?>
    </div>
<?php endif; ?>
<?php if (($name == "lec") || ($name == "ex")): ?>
          <div class="flowplayerwrapper" align="center">
            <video width="960" height="540" controls>
                <source src="videos/<?= $name ?><?= $id ?>.mp4">
            </video>
          </div>
<?php endif; ?>
        </div>
      </td>
  </tr>
</table>
</body>
</html>
