本文整理汇总了PHP中news::getUpcoming方法的典型用法代码示例。如果您正苦于以下问题:PHP news::getUpcoming方法的具体用法?PHP news::getUpcoming怎么用?PHP news::getUpcoming使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类news
的用法示例。
在下文中一共展示了news::getUpcoming方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drawUpcoming
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'>→ 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"] . " " . $ch["av_lastname"];
}
$stdout .= " <p class='noindent'><em>Coordinators</em>: " . implode(", ", $chair) . "</p>";
}
$stdout .= " <div class='clear social-footer' style=''>\r\n" . news::drawIconsSocialMedia() . " </div>\r\n" . "";
// }
}
}
}
}
$stdout .= "</div>\r\n";
// -----------------------------------------------------------
return $stdout;
}
示例2: OutputRssPage
//.........这里部分代码省略.........
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("&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;
}