function setAccociationIDs($zuordnungstabellenname, $element_value, $element_id, $kerndaten_id, $block_bez, $block_id)
{
    $Bol = new BlumenbachOnline();
    $messagediv = $element_id . "_message";
    $response = new tx_xajax_response();
    $response->assign($element_id, 'selected', 'selected');
    $response->assign($element_id, 'value', $element_value);
    $query = "";
    $a_element_value = array();
    $a_element_value = preg_split("#\\|#", $element_value);
    //	$anz_ids = sizeOf($a_element_value);
    $delete = true;
    $message = "";
    foreach ($a_element_value as $element_value) {
        $query .= $Bol->setAssociatedIDs($zuordnungstabellenname, $element_value, $kerndaten_id, $block_bez, $block_id, $delete);
        $delete = false;
        //bei BlockIII nur beim ersten Eintrag den Datensatz löschen
        if ($element_value != "") {
            $message .= '<div style="font-size:11px;"><span style="color:red">ID ' . $element_value . '</span> has been associated successfully to segment <strong>' . $block_bez . '</strong> with <strong>ID ' . $block_id . '</strong></div>';
        } else {
            $message .= '<div style="font-size:11px;">This arrangement has been deleted successfully from segment <strong>' . $block_bez . '</strong> with <strong>ID ' . $block_id . '</strong></div>';
        }
    }
    //$message .= $query;
    // Message
    //	$message = "<span style='color:red'>".$element_value." wurde erfolgreich zugeordnet!</span>";
    $response->assign($messagediv, 'style.display', 'none');
    $response->assign($messagediv, 'innerHTML', $message);
    //	$response->assign($messagediv, 'innerHTML', $message.$query);
    $response->assign($messagediv, 'style.display', 'block');
    return $response;
    //	return $response->getXML();
}
function getDBDumpfile()
{
    $response = new tx_xajax_response();
    include_once t3lib_extMgm::extPath('bolonline') . "/pi1/db_backup.php";
    $content = 'Aktueller Datenbankbackup: <a style="text-decoration:underline" target="_blank" href="' . $backuplink_rel . $backupfile . '">' . $backupfile . '</a>';
    $response->assign('db_backuplink', 'style.display', 'none');
    $response->assign('db_backuplink', 'innerHTML', $content);
    $response->assign('db_backuplink', 'style.display', 'block');
    return $response;
    //}
}
function getGNDData($person, $div_id, $divid_gnd_id, $divid_person)
{
    $debug = false;
    $content = "";
    $response = new tx_xajax_response();
    $erg = gndSearch($person);
    //echo '<xmp>' . print_r($erg, 1) . '</xmp>';
    foreach ($erg as $values) {
        //id="'.$div_id.'" onMouseOver="document.getElementById(\''.$div_id.'\').style.backgroundColor=\'orange\'"
        $dividtmp = md5($values['name']);
        $content .= '<div id="' . $dividtmp . '" onMouseOut="document.getElementById(\'' . $dividtmp . '\').style.backgroundColor=\'#769AFC\'"  onMouseOver="document.getElementById(\'' . $dividtmp . '\').style.backgroundColor=\'orange\'" style="height:11px;padding:5px;border: 1px solid gray;background-color:#769AFC" onClick="xajax_putGNDValues(\'' . $values["id"] . '\',\'' . $divid_gnd_id . '\',\'' . $values["name"] . '\',\'' . $divid_person . '\');document.getElementById(\'' . $div_id . '\').style.marginTop=\'10px\';document.getElementById(\'' . $div_id . '\').style.display=\'none\';">' . $values['name'] . '</div>';
    }
    $response->assign($div_id, 'style.display', 'none');
    $response->assign($div_id, 'innerHTML', $content);
    $response->assign($div_id, 'style.display', 'block');
    return $response;
}
function getGettyData($ort, $div_id, $divid_getty_id, $divid_ort, $divid_koordinaten)
{
    $debug = false;
    $content = "";
    $response = new tx_xajax_response();
    $erg = gettySearch($ort);
    //echo '<xmp>' . print_r($erg, 1) . '</xmp>';
    $content = '<div style="background-color:#555555;padding: 5px;color:white;border: 1px solid black;border-bottom:0px;font-size:0.9em"><u onClick="document.getElementById(\'' . $div_id . '\').style.display=\'none\'">schließen</u></div>';
    foreach ($erg as $values) {
        //id="'.$div_id.'" onMouseOver="document.getElementById(\''.$div_id.'\').style.backgroundColor=\'orange\'"
        $dividtmp = md5($values['name']);
        $content .= '<div id="' . $dividtmp . '" onMouseOut="document.getElementById(\'' . $dividtmp . '\').style.backgroundColor=\'#769AFC\'"  onMouseOver="document.getElementById(\'' . $dividtmp . '\').style.backgroundColor=\'orange\'" style="height:11px;padding:5px;border: 1px solid gray;background-color:#769AFC" onClick="xajax_putGettyValues(\'' . $values["id"] . '\',\'' . $divid_getty_id . '\',&quot;' . $values["name"] . '&quot;,\'' . $divid_ort . '\',\'' . preg_replace("|'|", "\\'", $values["coordinates"]) . '\',\'' . $divid_koordinaten . '\');document.getElementById(\'' . $div_id . '\').style.marginTop=\'10px\';document.getElementById(\'' . $div_id . '\').style.display=\'none\';">' . $values['name'] . '</div>';
        //id="'.$div_id.'" onMouseOver="document.getElementById(\''.$div_id.'\').style.backgroundColor=\'orange\'"
        //		$content .= '<div style="height:11px;padding:5px;border: 1px solid gray;background-color:lightgrey" onClick="xajax_putGettyValues(\''.$values["id"].'\',\''.$divid_getty_id.'\',\''.$values["name"].'\',\''.$divid_ort.'\',\''.preg_replace("|'|","\'",$values["coordinates"]).'\',\''.$divid_koordinaten.'\');document.getElementById(\''.$div_id.'\').style.display=\'none\';">'.$values['name'].'</div>';
        // auswahlmenue wieder ausblenden: document.getElementById(\''.$div_id.'_autofill\').style.display=\'none\'">
    }
    $response->assign($div_id, 'style.display', 'none');
    $response->assign($div_id, 'innerHTML', $content);
    $response->assign($div_id, 'style.display', 'block');
    return $response;
}
function delImage($id, $tablename)
{
    $Bol = new BlumenbachOnline();
    $response = new tx_xajax_response();
    if (!$id > 0) {
        return "";
    }
    $response = new tx_xajax_response();
    $deleted = (bool) false;
    $deleted = $Bol->deleteMediafile($id, $tablename) . ':<br />';
    if ($deleted) {
        $content .= 'Bild "' . $id . '" wurde erfolgreich gel&ouml;scht!' . "\n";
    } else {
        $content .= '<span style="color:red">Bild "' . $id . '" konnte nicht gel&ouml;scht werden!</span>' . "\n";
    }
    //	if ($_SESSION['todo'] != 'update')
    //		$content = '';
    $response->assign('bild_' . $id, 'style.display', 'none');
    $response->assign('bild_' . $id, 'innerHTML', $content);
    $response->assign('bild_' . $id, 'style.display', 'block');
    return $response;
}
 /**
  * Returns an XML document
  * @param    int        $quid: question UID
  * @return    string    xml-document
  */
 function getAjaxDetails($quid)
 {
     $quid = intval($quid);
     $nr = 0;
     $sOut = '';
     //$template = str_replace('\&quot;', '', $template);
     $template = $this->cObj->getSubpart($this->templateCode, "###TEMPLATE_DETAILS_ITEM###");
     //$template_item = preg_replace('/\r?\n/', " ", $template_item);
     //$template_item = str_replace("'", '"', $template_item);
     $template = str_replace('###PREFIX###', $this->prefixId, $template);
     $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('COUNT(*) anzahl', 'tx_myquizpoll_relation', 'LENGTH(textinput)>0 AND question_id=' . $quid, '', '', '');
     $rowA = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
     $gesamt = $rowA['anzahl'];
     $GLOBALS['TYPO3_DB']->sql_free_result($result);
     if ($gesamt > 0) {
         $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('DISTINCT textinput texte, COUNT( textinput ) anzahl', 'tx_myquizpoll_relation', 'LENGTH(textinput)>0 AND question_id=' . $quid, 'textinput', '', '');
         $rows = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
         if ($rows > 0) {
             while ($rowA = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
                 if ($nr % 2 == 0) {
                     $even_odd = 'even';
                 } else {
                     $even_odd = 'odd';
                 }
                 $prozent = number_format(100 * $rowA['anzahl'] / $gesamt, 2, ',', ' ');
                 //$texte = preg_replace("/(\r\n)+|(\n|\r)+/", "<br />", $rowA['texte']);    // nl2br funktioniert auch nicht
                 $texte = str_replace('\\r\\n', '<br />', htmlspecialchars($rowA['texte']));
                 $temp = str_replace('###ITEM_EVEN_ODD###', $even_odd, $template);
                 $temp = str_replace('###ITEM_ANSWER###', $texte, $temp);
                 $temp = str_replace('###ITEM_PERCENT###', $prozent, $temp);
                 $temp = str_replace('###ITEM_COUNTS###', $rowA['anzahl'], $temp);
                 $sOut .= $temp;
                 $nr++;
             }
         }
     }
     /* instantiate the xajaxResponse object */
     $objResponse = new tx_xajax_response();
     $objResponse->addScript("document.getElementById('details_hidden-{$quid}').style.display='block'; document.getElementById('show_details-{$quid}').style.display='none';");
     /* We alter the contents of the HTML element. The property 'innerHTML' is the html code inside this element. We replace it with the result in our $sOut variable */
     $objResponse->addAssign("details-{$quid}", "innerHTML", $sOut);
     /* With the getXML() method on the xajaxResponse objectwe send everything back to the client */
     return $objResponse->getXML();
 }
 public function refreshFiltersOnload($data)
 {
     // initializes plugin configuration
     $this->init();
     // set pivars
     $this->piVars = $data[$this->prefixId];
     foreach ($this->piVars as $key => $value) {
         $this->piVars[$key] = $value;
     }
     // init javascript onclick actions
     $this->initOnclickActions();
     // reset filters?
     if ($this->piVars['resetFilters'] && is_array($this->piVars['filter'])) {
         foreach ($this->piVars['filter'] as $key => $value) {
             // do not reset the preselected filters
             if ($this->preselectedFilter[$key]) {
                 $this->piVars['filter'][$key] = $this->preselectedFilter[$key];
             } else {
                 $this->piVars['filter'][$key] = '';
             }
         }
     }
     // make xajax response object
     $objResponse = new tx_xajax_response();
     // generate onload image
     $this->onloadImage = $this->createHideSpinner();
     // set filters
     $objResponse->addAssign('kesearch_filters', 'innerHTML', $this->renderFilters() . $this->onloadImage);
     // return response xml
     return $objResponse->getXML();
 }
 /**
  * This is the main communications engine of xajax. The engine handles all
  * incoming xajax requests, calls the apporiate PHP functions (or
  * class/object methods) and passes the XML responses back to the
  * Javascript response handler. If your RequestURI is the same as your Web
  * page then this function should be called before any headers or HTML has
  * been sent.
  */
 function processRequests()
 {
     $requestMode = -1;
     $sFunctionName = "";
     $bFoundFunction = true;
     $bFunctionIsCatchAll = false;
     $sFunctionNameForSpecial = "";
     $aArgs = array();
     $sPreResponse = "";
     $bEndRequest = false;
     $requestMode = $this->getRequestMode();
     if ($requestMode == -1) {
         return;
     }
     if ($requestMode == XAJAX_POST) {
         $sFunctionName = $_POST["xajax"];
         if (!empty($_POST["xajaxargs"])) {
             $aArgs = $_POST["xajaxargs"];
         }
     } else {
         header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
         header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
         header("Cache-Control: no-cache, must-revalidate");
         header("Pragma: no-cache");
         $sFunctionName = $_GET["xajax"];
         if (!empty($_GET["xajaxargs"])) {
             $aArgs = $_GET["xajaxargs"];
         }
     }
     // Use xajax error handler if necessary
     if ($this->bErrorHandler) {
         $GLOBALS['xajaxErrorHandlerText'] = "";
         set_error_handler("xajaxErrorHandler");
     }
     if ($this->sPreFunction) {
         if (!$this->_isFunctionCallable($this->sPreFunction)) {
             $bFoundFunction = false;
             $oResponse = new tx_xajax_response();
             $oResponse->addAlert("Unknown Pre-Function " . $this->sPreFunction);
         }
     }
     //include any external dependencies associated with this function name
     if (array_key_exists($sFunctionName, $this->aFunctionIncludeFiles)) {
         ob_start();
         include_once $this->aFunctionIncludeFiles[$sFunctionName];
         ob_end_clean();
     }
     if ($bFoundFunction) {
         $sFunctionNameForSpecial = $sFunctionName;
         if (!array_key_exists($sFunctionName, $this->aFunctions)) {
             if ($this->sCatchAllFunction) {
                 $sFunctionName = $this->sCatchAllFunction;
                 $bFunctionIsCatchAll = true;
             } else {
                 $bFoundFunction = false;
                 $oResponse = new tx_xajax_response();
                 $oResponse->addAlert("Unknown Function {$sFunctionName}.");
             }
         }
     }
     if ($bFoundFunction) {
         for ($i = 0; $i < sizeof($aArgs); $i++) {
             // If magic quotes is on, then we need to strip the slashes from the args
             if (get_magic_quotes_gpc() == 1 && is_string($aArgs[$i])) {
                 $aArgs[$i] = stripslashes($aArgs[$i]);
             }
             if (stristr($aArgs[$i], "<xjxobj>") != false) {
                 $aArgs[$i] = $this->_xmlToArray("xjxobj", $aArgs[$i]);
             } else {
                 if (stristr($aArgs[$i], "<xjxquery>") != false) {
                     $aArgs[$i] = $this->_xmlToArray("xjxquery", $aArgs[$i]);
                 } else {
                     if ($this->bDecodeUTF8Input) {
                         $aArgs[$i] = $this->_decodeUTF8Data($aArgs[$i]);
                     }
                 }
             }
         }
         if ($this->sPreFunction) {
             $mPreResponse = $this->_callFunction($this->sPreFunction, array($sFunctionNameForSpecial, $aArgs));
             if (is_array($mPreResponse) && $mPreResponse[0] === false) {
                 $bEndRequest = true;
                 $sPreResponse = $mPreResponse[1];
             } else {
                 $sPreResponse = $mPreResponse;
             }
             if ($bEndRequest) {
                 $oResponse = $sPreResponse;
             }
         }
         if (!$bEndRequest) {
             if (!$this->_isFunctionCallable($sFunctionName)) {
                 $oResponse = new tx_xajax_response();
                 $oResponse->addAlert("The Registered Function {$sFunctionName} Could Not Be Found.");
             } else {
                 if ($bFunctionIsCatchAll) {
                     $aArgs = array($sFunctionNameForSpecial, $aArgs);
                 }
                 $oResponse = $this->_callFunction($sFunctionName, $aArgs);
             }
             if (is_string($sResponse)) {
                 $oResponse = new tx_xajax_response();
                 $oResponse->addAlert("No XML Response Was Returned By Function {$sFunctionName}.\n\nOutput: " . $oResponse);
             } else {
                 if ($sPreResponse != "") {
                     $oNewResponse = new tx_xajax_response($this->sEncoding, $this->bOutputEntities);
                     $oNewResponse->loadXML($sPreResponse);
                     $oNewResponse->loadXML($oResponse);
                     $oResponse = $sNewResponse;
                 }
             }
         }
     }
     $sContentHeader = "Content-type: text/xml;";
     if ($this->sEncoding && strlen(trim($this->sEncoding)) > 0) {
         $sContentHeader .= " charset=" . $this->sEncoding;
     }
     header($sContentHeader);
     if ($this->bErrorHandler && !empty($GLOBALS['xajaxErrorHandlerText'])) {
         $oErrorResponse = new tx_xajax_response();
         $oErrorResponse->addAlert("** PHP Error Messages: **" . $GLOBALS['xajaxErrorHandlerText']);
         if ($this->sLogFile) {
             $fH = @fopen($this->sLogFile, "a");
             if (!$fH) {
                 $oErrorResponse->addAlert("** Logging Error **\n\nxajax was unable to write to the error log file:\n" . $this->sLogFile);
             } else {
                 fwrite($fH, "** xajax Error Log - " . strftime("%b %e %Y %I:%M:%S %p") . " **" . $GLOBALS['xajaxErrorHandlerText'] . "\n\n\n");
                 fclose($fH);
             }
         }
         $oErrorResponse->loadXML($oResponse);
         $oResponse = $oErrorResponse;
     }
     if ($this->bCleanBuffer) {
         while (@ob_end_clean()) {
         }
     }
     print $oResponse->getOutput();
     if ($this->bErrorHandler) {
         restore_error_handler();
     }
     if ($this->bExitAllowed) {
         exit;
     }
 }
 /**
  * Shows all records which are visible on the map (not all which are available through selected categories!)
  *
  * @param	string		$area: the area of the map
  * @return all available (=visible) records
  */
 function activeRecords($area)
 {
     // template
     $template['allrecords'] = $this->cObj2->getSubpart($this->templateCode, '###TEMPLATE_ACTIVERECORDS###');
     $template["item"] = $this->cObj2->getSubpart($template["allrecords"], "###SINGLE###");
     // build the query
     $areaArr = preg_split('/%2C%20/', $area);
     $where = 'hidden= 0 AND deleted = 0 AND pid IN(' . $this->config['pid_list'] . ')
           AND lng between ' . $areaArr[1] . ' AND ' . $areaArr[3] . '
           AND	lat between ' . $areaArr[0] . ' AND ' . $areaArr[2];
     $catList = $GLOBALS["TSFE"]->fe_user->getKey('ses', 'data2') ? $GLOBALS["TSFE"]->fe_user->getKey('ses', 'data2') : explode(',', $this->config['categories']);
     foreach ($catList as $key => $value) {
         $where2 .= ' FIND_IN_SET(' . $value . ',rggmcat) OR';
     }
     $where .= ' AND ( ' . substr($where2, 0, -3) . ' ) ';
     $table = $this->config['tables'];
     $field = '*';
     // query
     $res = $this->generic->exec_SELECTquery($field, $table, $where, $groupBy = '', $orderBy, $offset = '');
     while ($row = array_shift($res)) {
         foreach ($row as $key => $value) {
             $markerArray['###' . strtoupper($key) . '###'] = $this->cObj->stdWrap($value, $this->conf['activeRecords.'][$key . '.']);
         }
         $content_item .= $this->cObj->substituteMarkerArrayCached($template["item"], $markerArray, array(), $wrappedSubpartArray);
     }
     $subpartArray["###CONTENT###"] = $content_item;
     $content .= $this->cObj2->substituteMarkerArrayCached($template['allrecords'], $markerArray, $subpartArray, $wrappedSubpartArray);
     $objResponse = new tx_xajax_response($GLOBALS['TSFE']->metaCharset);
     $objResponse->addAssign('rggooglemap-recordsonmap', 'innerHTML', $content);
     return $objResponse->getXML();
 }