示例#1
0
 public static function OutputDisplayPage()
 {
     // Make sure a fresh agenda db reading is used
     //TODO: shouldn't the file cache be cleaned instead?
     fromcache::reset_page_cache();
     fromcache::reset_session_cache();
     // Simulate return visit
     $_SESSION["igen"] = 1;
     if (!isset($agenda_timespan) && !isset($agenda_selection)) {
         // --------------------------------
         // Two of the columns don't change over a day, so they can be cached.
         // There is just one minor variable item, the bus departure times, that
         // are calculated and replace a place holder in the static code.
         //
         // Sources:
         //   self::outputDisplayTime()
         //   self::outputDisplayTip()
         //   event::outputEventCurrentEntrance()
         //   event::outputColloquiumWidget()
         //   event::OutputArrivingVisitors()
         //   widget::Wapod()
         //   preprint::OutputRecentPreprints()
         // --------------------------------
         //TODO
         if (1) {
             // Fetch data from 12hr cache
             $column = self::getStaticDisplayColumns();
         } else {
             // Recreate data for each reload of the display screen:
             $column = self::outputStaticDisplayColumns($wid);
         }
         // Inject non-static item in static column:
         if (isset($column[1])) {
             $column[1] = str_replace("[BUS]", self::outputBusDeparture("display-busdeparture"), $column[1]);
         }
         // --------------------------------
         // Construct the third column
         // Sources:
         //   event::outputAgendatable()
         // --------------------------------
         //KEEP for bugfixes:
         //  $c .= "            <div id='agenda' class='widget-table'><tr class='preamble'><td><table><tr><td>\r\n<em>From the <strong>AlbaNova&nbsp;Agenda</strong>. If you arrange an event at AlbaNova, please register it on <strong>agenda.albanova.se</strong>.</em></td></tr><tr><th><span class='agenda-date'>" . date("l j F, Y") . "</span></th></tr>\r\n<tr><td><span class='agenda-period'>The agenda is not available at this moment (until end of August 2013).</span></td></tr></table></div>\r\n";
         if (1) {
             // Recreate entrance Agenda table for each reload of the display screen:
             $c = functions::callMethod("event", "lib/event", "outputAgendatable", "entranceagenda", "month", "nordita", "0", "0", "1", "1");
         } else {
             // Fetch entrance agenda table from cache:
             $c = functions::callMethod("event", "lib/event", "outputSeminarsMonthAgendatable");
         }
         $column[] = "          <div class='@ col wide'>\r\n" . "\r\n" . "            <h2>WHAT'S ON IN THEORETICAL PHYSICS</h2>\r\n" . $c . "          </div> <!-- col wide -->\r\n" . "\r\n";
         // --------------------------------
         // Output data
         // --------------------------------
         shuffle($column);
         $stdout = str_replace("'@ ", "'left ", $column[0]) . str_replace("'@ ", "'left ", $column[1]) . str_replace("'@ ", "'right ", $column[2]);
         /*
               $stdout =
                 "        <div class='column-left'>\r\n" .
                 str_replace("'@ ","'left ",$column[0]) .
                 "        </div>\r\n" .
                 "        <div class='column-left'>\r\n" .
                 str_replace("'@ ","'left ",$column[1]) .
                 "        </div>\r\n" .
                 "        <div class='column-right'>\r\n" .
                 str_replace("'@ ","'right ",$column[2]) .
                 "        </div>\r\n" .
                 "        <div class='column-end'></div>\r\n";
         */
     }
     // end if
     return $stdout;
 }
示例#2
0
 public static function recreateMenulookupCache()
 {
     fromcache::reset_common_cache("menulookup");
     $array = fromcache::get("menulookup", "24", "\$GLOBALS['documentClass']->buildCompleteMenuArraysData");
     return is_array($array) && !empty($array) ? TRUE : FALSE;
 }
示例#3
0
 public static function getEventCalendar()
 {
     return fromcache::get("eventcalendar", "24", "fromdb_agenda::getEventCalendarData");
 }
示例#4
0
 public static function getPeopleArray($searchVariant = "all", $mUser = FALSE, $stopOnError = IS_TESTSERVER, $sourceDb = PEOPLE_DATA_SOURCE_DB)
 {
     if (empty($sourceDb)) {
         $sourceDb = PEOPLE_DATA_SOURCE_DB;
     }
     switch ($searchVariant) {
         case "search":
             return self::getPeopleArrayData("search", $mUser, "active", "NOR", $stopOnError, $sourceDb);
             break;
         case "user":
             return self::getPeopleArrayData("user", $mUser, "active", "NOR", $stopOnError, $sourceDb);
             break;
         case "complete":
             return fromcache::get("peoplecomplete", "24", "people::getPeopleArrayData", "multiple", FALSE, "", "NOR", $stopOnError, $sourceDb);
             break;
         case "alumni":
             return fromcache::get("peoplealumni", "24", "people::getAlumniArrayData");
             break;
         case "all":
             return fromcache::get("peoplelist", "24", "people::getPeopleArrayData", "multiple", $mUser, "active", "NOR", $stopOnError, $sourceDb);
             break;
     }
     return array();
 }
示例#5
0
 static function getAllPlaylists()
 {
     return fromcache::get("youtubeplaylists", "24", "fromdb_youtube::getAllPlaylistsData");
 }
