require_once dirname(__FILE__) . "/../classes/class_tou.php"; //ajax wrapper for class_tou.php $ajaxResponse = new AjaxResponse($_POST); $json = new Mapbender_JSON(); $touObject = new tou(); //$currentUser = new User(); //$wmc = new wmc(); $resultObj = array(); //obj structure in session for acceptedTou (see class_tou.php): //acceptedTou { // wms [100,101,112], // wfs [12,34] // } switch ($ajaxResponse->getMethod()) { case 'checkAcceptedTou': $result = $touObject->check($ajaxResponse->getParameter("serviceType"), $ajaxResponse->getParameter("serviceId")); $ajaxResponse->setResult($result['accepted']); //1 or 0 $ajaxResponse->setMessage(_mb($result['message'])); $ajaxResponse->setSuccess(true); break; case 'setAcceptedTou': $serviceType = $ajaxResponse->getParameter("serviceType"); $serviceId = $ajaxResponse->getParameter("serviceId"); $result = $touObject->set($ajaxResponse->getParameter("serviceType"), $ajaxResponse->getParameter("serviceId")); $ajaxResponse->setResult($result['setTou']); //1 or 0 $ajaxResponse->setMessage(_mb($result['message'])); $ajaxResponse->setSuccess(true); break; // Invalid command
$unavailableIdsTitles = array(); foreach ($unavailableIdsArray as $i) { $unavailableIdsTitles[] = array("id" => $i["id"], "index" => $i["index"], "title" => $i["title"]); } $resultObj["unavailable"]["wms"] = array_merge($resultObj["unavailable"]["wms"], $unavailableIdsTitles); //get terms of use from wms objects which are in the remaining wmc and are not already accepted for this session $validWMS = $wmcGetApi->getValidWms(); $translation['wms'] = _mb("MapService"); $resourceSymbol = "<img src='../img/osgeo_graphics/geosilk/server_map.png' alt='" . $translation['wms'] . " - picture' title='" . $translation['wms'] . "'>"; $languageCode = 'de'; $hostName = $_SERVER['HTTP_HOST']; $tou = ""; $classTou = new tou(); foreach ($validWMS as $WMS) { //check if tou has already been read - if not show them in the message $resultOfCheck = $classTou->check('wms', $WMS['id']); if ($resultOfCheck['accepted'] == 0) { $touHeader = $resourceSymbol . " <a href='../php/mod_showMetadata.php?resource=wms&layout=tabs&id=" . $WMS['id'] . "&languageCode=" . $languageCode . "' target='_blank'>" . $WMS['title'] . "</a><br>"; if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") { $mapbenderProtocol = "https://"; $mapbenderBaseUrl = "https://" . $hostName; } else { $mapbenderProtocol = "http://"; $mapbenderBaseUrl = "http://" . $hostName; } $touServiceConnector = new connector($mapbenderProtocol . "localhost" . $_SERVER['SCRIPT_NAME'] . "/../../php/mod_getServiceDisclaimer.php?resource=wms&id=" . $WMS['id'] . "&languageCode=" . $languageCode . "&asTable=true"); $touForWMS = $touServiceConnector->file; //add only those who have no special tou defined - if ($touForWMS != '') { $tou .= $touHeader . $touForWMS; }