Пример #1
0
 static function OutputOpenPositions($wid = "openpositions", $divclass = "", $listclass = "", $splash = TRUE, $showall = FALSE, $noerrormessage = FALSE)
 {
     $stdout = "";
     if (empty($openpositions)) {
         $wid = "openpositions";
     }
     //    if (!$showall && !$splash) $listclass = trim($listclass . " current");
     // -------------------------------
     // -- obtain data
     // -------------------------------
     // REPLACE WHEN READY:
     $positions = functions::callMethod('fromdb_jam', 'fromdb/jam', 'getPositions');
     //    $positions = functions::callMethod('fromdb_nwpositions','fromdb/nwpositions','getCampaignsPositions');
     if (empty($positions)) {
         return "";
     }
     if (!$splash) {
         krsort($positions);
     }
     foreach ($positions as $date => $applic) {
         if (!$showall && $date < date("Y-m-d")) {
             unset($positions[$date]);
         }
     }
     if (empty($positions)) {
         return $noerrormessage ? "" : "            <h2 class='red bottommargin'>There are currently no open positions at Nordita</h2>\r\n" . "            <p style='margin-bottom:2em'><strong>&#187;</strong> " . "Check the <a href='people/positions/archive/index.php'><strong>positions archive</strong></a> for earlier campaigns.</p>\r\n" . "            <p style='margin-bottom:0'>Most position campaigns at Nordita are administred " . "through our <strong>Job Application Manager</strong> at</p>\r\n" . "            <p style='margin:0 0 3em 2em;font-size:1.5em'>" . "<a href='http://jam.nordita.org'><strong>jam.nordita.org</strong></a></p>\r\n" . "\r\n";
     }
     // -------------------------------
     // -- output data
     // -------------------------------
     $stdout .= "            <div id='" . $wid . "'" . (!empty($divclass) ? " class='" . $divclass . "'" : "") . ($splash ? "" : " style='margin-bottom:3em'") . ">\r\n";
     if ($splash) {
         $stdout .= "              <h3><span>Open Positions</span></h3>\r\n" . "              <div>\r\n";
         // for accordion effect
     } else {
         $stdout .= "\r\n";
     }
     $list = "";
     foreach ($positions as $date => $applic) {
         $splashclass = $splash ? functions::callMethod("widget", "lib/widget", "WlimitDate2Class", $date) : "";
         $thelistclass = trim($listclass . " " . $splashclass);
         foreach ($applic as $app) {
             if (!$showall && !$splash) {
                 $list .= "              <div class='current'>\r\n";
             }
             if (!isset($app["method"])) {
                 $app["method"] = "";
             }
             $thetitle = $app["title"];
             if ($splash) {
                 if ($app["method"] == "jam") {
                     $thetitle = "<a href='http://jam.nordita.org/'>" . $thetitle . "</a>";
                 } elseif ($app["method"] == "programs") {
                     $thetitle = "<a href='http://www.nordita.org/propose/'>" . $thetitle . "</a>";
                 } elseif (!empty($app["url"])) {
                     $thetitle = "<a href='" . $app["url"] . "' rel='nofollow'>" . $thetitle . "</a>";
                 } elseif (in_array($app["method"], array("kth", "su"))) {
                     $thetitle = $thetitle;
                     //TODO
                 }
             }
             $list .= "                <dl" . (!empty($thelistclass) ? " class='" . $thelistclass . "'" : "") . ">\r\n";
             if ($splash) {
                 $list .= "                  <dt class='title'>" . $thetitle . (!empty($app["announcement"]) ? " <span class='pdf'>" . "[<a href='docs/" . $app["announcement"] . "' rel='nofollow'>Announcement</a>]</span>" : "") . "</dt>\r\n";
             } else {
                 $list .= "                  <dt class='title'>" . $thetitle . "</dt>\r\n";
                 if (!$showall) {
                     if (isset($app["description"]) && !empty($app["description"])) {
                         $list .= "                </dl>\r\n" . "              <blockquote>" . $app["description"] . "\r\n" . "              </blockquote>\r\n";
                     }
                     $list .= "              </div>\r\n" . "                <dl>\r\n";
                 }
                 $list .= (empty($app["image"]) ? "" : "                  <dd><img src='" . $app["image"] . "' alt=''></dd>\r\n") . (empty($app["announcement"]) ? "" : "                  <dd><span class='pdf'><a href='docs/" . $app["announcement"] . "' rel='nofollow'>Announcement</a></span> (PDF File)</dd>\r\n") . (empty($app["url"]) ? "" : "                  <dd><span class='pdf'><a href='" . $app["url"] . "' rel='nofollow'>Information</a></span></dd>\r\n");
                 //TODO: same code in position::OutputOpenPositions() and news::drawCampaign()
                 if (isset($app["method"]) && !$showall) {
                     switch ($app["method"]) {
                         case "jam":
                             $list .= "                  <dd>Apply online: <span class='apply'><a href='http://jam.nordita.org/' rel='nofollow'>" . "jam.nordita.org</a></span></dd>\r\n";
                             break;
                         case "kth":
                             $list .= "                  <dd>Applications should be entered in the <span class='apply'>" . "<a href='https://kth.mynetworkglobal.com/en/what:login/jobID:46590/where:4/' rel='nofollow'>" . "KTH Recruitment System</a></span></dd>\r\n";
                             break;
                         case "su":
                             $list .= "                  <dd>Applications should be entered in the <strong>Stockholm University " . "Recruitment System</strong>. Press the button &quot;Ansök&quot; or &quot;Apply&quot; at the end of the " . (empty($app["url"]) ? "position information page " : "<span class='apply'><a href='" . $app["url"] . "' rel='nofollow'>position information page</a></span> ") . "to log in to the recruitment system.</dd>\r\n";
                             break;
                         case "vr":
                             $list .= "                  <dd>Applications should be sent to the <span class='apply'>" . "<a href='http://vrdirect.vr.se/'>" . "VR Online Application System</a></span></dd>\r\n";
                             break;
                     }
                 }
             }
             $list .= "                  <dd class='deadline'>Deadline: <span class='date" . ($date >= date("Y-m-d") ? " green" : "") . "'>" . functions::readableDate($date) . "</span></dd>\r\n" . (isset($app["extra"]) ? "                  <dd class='deadline'>" . $app["extra"] . "</dd>\r\n" : "");
             if (!$splash && isset($app["hired"]) && !empty($app["hired"])) {
                 $list .= "                    <dd><em class='red'><strong>Closed</strong></em> - Hired " . (count($app["hired"]) == 1 ? "was" : "were") . ":</dd>\r\n" . "                    <dd><dl>\r\n";
                 foreach ($app["hired"] as $name => $hired) {
                     if (preg_match("#^(.*),\\s+(.*)\$#", $name, $res)) {
                         $name = $res[2] . " " . $res[1];
                     }
                     $list .= "                      <dd><em>" . $name . "</em> " . (empty($hired["home"]) ? "" : " - " . $hired["home"]) . (empty($hired["field"]) ? "" : " (" . $hired["field"] . ")") . "</dd>\r\n";
                 }
                 $list .= "                    </dl></dd>\r\n";
             } elseif ($date < date("Y-m-d")) {
                 $list .= "                    <dd><em class='red'><strong>Closed</strong></em> - <em>Under evaluation</em></dd>\r\n";
             }
             $list .= "                </dl>\r\n";
         }
         // end foreach
     }
     // end foreach
     $stdout .= $list . ($splash ? "              </div>\r\n" : "") . "            </div> <!-- " . $wid . " -->\r\n" . "\r\n";
     return empty($list) ? "" : $stdout;
 }
