本文整理汇总了PHP中User_group::joinAdd方法的典型用法代码示例。如果您正苦于以下问题:PHP User_group::joinAdd方法的具体用法?PHP User_group::joinAdd怎么用?PHP User_group::joinAdd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User_group
的用法示例。
在下文中一共展示了User_group::joinAdd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
if ($dry) {
echo " - skipping\n";
} else {
echo " - removing bogus ostatus_profile entry...";
$evil = Ostatus_profile::staticGet('uri', $uri);
$evil->delete();
echo " ok\n";
}
}
echo "\n";
// And there may be user_group entries remaining where we've already killed
// the ostatus_profile. These were "harmless" until our lookup started actually
// using the uri field, at which point we can clearly see it breaks stuff.
echo "Checking for leftover bogus user_group.uri entries obscuring local_group entries...\n";
$group = new User_group();
$group->joinAdd(array('id', 'local_group:group_id'), 'LEFT');
$group->whereAdd('group_id IS NULL');
$marker = mt_rand(31337, 31337000);
$groupTemplate = common_local_url('groupbyid', array('id' => $marker));
$encGroup = $group->escape($groupTemplate, true);
$encGroup = str_replace($marker, '%', $encGroup);
echo " LIKE '{$encGroup}'\n";
$group->whereAdd("uri LIKE '{$encGroup}'");
$group->find();
$count = $group->N;
echo "Found {$count}...\n";
while ($group->fetch()) {
$uri = $group->uri;
if (preg_match('!/group/(\\d+)/id!', $uri, $matches)) {
$id = intval($matches[1]);
$local = Local_group::staticGet('group_id', $id);
示例2: getGroups
function getGroups()
{
$group = new User_group();
// Disable this to get global group searches
$group->joinAdd(array('id', 'local_group:group_id'));
$order = false;
if (!empty($this->q)) {
$wheres = array('nickname', 'fullname', 'homepage', 'description', 'location');
foreach ($wheres as $where) {
// Double % because of sprintf
$group->whereAdd(sprintf('LOWER(%1$s.%2$s) LIKE LOWER("%%%3$s%%")', $group->escapedTableName(), $where, $group->escape($this->q)), 'OR');
}
$order = sprintf('%1$s.%2$s %3$s', $group->escapedTableName(), $this->getSortKey('created'), $this->reverse ? 'DESC' : 'ASC');
} else {
// User is browsing via AlphaNav
switch ($this->filter) {
case 'all':
// NOOP
break;
case '0-9':
$group->whereAdd(sprintf('LEFT(%1$s.%2$s, 1) BETWEEN %3$s AND %4$s', $group->escapedTableName(), 'nickname', $group->_quote("0"), $group->_quote("9")));
break;
default:
$group->whereAdd(sprintf('LEFT(LOWER(%1$s.%2$s), 1) = %3$s', $group->escapedTableName(), 'nickname', $group->_quote($this->filter)));
}
$order = sprintf('%1$s.%2$s %3$s, %1$s.%4$s ASC', $group->escapedTableName(), $this->getSortKey('nickname'), $this->reverse ? 'DESC' : 'ASC', 'nickname');
}
$offset = ($this->page - 1) * PROFILES_PER_PAGE;
$limit = PROFILES_PER_PAGE + 1;
$group->selectAdd();
$group->selectAdd('profile_id');
$group->orderBy($order);
$group->limit($offset, $limit);
$group->find();
return Profile::multiGet('id', $group->fetchAll('profile_id'));
}