static function getSignature() { //people::loadClass(); $stdout = ""; // ------------------------------ // Obtain user data // ------------------------------ functions::gpc_declare_input("usr", false); functions::gpc_declare_input("beenthere", false, true); $userdata = functions::callMethod('people', 'lib/people', 'doorlabelData'); // yes, get doorlabel data if (empty($userdata)) { return BLURB_SORRY_PEOPLE_SEARCH; } // ------------------------------ // Adapt user data // ------------------------------ $entry = array(); if (isset($GLOBALS["usr"]) && $GLOBALS["usr"]) { $entry = $userdata[$GLOBALS["usr"]]; if ($entry["nw_user"] == "sigste") { $entry["nw_fullname"] = str_replace("igurdur", "igurður", $entry["nw_fullname"]); } if (!class_exists("fromdb_cv", FALSE)) { require_once PATH_CLASSES . "/fromdb/cv.php"; } $dbCv = new fromdb_cv(); $cvitems = $dbCv->getCvs(); $entry["nw_cv"] = isset($cvitems[$entry["nw_user"]]) ? $cvitems[$entry["nw_user"]] : ""; } // ------------------------------ // Output user data or input form // ------------------------------ if (count($entry)) { $sig = self::constructSignatures($entry, "en"); //$userdata = functions::callMethod('people','lib/people','doorlabelData'); // yes, get doorlabel data //$stdout .= self::outputSignature($userdata[$GLOBALS["usr"]]); //$showform = 0; /* FOR SIGNATURE FILES header("Content-Type: application/octet-stream"); print utf8_decode(self::outputSignature($entry)); die(); */ $stdout .= "<div class='col-content-left'>\r\n" . " <ul class='tightlist'>\r\n" . " <li class='bottommargin'>Select a <a href='" . $_SERVER["PHP_SELF"] . "?usr="******"usr"] . "#text'><strong>text signature</strong></a></li>\r\n" . " <li class='bottommargin'>Select a <a href='" . $_SERVER["PHP_SELF"] . "?usr="******"usr"] . "#graphic'><strong>graphic (HTML formatted) signature</strong></a></li>\r\n" . " <li class='bottommargin'>" . "<a href='" . $_SERVER["PHP_SELF"] . "#maildb_doorlabel'><strong>Back to E-Mail Signature Page</strong></a></li>\r\n" . " </ul>\r\n" . "</div> <div class='col-content-right'>\r\n" . functions::OutputWikiPage('0', '2458') . "</div><div style='clear:both'><br></div>\r\n" . "\r\n"; foreach ($sig as $type => $si) { $stdout .= PAGE_BREAK . "<hr id='" . $type . "' style='margin-top:2em'>\r\n"; foreach ($si as $id => $s) { $stdout .= "<h4>" . ucfirst($type) . " Signature Example #" . $id . "</h4>\r\n" . self::outputSignature($s, $type) . "\r\n" . "\r\n"; } } } else { // leave vertical space for error messages unset($GLOBALS["usr"]); $stdout .= self::outputSignatureForm($userdata); } return $stdout; }
public static function outputStaticDisplayColumns() { $column = array(); // -- CLOCK + CURRENT EVENT + APOD $column[1] = " <div class='@ col narrow'>\r\n" . "\r\n" . self::outputDisplayTime("display-time") . " <div class='column-clear'></div>\r\n" . "\r\n" . "[BUS]" . " <div class='column-clear'></div>\r\n" . "\r\n" . functions::callMethod("event", "lib/event", "outputEventCurrentEntrance", "display-currentevent") . functions::callMethod("widget", "lib/widget", "Wapod", "display-apod", "widget-table") . " <div class='column-clear'></div>\r\n" . "\r\n" . " </div> <!-- col narrow -->\r\n" . "\r\n"; // -- COLLOQUIUM + TIP OF THE DAY + VISITORS $content = functions::callMethod("event", "lib/event", "outputColloquiumWidget", "display-colloquium", "month", "widget-table") . self::outputDisplayTip("display-tip") . functions::callMethod('event', 'lib/event', 'OutputArrivingVisitors', 'display-visitors', 'today'); if (empty($content)) { $content = functions::callMethod("preprint", "lib/preprint", "OutputRecentPreprints", "display-preprints", "", "", "0", "1", "1"); } $column[2] = " <div class='@ col medium'>\r\n" . "\r\n" . $content . " <div class='column-clear'></div>\r\n" . "\r\n" . " </div> <!-- col medium -->\r\n" . "\r\n"; return $column; }
public static function outputPositionsDropdown($text = "data", $id = "position_id", $maxChars = 35) { $stdout = ""; $data = array(); functions::gpc_declare_input($id, "", false); // ----------------------------- // -- Obtain data // ----------------------------- $campaigns = functions::callMethod('fromdb_nwpositions', 'fromdb/nwpositions', 'getCampaigns'); if (empty($campaigns)) { return ""; } foreach ($campaigns as $regend => $arr) { foreach ($arr as $idx => $a) { $data[$regend . " " . $idx] = array($id => $a[$id], "title" => isset($a["title"]) ? $a["title"] : "", "regend" => isset($a["regend"]) ? $a["regend"] : ""); } } krsort($data); // ----------------------------- // -- Dropdown list // ----------------------------- $dropdownList = " <strong>Select the Nordita position</strong> for which you want to display the " . $text . ":\r\n" . " <br><select name='" . $id . "' onchange='submit()' style='font-size:1.1em'>\r\n" . " <option value='0'>--- select from list ---</option>\r\n"; foreach ($data as $pos) { $lbl = functions::truncateStringByWord($pos["title"], $maxChars); $lbl = substr($pos["title"], 0, $maxChars); if ($maxChars < strlen($pos["title"])) { $lbl .= "..."; } $dropdownList .= " <option value='" . $pos["position_id"] . "'" . (isset($_REQUEST[$id]) && $pos[$id] == $_REQUEST[$id] ? " selected" : "") . (strtotime($pos["regend"]) >= time() ? " class='future'>" . $pos["regend"] . " " . $lbl : " class='past'>" . $pos["regend"] . " [" . $lbl . "]") . "</option>\r\n"; } // end foreach $dropdownList .= " </select>\r\n" . "\r\n"; // ----------------------------- $stdout .= " <div class='only_online'>\r\n" . " <form " . "action='" . $_SERVER["PHP_SELF"] . "' " . "method='POST' " . "enctype='multipart/form-data' " . "name='ST1'>\r\n" . $dropdownList . " </form>\r\n" . " </div>\r\n" . "\r\n"; return $stdout; }
public static function authenticateByMypear($login, $pwd) { if (!OK_TO_CALL_MYPEAR && !IS_TESTSERVER) { return false; } //TODO: translate from ($login,$pwd) to MyPear GPC input data // -------------------------------------- // -- Load the entire myPear framework (about 47 classes). // This will also run myPear authentication, and if successful, the variables // $_SESSION["bAuth"]["email"] and bAuth::$av // are created, and the browser is redirected to the requested page. // MyPear authentication is run by bAuth->__construct(). // If authentication is handled by myPear, the session variable // $_SESSION["mypear_auth_attempted"] is set in order to capture // authentication failiure. // -------------------------------------- $_SESSION["mypear_auth_attempted"] = 1; if (IS_TESTSERVER) { echo "<h3>Classes before bAuth()</h3>"; print_r(get_declared_classes()); } auth::initializeBauth(); if (IS_TESTSERVER) { echo "<hr><h3>Classes after bAuth()</h3>"; print_r(get_declared_classes()); } // 0-130 (PHP) 131-132 (nw) 133-180 (myPear) // -------------------------------------- // -- If authentication was done by myPear, translate authentication results to // NW-style variables // -------------------------------------- if (!isset($_SESSION["nwAuth"]["authenticated"]) && isset($_SESSION["bAuth"]["email"])) { $_SESSION["nwAuth"]["authenticated"] = $_SESSION["bAuth"]["email"]; } if (!isset($_SESSION["nwAuth"]["identity"]) && isset(bAuth::$av)) { self::setUsername(bAuth::$av->getIdentity()); // username $_SESSION["nwAuth"]["identity"] = bAuth::$av->nameSimple(); // full name // Bugfix for strange UTF-8 decoding error... $_SESSION["nwAuth"]["identity"] = str_replace(chr(227), chr(195), utf8_decode($_SESSION["nwAuth"]["identity"])); $_SESSION["nwAuth"]["institute"] = bAuth::$av->getInst(); // institute if (self::getUsername() == "hvzm") { $_SESSION["nwAuth"]["institute"] = "Nordita"; } // fix if (in_array(self::getUsername(), array("yb", "iourib"))) { $_SESSION["nwAuth"]["institute"] = "AlbaNova,Nordita"; } // fix //TODO: tillfällig fix; kolla vad detta svarar mot i bAuth->$av $userdata = functions::callMethod('people', 'lib/people', 'getPeopleArray'); $_SESSION["nwAuth"]["employeegrp"] = isset($userdata[self::getUsername()]) && isset($userdata[self::getUsername()]["nw_employeeTitleGrp"]) ? $userdata[self::getUsername()]["nw_employeeTitleGrp"] : ""; } }
public static function getEventCalendarData($selectAll = FALSE) { functions::gpc_declare_input("vert", 0, true); $allConfids = self::getAgendaConferenceIdsForNorditaEvents(); if (!is_array($allConfids) || empty($allConfids)) { return array(); } $calendar = array(); $proglist = array(); $eventIdToTitle = array(); $eventIdToPath = array(); $grid = array(); foreach ($allConfids as $confId) { $oneprogram = functions::callMethod('event', 'lib/event', 'getEventByAgendaid', $confId); if (!empty($oneprogram)) { $yr = date("Y", $oneprogram["from"]); if (substr($oneprogram["startdate"], -5) != "01-01" && ($selectAll || date("Y") <= $yr)) { $calendar[$yr][date("z", $oneprogram["from"])][] = $oneprogram["id"]; $calendar[$yr][date("z", $oneprogram["to"])][] = -$oneprogram["id"]; $eventIdToTitle[$oneprogram["id"]] = $oneprogram["title"]; $eventIdToPath[$oneprogram["id"]] = $oneprogram["subpath"]; unset($coord); if (isset($oneprogram["chairs"]) && is_array($oneprogram["chairs"])) { foreach ($oneprogram["chairs"] as $ch) { $coord[] = $ch["av_firstname"] . " " . $ch["av_lastname"]; } } $proglist[$oneprogram["startdate"]] = array("title" => $oneprogram["title"], "id" => $oneprogram["id"], "subpath" => $oneprogram["subpath"], "startdate" => $oneprogram["startdate"], "chairlist" => isset($coord) ? implode(", ", $coord) : "", "enddate" => $oneprogram["enddate"], "blurb" => "", "eventtype" => $oneprogram["eventtype"], "period" => $oneprogram["period"]); } } } // end foreach ksort($calendar); foreach ($calendar as $yr => $cal) { ksort($cal); $calendar[$yr] = $cal; } ksort($proglist); foreach ($calendar as $yr => $cal) { $firsttime = mktime(0, 0, 0, 1, 1, $yr); $lastday = date("z", mktime(0, 0, 0, 12, 31, $yr)); $idx = array(); for ($day = 0; $day <= $lastday; $day++) { $thistime = mktime(0, 0, 0, 1, $day + 1, $yr); $thisdate = date("j", $thistime); $thismonth = date("n", $thistime); if (isset($calendar[$yr][$day])) { foreach ($calendar[$yr][$day] as $v) { if ($v < 0) { unset($idx[abs($v)]); } else { $idx[$v] = $v; } } } if ($GLOBALS["vert"]) { $grid[$yr][$thisdate][$thismonth] = join(" ", $idx); for ($i = $thisdate + 1; $i <= 31; $i++) { // fill to end of month $grid[$yr][$i][$thismonth] = NULL; } } else { $grid[$yr][$thismonth][$thisdate] = join(" ", $idx); for ($i = $thisdate + 1; $i <= 31; $i++) { // fill to end of month $grid[$yr][$thismonth][$i] = NULL; } } // end if } // end foreach } return array("proglist" => $proglist, "eventIdToTitle" => $eventIdToTitle, "eventIdToPath" => $eventIdToPath, "grid" => $grid); }
function getEventsParticipants($confid, $onlyaccepted = true, $allowrejected = false) { if (is_array($confid)) { return array(); } // -------------------------- // We can't trust VM data to be updated correctly, if changes are made to // participant data in the Agenda. Take data directly form the Agenda, by // way of the nw_events database. $basic = functions::callMethod('fromdb_nwevents', 'fromdb/nwevents', 'getEventsParticipantsBasicdata', $confid); // -------------------------- $statusString = $onlyaccepted ? "AND (V.v_status = 'STATUS_YES')" : ($allowrejected ? "" : "AND (V.v_status <> 'STATUS_NO')"); $sql = "\n SELECT\n E.e_name,\n A.av_firstname AS 'firstname',\n A.av_lastname AS 'lastname',\n A.av_salutation AS 'salutation',\n A.av_institute AS 'institute',\n A.av_city AS 'city',\n A.av_residentship AS 'country',\n A.av_email AS 'email',\n A.av_photo AS 'photo',\n FROM_UNIXTIME(V.v_start,'%Y-%m-%d') AS 'start',\n FROM_UNIXTIME(V.v_end,'%Y-%m-%d') AS 'end',\n GREATEST(IFNULL(X.exp_travel,0),IFNULL(X.exp_travel_est,0)) AS 'exp_travel',\n GREATEST(IFNULL(X.exp_living,0),IFNULL(X.exp_living_est,0)) AS 'exp_living',\n GREATEST(IFNULL(X.exp_perdiem,0),IFNULL(X.exp_perdiem_est,0)) AS 'exp_perdiem',\n GREATEST(IFNULL(X.exp_other,0),IFNULL(X.exp_other_est,0)) AS 'exp_other',\n V.v_status AS 'status'\n FROM\n abs_visits AS V\n LEFT JOIN zzz_avatars AS A ON A.av_id=V.v_avid\n LEFT JOIN abs_events AS E ON E.e_code=SUBSTRING(V.v_code,1,4)\n LEFT JOIN abs_expenses AS X ON X.exp_vid=V.v_id\n WHERE\n (E.e_code='" . $confid . "') " . $statusString . "\n ORDER BY\n A.av_lastname,A.av_firstname"; $res = $this->query($sql, IS_TESTSERVER); // includes a call to connect $data = array(); $GLOBALS["eventTitle"] = ""; if ($this->num_rows($res)) { while ($cell = $this->next_record_assoc($res)) { $cell = array_map("stripcslashes", $cell); if (isset($basic[$cell["email"]])) { foreach ($basic[$cell["email"]] as $k => $v) { $cell[$k] = $v; } } $data[$cell["lastname"] . $cell["email"]] = $cell; $GLOBALS["eventTitle"] = $cell["e_name"]; } // end while } ksort($data); // -------------------------- return $data; }
private function buildConfigOfPageUpdate() { // ----------------------------------------------------------- // -- (1) Update $this->configOfPage with menu configuration of current page // ----------------------------------------------------------- if (isset($this->allMenusArray[$this->pagePath])) { foreach ($this->allMenusArray[$this->pagePath] as $field => $value) { $this->setConfig($field, $value); } } // ----------------------------------------------------------- // -- (2) Massage some of the fields in $this->configOfPage // ----------------------------------------------------------- if (!$this->getConfig("requirelogin") && $this->getConfig("access")) { $this->setConfig("logintype", "link"); } // ----------------------- if ($this->getConfig("listincontext")) { $this->setConfig("notintopmenu", 1); } // ----------------------- // Login form should always be 'medwide' // ----------------------- if (auth::isLoginType("inline") && (!auth::isAuthenticated() || auth::isLogoutRequested() || !auth::isAccessGranted())) { $this->setConfig("wide", 0); $this->setConfig("medwide", 1); $this->setConfig("rightwide", 0); //$this->setConfig("nocolophon", 1); } // ----------------------- // Any kind of login form must have stylesheet 'loginform.css' // ----------------------- if ((auth::isLoginRequired() || auth::isLoginAllowed()) && (!auth::isAuthenticated() || auth::isLogoutRequested())) { $GLOBALS[SUBSITE]["stylesheets"]["all"][] = "loginform.css"; } // ----------------------- if (IS_ERRORPAGE) { $this->setConfig("title", "Oops! Something seems to have gone wrong..."); $this->setConfig("bodyid", "error"); } // if (IS_TESTSERVER) { // $this->setConfig("robots","noindex,nofollow,noodp,noydir"); // } //TODO: convert to current framework /* if ($this->getConfig("wide") ) { unset($GLOBALS["blocks"]["top"]); unset($GLOBALS["blocks"]["subtree"]); unset($GLOBALS["blocks"]["fixedimage"]); unset($GLOBALS["blocks"]["splashimage"]); unset($GLOBALS["blocks"]["sidebar"]); $GLOBALS["blocks"]["twotop"] = 1; } else if ($this->getConfig("medwide") ) { unset($GLOBALS["blocks"]["sidebar"]); } */ // For 'people/doorlabel' if (isset($_REQUEST["us"]) && count($_REQUEST["us"]) <= 4) { $this->setConfig("nobanner", 1); $this->setConfig("nobackground", 1); $this->setConfig("nocolophon", 1); $this->setConfig("nopagetitle", 1); } // ----------------------- if (isset($_REQUEST["eventlist_select"])) { $this->setConfig("url", functions::callMethod("event", "lib/event", "getEventListUrl")); } // ----------------------- if (isset($_REQUEST["statistics_preprints"])) { switch ($_REQUEST["preprints_type"]) { case "word": $this->setConfig("plaincss", 1); $this->setConfig("nomenu", 1); $this->setConfig("nocss", 1); $this->setConfig("nocolophon", 1); $this->setConfig("nobanner", 1); $this->setConfig("nosearch", 1); $this->setConfig("nopagetitle", 1); $this->setConfig("nobackground", 1); break; case "text": $this->setConfig("bodyid", "text"); break; } } // ----------------------- // If received data from login form, check authentication and redirect on success: // ----------------------- if ((isset($_REQUEST["auth_submitted"]) || isset($_SESSION["mypear_auth_attempted"])) && auth::checkLogin()) { $this->setConfig("url", $_SERVER["PHP_SELF"]); } // ----------------------- // Possibly modify $this->configOfPage["bannertext"] // -- Initiated to "Nordic Institute <span class='only_online'><br></span>for // Theoretical Physics" in 'config_SUBSITE.php'. // -- NB that YB apps pages should be self-sufficient // ----------------------- // Legacy YB-style, with page title in banner box; probably no longer used if ($this->getConfig("titleinbanner") && !$this->getConfig("nopagetitle")) { $this->setConfig("bannertext", $this->getConfig("title")); } /* RESTORE if test tabs needed */ /* if (SHOW_TEST_TABS && IS_INDEXPAGE && isset($GLOBALS["frontselect"]) && ($GLOBALS["frontselect"]==10)) $this->setConfig("bannertext",""); */ // ----------------------- // Set $this->configOfPage["titletag"] // -- TITLE TAG IN <HEAD> // TITLE and TITLE_EXTENSION are defined in 'config.php' // ----------------------- $thetitle = ""; if (IS_ERRORPAGE) { $thetitle = TITLE . " - " . $this->httpstatus_sc . " " . $this->httpstatus_reason; } elseif (IS_INDEXPAGE) { $thetitle = TITLE . " - " . TITLE_EXTENSION; } elseif (!empty($_REQUEST["iid"])) { if (!isset($GLOBALS["newsClass"])) { if (!class_exists("fromdb_nwnews", FALSE)) { require_once PATH_CLASSES . "/fromdb/nwnews.php"; } $GLOBALS["newsClass"] = new fromdb_nwnews(); } $thearticle = $GLOBALS["newsClass"]->getIssue(NEWS_ANYISSUE, $_REQUEST["iid"]); $issue = !empty($thearticle["issue_year"]) && !empty($thearticle["issue_number"]) ? ". " . $thearticle["issue_year"] . ", Issue " . $thearticle["issue_number"] : ""; $thetitle = "Nordita Newsletter" . $issue . " - " . TITLE; } elseif (!empty($_REQUEST["u"])) { $userdata = functions::callMethod('people', 'lib/people', 'getPeopleArray'); $fullname = isset($userdata[$_REQUEST["u"]]) && !empty($userdata[$_REQUEST["u"]]["nw_fullname"]) ? $userdata[$_REQUEST["u"]]["nw_fullname"] . " - " : ""; $thetitle = $fullname . TITLE; } elseif ($this->getConfig("title")) { $thetitle = $this->getConfig("title") . " - " . TITLE; } elseif (!empty($_REQUEST["htmltitel"])) { $thetitle = $_REQUEST["htmltitel"] . " - " . TITLE; } $this->setConfig("titletag", $thetitle); /* RESTORE if test tabs needed */ /* if (SHOW_TEST_TABS && IS_INDEXPAGE && !empty($GLOBALS["frontselect"])) $this->setConfig("titletag","[" . $GLOBALS["frontselect"] . "] " . $this->getConfig("titletag")); */ }
public function updateOneEventFromAgenda($confId, $keepAllEvents = FALSE) { if (empty($confId) || !is_numeric($confId)) { return FALSE; } $default_room = ""; // ------------------------------------------------------------------ // -- Get data for $confId event from Agenda API // ------------------------------------------------------------------ //@@@ -- in updateOneEventFromAgenda() -- calls getOneEvent $event = functions::callMethod('fromdb_agenda', 'fromdb/agenda', 'getOneEvent', $confId, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE); if (empty($event)) { return FALSE; } // Remove startup programs (which have no assigned dates yet) if (!$keepAllEvents && (!isset($event["start"]) || strpos($event["start"], "01-01") !== FALSE)) { return FALSE; } //TODO: check if this $confId at all exists in the DB so that it can be updated // ------------------------------------------------------------------ // -- Get additional data for $confId event from scraping Agenda page // ------------------------------------------------------------------ //sleep(5); // to avoid DoS $event_from_scraping["agendapageisopen"] = 1; ////$thepath = "http://www.nordita.org/".$event_from_file["subpath"]."/"; // must end with "/" //$thepath = "http://agenda.albanova.se/conferenceDisplay.py?confId=".$confId; //$data = functions::acurl($thepath); // assign to variable first //$event_from_scraping["agendapageisopen"] = (strpos($data,"signInForm")===FALSE) ? 1 : 0; // ------------------------------------------------------------------ // -- Get and update data for the same event in nw_events database // ------------------------------------------------------------------ // ------------------------------- // -- Component 'event' // ------------------------------- $sql = "SELECT event_id FROM " . $this->dbprefix . "event WHERE event_id='" . $confId . "'"; $res = $this->query($sql, IS_TESTSERVER); // includes a call to connect $record_exists = $this->num_rows($res) ? 1 : 0; /* KEEP FOR REFERENCE // Select basic info about a given event, including list of organizers: SELECT E.*, GROUP_CONCAT(DISTINCT P.organizer SEPARATOR ', ') AS 'organizers' FROM event AS E LEFT JOIN ( SELECT event_id, CONCAT(av_firstname,' ',av_lastname) as 'organizer' FROM person WHERE (event_id='4393') AND (person_type='organizer') ) AS P ON P.event_id=E.event_id WHERE E.event_id='4393' GROUP BY E.event_id */ foreach (array("title", "room", "attenders") as $field) { if (!isset($event[$field])) { $event[$field] = ""; } } foreach (array("start", "end", "regstart", "regend") as $field) { if (!isset($event[$field])) { $event[$field] = DATETIME_NULL; } } if (!empty($event["room"])) { $default_room = addslashes(strip_tags(substr($event["room"], 0, 49))); } if ($record_exists) { // -- Update database record $sql = "UPDATE " . $this->dbprefix . "event " . "SET " . " title='" . addslashes(strip_tags(substr($event["title"], 0, 199))) . "'," . " room='" . addslashes(strip_tags(substr($event["room"], 0, 49))) . "'," . " start='" . addslashes(strip_tags($event["start"])) . "'," . " end='" . addslashes(strip_tags($event["end"])) . "'," . " regstart='" . addslashes(strip_tags($event["regstart"])) . "'," . " regend='" . addslashes(strip_tags($event["regend"])) . "'," . " attenders='" . addslashes(strip_tags($event["attenders"])) . "', " . " agendapageisopen='" . addslashes(strip_tags($event_from_scraping["agendapageisopen"])) . "' " . "WHERE " . " event_id='" . $confId . "'"; } else { // -- Get additional data for $confId event from manually kept data file include_once PATH_MENU . "/m_events.php"; $m_events = menu_events(); $event_from_file = array(); foreach ($m_events as $key => $e) { //TODO: not very efficient... if (strpos($key, "events/") !== FALSE && isset($e["confid"]) && $e["confid"] == $confId) { $event_from_file = $e; $event_from_file["subpath"] = str_replace("events/", "", $key); } } /* do { $event_from_file = array_shift($m_events);debug::rr($event_from_file); } while (!isset($event_from_file["id"]) || ($event_from_file["id"]!=$confId)); */ foreach (array("subpath", "blurb", "venue", "confid_parent", "surveyresponse", "youtube") as $field) { if (!isset($event_from_file[$field])) { $event_from_file[$field] = ""; } } foreach (array("surveyid") as $field) { if (!isset($event_from_file[$field])) { $event_from_file[$field] = "0"; } } $et = event::$eventTypeId; $event_from_file["etype"] = isset($et[$event_from_file["etype"]]) ? $et[$event_from_file["etype"]] : "0"; // -- Insert database record $sql = "INSERT INTO " . $this->dbprefix . "event " . " (event_id," . " title," . " room," . " start," . " end," . " regstart," . " regend," . " attenders," . " subpath," . " eventtype," . " blurb," . " venue," . " confid_parent," . " surveyid," . " surveyresponse," . " youtube," . " agendapageisopen) " . "VALUES " . " ('" . addslashes(strip_tags($confId)) . "'," . " '" . addslashes(strip_tags($event["title"])) . "'," . " '" . addslashes(strip_tags(substr($event["room"], 0, 49))) . "'," . " '" . addslashes(strip_tags($event["start"])) . "'," . " '" . addslashes(strip_tags($event["end"])) . "'," . " '" . addslashes(strip_tags($event["regstart"])) . "'," . " '" . addslashes(strip_tags($event["regend"])) . "'," . " '" . addslashes(strip_tags($event["attenders"])) . "'," . " '" . addslashes(strip_tags($event_from_file["subpath"])) . "'," . " '" . addslashes(strip_tags($event_from_file["etype"])) . "'," . " '" . addslashes(strip_tags($event_from_file["blurb"])) . "'," . " '" . addslashes(strip_tags($event_from_file["venue"])) . "'," . " '" . addslashes(strip_tags($event_from_file["confid_parent"])) . "'," . " '" . addslashes(strip_tags($event_from_file["surveyid"])) . "'," . " '" . addslashes(strip_tags($event_from_file["surveyresponse"])) . "'," . " '" . addslashes(strip_tags($event_from_file["youtube"])) . "'," . " '" . addslashes(strip_tags($event_from_scraping["agendapageisopen"])) . "'" . " ) "; } /* [start] => 2015-08-24 08:00 [end] => 2015-08-28 18:00 [title] => Hawking Radiation [id] => 5173 [regstart] => 2015-05-05 [regend] => 2015-08-01 [room] => 132:028 [chairs] => Array */ if (!(bool) $this->query($sql, IS_TESTSERVER)) { return FALSE; } // includes a call to connect // ------------------------------- // -- Component 'chairs' // ------------------------------- if (isset($event["chairs"]) && !empty($event["chairs"])) { $sql = "DELETE FROM " . $this->dbprefix . "person WHERE (event_id='" . $confId . "') AND (person_type='organizer')"; $this->query($sql, IS_TESTSERVER); foreach ($event["chairs"] as $item) { foreach (array("av_firstname", "av_lastname", "av_institute", "av_email") as $field) { if (!isset($item[$field])) { $item[$field] = ""; } } $sql = "REPLACE INTO " . $this->dbprefix . "person " . " (event_id," . " parent_id," . " person_type," . " av_firstname," . " av_lastname," . " av_institute," . " av_email) " . "VALUES " . " ('" . $confId . "'," . " NULL," . " 'organizer'," . " '" . addslashes(strip_tags(substr($item["av_firstname"], 0, 49))) . "'," . " '" . addslashes(strip_tags(substr($item["av_lastname"], 0, 99))) . "'," . " '" . addslashes(strip_tags(substr($item["av_institute"], 0, 199))) . "'," . " '" . addslashes(strip_tags(substr($item["av_email"], 0, 99))) . "' " . " )"; if ((bool) $this->query($sql, IS_TESTSERVER)) { } // includes a call to connect } // end foreach } // end if (isset($event["chairs"]) // ------------------------------- // -- Component 'session' [call before 'contribution'] // ------------------------------- /* KEEP FOR REFERENCE // Select basic info about sessions for a given event, including conveners: SELECT S.*, GROUP_CONCAT(DISTINCT C.convener SEPARATOR ', ') AS 'conveners' FROM session AS S LEFT JOIN ( SELECT parent_id, CONCAT(av_firstname,' ',av_lastname) as 'convener' FROM person WHERE (person_type='convener') ) AS C ON C.parent_id=S.session_id GROUP BY S.session_id // Select all conveners for a session: SELECT event_id, parent_id, GROUP_CONCAT(DISTINCT convener SEPARATOR ', ') AS 'conveners' FROM ( SELECT *, CONCAT(av_firstname,' ',av_lastname) as 'convener' FROM person WHERE (parent_id='25') AND (person_type='convener') ) AS C GROUP BY parent_id */ $session = array(); if (isset($event["session"]) && !empty($event["session"])) { $sql = "DELETE FROM " . $this->dbprefix . "session WHERE (event_id='" . $confId . "')"; $this->query($sql, IS_TESTSERVER); $sql = "DELETE FROM " . $this->dbprefix . "person WHERE (event_id='" . $confId . "') AND (person_type='convener')"; $this->query($sql, IS_TESTSERVER); foreach ($event["session"] as $item) { foreach (array("title") as $field) { if (!isset($item[$field])) { $item[$field] = ""; } } foreach (array("start", "end") as $field) { if (!isset($item[$field])) { $item[$field] = DATETIME_NULL; } } $start = addslashes(strip_tags($item["start"])); $sql = "REPLACE INTO " . $this->dbprefix . "session " . " (event_id," . " title," . " start," . " end) " . "VALUES " . " ('" . $confId . "'," . " '[" . $start . "] " . addslashes(strip_tags(substr($item["title"], 0, 199))) . "'," . " '" . $start . "'," . " '" . addslashes(strip_tags($item["end"])) . "' " . " )"; if ((bool) $this->query($sql, IS_TESTSERVER)) { // includes a call to connect $session_id = $this->insert_id(); $session[$item["title"]] = $session_id; if (isset($item["conveners"])) { foreach ($item["conveners"] as $con) { foreach (array("parent_id", "person_type", "av_firstname", "av_lastname") as $field) { if (!isset($con[$field])) { $con[$field] = ""; } } $sql = "REPLACE INTO " . $this->dbprefix . "person " . " (event_id," . " parent_id," . " person_type," . " av_firstname," . " av_lastname) " . "VALUES " . " ('" . $confId . "'," . " '" . $session_id . "'," . " 'convener'," . " '" . addslashes(strip_tags(substr($con["av_firstname"], 0, 49))) . "'," . " '" . addslashes(strip_tags(substr($con["av_lastname"], 0, 99))) . "' " . " )"; if ((bool) $this->query($sql, IS_TESTSERVER)) { } // includes a call to connect } } // end foreach convener } } // end foreach session } // end if (isset($event["session"]) // ------------------------------- // -- Component 'contribution' // ------------------------------- /* KEEP FOR REFERENCE // Select basic info about contributions for a given event or session, including speakers: //TODO: */ if (isset($event["contribution"]) && !empty($event["contribution"])) { $sql = "DELETE FROM " . $this->dbprefix . "contribution WHERE (event_id='" . $confId . "')"; $this->query($sql, IS_TESTSERVER); $contributionSpeakers[$confId] = array(); foreach ($event["contribution"] as $item) { if (!isset($item["start"]) || strtolower($item["start"]) != "none") { foreach (array("title", "description", "start", "end") as $field) { if (!isset($item[$field])) { $item[$field] = ""; } } if (!isset($item["room"])) { $item["room"] = $default_room; } $session_id = 0; if (isset($item["session_title"]) && isset($session[$item["session_title"]])) { $session_id = $session[$item["session_title"]]; } $end = functions::addDurationToDatetime($item["start"], $item["duration"]); $sql = "REPLACE INTO " . $this->dbprefix . "contribution " . " (event_id," . " session_id," . " title," . " description," . " room," . " start," . " end) " . "VALUES " . " ('" . $confId . "'," . " '" . $session_id . "'," . " '" . addslashes(strip_tags(substr($item["subject"], 0, 199))) . "'," . " '" . addslashes(strip_tags(str_replace(" ", " ", $item["description"]))) . "'," . " '" . addslashes(strip_tags($item["room"])) . "'," . " '" . addslashes(strip_tags($item["start"])) . "'," . " '" . $end . "' " . " )"; if ((bool) $this->query($sql, IS_TESTSERVER)) { // includes a call to connect $contribution_id = $this->insert_id(); if (isset($item["speakers"])) { foreach ($item["speakers"] as $speaker) { list($firstname, $lastname) = functions::splitAgendaName($speaker); $lastname = str_replace(",", "", $lastname); $sql = "REPLACE INTO " . $this->dbprefix . "person " . " (event_id," . " parent_id," . " person_type," . " av_firstname," . " av_lastname) " . "VALUES " . " ('" . $confId . "'," . " '" . $contribution_id . "'," . " 'speaker'," . " '" . addslashes(strip_tags(substr($firstname, 0, 49))) . "'," . " '" . addslashes(strip_tags(substr($lastname, 0, 99))) . "' " . " )"; if ((bool) $this->query($sql, IS_TESTSERVER)) { } // includes a call to connect } } // end foreach speaker } // end if query } } // end foreach } // end if (isset($event["contribution"]) // ------------------------------- // -- Component 'registrant' // ------------------------------- /* KEEP FOR REFERENCE // Select basic info about regstrants for a given event: //TODO: */ if (isset($event["registrant"]) && !empty($event["registrant"])) { $sql = "DELETE FROM " . $this->dbprefix . "registrant WHERE (event_id='" . $confId . "')"; $this->query($sql, IS_TESTSERVER); foreach ($event["registrant"] as $item) { foreach (array("firstname", "familyname", "salutation", "institution", "email", "address", "city", "country", "position", "phone", "homepage") as $field) { if (!isset($item[$field])) { $item[$field] = ""; } } foreach (array("registrationdate", "arrivaldate", "departuredate") as $field) { if (!isset($item[$field])) { $item[$field] = DATETIME_NULL; } } $registrationdate = date("Y-m-d", strtotime($item["registrationdate"])); if (!$registrationdate) { $registrationdate = DATETIME_NULL; } $accommodation = ""; //TODO $sql = "REPLACE INTO " . $this->dbprefix . "registrant " . " (event_id," . " av_firstname," . " av_lastname," . " av_salutation," . " av_institute," . " av_email," . " av_address," . " av_city," . " av_residentship," . " position," . " registrationdate," . " phone," . " homepage," . " arrivaldate," . " departuredate," . " accommodation) " . "VALUES " . " ('" . $confId . "'," . " '" . addslashes(strip_tags(substr($item["firstname"], 0, 49))) . "'," . " '" . addslashes(strip_tags(substr($item["familyname"], 0, 99))) . "'," . " '" . addslashes(strip_tags($item["salutation"])) . "'," . " '" . addslashes(strip_tags(substr($item["institution"], 0, 199))) . "'," . " '" . addslashes(strip_tags(substr($item["email"], 0, 99))) . "'," . " '" . addslashes(strip_tags(substr($item["address"], 0, 199))) . "'," . " '" . addslashes(strip_tags(substr($item["city"], 0, 99))) . "'," . " '" . addslashes(strip_tags($item["country"])) . "'," . " '" . addslashes(strip_tags(substr($item["position"], 0, 199))) . "'," . " '" . addslashes(strip_tags($registrationdate)) . "'," . " '" . addslashes(strip_tags(substr($item["phone"], 0, 49))) . "'," . " '" . addslashes(strip_tags(substr($item["homepage"], 0, 199))) . "'," . " '" . addslashes(strip_tags($item["arrivaldate"])) . "'," . " '" . addslashes(strip_tags($item["departuredate"])) . "'," . " '" . addslashes(strip_tags($accommodation)) . "' " . " )"; if ((bool) $this->query($sql, IS_TESTSERVER)) { } // includes a call to connect } // end foreach } // end if (isset($event["registrant"])) // ------------------------------------------------------------------ return TRUE; }
private static function manageSubscriptionsAddStaff($table = "subscriber") { $stdout = ""; $record["email"] = array(); $record["comment"] = ""; $record["source"] = NEWS_STAFF; $record["status"] = NEWS_ACTIVE; $userdata = functions::callMethod('people', 'lib/people', 'getPeopleArray'); if (empty($userdata)) { return false; } foreach ($userdata as $u) { if (isset($u["nw_email_plain"])) { $record["email"][] = $u["nw_email_plain"]; } } $_SESSION["inserted_staff"] = count($record["email"]); if (!$GLOBALS["subscriptionClass"]->insertSubscriber($table, $record)) { return false; } else { return true; } return $stdout; }
private static function outputCombinedSearch($queryData, $searchResults, $peopleResult, $wid = "os_main") { // -------------------------------------------------------------------------- // -- SETUP VARIABLES // -------------------------------------------------------------------------- // -------------------- // -- ... // -------------------- $rootUri = "http://" . $_SERVER["HTTP_HOST"] . preg_replace("/\\/[^\\/]*\$/", "/", $_SERVER["PHP_SELF"]); // -------------------- // -- GPC variables, if not already initiated // -------------------- functions::gpc_declare_input("start", 1, false); $GLOBALS["start"] = (int) $GLOBALS["start"]; functions::gpc_declare_input("end", 1, false); $GLOBALS["end"] = (int) $GLOBALS["end"]; // -------------------- // -- Massage $queryData array // -------------------- $ignoredTerms = ""; if (isset($queryData["allterms"]) && isset($queryData["terms"])) { $ignoredTerms = array_filter(array_diff($queryData["allterms"], $queryData["terms"])); $ignoredTerms = ($ignoredTermsCount = count($ignoredTerms)) ? implode(" ", $ignoredTerms) : ""; } if (!isset($queryData["category"]) && isset($GLOBALS["ctg"])) { $queryData["category"] = $GLOBALS["ctg"]; } if (!isset($queryData["original"])) { $queryData["original"] = ""; } // -------------------- // -- Massage display page interval // -------------------- if (count($searchResults)) { $GLOBALS["start"] = count($searchResults) <= SEARCH_MAX_RESULTS_PER_PAGE ? 1 : $GLOBALS["start"]; $GLOBALS["end"] = min($GLOBALS["start"] + SEARCH_MAX_RESULTS_PER_PAGE - 1, count($searchResults)); } // -------------------------------------------------------------------------- // -- PREPARE COMPONENTS OF OUTPUT // -------------------------------------------------------------------------- if (!class_exists("people", FALSE)) { require_once PATH_CLASSES . "/lib/people.php"; } $peopleResultList = functions::callMethod('people', 'lib/people', 'OutputPeople', "search", "box", "people-list", "", $peopleResult); $peopleResultBlurb = functions::callMethod('people', 'lib/people', 'outputPeopleSearchBlurb', $queryData["original"], count($peopleResult)); // -------------------- $pageResultList = self::outputPageSearchResult($searchResults, $rootUri); $pageResultBlurb = self::outputPageSearchBlurb($queryData["original"], $queryData["category"], count($searchResults)); // -------------------- $searchform = self::searchfieldCombined($queryData["original"], $queryData["category"]); $searchtips = " <ul class='os_searchtips'>\r\n" . (defined(SEARCH_TERMLENGTH) ? " <li>Search terms with fewer than " . SEARCH_TERMLENGTH . " characters are ignored</li>\r\n" : "") . " <li>Terms without prefix are treated as optional (logical OR)</li>\r\n" . " <li>Prefix terms with a plus-sign (+) to make them requred</li>\r\n" . " <li>Prefix terms with a minus-sign (-) " . "to exclude terms</li>\r\n" . " <li>Enclose groups of terms in quotes ("") to search for phrases (only in web page search)</li>\r\n" . " </ul>\r\n" . "\r\n"; $messageform = ""; if ($queryData["category"] != "") { $messageform = " <form action='" . $_SERVER["PHP_SELF"] . "' method='post' class='os_msg'" . " style='margin-top:1em'" . ">\r\n" . " <strong>»</strong> Try this search in \r\n" . " <input type='submit' value='all Nordita web subsites' class='fakelink bold'>?\r\n" . " <input type='hidden' name='qry' " . "value='" . htmlspecialchars($queryData["original"]) . "'>\r\n" . " <input type='hidden' name='ctg' value=''>\r\n" . " </form>\r\n" . "\r\n"; //"<a href='" . $_SERVER["PHP_SELF"] . "?qry=".htmlspecialchars($queryData["original"])."'>all categories</a>" . } // -------------------- // -- CREATE // $output1 - top search form, or empty if there are errors // $message[] - instructions if first run, error messages if there are errors, or empty if success // $output2 - search results if success, bottom form if not first run, always instructions // -------------------- $message = array(); $output1 = $output2 = ""; /* // -------------------- // Case: No DB Connection // -------------------- if (!$GLOBALS["DDATA"]["online"]) { $message[] = "Could not establish a connection to the database.\r\n" . "<br><em>" . $GLOBALS["DDATA"]["errno"] . ": " . $GLOBALS["DDATA"]["error"] . "</em>"; // -------------------- // Case: DB Locked // -------------------- } else if ($searchResults === NULL) { $message[] = "The search database is currently being updated; " . "please try your search again in a few minutes."; // -------------------- // Case: Query Success // -------------------- // } else if (!empty($pageResultList) || !empty($peopleResultList)) { } else */ if ($queryData["original"]) { if ($ignoredTermsCount) { $message[] = "These terms were ignored: <strong>" . htmlspecialchars($ignoredTerms) . "</strong>"; } $output1 = !empty($pageResultList) || !empty($peopleResultList) ? $searchform : ""; $output2 = "<div class='col-content-left'>\r\n\r\n" . " <h2>Web Page Results</h2>\r\n" . "\r\n" . ($pageResultList ? $pageResultBlurb . " " . $pageResultList . (count($searchResults) > 2 ? $pageResultBlurb : "") : " " . BLURB_SORRY_WEB_SEARCH . $messageform) . "\r\n" . "\r\n" . "</div>\r\n" . "\r\n" . "<div class='col-content-right divider'>\r\n\r\n" . " <h2>Nordita Staff Results</h2>\r\n" . "\r\n" . ($peopleResultList ? $peopleResultBlurb . " " . $peopleResultList : " " . BLURB_SORRY_PEOPLE_SEARCH) . "\r\n" . "</div>\r\n" . "\r\n" . "<div style='clear:both'><br></div>\r\n" . "\r\n" . $searchform . $searchtips; // -------------------- // Case: No Results // -------------------- /* } elseif ($queryData["original"]) { $message[] = "<span class='red'>No matches found for " . "<strong>".trim(htmlspecialchars($queryData["original"]))."</strong></span>" . ( ($queryData["category"]) ? " when searching in Nordita web subsite <strong>" . $queryData["category"] . "</strong>" . " and among <a href='people/index.php'><strong>Nordita staff members</strong></a>" . "." : "" ); if ($ignoredTermsCount) { $message[] = "These terms were ignored: " . "<strong>" . htmlspecialchars($ignoredTerms) . "</strong>"; } $messageform = ""; if ($queryData["category"] != "") { $messageform = " <form action='" . $_SERVER["PHP_SELF"] . "' method='post' class='os_msg'>\r\n" . " Try this search in \r\n" . " <input type='submit' value='all Nordita web subsites' class='fakelink bold'>?\r\n" . " <input type='hidden' name='qry' " . "value='" . htmlspecialchars($queryData["original"]) . "'>\r\n" . " <input type='hidden' name='ctg' value=''>\r\n" . " </form>\r\n" . "\r\n"; //"<a href='" . $_SERVER["PHP_SELF"] . "?qry=".htmlspecialchars($queryData["original"])."'>all categories</a>" . } $output2 = $messageform . $searchform . $searchtips; */ // -------------------- // Case: No Query // -------------------- } else { // $message[] = // "Please enter your search terms in the text field. <br>You may also limit your search to only the main Nordita web site, or to one of the specialized subsites."; $output1 = $searchform; $output2 = $searchtips; } // end if $messages = ""; foreach ($message as $mtext) { $messages .= " <p class='os_msg'>" . $mtext . "</p>\r\n"; } if (!empty($messages)) { $messages .= "\r\n"; } // -------------------------------------------------------------------------- // -- OUTPUT // -------------------------------------------------------------------------- $stdout = "<div" . (!empty($wid) ? " id='" . $wid . "'" : "") . ">\r\n" . "\r\n" . " <!-- Orca Search v2.3a -->\r\n" . "\r\n" . $output1 . $messages . $output2 . "</div>\r\n" . "\r\n"; return $stdout; }
public static function outputStartpageContentItem($wid = "startpage-content-item", $class = "", $date = "", $headerInsideDiv = FALSE) { $stdout = ""; $items = array(); $hdr = "Nordita News"; $seealso = " <p class='seealso dots'><a href='news/index.php'>" . "See other Nordita News items</a></p>\r\n"; // ----------------- //if (date("Y-m-d")<"2016-09-12") $items[] = "<p>Jongbae Hong and D.S.L. Abergel, '<em>A universal explanation of tunneling conductance in exotic superconductors</em>',</p>\r\n" . "<p>We provide a comprehensive explanation of the tunneling conductance...</p>\r\n"; // ----------------- if (empty($items)) { return ""; } $stdout .= implode("\r\n", $items) . $seealso; return functions::callMethod("widget", "lib/widget", "WoutputBoxOrWidget", $wid, $class, $hdr, $stdout, $headerInsideDiv); }
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"]) ? "—" . $dayevent["endtime"] : ""); $sel["room"] = isset($dayevent["room"]) ? ucfirst($dayevent["room"]) : ""; $sel["title"] = """ . $dayevent["title"] . """; $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"] . "&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") . "]" . " " . "[" . ($GLOBALS["w"] == 1 ? "<a href='" . $_SERVER["PHP_SELF"] . "?w=0' class='bold' rel='nofollow'>Next Week</a>" : "Next Week") . "]" . "</p>\r\n" . "\r\n" . "<pre class='box letter'>\r\n" . "Dear Norditans,\r\n" . "\r\n" . "-------------\r\n\r\n"; if (count($visits)) { $visitortext = ""; foreach ($visits as $type) { if (isset($type["Visitors"])) { foreach ($type["Visitors"] as $v) { $visitortext .= "*" . $v["name"] . "*\r\n" . " " . $v["affiliation"] . "\r\n" . " " . $v["dates"] . "\r\n" . "\r\n"; } } } $stdout .= ($GLOBALS["w"] == 0 ? "Next" : "This") . " week, Nordita welcomes these guests:\r\n" . "\r\n" . $visitortext . "-------------\r\n\r\n"; } /* "*MONDAY, __________ 2011* 12:30- Nordita West Seminar Room (122:026) ASTRO-PH LUNCH MEETING http://wiki.nordita.org/index.php/Astro-ph_Meeting " . */ if (empty($talks_selection) && empty($events)) { $stdout .= "Nothing of theoretical interest will happen " . ($GLOBALS["w"] == 0 ? "next" : "this") . " week!\r\n" . "-------------\r\n\r\n"; } else { if (!empty($events)) { $stdout .= "Major Nordita Events " . ($GLOBALS["w"] == 0 ? "next" : "this") . " week:\r\n\r\n"; foreach ($events as $key => $ev) { $stdout .= " During the week, the " . str_replace("nordita", "Nordita", $ev["eventtype"]) . "\r\n" . " "" . strtoupper($ev["title"]) . ""\r\n" . " " . ($sunday < $ev["start"] ? "starts on " . functions::readableDateInterval($ev["start"], $ev["start"]) : "continues") . ", and will continue until " . functions::readableDateInterval($ev["end"], $ev["end"]) . ".\r\n"; if (!empty($ev["subpath"])) { $stdout .= " " . URL_PREFIX . "/" . $ev["subpath"] . "\r\n"; } elseif (!empty($ev["id"])) { $stdout .= " http://agenda.albanova.se/conferenceDisplay.py?confId=" . $ev["id"] . "\r\n"; } $stdout .= "\r\n"; } $stdout .= "-------------\r\n\r\n"; } if (!empty($talks_selection)) { $stdout .= "Here are some of the seminars at Nordita and AlbaNova " . ($GLOBALS["w"] == 0 ? "next" : "this") . " week:\r\n\r\n"; foreach ($talks_selection as $day => $record) { $stdout .= "*" . strtoupper(date("l, j F Y", strtotime($day))) . "*\r\n\r\n"; foreach ($record as $start => $dayevent) { if (count($dayevent)) { if (in_array(strtolower($dayevent["eventtype"]), array("nordita program", "program", "conference", "workshop", "meeting", "school"))) { $stdout .= " " . ucfirst($dayevent["eventtype"]) . "\r\n" . " " . $dayevent["period"] . "\r\n" . "\r\n"; } else { $stdout .= " " . (!empty($dayevent["period"]) ? $dayevent["period"] : "") . (!empty($dayevent["room"]) ? " " . $dayevent["room"] : "") . "\r\n" . (!empty($dayevent["heading"]) ? " " . strtoupper($dayevent["heading"]) . "\r\n" : "") . (!empty($dayevent["thespeaker"]) ? " " . $dayevent["thespeaker"] . "\r\n" : "") . (!empty($dayevent["title"]) ? " " . $dayevent["title"] . "\r\n" : "") . (!empty($dayevent["url"]) ? " Info: " . $dayevent["url"] . "\r\n" : "") . (!empty($dayevent["ical"]) ? " Add to calendar: " . $dayevent["ical"] . "\r\n" : "") . "\r\n"; } } } // end if } // end foreach $stdout .= "-------------\r\n\r\n"; } } // end if (empty($talks_selection)) // ---------------------- move to suitable class! $dbWiki = new fromdb_nwwiki(); $dbWiki->get_text("Cake"); $txt = $dbWiki->wikipage_text["text"]; preg_match_all("~<td>([^<]*)</td>[^<].*<td>([^<]*)</td>~mU", $txt, $res); foreach ($res[1] as $ix => $v) { $cake[strtotime($v)] = $res[2][$ix]; } $delta = $GLOBALS["w"] == 0 ? 8 : 1; $monday = date("Y-m-d", time() - 3600 + ($delta - date("w", time() - 3600)) * 86400); $m = strtotime($monday); $nextm = $m + 604800; $stdout .= "*MONDAY CAKE, " . strtoupper(functions::readableDateInterval($monday, $monday)) . "*\r\n"; //functions::readableDateInterval($monday,$monday) . if (isset($cake[$m]) && strlen($cake[$m]) > 5) { $stdout .= " Cakemaster this week is " . $cake[$m] . ".\r\n"; } else { $stdout .= " No cakemaster appointed!\r\n"; } if (isset($cake[$nextm]) && strlen($cake[$nextm]) > 5) { $stdout .= " (Cakemaster on " . date("l, F jS", $nextm) . " the following week, will be " . $cake[$nextm] . ".)\r\n"; } $stdout .= " " . URL_PREFIX . "/cake\r\n"; // ---------------------- return str_replace("()", "", $stdout) . "</pre>"; }
public static function WoutputReports($private = false) { $external = $self = $annual = $director = $policy = $programs = $surveys = ""; $sfiles = $li = $event = array(); // ----------------------------------------------------------- $directories = array("annual_reports", "directors_reports", "evaluations", "policies", "program_reports", "scientific_advisory_committee_reports", "surveys"); foreach ($directories as $dir) { $files = scandir(INCLEVEL . "/" . PATH_DOCSX . "/" . $dir); $sfiles[$dir] = array(); foreach ($files as $file) { if (!in_array($file, array(".", "..", "index.php"))) { $sfiles[$dir][] = $file; } } krsort($sfiles[$dir]); } // ----------------------------------------------------------- $d = "evaluations"; foreach ($sfiles[$d] as $file) { if (preg_match("#nordita_evaluation_report_(\\d*)#", $file, $res)) { $li[$d][] = " <li><a href='" . PATH_DOCSX . "/" . $d . "/" . $file . "'>" . "<strong>Evaluation Report " . $res[1] . "</strong></a></li>\r\n"; } elseif (preg_match("#nordita_self_evaluation_(\\d*)#", $file, $res)) { $li["self"][] = " <li><a href='" . PATH_DOCSX . "/" . $d . "/" . $file . "'>" . "<strong>Self-Evaluation " . $res[1] . "</strong></a></li>\r\n"; } } // ----------------------------------------------------------- $d = "annual_reports"; foreach ($sfiles[$d] as $file) { if (preg_match("#nordita_annual_report_for_(\\d*)#", $file, $res)) { $li[$d][] = " <li><a href='" . PATH_DOCSX . "/" . $d . "/" . $file . "'>" . "<strong>Annual Report for " . $res[1] . "</strong></a></li>\r\n"; } } // ----------------------------------------------------------- $d = "directors_reports"; foreach ($sfiles[$d] as $file) { if (preg_match("#nordita_directors_report_(\\d*)_(\\d*)#", $file, $res)) { $li[$d][] = " <li><a href='" . PATH_DOCSX . "/" . $d . "/" . $file . "'>" . "<strong>Director's Report " . date("F", strtotime("2015-" . $res[2] . "-01")) . " " . $res[1] . "</strong></a></li>\r\n"; } } // ----------------------------------------------------------- $policy .= " <ul class='tightlist'>\r\n" . " <li><a href='" . PATH_DOCSX . "/policies/nordita_today_and_tomorrow_november_2014.pdf'>" . "<strong>Nordita: Today and Tomorrow</strong></a> (November 2014)</li>\r\n" . " <li><a href='" . PATH_DOCSX . "/policies/nordic_value_of_nordita_may_2013.pdf'>" . "<strong>The Nordic Value of Nordita</strong></a> (May 2013)</li>\r\n" . " <li><a href='" . PATH_DOCSX . "/policies/nordita_the_next_ten_years_march_2008.pdf'>" . "<strong>Nordita: The Next Ten Years</strong></a> (March 2008)</li>\r\n" . " </ul>\r\n"; // ----------------------------------------------------------- $d = "program_reports"; foreach ($sfiles[$d] as $file) { if (preg_match("#report_(.*)\\.#", $file, $res) && isset($res[1])) { // $event[$res[1]]["report"] = $file; } } $d = "surveys"; foreach ($sfiles[$d] as $file) { if (preg_match("#[\\d-]*-([^.]*)#", $file, $res) && isset($res[1])) { $event[$res[1]]["survey"] = $file; } } foreach ($event as $label => $record) { $data = functions::callMethod('event', 'lib/event', 'getEventByPath', $label); if (isset($data["from"]) && isset($data["title"]) && isset($data["period"])) { while (isset($li["events"][$data["from"]])) { $data["from"]++; } $li["events"][$data["from"]] = " <li><strong>" . $data["title"] . "</strong> <span style='white-space:nowrap'>" . "(" . $data["period"] . ")</span>\r\n" . (isset($record["report"]) ? " <br><strong>»</strong> " . "<a href='" . PATH_DOCSX . "/program_reports/" . $record["report"] . "'>Organizer's Report</a>\r\n" : "") . (isset($record["survey"]) ? " <br><strong>»</strong> " . "<a href='" . PATH_DOCSX . "/surveys/" . $record["survey"] . "'>Participant Survey</a>\r\n" : "") . "</li>\r\n"; } } krsort($li["events"]); $i = $k = 1; $half = ceil(count($li["events"]) / 2); foreach ($li["events"] as $from => $record) { $li["events" . $k][] = array_shift($li["events"]); if ($i++ == $half) { $k++; } } // ----------------------------------------------------------- $minutesPath = "intranet/resources/minutes/index.php"; if (SUBSITE == "bc") { $minutesPath = "bc/meetings/minutes/index.php"; } return "<div class='col c1of3'>\r\n" . "\r\n" . " <h3>External Evaluations</h3>\r\n" . " <ul class='tightlist'>\r\n" . implode($li["evaluations"], "\r") . " </ul>\r\n" . " <h3>Self-Evaluations</h3>\r\n" . " <ul class='tightlist'>\r\n" . implode($li["self"], "\r") . " </ul>\r\n" . " <h3>Annual Reports</h3>\r\n" . " <ul class='tightlist'>\r\n" . implode($li["annual_reports"], "\r") . " </ul>\r\n" . "\r\n" . "</div> <div class='col c2of3'>\r\n" . "\r\n" . ($private ? " <h3>Director's Reports</h3>\r\n" . " <ul class='tightlist'>\r\n" . implode($li["directors_reports"], "\r") . " </ul>\r\n" . "\r\n" : "") . "</div> <div class='col c3of3'>\r\n" . "\r\n" . ($private ? " <h3>Policy Documents</h3>\r\n" . $policy : "") . (SUBSITE == "bc" ? PADDED_HR : "") . " <p><strong>»</strong> <a href='" . $minutesPath . "'>Minutes from <strong>Board meetings</strong></a>\r\n" . " <br><strong>»</strong> <a href='" . $minutesPath . "'>Minutes from <strong>Faculty meetings</strong></a></p>\r\n" . "</div><div style='clear:both;height:0'><br></div>\r\n" . "\r\n" . ($private ? PADDED_HR . " <h3 class='bottommargin'>Events: Reports from Program Organizers, " . "and Event Participant Surveys</h3>\r\n" . "<div class='col c1of2'>\r\n" . "\r\n" . " <ul class='tightlist'>\r\n" . implode($li["events1"], "\r") . " </ul>\r\n" . "\r\n" . "</div> <div class='col c2of2'>\r\n" . "\r\n" . " <ul class='tightlist'>\r\n" . implode($li["events2"], "\r") . " </ul>\r\n" . "\r\n" . "</div><div style='clear:both'><br></div>\r\n" : ""); }
public static function getEventDetails($stattype, $eventTitleArray) { if (empty($eventTitleArray) || $stattype == "visitors") { return array(); } $eventDetail = array(); // ------------------------ // Campaigns // ------------------------ if (in_array($stattype, array("applicants"))) { foreach ($eventTitleArray as $idx => $label) { if ($idx > 0 && preg_match("/([^\\[]*)\\s*\\[(.*)\\]/", $label, $res)) { $thisEventType = $typeid = $default = ""; if (stripos($res[1], "nordita fellowship") !== false) { $typeid = 1; $thisEventType = "nordita fellowship"; // $default = "on"; } elseif (stripos($res[1], "assistant pro") !== false) { $typeid = 2; $thisEventType = "assistant professor"; // $default = "on"; } elseif (preg_match("/post-?doc/i", $res[1])) { $typeid = 3; $thisEventType = "postdoc"; } elseif (stripos($res[1], "visiting phd") !== false) { $typeid = 5; $thisEventType = "visiting phd fellowship"; } elseif (stripos($res[1], "phd") !== false) { $typeid = 4; $thisEventType = "phd"; } elseif (stripos($res[1], "masterclass") !== false) { $typeid = 6; $thisEventType = "masterclass"; } $eventDetail[$typeid][$idx] = array("year" => $res[2], "title" => $label, "eventtype" => $thisEventType); } } // end foreach if (!empty($eventDetail)) { $eventDetail[0][0] = array("year" => "", "title" => "All Campaigns", "eventtype" => ""); } ksort($eventDetail); } // end if // ------------------------ // Events // ------------------------ if (in_array($stattype, array("events", "allguests"))) { $eventid = array_flip(self::$eventType); foreach ($eventTitleArray as $idx => $label) { if ($idx > 0) { $thisEventType = functions::callMethod('event', 'lib/event', 'getEventByAgendaid', $idx, "etype"); if (!empty($thisEventType)) { $year = preg_match("/([^\\[]*)\\s*\\[(.*)\\]/", $label, $res) ? $res[2] : ""; //$default = in_array($thisEventType,array("program")); $eventDetail[$eventid[$thisEventType]][$idx] = array("year" => $res[2], "title" => $label, "eventtype" => $thisEventType); } } } // end foreach ksort($eventDetail); } // end if // ------------------------ return $eventDetail; }
public static function BmyMenu($id = "mymenu", $class = "") { // class="centered" $stdout = $userIcon = $menuitems = $logoutLink = $contentblock = ""; $menuitem = array(); if (!defined("SEPARATE_LOGIN")) { define("SEPARATE_LOGIN", "<span style='color:#777' title='separate login required'>(⁎)</span> "); } // ------------------------------- // -- check if bar might not be needed // ------------------------------- if (!auth::isAuthenticated() && auth::isLoginType("inline") || auth::isLoginRequested() || !auth::isAuthenticated() && !auth::isLoginRequired() && !auth::isLoginAllowed() || $GLOBALS["documentClass"]->getConfig("nobanner")) { return ""; } // ------------------------------- // -- return with login icon if logout requested // ------------------------------- if (auth::checkLogout()) { $stdout = auth::drawLoginLink(); if (empty($stdout)) { return ""; } return " <div" . (!empty($id) ? " id='block-login'" : "") . ">\r\n" . $stdout . " </div> <!-- " . $id . " -->\r\n" . "\r\n"; } // ------------------------------- // -- obtain data // ------------------------------- $username = auth::getUsername(); $userData = functions::callMethod('people', 'lib/people', 'getUserData', $username); $userFullName = isset($userData["nw_fullname"]) ? $userData["nw_fullname"] : ""; // ------------------------------- // -- collect output snippets // ------------------------------- $iconfile = PATH_PEOPLE . "/48x48/" . $username . "-48.png"; if (file_exists(INCLEVEL . $iconfile)) { $userIcon = " <div class='my-usericon'>\r\n" . " <a href='people/staff/index.php?u=" . $username . "'>" . "<img src='" . $iconfile . "' alt='" . $userFullName . "' title='" . $userFullName . "'>" . "</a>\r\n" . " </div>\r\n" . "\r\n"; } $logoutLink = " <div id='my-logout'>\r\n" . " <form method='post' action='" . PATH_FROM_DOCROOT . "'>\r\n" . " <input type='hidden' name='login' value='0'>\r\n" . " <input type='submit' value='[Logout]' class='fakelink bold'>\r\n" . " </form>\r\n" . " </div>\r\n" . "\r\n"; $menuitem["fullname"] = array("label" => !empty($userFullName) ? $userFullName : "My Personal Data", "content" => array("1" => " <p>" . SEPARATE_LOGIN . "<em>means separate CMS login required</em></p>\r\n" . " <p><em>Note that the "Employees and Alumni" (EA) database of Nordita is independent of the HR database of KTH, so you might want to check both.</em></p>\r\n" . " <ul>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='http://cms.nordita.org/?q=ea/356353008'>View and Edit My Personal Info</a> <span class='nowrap'>[CMS-EA]</span></li>\r\n" . " </ul>\r\n", "2" => " <p>" . SEPARATE_LOGIN . "<em>means separate KTH login required</em></p>\r\n" . " <ul>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='https://hrweb.admin.kth.se/' target='_blank'>Edit My Home Address &c</a><br><em>Egenrapportering → Mina Sidor → Mina Personuppgifter</em></li>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='https://login.kth.se/password/change?l=en' target='_blank'>Change My KTH Password</a></li>\r\n" . (!empty($userData["acc_kth"]) ? " <li>" . SEPARATE_LOGIN . "<a href='https://www.kth.se/profile/" . $userData["acc_kth"] . "/' target='_blank'>Edit My KTH Online Profile</a></li>\r\n" : "") . " <li>" . SEPARATE_LOGIN . "<a href='https://www.kth.se/internt/minasidor/installningar/mail.jsp?l=en_UK&null=' target='_blank'>Edit My E-Mail Forwarding Address</a></li>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='https://www.kth.se/internt/minasidor/installningar/mail.jsp?l=en_UK&null=' target='_blank'>Check My E-Mail Aliases</a></li>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='https://login.sys.kth.se/peapshow.html' target='_blank'>Show My Eduroam Password ("Network Secret")</a></li>\r\n" . " </ul>\r\n", "3" => " <ul>\r\n" . " <li><a href='eduroam/'>Wireless Login Using Eduroam</a></li>\r\n" . " <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . " <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . " </ul>\r\n")); $menuitem["myemployment"] = array("label" => "My Employment", "content" => array("1" => "", "2" => " <p>" . SEPARATE_LOGIN . "<em>means separate KTH login required</em></p>\r\n" . " <p><em>Note that some of the sevices below do not apply for Nordita fellows (=scholarships)</em></p>\r\n" . " <ul>\r\n" . " <li><a href='http://intra.kth.se/en/anstallning' target='_blank'>My Employment at KTH</a> (Overview)</li>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='https://www.flexpay.se/fps/setLanguage.do?&languageId=12' target='_blank'>Employment Benefits "KTH For Me"</a></li>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='https://hrweb.admin.kth.se/' target='_blank'>Salary Specification</a><br><em>Egenrapportering → Mina Sidor → Lönespec Online → check+button [lönespec online (presentation)]</em></li>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='https://hrweb.admin.kth.se/' target='_blank'>Register Vacation</a><br><em>Egenrapportering → Mina Ärenden → Ledigheter</em></li>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='https://hrweb.admin.kth.se/' target='_blank'>Register Sick Leave</a><br><em>Egenrapportering → Mina Ärenden → Sjuk & Vård av...</em></li>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='https://hrweb.admin.kth.se/' target='_blank'>Register Overtime</a><br><em>Egenrapportering → Mina Ärenden → Övertid & Mertid</em></li>\r\n" . " </ul>\r\n", "3" => " <ul>\r\n" . " <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . " <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . " </ul>\r\n")); $menuitem["mytravels"] = array("label" => "My Travels", "content" => array("1" => " <p>" . SEPARATE_LOGIN . "<em>means separate CMS login required</em></p>\r\n" . " <ul>\r\n" . " <li><a href='" . URL_PREFIX . "/travel/' target='_blank'>View Nordita "Who Is Where" Travel Schedule</a></li>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='" . URL_PREFIX . "/travel/private/edit-confirm.php' target='_blank'>Edit My Travels in Nordita Travel Schedule</a></li>\r\n" . " <li><a href='intranet/job/travels/scholarship/request/' target='_blank'>Travel Request</a> (only for Nordita fellows/scholarships)</li>\r\n" . " </ul>\r\n", "2" => " <p>" . SEPARATE_LOGIN . "<em>means separate KTH login required</em></p>\r\n" . " <p><em>The KTH-RES system should only be used by Nordita employees (not fellows/scholarships)</em></p>\r\n" . " <ul>\r\n" . " <li><a href='http://intra.kth.se/en/administration/kth-res' target='_blank'>KTH-RES</a> (Overview and Guides)</li>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='https://kth.ebuilder.se/' target='_blank'>Book New Travel</a> (only for employees)<br><em>Travel → Booking</em></li>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='https://kth.ebuilder.se/' target='_blank'>Manage Travel Bills</a> (only for employees)<br><em>Travel → Travel bill</em></li>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='https://kth.ebuilder.se/ebbooking/profile/personprofile.do' target='_blank'>Edit My KTH-RES Profile</a></li>\r\n" . " </ul>\r\n", "3" => " <ul>\r\n" . " <li><a href='intranet/job/travels/'>Travel</a></li>\r\n" . " <li><a href='intranet/job/travels/employment/'>Travel for Employees</a></li>\r\n" . " <li><a href='intranet/job/travels/scholarship/'>Travel for Scholarships</a></li>\r\n" . " <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . " <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . " </ul>\r\n")); $menuitem["myguests"] = array("label" => "My Guests", "content" => array("1" => " <p>" . SEPARATE_LOGIN . "<em>means separate CMS login required</em></p>\r\n" . " <ul>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='http://cms.nordita.org/?q=vm/1735395761/1961830993'>See People I Invite</a> <span class='nowrap'>[CMS-VM]</span></li>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='http://cms.nordita.org/?q=vm/1735395761/1181421194'>Register New Guest</a> <span class='nowrap'>[CMS-VM]</span></li>\r\n" . " </ul>\r\n", "2" => "", "3" => " <ul>\r\n" . " <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . " <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . " </ul>\r\n")); $menuitem["myevents"] = array("label" => "My Events", "content" => array("1" => " <p>" . SEPARATE_LOGIN . "<em>means separate CMS login required</em></p>\r\n" . " <ul>\r\n" . " <li>" . SEPARATE_LOGIN . "<a href='http://cms.nordita.org/?q=vm/3862121824'>Manage Events I Organize</a> <span class='nowrap'>[CMS-VM]</span></li>\r\n" . " </ul>\r\n", "2" => "", "3" => " <ul>\r\n" . " <li><a href='organizers/index.php'>For Organizers of Nordita Events</a></li>\r\n" . " <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . " <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . " </ul>\r\n")); // -- NB. // The three columns in the panels need to be realized as a <table> rather than as positioned // <div> (eg. as <div class='col c1of3'> etc). For the jQuery UI tabs generated panels to have // a non-zero height, the content must not be positioned as absolute, fixed or float; just // position relative cannot generate three parallel columns; this leaves <table> as only option. foreach ($menuitem as $target => $item) { $menuitems .= " <li class='" . $target . "'>" . "<a href='" . (!empty($item["url"]) ? $item["url"] : $_SERVER["REQUEST_URI"] . "#" . $target) . "'>" . $item["label"] . "</a>" . "</li>\r\n"; if (!is_array($item["content"])) { $content = " "; } else { $content = " <table><tr>\r\n" . " <td>\r\n" . " <h4>Nordita</h4>\r\n" . (!empty($item["content"][1]) ? $item["content"][1] : " <p>—</p>\r\n") . " </td>\r\n" . " <td>\r\n" . " <h4>KTH</h4>\r\n" . (!empty($item["content"][2]) ? $item["content"][2] : " <p>—</p>\r\n") . " </td>\r\n" . " <td>\r\n" . " <h4>Nordita Help Pages</h4>\r\n" . (!empty($item["content"][3]) ? $item["content"][3] : " <p>—</p>\r\n") . " </td>\r\n" . " </tr></table>\r\n"; } $contentblock .= " <div id='" . $target . "'>\r\n" . $content . " </div>\r\n" . "\r\n"; } // ------------------------------- // -- output data // ------------------------------- $stdout = " <div" . (!empty($id) ? " id='block-" . $id . "'" : "") . (!empty($class) ? " class='" . $class . "'" : "") . ">\r\n" . "\r\n" . " <div>\r\n" . "\r\n" . $userIcon . " <div id='my-tabs'>\r\n" . "\r\n" . " <ul>\r\n" . $menuitems . " </ul>\r\n" . "\r\n" . $contentblock . " </div> <!-- my-tabs -->\r\n" . "\r\n" . $logoutLink . " </div>\r\n" . "\r\n" . " </div> <!-- " . $id . " -->\r\n" . "\r\n"; return $stdout; }
function getSqlForUserSearch($qArray = array(), $status = "active", $inst = "NOR") { if (empty($qArray)) { if (isset($GLOBALS["QUERY"]) && !empty($GLOBALS["QUERY"])) { $qArray = $GLOBALS["QUERY"]; } else { return false; } } $where = $wNOT = $wAND = $cvAND = $wOR = array(); // ------------------------- // Construct 'WHERE status=...' // ------------------------- // NB: LM.lm_key should correspond to appointment start date // NB: LM.lm_status should correspond to appointment end date // NB: for 'active' it should be enough to check that any end date is in the future switch ($status) { case "active": //$where[] = "LM.lm_key<=CURDATE()"; // start date in past $where[] = "(CURDATE()<=LM.lm_status) OR (LM.lm_status='')"; // end date in future break; case "passive": case "expired": $where[] = "LM.lm_status<=CURDATE()"; // end date in past break; } // We are only interested in Records from Nordita Stockholm era: $where[] = "'2007-01-01'<=LM.lm_status"; // ------------------------- // Construct 'WHERE inst=...' // ------------------------- // NB: 'combodb.zzz_avatars.av_institute' may not be reliable! if ($inst) { if ($inst == "NOR") { $where[] = "UM.um_uid='" . MYPEAR_NORDITA_EMPLOYEES . "'"; } else { $where[] = "AV.av_institute REGEXP '" . mb_strtoupper($inst) . "'"; } } // ------------------------------------------ // Need to make separate search in CV records // ------------------------------------------ /* $cvs = array(); $cvarray = $this->getCvArray(1); if (!empty($cvarray)) { foreach ($cvarray as $id => $cv) { if (!empty($cv["plain"])) { $cvs[$id] = $cv["plain"]; } } } */ foreach (functions::callMethod('people', 'lib/people', 'getPeopleArray', 'all') as $id => $record) { $cv = isset($record["nw_cv"]["plain"]) ? strtolower($record["nw_cv"]["plain"]) : ""; // NOT (-terms) foreach ($qArray["not"] as $lg) { if (preg_match("/" . $lg . "/", $cv)) { $wNOT[$record["nw_id_ea"]] = "`av_id`<>'" . $record["nw_id_ea"] . "'"; } } // AND (+terms) //foreach (array_merge($qArray["_and"],$qArray["_or"]) as $lg) { foreach ($qArray["_and"] as $lg) { if (preg_match("/" . $lg . "/", $cv)) { $cvAND[$record["nw_id_ea"]] = "`av_id`='" . $record["nw_id_ea"] . "'"; } } // OR (optional terms) if (!count($qArray["_and"])) { foreach ($qArray["_or"] as $lg) { if (preg_match("/" . $lg . "/", $cv)) { $wOR[$record["nw_id_ea"]] = "`av_id`='" . $record["nw_id_ea"] . "'"; } } } } //echo "cvAND";debug::rr($cvAND);echo "wOR";debug::rr($wOR);echo "wNOT";debug::rr($wNOT);echo "where";debug::rr($where);echo "<hr>"; // ------------------------- // Construct 'WHERE user=...' // NB "_and","_or" fields have had any phrases eliminated // -------------------- // Nordita branch $wtmp = array(); if (preg_match("/stockholm/i", strtolower($qArray["original"]))) { $wtmp[] = "(AV.av_phone!='') AND (AV.av_phone NOT LIKE '%+45%')"; } if (preg_match("/copenhagen/i", strtolower($qArray["original"]))) { $wtmp[] = "AV.av_phone LIKE '%+45%'"; } if (count($wtmp)) { $w1[] = "(" . join(") OR (", $wtmp) . ")"; } // -------------------- // NOT (-terms) $wtmp = array(); foreach ($qArray["not"] as $lg) { $shot = search::mysqlFormat($lg, true); foreach ($this->searchableFields as $field) { $wNOT[] = "`" . $field . "` " . $shot . ""; } } if (count($wNOT) == 1) { $where[] = array_pop($wNOT); } elseif (count($wNOT) > 1) { $where[] = "" . join(") AND (", $wNOT) . ""; } // -------------------- // AND (+terms) foreach ($qArray["_and"] as $lg) { $wtmp = array(); $shot = search::mysqlFormat($lg, false); foreach ($this->searchableFields as $field) { $wtmp[] = "`" . $field . "` " . $shot . ""; } $wtmp = array_merge($wtmp, $cvAND); if (count($wtmp)) { $wAND[] = "(" . join(") OR (", $wtmp) . ")"; } } // -------------------- // OR (optional terms) if (!count($qArray["_and"])) { foreach ($qArray["_or"] as $lg) { $shot = search::mysqlFormat($lg, false); foreach ($this->searchableFields as $field) { $wOR[] = "`" . $field . "` " . $shot . ""; } } } // -------------------- if (count($wOR) == 1) { $where[] = array_pop($wOR); } elseif (count($wOR) > 1) { $where[] = "(" . join(") OR (", $wOR) . ")"; } //echo "wOR";debug::rr($wOR);debug::rr($where); // -------------------- // -- Assemble SQL SELECT query // -------------------- return "SELECT " . " AV.*, " . " UM.um_status, " . " LOWER(LM.lm_value) AS lm_value, " . " LM.lm_key, " . " LM.lm_status, " . " LM.lm_option, " . " MDB.acc_kth, " . " MDB.acc_su, " . " MDB.maildrop, " . " MDB.user " . "FROM " . " zzz_avatars AS AV " . " LEFT JOIN zzz_unit_members AS UM ON AV.av_id=UM.um_avid " . " LEFT JOIN zzz_lists AS L ON AV.av_id=L.l_parent " . " LEFT JOIN zzz_list_members AS LM ON L.l_id=LM.lm_lid " . " LEFT JOIN maildb.master AS MDB ON AV.av_id=MDB.m_myorg " . "WHERE " . " (UM.um_uid='" . MYPEAR_NORDITA_EMPLOYEES . "') " . " AND (UM.um_status REGEXP '" . MYPEAR_REGEXP_IS_EMPLOYEE_OR_VISITOR . "') " . " AND (LM.lm_option REGEXP '" . MYPEAR_REGEXP_NORDITA_IS_HOME_INSTITUTE . "') " . (count($where) ? " AND (" . join(") AND (", $where) . ")" : "") . (count($wAND) ? " AND ( (" . join(") AND (", $wAND) . ") )" : ""); }