Пример #2
0
 public static function drawCampaign($issue_id)
 {
     $stdout = "";
     $stdout .= "<h2 class='bottommargin'>OPEN POSITIONS AT NORDITA</h2>\r\n" . "<p style='margin-bottom:2em' class='only_online'>&rarr; See Current Open Postitions: <a href='people/positions/index.php' rel='nofollow'><strong>www.nordita.org/positions</strong></a></p>\r\n";
     // -----------------------------------------------------------
     // -- Obtain campaign data
     // -----------------------------------------------------------
     $campaigns = news::getCampaign($issue_id);
     if (!is_array($campaigns)) {
         return $stdout . $campaigns;
     }
     // -----------------------------------------------------------
     // -- Output campaign data
     // -----------------------------------------------------------
     foreach ($campaigns as $date => $arr) {
         foreach ($arr as $row) {
             $stdout .= "<div class='campaign'>\r\n" . "  <h3>" . preg_replace("/\\w*20\\d\\d/", "", $row["title"]) . "</h3>\r\n" . "  <dl>\r\n" . (empty($row["announcement"]) ? "" : "    <dd><span class='pdf'><a href='docs/" . $row["announcement"] . "' rel='nofollow'>Announcement</a></span> (PDF File)</dd>\r\n") . (empty($row["url"]) ? "" : "    <dd><span class='pdf'><a href='" . $row["url"] . "' rel='nofollow'>Information</a></span></dd>\r\n");
             //TODO: same code in position::OutputOpenPositions() and news::drawCampaign()
             if (isset($row["method"])) {
                 switch ($row["method"]) {
                     case "jam":
                         $stdout .= "    <dd>Apply online: <span class='apply'><a href='http://jam.nordita.org/' rel='nofollow'>" . "jam.nordita.org</a></span></dd>\r\n";
                         break;
                         //case "kth": $stdout .=
                         //  "    <dd>Applications should be sent to the <span class='apply'>" .
                         //  "<a href='http://www.kth.se/en/om/kontakt/registrator-1.15615' rel='nofollow'>" .
                         //  "KTH Registrar's Office</a></span></dd>\r\n"; break;
                     //case "kth": $stdout .=
                     //  "    <dd>Applications should be sent to the <span class='apply'>" .
                     //  "<a href='http://www.kth.se/en/om/kontakt/registrator-1.15615' rel='nofollow'>" .
                     //  "KTH Registrar's Office</a></span></dd>\r\n"; break;
                     case "kth":
                         $stdout .= "    <dd>Applications should be entered in the <span class='apply'>" . "<a href='https://kth.mynetworkglobal.com/en/what:login/jobID:46590/where:4/' rel='nofollow'>" . "KTH Recruitment System</a></span></dd>\r\n";
                         break;
                     case "su":
                         $list .= "                  <dd>Applications should be entered in the <strong>Stockholm University " . "Recruitment System</strong>. Press the button &quot;Ansök&quot; or &quot;Apply&quot; at the end of the " . (empty($app["url"]) ? "position information page " : "<span class='apply'><a href='" . $app["url"] . "' rel='nofollow'>position information page</a></span> ") . "to log in to the recruitment system.</dd>\r\n";
                         break;
                         //case "su": $stdout .=
                         //  "    <dd>Applications should be sent to the <span class='apply'>" .
                         //  "<a href='' rel='nofollow'>" .
                         //  "Stockholm University Registrar's Office</a></span></dd>\r\n"; break;
                     //case "su": $stdout .=
                     //  "    <dd>Applications should be sent to the <span class='apply'>" .
                     //  "<a href='' rel='nofollow'>" .
                     //  "Stockholm University Registrar's Office</a></span></dd>\r\n"; break;
                     case "vr":
                         $stdout .= "    <dd>Applications should be sent to the <span class='apply'>" . "<a href='http://vrdirect.vr.se/'>" . "VR Online Application System</a></span></dd>\r\n";
                         break;
                     case "":
                         break;
                     case "":
                         break;
                     case "":
                         break;
                     case "":
                         break;
                 }
             }
             $stdout .= "   <dd>Application deadline: <span class='deadline'>" . functions::readableDate($date) . "</span></dd>\r\n" . "  </dl>\r\n" . $row["text"] . "  <div class='clear social-footer' style=''>\r\n" . news::drawIconsSocialMedia() . "  </div>\r\n" . "</div>\r\n";
         }
     }
     // -----------------------------------------------------------
     return $stdout;
 }
