本文整理汇总了PHP中CriteriaCompo::render方法的典型用法代码示例。如果您正苦于以下问题:PHP CriteriaCompo::render方法的具体用法?PHP CriteriaCompo::render怎么用?PHP CriteriaCompo::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CriteriaCompo
的用法示例。
在下文中一共展示了CriteriaCompo::render方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intval
function &get($blog_id, $direction = "")
{
$blog_id = intval($blog_id);
$criteria = new CriteriaCompo(new Criteria('blog_id', $blog_id));
if ($direction) {
$criteria->add(new Criteria('direction', $direction));
}
if ($blog_id > 0) {
$sql = sprintf('SELECT blog_id, tb_url, blog_name, title, description, link, direction,trackback_created FROM %s WHERE %s order by trackback_created DESC', $this->db->prefix($this->mydirname . '_trackback'), $criteria->render());
if ($result = $this->db->query($sql)) {
$trackback_array = array();
while ($trackback_data = $this->db->fetchArray($result)) {
$trackback_obj = $this->create();
$trackback_obj->assignVars($trackback_data);
array_push($trackback_array, $trackback_obj);
}
return $trackback_array;
}
}
return false;
}
示例2: xnpbookGetAdvancedSearchQuery
function xnpbookGetAdvancedSearchQuery(&$where, &$join)
{
global $xoopsDB;
$book_table = $xoopsDB->prefix('xnpbook_item_detail');
$book_author = $xoopsDB->prefix('xnpbook_author');
$wheres = array();
$w = xnpGetBasicInformationAdvancedSearchQuery('xnpbook');
if ($w) {
$wheres[] = $w;
}
$w = xnpGetKeywordQuery($book_author . '.author', 'xnpbook_author');
if ($w) {
$wheres[] = $w;
}
$w = xnpGetKeywordQuery($book_table . '.editor', 'xnpbook_editor');
if ($w) {
$wheres[] = $w;
}
$w = xnpGetKeywordQuery($book_table . '.publisher', 'xnpbook_publisher');
if ($w) {
$wheres[] = $w;
}
$w = xnpGetKeywordQuery($book_table . '.isbn', 'xnpbook_isbn');
if ($w) {
$wheres[] = $w;
}
$formdata =& xoonips_getutility('formdata');
$xnpbook_book_pdf = $formdata->getValue('post', 'xnpbook_book_pdf', 's', false);
if (!empty($xnpbook_book_pdf)) {
$search_text_table = $xoopsDB->prefix('xoonips_search_text');
$file_table = $xoopsDB->prefix('xoonips_file');
$searchutil =& xoonips_getutility('search');
$fulltext_query = $xnpbook_book_pdf;
$fulltext_encoding = mb_detect_encoding($fulltext_query);
$fulltext_criteria = new CriteriaCompo($searchutil->getFulltextSearchCriteria('search_text', $fulltext_query, $fulltext_encoding, $search_text_table));
$fulltext_criteria->add(new Criteria('is_deleted', 0, '=', $file_table));
$wheres[] = $fulltext_criteria->render();
}
$where = implode(' AND ', $wheres);
$join = " INNER JOIN {$book_author} ON " . $book_author . '.book_id = ' . $xoopsDB->prefix('xoonips_item_basic') . '.item_id ';
}
示例3: xnppresentationGetAdvancedSearchQuery
function xnppresentationGetAdvancedSearchQuery(&$where, &$join)
{
global $xoopsDB;
$formdata =& xoonips_getutility('formdata');
$basic_table = $xoopsDB->prefix('xoonips_item_basic');
$presentation_table = $xoopsDB->prefix('xnppresentation_item_detail');
$presentation_creator_table = $xoopsDB->prefix('xnppresentation_creator');
$file_table = $xoopsDB->prefix('xoonips_file');
$search_text_table = $xoopsDB->prefix('xoonips_search_text');
$wheres = array();
$joins = array();
$xnppresentation_presentation_type = $formdata->getValue('post', 'xnppresentation_presentation_type', 's', false);
$xnppresentation_presentation_file = $formdata->getValue('post', 'xnppresentation_presentation_file', 's', false);
$w = xnpGetBasicInformationAdvancedSearchQuery('xnppresentation');
if ($w) {
$wheres[] = $w;
}
if (!empty($xnppresentation_presentation_type)) {
$myts =& MyTextSanitizer::getInstance();
$wheres[] = $presentation_table . '.presentation_type = \'' . addslashes($xnppresentation_presentation_type) . '\'';
}
$w = xnpGetKeywordQuery($presentation_creator_table . '.creator', 'xnppresentation_creator');
if ($w) {
$wheres[] = $w;
}
$w = xnpGetKeywordQuery($file_table . '.caption', 'xnppresentation_caption');
if ($w) {
$wheres[] = $w;
$wheres[] = " {$file_table}.file_type_id = 1";
}
if (!empty($xnppresentation_presentation_file)) {
$search_text_table = $xoopsDB->prefix('xoonips_search_text');
$file_table = $xoopsDB->prefix('xoonips_file');
$searchutil =& xoonips_getutility('search');
$fulltext_query = $xnppresentation_presentation_file;
$fulltext_encoding = mb_detect_encoding($fulltext_query);
$fulltext_criteria = new CriteriaCompo($searchutil->getFulltextSearchCriteria('search_text', $fulltext_query, $fulltext_encoding, $search_text_table));
$fulltext_criteria->add(new Criteria('is_deleted', 0, '=', $file_table));
$wheres[] = $fulltext_criteria->render();
}
$where = implode(' AND ', $wheres);
$join = " INNER JOIN {$presentation_creator_table} ON " . $presentation_creator_table . '.presentation_id = ' . $xoopsDB->prefix('xoonips_item_basic') . '.item_id ';
}
示例4: getUserCountByGroupLink
/**
* Get count of users belonging to certain groups and matching criteria
* Temporary solution
*
* @param int $groups IDs of groups
* @param null $criteria
* @return int count of users
*/
function getUserCountByGroupLink($groups, $criteria = null)
{
$ret = 0;
$criteriaCompo = new CriteriaCompo();
$sql = "SELECT DISTINCT COUNT(u.uid) " . " FROM " . $this->_uHandler->db->prefix("users") . " AS u" . " LEFT JOIN " . $this->_mHandler->db->prefix("groups_users_link") . " AS m ON m.uid = u.uid" . " WHERE ";
if (!empty($groups)) {
$criteriaCompo->add(new Criteria('m.groupid', "(" . implode(", ", $groups) . ")", 'IN'));
}
if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
$criteriaCompo->add($criteria);
}
$sql_criteria = $criteriaCompo->render();
if ($sql_criteria) {
$sql .= $sql_criteria;
} else {
$sql .= "1 = 1";
}
if (!($result = $this->_uHandler->db->query($sql))) {
return $ret;
}
list($ret) = $this->_uHandler->db->fetchRow($result);
return $ret;
}
示例5: xnppaperGetAdvancedSearchQuery
function xnppaperGetAdvancedSearchQuery(&$where, &$join)
{
global $xoopsDB;
$formdata =& xoonips_getutility('formdata');
$paper_table = $xoopsDB->prefix('xnppaper_item_detail');
$paper_author_table = $xoopsDB->prefix('xnppaper_author');
$file_table = $xoopsDB->prefix('xoonips_search_text');
$wheres = array();
$w = xnpGetBasicInformationAdvancedSearchQuery('xnppaper');
if ($w) {
$wheres[] = $w;
}
$w = xnpGetKeywordQuery($paper_table . '.journal', 'xnppaper_journal');
if ($w) {
$wheres[] = $w;
}
$w = xnpGetKeywordQuery($paper_table . '.volume', 'xnppaper_volume');
if ($w) {
$wheres[] = $w;
}
$w = xnpGetKeywordQuery($paper_table . '.number', 'xnppaper_number');
if ($w) {
$wheres[] = $w;
}
$w = xnpGetKeywordQuery($paper_table . '.page', 'xnppaper_page');
if ($w) {
$wheres[] = $w;
}
$w = xnpGetKeywordQuery($paper_table . '.pubmed_id', 'xnppaper_pubmed_id');
if ($w) {
$wheres[] = $w;
}
$w = xnpGetKeywordQuery($paper_author_table . '.author', 'xnppaper_author');
if ($w) {
$wheres[] = $w;
}
$xnppaper_paper_pdf_reprint = $formdata->getValue('post', 'xnppaper_paper_pdf_reprint', 's', false);
if (!empty($xnppaper_paper_pdf_reprint)) {
$search_text_table = $xoopsDB->prefix('xoonips_search_text');
$file_table = $xoopsDB->prefix('xoonips_file');
$searchutil =& xoonips_getutility('search');
$fulltext_query = $xnppaper_paper_pdf_reprint;
$fulltext_encoding = mb_detect_encoding($fulltext_query);
$fulltext_criteria = new CriteriaCompo($searchutil->getFulltextSearchCriteria('search_text', $fulltext_query, $fulltext_encoding, $search_text_table));
$fulltext_criteria->add(new Criteria('is_deleted', 0, '=', $file_table));
$wheres[] = $fulltext_criteria->render();
}
$where = implode(' AND ', $wheres);
$join = '';
$join = " INNER JOIN {$paper_author_table} on " . $paper_author_table . '.paper_id = ' . $xoopsDB->prefix('xoonips_item_basic') . '.item_id ';
}
示例6: checkForumAccess
function checkForumAccess()
{
$uid = $this->sessionHandler->getUid();
$user =& $this->sessionHandler->getUser();
$forum_access_level = 0;
$forum_type = 1;
$is_mod = 0;
$is_admin = 0;
if ($this->forum_id) {
$sql = 'SELECT forum_access,forum_type FROM ' . $this->db->prefix('xhnewbb_forums') . ' WHERE forum_id = ' . $this->forum_id;
} elseif ($this->topic_id) {
$sql = 'SELECT f.forum_access,f.forum_type FROM ' . $this->db->prefix('xhnewbb_topics') . ' t LEFT JOIN ' . $this->db->prefix('xhnewbb_forums') . ' f ON t.forum_id=f.forum_id WHERE t.topic_id=' . $this->topic_id;
} else {
return $this->forum_access;
}
// debug
$this->utils->setDebugMessage(__CLASS__, 'checkForumAccess sql', $sql);
if (!($ret = $this->db->query($sql))) {
$this->utils->setDebugMessage(__CLASS__, 'checkForumAccess sql error', $this->db->error());
}
while ($data = $this->db->fetchArray($ret)) {
$forum_access_level = $data['forum_access'];
$forum_type = $data['forum_type'];
}
if ($forum_type == 1) {
if (is_object($user)) {
$criteria = new CriteriaCompo();
$groupid_array = $this->utils->getGroupIdArray($user);
foreach ($groupid_array as $groupid) {
$criteria->add(new Criteria('groupid', $groupid), 'OR');
}
$sql3 = 'SELECT user_id, can_post FROM ' . $this->db->prefix('xhnewbb_forum_access') . ' WHERE forum_id = ' . $this->forum_id . ' AND user_id = ' . $uid;
if ($criteria->render() != '') {
$sql3 .= ' OR ' . $criteria->render();
}
if (!($ret3 = $this->db->query($sql3))) {
// debug
$this->utils->setDebugMessage(__CLASS__, 'checkForumAccess xhnewbb_forum_access sql', $sql3);
$this->utils->setDebugMessage(__CLASS__, 'checkForumAccess xhnewbb_forum_access sql error', $this->db->error());
}
$ret3_n = $this->db->getRowsNum($ret3);
if ($ret3_n > 0) {
list($user_id, $can_post) = $this->db->fetchRow($ret3);
if ($can_post) {
$this->forum_access = 2;
} else {
$this->forum_access = 1;
}
}
}
} else {
if ($forum_access_level == 2) {
$this->forum_access = 2;
} elseif ($forum_access_level == 1) {
if ($uid) {
$this->forum_access = 2;
} else {
$this->forum_access = 1;
// ゲスト閲覧のみ許可
}
}
}
//moderator
$sql2 = 'SELECT * FROM ' . $this->db->prefix('xhnewbb_forum_mods') . ' WHERE forum_id = ' . $this->forum_id . ' AND user_id = ' . $uid;
if (!($ret2 = $this->db->query($sql2))) {
// debug
$this->utils->setDebugMessage(__CLASS__, 'checkForumAccess xhnewbb_forum_mods sql', $sql2);
$this->utils->setDebugMessage(__CLASS__, 'checkForumAccess xhnewbb_forum_mods sql error', $this->db->error());
}
$ret2_n = $this->db->getRowsNum($ret2);
if ($ret2_n > 0) {
$this->forum_access = 3;
}
//module admin
if ($mod_admin = $this->getModuleAdmin()) {
$this->forum_access = 3;
}
// poster
if ($uid) {
$sql4 = 'SELECT post_id FROM ' . $this->db->prefix('xhnewbb_posts') . ' WHERE uid = ' . $uid . ' AND post_id = ' . $this->post_id;
if (!($ret4 = $this->db->query($sql4))) {
// debug
$this->utils->setDebugMessage(__CLASS__, 'checkForumAccess xhnewbb_posts sql', $sql4);
$this->utils->setDebugMessage(__CLASS__, 'checkForumAccess xhnewbb_posts sql error', $this->db->error());
}
$ret4_n = $this->db->getRowsNum($ret4);
if ($ret4_n > 0) {
$this->forum_access = 3;
}
}
// debug
$this->utils->setDebugMessage(__CLASS__, 'forum_access_level', $forum_access_level);
$this->utils->setDebugMessage(__CLASS__, 'forum_access', $this->forum_access);
$this->utils->setDebugMessage(__CLASS__, 'forum_type', $forum_type);
return $this->forum_access;
}
示例7: getUserCountByGroupLink
/**
* Get count of users belonging to certain groups and matching criteria
* Temporary solution
*
* @param int $groups IDs of groups
* @param CriteriaElement $criteria
* @return int count of users
*/
public function getUserCountByGroupLink($groups, CriteriaElement $criteria = null)
{
$ret = 0;
$criteriaCompo = new CriteriaCompo();
$sql = 'SELECT DISTINCT COUNT(u.uid) ' . ' FROM ' . $this->userHandler->db->prefix('users') . ' AS u' . ' LEFT JOIN ' . $this->membershipHandler->db->prefix('groups_users_link') . ' AS m ON m.uid = u.uid' . ' WHERE ';
if (!empty($groups)) {
$criteriaCompo->add(new Criteria('m.groupid', '(' . implode(', ', $groups) . ')', 'IN'));
}
if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
$criteriaCompo->add($criteria);
}
$sql_criteria = $criteriaCompo->render();
if ($sql_criteria) {
$sql .= $sql_criteria;
} else {
$sql .= '1 = 1';
}
if (!($result = $this->userHandler->db->query($sql))) {
return $ret;
}
list($ret) = $this->userHandler->db->fetchRow($result);
return $ret;
}
示例8: getAllSubmitted
function getAllSubmitted($limit = 0, $asobject = true, $checkRight = false)
{
$db =& Database::getInstance();
$myts =& MyTextSanitizer::getInstance();
$ret = array();
$criteria = new CriteriaCompo(new Criteria('published', 0));
if ($checkRight) {
global $xoopsUser;
if (!$xoopsUser) {
return $ret;
}
$groups = $xoopsUser->getGroups();
$gperm_handler =& xoops_gethandler('groupperm');
global $xoopsModule;
if (!isset($xoopsModule) || $xoopsModule->getVar('dirname') != "AMS") {
$module_handler =& xoops_gethandler('module');
$newsmodule =& $module_handler->getByDirname('AMS');
} else {
$newsmodule =& $xoopsModule;
}
$allowedtopics = $gperm_handler->getItemIds('ams_approve', $groups, $newsmodule->getVar('mid'));
if (count($allowedtopics) == 0) {
return $ret;
}
$criteria2 = new CriteriaCompo();
$criteria2->add(new Criteria('topicid', "(" . implode(',', $allowedtopics) . ")", 'IN'));
$criteria->add($criteria2);
}
$criteria->setOrder('DESC');
$criteria->setSort('created');
$sql = "SELECT * FROM " . $db->prefix("ams_article") . " n, " . $db->prefix("ams_text") . " t WHERE n.storyid=t.storyid AND t.current=1";
$sql .= ' AND ' . $criteria->render();
$result = $db->query($sql, $limit, 0);
while ($myrow = $db->fetchArray($result)) {
if ($asobject) {
$ret[] = new AmsStory($myrow);
} else {
$ret[$myrow['storyid']] = $myts->htmlSpecialChars($myrow['title']);
}
}
return $ret;
}
示例9: xnptoolGetAdvancedSearchQuery
function xnptoolGetAdvancedSearchQuery(&$where, &$join)
{
global $xoopsDB;
$formdata =& xoonips_getutility('formdata');
$tool_table = $xoopsDB->prefix('xnptool_item_detail');
$tool_developer_table = $xoopsDB->prefix('xnptool_developer');
$file_table = $xoopsDB->prefix('xoonips_file');
$search_text_table = $xoopsDB->prefix('xoonips_search_text');
$wheres = array();
$joins = array();
$w = xnpGetBasicInformationAdvancedSearchQuery('xnptool');
if ($w) {
$wheres[] = $w;
}
$w = xnpGetKeywordQuery($tool_table . '.tool_type', 'xnptool_tool_type');
if ($w) {
$wheres[] = $w;
}
$w = xnpGetKeywordQuery($tool_developer_table . '.developer', 'xnptool_developer');
if ($w) {
$wheres[] = $w;
}
$w = xnpGetKeywordQuery($file_table . '.caption', 'xnptool_caption');
if ($w) {
$wheres[] = $w;
$wheres[] = " {$file_table}.file_type_id = 1";
}
$xnptool_tool_file = $formdata->getValue('post', 'xnptool_tool_file', 's', false);
if (!empty($xnptool_tool_file)) {
$search_text_table = $xoopsDB->prefix('xoonips_search_text');
$file_table = $xoopsDB->prefix('xoonips_file');
$searchutil =& xoonips_getutility('search');
$fulltext_query = $xnptool_tool_file;
$fulltext_encoding = mb_detect_encoding($fulltext_query);
$fulltext_criteria = new CriteriaCompo($searchutil->getFulltextSearchCriteria('search_text', $fulltext_query, $fulltext_encoding, $search_text_table));
$fulltext_criteria->add(new Criteria('is_deleted', 0, '=', $file_table));
$wheres[] = $fulltext_criteria->render();
}
$where = implode(' AND ', $wheres);
$join = " INNER JOIN {$tool_developer_table} ON " . $tool_developer_table . '.tool_id = ' . $xoopsDB->prefix('xoonips_item_basic') . '.item_id ';
}