public static function init($CUSTOM) { $bfacet = $CUSTOM->getDSpaceVer() == "1.7" ? "" : "+bundleName:ORIGINAL"; self::$DURATION = array("7DAYS" => array("desc" => "Last 7 days", "colcount" => 8, "query" => "&facet.date.start=NOW/DAY-7DAYS&facet.date.end=NOW&facet.date.gap=" . urlencode("+1DAY")), "4WEEKS" => array("desc" => "Last 4 weeks", "colcount" => 5, "query" => "&facet.date.start=NOW/DAY-28DAYS&facet.date.end=NOW&facet.date.gap=" . urlencode("+7DAYS")), "6MONTHS" => array("desc" => "Last 6 months", "colcount" => 7, "query" => "&facet.date.start=NOW/MONTH/DAY-6MONTHS&facet.date.end=NOW&facet.date.gap=" . urlencode("+1MONTH")), "2YEAR" => array("desc" => "Quarterly, 2 Years", "colcount" => 8, "query" => "&facet.date.start=NOW/YEAR/DAY-1YEAR&facet.date.end=NOW/YEAR/DAY" . urlencode("+1YEAR") . "&facet.date.gap=" . urlencode("+3MONTHS")), "6YEAR" => array("desc" => "Yearly, 6 Years", "colcount" => 6, "query" => "&facet.date.start=NOW/YEAR/DAY-5YEARS&facet.date.end=NOW/YEAR/DAY" . urlencode("+1YEAR") . "&facet.date.gap=" . urlencode("+1YEAR"))); self::$TYPE = array("ITEMV" => array("desc" => "Item Views", "query" => "+AND+type:2"), "COLLV" => array("desc" => "Collection Views", "query" => "+AND+type:3"), "COMMV" => array("desc" => "Community Views", "query" => "+AND+type:4"), "BITV" => array("desc" => "Original Bitstream Views/downloads", "query" => "+AND+type:0" . $bfacet), "BITVALL" => array("desc" => "All Bitstream Views", "query" => "+AND+type:0")); self::$AUTH = array("ALL" => array("desc" => "All Users", "query" => ""), "AUTH" => array("desc" => "Authenticated Users", "query" => "+AND+(epersonid:[0+TO+*])"), "UNAUTH" => array("desc" => "Unauthenticated Users", "query" => "+AND+NOT(epersonid:[0+TO+*])")); self::$IP = $CUSTOM->getStatsIPs(); }
} } else { if ($coll != "") { if ($typearg == "COLLV") { $q = "id:" . $coll; } else { $q = "owningColl:" . $coll; } } else { $q = "owningComm:1"; } } $duration = solrFacets::getDuration(); $type = solrFacets::getType(); $auth = solrFacets::getAuth(); $ip = solrFacets::getIp(); $bots = $CUSTOM->getStatsBots(); $botstr = "&fq=NOT("; foreach ($bots as $k => $v) { if ($k != 0) { $botstr .= "+OR+"; } $botstr .= $v; } $botstr .= ")"; $qparm = $q . $type['query'] . $auth['query'] . $ip['query'] . $time . $botstr; $shards = $CUSTOM->getSolrShards(); if (!isset($_GET["debug"])) { header('Content-type: application/json'); $rows = 0; $req = $CUSTOM->getSolrPath() . "statistics/select?shards={$shards}&indent=on&q=" . $qparm . "&rows=" . $rows . "&fl=*%2Cscore&qt=&wt=json&explainOther=&hl.fl=" . "&facet=true&facet.date=time" . $duration['query'];
$CUSTOM->getCommunityInit()->initCommunities(); $CUSTOM->getCommunityInit()->initCollections(); solrFacets::init($CUSTOM); $duration = solrFacets::getDurationArg(); $type = solrFacets::getTypeArg(); $auth = solrFacets::getAuthArg(); $ip = solrFacets::getIpArg(); $scope = util::getArg("scope", "ALL"); hierarchy::initHierarchy($scope == "ALL", $scope); $colcount = solrFacets::getDurationKey("colcount"); header('Content-type: text/html; charset=UTF-8'); ?> <html> <head> <?php $header = new LitHeader(solrFacets::getTypeKey("desc") . " for the " . solrFacets::getDurationKey("desc") . " for " . solrFacets::getAuthKey("desc") . " from " . solrFacets::getIpKey("desc")); $header->litPageHeader(); ?> <script type="text/javascript"> var first = true; var complete = 0; var getStatsFunc = function(cell, tbd) { var id = cell.attr("id"); var arr = /(comm|coll)-(\d+)-all/.exec(id); if (arr.length <= 2) return; var prefix = id.replace("all",""); var req = "solrStats.php?" + arr[1] + "=" + arr[2] + "&colls=" + $(cell).parent("tr").attr("colls") +