Пример #1
0
 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
0
 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(" ", "&nbsp;", str_replace("-", "&#8209;", $udata["nw_firstname"])) . "&nbsp;" . str_replace(" ", "&nbsp;", str_replace("-", "&#8209;", $udata["nw_lastname"]));
                 $udata["nw_fullname_reverse"] = str_replace(" ", "&nbsp;", preg_replace("/" . (!empty($rec["av_von"]) ? $rec["av_von"] . "\\s*" : "") . "/i", "", str_replace("-", "&#8209;", $udata["nw_lastname"]))) . ",&nbsp;" . str_replace(" ", "&nbsp;", str_replace("-", "&#8209;", $udata["nw_firstname"])) . (!empty($rec["av_von"]) ? "&nbsp;" . $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"]) . " &#8212;&nbsp;";
                     $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"];
                 } else {
                     $em["nw_employment_type"] = "";
                 }
                 //TODO: often inconclusive
                 $em["nw_employment_gid"] = isset($options["e_gid"]) ? $options["e_gid"] : "";
                 if (stripos($em["nw_employment_inst"], "nordita") !== FALSE && stripos($em["nw_employment_title"], "board") === FALSE) {
                     $em["nw_employment_isnorditaemployment"] = 1;
                 } else {
                     $em["nw_employment_isnorditaemployment"] = 0;
                 }
                 // -----------------------------------
                 $key = $udata["nw_fullname_reverse_sortable"];
                 if (empty($udata["nw_fullname_reverse_sortable"])) {
                     $key = $udata["av_id"];
                 }
                 if (!isset($userarray[$key])) {
                     $userarray[$key] = $udata;
                 }
                 $userarray[$key]["employment"][$em["nw_employment_fromdate"] . "-" . $rec["lm_id"]] = $em;
                 // -----------------------------------
                 if ($em["nw_employment_isnorditaemployment"]) {
                     $userarray[$key]["nw_isnorditaalumn"] = 1;
                     if ($em["nw_employment_current"]) {
                         $userarray[$key]["nw_current_isnorditastaff"] = 1;
                     }
                 }
                 if (0 && IS_TESTSERVER) {
                     echo "<hr>" . $udata["nw_fullname"];
                     echo "<br>Current: " . $udata["nw_current_institute"];
                     foreach ($userarray[$key]["employment"] as $e) {
                         if ($e["nw_employment_current"]) {
                             echo "<br>* " . $e["nw_employment_title"] . ", " . $e["nw_employment_inst"];
                         }
                     }
                     echo "<br>TYPE = " . $e["nw_employment_type"];
                     echo "<br>GUESS: " . self::getEmploymentTypeFromTitle($em["nw_employment_title"]);
                     debug::rr($rec);
                     debug::rr($options);
                     debug::rr($em);
                     debug::rr($udata);
                 }
             }
             // end if
         }
     }
     // end while $rec
     ksort($userarray);
     foreach ($userarray as $key => $udata) {
         $ct = $cc = array();
         $ci = explode(",", $userarray[$key]["nw_current_institute"]);
         $userarray[$key]["nw_current_isnordic"] = 0;
         $userarray[$key]["nw_isnorditaalumn"] = 0;
         if (!isset($udata["nw_current_isnorditastaff"])) {
             $userarray[$key]["nw_current_isnorditastaff"] = 0;
         }
         foreach ($udata["employment"] as $item) {
             if ($item["nw_employment_current"] && stripos($item["nw_employment_title"], "board") === FALSE) {
                 foreach (explode(",", $item["nw_employment_inst"]) as $ins) {
                     if (!empty($ins) && array_search(trim($ins), $ci) === false) {
                         $ci[] = $ins;
                     }
                 }
                 $ct[] = $item["nw_employment_title"];
                 $cc[] = $item["nw_employment_country"];
                 if ($item["nw_employment_isnordic"]) {
                     $userarray[$key]["nw_current_isnordic"] = 1;
                 }
             }
             if ($item["nw_employment_isnorditaemployment"]) {
                 $userarray[$key]["nw_isnorditaalumn"] = 1;
             }
         }
         $userarray[$key]["nw_current_title"] = implode(", ", array_unique($ct));
         $userarray[$key]["nw_current_institute"] = implode(", ", array_unique($ci));
         $userarray[$key]["nw_current_country"] = implode(", ", array_unique($cc));
         $e = $udata["employment"];
         ksort($e);
         $userarray[$key]["nw_nordita_employment"] = $e;
         unset($userarray[$key]["employment"]);
         if ($udata["nw_deceased"]) {
             $userarray[$key]["nw_current_institute"] = "";
             $userarray[$key]["nw_current_email"] = "";
             $userarray[$key]["nw_current_isnordic"] = "";
             $userarray[$key]["nw_current_isnorditastaff"] = "";
             $userarray[$key]["nw_current_title"] = "";
             $userarray[$key]["nw_current_country"] = "";
         }
     }
     // end foreach
     // --------------------
     if (0 && IS_TESTSERVER) {
         debug::rr($userarray);
     }
     return $userarray;
 }