Пример #3
0
 static function outputRegistrationOpen($wid = "announce-registration", $divclass = "", $listclass = "box announce", $splash = true)
 {
     // -- Obtain data array
     $eventArray = functions::callMethod('fromdb_nwevents', 'fromdb/nwevents', 'getEventsRegistrationOpen');
     // -- Output data
     $stdout = "            <div id='" . $wid . "'" . (!empty($divclass) ? " class='" . $divclass . "'" : "") . ">\r\n";
     if ($splash) {
         $stdout .= "              <h3><span>Apply Now!</span></h3>\r\n" . "              <div>\r\n";
         // for accordion effect
     }
     $list = "";
     foreach ($eventArray as $date => $events) {
         if ($date >= date("Y-m-d")) {
             $splashclass = $splash ? functions::callMethod("widget", "lib/widget", "WlimitDate2Class", $date) : "";
             $thelistclass = trim($listclass . " " . $splashclass);
             foreach ($events as $ev) {
                 $ev["url"] = preg_replace("#^" . URL_PREFIX . "/#", "", $ev["url"]);
                 $list .= "                <dl" . (!empty($thelistclass) ? " class='" . $thelistclass . "'" : "") . ">\r\n" . "                  <dt class='title'>" . "<a href='" . $ev["url"] . "' rel='nofollow'>" . $ev["title"] . "</a></dt>\r\n" . "                  <dd class='deadline'>Deadline: <span class='date'>" . functions::readableDate($date) . "</span></dd>\r\n" . (isset($ev["extra"]) ? "                  <dd class='deadline'>" . $ev["extra"] . "</dd>\r\n" : "") . "                </dl>\r\n";
             }
             // end foreach
         }
         // end if
     }
     // end foreach
     $stdout .= $list . ($splash ? "              </div>\r\n" : "") . "            </div> <!-- " . $wid . " -->\r\n" . "\r\n";
     return empty($list) ? "" : $stdout;
 }
