本文整理汇总了PHP中functions::readableDateInterval方法的典型用法代码示例。如果您正苦于以下问题:PHP functions::readableDateInterval方法的具体用法?PHP functions::readableDateInterval怎么用?PHP functions::readableDateInterval使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类functions
的用法示例。
在下文中一共展示了functions::readableDateInterval方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEventsRegistrationDates
public static function getEventsRegistrationDates($regshift = 8)
{
$allevents = self::getEventByYear("all");
$today = date("Y-m-d");
$eventdata = array();
foreach ($allevents as $ae) {
foreach ($ae as $d => $confId) {
if ($today < $d) {
$e = self::getOneEvent($confId);
list($Yr, $Ym, $Yd) = explode("-", $e["startdate"]);
$prefregend = strtotime("-" . $regshift . " weeks", mktime(0, 0, 0, $Ym, $Yd, $Yr));
$c = array();
if (isset($e["chairs"]) && is_array($e["chairs"])) {
foreach ($e["chairs"] as $ch) {
if (!empty($ch["av_email"])) {
$c[] = $ch["av_email"];
}
}
}
$eventdata[$d] = array("id" => $e["id"], "title" => $e["title"], "subpath" => $e["subpath"], "eventperiod" => $e["period"], "regopen" => $e["regstart"] != $e["regend"] ? 1 : 0, "regstart" => $e["regstart"], "regend" => $e["regend"], "regperiod" => functions::readableDateInterval($e["regstart"], $e["regend"]), "prefregend" => date("j F Y", $prefregend), "regendwrong" => date("Y-m-d", $prefregend) < $e["regend"] ? 1 : 0, "attenders" => isset($e["attenders"]) && $e["attenders"] ? $e["attenders"] : 0, "chairs" => implode(",", $c));
}
}
}
ksort($eventdata);
return $eventdata;
}
示例2: getAlumniArrayData
public static function getAlumniArrayData()
{
$userarray = array();
// --------------------
// DETERMINE SOURCE OF PEOPLE DATA
// --> $GLOBALS["peopleClass"]
// --------------------
self::loadClass("ea");
// ---------------------------------------------------------------------------
// SELECT APPROPRIATE SQL QUERY
// If $searchVariant='user', only the record for user $u is selected.
// --> $sql
// ---------------------------------------------------------------------------
$sql = $GLOBALS["peopleClass"]->getSqlForEmployment();
// --------------------
// OBTAIN DATA FROM DATABASE
// --> $userarray
// --------------------
$countryCodeArray = functions::countryCodeArray();
$result = $GLOBALS["peopleClass"]->query($sql);
if ($GLOBALS["peopleClass"]->num_rows($result) > 0) {
while ($rec = $GLOBALS["peopleClass"]->next_record_assoc($result)) {
if (!empty($rec["lm_option"])) {
$options = @unserialize(stripslashes($rec["lm_option"]));
if ($options) {
$rec = @array_merge($rec, $options);
}
}
if (!empty($rec["av_id"])) {
$udata = array();
// -----------------------------------
$udata["nw_firstname"] = isset($rec["av_firstname"]) ? $rec["av_firstname"] : "";
$udata["nw_lastname"] = isset($rec["av_lastname"]) ? $rec["av_lastname"] : "";
$udata["nw_fullname"] = str_replace(" ", " ", str_replace("-", "‑", $udata["nw_firstname"])) . " " . str_replace(" ", " ", str_replace("-", "‑", $udata["nw_lastname"]));
$udata["nw_fullname_reverse"] = str_replace(" ", " ", preg_replace("/" . (!empty($rec["av_von"]) ? $rec["av_von"] . "\\s*" : "") . "/i", "", str_replace("-", "‑", $udata["nw_lastname"]))) . ", " . str_replace(" ", " ", str_replace("-", "‑", $udata["nw_firstname"])) . (!empty($rec["av_von"]) ? " " . $rec["av_von"] : "");
$udata["nw_fullname_reverse_sortable"] = strtolower(functions::strip_accents($udata["nw_fullname_reverse"]));
$udata["nw_user"] = functions::dotName($udata["nw_fullname"]);
if (self::getSpecialDotname($udata["nw_user"])) {
$udata["nw_user"] = self::getSpecialDotname($udata["nw_user"]);
}
$udata["nw_current_institute"] = $rec["av_institute"];
$udata["nw_current_email"] = functions::obscurify_email($rec["av_email"]);
$udata["nw_deceased"] = !empty($rec["av_ddate"]) ? 1 : 0;
// -----------------------------------
// COLLECT DATA FROM OTHER SOURCES, IF NEEDED
// -----------------------------------
include PATH_DATA . "/adhoc_people_data.php";
// -----------------------------------
// SPECIAL EMPLOYMENT-RELATED FIELDS
// -----------------------------------
$em = array();
$em["nw_employment_status"] = $rec["um_status"];
$em["nw_employment_title"] = $rec["lm_value"];
$em["nw_employment_fromdate"] = $rec["lm_key"];
$em["nw_employment_todate"] = $rec["lm_status"];
if ($rec["lm_status"] <= date("Y-m-d")) {
$em["nw_employment_date"] = functions::readableDateInterval($rec["lm_key"], $rec["lm_status"]);
$em["nw_employment_current"] = 0;
} else {
$em["nw_employment_date"] = functions::readableDate($rec["lm_key"]) . " — ";
$em["nw_employment_current"] = 1;
}
$em["nw_employment_inst"] = isset($options["e_inst"]) ? $options["e_inst"] : "";
if (isset($options["e_org"])) {
switch ($options["e_org"]) {
case MYPEAR_ORGID_NORDITA:
$em["nw_employment_inst"] = "Nordita";
$em["nw_employment_country"] = $em["nw_employment_fromdate"] >= date("2007-01-01") || in_array($rec["user"], array("yb", "brandenb", "jifalt", "uw", "divecchi")) ? "SE" : "DK";
break;
case MYPEAR_ORGID_FYSIKUM:
$em["nw_employment_inst"] = "Stockholm University";
$em["nw_employment_country"] = "SE";
break;
case MYPEAR_ORGID_ALBANOVA:
$em["nw_employment_inst"] = "AlbaNova";
$em["nw_employment_country"] = "SE";
break;
case MYPEAR_ORGID_KTH:
$em["nw_employment_inst"] = "KTH Royal Institute of Technology";
$em["nw_employment_country"] = "SE";
break;
case MYPEAR_ORGID_OKC:
$em["nw_employment_inst"] = "Oskar Klein Center";
$em["nw_employment_country"] = "SE";
break;
}
}
if (empty($em["nw_employment_country"])) {
$em["nw_employment_country"] = isset($options["e_cc"]) ? $options["e_cc"] : "";
}
if (isset($options["e_cc"]) && ($k = array_search($options["e_cc"], $countryCodeArray))) {
$em["nw_employment_country"] = $k;
}
$em["nw_employment_isnordic"] = functions::fromCountryCodeTo("continentcode", $em["nw_employment_country"], 1, 0, 0) == "NO" ? 1 : 0;
if (!empty($em["nw_employment_title"])) {
$em["nw_employment_type"] = self::getEmploymentTypeFromTitle($em["nw_employment_title"]);
} elseif (!empty($options["e_rate"])) {
$em["nw_employment_type"] = $options["e_rate"];
} elseif (!empty($udata["nw_employeeType"])) {
$em["nw_employment_type"] = $udata["nw_employeeType"];
//.........这里部分代码省略.........
示例3: 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;
}
示例4: OutputSeminarsNextweek
//.........这里部分代码省略.........
$sel["ical"] = empty($dayevent["id"]) && !isset($dayevent["parent_id"]) ? "" : AGENDA_URI . "/conferenceDisplay.py/ical?confId=" . $dayevent["id"];
$talks_selection[$day][$dayevent["starttime"] . ":" . str_pad(rand(0, 999), 3, "0", STR_PAD_LEFT)] = $sel;
/*
} // end if
*/
}
// end foreach
}
}
// end foreach
}
// end if
ksort($talks_selection);
foreach (array_keys($talks_selection) as $key) {
ksort($talks_selection[$key]);
}
// ----------------------
// -- Output data
// ----------------------
$stdout .= " <p class='only_online'>" . "[" . ($GLOBALS["w"] == 0 ? "<a href='" . $_SERVER["PHP_SELF"] . "?w=1' class='bold' rel='nofollow'>This Week</a>" : "This Week") . "]" . " " . "[" . ($GLOBALS["w"] == 1 ? "<a href='" . $_SERVER["PHP_SELF"] . "?w=0' class='bold' rel='nofollow'>Next Week</a>" : "Next Week") . "]" . "</p>\r\n" . "\r\n" . "<pre class='box letter'>\r\n" . "Dear Norditans,\r\n" . "\r\n" . "-------------\r\n\r\n";
if (count($visits)) {
$visitortext = "";
foreach ($visits as $type) {
if (isset($type["Visitors"])) {
foreach ($type["Visitors"] as $v) {
$visitortext .= "*" . $v["name"] . "*\r\n" . " " . $v["affiliation"] . "\r\n" . " " . $v["dates"] . "\r\n" . "\r\n";
}
}
}
$stdout .= ($GLOBALS["w"] == 0 ? "Next" : "This") . " week, Nordita welcomes these guests:\r\n" . "\r\n" . $visitortext . "-------------\r\n\r\n";
}
/* "*MONDAY, __________ 2011*
12:30- Nordita West Seminar Room (122:026)
ASTRO-PH LUNCH MEETING
http://wiki.nordita.org/index.php/Astro-ph_Meeting
" . */
if (empty($talks_selection) && empty($events)) {
$stdout .= "Nothing of theoretical interest will happen " . ($GLOBALS["w"] == 0 ? "next" : "this") . " week!\r\n" . "-------------\r\n\r\n";
} else {
if (!empty($events)) {
$stdout .= "Major Nordita Events " . ($GLOBALS["w"] == 0 ? "next" : "this") . " week:\r\n\r\n";
foreach ($events as $key => $ev) {
$stdout .= " During the week, the " . str_replace("nordita", "Nordita", $ev["eventtype"]) . "\r\n" . " "" . strtoupper($ev["title"]) . ""\r\n" . " " . ($sunday < $ev["start"] ? "starts on " . functions::readableDateInterval($ev["start"], $ev["start"]) : "continues") . ", and will continue until " . functions::readableDateInterval($ev["end"], $ev["end"]) . ".\r\n";
if (!empty($ev["subpath"])) {
$stdout .= " " . URL_PREFIX . "/" . $ev["subpath"] . "\r\n";
} elseif (!empty($ev["id"])) {
$stdout .= " http://agenda.albanova.se/conferenceDisplay.py?confId=" . $ev["id"] . "\r\n";
}
$stdout .= "\r\n";
}
$stdout .= "-------------\r\n\r\n";
}
if (!empty($talks_selection)) {
$stdout .= "Here are some of the seminars at Nordita and AlbaNova " . ($GLOBALS["w"] == 0 ? "next" : "this") . " week:\r\n\r\n";
foreach ($talks_selection as $day => $record) {
$stdout .= "*" . strtoupper(date("l, j F Y", strtotime($day))) . "*\r\n\r\n";
foreach ($record as $start => $dayevent) {
if (count($dayevent)) {
if (in_array(strtolower($dayevent["eventtype"]), array("nordita program", "program", "conference", "workshop", "meeting", "school"))) {
$stdout .= " " . ucfirst($dayevent["eventtype"]) . "\r\n" . " " . $dayevent["period"] . "\r\n" . "\r\n";
} else {
$stdout .= " " . (!empty($dayevent["period"]) ? $dayevent["period"] : "") . (!empty($dayevent["room"]) ? " " . $dayevent["room"] : "") . "\r\n" . (!empty($dayevent["heading"]) ? " " . strtoupper($dayevent["heading"]) . "\r\n" : "") . (!empty($dayevent["thespeaker"]) ? " " . $dayevent["thespeaker"] . "\r\n" : "") . (!empty($dayevent["title"]) ? " " . $dayevent["title"] . "\r\n" : "") . (!empty($dayevent["url"]) ? " Info: " . $dayevent["url"] . "\r\n" : "") . (!empty($dayevent["ical"]) ? " Add to calendar: " . $dayevent["ical"] . "\r\n" : "") . "\r\n";
}
}
}
// end if
}
// end foreach
$stdout .= "-------------\r\n\r\n";
}
}
// end if (empty($talks_selection))
// ---------------------- move to suitable class!
$dbWiki = new fromdb_nwwiki();
$dbWiki->get_text("Cake");
$txt = $dbWiki->wikipage_text["text"];
preg_match_all("~<td>([^<]*)</td>[^<].*<td>([^<]*)</td>~mU", $txt, $res);
foreach ($res[1] as $ix => $v) {
$cake[strtotime($v)] = $res[2][$ix];
}
$delta = $GLOBALS["w"] == 0 ? 8 : 1;
$monday = date("Y-m-d", time() - 3600 + ($delta - date("w", time() - 3600)) * 86400);
$m = strtotime($monday);
$nextm = $m + 604800;
$stdout .= "*MONDAY CAKE, " . strtoupper(functions::readableDateInterval($monday, $monday)) . "*\r\n";
//functions::readableDateInterval($monday,$monday) .
if (isset($cake[$m]) && strlen($cake[$m]) > 5) {
$stdout .= " Cakemaster this week is " . $cake[$m] . ".\r\n";
} else {
$stdout .= " No cakemaster appointed!\r\n";
}
if (isset($cake[$nextm]) && strlen($cake[$nextm]) > 5) {
$stdout .= " (Cakemaster on " . date("l, F jS", $nextm) . " the following week, will be " . $cake[$nextm] . ".)\r\n";
}
$stdout .= " " . URL_PREFIX . "/cake\r\n";
// ----------------------
return str_replace("()", "", $stdout) . "</pre>";
}
示例5: calculateVisitors
private static function calculateVisitors($personData, $yearfrom = VM_START_YEAR, $yearto = "", $mindays = 1)
{
if (empty($yearto)) {
$yearto = date("Y");
}
if ($yearfrom > $yearto) {
$yearfrom = VM_START_YEAR;
$yearto = date("Y");
}
$visits = array();
foreach ($personData as $data) {
$yearVisitStart = date("Y", $data["visit_start"]);
$yearVisitEnd = date("Y", $data["visit_end"]);
if ($yearVisitStart <= $yearto && $yearfrom <= $yearVisitEnd) {
if ($yearVisitStart < $yearfrom) {
$yearVisitStart = $yearfrom;
$data["visit_start"] = mktime(0, 0, 0, 1, 1, $yearfrom);
}
if ($yearto < $yearVisitEnd) {
$yearVisitEnd = $yearto;
$data["visit_end"] = mktime(0, 0, 0, 12, 31, $yearto);
}
$thisApp = array();
// some ad hoc exclusions
if ($data["firstname"] . " " . $data["lastname"] == 'Larus Thorlacius') {
continue;
}
if ($data["firstname"] . " " . $data["lastname"] == 'Troels Harmark') {
continue;
}
if ($data["firstname"] . " " . $data["lastname"] == 'John Hertz') {
continue;
}
if ($data["firstname"] . " " . $data["lastname"] == 'Dhrubaditya Mitra') {
if (date("Y", $data["visit_start"]) > 2008) {
continue;
}
$data["res"] = 'in';
$data["nordic"] = 0;
}
$name = $data["firstname"] . " " . $data["lastname"];
if (!isset($visits[$name])) {
$visits[$name]["country"] = !empty($data["res"]) ? strtolower($data["res"]) : "";
$visits[$name]["totdays"] = 0;
$visits[$name]["institute"] = $data["institute"];
}
$visits[$name]["interval"][] = functions::readableDateInterval(date("Y-m-d", $data["visit_start"]), date("Y-m-d", $data["visit_end"]), true);
$days = functions::date_diff_workaround(date("Y-m-d", $data["visit_start"]), date("Y-m-d", $data["visit_end"]));
if (!$days) {
$days = 1;
}
// count only nights, but if visitors arrives and leaves the same day, count as one:
$visits[$name]["totdays"] = $visits[$name]["totdays"] + $days;
$visits[$name]["days"][] = $days;
}
}
// end foreach
foreach ($visits as $name => $data) {
if ($data["totdays"] < $mindays) {
unset($visits[$name]);
}
}
return $visits;
}
示例6: outputRoomsEditorList
public static function outputRoomsEditorList()
{
$stdout = $update = "";
$allevents = $unallocatedevents = array();
// --------------------------------
// -- Obtain data
// --------------------------------
$allConfids = false;
//TODO:
/*
$allConfids = functions::callMethod('fromdb_nwevents','fromdb/nwevents','getAgendaConferenceIdsForNorditaEvents','','1');
*/
if (!is_array($allConfids) || empty($allConfids)) {
return BLURB_SORRY_NO_EVENTS;
}
//TODO: use exception instead
foreach ($allConfids as $confId) {
$event = false;
//TODO:
/*
$event = functions::callMethod('fromdb_nwevents','fromdb/nwevents','getOneEvent',$confId,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE);
*/
if (!empty($event)) {
if (!empty($event["from"]) && substr($event["startdate"], -5) != "01-01") {
$allevents[$event["from"]] = $event;
} elseif (!empty($event["id"])) {
$event["from"] = 0;
$unallocatedevents[$event["id"]] = $event;
}
}
}
// end foreach
krsort($allevents);
krsort($unallocatedevents);
$allevents = array_merge($unallocatedevents, $allevents);
// --------------------------------
// -- Output data
// --------------------------------
$stdout .= " <p class='largefont'><strong>Select Event to be Edited Below</strong> or " . "<strong><a href='" . $_SERVER["PHP_SELF"] . "?menulookup=1'>Recreate 'menulookup' cache</a></strong></p>\r\n" . " <p style='margin-bottom:2em'><strong>[Edit]</strong> = edit manually kept fields in nw_events DB;<br><strong>[Update]</strong> = update Agenda fields in nw_events DB from Agenda DB;<br><strong>[Delete]</strong> = delete record from nw_events DB</p>\r\n";
$stdout .= "<table style='border-top:2px solid black;border-bottom:2px solid black'>\r\n";
$currentyear = "";
foreach ($allevents as $thisevent) {
if ($thisevent["from"]) {
$year = date("Y", $thisevent["from"]);
if ($year != $currentyear) {
$currentyear = $year;
$stdout .= " <tr>\r\n" . " <th colspan='7' style='border:1px solid black;padding:0.2em 1em;background-color:#eee'>" . $currentyear . "</th>\r\n" . " </tr>\r\n";
}
$period = functions::readableDateInterval($thisevent["start"], $thisevent["end"], TRUE);
$update = "<a href='" . $_SERVER["PHP_SELF"] . "?c=" . urlencode($thisevent["id"]) . "&u=1'>[Update]</a>";
} else {
$period = "(<em>Dates missing</em>)";
$update = "";
}
$title = functions::truncateStringByWord($thisevent["title"], 50);
if ($thisevent["title"] != $title) {
$title .= "...";
}
$img = !empty($thisevent["subpath"]) && file_exists(INCLEVEL . PATH_EVENTLOGOS . "/" . $thisevent["subpath"] . ".png") ? "<img src='" . PATH_EVENTLOGOS . "/" . $thisevent["subpath"] . ".png' alt='' style='width:10px;height:10px;border:1px solid black'>" : "";
$stdout .= " <tr>\r\n" . " <td style='padding-right:0.5em'>" . $img . "</td>\r\n" . " <td style='padding-right:0.5em' class='bold' title='" . $thisevent["subpath"] . "'>" . $title . "</td>\r\n" . " <td style='padding-right:0.5em'>" . $thisevent["eventtype"] . "</td>\r\n" . " <td style='padding-right:0.5em'>" . $period . "</td>\r\n" . " <td style='padding-right:0.5em' class='bold'>" . "<a href='" . $_SERVER["PHP_SELF"] . "?c=" . urlencode($thisevent["id"]) . "&e=1'>[Edit]</a></td>\r\n" . " <td style='padding-right:0.5em' class='bold'>" . $update . "</td>\r\n" . " <td style='padding-right:0.5em' class='bold'>" . "[Delete]</td>\r\n" . " </tr>\r\n";
}
$stdout .= "</table>\r\n";
// --------------------------------
return $stdout;
}
示例7: adaptRawUserArray
//.........这里部分代码省略.........
if (!empty($udata["e_gid"])) {
$gridtmp = explode(",", $udata["e_gid"]);
unset($grid);
unset($gid);
foreach ($gridtmp as $k => $v) {
$v = trim($v);
if ($v == "grund") {
$v = "adm";
}
if ($v == "admin") {
$v = "adm";
}
$gid[] = $v;
if (isset($this->researchGroups[$v])) {
$grid[] = $this->researchGroups[$v];
}
}
$udata["nw_group"] = isset($grid) && is_array($grid) ? implode("; ", $grid) : "";
$udata["nw_groupShort"] = str_replace("Statistical ", "Stat. ", str_replace("Condensed ", "Cond. ", $udata["nw_group"]));
$udata["nw_gid"] = is_array($gid) ? implode(",", $gid) : "";
$udata["nw_gid"] = preg_replace("/^,/", "", preg_replace("/,\$/", "", str_replace(",,", ",", str_replace("kof", "", str_replace("BIO", "CM", str_replace("MA", "SA", str_replace("NP", "SA", str_replace("HP", "SA", $udata["nw_gid"]))))))));
}
// -----------------------------------
// -- Rename field nw_employmentStart
// -- Rename field nw_employmentEnd
// -- Create field nw_employmentPeriod
// -----------------------------------
$udata["nw_employmentStart"] = isset($udata["lm_key"]) ? $udata["lm_key"] : "";
$udata["nw_employmentEnd"] = isset($udata["lm_status"]) ? $udata["lm_status"] : "";
// In maildb: "norPeriodOfStay"
if ($udata["nw_employmentEnd"] > date("Y-m-d", mktime(0, 0, 0, 1, 1, date("Y") + 15))) {
$udata["nw_employmentEnd"] = "";
}
$udata["nw_employmentPeriod"] = functions::readableDateInterval($udata["nw_employmentStart"], $udata["nw_employmentEnd"], 1);
// -----------------------------------
// -- Create field nw_status
// -----------------------------------
// In maildb: "status"
//TODO:
$udata["nw_status"] = date("Y-m-d") <= $udata["nw_employmentEnd"] || empty($udata["nw_employmentEnd"]) ? "Active" : "Passive";
// -----------------------------------
// -- Rename field nw_employeeTitle
// -----------------------------------
$udata["nw_employeeTitle"] = mb_strtolower($udata["lm_value"]);
// In maildb: "employeeTitle"
// Also in ea: "av_salutation"
// 'lm_data' can be of the form "professor / professor emeritus", concatenating all
// positions held by the user at Nordita over time.
if (preg_match("#/\\S*([^/]*\\S*em[ei]rit[aus]*)\\S*/?#i", $udata["nw_employeeTitle"], $res)) {
$udata["nw_employeeTitle"] = trim($res[1]);
}
$udata["nw_employeeTitle"] = preg_replace("#deputy director / professor#", "professor, deputy director", $udata["nw_employeeTitle"]);
$udata["nw_employeeTitle"] = preg_replace("#visiting professor,professor#", "visiting professor", $udata["nw_employeeTitle"]);
$udata["nw_employeeTitle"] = preg_replace("#phd student,associate phd student#", "associate phd student", $udata["nw_employeeTitle"]);
if (strpos($udata["nw_employeeTitle"], "/") !== false) {
$tmp = explode("/", $udata["nw_employeeTitle"]);
$udata["nw_employeeTitle"] = trim(array_pop($tmp));
}
// Cleanup of some exact string matches
if ($udata["nw_employeeTitle"] == "fellow") {
$udata["nw_employeeTitle"] = "nordita fellow";
} elseif (in_array($udata["nw_employeeTitle"], array("vice director", "deputy director"))) {
$udata["nw_employeeTitle"] = "professor, deputy director";
} elseif ($udata["nw_employeeTitle"] == "director") {
$udata["nw_employeeTitle"] = "professor, director";
}
示例8: OutputMyTravels
public static function OutputMyTravels()
{
$stdout = "";
$stdout = "<h1 class='red'>[UNDER DEVELOPMENT]</h1><br><br>\r\n";
self::loadClass();
functions::gpc_declare_input("user", "divecchi@nbi.dk", false);
functions::gpc_declare_input("fullname", "", false);
// ------------------------------------
$stdout .= "<form method='post' action='" . $_SERVER["PHP_SELF"] . "'>\r\n" . " <p>Please enter your username: <input type='text' name='user'" . (!empty($GLOBALS["user"]) ? " value='" . $GLOBALS["user"] . "'" : "") . ">\r\n" . " <input type='submit' name='doit' value='Go'></p>\r\n" . "</form>\r\n" . PADDED_HR;
if (!empty($GLOBALS["user"])) {
// $data = $GLOBALS["travelClass"]->getMyTravels("",$GLOBALS["fullname"]);
$data = $GLOBALS["travelClass"]->getMyTravels($GLOBALS["user"]);
if (empty($data)) {
return $stdout . "<p class='box error background padding'>No travels found " . "for user '<strong>" . $GLOBALS["user"] . "</strong>'</p>\r\n";
}
// "for '<strong>" . $GLOBALS["fullname"] . "</strong>'</p>\r\n";
// $stdout .= "<h3>Travels for '" . $GLOBALS["fullname"] . "'</h3>\r\n";
$stdout .= "<h3>Travels for user '" . $GLOBALS["user"] . "'</h3>\r\n";
foreach ($data as $rec) {
if (date("Y", $rec["from"]) >= 2000) {
$stdout .= "<p><strong>" . functions::readableDateInterval($rec["from"], $rec["to"]) . "</strong> " . "<br>" . $rec["destination"] . (!empty($rec["info"]) ? "<br><em>" . str_replace("\\\\\\\\\\\\\\'", "'", $rec["info"]) . "</em>" : "") . "</p>";
}
}
}
// ------------------------------------
return $stdout;
}