Пример #3
0
 public function getEventsRegistrationDates($regshift = 8)
 {
     $sql = "SELECT " . " V.*, " . "  e_code," . "  e_name," . "  e_start," . "  e_end," . "  e_reg_start," . "  e_reg_end " . "FROM " . "  abs_visits AS V " . "  LEFT JOIN abs_events AS E ON E.e_code=SUBSTRING(V.v_code,1,4) " . "WHERE " . "  (V.v_status <> 'STATUS_NO') " . "ORDER BY " . "  e_start DESC";
     $res = $this->query($sql, IS_TESTSERVER);
     // includes a call to connect
     $eventlist = array();
     if ($this->num_rows($res)) {
         while ($e = $this->next_record_assoc($res)) {
             if (!empty($e["e_start"]) && !in_array($e["e_code"], event::$badEvents)) {
                 $prefregend = strtotime("-" . $regshift . " weeks", $e["e_start"]);
                 $eventlist[date("Y-m-d", $e["e_start"])] = array("id" => $e["e_code"], "title" => $e["e_name"], "subpath" => "", "eventperiod" => "", "regopen" => $e["e_reg_start"] != $e["e_reg_end"] ? 1 : 0, "regstart" => date("Y-m-d", $e["e_reg_start"]), "regend" => date("Y-m-d", $e["e_reg_end"]), "regperiod" => functions::readableDateInterval(date("Y-m-d", $e["e_reg_start"]), date("Y-m-d", $e["e_reg_end"])), "prefregend" => date("j F Y", $prefregend), "regendwrong" => $prefregend < $e["e_reg_end"] ? 1 : 0, "attenders" => "", "chairs" => "");
             }
         }
         // end while
     }
     ksort($eventlist);
     return $eventlist;
 }
Пример #4
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;
 }
Пример #5
0
 public function getEventsRegistrationDates($regshift = REGISTRATION_SHIFT, $sortByRegend = FALSE)
 {
     if (!OK_TO_CALL_EVENTS) {
         $eventdataArray = functions::callMethod('fromdb_agenda', 'fromdb/agenda', 'getEventsRegistrationDates', $regshift);
         $tmp = array();
         if ($GLOBALS["sort"]) {
             foreach ($eventdataArray as $item) {
                 if (!empty($item["regend"])) {
                     $tmp[$item["regend"]][] = $item;
                 }
             }
             $eventdataArray = array();
             foreach ($tmp as $regend => $items) {
                 foreach ($items as $key => $item) {
                     $eventdataArray[$regend . "-" . $key] = $item;
                 }
             }
             krsort($eventdataArray);
         }
         foreach ($eventdataArray as $key => $value) {
             $eventdata[$key][] = $value;
         }
         return $eventdata;
     }
     // ---------------------------
     $list = array();
     if (!is_numeric($regshift) || empty($regshift)) {
         $regshift = REGISTRATION_SHIFT;
     }
     $sql = "SELECT " . "  E.event_id, " . "  E.title, " . "  E.eventtype, " . "  E.subpath, " . "  E.start, " . "  E.end, " . "  E.regstart, " . "  E.regend, " . "  E.attenders, " . "  GROUP_CONCAT(DISTINCT P.av_email SEPARATOR ', ') AS 'organizer_mail' " . "FROM " . "  event AS E " . "  LEFT JOIN person as P on E.event_id=P.event_id " . "WHERE " . "  (NOT ISNULL(start)) AND " . "  (UNIX_TIMESTAMP() < UNIX_TIMESTAMP(start)) AND " . "  (P.person_type='organizer') " . "GROUP BY " . "  P.event_id " . "";
     $res = $this->query($sql, IS_TESTSERVER);
     // includes a call to connect
     if ($this->num_rows($res)) {
         while ($r = $this->next_record_assoc($res)) {
             if (!empty($r["start"])) {
                 list($startdate, $starttime) = explode(" ", $r["start"]);
                 list($enddate, $endtime) = explode(" ", $r["end"]);
                 $eventtype = array_search($r["eventtype"], event::$eventTypeId);
                 $prefregend = strtotime("-" . $regshift . " weeks", strtotime($startdate));
                 $orderby = $sortByRegend ? $r["regend"] : $startdate;
                 $list[$orderby][] = array("id" => $r["event_id"], "title" => $r["title"], "subpath" => $r["subpath"], "eventperiod" => functions::readableDateInterval($startdate, $enddate), "regopen" => $r["regstart"] != $r["regend"] ? 1 : 0, "regstart" => $r["regstart"], "regend" => $r["regend"], "regperiod" => functions::readableDateInterval($r["regstart"], $r["regend"]), "prefregend" => date("j F Y", $prefregend), "regendwrong" => $prefregend < strtotime($r["regend"]) ? 1 : 0, "attenders" => isset($r["attenders"]) && $r["attenders"] ? $r["attenders"] : 0, "chairs" => $r["organizer_mail"]);
             }
         }
         // end while
         ksort($list);
     }
     return $list;
 }
