本文整理汇总了PHP中rex_sql::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_sql::reset方法的具体用法?PHP rex_sql::reset怎么用?PHP rex_sql::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_sql
的用法示例。
在下文中一共展示了rex_sql::reset方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init()
{
global $REX;
self::$curClang = $REX['CUR_CLANG'];
$sql = new rex_sql();
$sql->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'string_table');
foreach ($REX['CLANG'] as $clangId => $clangName) {
for ($i = 0; $i < $sql->getRows(); $i++) {
$key = $sql->getValue('keyname');
$value = nl2br($sql->getValue('value_' . $clangId));
self::$stringTable[$clangId][$key] = $value;
self::$stringTableKeys[$clangId][] = $REX['ADDON']['string_table']['settings']['key_start_token'] . $key . $REX['ADDON']['string_table']['settings']['key_end_token'];
self::$stringTableValues[$clangId][] = $value;
$sql->next();
}
$sql->reset();
}
}
示例2: renderMetaFields
/**
* Erstellt den nötigen HTML Code um ein Formular zu erweitern.
*
* @param rex_sql $sqlFields rex_sql-objekt, dass die zu verarbeitenden Felder enthält
* @param array $epParams Array of all EP parameters
*
* @return string
*/
public function renderMetaFields(rex_sql $sqlFields, array $epParams)
{
$s = '';
// Startwert für MEDIABUTTON, MEDIALIST, LINKLIST zähler
$media_id = 1;
$mlist_id = 1;
$link_id = 1;
$llist_id = 1;
$activeItem = isset($epParams['activeItem']) ? $epParams['activeItem'] : null;
$sqlFields->reset();
for ($i = 0; $i < $sqlFields->getRows(); $i++, $sqlFields->next()) {
// Umschliessendes Tag von Label und Formularelement
$tag = 'p';
$tag_attr = '';
$name = $sqlFields->getValue('name');
$title = $sqlFields->getValue('title');
$params = $sqlFields->getValue('params');
$typeLabel = $sqlFields->getValue('label');
$attr = $sqlFields->getValue('attributes');
$dblength = $sqlFields->getValue('dblength');
$attrArray = rex_string::split($attr);
if (isset($attrArray['perm'])) {
if (!rex::getUser()->hasPerm($attrArray['perm'])) {
continue;
}
unset($attrArray['perm']);
}
$defaultValue = $sqlFields->getValue('default');
if ($activeItem) {
$itemValue = $activeItem->getValue($name);
if (strpos($itemValue, '|+|') !== false) {
// Alte notation mit |+| als Trenner
$dbvalues = explode('|+|', $activeItem->getValue($name));
} else {
// Neue Notation mit | als Trenner
$dbvalues = explode('|', $activeItem->getValue($name));
}
} else {
$dbvalues = (array) $sqlFields->getValue('default');
}
if ($title != '') {
$label = rex_i18n::translate($title);
} else {
$label = htmlspecialchars($name);
}
$id = preg_replace('/[^a-zA-Z\\-0-9_]/', '_', $label);
$labelIt = true;
$label = '<label for="' . $id . '">' . $label . '</label>';
$field = '';
switch ($typeLabel) {
case 'text':
$tag_attr = ' class="form-control"';
$rexInput = rex_input::factory($typeLabel);
$rexInput->addAttributes($attrArray);
$rexInput->setAttribute('id', $id);
$rexInput->setAttribute('name', $name);
if ($dblength > 0) {
$rexInput->setAttribute('maxlength', $dblength);
}
if ($activeItem) {
$rexInput->setValue($activeItem->getValue($name));
} else {
$rexInput->setValue($defaultValue);
}
$field = $rexInput->getHtml();
$e = [];
$e['label'] = $label;
$e['field'] = $field;
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$field = $fragment->parse('core/form/form.php');
break;
case 'checkbox':
// Beachte auch default values in multiple fields bei ADD.
// Im EDIT wurde dies bereits vorher gehandelt
if (!$activeItem) {
$defaultValue = explode('|', $defaultValue);
}
$name .= '[]';
case 'radio':
$formElements = [];
$values = [];
if (rex_sql::getQueryType($params) == 'SELECT') {
$sql = rex_sql::factory();
$value_groups = $sql->getDBArray($params, [], PDO::FETCH_NUM);
foreach ($value_groups as $value_group) {
if (isset($value_group[1])) {
$values[$value_group[1]] = $value_group[0];
} else {
$values[$value_group[0]] = $value_group[0];
}
}
//.........这里部分代码省略.........
示例3: foreach
}
}
}
// categories
foreach ($cat_ids as $cat_id) {
if ($sql->hasPerm('csw[' . $cat_id . ']')) {
$sel_cat->setSelected($cat_id);
}
}
// media categories
foreach ($mediacat_ids as $cat_id) {
if ($sql->hasPerm('media[' . $cat_id . ']')) {
$sel_media->setSelected($cat_id);
}
}
$sqlmodule->reset();
for ($i = 0; $i < $sqlmodule->getRows(); $i++) {
$name = 'module[' . $sqlmodule->getValue('id') . ']';
if ($sql->hasPerm($name)) {
$sel_module->setSelected($sqlmodule->getValue('id'));
}
$sqlmodule->next();
}
$sqlsprachen->reset();
for ($i = 0; $i < $sqlsprachen->getRows(); $i++) {
$name = 'clang[' . $sqlsprachen->getValue('id') . ']';
if ($sql->hasPerm($name)) {
$sel_sprachen->setSelected($sqlsprachen->getValue('id'));
}
$sqlsprachen->next();
}
示例4: htmlentities
$ArticleID = $row['id'];
$TemplateTypID = $row['template_id'];
$TEMPLATEHIDDEN = '';
$TEMPLATE = '<select name="template_id">' . "\n";
for ($i = 0; $i < $TEMPLATES->getRows(); $i++) {
$TemplateName = $TEMPLATES->getValue("name");
$TemplateID = $TEMPLATES->getValue("id");
if ($TemplateTypID == $TemplateID) {
$TEMPLATE .= '<option value="' . $TemplateID . '" selected="selected">[' . $TemplateID . '] - ' . htmlentities($TemplateName, ENT_QUOTES) . '</option>' . "\n";
$TEMPLATEHIDDEN = $TemplateID;
} else {
$TEMPLATE .= '<option value="' . $TemplateID . '">[' . $TemplateID . '] - ' . htmlentities($TemplateName, ENT_QUOTES) . '</option>' . "\n";
}
$TEMPLATES->next();
}
$TEMPLATES->reset();
$TEMPLATE .= '</select>' . "\n";
// Article-Name
$ARTICLE_NAME = htmlentities($row['article_name'], ENT_QUOTES);
// Article-Name-Kurzform
$ARTICLE_NAME_KURZ = mas_kurzanzeige_106($row['article_name'], 20);
$ARTICLE_NAME_KURZ = htmlentities($ARTICLE_NAME_KURZ, ENT_QUOTES);
// Artikel-ID mit einem Link versehen index.php?page=content&article_id=83
$ARTICLEID = '<a href="index.php?page=content&article_id=' . $row['id'] . '" title="' . $ARTICLE_NAME . '">[' . $row['id'] . '] - ' . $ARTICLE_NAME_KURZ . '</a>';
$t->set_var(array("ARTICLEID" => $ARTICLEID, "TEMPLATETYPID" => $TemplateTypID, "TEMPLATE" => $TEMPLATE, "SENDBUTTON" => $I18N_MAS->msg('art_and_temp_form_button_send'), "HIDDEN_ARTICLEID" => $ArticleID, "HIDDEN_TEMPLATEIDOLD" => $TEMPLATEHIDDEN));
$t->parse("EintragsUebersicht_s", "EintragsUebersicht", true);
}
// foreach ($data as $row)
// Module zur Ausgabe da, dann anzeigen
$t->set_var(array("AUSGABEVORHANDEN_BEGINN" => '', "AUSGABEVORHANDEN_ENDE" => ''));
} else {
示例5: getMetaValues
/**
* return array with the meta name & values
* it test if the form is posted or not and add the necessary values
* @return array
*/
public function getMetaValues()
{
global $REX;
$returnArray = array();
$this->sqlFields->reset();
for ($i = 0; $i < $this->sqlFields->getRows(); $i++, $this->sqlFields->next()) {
$fieldName = $this->sqlFields->getValue('name');
$fieldType = $this->sqlFields->getValue('type');
$fieldAttributes = $this->sqlFields->getValue('attributes');
$postValue = rex_post($fieldName, 'array', null);
// Wert aus der DB nehmen, falls keiner extern und keiner im POST angegeben
if ($postValue === null && $this->sql->getRows() == 1 && $this->sql->hasValue($fieldName)) {
$postValue = $this->sql->getValue($fieldName);
}
// dont save restricted fields
$attrArray = rex_split_string($fieldAttributes);
if (isset($attrArray['perm'])) {
if (!$REX['USER']->hasPerm($attrArray['perm'])) {
continue;
}
unset($attrArray['perm']);
}
// handle date types with timestamps
if (is_array($postValue) && isset($postValue['year']) && isset($postValue['month']) && isset($postValue['day']) && isset($postValue['hour']) && isset($postValue['minute'])) {
if (isset($postValue['active'])) {
$saveValue = mktime((int) $postValue['hour'], (int) $postValue['minute'], 0, (int) $postValue['month'], (int) $postValue['day'], (int) $postValue['year']);
} else {
$saveValue = 0;
}
} elseif (is_array($postValue) && isset($postValue['year']) && isset($postValue['month']) && isset($postValue['day'])) {
if (isset($postValue['active'])) {
$saveValue = mktime(0, 0, 0, (int) $postValue['month'], (int) $postValue['day'], (int) $postValue['year']);
} else {
$saveValue = 0;
}
} elseif (is_array($postValue) && isset($postValue['hour']) && isset($postValue['minute'])) {
if (isset($postValue['active'])) {
$saveValue = mktime((int) $postValue['hour'], (int) $postValue['minute'], 0, 0, 0, 0);
} else {
$saveValue = 0;
}
} else {
if (count($postValue) > 1) {
// Mehrwertige Felder
$saveValue = '|' . implode('|', $postValue) . '|';
} else {
$postValue = is_array($postValue) && isset($postValue[0]) ? $postValue[0] : $postValue;
if ($fieldType == REX_A62_FIELD_SELECT && strpos($fieldAttributes, 'multiple') !== false || $fieldType == REX_A62_FIELD_CHECKBOX) {
// Mehrwertiges Feld, aber nur ein Wert ausgewählt
$saveValue = '|' . $postValue[0] . '|';
} else {
// Einwertige Felder
$saveValue = $postValue;
}
}
}
// Wert in SQL zum speichern
$returnArray[$fieldName] = $saveValue;
}
return $returnArray;
}
示例6: seo42_generate_pathlist
//.........这里部分代码省略.........
$pathname = seo42_appendToPath($pathname, $name, $id, $clang);
}
// ALLGEMEINE URL ENDUNG
$pathname = substr($pathname, 0, strlen($pathname) - 1) . $REX['ADDON']['seo42']['settings']['url_ending'];
// STARTSEITEN URL FORMAT
if ($db->getValue('id') == $REX['START_ARTICLE_ID'] && $db->getValue('clang') == $REX['ADDON']['seo42']['settings']['homelang'] && ($REX['ADDON']['seo42']['settings']['homeurl'] == 1 || $REX['ADDON']['seo42']['settings']['homeurl'] == 2)) {
$pathname = '';
} elseif ($REX['ADDON']['seo42']['settings']['homeurl'] == 2 && $db->getValue('id') == $REX['START_ARTICLE_ID'] && count($REX['CLANG']) > 1) {
if ($REX['ADDON']['seo42']['settings']['url_ending'] == '') {
$langSlug = seo42::getLangUrlSlug($clang);
} else {
$langSlug = seo42::getLangUrlSlug($clang) . '/';
}
$pathname = $langSlug;
}
// UNSET OLD URL FROM $SEO42_URLS
if (isset($SEO42_IDS[$id][$clang]['url']) && isset($SEO42_URLS[$SEO42_IDS[$id][$clang]['url']])) {
unset($SEO42_URLS[$SEO42_IDS[$id][$clang]['url']]);
}
$SEO42_IDS[$id][$clang] = array('url' => $pathname);
$SEO42_URLS[$pathname] = array('id' => (int) $id, 'clang' => (int) $clang);
// get data from default lang if clone option is enabled for all other langs
$jsonData = json_decode($db->getValue('seo_custom_url'), true);
$articleId = $db->getValue('id');
$clangId = $db->getValue('clang');
if (isset($jsonData['url_clone']) && $jsonData['url_clone'] == true && $clangId == $REX['START_CLANG_ID']) {
$REX['SEO42_URL_CLONE'][$articleId] = $jsonData;
}
$db->next();
}
// URL MANIPULATION BY SEO42
// -----------------------------------------------------------------------------------------------------------
$interReplaceIds = array();
$db->reset();
for ($i = 0; $i < $db->getRows(); $i++) {
$urlField = $db->getValue('seo_custom_url');
$articleId = $db->getValue('id');
$clangId = $db->getValue('clang');
if ($urlField != '' || isset($REX['SEO42_URL_CLONE'][$articleId])) {
$urlData = seo42_utils::getUrlTypeData($urlField);
$jsonData = json_decode($urlData, true);
if (isset($REX['SEO42_URL_CLONE'][$articleId]) && !isset($jsonData['url_type'])) {
$jsonData = $REX['SEO42_URL_CLONE'][$articleId];
}
switch ($jsonData['url_type']) {
case SEO42_URL_TYPE_DEFAULT:
// do nothing
break;
case SEO42_URL_TYPE_USERDEF_INTERN:
$customUrl = $jsonData['custom_url'];
if ($SEO42_IDS[$articleId][$clangId]['url'] != $customUrl) {
// only if custom url ist different then auto url
$SEO42_URLS[$customUrl] = $SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']];
unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
}
$SEO42_IDS[$articleId][$clangId] = array('url' => $customUrl);
break;
case SEO42_URL_TYPE_USERDEF_EXTERN:
$customUrl = $jsonData['custom_url'];
unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
$SEO42_IDS[$articleId][$clangId] = array('url' => $customUrl);
break;
case SEO42_URL_TYPE_MEDIAPOOL:
$customUrl = $REX['MEDIA_DIR'] . '/' . $jsonData['file'];
unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
$SEO42_IDS[$articleId][$clangId] = array('url' => $customUrl);
示例7: htmlentities
$SliceID = $row['id'];
$ModulTypID = $row['modultyp_id'];
$MODULHIDDEN = '';
$MODUL = '<select name="module_id">' . "\n";
for ($i = 0; $i < $MODULE->getRows(); $i++) {
$ModulName = $MODULE->getValue("name");
$ModulID = $MODULE->getValue("id");
if ($ModulTypID == $ModulID) {
$MODUL .= '<option value="' . $ModulID . '" selected="selected">[' . $ModulID . '] - ' . htmlentities($ModulName, ENT_QUOTES) . '</option>' . "\n";
$MODULHIDDEN = $ModulID;
} else {
$MODUL .= '<option value="' . $ModulID . '">[' . $ModulID . '] - ' . htmlentities($ModulName, ENT_QUOTES) . '</option>' . "\n";
}
$MODULE->next();
}
$MODULE->reset();
$MODUL .= '</select>' . "\n";
// Article-Name
$ARTICLE_NAME = htmlentities($row['article_name'], ENT_QUOTES);
// Article-Name-Kurzform
$ARTICLE_NAME_KURZ = mas_kurzanzeige_106($row['article_name'], 20);
$ARTICLE_NAME_KURZ = htmlentities($ARTICLE_NAME_KURZ, ENT_QUOTES);
// Artikel-ID mit einem Link versehen index.php?page=content&article_id=83
$ARTICLEID = '<a href="index.php?page=content&article_id=' . $row['article_id'] . '&ctype=' . $row['ctype'] . '" title="' . $ARTICLE_NAME . ' - CTYPE: ' . $row['ctype'] . '">[' . $row['article_id'] . '] - ' . $ARTICLE_NAME_KURZ . '</a>';
$t->set_var(array("SLICEID" => $SliceID, "ARTICLEID" => $ARTICLEID, "MODULTYPID" => $ModulTypID, "MODUL" => $MODUL, "SENDBUTTON" => $I18N_MAS->msg('form_button_send'), "HIDDEN_SLICEID" => $SliceID, "HIDDEN_MODULIDOLD" => $MODULHIDDEN));
$t->parse("EintragsUebersicht_s", "EintragsUebersicht", true);
}
// foreach ($data as $row)
// Module zur Ausgabe da, dann anzeigen
$t->set_var(array("AUSGABEVORHANDEN_BEGINN" => '', "AUSGABEVORHANDEN_ENDE" => ''));
} else {