本文整理汇总了PHP中CriteriaCompo::setFields方法的典型用法代码示例。如果您正苦于以下问题:PHP CriteriaCompo::setFields方法的具体用法?PHP CriteriaCompo::setFields怎么用?PHP CriteriaCompo::setFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CriteriaCompo
的用法示例。
在下文中一共展示了CriteriaCompo::setFields方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setContent
function setContent($isreturn = false)
{
global $jieqiTpl;
global $jieqiConfigs;
jieqi_getconfigs('article', 'configs');
$article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['staticurl'];
$article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['dynamicurl'];
$jieqiTpl->assign('article_static_url', $article_static_url);
$jieqiTpl->assign('article_dynamic_url', $article_dynamic_url);
jieqi_includedb();
$query = JieqiQueryHandler::getInstance('JieqiQueryHandler');
$criteria = new CriteriaCompo();
$criteria->setFields("r.*,a.articlename");
$criteria->setTables(jieqi_dbprefix('article_reviews') . " AS r LEFT JOIN " . jieqi_dbprefix('article_article') . " AS a ON r.ownerid=a.articleid");
if ($this->exevars['istop'] == 1) {
$criteria->add(new Criteria('r.istop', '1'));
} elseif ($this->exevars['istop'] == 2) {
$criteria->add(new Criteria('r.istop', '0'));
}
if ($this->exevars['isgood'] == 1) {
$criteria->add(new Criteria('r.isgood', '1'));
} elseif ($this->exevars['isgood'] == 2) {
$criteria->add(new Criteria('r.isgood', '0'));
}
$criteria->setSort('r.topicid');
$criteria->setOrder('DESC');
$criteria->setLimit($this->exevars['listnum']);
$criteria->setStart(0);
$query->queryObjects($criteria);
$reviewrows = array();
$i = 0;
while ($v = $query->getObject()) {
$reviewrows[$i]['reviewtitle'] = jieqi_htmlstr(str_replace(array("\r", "\n"), array('', ' '), $v->getVar('title', 'n')));
$reviewrows[$i]['ownerid'] = $v->getVar('ownerid');
$reviewrows[$i]['articlename'] = $v->getVar('articlename');
$reviewrows[$i]['topicid'] = $v->getVar('topicid');
$reviewrows[$i]['url_review'] = $article_dynamic_url . '/reviews.php?aid=' . $v->getVar('ownerid');
$reviewrows[$i]['poster'] = $v->getVar('poster');
$reviewrows[$i]['posterid'] = $v->getVar('posterid');
$reviewrows[$i]['postdate'] = date('m-d H:i', $v->getVar('posttime'));
$reviewrows[$i]['posttime'] = $v->getVar('posttime');
$reviewrows[$i]['replytime'] = $v->getVar('replytime');
$reviewrows[$i]['views'] = $v->getVar('views');
$reviewrows[$i]['replies'] = $v->getVar('replies');
$reviewrows[$i]['islock'] = $v->getVar('islock');
$reviewrows[$i]['istop'] = $v->getVar('istop');
$reviewrows[$i]['isgood'] = $v->getVar('isgood');
$reviewrows[$i]['topictype'] = $v->getVar('topictype');
$reviewrows[$i]['url_articleinfo'] = jieqi_geturl('article', 'article', $v->getVar('ownerid'), 'info');
$reviewrows[$i]['url_articleindex'] = jieqi_geturl('article', 'article', $v->getVar('ownerid'), 'index');
$reviewrows[$i]['url_articleread'] = $reviewrows[$i]['url_articleindex'];
$i++;
}
$jieqiTpl->assign_by_ref('reviewrows', $reviewrows);
$jieqiTpl->assign('url_more', $article_dynamic_url . '/reviewslist.php');
}
示例2: unset
include_once $jieqiModules['obook']['path'] . '/class/obook.php';
$obook_handler =& JieqiobookHandler::getInstance('JieqiobookHandler');
$obook_handler->db->query('UPDATE ' . jieqi_dbprefix('obook_obook') . ' SET goodnum=goodnum-1 WHERE obookid=' . $obookcase->getVar('obookid', 'n'));
$obookcase_handler->delete($_REQUEST['delid']);
}
}
unset($obookcase);
}
//最大收藏数
$maxnum = $jieqiConfigs['obook']['bookcasenum'];
$jieqiTpl->assign('checkall', '<input type="checkbox" id="checkall" name="checkall" value="checkall" onclick="javascript: for (var i=0;i<this.form.elements.length;i++){ if (this.form.elements[i].name != \'checkkall\') this.form.elements[i].checked = form.checkall.checked; }">');
jieqi_includedb();
$obookcase_query = JieqiQueryHandler::getInstance('JieqiQueryHandler');
$criteria = new CriteriaCompo(new Criteria('c.userid', $_SESSION['jieqiUserId']));
$criteria->setTables(jieqi_dbprefix('obook_obookcase') . ' c LEFT JOIN ' . jieqi_dbprefix('obook_obook') . ' a ON c.obookid=a.obookid');
$criteria->setFields('c.*, a.obookid, a.articleid, a.lastupdate, a.obookname, a.lastchapterid, a.lastchapter');
$criteria->setSort('a.lastupdate');
$criteria->setOrder('DESC');
$obookcase_query->queryObjects($criteria);
unset($criteria);
$obookcaserows = array();
$k = 0;
while ($v = $obookcase_query->getObject()) {
$obookcaserows[$k]['ocaseid'] = $v->getVar('ocaseid');
$obookcaserows[$k]['checkbox'] = '<input type="checkbox" id="checkid[]" name="checkid[]" value="' . $v->getVar('oocaseid') . '">';
$tmpvar = $v->getVar('obookname');
if (!empty($tmpvar)) {
$obookcaserows[$k]['url_obookinfo'] = $obook_dynamic_url . '/readbookcase.php?oid=' . $v->getVar('obookid') . '&bid=' . $v->getVar('ocaseid');
$obookcaserows[$k]['url_index'] = $obookcaserows[$k]['url_obookinfo'] . '&indexflag=1';
$obookcaserows[$k]['obookname'] = $v->getVar('obookname');
} else {
示例3: for
$users_handler->changeScore($actreview->getVar('userid'), $jieqiConfigs['article']['scorereview'], false);
}
}
$sql='DELETE FROM '.jieqi_dbprefix('article_review').' WHERE '.$where;
$reviews_handler->db->query($sql);
}
*/
}
include_once JIEQI_ROOT_PATH . '/admin/header.php';
$jieqiTpl->assign('article_static_url', $article_static_url);
$jieqiTpl->assign('article_dynamic_url', $article_dynamic_url);
include_once JIEQI_ROOT_PATH . '/lib/text/textfunction.php';
$jieqiTpl->assign('url_review', $article_dynamic_url . '/admin/reviews.php');
$jieqiTpl->assign('checkall', '<input type="checkbox" id="checkall" name="checkall" value="checkall" onclick="javascript: for (var i=0;i<this.form.elements.length;i++){ if (this.form.elements[i].name != \'checkkall\') this.form.elements[i].checked = form.checkall.checked; }">');
$criteria = new CriteriaCompo();
$criteria->setFields("r.*,a.articlename");
$criteria->setTables(jieqi_dbprefix('article_reviews') . " AS r LEFT JOIN " . jieqi_dbprefix('article_article') . " AS a ON r.ownerid=a.articleid");
if (!empty($_REQUEST['keyword'])) {
$_REQUEST['keyword'] = trim($_REQUEST['keyword']);
if ($_REQUEST['keytype'] == 1) {
$criteria->add(new Criteria('r.poster', $_REQUEST['keyword'], '='));
} else {
$criteria->add(new Criteria('a.articlename', $_REQUEST['keyword'], '='));
}
}
if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'good') {
//精华书评
$criteria->add(new Criteria('isgood', 1));
} else {
$_REQUEST['type'] = 'all';
}
示例4: setContent
function setContent($isreturn = false)
{
global $jieqiTpl;
global $jieqiConfigs;
jieqi_getconfigs('article', 'configs');
jieqi_getconfigs('article', 'sort');
$article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['staticurl'];
$article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['dynamicurl'];
$jieqiTpl->assign('article_static_url', $article_static_url);
$jieqiTpl->assign('article_dynamic_url', $article_dynamic_url);
jieqi_includedb();
$bookcase_query = JieqiQueryHandler::getInstance('JieqiQueryHandler');
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('c.userid', intval($this->blockvars['cacheid'])));
if ($this->exevars['flag'] == 1) {
$criteria->add(new Criteria('flag', 1));
} elseif ($this->exevars['flag'] == 2) {
$criteria->add(new Criteria('flag', 0));
}
$criteria->setTables(jieqi_dbprefix('article_bookcase') . ' c LEFT JOIN ' . jieqi_dbprefix('article_article') . ' a ON c.articleid=a.articleid');
$criteria->setFields('c.*, a.articleid, a.lastupdate, a.articlename, a.authorid, a.author, a.sortid, a.typeid, a.lastchapterid, a.lastchapter');
$tmpary = array('articleid' => 'a.articleid', 'lastupdate' => 'a.lastupdate', 'caseid' => 'c.caseid', 'joindate' => 'c.joindate', 'lastvisit' => 'c.lastvisit');
$criteria->setSort($tmpary[$this->exevars['field']]);
if ($this->exevars['asc'] == 1) {
$criteria->setOrder('ASC');
} else {
$criteria->setOrder('DESC');
}
$criteria->setLimit($this->exevars['listnum']);
$criteria->setStart(0);
$bookcase_query->queryObjects($criteria);
unset($criteria);
$bookcaserows = array();
$k = 0;
while ($v = $bookcase_query->getObject()) {
$bookcaserows[$k]['caseid'] = $v->getVar('caseid');
$bookcaserows[$k]['articleid'] = $v->getVar('articleid');
$bookcaserows[$k]['lastchapterid'] = $v->getVar('lastchapterid');
$bookcaserows[$k]['chapterid'] = $v->getVar('chapterid');
$bookcaserows[$k]['sortid'] = $v->getVar('sortid');
$bookcaserows[$k]['typeid'] = $v->getVar('typeid');
$bookcaserows[$k]['sort'] = $jieqiSort['article'][$v->getVar('sortid')]['shortname'];
$bookcaserows[$k]['type'] = $bookcaserows[$k]['sort'];
//$bookcaserows[$k]['type']=$jieqiSort['article'][$v->getVar('sortid')]['types'][$v->getVar('typeid')];
$bookcaserows[$k]['authorid'] = $v->getVar('authorid');
$bookcaserows[$k]['author'] = $v->getVar('author');
$bookcaserows[$k]['checkbox'] = '<input type="checkbox" id="checkid[]" name="checkid[]" value="' . $v->getVar('caseid') . '">';
$tmpvar = $v->getVar('articlename');
if (!empty($tmpvar)) {
$bookcaserows[$k]['url_articleinfo'] = $article_dynamic_url . '/readbookcase.php?aid=' . $v->getVar('articleid') . '&bid=' . $v->getVar('caseid');
$bookcaserows[$k]['url_index'] = $bookcaserows[$k]['url_articleinfo'] . '&indexflag=1';
$bookcaserows[$k]['articlename'] = $v->getVar('articlename');
} else {
$bookcaserows[$k]['url_articleinfo'] = '#';
$bookcaserows[$k]['url_index'] = '#';
$bookcaserows[$k]['articlename'] = $jieqiLang['article']['articlemark_has_deleted'];
}
if ($v->getVar('lastchapter') == '') {
$bookcaserows[$k]['lastchapter'] = '';
$bookcaserows[$k]['url_lastchapter'] = '#';
} else {
$bookcaserows[$k]['lastchapter'] = $v->getVar('lastchapter');
$bookcaserows[$k]['url_lastchapter'] = $article_dynamic_url . '/readbookcase.php?aid=' . $v->getVar('articleid') . '&bid=' . $v->getVar('caseid') . '&cid=' . $v->getVar('lastchapterid');
}
if ($v->getVar('lastupdate') > $v->getVar('lastvisit')) {
$bookcaserows[$k]['hasnew'] = 1;
} else {
$bookcaserows[$k]['hasnew'] = 0;
}
if ($v->getVar('chaptername') == '') {
$bookcaserows[$k]['articlemark'] = '';
$bookcaserows[$k]['url_articlemark'] = '#';
} else {
$bookcaserows[$k]['articlemark'] = $v->getVar('chaptername');
$bookcaserows[$k]['url_articlemark'] = $article_dynamic_url . '/readbookcase.php?aid=' . $v->getVar('articleid') . '&bid=' . $v->getVar('caseid') . '&cid=' . $v->getVar('chapterid');
}
$bookcaserows[$k]['lastupdate'] = $v->getVar('lastupdate');
$bookcaserows[$k]['url_delete'] = jieqi_addurlvars(array('delid' => $v->getVar('caseid')));
$k++;
}
$jieqiTpl->assign_by_ref('bookcaserows', $bookcaserows);
$jieqiTpl->assign('ownerid', $this->blockvars['cacheid']);
}
示例5: CriteriaCompo
* @category jieqicms
* @package system
* @copyright Copyright (c) Hangzhou Jieqi Network Technology Co.,Ltd. (http://www.jieqi.com)
* @author $Author: juny $
* @version $Id: ptopiclist.php 329 2009-02-07 01:21:38Z juny $
*/
define('JIEQI_MODULE_NAME', 'system');
require_once 'global.php';
jieqi_getconfigs(JIEQI_MODULE_NAME, 'power');
jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs');
include_once JIEQI_ROOT_PATH . '/class/users.php';
$query = JieqiQueryHandler::getInstance('JieqiQueryHandler');
include_once JIEQI_ROOT_PATH . '/header.php';
include_once JIEQI_ROOT_PATH . '/lib/text/textfunction.php';
$criteria = new CriteriaCompo();
$criteria->setFields("t.*,u.uname,u.name");
$criteria->setTables(jieqi_dbprefix('system_ptopics') . " AS t LEFT JOIN " . jieqi_dbprefix('system_users') . " AS u ON t.ownerid=u.uid");
if (!empty($_REQUEST['keyword'])) {
$_REQUEST['keyword'] = trim($_REQUEST['keyword']);
if ($_REQUEST['keytype'] == 1) {
$criteria->add(new Criteria('t.poster', $_REQUEST['keyword'], '='));
}
if ($_REQUEST['keytype'] == 2) {
$criteria->add(new Criteria('t.title', '%' . $_REQUEST['keyword'] . '%', 'LIKE'));
} else {
$criteria->add(new Criteria('u.uname', $_REQUEST['keyword'], '='));
}
}
if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'good') {
$jieqiTpl->assign('type', 'good');
//精华书评
示例6: for
}
$jieqiTpl->assign('checkall', '<input type="checkbox" id="checkall" name="checkall" value="checkall" onclick="javascript: for (var i=0;i<this.form.elements.length;i++){ if (this.form.elements[i].name != \'checkkall\') this.form.elements[i].checked = form.checkall.checked; }">');
jieqi_includedb();
$bookcase_query = JieqiQueryHandler::getInstance('JieqiQueryHandler');
$criteria = new CriteriaCompo(new Criteria('userid', $_SESSION['jieqiUserId']));
$criteria->setTables(jieqi_dbprefix('article_bookcase'));
$jieqiTpl->assign('nowbookcase', $bookcase_query->getCount($criteria));
unset($criteria);
$criteria = new CriteriaCompo(new Criteria('c.userid', $_SESSION['jieqiUserId']));
if (is_numeric($_REQUEST['classid'])) {
$criteria->add(new Criteria('c.classid', $_REQUEST['classid']));
}
if ($jieqiModules['obook']['publish']) {
//有电子书时候查询电子书最新章节
$criteria->setTables(jieqi_dbprefix('article_bookcase') . ' c LEFT JOIN ' . jieqi_dbprefix('article_article') . ' a ON c.articleid=a.articleid LEFT JOIN ' . jieqi_dbprefix('obook_obook') . ' o ON a.articleid=o.articleid');
$criteria->setFields('c.*, a.articleid, a.lastupdate, a.articlename, a.lastchapterid, a.lastchapter, o.obookid, o.lastvolume as obookvolume, o.lastvolumeid as obookvolumeid, o.lastchapter as obookchapter, o.lastchapterid as obookchapterid, o.lastupdate as obookupdate, o.size as obooksize, o.publishid as obookpublishid');
$criteria->setSort('o.lastupdate DESC, a.lastupdate');
$criteria->setOrder('DESC');
} else {
$criteria->setTables(jieqi_dbprefix('article_bookcase') . ' c LEFT JOIN ' . jieqi_dbprefix('article_article') . ' a ON c.articleid=a.articleid');
$criteria->setFields('c.*, a.articleid, a.lastupdate, a.articlename, a.authorid, a.author, a.sortid, a.typeid, a.lastchapterid, a.lastchapter');
$criteria->setSort('a.lastupdate');
$criteria->setOrder('DESC');
}
$bookcase_query->queryObjects($criteria);
unset($criteria);
$bookcaserows = array();
$k = 0;
while ($v = $bookcase_query->getObject()) {
//电子书部分信息
if ($jieqiModules['obook']['publish']) {