示例#6
0
 public function getEventCalendar()
 {
     if (!OK_TO_CALL_EVENTS) {
         return functions::callMethod('fromdb_agenda', 'fromdb/agenda', 'getEventCalendar');
     }
     // ----------------------
     return fromcache::get("eventcalendar", "24", "fromdb_nwevents->getEventCalendarData");
 }
示例#7
0
 static function Acron($onlycaches = array())
 {
     $stdout = "";
     $newcache = $updatedRecords = array();
     // ----------------------
     // -- Update current event data from Agenda
     // ----------------------
     if (!class_exists("fromdb_nwevents", FALSE)) {
         require_once PATH_CLASSES . "/fromdb/nwevents.php";
     }
     if (!isset($dbEv) || !is_object($dbEv)) {
         $dbEv = new fromdb_nwevents();
     }
     $updatedRecords = $dbEv->updateCurrentEventsFromAgenda();
     // ----------------------
     // -- Recreate all caches
     // ----------------------
     if (!class_exists("fromcache", FALSE)) {
         require_once PATH_CLASSES . "/lib/fromcache.php";
     }
     $cachesCallback = fromcache::get_cache_callback();
     foreach (array_reverse($cachesCallback) as $cachename => $callback) {
         $callback = str_replace("URL_PREFIX", URL_PREFIX, $callback);
         eval("\$c = functions::callMethod(" . $callback . ");");
         if ($c) {
             $newcache[] = $cachename . "\r\n";
         }
     }
     // ----------------------
     // -- Output confirmation
     // ----------------------
     $thecache = is_array($onlycaches) || !empty($onlycaches) ? $onlycaches : $newcache;
     $stdout .= "<div class='col-content-left' style='width:30%'>\r\n";
     if (count($updatedRecords)) {
         $stdout .= "<h3>Updated data for events:</h3>" . "  <ul>\r\n";
         foreach ($updatedRecords as $confId) {
             $stdout .= "    <li><a href='http://agenda.albanova.se/conferenceDisplay.py?confId=" . $confId . "'>" . $dbEv->getEventTitle($confId) . "</a></li>\r\n";
         }
         $stdout .= "  </ul>\r\n";
     }
     $stdout .= "<h3>Recreated Caches:</h3>" . "<ul>\r\n";
     foreach ($thecache as $c) {
         $stdout .= "<li>" . $c . "</li>\r\n";
     }
     $stdout .= "</ul>\r\n" . "\r\n</div><div class='col-content-right' style='width:60%'>\r\n" . admin::AcacheFilesList() . "</div>\r\n";
     return $stdout;
 }
示例#8
0
 public static function outputTheoryMonthAgendatable($nocache = false)
 {
     if ($nocache) {
         return event::outputAgendatable("longagenda", "month", "theory", "0", "0", "1");
     } else {
         return fromcache::get("seminarschedule", "12", "event::outputAgendatable", "longagenda", "month", "theory", "0", "0", "1");
     }
 }
示例#9
0
         }
     }
 }
 // end if
 $uri['matchText'] = OS_outputFormat($uri['matchText'], $GLOBALS["QUERY"]['andor']);
 $uri['title'] = OS_outputFormat($uri['title'], $GLOBALS["QUERY"]['andor']);
 $uri['matchURI'] = (double) $GLOBALS["VDATA"]['s.weight'][4] > 0 ? OS_outputFormat($uri['uri'], $GLOBALS["QUERY"]['andor']) : $uri['uri'];
 $uri['description'] = OS_outputFormat($uri['description'], array());
 // --------------------
 // -- Remove paths that the current user has no access rights to see
 //    ($uri['path'] added by HVZM)
 // --------------------
 $uri['path'] = preg_replace("~http://[^/]*/~", "", str_replace("/index.php", "", $uri['uri']));
 //if ($uri["relevance"])              debug::rr(array(                "title"       => $uri['title'],                "description" => $uri['description'],                "category"    => $uri['category'],                "uri"         => $uri['uri'],                "matchURI"    => $uri['matchURI'],                "path"        => $uri['path'],                "filetype"    => $uri['ctype'],                "matchText"   => $uri['matchText'],                "relevance"   => $uri["relevance"]));echo "<br>".$uri["category"];var_dump(auth::isAccessGranted($GLOBALS["nw_categories"][$uri["category"]]));
 // $allpaths -- array with union of all sitemap info for entire site
 $allpaths = fromcache::get('allsitemap', '24', 'widget::WgetAllPaths');
 if (!class_exists("auth", FALSE)) {
     require_once PATH_CLASSES . "/lib/auth.php";
 }
 if ($uri["relevance"] && (isset($allpaths[$uri["path"]]["access"]) && !auth::isAccessGranted($allpaths[$uri["path"]]["access"]) || isset($GLOBALS["nw_categories"][$uri["category"]]) && !auth::isAccessGranted($GLOBALS["nw_categories"][$uri["category"]]))) {
     $uri["relevance"] = 0;
 }
 // --------------------
 // -- Reduce weight of signature page paths:
 // --------------------
 if ($uri["relevance"] && strpos($uri['uri'], "/signature/") !== false) {
     $uri["relevance"] = 0.1;
 }
 // --------------------
 // -- Remove paths of single-user pages:
 // --------------------
示例#10
0
 public static function getSidebarBoxes()
 {
     return fromcache::get("sidebar", "12", "block::BsidebarBoxes", "sidebarboxes", "acc-item");
 }