当前位置: 首页>>代码示例>>PHP>>正文


PHP rex_sql::setTable方法代码示例

本文整理汇总了PHP中rex_sql::setTable方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_sql::setTable方法的具体用法?PHP rex_sql::setTable怎么用?PHP rex_sql::setTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rex_sql的用法示例。


在下文中一共展示了rex_sql::setTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: asd_news_addClang

function asd_news_addClang($params)
{
    global $REX;
    $id = $params['id'];
    $name = $params['name'];
    $now = new DateTime();
    $error = false;
    $sql = new rex_sql();
    $sql->setQuery('SELECT * FROM `' . rex_asd_news_config::getTable() . '` WHERE `clang` = ' . $REX['START_CLANG_ID']);
    for ($i = 1; $i <= $sql->getRows(); $i++) {
        $save = new rex_sql();
        $save->setTable(rex_asd_news_config::getTable());
        $save->setValues($sql->getRow());
        $save->setValue('clang', $id);
        $save->setValue('createdAt', $now->format('Y-m-d H:i:s'));
        $save->setValue('updatedAt', $now->format('Y-m-d H:i:s'));
        $save->setValue('publishedAt', '0000-00-00 00:00:00');
        $save->setValue('createdBy', $REX['USER']->getValue('user_id'));
        $save->setValue('updatedBy', $REX['USER']->getValue('user_id'));
        $save->setValue('publishedBy', 0);
        $save->setValue('status', 0);
        unset($save->values['news_id']);
        if (!$save->insert()) {
            $error = $save->getError();
        }
    }
    if ($error) {
        echo rex_warning('ASD News: Neuigkeiten in der Sprache "' . $name . '" konnten nicht angelegt werden<br />' . $error);
    } else {
        echo rex_info('ASD News: Neuigkeiten in der Sprache "' . $name . '" wurden angelegt');
    }
}
开发者ID:Sysix,项目名称:asd_news,代码行数:32,代码来源:rex_asd_news_language.php

示例2: 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&amp;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&amp;id=' . $id . '">' . $I18N->msg('edit') . '</a></td>
     <td><a href="' . self::getBaseUrl($clang) . 'delete&amp;id=' . $id . '" onclick="return confirm(\'' . $I18N->msg('asd_news_really_delete') . '\');">' . $I18N->msg('delete') . '</a></td>
     <td><a href="' . self::getBaseUrl($clang) . 'status&amp;id=' . $id . '" class="rex-online">' . $I18N->msg('status_online') . '</a></td>';
 }
开发者ID:Sysix,项目名称:asd_news,代码行数:35,代码来源:rex_asd_news_ajaxHandler.php

示例3: 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;
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:58,代码来源:function_rex_copyrevisioncontent.inc.php

示例4: checkEntrys

 /**
  * check if entrys exists for the addon
  * @return bool
  */
 public static function checkEntrys()
 {
     global $REX;
     $sql = new rex_sql();
     $sql->setTable($REX['TABLE_PREFIX'] . 'url_control_generate');
     $sql->setWhere('`table` = "' . rex_asd_news_config::getTable() . '"');
     $sql->select('1');
     return (bool) $sql->getRows();
 }
开发者ID:Sysix,项目名称:asd_news,代码行数:13,代码来源:rex_asd_news_url_control.php

