Beispiel #1
0
 public static function drawUpcoming($issue_id)
 {
     $stdout = "";
     $stdout .= "<h2 class='bottommargin'>UPCOMING SCIENTIFIC EVENTS</h2>\r\n" . "<p style='margin-bottom:2em' class='only_online'>&rarr; See List of all Nordita Events: <a href='science/events/index.php' rel='nofollow'><strong>www.nordita.org/events</strong></a></p>\r\n";
     // -----------------------------------------------------------
     // -- Obtain data
     // -----------------------------------------------------------
     $events = news::getUpcoming($issue_id, 1);
     // 1 = no subheadings
     if (!is_array($events)) {
         return $stdout . $events;
     }
     // -----------------------------------------------------------
     // -- Output data
     // -----------------------------------------------------------
     $stdout .= "<div class='upcomingevents'>\r\n";
     foreach (array("", self::$labelP, self::$labelC) as $label) {
         if (isset($events[$label])) {
             $stdout .= "<h3>" . $label . "</h3>\r\n";
             foreach ($events[$label] as $arr) {
                 foreach ($arr as $ev) {
                     //        if (isset($eventarraybypath[$path])) {
                     $stdout .= "<p id='" . $ev["subpath"] . "'><img src='" . PATH_EVENTLOGOS . "/" . $ev["subpath"] . ".png' alt=''></p>\r\n" . "  <h4 style='margin-bottom:-1em'><a href='" . $ev["subpath"] . "/index.php'>" . $ev["title"] . "</a></h4>\r\n" . "  <p><em>" . ucfirst($ev["eventtype"]) . "</em></p>\r\n" . "  <p><strong>" . $ev["period"] . "</strong></p>\r\n" . "  <p>" . $ev["blurb"] . "</p>\r\n";
                     if (isset($ev["chairs"]) && is_array($ev["chairs"])) {
                         $chair = array();
                         foreach ($ev["chairs"] as $ch) {
                             $chair[] = $ch["av_firstname"] . "&nbsp;" . $ch["av_lastname"];
                         }
                         $stdout .= "  <p class='noindent'><em>Coordinators</em>:&nbsp; " . implode(", ", $chair) . "</p>";
                     }
                     $stdout .= "  <div class='clear social-footer' style=''>\r\n" . news::drawIconsSocialMedia() . "  </div>\r\n" . "";
                     //        }
                 }
             }
         }
     }
     $stdout .= "</div>\r\n";
     // -----------------------------------------------------------
     return $stdout;
 }
