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();
 }
 /**
  * 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('\"', '', $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();
 }
 /**
  * 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();
 }