示例5:

 function a724_deletePathnamesFromTable()
 {
     $debug = false;
     // Alle Urls der Tabelle loeschen
     $sqld = new rex_sql();
     $sqld->setDebug($debug);
     $sqld->setTable('rex_a724_frau_schultze');
     $sqld->setWhere('name != "" AND url_table != "" AND url_table_parameters = ""');
     $sqld->delete();
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:10,代码来源:extension_common.inc.php

示例6: execute

 function execute()
 {
     $subject_key = $this->action["elements"][2];
     $body_key = $this->action["elements"][3];
     $user_id_key = $this->action["elements"][4];
     foreach ($this->elements_sql as $key => $value) {
         if ($subject_key == $key) {
             $subject = $value;
         }
         if ($body_key == $key) {
             $body = $value;
         }
         if ($user_id_key == $key) {
             $from_user_id = $value;
         }
         // echo "<br /> $key => $value";
     }
     if ($subject == "" or $body == "" or $from_user_id == "") {
         return FALSE;
     }
     // User auslesen
     $gu = new rex_sql();
     // $gu->debugsql = 1;
     // $gu->setQuery('select * from rex_com_user where id<>"'.$from_user_id.'" order by id');
     $gu->setQuery('select * from rex_com_user order by id');
     foreach ($gu->getArray() as $user) {
         $user_body = $body;
         $user_subject = $subject;
         $to_user_id = $user["id"];
         // Empfaenger einbauen
         $in = new rex_sql();
         // $in->debugsql = 1;
         $in->setTable("rex_com_message");
         $in->setValue("user_id", $to_user_id);
         $in->setValue("from_user_id", $from_user_id);
         $in->setValue("to_user_id", $to_user_id);
         $in->setValue("subject", $user_subject);
         $in->setValue("body", $user_body);
         $in->setValue("create_datetime", time());
         $in->insert();
         /*
         $in = new rex_sql;
         // $in->debugsql = 1;
         $in->setTable("rex_com_message");
         $in->setValue("user_id",$from_user_id);
         $in->setValue("from_user_id",$from_user_id);
         $in->setValue("to_user_id",$to_user_id);
         $in->setValue("subject",$user_subject);
         $in->setValue("body",$user_body);
         $in->setValue("create_datetime",time());
         $in->insert();
         */
         rex_com_user::exeAction($to_user_id, "sendemail_newmessage", $user);
     }
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:55,代码来源:class.xform.action_com_send_msg2all.inc.php

示例7: getInsertValue

 function getInsertValue($value)
 {
     $value = (array) $value;
     $section =& $this->getSection();
     // Alle vorhanden Werte löschen
     $sql = new rex_sql();
     $sql->setTable($this->foreignTable);
     $sql->setWhere($section->_getWhereString());
     $sql->delete();
     // und anschließend alle neu eintragen
     foreach ($value as $val) {
         // Parameter aus der Ursprungstabelle mit abspeichern damit später darüber verknüpft werden kann
         foreach ($section->getWhere() as $whereColName => $whereColValue) {
             $sql->setValue($whereColName, $whereColValue);
         }
         // Den zu speichernden Wert
         $sql->setValue($this->foreignField, $val);
         $sql->setTable($this->foreignTable);
         $sql->insert();
     }
     // null zurückgeben, damit zu diesem Feld nichts im rexForm gespeichert wird
     return null;
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-addons,代码行数:23,代码来源:class.rex_externalMultiValueManager.inc.php

示例8: execute

 function execute()
 {
     // echo "DB EXECUTE";
     // return;
     $sql = new rex_sql();
     if ($this->params["debug"]) {
         $sql->debugsql = TRUE;
     }
     $main_table = "";
     if (isset($this->action["elements"][2]) && $this->action["elements"][2] != "") {
         $main_table = $this->action["elements"][2];
     } else {
         $main_table = $this->params["main_table"];
     }
     if ($main_table == "") {
         $this->params["form_show"] = TRUE;
         $this->params["hasWarnings"] = TRUE;
         $this->params["warning_messages"][] = $this->params["Error-Code-InsertQueryError"];
         return FALSE;
     }
     $sql->setTable($main_table);
     $where = "";
     if (isset($this->action["elements"][3]) && trim($this->action["elements"][3]) != "") {
         $where = trim($this->action["elements"][3]);
     }
     // SQL Objekt mit Werten füllen
     foreach ($this->elements_sql as $key => $value) {
         $sql->setValue($key, $value);
         if ($where != "") {
             $where = str_replace('###' . $key . '###', addslashes($value), $where);
         }
     }
     if ($where != "") {
         $sql->setWhere($where);
         $sql->update();
         $flag = "update";
     } else {
         $sql->insert();
         $flag = "insert";
         $id = $sql->getLastId();
         $this->elements_email["ID"] = $id;
         // $this->elements_sql["ID"] = $id;
         if ($id == 0) {
             $this->params["form_show"] = TRUE;
             $this->params["hasWarnings"] = TRUE;
             $this->params["warning_messages"][] = $this->params["Error-Code-InsertQueryError"];
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:49,代码来源:class.xform.action_db.inc.php

示例9:

 static function syncCatname2Artname($params)
 {
     global $REX, $I18N;
     $id = $params['id'];
     $clang = $params['clang'];
     $name = $params['data']['catname'];
     if ($name != '') {
         $sql = new rex_sql();
         $sql->setTable($REX['TABLE_PREFIX'] . 'article');
         $sql->setWhere('id=' . $id . ' AND clang=' . $clang);
         $sql->setValue('name', $name);
         $sql->addGlobalUpdateFields();
         $sql->update();
         rex_deleteCacheArticle($id, $clang);
     }
 }
开发者ID:olien,项目名称:be_utilities,代码行数:16,代码来源:class.rex_articlename_sync.inc.php

示例10: rex_setup_setUtf8

function rex_setup_setUtf8()
{
    global $REX;
    $gt = new rex_sql();
    $gt->setQuery("show tables");
    foreach ($gt->getArray() as $t) {
        $table = $t["Tables_in_" . $REX['DB']['1']['NAME']];
        $gc = new rex_sql();
        $gc->setQuery("show columns from {$table}");
        if (substr($table, 0, strlen($REX['TABLE_PREFIX'])) == $REX['TABLE_PREFIX']) {
            $columns = array();
            $pri = "";
            foreach ($gc->getArray() as $c) {
                $columns[] = $c["Field"];
                if ($pri == "" && $c["Key"] == "PRI") {
                    $pri = $c["Field"];
                }
            }
            if ($pri != "") {
                $gr = new rex_sql();
                $gr->setQuery("select * from {$table}");
                foreach ($gr->getArray() as $r) {
                    reset($columns);
                    $privalue = $r[$pri];
                    $uv = new rex_sql();
                    $uv->setTable($table);
                    $uv->setWhere($pri . '= "' . $privalue . '"');
                    foreach ($columns as $key => $column) {
                        if ($pri != $column) {
                            $value = $r[$column];
                            $newvalue = utf8_decode($value);
                            $uv->setValue($column, addslashes($newvalue));
                        }
                    }
                    $uv->update();
                }
            }
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:40,代码来源:setup.inc.php

示例11: organizePriorities

 function organizePriorities($newPrio, $oldPrio)
 {
     if ($newPrio == $oldPrio) {
         return;
     }
     if ($newPrio < $oldPrio) {
         $addsql = 'desc';
     } else {
         $addsql = 'asc';
     }
     $sql = new rex_sql();
     $sql->debugsql =& $this->debug;
     $sql->setQuery('SELECT field_id FROM ' . $this->tableName . ' WHERE name LIKE "' . $this->metaPrefix . '%" ORDER BY prior, updatedate ' . $addsql);
     $updateSql = new rex_sql();
     $updateSql->debugsql =& $this->debug;
     for ($i = 0; $i < $sql->getRows(); $i++) {
         $updateSql->setTable($this->tableName);
         $updateSql->setValue('prior', $i + 1);
         $updateSql->setWhere('name LIKE "' . $this->metaPrefix . '%" AND field_id = ' . $sql->getValue('field_id'));
         $updateSql->update();
         $sql->next();
     }
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:23,代码来源:class.rex_tableExpander.inc.php

示例12: addslashes

$gm = new rex_sql();
$gm->setQuery('select * from rex_module where ausgabe LIKE "%' . $searchtext . '%"');
$module_id = 0;
$module_name = "";
foreach ($gm->getArray() as $module) {
    $module_id = $module["id"];
    $module_name = $module["name"];
}
if (isset($_REQUEST["install"]) && $_REQUEST["install"] == 1) {
    $xform_module_name = "rex - X-Form";
    // Daten einlesen
    $in = rex_get_file_contents($REX["INCLUDE_PATH"] . "/addons/xform/module/module_in.inc");
    $out = rex_get_file_contents($REX["INCLUDE_PATH"] . "/addons/xform/module/module_out.inc");
    $mi = new rex_sql();
    // $mi->debugsql = 1;
    $mi->setTable("rex_module");
    $mi->setValue("eingabe", addslashes($in));
    $mi->setValue("ausgabe", addslashes($out));
    // altes Module aktualisieren
    if (isset($_REQUEST["module_id"]) && $module_id == $_REQUEST["module_id"]) {
        $mi->setWhere('id="' . $module_id . '"');
        $mi->update();
        echo rex_info('Modul "' . $module_name . '" wurde aktualisiert');
    } else {
        $mi->setValue("name", $xform_module_name);
        $mi->insert();
        echo rex_info('XForm Modul wurde angelegt unter "' . $xform_module_name . '"');
    }
}
?>
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:30,代码来源:module.inc.php

示例13: rex_medienpool_registerFile

function rex_medienpool_registerFile($physical_filename, $org_filename, $filename, $category_id, $title, $filesize, $filetype)
{
    global $REX, $REX_USER;
    $abs_file = $REX['MEDIAFOLDER'] . '/' . $physical_filename;
    if (!file_exists($abs_file)) {
        return false;
    }
    if (empty($filesize)) {
        $filesize = filesize($abs_file);
    }
    if (empty($filetype) && function_exists('mime_content_type')) {
        $filetype = mime_content_type($abs_file);
    }
    @chmod($abs_file, $REX['FILEPERM']);
    $filename = rex_medienpool_filename($filename, false);
    $org_filename = strtolower($org_filename);
    // Ggf Alte Datei umbennen
    rename($abs_file, $REX['MEDIAFOLDER'] . '/' . $filename);
    $abs_file = $REX['MEDIAFOLDER'] . '/' . $filename;
    // get widht height
    $size = @getimagesize($abs_file);
    $FILESQL = new rex_sql();
    // $FILESQL->debugsql=1;
    $FILESQL->setTable($REX['TABLE_PREFIX'] . "file");
    $FILESQL->setValue('filename', $filename);
    $FILESQL->setValue('originalname', $org_filename);
    $FILESQL->setValue('category_id', $category_id);
    $FILESQL->setValue('title', $title);
    $FILESQL->setValue('filesize', $filesize);
    $FILESQL->setValue('filetype', $filetype);
    $FILESQL->setValue('width', $size[0]);
    $FILESQL->setValue('height', $size[1]);
    // TODO Hier Update + Create zugleich?
    $FILESQL->addGlobalUpdateFields();
    $FILESQL->addGlobalCreateFields();
    $FILESQL->insert();
    return $FILESQL->getError() == '';
}
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:38,代码来源:medienpool.inc.php

示例14:

             $err_msg .= ' ';
         }
         $err_msg .= $I18N->msg('setup_041');
     }
     if ($err_msg == "") {
         $ga = new rex_sql();
         $ga->setQuery("select * from " . $REX['TABLE_PREFIX'] . "user where login='{$redaxo_user_login}'");
         if ($ga->getRows() > 0) {
             $err_msg .= $I18N->msg('setup_042');
         } else {
             if ($REX['PSWFUNC'] != '') {
                 $redaxo_user_pass = call_user_func($REX['PSWFUNC'], $redaxo_user_pass);
             }
             $user = new rex_sql();
             // $user->debugsql = true;
             $user->setTable($REX['TABLE_PREFIX'] . 'user');
             $user->setValue('name', 'Administrator');
             $user->setValue('login', $redaxo_user_login);
             $user->setValue('psw', $redaxo_user_pass);
             $user->setValue('rights', '#admin[]#dev[]#import[]#stats[]#moveSlice[]#');
             $user->addGlobalCreateFields('setup');
             $user->setValue('status', '1');
             if (!$user->insert()) {
                 $err_msg .= $I18N->msg("setup_043");
             }
         }
     }
 } else {
     $gu = new rex_sql();
     $gu->setQuery("select * from " . $REX['TABLE_PREFIX'] . "user LIMIT 1");
     if ($gu->getRows() == 0) {
开发者ID:BackupTheBerlios,项目名称:redaxo,代码行数:31,代码来源:setup.inc.php

示例15: createTable

 function createTable($mifix = "", $data_table, $params = array(), $debug = FALSE)
 {
     // Tabelle erstellen wenn noch nicht vorhanden
     $c = rex_sql::factory();
     $c->debugsql = $debug;
     $c->setQuery('CREATE TABLE IF NOT EXISTS `' . $data_table . '` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY );');
     // Tabellenset in die Basics einbauen, wenn noch nicht vorhanden
     $c = new rex_sql();
     $c->debugsql = $debug;
     $c->setQuery('DELETE FROM rex_xform_table where table_name="' . $data_table . '"');
     $c->setTable('rex_xform_table');
     $params["table_name"] = $data_table;
     if (!isset($params["status"])) {
         $params["status"] = 1;
     }
     if (!isset($params["name"])) {
         $params["name"] = 'Tabelle "' . $data_table . '"';
     }
     if (!isset($params["prio"])) {
         $params["prio"] = 100;
     }
     if (!isset($params["search"])) {
         $params["search"] = 0;
     }
     if (!isset($params["hidden"])) {
         $params["hidden"] = 0;
     }
     if (!isset($params["export"])) {
         $params["export"] = 0;
     }
     foreach ($params as $k => $v) {
         $c->setValue($k, $v);
     }
     $c->insert();
     return TRUE;
 }
开发者ID:rotzek,项目名称:redaxo_xform,代码行数:36,代码来源:class.rex_xform_manager.inc.php


注:本文中的rex_sql::setTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。