Beispiel #2
0
 public static function OutputRssPage($feedpathid)
 {
     $stdout = "";
     if (!isset($GLOBALS["newsClass"])) {
         if (!class_exists("fromdb_nwnews", FALSE)) {
             require_once PATH_CLASSES . "/fromdb/nwnews.php";
         }
         $GLOBALS["newsClass"] = new fromdb_nwnews();
     }
     if (!class_exists("news", FALSE)) {
         require_once PATH_CLASSES . "/lib/news.php";
     }
     $numberOfItemsToKeep = 10;
     $channelTitle = "Nordita News";
     $channelPath = PATH_NEWS . "/";
     $channelDescription = "Scientific and other news from Nordita, the Nordic Institute for Theoretical Physics in Stockholm, Sweden";
     $channelCreator = "Nordita";
     switch ($feedpathid) {
         case NEWS_ALLSECTIONS:
             //$issueId = 0; // 0 = all issues
             $issueId = $GLOBALS["newsClass"]->getCurrentIssueId();
             $numberOfItemsToKeep = 25;
             //$channelTitle = "";
             $channelPath = PATH_NEWS . "/feature/";
             //$channelDescription: "";
             break;
         case NEWS_FEATURE:
             $issueId = 0;
             // 0 = all issues
             $numberOfItemsToKeep = 5;
             $channelTitle = "A Glimpse into the World of Theoretical Physics";
             $channelPath = PATH_NEWS . "/feature/";
             //$channelDescription: "";
             break;
         case NEWS_NORDIC:
             $issueId = 0;
             // 0 = all issues
             //$numberOfItemsToKeep = 5;
             $channelTitle = "Recent Science News from the Nordic Countries";
             $channelPath = PATH_NEWS . "/nordic/";
             //$channelDescription: "";
             break;
         case NEWS_INSTITUTE:
             $issueId = 0;
             // 0 = all issues
             $numberOfItemsToKeep = 50;
             $channelTitle = "Nordita - News from the Institute";
             $channelPath = PATH_NEWS . "/institute/";
             //$channelDescription: "";
             break;
         case NEWS_UPCOMING:
             //$issueId = 0; // 0 = all issues
             $issueId = $GLOBALS["newsClass"]->getCurrentIssueId();
             //$numberOfItemsToKeep = 5;
             $channelTitle = "Upcoming Scientific Events at Nordita";
             $channelPath = PATH_NEWS . "/upcoming/";
             //$channelDescription: "";
             break;
             /* News from file OBSOLETE; keep for reference
                   case NEWS_FROMFILE:
                     //$issueId = 0; // 0 = all issues
                     $issueId = $GLOBALS["newsClass"]->getCurrentIssueId();
                     //$numberOfItemsToKeep = 5;
                     //$channelTitle = "";
                     $channelPath = "news/";
                     //$channelDescription: "";
                     break;
             */
     }
     // end switch
     // ---------------------
     $feeditems = array();
     $number = 0;
     /* News from file OBSOLETE; keep for reference
         if ($feedpathid==NEWS_FROMFILE) {
     
           $feeddata = $GLOBALS["newsClass"]->getNewsFromFile();
     
           if (is_array($feeddata) && !empty($feeddata)) {
             foreach ($feeddata as $date => $arr) {
               foreach ($arr as $key => $data) {
                 if ($number<$numberOfItemsToKeep) {
                   $data["date"] = $date;
                   $feeditems[$date."-".str_pad($key+1,2,"0", STR_PAD_LEFT)] = $data;
                 }
                 $number++;
               }
             }
           }
     
         } else {
     */
     if (1) {
         $feeddata = $GLOBALS["newsClass"]->getArticle(NEWS_PUBLISHED, 0, $feedpathid, $issueId);
         if ($feedpathid == NEWS_NORDIC) {
             $feeddata = array_merge($feeddata, $GLOBALS["newsClass"]->getArticle(NEWS_PUBLISHED, 0, NEWS_NORDIC_INBRIEF, $issueId));
         }
         if (is_array($feeddata) && !empty($feeddata)) {
             foreach ($feeddata as $data) {
                 if ($number < $numberOfItemsToKeep) {
                     if (!empty($data["date_written"])) {
                         $date = $data["date_written"];
                     } elseif (!empty($data["issue_date_published"]) && preg_match("/^(\\S*) .*/", $data["issue_date_published"], $res)) {
                         $date = $res[1];
                     } else {
                         $date = date("Y-m-d");
                     }
                     if (!isset($data["category"])) {
                         $data["category"] = array();
                     }
                     $text = preg_replace("#<p class='caption'>.*</p>#imU", "", htmlspecialchars_decode($data["text"]));
                     $text = news::brieftext($data["text"], 250);
                     // NB: this does not display in all feed readers:
                     if (!empty($data["cover_image"])) {
                         $text = "<img src='" . URL_PREFIX . "/" . $data["cover_image"] . "'" . " height='75' align='left' hspace='10'" . "> " . $text . "<br clear='all'>";
                     }
                     $feeditems[$data["article_id"]] = array("cat" => $data["category"], "title" => ($data["section_id"] == NEWS_FEATURE ? "Nordita News Feature - " : "") . (in_array($data["section_id"], array(NEWS_NORDIC, NEWS_NORDIC_INBRIEF)) ? "Nordic Physics News - " : "") . ($data["section_id"] == NEWS_INSTITUTE ? "News from Nordita - " : "") . htmlspecialchars_decode(str_replace("&amp;quot;", "\"", $data["title"])), "text" => $text, "date" => $date);
                     /* -- not properly debugged
                        if (!empty($data["cover_image"])) {
                          $feeditems[$data["article_id"]]["image"] = "".URL_PREFIX."/" . $data["cover_image"];
                        } */
                     $number++;
                 }
             }
         }
     }
     // end if
     if (in_array($feedpathid, array(NEWS_UPCOMING, NEWS_ALLSECTIONS))) {
         $feeddata = news::getUpcoming($issueId);
         if (is_array($feeddata) && !empty($feeddata)) {
             foreach ($feeddata as $section => $arr) {
                 foreach ($arr as $timestamp => $ar) {
                     foreach ($ar as $key => $data) {
                         if ($number < $numberOfItemsToKeep) {
                             $feeditems[$data["subpath"]] = array("cat" => array(ucfirst($data["eventtype"])), "title" => ($feedpathid == NEWS_ALLSECTIONS ? "Upcoming Nordita Event - " : "") . (!empty($data["eventtype"]) ? ucfirst($data["eventtype"]) . ": " : "") . $data["title"], "text" => "[" . functions::readableDateInterval($data["startdate"], $data["enddate"], 1) . "] " . news::brieftext($data["blurb"], 250), "date" => $data["startdate"]);
                         }
                         $number++;
                     }
                 }
             }
         }
     }
     //TODO: item urls, either as fragment or new page
     // ---------------------
     //$feedname = array_pop(explode("/",$channelPath));
     $feedchannel = array("stylesheetFile" => "", "channelTitle" => $channelTitle, "channelDescription" => $channelDescription, "channelCreator" => $channelCreator);
     $stdout .= feed::outputFeed($feedchannel, $feeditems, $issueId ? 0 : 1);
     // ---------------------
     return $stdout;
 }