Exemplo n.º 1
0
 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")); */
 }
Exemplo n.º 2
0
 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'>(&#8270;)</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 &quot;Employees and Alumni&quot; (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 &amp;c</a><br><em>Egenrapportering &#8594; Mina&nbsp;Sidor &#8594; Mina&nbsp;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 (&quot;Network Secret&quot;)</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?&amp;languageId=12' target='_blank'>Employment Benefits &quot;KTH&nbsp;For&nbsp;Me&quot;</a></li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='https://hrweb.admin.kth.se/' target='_blank'>Salary Specification</a><br><em>Egenrapportering &#8594; Mina&nbsp;Sidor &#8594; Lönespec&nbsp;Online &#8594; check+button [lönespec&nbsp;online&nbsp;(presentation)]</em></li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='https://hrweb.admin.kth.se/' target='_blank'>Register Vacation</a><br><em>Egenrapportering &#8594; Mina&nbsp;Ärenden &#8594; Ledigheter</em></li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='https://hrweb.admin.kth.se/' target='_blank'>Register Sick Leave</a><br><em>Egenrapportering &#8594; Mina&nbsp;Ärenden &#8594; Sjuk&nbsp;&amp;&nbsp;Vård&nbsp;av...</em></li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='https://hrweb.admin.kth.se/' target='_blank'>Register Overtime</a><br><em>Egenrapportering &#8594; Mina&nbsp;Ärenden &#8594; Övertid&nbsp;&amp;&nbsp;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 &quot;Who Is Where&quot; 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 &#8594; 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 &#8594; Travel&nbsp;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 = "              &nbsp;";
         } else {
             $content = "              <table><tr>\r\n" . "                <td>\r\n" . "                  <h4>Nordita</h4>\r\n" . (!empty($item["content"][1]) ? $item["content"][1] : "                  <p>&#8212;</p>\r\n") . "                </td>\r\n" . "                <td>\r\n" . "                  <h4>KTH</h4>\r\n" . (!empty($item["content"][2]) ? $item["content"][2] : "                  <p>&#8212;</p>\r\n") . "                </td>\r\n" . "                <td>\r\n" . "                  <h4>Nordita Help Pages</h4>\r\n" . (!empty($item["content"][3]) ? $item["content"][3] : "                  <p>&#8212;</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;
 }