本文整理汇总了PHP中rex_sql::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_sql::getValue方法的具体用法?PHP rex_sql::getValue怎么用?PHP rex_sql::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_sql
的用法示例。
在下文中一共展示了rex_sql::getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Konstruktor. Stellt die Daten der Kategorie aus der Datenbank zusammen.
* @param int $kategorie_id Kategorie ID.
* @param int $clang_id Redaxo SprachID.
* @param string $table_prefix Redaxo Tabellen Praefix ($REX['TABLE_PREFIX'])
*/
public function __construct($kategorie_id, $clang_id, $table_prefix = "rex_")
{
$this->table_prefix = $table_prefix;
// Sprachfallback
$query_prove = "SELECT * FROM " . $this->table_prefix . "d2u_stellenmarkt_kategorien_lang AS lang " . "WHERE kategorie_id = " . $kategorie_id . " " . "ORDER BY clang_id DESC";
$result_prove = new rex_sql();
$result_prove->setQuery($query_prove);
$num_rows_prove = $result_prove->getRows();
$is_lang_available = false;
$fallback_lang_id = 0;
for ($i = 0; $i < $num_rows_prove; $i++) {
if ($result_prove->getValue("lang.clang_id") == $clang_id) {
$is_lang_available = true;
} else {
$fallback_lang_id = $result_prove->getValue("lang.clang_id");
}
$result_prove->next();
}
$sql_clang_id = $clang_id;
if ($is_lang_available == false) {
$sql_clang_id = $fallback_lang_id;
}
$query = "SELECT * FROM " . $this->table_prefix . "d2u_stellenmarkt_kategorien AS kategorien " . "LEFT JOIN " . $this->table_prefix . "d2u_stellenmarkt_kategorien_lang AS lang " . "ON kategorien.kategorie_id = lang.kategorie_id " . "WHERE kategorien.kategorie_id = " . $kategorie_id . " " . "AND (clang_id = " . $sql_clang_id . " OR clang_id IS NULL) " . "LIMIT 0, 1";
$result = new rex_sql();
$result->setQuery($query);
$num_rows = $result->getRows();
if ($num_rows > 0) {
$this->kategorie_id = $result->getValue("kategorie_id");
if ($result->getValue("clang_id") != "") {
$this->clang_id = $result->getValue("clang_id");
}
$this->interne_bezeichnung = $result->getValue("interne_bezeichnung");
$this->name = $result->getValue("name");
}
}
示例2: rex_a62_metainfo_cleanup
/**
* Alle Metafelder löschen, nicht das nach einem Import in der Parameter Tabelle
* noch Datensätze zu Feldern stehen, welche nicht als Spalten in der
* rex_article angelegt wurden!
*/
function rex_a62_metainfo_cleanup($params)
{
global $REX;
// Cleanup nur durchführen, wenn auch die rex_article Tabelle neu angelegt wird
if (isset($params['force']) && $params['force'] != true && strpos($params['content'], 'CREATE TABLE `' . $REX['TABLE_PREFIX'] . 'article`') === false && strpos($params['content'], 'CREATE TABLE ' . $REX['TABLE_PREFIX'] . 'article') === false) {
return;
}
require_once $REX['INCLUDE_PATH'] . '/addons/metainfo/classes/class.rex_table_manager.inc.php';
$sql = new rex_sql();
$sql->setQuery('SELECT name FROM ' . $REX['TABLE_PREFIX'] . '62_params');
for ($i = 0; $i < $sql->getRows(); $i++) {
if (substr($sql->getValue('name'), 0, 4) == 'med_') {
$tableManager = new rex_a62_tableManager($REX['TABLE_PREFIX'] . 'file');
} else {
$tableManager = new rex_a62_tableManager($REX['TABLE_PREFIX'] . 'article');
}
$tableManager->deleteColumn($sql->getValue('name'));
$sql->next();
}
// evtl reste aufräumen
$tablePrefixes = array('article' => array('art_', 'cat_'), 'file' => array('med_'));
foreach ($tablePrefixes as $table => $prefixes) {
$table = $REX['TABLE_PREFIX'] . $table;
$tableManager = new rex_a62_tableManager($table);
foreach (rex_sql::showColumns($table) as $column) {
$column = $column['name'];
if (in_array(substr($column, 0, 4), $prefixes)) {
$tableManager->deleteColumn($column);
}
}
}
$sql = new rex_sql();
$sql->setQuery('DELETE FROM ' . $REX['TABLE_PREFIX'] . '62_params');
rex_generateAll();
}
示例3: enterObject
function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
{
// ***** SELECT FESTLEGEN
$SEL = new rex_select();
$SEL->setName('FORM[' . $this->params["form_name"] . '][el_' . $this->id . '][]');
$SEL->setId("el_" . $this->id);
$SEL->setSize(5);
$SEL->setMultiple(1);
// ***** SQL - ROHDATEN ZIEHEN
$sql = $this->elements[5];
$teams = new rex_sql();
$teams->debugsql = $this->params["debug"];
$teams->setQuery($sql);
for ($t = 0; $t < $teams->getRows(); $t++) {
$SEL->addOption($teams->getValue($this->elements[7]), $teams->getValue($this->elements[6]));
$teams->next();
}
$wc = "";
// if (isset($warning["el_" . $this->getId()])) $wc = $warning["el_" . $this->getId()];
$SEL->setStyle('class="multipleselect ' . $wc . '"');
// ***** EINGELOGGT ODER NICHT SETZEN
if ($send == 0) {
// erster aufruf
// Daten ziehen
if ($this->params["main_id"] > 0) {
$this->value = array();
$g = new rex_sql();
$g->debugsql = $this->params["debug"];
$g->setQuery('select ' . $this->elements[3] . ' from ' . $this->elements[1] . ' where ' . $this->elements[2] . '=' . $this->params["main_id"]);
$gg = $g->getArray();
if (is_array($gg)) {
foreach ($gg as $g) {
$this->value[] = $g[$this->elements[3]];
}
}
}
}
// ***** AUSWAHL SETZEN
if (is_array($this->value)) {
foreach ($this->value as $val) {
$SEL->setSelected($val);
}
}
// ***** AUSGEBEN
$form_output[] = '
<p class="formmultipleselect">
<label class="multipleselect ' . $wc . '" for="el_' . $this->id . '" >' . $this->elements[4] . '</label>
' . $SEL->get() . '
</p>';
}
示例4: setContent
/**
* SET CONTENT OF ROBOTS.TXT
*
* @return (string) robots.txt
*/
public function setContent($content)
{
global $REX;
$out = '';
$langs = array_keys($REX['CLANG']);
// get clang ids
$defaultRobotsTxt = 'User-agent: *' . "\r\n" . 'Disallow:';
if (!$REX['ADDON']['seo42']['settings']['no_robots_txt_auto_disallow']) {
foreach ($langs as $lang) {
$query = "SELECT id FROM " . $REX['TABLE_PREFIX'] . "article WHERE seo_noindex = '1' AND status = 1 AND clang = " . $lang;
$sql = new rex_sql();
$sql->setQuery($query);
for ($i = 1; $i <= $sql->getRows(); $i++) {
$out .= "Disallow: /" . seo42::getTrimmedUrl($sql->getValue('id'), $lang) . "\r\n";
$sql->next();
}
}
}
if ($out != '') {
$out = "User-agent: *" . "\r\n" . $out . "\r\n";
}
if ($out == '' && $content == '') {
$this->robots_txt = $defaultRobotsTxt;
} else {
$this->robots_txt = $out . $content;
}
}
示例5: publishNews
/**
* publish a news by id & clang
* if publish-lang == all => $clang is not needed, but must be set
* @param $id
* @param $clang
* @param DateTime $time
* @return string
*/
public static function publishNews($id, $clang, DateTime $time)
{
/**
* @var array $REX
* @var i18n $I18N
*/
global $REX, $I18N;
$sql = new rex_sql();
$sql->setTable(rex_asd_news_config::getTable());
$sql->setWhere('`id` = ' . $id . ' AND `clang` = ' . $clang);
if (rex_asd_news_config::getConfig('published-lang') == 'all') {
$sql->setWhere('`id` = ' . $id);
}
$sql->setValue('publishedAt', $time->format('Y-m-d H:i'));
$sql->setValue('publishedBy', $REX['USER']->getValue('user_id'));
$sql->setValue('status', 1);
$sql->update();
$sql->setQuery('SELECT * FROM `' . rex_asd_news_config::getTable() . '` WHERE `id` = ' . $id . ' AND `clang` = ' . $clang);
return '
<td>' . $id . '</td>
<td>' . $sql->getValue('title') . '</td>
<td><span>' . $time->format('d.m.Y H:i') . '</span></td>
<td><a href="' . self::getBaseUrl($clang) . 'unpublish&id=' . $id . '" class="rex-online" onclick="return confirm(\'' . $I18N->msg('asd_news_really_unpublish') . '\');">' . $I18N->msg('asd_news_published') . '</a></td>
<td><a href="' . self::getBaseUrl($clang) . 'edit&id=' . $id . '">' . $I18N->msg('edit') . '</a></td>
<td><a href="' . self::getBaseUrl($clang) . 'delete&id=' . $id . '" onclick="return confirm(\'' . $I18N->msg('asd_news_really_delete') . '\');">' . $I18N->msg('delete') . '</a></td>
<td><a href="' . self::getBaseUrl($clang) . 'status&id=' . $id . '" class="rex-online">' . $I18N->msg('status_online') . '</a></td>';
}
示例6: hasRole
/**
* Returns if the user has a role.
*
* @return bool
*/
public function hasRole()
{
if (self::$roleClass && !is_object($this->role) && ($role = $this->sql->getValue('role'))) {
$class = self::$roleClass;
$this->role = $class::get($role);
}
return is_object($this->role);
}
示例7: elseif
function rex_copyRevisionContent($article_id, $clang, $from_revision_id, $to_revision_id, $from_re_sliceid = 0, $to_revision_delete = FALSE)
{
global $REX;
if ($to_revision_delete) {
$dc = new rex_sql();
// $dc->debugsql = 1;
$dc->setQuery('delete from ' . $REX['TABLE_PREFIX'] . 'article_slice where article_id=' . $article_id . ' and clang=' . $clang . ' and revision=' . $to_revision_id);
}
if ($from_revision_id == $to_revision_id) {
return false;
}
$gc = new rex_sql();
// $gc->debugsql = 1;
$gc->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article_slice where re_article_slice_id='{$from_re_sliceid}' and article_id='{$article_id}' and clang='{$clang}' and revision='{$from_revision_id}'");
if ($gc->getRows() == 1) {
// letzt slice_id des ziels holen ..
$glid = new rex_sql();
// $glid->debugsql = 1;
$glid->setQuery("\n\t\t\t\t\tselect \n\t\t\t\t\t\tr1.id, r1.re_article_slice_id\n\t from \n\t\t\t\t\t\t" . $REX['TABLE_PREFIX'] . "article_slice as r1\n\t\t\t\t\tleft join " . $REX['TABLE_PREFIX'] . "article_slice as r2 on r1.id = r2.re_article_slice_id\n\t where \n\t\t\t\t\t\tr1.article_id = {$article_id} and r1.clang = {$clang} and \n\t\t\t\t\t\tr2.id is NULL and \n\t\t\t\t\t\tr1.revision='{$to_revision_id}';");
if ($glid->getRows() == 1) {
$to_last_slice_id = $glid->getValue("r1.id");
} else {
$to_last_slice_id = 0;
}
$ins = new rex_sql();
// $ins->debugsql = 1;
$ins->setTable($REX['TABLE_PREFIX'] . "article_slice");
$cols = new rex_sql();
$cols->setquery("SHOW COLUMNS FROM " . $REX['TABLE_PREFIX'] . "article_slice");
for ($j = 0; $j < $cols->rows; $j++, $cols->next()) {
$colname = $cols->getValue("Field");
if ($colname == "re_article_slice_id") {
$value = $to_last_slice_id;
} elseif ($colname == "revision") {
$value = $to_revision_id;
} elseif ($colname == "createdate") {
$value = time();
} elseif ($colname == "updatedate") {
$value = time();
} elseif ($colname == "createuser") {
$value = $REX["USER"]->getValue("login");
} elseif ($colname == "updateuser") {
$value = $REX["USER"]->getValue("login");
} else {
$value = $gc->getValue($colname);
}
if ($colname != "id") {
$ins->setValue($colname, $ins->escape($value));
}
}
$ins->insert();
// id holen und als re setzen und weitermachen..
rex_copyRevisionContent($article_id, $clang, $from_revision_id, $to_revision_id, $gc->getValue("id"));
return true;
}
rex_generateArticle($article_id);
return true;
}
示例8: execute
function execute()
{
global $REX;
$gt = new rex_sql();
if ($this->params["debug"]) {
$gt->debugsql = true;
}
$gt->setQuery('select * from rex_xform_email_template where name="' . $this->action["elements"][2] . '"');
if ($gt->getRows() == 1) {
$mail_to = $REX['ERROR_EMAIL'];
if (isset($this->action["elements"][3]) && $this->action["elements"][3] != "") {
foreach ($this->elements_email as $key => $value) {
if ($this->action["elements"][3] == $key) {
$mail_to = $value;
}
}
}
if (isset($this->action["elements"][4]) && $this->action["elements"][4] != "") {
$mail_to = $this->action["elements"][4];
}
$mail_from = $gt->getValue("mail_from");
$mail_subject = $gt->getValue("subject");
$mail_body = $gt->getValue("body");
foreach ($this->elements_email as $search => $replace) {
$mail_from = str_replace('###' . $search . '###', $replace, $mail_from);
$mail_subject = str_replace('###' . $search . '###', $replace, $mail_subject);
$mail_body = str_replace('###' . $search . '###', $replace, $mail_body);
$mail_from = str_replace('***' . $search . '***', urlencode($replace), $mail_from);
$mail_subject = str_replace('***' . $search . '***', urlencode($replace), $mail_subject);
$mail_body = str_replace('***' . $search . '***', urlencode($replace), $mail_body);
}
$mail = new rex_mailer();
$mail->AddAddress($mail_to, $mail_to);
$mail->WordWrap = 80;
$mail->FromName = $mail_from;
$mail->From = $mail_from;
$mail->Subject = $mail_subject;
$mail->Body = nl2br($mail_body);
$mail->AltBody = strip_tags($mail_body);
// $mail->IsHTML(true);
if (!$mail->Send()) {
echo "FAILED";
}
}
}
示例9: 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();
}
}
示例10: init
public static function init()
{
global $REX;
$sql = new rex_sql();
$sql->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'tracking_code WHERE id = 1');
if ($sql->getRows() > 0) {
self::$trackingCode = $sql->getValue('tracking_code');
}
}
示例11: enterObject
function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
{
$SEL = new rex_select();
$SEL->setName('FORM[' . $this->params["form_name"] . '][el_' . $this->id . ']');
$SEL->setId("el_" . $this->id);
$SEL->setSize(1);
$sql = $this->elements[4];
$teams = new rex_sql();
$teams->debugsql = $this->params["debug"];
$teams->setQuery($sql);
$sqlnames = array();
if ($this->elements[3] != 1) {
// mit --- keine auswahl ---
$SEL->addOption($this->elements[3], "0");
}
for ($t = 0; $t < $teams->getRows(); $t++) {
$SEL->addOption($teams->getValue($this->elements[6]), $teams->getValue($this->elements[5]));
if (isset($this->elements[7])) {
$sqlnames[$teams->getValue($this->elements[5])] = $teams->getValue($this->elements[7]);
}
$teams->next();
}
$wc = "";
if (isset($warning["el_" . $this->getId()])) {
$wc = $warning["el_" . $this->getId()];
}
$SEL->setStyle(' class="select ' . $wc . '"');
if ($this->value == "" && isset($this->elements[7]) && $this->elements[7] != "") {
$this->value = $this->elements[7];
}
$SEL->setSelected($this->value);
$form_output[] = '
<p class="formselect">
<label class="select ' . $wc . '" for="el_' . $this->id . '" >' . $this->elements[2] . '</label>
' . $SEL->get() . '
</p>';
$email_elements[$this->elements[1]] = stripslashes($this->value);
if (isset($sqlnames[$this->value])) {
$email_elements[$this->elements[1] . '_SQLNAME'] = stripslashes($sqlnames[$this->value]);
}
if (!isset($this->elements[8]) || $this->elements[8] != "no_db") {
$sql_elements[$this->elements[1]] = $this->value;
}
}
示例12: delFields
/**
* delete the metafields
*/
public static function delFields()
{
global $REX;
$sql = new rex_sql();
$sql->setQuery('SELECT `name` FROM ' . $REX['TABLE_PREFIX'] . '62_params WHERE `name` LIKE "asd_%"');
$delFields = array();
for ($i = 1; $i <= $sql->getRows(); $i++) {
$delFields[] = a62_delete_field($sql->getValue('name'));
$sql->next();
}
return self::checkErrorMessage($delFields);
}
示例13: isImageInUse
/**
* @param array $params
* @return array
*/
public static function isImageInUse($params)
{
/** @var i18n $I18N */
global $I18N;
$sql = new rex_sql();
$sqlCols = rex_asd_news_config::getConfig('sql');
$sql->setQuery('SELECT `id`, `title` FROM `' . rex_asd_news_config::getTable() . '` WHERE `' . $sqlCols['picture'] . '` = "' . $params['filename'] . '"');
if ($sql->getRows()) {
$message = $I18N->msg('asd_news') . '<br /><ul>';
for ($i = 1; $i <= $sql->getRow(); $i++) {
$message .= '
<li>
<a href="index.php?page=' . rex_asd_news_config::getName() . '&func=edit&id=' . $sql->getValue('id') . '">
' . $sql->getValue('title') . '
</a>
</li>';
}
$message .= '</ul>';
$params['subject'][] = $message;
}
return $params['subject'];
}
示例14: get
/**
* Gibt den HTML Content zurück
*/
function get()
{
$table = $this->getTable();
$field = $this->getField();
$foreignField = $this->getForeignField();
$value = $this->formatValue();
$qry = 'SELECT ' . $field . ' FROM ' . $table . ' WHERE ' . $foreignField . ' = "' . $value . '"';
$sql = new rex_sql();
// $sql->debugsql = true;
$sql->setQuery($qry);
if ($sql->getRows() == 1) {
return $sql->getValue($field);
}
return '';
}
示例15: getValue
function getValue($value)
{
if (!is_array($value)) {
$value = array();
$section =& $this->getSection();
// Alle vorhanden Werte löschen
$sql = new rex_sql();
$sql->setQuery('SELECT `' . $this->foreignField . '` FROM `' . $this->foreignTable . '` WHERE ' . $section->_getWhereString());
for ($i = 0; $i < $sql->getRows(); $i++) {
$value[] = $sql->getValue($this->foreignField);
$sql->next();
}
}
return $value;
}