Public Member Functions | |
form () | |
[Describe function...] | |
makeStoreControl () | |
[Describe function...] | |
initStoreArray () | |
[Describe function...] | |
cleanStoreQueryConfigs ($storeQueryConfigs, $storeArray) | |
[Describe function...] | |
addToStoreQueryConfigs ($storeQueryConfigs, $index) | |
[Describe function...] | |
saveQueryInAction ($uid) | |
[Describe function...] | |
loadStoreQueryConfigs ($storeQueryConfigs, $storeIndex, $writeArray) | |
[Describe function...] | |
procesStoreControl () | |
[Describe function...] | |
queryMaker () | |
[Describe function...] | |
getQueryResultCode ($mQ, $res, $table) | |
[Describe function...] | |
Public Attributes | |
$storeList = "search_query_smallparts,queryConfig,queryTable,queryFields,queryLimit,queryOrder,queryOrderDesc,queryOrder2,queryOrder2Desc,queryGroup,search_query_makeQuery" | |
$downloadScript = "index.php" | |
$formW = 48 | |
$noDownloadB = 0 |
|
[Describe function...]
Definition at line 188 of file class.t3lib_fullsearch.php. Referenced by procesStoreControl(). 00188 { 00189 $keyArr = explode(",",$this->storeList); 00190 reset($keyArr); 00191 $storeQueryConfigs[$index]=array(); 00192 while(list(,$k)=each($keyArr)) { 00193 $storeQueryConfigs[$index][$k]=$GLOBALS["SOBE"]->MOD_SETTINGS[$k]; 00194 } 00195 return $storeQueryConfigs; 00196 }
|
|
[Describe function...]
Definition at line 171 of file class.t3lib_fullsearch.php. 00171 { 00172 if (is_array($storeQueryConfigs)) { 00173 reset($storeQueryConfigs); 00174 while(list($k,$v)=each($storeQueryConfigs)) { 00175 if (!isset($storeArray[$k])) unset($storeQueryConfigs[$k]); 00176 } 00177 } 00178 return $storeQueryConfigs; 00179 }
|
|
[Describe function...]
Definition at line 98 of file class.t3lib_fullsearch.php. References $out. 00098 { 00099 $out=' 00100 Search Word:<BR> 00101 <input type="text" name="SET[sword]" value="'.htmlspecialchars($GLOBALS["SOBE"]->MOD_SETTINGS["sword"]).'"'.$GLOBALS["TBE_TEMPLATE"]->formWidth(20).'><input type="submit" name="submit" value="Search All Records"> 00102 '; 00103 00104 return $out; 00105 }
|
|
[Describe function...]
Definition at line 402 of file class.t3lib_fullsearch.php. Referenced by queryMaker(). 00402 { 00403 global $TCA; 00404 $output=""; 00405 $cPR=array(); 00406 switch($mQ) { 00407 case "count": 00408 $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res); 00409 $cPR["header"]='Count'; 00410 $cPR["content"]="<BR><strong>".$row[0]. "</strong> records selected."; 00411 break; 00412 case "all": 00413 $rowArr=array(); 00414 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00415 $rowArr[]=$this->resultRowDisplay($row,$TCA[$table],$table); 00416 $lrow=$row; 00417 } 00418 if (count($rowArr)) { 00419 $out.="<table border=0 cellpadding=2 cellspacing=1>".$this->resultRowTitles($lrow,$TCA[$table],$table).implode(chr(10),$rowArr)."</table>"; 00420 } 00421 if (!$out) $out="<em>No rows selected!</em>"; 00422 $cPR["header"]='Result'; 00423 $cPR["content"]=$out; 00424 break; 00425 case "csv": 00426 $rowArr=array(); 00427 $first=1; 00428 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00429 if ($first) { 00430 $rowArr[]=$this->csvValues(array_keys($row),",",""); 00431 $first=0; 00432 } 00433 $rowArr[]=$this->csvValues($row); 00434 } 00435 if (count($rowArr)) { 00436 $out.='<textarea name="whatever" rows="20" wrap="off"'.$GLOBALS["SOBE"]->doc->formWidthText($this->formW,"","off").'>'.t3lib_div::formatForTextarea(implode(chr(10),$rowArr)).'</textarea>'; 00437 if (!$this->noDownloadB) { 00438 $out.='<BR><input type="submit" name="download_file" value="Click to download file" onClick="document.location=\''.$this->downloadScript.'\';">'; // document.forms[0].target=\'_blank\'; 00439 } 00440 // Downloads file: 00441 if (t3lib_div::_GP("download_file")) { 00442 $filename="TYPO3_".$table."_export_".date("dmy-Hi").".csv"; 00443 $mimeType = "application/octet-stream"; 00444 Header("Content-Type: ".$mimeType); 00445 Header("Content-Disposition: attachment; filename=".$filename); 00446 echo implode(chr(13).chr(10),$rowArr); 00447 exit; 00448 } 00449 } 00450 if (!$out) $out="<em>No rows selected!</em>"; 00451 $cPR["header"]='Result'; 00452 $cPR["content"]=$out; 00453 break; 00454 case "xml": 00455 $className=t3lib_div::makeInstanceClassName("t3lib_xml"); 00456 $xmlObj = new $className("typo3_export"); 00457 $xmlObj->includeNonEmptyValues=1; 00458 $xmlObj->renderHeader(); 00459 $first=1; 00460 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00461 if ($first) { 00462 $xmlObj->setRecFields($table,implode(",",array_keys($row))); 00463 // debug($xmlObj->XML_recFields); 00464 $first=0; 00465 } 00466 $xmlObj->addRecord($table,$row); 00467 } 00468 $xmlObj->renderFooter(); 00469 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) { 00470 $xmlData=$xmlObj->getResult(); 00471 $out.='<textarea name="whatever" rows="20" wrap="off"'.$GLOBALS["SOBE"]->doc->formWidthText($this->formW,"","off").'>'.t3lib_div::formatForTextarea($xmlData).'</textarea>'; 00472 if (!$this->noDownloadB) { 00473 $out.='<BR><input type="submit" name="download_file" value="Click to download file" onClick="document.location=\''.$this->downloadScript.'\';">'; // document.forms[0].target=\'_blank\'; 00474 } 00475 // Downloads file: 00476 if (t3lib_div::_GP("download_file")) { 00477 $filename="TYPO3_".$table."_export_".date("dmy-Hi").".xml"; 00478 $mimeType = "application/octet-stream"; 00479 Header("Content-Type: ".$mimeType); 00480 Header("Content-Disposition: attachment; filename=".$filename); 00481 echo $xmlData; 00482 exit; 00483 } 00484 } 00485 if (!$out) $out="<em>No rows selected!</em>"; 00486 $cPR["header"]='Result'; 00487 $cPR["content"]=$out; 00488 break; 00489 case "explain": 00490 default: 00491 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00492 $out.="<BR>".t3lib_div::view_array($row); 00493 } 00494 $cPR["header"]='Explain SQL query'; 00495 $cPR["content"]=$out; 00496 break; 00497 } 00498 return $cPR; 00499 }
|
|
[Describe function...]
Definition at line 151 of file class.t3lib_fullsearch.php. Referenced by makeStoreControl(), and procesStoreControl(). 00151 { 00152 $storeArray=array( 00153 "0" => "[New]" 00154 ); 00155 00156 $savedStoreArray = unserialize($GLOBALS["SOBE"]->MOD_SETTINGS["storeArray"]); 00157 00158 if (is_array($savedStoreArray)) { 00159 $storeArray = array_merge($storeArray,$savedStoreArray); 00160 } 00161 return $storeArray; 00162 }
|
|
[Describe function...]
Definition at line 251 of file class.t3lib_fullsearch.php. Referenced by procesStoreControl(). 00251 { 00252 if ($storeQueryConfigs[$storeIndex]) { 00253 $keyArr = explode(",",$this->storeList); 00254 reset($keyArr); 00255 while(list(,$k)=each($keyArr)) { 00256 $writeArray[$k]=$storeQueryConfigs[$storeIndex][$k]; 00257 } 00258 } 00259 return $writeArray; 00260 }
|
|
[Describe function...]
Definition at line 112 of file class.t3lib_fullsearch.php. References initStoreArray(), t3lib_extMgm::isLoaded(), and table(). 00112 { 00113 // Load/Save 00114 $storeArray = $this->initStoreArray(); 00115 $cur=""; 00116 00117 // Store Array: 00118 $opt=array(); 00119 reset($storeArray); 00120 while(list($k,$v)=each($storeArray)) { 00121 $opt[]='<option value="'.$k.'"'.(!strcmp($cur,$v)?" selected":"").'>'.htmlspecialchars($v).'</option>'; 00122 } 00123 00124 // Actions: 00125 if (t3lib_extMgm::isLoaded("sys_action")) { 00126 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_action', 'type=2', '', 'title'); 00127 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) { 00128 $opt[]='<option value="0">__Save to Action:__</option>'; 00129 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00130 $opt[]='<option value="-'.$row["uid"].'"'.(!strcmp($cur,"-".$row["uid"])?" selected":"").'>'.htmlspecialchars($row["title"]." [".$row["uid"]."]").'</option>'; 00131 } 00132 } 00133 $GLOBALS['TYPO3_DB']->sql_free_result($res); 00134 } 00135 00136 $TDparams=' nowrap="nowrap" class="bgColor4"'; 00137 $tmpCode=' 00138 <table border=0 cellpadding=3 cellspacing=1> 00139 <tr'.$TDparams.'><td><select name="storeControl[STORE]" onChange="document.forms[0][\'storeControl[title]\'].value= this.options[this.selectedIndex].value!=0 ? this.options[this.selectedIndex].text : \'\';">'.implode(chr(10),$opt).'</select><input type="submit" name="storeControl[LOAD]" value="Load"></td></tr> 00140 <tr'.$TDparams.'><td nowrap><input name="storeControl[title]" value="" type="text" max=80'.$GLOBALS["SOBE"]->doc->formWidth().'><input type="submit" name="storeControl[SAVE]" value="Save" onClick="if (document.forms[0][\'storeControl[STORE]\'].options[document.forms[0][\'storeControl[STORE]\'].selectedIndex].value<0) return confirm(\'Are you sure you want to overwrite the existing query in this action?\');"><input type="submit" name="storeControl[REMOVE]" value="Remove"></td></tr> 00141 </table> 00142 '; 00143 return $tmpCode; 00144 }
|
|
[Describe function...]
Definition at line 267 of file class.t3lib_fullsearch.php. References addToStoreQueryConfigs(), t3lib_BEfunc::getModuleData(), t3lib_BEfunc::getRecord(), initStoreArray(), loadStoreQueryConfigs(), and saveQueryInAction(). Referenced by queryMaker(). 00267 { 00268 $storeArray = $this->initStoreArray(); 00269 $storeQueryConfigs = unserialize($GLOBALS["SOBE"]->MOD_SETTINGS["storeQueryConfigs"]); 00270 00271 $storeControl = t3lib_div::_GP("storeControl"); 00272 $storeIndex = intval($storeControl["STORE"]); 00273 $saveStoreArray=0; 00274 $writeArray=array(); 00275 if (is_array($storeControl)) { 00276 if ($storeControl["LOAD"]) { 00277 if ($storeIndex>0) { 00278 $writeArray=$this->loadStoreQueryConfigs($storeQueryConfigs,$storeIndex,$writeArray); 00279 $saveStoreArray=1; 00280 $msg="'".htmlspecialchars($storeArray[$storeIndex])."' query loaded!"; 00281 } elseif ($storeIndex<0 && t3lib_extMgm::isLoaded("sys_action")) { 00282 $actionRecord=t3lib_BEfunc::getRecord("sys_action",abs($storeIndex)); 00283 if (is_array($actionRecord)) { 00284 $dA = unserialize($actionRecord["t2_data"]); 00285 $dbSC=array(); 00286 if (is_array($dA["qC"])) { 00287 $dbSC[0] = $dA["qC"]; 00288 } 00289 $writeArray=$this->loadStoreQueryConfigs($dbSC,"0",$writeArray); 00290 $saveStoreArray=1; 00291 $acTitle=htmlspecialchars($actionRecord["title"]); 00292 $msg="Query from action '".$acTitle."' loaded!"; 00293 } 00294 } 00295 } elseif ($storeControl["SAVE"]) { 00296 if ($storeIndex<0) { 00297 $qOK = $this->saveQueryInAction(abs($storeIndex)); 00298 if ($qOK) { 00299 $msg="Query OK and saved."; 00300 } else { 00301 $msg="No query saved!"; 00302 } 00303 } else { 00304 if (trim($storeControl["title"])) { 00305 if ($storeIndex>0) { 00306 $storeArray[$storeIndex]=$storeControl["title"]; 00307 } else { 00308 $storeArray[]=$storeControl["title"]; 00309 end($storeArray); 00310 $storeIndex=key($storeArray); 00311 } 00312 $storeQueryConfigs=$this->addToStoreQueryConfigs($storeQueryConfigs,$storeIndex); 00313 $saveStoreArray=1; 00314 $msg="'".htmlspecialchars($storeArray[$storeIndex])."' query saved!"; 00315 } 00316 } 00317 } elseif ($storeControl["REMOVE"]) { 00318 if ($storeIndex>0) { 00319 $msg="'".$storeArray[$storeControl["STORE"]]."' query entry removed!"; 00320 unset($storeArray[$storeControl["STORE"]]); // Removing 00321 $saveStoreArray=1; 00322 } 00323 } 00324 } 00325 if ($saveStoreArray) { 00326 unset($storeArray[0]); // making sure, index 0 is not set! 00327 $writeArray["storeArray"]=serialize($storeArray); 00328 $writeArray["storeQueryConfigs"]=serialize($this->cleanStoreQueryConfigs($storeQueryConfigs,$storeArray)); 00329 $GLOBALS["SOBE"]->MOD_SETTINGS = t3lib_BEfunc::getModuleData($GLOBALS["SOBE"]->MOD_MENU, $writeArray, $GLOBALS["SOBE"]->MCONF["name"], "ses"); 00330 } 00331 return $msg; 00332 }
|
|
[Describe function...]
Definition at line 339 of file class.t3lib_fullsearch.php. References $out, error(), getQueryResultCode(), procesStoreControl(), and TYPO3_db. 00339 { 00340 global $TCA; 00341 00342 $msg=$this->procesStoreControl(); 00343 00344 $output.= $GLOBALS["SOBE"]->doc->section('Load/Save Query',$this->makeStoreControl(),0,1); 00345 if ($msg) { 00346 $output.= $GLOBALS["SOBE"]->doc->section('','<font color=red><strong>'.$msg.'</strong></font>'); 00347 } 00348 $output.= $GLOBALS["SOBE"]->doc->spacer(20); 00349 00350 00351 // Query Maker: 00352 $qGen = t3lib_div::makeInstance("t3lib_queryGenerator"); 00353 $qGen->init("queryConfig",$GLOBALS["SOBE"]->MOD_SETTINGS["queryTable"]); 00354 $tmpCode=$qGen->makeSelectorTable($GLOBALS["SOBE"]->MOD_SETTINGS); 00355 $output.= $GLOBALS["SOBE"]->doc->section('Make query',$tmpCode,0,1); 00356 00357 $mQ = $GLOBALS["SOBE"]->MOD_SETTINGS["search_query_makeQuery"]; 00358 00359 // Make form elements: 00360 if ($qGen->table && is_array($TCA[$qGen->table])) { 00361 if ($mQ) { 00362 // Show query 00363 $qGen->enablePrefix=1; 00364 $qString = $qGen->getQuery($qGen->queryConfig); 00365 // debug($qGen->queryConfig); 00366 00367 switch($mQ) { 00368 case "count": 00369 $qExplain = $GLOBALS['TYPO3_DB']->SELECTquery('count(*)', $qGen->table, $qString.t3lib_BEfunc::deleteClause($qGen->table)); 00370 break; 00371 default: 00372 $qExplain = $qGen->getSelectQuery($qString); 00373 if ($mQ=="explain") { 00374 $qExplain="EXPLAIN ".$qExplain; 00375 } 00376 break; 00377 } 00378 00379 $output.= $GLOBALS["SOBE"]->doc->section('SQL query',$this->tableWrap(htmlspecialchars($qExplain)),0,1); 00380 00381 $res = @$GLOBALS['TYPO3_DB']->sql(TYPO3_db,$qExplain); 00382 if ($GLOBALS['TYPO3_DB']->sql_error()) { 00383 $out.="<BR><strong>Error:</strong><BR><font color=red><strong>".$GLOBALS['TYPO3_DB']->sql_error()."</strong></font>"; 00384 $output.= $GLOBALS["SOBE"]->doc->section('SQL error',$out,0,1); 00385 } else { 00386 $cPR = $this->getQueryResultCode($mQ,$res,$qGen->table); 00387 $output.=$GLOBALS["SOBE"]->doc->section($cPR["header"],$cPR["content"],0,1); 00388 } 00389 } 00390 } 00391 return $output; 00392 }
|
|
[Describe function...]
Definition at line 204 of file class.t3lib_fullsearch.php. References t3lib_extMgm::isLoaded(), and TYPO3_db. Referenced by procesStoreControl(). 00204 { 00205 if (t3lib_extMgm::isLoaded("sys_action")) { 00206 $keyArr = explode(",",$this->storeList); 00207 reset($keyArr); 00208 $saveArr=array(); 00209 while(list(,$k)=each($keyArr)) { 00210 $saveArr[$k]=$GLOBALS["SOBE"]->MOD_SETTINGS[$k]; 00211 } 00212 00213 $qOK = 0; 00214 // Show query 00215 if ($saveArr["queryTable"]) { 00216 $qGen = t3lib_div::makeInstance("t3lib_queryGenerator"); 00217 $qGen->init("queryConfig",$saveArr["queryTable"]); 00218 $qGen->makeSelectorTable($saveArr); 00219 00220 $qGen->enablePrefix=1; 00221 $qString = $qGen->getQuery($qGen->queryConfig); 00222 $qCount = $GLOBALS['TYPO3_DB']->SELECTquery('count(*)', $qGen->table, $qString.t3lib_BEfunc::deleteClause($qGen->table)); 00223 $qSelect = $qGen->getSelectQuery($qString); 00224 00225 $res = @$GLOBALS['TYPO3_DB']->sql(TYPO3_db,$qCount); 00226 if (!$GLOBALS['TYPO3_DB']->sql_error()) { 00227 $dA = array(); 00228 $dA["t2_data"] = serialize(array( 00229 "qC"=>$saveArr, 00230 "qCount" => $qCount, 00231 "qSelect" => $qSelect, 00232 "qString" => $qString 00233 )); 00234 $GLOBALS['TYPO3_DB']->exec_UPDATEquery("sys_action", "uid=".intval($uid), $dA); 00235 $qOK=1; 00236 } 00237 } 00238 00239 return $qOK; 00240 } 00241 }
|
|
Definition at line 85 of file class.t3lib_fullsearch.php. |
|
Definition at line 86 of file class.t3lib_fullsearch.php. |
|
Definition at line 87 of file class.t3lib_fullsearch.php. |
|
Definition at line 84 of file class.t3lib_fullsearch.php. |