Пример #4
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;
 }
Пример #5
0
 public static function OutputDirectorsReport()
 {
     functions::gpc_declare_input("r", false, true);
     if ($GLOBALS["r"] == 1) {
         unset($_SESSION["directorsreport"]);
     }
     debug::rrr();
     $stdout = $date_interval = "";
     $errormessage = array();
     $meetingdate = isset($_SESSION["directorsreport"]["meetingdate"]) ? $_SESSION["directorsreport"]["meetingdate"] : date("Y-m-d");
     $timestamp_from = isset($_SESSION["directorsreport"]["timestamp_from"]) ? $_SESSION["directorsreport"]["timestamp_from"] : strtotime("- 3 months");
     $timestamp_to = isset($_SESSION["directorsreport"]["timestamp_to"]) ? $_SESSION["directorsreport"]["timestamp_to"] : time();
     functions::gpc_declare_input("meetingdate_selected", false, true);
     functions::gpc_declare_input("meetingdate", $meetingdate, false);
     functions::gpc_declare_input("period_selected", false, true);
     functions::gpc_declare_input("month_from", date("n", $timestamp_from), false);
     functions::gpc_declare_input("year_from", date("Y", $timestamp_from), false);
     functions::gpc_declare_input("month_to", date("n", $timestamp_to), false);
     functions::gpc_declare_input("year_to", date("Y", $timestamp_to), false);
     // ------------------------
     // -- Input check
     // ------------------------
     if ($GLOBALS["meetingdate_selected"]) {
         if (!strtotime($GLOBALS["meetingdate"])) {
             $errormessage[] = "Incorrect date '" . $GLOBALS["meetingdate"] . "'. Please try again.";
         }
     } elseif ($GLOBALS["period_selected"]) {
         $timestamp_from = mktime(0, 0, 0, $GLOBALS["month_from"], 1, $GLOBALS["year_from"]);
         $timestamp_to = mktime(0, 0, 0, $GLOBALS["month_to"], 1, $GLOBALS["year_to"]);
         $lastday = date("t", $timestamp_to);
         $timestamp_to = mktime(0, 0, 0, $GLOBALS["month_to"], $lastday, $GLOBALS["year_to"]);
         if (!is_numeric($GLOBALS["month_from"]) || !is_numeric($GLOBALS["year_from"]) || !is_numeric($GLOBALS["month_to"]) || !is_numeric($GLOBALS["year_to"]) || !checkdate($GLOBALS["month_from"], 1, $GLOBALS["year_from"]) || !checkdate($GLOBALS["month_to"], 1, $GLOBALS["year_to"])) {
             $errormessage[] = "Incorrect month or year. Please try again.";
         }
         if ($timestamp_from > $timestamp_to) {
             $errormessage[] = "Incorrect period. Please try again.";
         }
     }
     // ------------------------
     // -- Print preamble
     // ------------------------
     $stdout .= "  <p><a href='" . $_SERVER["PHP_SELF"] . "?r=1' class='fakebuttonbutton'>Start over</a></p>\r\n" . "  <p class='bold'><a href='docsx/directors_reports/nordita_directors_report_MONTH_YEAR.tex'>Download TeX template for report</a>\r\n" . "  &#8212; <a href='docs/logo/nordita-logo-black-text-and-subtitle.pdf'>Download logo image file for TeX file</a></p>\r\n";
     // ------------------------
     // -- Print date selection form
     // ------------------------
     var_dump(!$GLOBALS["meetingdate_selected"]);
     if (!$GLOBALS["period_selected"] && (!$GLOBALS["meetingdate_selected"] || !empty($errormessage))) {
         if (!empty($errormessage)) {
             $stdout .= "  <div class='box error padding background bold'>\r\n" . "  <p>&#187; " . implode("</p>\r\n  <p>&#187; ", $errormessage) . "</p>\r\n" . "  </div>\r\n";
         }
         $stdout .= "  <form " . "action='" . $_SERVER["PHP_SELF"] . "' " . "method='POST' " . "enctype='multipart/form-data' " . "style='margin-top:1em;margin-bottom:1em'>\r\n" . "    <h3 style='margin-bottom:1em'>Please enter the date for the board meeting<br>(format <strong>YY-mm-dd</strong>):</h3>\r\n" . "    <p><input type='date' name='meetingdate' value='" . $GLOBALS["meetingdate"] . "'" . (!empty($errormessage) ? " class='error'" : "") . ">\r\n" . "    <input type='submit' name='meetingdate_selected' value='Select'>\r\n" . "    </p>\r\n " . "  </form>\r\n";
         debug::rr($_SESSION["directorsreport"]);
         return $stdout;
     } elseif (!$GLOBALS["period_selected"] || !empty($errormessage)) {
         $_SESSION["directorsreport"]["meetingdate"] = $GLOBALS["meetingdate"];
         $stdout .= "  <h2>Compiling a Director's Report for<br>the Board Meeting on " . $GLOBALS["meetingdate"] . "</h2>\r\n";
         if (!empty($errormessage)) {
             $stdout .= "  <div class='box error padding background bold'>\r\n" . "  <p>&#187; " . implode("</p>\r\n  <p>&#187; ", $errormessage) . "</p>\r\n" . "  </div>\r\n";
         }
         $stdout .= "  <form " . "action='" . $_SERVER["PHP_SELF"] . "' " . "method='POST' " . "enctype='multipart/form-data' " . "style='margin-top:1em;margin-bottom:1em'>\r\n" . "    <h3 style='margin-bottom:1em'>Select the period for this report</h3>\r\n" . "    <p>From \r\n" . "    <select name='month_from' style=''>\r\n";
         for ($m = 1; $m < 13; $m++) {
             $stdout .= "    <option value='" . $m . "'" . ($GLOBALS["month_from"] == $m ? " selected='selected'" : "") . ">" . date("F", mktime(0, 0, 0, $m)) . "</option>\r\n";
         }
         $stdout .= "    </select>\r\n" . "    <select name='year_from'>\r\n";
         for ($y = date("Y") - 1; $y <= date("Y") + 1; $y++) {
             $stdout .= "    <option value='" . $y . "'" . ($GLOBALS["year_from"] == $y ? " selected='selected'" : "") . ">" . date("Y", mktime(0, 0, 0, 1, 1, $y)) . "</option>\r\n";
         }
         $stdout .= "    </select>\r\n" . "    to \r\n " . "    <select name='month_to'>\r\n";
         for ($m = 1; $m < 13; $m++) {
             $stdout .= "    <option value='" . $m . "'" . ($GLOBALS["month_to"] == $m ? " selected='selected'" : "") . ">" . date("F", mktime(0, 0, 0, $m)) . "</option>\r\n";
         }
         $stdout .= "    </select>\r\n" . "    <select name='year_to'>\r\n";
         for ($y = date("Y") - 1; $y <= date("Y") + 1; $y++) {
             $stdout .= "    <option value='" . $y . "'" . ($GLOBALS["year_to"] == $y ? " selected='selected'" : "") . ">" . date("Y", mktime(0, 0, 0, 1, 1, $y)) . "</option>\r\n";
         }
         $stdout .= "    </select>\r\n" . "    <input type='submit' name='period_selected' value='Select'>\r\n" . "    </p>\r\n " . "  </form>\r\n";
         debug::rr($_SESSION["directorsreport"]);
         return $stdout;
     }
     // ------------------------
     // -- Print output
     // ------------------------
     $_SESSION["directorsreport"]["timestamp_from"] = $timestamp_from;
     $_SESSION["directorsreport"]["timestamp_to"] = $timestamp_to;
     debug::rr($_SESSION["directorsreport"]);
     var_dump(date("Y-m-d", $timestamp_from));
     var_dump(date("Y-m-d", $timestamp_to));
     $from = getdate($timestamp_from);
     $to = getdate($timestamp_to);
     $date_interval = $from["year"] == $to["year"] ? $from["mon"] == $to["mon"] ? $from["month"] . " " . $from["year"] : $from["month"] . " &#8212; " . $to["month"] . " " . $from["year"] : $from["month"] . " " . $from["year"] . " &#8212; " . $to["month"] . " " . $to["year"];
     $stdout .= "  <h2>TeX Template for a Director's Report" . "<br>for the period " . $date_interval . "<br>for the Board Meeting on " . functions::readableDate($_SESSION["directorsreport"]["meetingdate"]) . "</h2>\r\n";
     $stdout .= "  <div class='box blackborder padding' style='white-space:pre;font-family:monospace'>";
     $stdout .= "\\documentclass[twoside,10pt,a4paper]{article}\n\\usepackage[utf8]{inputenc}\n\\usepackage[T1]{fontenc}\n\\usepackage[swedish]{babel}\n\\usepackage{amsmath}\n\\usepackage{amssymb,amsfonts,textcomp}\n\\usepackage{array}\n\\usepackage{hhline}\n\\usepackage{graphicx}\n\\usepackage{titlesec}\n\\usepackage{hyperref}\n\\usepackage{enumerate}\n\\usepackage{color}\n\\usepackage{multicol}\n\n\\setlength{\\textwidth}{155mm}        % A4\n\\setlength{\\textheight}{247mm}       % A4\n\\setlength{\\hoffset}{-1in}           % to compensate default 1 inch inner margin\n\\setlength{\\voffset}{-1in}           % to compensate default 1 inch top margin\n\\setlength{\\oddsidemargin}{30mm}\n\\setlength{\\evensidemargin}{30mm}\n\\setlength{\\marginparwidth}{17mm}\n\n\\titleformat{\\section}[display]{\\normalfont\\Huge\\bfseries}{}{0pt}{}\n\\titleformat{\\subsection}[display]{\\raggedright\\normalfont\\LARGE\\bf}{}{-5pt}{}\n\\titleformat{\\subsubsection}[display]{\\normalfont\\large\\bf}{}{-15pt}{}\n\n\\title{}\n\n% ------------------------------------------------------------\n\n\\begin{document}\n\n% Unhandled or unsupported graphics:\n% This image can be downloaded from http://www.nordita.org/docs/logo/nordita-logo-black-text-and-subtitle.pdf\n\\noindent\\includegraphics{nordita-logo-black-text-and-subtitle.pdf}\n\\newline\\rule{\\textwidth}{1pt}\n\n\\bigskip\n\n\\section{DIRECTOR’S REPORT \\newline\nfor " . $date_interval . "}\n\nPrepared by ........... for the meeting of the Nordita board on " . functions::readableDate($_SESSION["directorsreport"]["meetingdate"]) . ".\n\n\\bigskip\n\n% ------------------------------------------------------------\n\\subsection{STAFF}\n% Get data from http://nordita.org/alumni\n\n\\subsubsection{Faculty}\n\n% ABC listing\n\\begin{itemize}\n\\item \\textit{....} (.... physics) from ... ..... longer text ....\n\\end{itemize}\n\n\\noindent Faculty members that have left since the previous Director’s report:\n\n% ABC listing\n\\begin{itemize}\n\\item \\textit{...} (.... physics) left Nordita ... for a position .........\n\\end{itemize}\n\n% If relevant, insert information about ongoing or concluded recruitments .......\n\n\\subsubsection{Post-doctoral Fellows}\n\n\\noindent ....... new Nordita Fellows arrived during the period covered by the report, and ......... postponed thier arrival:\n\n% ABC listing\n\\begin{itemize}\n\\item \\textit{.....} (.... physics) from ..., arrived .....\n\\end{itemize}\n\n\\noindent ........ new postdoctoral fellow supported by project grants arrived during the report period, and ......... were continued on other project grants:\n\n% ABC listing\n\\begin{itemize}\n\\item \\textit{...} (.... physics) from ..., arrived ..... under the ..... grant\n\\end{itemize}\n\n\\noindent Postdoctoral fellows that have left since the previous Director’s report:\n\n% ABC listing\n\\begin{itemize}\n\\item \\textit{...} (.... physics) left Nordita ... for a position .........\n\\end{itemize}\n\n% Get data from http://nordita.org/people\n\\noindent Currently there are ......... Nordita Fellows, and ......... postdoctoral fellows supported by project grants.\n\n% --------- START -- ONLY FOR OCTOBER-JANUARY REPORT -----------------\n% Get data from http://jam.nordita.org\n\n\\bigskip\n\\noindent A total of 439 applications were received for Nordita Fellowships in Fall 2015 (compared to 455 in 2014, 399 in 2013, 331 in 2012, 226 in 2011, 403 in 2010, and 355 in 2009). Applicants placed themselves in one of six categories and the breakdown was as follows (numbers in parentheses are from previous years):\n\n% Modyfy this list in such a way that the history is kept and updated:\n\\begin{itemize}\\itemsep-3pt\n\\item Astrophysics and Astrobiology — 33 (2014: 46; 2013: 41; 2012: 33; 2011: 43)\n\\item Biological Physics — 8 (2014: 6; 2013: 6; 2012: 3; 2011: 3)\n\\item Condensed Matter Physics — 45 (2014: 42; 2013: 36; 2012: 34; 2011: 28)\n\\item Gravitation and Cosmology — 110 (2014: 137; 2013: 127; 2012: 118; 2011: 54)\n\\item High-Energy Physics — 243 (2014: 150; 2013: 189; 2012: 114; 2011: 87)\n\\item Other — [this option was removed] (2014: 74; 2013: –; 2012: 32; 2011: 11)\n\\end{itemize}\n\n\\noindent The applications were evaluated by the Nordita Research Committees and by members of the Nordita Faculty. The committees met in Stockholm in the beginning of December to make recommendations for a short list,\n% Get data from http://www.nordita.org/minutes/\nwhich was finalized at a faculty meeting on December ..............\n%The recruitment is ongoing with 5 accepted fellowships and 1 active offer.\nThe recruitment is completed with 6 accepted fellowships:\n% ABC listing\n% Get PhD data from http://jam.nordita.org\n\\begin{itemize}\\itemsep-3pt\n\\item \\textit{Stefano Bo} (biophysics), PhD 2015 from Turin, Italy\n\\item \\textit{......} (....... physics), PhD ..... from ........\n\\end{itemize}\nIn most cases, the top candidates accepted.\n% ABC listing\n% Get info from faculty member...\nInitial offers to\n... (..... physics),\n... (..... physics)\nwere eventually declined.\n\n% --------- END -- ONLY FOR OCTOBER-JANUARY REPORT -----------------\n\n\\subsubsection{PhD Students}\n\n........ new PhD students arrived at Nordita during the reporting period:\n\n% ABC listing\n\\begin{itemize}\n\\item \\textit{...} (.... physics) from ..., arrived .....\n\\end{itemize}\n\n\\noindent Thesis defense:\n\n% ABC listing\n\\begin{itemize}\n\\item \\textit{....} successfully defended his ....... thesis ``........'' on 1 January 2016.\n\\end{itemize}\n\n\\noindent A complete list of current Nordita staff is at {\\textless}www.nordita.org/people{\\textgreater}. Nordita Alumni from 1957 to the present are at {\\textless}www.nordita.org/alumni{\\textgreater}.\n\n% ------------------------------------------------------------\n\\subsection{VISITORS}\n% Get data from http://www.nordita.org/science/phd_fellows/list_of_phd_fellows\n\n\\noindent ....... Visiting PhD Student Fellows stayed at Nordita during the period:\n\n% Arrival date listing\n\\begin{itemize}\n\\item \\textit{...} (.... physics) from ..., period\n\\end{itemize}\n\n\\noindent Four Visiting PhD Fellowships for 2016 have been awarded:\n% Get data from http://www.nordita.org/science/phd_fellows/list_of_phd_fellows\n\n% ABC listing\n\\begin{itemize}\n\\item \\textit{...} (.... physics) from ..., period. Contact person is ...............\n\\end{itemize}\n\n\\noindent Long-term visitors, staying one week or more, include:\n% Get data from http://nordita.org/science/visitors/list_of_visitors\n\n% Arrival date listing\n\\begin{itemize}\n\\item \\textit{.......} (.... physics) from ..., period\n\\end{itemize}\n\n\\noindent A more complete list of Nordita visitors, including short-term visits of less than a week, can be found online at {\\textless}www.nordita.org/visitors{\\textgreater}. A summary of visitors outside events, including nationality statistics, is at {\\textless}www.nordita.org/statistics/nationality\\_visitors{\\textgreater}.\n\n% ------------------------------------------------------------\n\\subsection{SCIENTIFIC PROGRAMS}\n% Get data from http://nordita.org/events\n\n........ Nordita Scientific Program took place during the period:\n\n\\begin{itemize}\n\\item \\textit{Water – the Most Anomalous Liquid}, 13 October – 7 November 2014; Coordinators: Lars G. M. Pettersson (Stockholm Univ.), Anders Nilsson (Stanford Univ.), Richard H. Henchman (Univ.\\ of Manchester)\n\\end{itemize}\n\n\\noindent A selection of upcoming programs:\n\n\\begin{itemize}\n\\item \\textit{Extended Theories of Gravity}, 2–20 March 2015; Coordinators: Kari Enqvist (Univ.\\ of Helsinki), Tomi Koivisto (Nordita), David Fonseca Mota (Univ.\\ of Oslo), Fawad Hassan (Stockholm Univ.), Lavinia Heisenberg (Nordita)\n\\end{itemize}\n\n\\noindent The complete list of Nordita events, including programs, conferences and schools, can be found online at {\\textless}www.nordita.org/events{\\textgreater}. Statistics including nationality of program participants is at {\\textless}www.nordita.org/statistics/nationality\\_programs{\\textgreater}.\n\n% ------------------------------------------------------------\n\\subsection{CONFERENCES, WORKSHOPS, AND SCHOOLS}\n% Get data from http://nordita.org/events\n\nThe following events have been organized and/or co-sponsored by Nordita during the period of this report:\n\n\\begin{itemize}\n\\item \\textit{Dark Energy Interactions}, 1–3 October 2014; Coordinators: Tomi Koivisto (Nordita), David Fonseca Mota (Univ.\\ of Oslo)\n\\end{itemize}\n\n\\noindent A selection of upcoming shorter events:\n\n\\begin{itemize}\n\\item \\textit{The 6th Nordic Workshop on Statistical Physics: Biological, Complex and Non-Equilibrium Systems}, 25–27 February 2015; Coordinators: Ralf Eichhorn (Nordita), Alberto Imparato (Aarhus Univ.)\n\\end{itemize}\n\n% ------------------------------------------------------------\n\\subsection{PUBLICATIONS}\n% Get data from http://nordita.org/preprints\n\n% Modify this text so that publication history is kept:\nA total of 181 Nordita preprints were registered in 2015, and 5 so far in 2016.\\\\\n(In 2014 a total of 152 preprints were registered, 121 in 2013, and 110 in 2012.)\n\n\\bigskip\n\n\\noindent All Nordita preprints are listed online at: {\\textless}www.nordita.org/preprints{\\textgreater}.\\\\\nPreprint statistics is at {\\textless}www.nordita.org/statistics/preprint{\\textgreater}.\n\n% ------------------------------------------------------------\n\\subsection{EXTERNAL FUNDING}\n\n\\begin{itemize}\n \\item \\textit{....} (... physics) was awarded ..........\n\\end{itemize}\n\n% ------------------------------------------------------------\n\\subsection{OTHER ISSUES}\n\n\\subsubsection{Funding from the Swedish Research Council (VR)}\n\n.......\n\n\\subsubsection{Funding from the Henrik Granholm Foundation}\n\n........\n\n\\subsubsection{Funding from the Knut and Alice Wallenberg Foundations}\n\n........\n\n\\subsubsection{Indirect support from the Faculty of Science, Stockholm University}\n\n.........\n\n% ------------------------------------------------------------\n\n\\bigskip\n\\end{document}";
     $stdout .= " </div>\r\n";
     // ------------------------
     return $stdout;
 }