Пример #6
0
 public static function OutputSeminarsNextweek($w = 0)
 {
     $stdout = "";
     $talks_selection = $events = $colloquium = $visits = $contributions = $seminars = $talks = array();
     functions::gpc_declare_input("w", $w, true);
     $delta = $GLOBALS["w"] == 0 ? 7 : 0;
     $saturday1 = date("Y-m-d", time() - 3600 + ($delta - 1 + date("w", time() - 3600)) * 86400);
     $sunday = date("Y-m-d", time() - 3600 + ($delta - date("w", time() - 3600)) * 86400);
     $saturday2 = date("Y-m-d", time() - 3600 + ($delta + 7 - date("w", time() - 3600)) * 86400);
     $agenda_timespan = $GLOBALS["w"] == 0 ? "nextweek" : "thisweek";
     // ----------------------
     // Obtain data from VM DB: records for visitors outside events
     // ----------------------
     $visits = functions::callMethod('fromdb_vm', 'fromdb/vm', 'getArrivingVisitors', "extweek", $GLOBALS["w"]);
     // 'extweek' = extended week
     // ----------------------
     // Obtain data from Agenda DB: seminars and colloquium
     // ----------------------
     //@@@ -- VERKAR OK -- in OutputSeminarsNextweek() -- calls getTalkRecordsSeminars+getTalkRecordsColloquium
     // ----------------------
     // Obtain data from nw_events DB: programs and other events, and talks inside these events
     // ----------------------
     $events = functions::callMethod('fromdb_nwevents', 'fromdb/nwevents', 'getEventsInPeriod', $agenda_timespan);
     $seminars = functions::callMethod('fromdb_nwevents', 'fromdb/nwevents', 'getTalkRecordsSeminars', $agenda_timespan);
     $colloquium = functions::callMethod('fromdb_nwevents', 'fromdb/nwevents', 'getTalkRecordsColloquium', $agenda_timespan);
     $contributions = functions::callMethod('fromdb_nwevents', 'fromdb/nwevents', 'getEventContributionsInPeriod', $agenda_timespan);
     // ----------------------
     // Postparsing of seminars data records --> array $talks_selection[]
     // ----------------------
     //    $seminars = self::mergeTalkRecords($seminars,$colloquium);
     //    $talks = self::mergeTalkRecords($seminars,$contributions);
     $talks = self::mergeTalkRecords($colloquium, self::mergeTalkRecords($seminars, $contributions));
     if (isset($talks) && count($talks)) {
         foreach ($talks as $day => $dayevents) {
             if (count($dayevents)) {
                 foreach ($dayevents as $categoryId => $dayevent) {
                     // $dayevent["id"|"end"|"title"]
                     /*
                               if (isset($dayevent["eventtype"])
                                   && in_array(strtolower($dayevent["eventtype"]),
                                      array("nordita program","program","conference","workshop","meeting","school"))
                                  ) {
                     
                                 // -- Nordita event(s)
                     //doesn't seem to work...
                                 $talks_selection[0][] = array(
                                   "title"      => trim($dayevent["title"]),
                                   "eventtype"  => $dayevent["eventtype"],
                                   "startdate"  => $dayevent["startdate"],
                                   "enddate"    => $dayevent["enddate"],
                                   "subpath"    => $dayevent["subpath"],
                                   "id"         => $dayevent["id"],
                                   "categoryid" => $dayevent["categoryid"]
                                 );
                                 unset($talks[$day][$categoryId]);
                     
                               } else {
                     */
                     // -- Seminars
                     unset($sel);
                     if (isset($dayevent["title"])) {
                         $dayevent["title"] = trim($dayevent["title"]);
                     }
                     $sel["heading"] = "";
                     if (isset($dayevent["eventtitle"])) {
                         $sel["heading"] = "Event Talk" . (!empty($dayevent["eventtitle"]) ? " (" . $dayevent["eventtitle"] . ")" : "");
                     }
                     if (isset($dayevent["categoryid"])) {
                         include PATH_DATA . "/agenda_fids.php";
                         // -> $fids[]
                         if (isset($fids)) {
                             if (in_array($dayevent["categoryid"], array_keys($fids["colloquium"]))) {
                                 // -- AN COLLOQUIUM
                                 $sel["heading"] = "The AlbaNova Colloquium";
                             } else {
                                 // -- SEMINARS
                                 foreach ($fids as $group => $farray) {
                                     foreach ($farray as $categoryid => $label) {
                                         if ($categoryid == $dayevent["categoryid"] && (preg_match("/^Seminar\\S*\\s*(.*)\$/i", $label, $res) || preg_match("/^Group meeting\\S*\\s*(.*)\$/i", $label, $res)) && !empty($res[1])) {
                                             $sel["heading"] = $res[1];
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     $sel["eventtype"] = isset($dayevent["eventtype"]) ? ucfirst($dayevent["eventtype"]) : "";
                     $sel["period"] = ucfirst($dayevent["period"]);
                     $sel["period"] = $dayevent["starttime"] . (!empty($dayevent["endtime"]) ? "&#8212;" . $dayevent["endtime"] : "");
                     $sel["room"] = isset($dayevent["room"]) ? ucfirst($dayevent["room"]) : "";
                     $sel["title"] = "&quot;" . $dayevent["title"] . "&quot;";
                     $sel["title"] = str_replace("<span class='agenda-programtalk'><span>Event Talk</span></span> ", "", $sel["title"]);
                     //if (isset($dayevent["url"]) && (strpos($dayevent["url"],"contribId")!==false)) $programtalk = "[Program Talk] ";
                     $seltmp = array();
                     if (isset($dayevent["speakers"])) {
                         foreach ($dayevent["speakers"] as $speaker) {
                             $tmp = (!empty($speaker["nw_fullname"]) ? $speaker["nw_fullname"] . " " : "") . (!empty($speaker["av_institute"]) ? "(" . $speaker["av_institute"] . ")" : "");
                             $seltmp[] = trim($tmp);
                         }
                     }
                     $sel["thespeaker"] = implode(", ", $seltmp);
                     $sel["url"] = empty($dayevent["id"]) ? "" : AGENDA_URI . "/" . (isset($dayevent["parent_id"]) ? "contributionDisplay.py?contribId=" . $dayevent["id"] . "&amp;confId=" . $dayevent["parent_id"] : "conferenceDisplay.py?confId=" . $dayevent["id"]);
                     $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") . "]" . "&nbsp;&nbsp;" . "[" . ($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" . "  &quot;" . strtoupper($ev["title"]) . "&quot;\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>";
 }
Пример #7
0
 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;
 }
Пример #8
0
 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> &nbsp; or &nbsp; " . "<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;
 }
Пример #9
0
 function adaptRawUserArray($userarray = array(), $status = "active")
 {
     if (empty($userarray)) {
         return array();
     }
     // ------------------------------------------
     // MASSAGE DATA IN ARRAY $userarray
     // ------------------------------------------
     //if (IS_TESTSERVER) debug::rr($userarray);
     foreach ($userarray as $usr => $udata) {
         // -----------------------------------
         // -- Not every user has a value for these fields:
         // -----------------------------------
         foreach (array("e_gid", "e_inst", "e_off", "e_org", "e_rate", "e_type") as $key) {
             if (!isset($udata[$key])) {
                 $udata[$key] = "";
             }
         }
         // -----------------------------------
         // -- Rename field nw_firstname
         // -- Rename field nw_lastname
         // -----------------------------------
         // nw_firstname in maildb: "name"
         // nw_lastname in maildb: "namefam"
         $udata["nw_firstname"] = isset($udata["av_firstname"]) ? $udata["av_firstname"] : "";
         $udata["nw_lastname"] = isset($udata["av_lastname"]) ? $udata["av_lastname"] : "";
         // -----------------------------------
         // -- Create field nw_namevon = von
         // -- Create field nw_vonnamefam = von lastname
         // -- Create field nw_fullname = firstname von lastname
         // -- Create field nw_fullname_break = firstname<br>von lastname
         // -- Create field nw_fullname_reverse = lastname, firstname von
         // -- Create field nw_dotname = firstname.von.lastname
         // -----------------------------------
         // nw_namevon in maildb: "von"
         $udata["nw_namevon"] = $udata["av_von"];
         $udata["nw_vonnamefam"] = trim($udata["av_von"] . " " . $udata["nw_lastname"]);
         $udata["nw_fullname"] = str_replace(" ", "&nbsp;", str_replace("-", "&#8209;", $udata["nw_firstname"])) . "&nbsp;" . (!empty($udata["av_von"]) ? $udata["av_von"] . "&nbsp;" : "") . str_replace(" ", "&nbsp;", str_replace("-", "&#8209;", $udata["nw_lastname"]));
         $udata["nw_fullname_break"] = str_replace(" ", "&nbsp;", str_replace("-", "&#8209;", $udata["nw_firstname"])) . "<br>" . (!empty($udata["av_von"]) ? $udata["av_von"] . " " : "") . str_replace(" ", "&nbsp;", str_replace("-", "&#8209;", $udata["nw_lastname"]));
         $udata["nw_fullname_reverse"] = str_replace(" ", "&nbsp;", preg_replace("/" . (!empty($udata["nw_namevon"]) ? $udata["nw_namevon"] . "\\s*" : "") . "/i", "", str_replace("-", "&#8209;", $udata["nw_lastname"]))) . ",&nbsp;" . str_replace(" ", "&nbsp;", str_replace("-", "&#8209;", $udata["nw_firstname"])) . (!empty($udata["nw_namevon"]) ? "&nbsp;" . $udata["nw_namevon"] : "");
         $udata["nw_fullname_reverse_sortable"] = strtolower(functions::strip_accents($udata["nw_fullname_reverse"]));
         $udata["nw_dotname"] = functions::dotName($udata["nw_fullname"]);
         if (functions::callMethod('people', 'lib/people', 'getSpecialDotname', $udata["nw_dotname"])) {
             $udata["nw_dotname"] = functions::callMethod('people', 'lib/people', 'getSpecialDotname', $udata["nw_dotname"]);
         }
         // -----------------------------------
         // -- Rename field nw_user
         // -----------------------------------
         // In maildb: "user"
         // NB. Can't use field 'av_identity' since it is a comma-separated list of
         //     various usernames of unknown origin
         $udata["nw_user"] = $udata["nw_dotname"];
         // -----------------------------------
         // -- Rename field nw_id_ea
         // -- Rename field nw_id_maildb
         // -----------------------------------
         // ID in maildb: "m_id"
         // ID in ea:     "av_id"
         $udata["nw_id_ea"] = isset($udata["av_id"]) ? $udata["av_id"] : "";
         $udata["nw_id_maildb"] = isset($udata["m_id"]) ? $udata["m_id"] : "";
         // -----------------------------------
         // -- Rename field nw_localinstitute
         // -----------------------------------
         // In maildb: "institution"
         //TODO: 'av_institute' not reliable!
         $udata["nw_localinstitute"] = isset($udata["av_institute"]) ? strtolower($udata["av_institute"]) : "";
         $ins = explode(",", $udata["nw_localinstitute"]);
         $insAll = array();
         foreach ($ins as $item) {
             switch ($item) {
                 case "nordita":
                     $insAll[] = "NOR";
                     break;
                 case "fysikum":
                     $insAll[] = "FKM";
                     break;
                 case "albanova":
                     $insAll[] = "ALB";
                     break;
                 case "vetenskapens hus":
                 case "vetenskapenshus":
                     $insAll[] = "VH";
                     break;
             }
         }
         $udata["nw_localinstitute"] = join(",", $insAll);
         // -----------------------------------
         // -- Rename field nw_institute
         // -----------------------------------
         // In maildb: ~"institution"
         $udata["nw_institute"] = isset($udata["av_institute"]) ? ucfirst($udata["av_institute"]) : "";
         // -----------------------------------
         // -- Rename field nw_ssn
         // -----------------------------------
         // In maildb: "pers_number"
         $udata["nw_ssn"] = isset($udata["av_ssn"]) ? $udata["av_ssn"] : "";
         // -----------------------------------
         // -- Rename field nw_birthdate
         // -- Create field nw_birthday
         // -----------------------------------
         // NB: 'av_birthdate' is a timestamp, 'nw_birthdate' is a date YYYY-MM-DD
         if (!empty($udata["av_birthdate"]) && abs($udata["av_birthdate"]) > date("Y")) {
             // must be a timestamp, not a year
             $udata["nw_birthdate"] = date("Y-m-d", $udata["av_birthdate"]);
         } elseif (!empty($udata["nw_ssn"]) && preg_match("/^(\\d\\d)(\\d\\d)(\\d\\d)/", $udata["nw_ssn"], $pn) && $pn[1] != "00") {
             $udata["nw_birthdate"] = ($pn[1] > date("y") + 10 ? "19" : "20") . $pn[1] . "-" . $pn[2] . "-" . $pn[3];
         } else {
             $udata["nw_birthdate"] = "";
         }
         // In maildb: N/A
         $udata["nw_birthday"] = !empty($udata["nw_birthdate"]) && ($t = strtotime($udata["nw_birthdate"])) ? date("m-d", $t) : "";
         // -----------------------------------
         // -- Rename field nw_office
         // -----------------------------------
         // In maildb: "office"
         $udata["nw_office"] = isset($udata["e_off"]) ? $udata["e_off"] : "";
         // -----------------------------------
         // -- Create field nw_leaveofabsence, nw_notyetarrived
         //    (call after nw_office)
         // -----------------------------------
         if (!isset($udata["nw_leaveofabsence"])) {
             $udata["nw_leaveofabsence"] = "";
             if (strpos(mb_strtolower($udata["nw_office"]), "leave of absence") !== false || strpos(mb_strtolower($udata["nw_office"]), "on leave") !== false) {
                 $udata["nw_leaveofabsence"] = "On leave of absence";
             } elseif (strpos($udata["nw_office"], "from") !== false || strpos($udata["nw_office"], "Arrives") !== false || strpos($udata["nw_office"], "arrives") !== false) {
                 $udata["nw_leaveofabsence"] = $udata["nw_notyetarrived"] = $udata["nw_office"];
             }
         }
         if (!empty($udata["nw_leaveofabsence"])) {
             $udata["nw_office"] = "";
         }
         // -----------------------------------
         // -- Create field nw_acc_kth
         // -- Create field nw_acc_su
         // -- Create field nw_acc_nbi
         // -- Create field nw_acc_maildb
         // -----------------------------------
         $udata["nw_acc_kth"] = isset($udata["acc_kth"]) ? $udata["acc_kth"] : "";
         // In maildb: "acc_kth"
         $udata["nw_acc_su"] = isset($udata["acc_su"]) ? $udata["acc_su"] : "";
         // In maildb: "acc_su"
         $udata["nw_acc_nbi"] = !empty($udata["maildrop"]) && preg_match("/([^@]*)\\@(.*).dk/", $udata["maildrop"], $res) ? $res[1] : "";
         //	  $udata["nw_acc_nbi"] = (isset($udata["acc_nbi"])) ? $udata["acc_nbi"] : "";
         //      $udata["nw_acc_nbi"] = (!empty($udata["av_email"]) // Use "av_email" and "av_email2", not "nw_email"
         //                              && preg_match("/^(.+)@nbi.dk$/i",$udata["av_email"],$nbi))
         //		? $nbi[1]
         //		: "";
         // In maildb: "cmt" and "maildrop"
         $udata["nw_acc_maildb"] = isset($udata["user"]) ? $udata["user"] : "";
         //	  $udata["nw_acc_maildb"] = (isset($udata["av_identity"])) ? $udata["av_identity"] : "";
         // In maildb: "user"
         // -----------------------------------
         // -- Rename field nw_phone
         // -- Create field nw_extension
         // -- Create field nw_phone_linked
         //    (call after nw_notyetarrived)
         // -----------------------------------
         $udata["nw_phone"] = isset($udata["av_phone"]) ? $udata["av_phone"] : "";
         // In maildb: "phone"
         $udata["nw_extension"] = "";
         if ($udata["nw_phone"] == "0000") {
             $udata["nw_phone"] = "";
         } else {
             $udata["nw_phone"] = preg_replace("/ (..) (..)/", " \\1\\2", $udata["nw_phone"]);
             $udata["nw_phone"] = trim(str_replace("&nbsp;", " ", $udata["nw_phone"]));
             if (strlen($udata["nw_phone"]) == 4) {
                 $udata["nw_extension"] = $udata["nw_phone"];
                 $udata["nw_phone"] = "+46&nbsp;8&nbsp;5537&nbsp;<strong>" . $udata["nw_phone"] . "</strong>";
             } elseif (preg_match("/46[\\D]*8[\\D]*5537[\\D]*(\\d\\d\\d\\d)/", $udata["nw_phone"], $res)) {
                 $udata["nw_extension"] = $res[1];
                 $udata["nw_phone"] = "+46&nbsp;8&nbsp;5537&nbsp;<strong>" . $res[1] . "</strong>";
             } elseif (preg_match("/46[\\D]*8[\\D]*16[\\D]*(\\d\\d\\d\\d)/", $udata["nw_phone"], $res)) {
                 $udata["nw_extension"] = $res[1];
                 $udata["nw_phone"] = "+46&nbsp;8&nbsp;16&nbsp;<strong>" . $res[1] . "</strong>";
             } elseif (preg_match("/46[\\D]*8[\\D]*674[\\D]*(\\d\\d\\d\\d)/", $udata["nw_phone"], $res)) {
                 $udata["nw_extension"] = $res[1];
                 $udata["nw_phone"] = "+46&nbsp;8&nbsp;674&nbsp;<strong>" . $res[1] . "</strong>";
             }
             $udata["nw_phone"] = str_replace(" ", "&nbsp;", $udata["nw_phone"]);
         }
         $phonestring = substr($udata["nw_phone"], 0, 1) == "+" ? str_replace("&nbsp;", "", str_replace(" ", "", str_replace("-", "", strip_tags($udata["nw_phone"])))) : "";
         $udata["nw_phone_linked"] = !empty($phonestring) ? "<a href='tel:" . $phonestring . "'>" . $udata["nw_phone"] . "</a>" : $udata["nw_phone"];
         if (!empty($udata["nw_notyetarrived"])) {
             $udata["nw_phone"] = "";
             $udata["nw_extension"] = "";
             $udata["nw_phone_linked"] = "";
         }
         // -----------------------------------
         // -- Create field nw_city
         //    (after nw_phone)
         // -----------------------------------
         $udata["nw_city"] = strpos($udata["nw_phone"], "+45") !== false ? "Copenhagen" : "Stockholm";
         // Also in ea: "av_residentship"
         // -----------------------------------
         // -- Create field nw_fax
         //    (after nw_phone)
         // -----------------------------------
         $udata["nw_fax"] = strpos($udata["nw_phone"], "+45") !== false ? FAX_COPENHAGEN_EXT : FAX_STOCKHOLM_EXT;
         // -----------------------------------
         // -- Create field nw_building
         //    (call after 'nw_city' and 'nw_leaveofabsence')
         // -----------------------------------
         if ($udata["nw_city"] == "Copenhagen") {
             $udata["nw_building"] = "dk";
             // "NBI (Copenhagen)"
         } elseif (preg_match("/^13/i", $udata["nw_office"], $res)) {
             $udata["nw_building"] = "13";
             // "Nordita East Building"
         } elseif (preg_match("/^12/i", $udata["nw_office"], $res)) {
             $udata["nw_building"] = "12";
             // "Nordita West Building"
         } elseif (preg_match("/^11/i", $udata["nw_office"], $res)) {
             $udata["nw_building"] = "11";
             // "Nordita South Building"
         } elseif (preg_match("/^A5/i", $udata["nw_office"], $res)) {
             $udata["nw_building"] = "an";
             // "AlbaNova Main Building"
         } else {
             $udata["nw_building"] = "";
         }
         // -----------------------------------
         // -- Create field nw_email
         // -- Create field nw_email_plain
         //    (call after nw_notyetarrived)
         // -----------------------------------
         // These fields exist but are not set for all users:
         // In ea: "av_email"
         // In maildb: "m_email" or "maildrop", see also "forward"
         // First check if people::$specialmail contains special instructions
         $smail = functions::callMethod('people', 'lib/people', 'getSpecialMail', $udata["nw_user"]);
         $udata["nw_email_plain"] = "";
         if ($smail !== false) {
             $udata["nw_email_plain"] = $smail;
         } elseif (empty($udata["nw_notyetarrived"])) {
             $udata["nw_email_plain"] = $udata["nw_user"] . "@" . MAIL_DOMAIN;
         }
         $udata["nw_email"] = functions::obscurify_email($udata["nw_email_plain"]);
         // -----------------------------------
         // -- Rename field nw_gid
         // -- Create field nw_group
         // -- Create field nw_groupShort
         // -----------------------------------
         // in ea: "e_gid"
         // In maildb: "groupid"
         $udata["nw_group"] = $udata["nw_groupShort"] = $udata["nw_gid"] = "";
         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.&nbsp;", str_replace("Condensed ", "Cond.&nbsp;", $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&nbsp;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";
         }
         $etArray = explode(",", $udata["nw_employeeTitle"]);
         foreach ($etArray as $key => $title) {
             $title = trim($title);
             $etArray[$key] = ucfirst(str_ireplace("emiritus", "emeritus", str_ireplace("nordita", "Nordita", str_ireplace(" ", "&nbsp;", str_ireplace("postdoctoral fellow", "postdoc", str_ireplace("postdoctoral researcher", "postdoc", str_ireplace("prof.", "professor", str_ireplace("phd", "PhD", str_ireplace("Visiting professor, Professor", "Visiting professor", str_ireplace("Hr officer", "HR officer", str_ireplace("Professor / ", "", str_ireplace("Ass.professor / ", "", $title))))))))))));
         }
         $udata["nw_employeeTitle"] = join(", ", $etArray);
         // -----------------------------------
         // -- Create field nw_employeeTitleShort
         // -----------------------------------
         $udata["nw_employeeTitleShort"] = str_ireplace("Assistant", "Asst.", str_ireplace("Professor&nbsp;emeritus", "Prof.&nbsp;emer.", str_ireplace("Director&nbsp;emeritus", "Director.&nbsp;emer.", preg_replace("/ssociate[d]?/", "ssoc.", str_replace("orresponding", "orresp.", str_replace("ostdoctoral", "ostdoct.", str_replace("eputy", "ep.", str_replace("coordinator", "coord.", $udata["nw_employeeTitle"]))))))));
         // -----------------------------------
         // -- Rename field nw_employeeType
         //    ["faculty"|"fellows"|"visitors"|"postgrads"|"admin"]
         //    After setting of "nw_employeeTitle"
         // -----------------------------------
         $udata["nw_employeeType"] = functions::callMethod('people', 'lib/people', 'getEmploymentTypeFromTitle', $udata["nw_employeeTitle"]);
         if (empty($udata["nw_employeeType"])) {
             $udata["nw_employeeType"] = isset($udata["e_rate"]) ? $udata["e_rate"] : "";
             // In maildb: "employeeType"
             // In ea: "lm_value"
             if ($udata["um_status"] == "v") {
                 $udata["nw_employeeType"] = "visitors";
             }
         }
         // -----------------------------------
         // -- Create field nw_employeeTitleGrp
         // -----------------------------------
         if (!class_exists("people", FALSE)) {
             require_once PATH_CLASSES . "/lib/people.php";
         }
         $udata["nw_employeeTitleGrp"] = isset(people::$fieldnames[$udata["nw_employeeType"]]) ? people::$fieldnames[$udata["nw_employeeType"]] : "";
         /*
               $grpArray = array();
               foreach ($etArray as $key => $title) {
         
                 switch (str_replace("&nbsp;"," ",mb_strtolower($title))) {
                   case "professor":
                   case "professor emeritus":
                   case "visiting professor":
                   case "corresponding professor":
                   case "associate professor":
                     $grpArray["Professors"] = 1;
                     if (empty($udata["nw_employeeType"])) $udata["nw_employeeType"] = "faculty";
                     break;
                   case "assistant professor":
                   case "visiting assistant professor":
                   case "corresponding assistant professor":
                   case "associate assistant professor":
                   case "senior lecturer":
                   case "visiting senior lecturer":
                   case "corresponding senior lecturer":
                   case "associate senior lecturer":
                     $grpArray["Assistant Professors"] = 1;
                     if (empty($udata["nw_employeeType"])) $udata["nw_employeeType"] = "faculty";
                     break;
                   case "fellow":
                   case "nordita fellow":
                   case "postdoc":
                   case "postdoctoral fellow":
                   case "visiting fellow":
                   case "visiting postdoc":
                   case "visiting postdoctoral fellow":
                   case "corresponding fellow":
                   case "corresponding postdoc":
                   case "associate fellow":
                   case "associate postdoc":
                     $grpArray["Postdocs"] = 1;
                     if (empty($udata["nw_employeeType"])) $udata["nw_employeeType"] = "fellows";
                     break;
                   case "phd student":
                   case "phd fellow":
                   case "visiting phd fellow":
                   case "visiting phd student":
                   case "corresponding phd student":
                   case "corresponding phd fellow":
                   case "associate phd student":
                   case "associate phd fellow":
                     $grpArray["PhD Students"] = 1;
                     if (empty($udata["nw_employeeType"])) $udata["nw_employeeType"] = "postgrads";
                     break;
                   case "masters student":
                   case "visiting masters student":
                   case "corresponding masters student":
                   case "associate masters student":
                     $grpArray["Masters Students"] = 1;
                     if (empty($udata["nw_employeeType"])) $udata["nw_employeeType"] = "postgrads";
                     break;
                   case "web and computing":
                   case "economic officer":
                   case "scientific program coordinator":
                   case "student assistant":
                   case "administrator":
                   case "director":
                   case "deputy director":
                   case "hr officer":
                   case "head of computing":
                   case "head of administration":
                   case "director emeritus":
                     $grpArray["Administration"] = 1;
                     if (empty($udata["nw_employeeType"])) $udata["nw_employeeType"] = "admin";
                     break;
                   default:
                     $grpArray[ucfirst($udata["nw_employeeTitle"])] = 1;
                     break;
                 } // end switch
               } // end foreach
               $udata["nw_employeeTitleGrp"] = join(", ",array_keys($grpArray));
         */
         // -----------------------------------
         // -- Create field nw_image_small
         // -- Create field nw_image_medium
         // -- Create field nw_image_large
         // -----------------------------------
         // In ea: "av_photo"
         // In maildb: "m_photo"
         $udata["nw_image_small"] = PATH_PEOPLE . "/48x48/" . "blank-48.png";
         $pic_sans_ext = PATH_PEOPLE . "/48x48/" . $udata["nw_user"] . "-48";
         foreach (array('.png', '.jpg', '.jpeg') as $ext) {
             if (file_exists(INCLEVEL . $pic_sans_ext . $ext)) {
                 $udata["nw_image_small"] = $pic_sans_ext . $ext;
                 break;
             }
         }
         $udata["nw_image_medium"] = PATH_PEOPLE . "/85x113/" . "blank-3x4.png";
         $pic_sans_ext = PATH_PEOPLE . "/85x113/" . $udata["nw_user"] . "-3x4";
         foreach (array('.png', '.jpg', '.jpeg') as $ext) {
             if (file_exists(INCLEVEL . $pic_sans_ext . $ext)) {
                 $udata["nw_image_medium"] = $pic_sans_ext . $ext;
                 break;
             }
         }
         $udata["nw_image_large"] = PATH_PEOPLE . "/188x250/" . "blank.png";
         $pic_sans_ext = PATH_PEOPLE . "/188x250/" . $udata["nw_user"];
         foreach (array('.png', '.jpg', '.jpeg') as $ext) {
             if (file_exists(INCLEVEL . $pic_sans_ext . $ext)) {
                 $udata["nw_image_large"] = $pic_sans_ext . $ext;
                 break;
             }
         }
         // -----------------------------------
         // -- Create field nw_homepage
         // -- Create field nw_homepage_unlinked
         // -----------------------------------
         // Also in ea: "av_http"
         $udata["nw_homepage_unlinked"] = "";
         $udata["nw_homepage"] = "";
         //TODO: fetch people::hasValidHomepage() from cache
         $slask = array($udata["nw_acc_kth"], $udata["nw_acc_su"], $udata["nw_acc_nbi"], $udata["nw_acc_maildb"], $udata["nw_user"]);
         if ($sweb = functions::callMethod('people', 'lib/people', 'getSpecialHomepage', $udata["nw_user"])) {
             $udata["nw_homepage_unlinked"] = $sweb;
             $udata["nw_homepage"] = "<a href='http://" . $sweb . "'" . ">" . $sweb . "</a>";
         } elseif (functions::callMethod('people', 'lib/people', 'hasValidHomepage', $udata["nw_user"])) {
             $udata["nw_homepage_unlinked"] = "www.nordita.org/~" . $udata["nw_user"];
             $udata["nw_homepage"] = "<a href='http://" . $udata["nw_homepage_unlinked"] . "/'" . ">" . $udata["nw_homepage_unlinked"] . "</a>";
         }
         // -----------------------------------
         // -- Rename field nw_home_address
         // -- Rename field nw_home_zip
         // -- Rename field nw_home_city
         // -- Create field nw_home_phone
         // -- Create field nw_phone_mobile
         // -----------------------------------
         $udata["nw_home_address"] = isset($udata["av_address"]) ? $udata["av_address"] : "";
         // In maildb: "address"
         $udata["nw_home_zip"] = isset($udata["av_zip"]) ? $udata["av_zip"] : "";
         // In maildb: "postnummer"
         $udata["nw_home_city"] = isset($udata["av_city"]) ? $udata["av_city"] : "";
         // In maildb: "ortnamn"
         //TODO:
         $udata["nw_home_phone"] = "";
         // (isset($udata[""])) ? $udata[""] : "";
         // In maildb: "phone_home"
         //TODO:
         $udata["nw_phone_mobile"] = "";
         // (isset($udata[""])) ? $udata[""] : "";
         // In maildb: "phone_mobile"
         // -----------------------------------
         // -- Rename field nw_cv
         // -----------------------------------
         $udata["nw_cv"] = isset($udata["cv"]) ? $udata["cv"] : "";
         if ($udata["nw_cv"]["text"] == "") {
             if (!class_exists("fromdb_cv", FALSE)) {
                 require_once PATH_CLASSES . "/fromdb/cv.php";
             }
             $dbCvs = new fromdb_cv();
             $cvitems = $dbCvs->getCvs();
             // array("text","brief")
             $udata["nw_cv"] = isset($cvitems[$udata["nw_user"]]) ? $cvitems[$udata["nw_user"]] : array("text" => "", "brief" => "");
             $udata["nw_cv"]["text"] = str_replace("<p></p>", "", $udata["nw_cv"]["text"]);
             $udata["nw_cv"]["plain"] = isset($udata["nw_cv"]["text"]) ? strip_tags($udata["nw_cv"]["text"]) : "";
         }
         // -----------------------------------
         // ERASE OBSOLETE FIELDS IN DB OUTPUT
         // -----------------------------------
         foreach (array("acc_kth", "acc_su", "acc_nbi", "acc_maildb", "av_address", "av_birthcountry", "av_birthdate", "av_birthplace", "av_citizenship", "av_city", "av_ddate", "av_email", "av_email2", "av_firstname", "av_http", "av_id", "av_id2", "av_identity", "av_institute", "av_lastlogin", "av_lastname", "av_ms_country", "av_ms_institute", "av_ms_year", "av_phd_adviser_avid", "av_phd_country", "av_phd_institute", "av_phd_year", "av_phone", "av_photo", "av_position", "av_pwd", "av_pwd2", "av_residentship", "av_salutation", "av_sex", "av_ssn", "av_timestamp", "av_zip", "av_timestamp", "av_von", "e_cc", "e_gid", "e_inst", "e_off", "e_org", "e_rate", "e_type", "lm_value", "lm_key", "lm_status", "lm_option", "um_status", "altname", "altacct", "maildrop", "user", "cv") as $field) {
             if (isset($udata[$field])) {
                 unset($udata[$field]);
             }
         }
         // -----------------------------------
         // COLLECT DATA FROM OTHER SOURCES, IF NEEDED
         // -----------------------------------
         include PATH_DATA . "/adhoc_people_data.php";
         // -----------------------------------
         // SAVE BACK CHANGES INTO ARRAY $userarray
         // NB. An empty $status papameter should be interpreted as "any status"
         // -------------------------------------------------------------------------
         if (empty($status) || strtolower($udata["nw_status"]) == $status || $status == "alumni") {
             $userarray[$usr] = $udata;
         }
     }
     // end foreach
     // ------------------------------------------
     return $userarray;
 }
Пример #10
0
 public static function OutputMyTravels()
 {
     $stdout = "";
     $stdout = "<h1 class='red'>[UNDER DEVELOPMENT]</h1><br><br>\r\n";
     self::loadClass();
     functions::gpc_declare_input("user", "*****@*****.**", 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;
 }