本文整理汇总了PHP中rex_sql::getFieldnames方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_sql::getFieldnames方法的具体用法?PHP rex_sql::getFieldnames怎么用?PHP rex_sql::getFieldnames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_sql
的用法示例。
在下文中一共展示了rex_sql::getFieldnames方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addSlice
function addSlice($I_ID, $module_id)
{
global $REX, $I18N;
$MOD = new rex_sql();
$MOD->setQuery("SELECT * FROM " . $REX['TABLE_PREFIX'] . "module WHERE id={$module_id}");
if ($MOD->getRows() != 1) {
$slice_content = rex_warning($I18N->msg('module_doesnt_exist'));
} else {
$slice_content = '
<a name="addslice"></a>
<form action="index.php#slice' . $I_ID . '" method="post" id="REX_FORM" enctype="multipart/form-data">
<fieldset>
<legend class="rex-lgnd">' . $I18N->msg('add_block') . '</legend>
<input type="hidden" name="article_id" value="' . $this->article_id . '" />
<input type="hidden" name="page" value="content" />
<input type="hidden" name="mode" value="' . $this->mode . '" />
<input type="hidden" name="slice_id" value="' . $I_ID . '" />
<input type="hidden" name="function" value="add" />
<input type="hidden" name="module_id" value="' . $module_id . '" />
<input type="hidden" name="save" value="1" />
<input type="hidden" name="clang" value="' . $this->clang . '" />
<input type="hidden" name="ctype" value="' . $this->ctype . '" />
<p class="rex-cnt-mdl-name">
' . $I18N->msg("module") . ': <span>' . htmlspecialchars($MOD->getValue("name")) . '</span>
</p>
<div class="rex-cnt-slc-ipt"><div class="rex-cnt-slc-ipt2">
' . $MOD->getValue("eingabe") . '
</div></div>
<p class="rex-sbmt">
<input type="submit" name="btn_save" value="' . $I18N->msg('add_block') . '"' . rex_accesskey($I18N->msg('add_block'), $REX['ACKEY']['SAVE']) . ' />
</p>
</fieldset>
</form>
';
// Beim Add hier die Meldung ausgeben
if ($this->slice_id == 0 && $this->message != '') {
echo rex_warning($this->message);
}
$dummysql = new rex_sql();
// Den Dummy mit allen Feldern aus rex_article_slice füllen
$slice_fields = new rex_sql();
$slice_fields->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'article_slice LIMIT 1');
foreach ($slice_fields->getFieldnames() as $fieldname) {
switch ($fieldname) {
case 'clang':
$def_value = $this->clang;
break;
case 'ctype':
$def_value = $this->ctype;
break;
case 'modultyp_id':
$def_value = $module_id;
break;
case 'article_id':
$def_value = $this->article_id;
break;
case 'id':
$def_value = 0;
break;
default:
$def_value = '';
}
$dummysql->setValue($REX['TABLE_PREFIX'] . 'article_slice.' . $fieldname, $def_value);
}
$slice_content = $this->replaceVars($dummysql, $slice_content);
}
return $slice_content;
}
示例2: addSlice
function addSlice($I_ID, $module_id)
{
global $REX, $I18N;
$MOD = new rex_sql();
$MOD->setQuery("SELECT * FROM " . $REX['TABLE_PREFIX'] . "module WHERE id={$module_id}");
if ($MOD->getRows() != 1) {
$slice_content = rex_warning($I18N->msg('module_doesnt_exist'));
} else {
$slice_content = '
<a name="addslice"></a>
<div class="rex-form rex-form-content-editmode-add-slice">
<form action="index.php#slice' . $I_ID . '" method="post" id="REX_FORM" enctype="multipart/form-data">
<fieldset class="rex-form-col-1">
<legend><span>' . $I18N->msg('add_block') . '</span></legend>
<input type="hidden" name="article_id" value="' . $this->article_id . '" />
<input type="hidden" name="page" value="content" />
<input type="hidden" name="mode" value="' . $this->mode . '" />
<input type="hidden" name="slice_id" value="' . $I_ID . '" />
<input type="hidden" name="function" value="add" />
<input type="hidden" name="module_id" value="' . $module_id . '" />
<input type="hidden" name="save" value="1" />
<input type="hidden" name="clang" value="' . $this->clang . '" />
<input type="hidden" name="ctype" value="' . $this->ctype . '" />
<div class="rex-content-editmode-module-name">
<h3 class="rex-hl4">
' . $I18N->msg("module") . ': <span>' . htmlspecialchars($MOD->getValue("name")) . '</span>
</h3>
</div>
<div class="rex-form-wrapper">
<div class="rex-form-row">
<div class="rex-content-editmode-slice-input">
<div class="rex-content-editmode-slice-input-2">
' . $MOD->getValue("eingabe") . '
</div>
</div>
</div>
</div>
</fieldset>
<fieldset class="rex-form-col-1">
<div class="rex-form-wrapper">
<div class="rex-form-row">
<p class="rex-form-col-a rex-form-submit">
<input class="rex-form-submit" type="submit" name="btn_save" value="' . $I18N->msg('add_block') . '"' . rex_accesskey($I18N->msg('add_block'), $REX['ACKEY']['SAVE']) . ' />
</p>
</div>
</div>
</fieldset>
</form>
</div>
<script type="text/javascript">
<!--
jQuery(function($) {
$(":input:visible:enabled:not([readonly]):first", $("form#REX_FORM")).focus();
});
//-->
</script>';
// Beim Add hier die Meldung ausgeben
if ($this->slice_id == 0) {
if ($this->warning != '') {
echo rex_warning($this->warning);
}
if ($this->info != '') {
echo rex_info($this->info);
}
}
$dummysql = new rex_sql();
// Den Dummy mit allen Feldern aus rex_article_slice füllen
$slice_fields = new rex_sql();
$slice_fields->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'article_slice LIMIT 1');
foreach ($slice_fields->getFieldnames() as $fieldname) {
switch ($fieldname) {
case 'clang':
$def_value = $this->clang;
break;
case 'ctype':
$def_value = $this->ctype;
break;
case 'modultyp_id':
$def_value = $module_id;
break;
case 'article_id':
$def_value = $this->article_id;
break;
case 'id':
$def_value = 0;
break;
default:
$def_value = '';
}
$dummysql->setValue($REX['TABLE_PREFIX'] . 'article_slice.' . $fieldname, $def_value);
}
$slice_content = $this->replaceVars($dummysql, $slice_content);
}
return $slice_content;
}
示例3: rex_addCLang
/**
* Erstellt eine Clang
*
* @param $id Id der Clang
* @param $name Name der Clang
*/
function rex_addCLang($id, $name)
{
global $REX;
$REX['CLANG'][$id] = $name;
$content = "// --- DYN\n\r";
foreach ($REX['CLANG'] as $cur => $val) {
$content .= "\n\r\$REX['CLANG']['{$cur}'] = \"{$val}\";";
}
$content .= "\n\r// --- /DYN";
$file = $REX['INCLUDE_PATH'] . "/clang.inc.php";
$h = fopen($file, "r");
$fcontent = fread($h, filesize($file));
$fcontent = ereg_replace("(\\/\\/.---.DYN.*\\/\\/.---.\\/DYN)", $content, $fcontent);
fclose($h);
$h = fopen($file, "w+");
fwrite($h, $fcontent, strlen($fcontent));
fclose($h);
@chmod($file, 0777);
$add = new rex_sql();
$add->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where clang='0'");
$fields = $add->getFieldnames();
$adda = new rex_sql();
// $adda->debugsql = 1;
for ($i = 0; $i < $add->getRows(); $i++) {
$adda->setTable($REX['TABLE_PREFIX'] . "article");
foreach ($fields as $key => $value) {
if ($value == 'pid') {
echo '';
} else {
if ($value == 'clang') {
$adda->setValue('clang', $id);
} else {
if ($value == 'status') {
$adda->setValue('status', '0');
} else {
$adda->setValue($value, rex_addslashes($add->getValue($value)));
}
}
}
}
$adda->insert();
$add->next();
}
$add = new rex_sql();
$add->setQuery("insert into " . $REX['TABLE_PREFIX'] . "clang set id='{$id}',name='{$name}'");
// ----- EXTENSION POINT
rex_register_extension_point('CLANG_ADDED', '', array('id' => $id, 'name' => $name));
rex_generateAll();
}
示例4: rex_addCLang
/**
* Erstellt eine Clang
*
* @param $id Id der Clang
* @param $name Name der Clang
*/
function rex_addCLang($id, $name)
{
global $REX;
$REX['CLANG'][$id] = $name;
$content = "";
foreach ($REX['CLANG'] as $cur => $val) {
$content .= "\$REX['CLANG']['{$cur}'] = \"{$val}\";\n";
}
$file = $REX['INCLUDE_PATH'] . "/clang.inc.php";
rex_replace_dynamic_contents($file, $content);
$add = new rex_sql();
$add->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where clang='0'");
$fields = $add->getFieldnames();
$adda = new rex_sql();
// $adda->debugsql = 1;
for ($i = 0; $i < $add->getRows(); $i++) {
$adda->setTable($REX['TABLE_PREFIX'] . "article");
foreach ($fields as $key => $value) {
if ($value == 'pid') {
echo '';
} else {
if ($value == 'clang') {
$adda->setValue('clang', $id);
} else {
if ($value == 'status') {
$adda->setValue('status', '0');
} else {
$adda->setValue($value, rex_addslashes($add->getValue($value)));
}
}
}
}
$adda->insert();
$add->next();
}
$add = new rex_sql();
$add->setQuery("insert into " . $REX['TABLE_PREFIX'] . "clang set id='{$id}',name='{$name}'");
// ----- EXTENSION POINT
rex_register_extension_point('CLANG_ADDED', '', array('id' => $id, 'name' => $name));
rex_generateAll();
}
示例5: getClassVars
/**
* CLASS Function:
* Returns an Array containing article field names
*/
function getClassVars()
{
static $vars = array();
if (empty($vars)) {
global $REX;
$vars = array();
$file = $REX['INCLUDE_PATH'] . '/generated/articles/' . $REX['START_ARTICLE_ID'] . '.0.article';
if ($REX['GG'] && file_exists($file)) {
// Im GetGenerated Modus, die Spaltennamen aus den generated Dateien holen
include_once $file;
// da getClassVars() eine statische Methode ist, können wir hier nicht mit $this->getId() arbeiten!
$genVars = OORedaxo::convertGeneratedArray($REX['ART'][$REX['START_ARTICLE_ID']], 0);
unset($genVars['article_id']);
unset($genVars['last_update_stamp']);
foreach ($genVars as $name => $value) {
$vars[] = $name;
}
} else {
// Im Backend die Spalten aus der DB auslesen / via EP holen
$sql = new rex_sql();
$sql->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'article LIMIT 0');
foreach ($sql->getFieldnames() as $field) {
$vars[] = $field;
}
}
}
return $vars;
}
示例6: array
$field =& $form->addSelectField('url_table');
$field->setLabel($I18N->msg('a724_table'));
$field->setAttribute('onchange', 'url_table(this);');
$field->setAttribute('style', 'width: ' . $select_w4 . 'px;');
$select =& $field->getSelect();
$select->setSize(1);
$select->addOption($I18N->msg('a724_no_table_selected'), '');
$sql = new rex_sql();
$tables = $sql->getArray("SHOW TABLES");
$cols = array();
foreach ($tables as $key => $value) {
$select->addOption(current($value), current($value));
$sqlf = new rex_sql();
// $sqlf->setDebug(true);
$sqlf->setQuery('SELECT * FROM ' . current($value));
$fieldnames = $sqlf->getFieldnames();
foreach ($fieldnames as $fieldname) {
$fields[current($value)][] = $fieldname;
}
}
$script = '
<script type="text/javascript">
<!--
(function($) {
var currentShown = null;
$("#' . $field->getAttribute('id') . '").change(function(){
if(currentShown) currentShown.hide();
var effectParamsId = "#rex-"+ jQuery(this).val();
currentShown = $(effectParamsId);
示例7: rex_addCLang
/**
* Erstellt eine Clang
*
* @param $id Id der Clang
* @param $name Name der Clang
*
* @return TRUE bei Erfolg, sonst FALSE
*/
function rex_addCLang($id, $name)
{
global $REX;
if (isset($REX['CLANG'][$id])) {
return FALSE;
}
$REX['CLANG'][$id] = $name;
$file = $REX['INCLUDE_PATH'] . "/clang.inc.php";
rex_replace_dynamic_contents($file, "\$REX['CLANG'] = " . var_export($REX['CLANG'], TRUE) . ";\n");
$add = new rex_sql();
$add->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where clang='0'");
$fields = $add->getFieldnames();
$adda = new rex_sql();
// $adda->debugsql = 1;
for ($i = 0; $i < $add->getRows(); $i++) {
$adda->setTable($REX['TABLE_PREFIX'] . "article");
foreach ($fields as $key => $value) {
if ($value == 'pid') {
echo '';
} else {
if ($value == 'clang') {
$adda->setValue('clang', $id);
} else {
if ($value == 'status') {
$adda->setValue('status', '0');
} else {
$adda->setValue($value, $add->escape($add->getValue($value)));
}
}
}
}
$adda->insert();
$add->next();
}
$add = new rex_sql();
$add->setQuery("insert into " . $REX['TABLE_PREFIX'] . "clang set id='{$id}',name='{$name}'");
// ----- EXTENSION POINT
rex_register_extension_point('CLANG_ADDED', '', array('id' => $id, 'name' => $name));
return TRUE;
}
示例8: rex_copyArticle
/**
* Kopieren eines Artikels von einer Kategorie in eine andere
*
* @param int $id ArtikelId des zu kopierenden Artikels
* @param int $to_cat_id KategorieId in die der Artikel kopiert werden soll
*
* @return boolean FALSE bei Fehler, sonst die Artikel Id des neue kopierten Artikels
*/
function rex_copyArticle($id, $to_cat_id)
{
global $REX;
$id = (int) $id;
$to_cat_id = (int) $to_cat_id;
$new_id = '';
// Artikel in jeder Sprache kopieren
foreach ($REX['CLANG'] as $clang => $clang_name) {
// validierung der id & from_cat_id
$from_sql = new rex_sql();
$qry = 'select * from ' . $REX['TABLE_PREFIX'] . 'article where clang="' . $clang . '" and id="' . $id . '"';
$from_sql->setQuery($qry);
if ($from_sql->getRows() == 1) {
// validierung der to_cat_id
$to_sql = new rex_sql();
$to_sql->setQuery('select * from ' . $REX['TABLE_PREFIX'] . 'article where clang="' . $clang . '" and startpage=1 and id="' . $to_cat_id . '"');
if ($to_sql->getRows() == 1 || $to_cat_id == 0) {
if ($to_sql->getRows() == 1) {
$path = $to_sql->getValue('path') . $to_sql->getValue('id') . '|';
$catname = $to_sql->getValue('name');
} else {
// In RootEbene
$path = '|';
$catname = $from_sql->getValue("name");
}
$art_sql = new rex_sql();
$art_sql->setTable($REX['TABLE_PREFIX'] . 'article');
if ($new_id == "") {
$new_id = $art_sql->setNewId('id');
}
$art_sql->setValue('id', $new_id);
// neuen auto_incrment erzwingen
$art_sql->setValue('re_id', $to_cat_id);
$art_sql->setValue('path', $path);
$art_sql->setValue('catname', $art_sql->escape($catname));
$art_sql->setValue('catprior', 0);
$art_sql->setValue('prior', 99999);
// Artikel als letzten Artikel in die neue Kat einfügen
$art_sql->setValue('status', 0);
// Kopierter Artikel offline setzen
$art_sql->setValue('startpage', 0);
$art_sql->addGlobalCreateFields();
// schon gesetzte Felder nicht wieder überschreiben
$dont_copy = array('id', 'pid', 're_id', 'catname', 'catprior', 'path', 'prior', 'status', 'createdate', 'createuser', 'startpage');
foreach (array_diff($from_sql->getFieldnames(), $dont_copy) as $fld_name) {
$art_sql->setValue($fld_name, $art_sql->escape($from_sql->getValue($fld_name)));
}
$art_sql->setValue("clang", $clang);
$art_sql->insert();
// ArticleSlices kopieren
rex_copyContent($id, $new_id, $clang, $clang);
// Prios neu berechnen
rex_newArtPrio($to_cat_id, $clang, 1, 0);
} else {
return false;
}
} else {
return false;
}
}
// Caches des Artikels löschen, in allen Sprachen
rex_deleteCacheArticle($id);
// Caches der Kategorien löschen, da sich derin befindliche Artikel geändert haben
rex_deleteCacheArticle($to_cat_id);
return $new_id;
}