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


PHP User_group::joinAdd方法代码示例

本文整理汇总了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);
开发者ID:microcosmx,项目名称:experiments,代码行数:31,代码来源:fixup-shadow.php

示例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'));
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:36,代码来源:groupdirectory.php


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