Exemple #1
0
 public static function outputEventListSingle($thisevent, $class = "event-box", $subclass = "", $showCoordinators = FALSE, $compactOutput = FALSE, $showBlurb = TRUE, $plaintextUrl = FALSE)
 {
     if (empty($thisevent)) {
         return "";
     }
     $stdout = "";
     $agendapageisopen = isset($thisevent["agendapageisopen"]) && $thisevent["agendapageisopen"] ? TRUE : FALSE;
     // -----------------------------------
     // -- Front Pages
     // -----------------------------------
     if ($GLOBALS["documentClass"]->isIndexPage()) {
         return (!empty($image) ? "              <p>" . $image . "</p>\r\n" : "") . "              <h4>" . (empty($thisevent["subpath"]) ? $thisevent["title"] : "<a href='events/" . $thisevent["subpath"] . "/index.php' rel='nofollow'>" . $thisevent["title"] . "</a>") . "</h4>\r\n" . "              <p><strong>" . functions::shortMonthNames($thisevent["period"]) . "</strong></p>\r\n" . ($showBlurb && !empty($thisevent["blurb"]) ? "              <p>" . $thisevent["blurb"] . "</p>\r\n" : "");
     }
     // end if is indexpage
     // -----------------------------------
     // -- Initiate pieces
     // -----------------------------------
     $output_eventname = "            <h4>" . (empty($thisevent["subpath"]) || !$agendapageisopen ? $thisevent["title"] : "<a href='events/" . $thisevent["subpath"] . "/index.php' rel='nofollow'>" . $thisevent["title"] . "</a>") . "</h4>\r\n";
     $image = !empty($thisevent["image"]) && is_file(INCLEVEL . $thisevent["image"]) ? "<img src='" . $thisevent["image"] . "' alt=''>" : "<img src='" . PATH_EVENTLOGOS . "/blank_103x103.png' alt=''>";
     $output_image = (!$compactOutput || $plaintextUrl) && !empty($image) ? "              <p class='img'>" . (empty($thisevent["subpath"]) ? $image : "<a href='events/" . $thisevent["subpath"] . "/index.php' rel='nofollow'>" . $image . "</a>") . "</p>\r\n" : "";
     if (!$compactOutput && $agendapageisopen) {
         $output_eventurl = "                <p>" . "<a href='events/" . $thisevent["subpath"] . "/' rel='nofollow'>" . "<span style='font-weight:normal'>www.nordita.org/</span>" . $thisevent["subpath"] . "</a>" . "</p>\r\n";
     } else {
         $output_eventurl = "                <p class='eventurl'><em>URL</em>: " . "www.nordita.org/<strong>" . $thisevent["subpath"] . "</strong></p>\r\n";
     }
     $output_eventtype = !empty($thisevent["eventtype"]) ? "                <p class='eventtype'>" . ucfirst($thisevent["eventtype"]) . "</p>\r\n" : "";
     $output_dates = "                <p class='dates'>" . $thisevent["period"] . "</p>\r\n";
     $output_blurb = "              <p class='blurb'>" . ($showBlurb && !empty($thisevent["blurb"]) ? $thisevent["blurb"] : "&nbsp;") . "</p>\r\n";
     $output_venue = !empty($thisevent["venue"]) ? "                <p class='eventvenue'><em>Venue:</em> " . ucfirst($thisevent["venue"]) . "</p>\r\n" : "";
     $output_coordinators = "";
     if ($showCoordinators && isset($thisevent["chairs"]) && is_array($thisevent["chairs"])) {
         $output_coordinators .= $thisevent["eventtype"] == "course" ? "                <p class='coordinators'><em>Teachers:</em> " : "                <p class='coordinators'><em>Coordinators:</em> ";
         $coord = array();
         foreach ($thisevent["chairs"] as $ch) {
             $coord[strtolower($ch["av_lastname"] . $ch["av_firstname"] . rand(0, 100))] = $ch["av_firstname"] . " " . $ch["av_lastname"];
         }
         ksort($coord);
         $output_coordinators .= implode(", ", $coord) . "</p>\r\n";
     }
     $output_timetable = !$compactOutput && $thisevent["id"] != "4393" && isset($thisevent["timetableexists"]) && !empty($thisevent["timetableexists"]) ? "                <p class='timetable'>" . "<a href='timetables/index.php?confid=" . $thisevent["id"] . "' rel='nofollow'>" . "Timetable</a></p>\r\n" : "";
     $posterArray = event::getPosterArray();
     $output_poster = !$compactOutput && isset($posterArray[$thisevent["subpath"]]) && isset($posterArray[$thisevent["subpath"]]["file"]) ? "                <p class='timetable'>" . "<a href='docs/posters/" . $posterArray[$thisevent["subpath"]]["file"] . "' rel='nofollow'>" . "Poster</a></p>\r\n" : "";
     $output_videos = !$compactOutput && isset($thisevent["videos"]) && !empty($thisevent["videos"]) ? "                <p class='timetable'>" . "<a href='" . $thisevent["videos"] . "' rel='nofollow'>" . "Videos from talks</a></p>\r\n" : "";
     //TODO: restore after checking!
     //TODO: perhaps simplify with glob() ?
     $output_photos = "";
     $pth = "events/" . $thisevent["subpath"] . "/photos_participants";
     if (!$compactOutput && is_file(INCLEVEL . $pth . "/index.php") && is_dir(INCLEVEL . $pth . "/images")) {
         $dir = scandir(INCLEVEL . $pth . "/images");
         reset($dir);
         $pc = FALSE;
         while ((list($k, $v) = each($dir)) && !$pc) {
             $pc = preg_match("/^[\\w{].*\\.[pngjpeg]{3,4}/i", $v) ? TRUE : FALSE;
         }
         if ($pc) {
             $output_photos .= "                <p class='photos'><a href='" . $pth . "/index.php' rel='nofollow'>" . "Photos of the participants</a></p>\r\n";
         }
     }
     // -----------------------------------
     // -- Output whole list
     // -----------------------------------
     if ($compactOutput) {
         if ($plaintextUrl) {
             $stdout .= "<table>\r\n" . "  <tr>\r\n" . "    <td style='padding-right:1em'>\r\n" . $output_image . "    </td>\r\n" . "    <td>\r\n";
         }
         $stdout .= $output_eventname . "            <div class='event-compact'>\r\n" . $output_eventtype . $output_dates . $output_venue . $output_eventurl . $output_coordinators . "            </div>\r\n";
         if ($plaintextUrl) {
             $stdout .= "    </td>\r\n" . "  </tr>\r\n" . "</table>\r\n";
         }
         $stdout .= "\r\n";
     } else {
         $stdout .= "          <div" . (!empty($class) ? " class='" . $class . "'" : "") . ">\r\n" . $output_eventname . "            <div" . (!empty($subclass) ? " class='" . $subclass . "'" : "") . ">\r\n" . $output_image . "              <div class='baseinfo'>\r\n" . $output_eventtype . $output_dates . $output_venue . $output_coordinators . $output_timetable . $output_eventurl . $output_poster . $output_photos . $output_videos . "              </div>\r\n" . $output_blurb . "            </div>\r\n" . "          </div>\r\n" . "\r\n";
     }
     return $stdout;
 }