本文整理汇总了PHP中Notice::selectAdd方法的典型用法代码示例。如果您正苦于以下问题:PHP Notice::selectAdd方法的具体用法?PHP Notice::selectAdd怎么用?PHP Notice::selectAdd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notice
的用法示例。
在下文中一共展示了Notice::selectAdd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNoticeIds
function getNoticeIds($offset, $limit, $since_id, $max_id)
{
$notice = new Notice();
$notice->selectAdd();
// clears it
$notice->selectAdd('id');
$notice->orderBy('created DESC, id DESC');
if (!is_null($offset)) {
$notice->limit($offset, $limit);
}
$notice->whereAdd('is_local =' . Notice::REMOTE);
// -1 == blacklisted, -2 == gateway (i.e. Twitter)
$notice->whereAdd('is_local !=' . Notice::LOCAL_NONPUBLIC);
$notice->whereAdd('is_local !=' . Notice::GATEWAY);
Notice::addWhereSinceId($notice, $since_id);
Notice::addWhereMaxId($notice, $max_id);
if (!empty($this->selectVerbs)) {
$notice->whereAddIn('verb', $this->selectVerbs, $notice->columnType('verb'));
}
$ids = array();
if ($notice->find()) {
while ($notice->fetch()) {
$ids[] = $notice->id;
}
}
$notice->free();
$notice = NULL;
return $ids;
}
示例2: getNoticeIds
function getNoticeIds($offset, $limit, $since_id = null, $max_id = null)
{
$notice = new Notice();
// SELECT
$notice->selectAdd();
$notice->selectAdd('id');
// WHERE
$notice->conversation = $this->id;
if (!empty($since_id)) {
$notice->whereAdd(sprintf('notice.id > %d', $since_id));
}
if (!empty($max_id)) {
$notice->whereAdd(sprintf('notice.id <= %d', $max_id));
}
if (!is_null($offset)) {
$notice->limit($offset, $limit);
}
if (!empty($this->selectVerbs)) {
$notice->whereAddIn('verb', $this->selectVerbs, $notice->columnType('verb'));
}
// ORDER BY
// currently imitates the previously used "_reverseChron" sorting
$notice->orderBy('notice.created DESC');
$notice->find();
return $notice->fetchAll('id');
}
示例3: getNoticeIds
function getNoticeIds($offset, $limit, $since_id, $max_id)
{
$notice = new Notice();
$notice->selectAdd();
// clears it
$notice->selectAdd('id');
$notice->orderBy('created DESC, id DESC');
if (!is_null($offset)) {
$notice->limit($offset, $limit);
}
if (common_config('public', 'localonly')) {
$notice->whereAdd('is_local = ' . Notice::LOCAL_PUBLIC);
} else {
// -1 == blacklisted, -2 == gateway (i.e. Twitter)
$notice->whereAdd('is_local !=' . Notice::LOCAL_NONPUBLIC);
$notice->whereAdd('is_local !=' . Notice::GATEWAY);
}
Notice::addWhereSinceId($notice, $since_id);
Notice::addWhereMaxId($notice, $max_id);
$ids = array();
if ($notice->find()) {
while ($notice->fetch()) {
$ids[] = $notice->id;
}
}
$notice->free();
$notice = NULL;
return $ids;
}
示例4: getNoticeIds
function getNoticeIds($offset, $limit, $since_id, $max_id)
{
$notice = new Notice();
$notice->selectAdd();
// clears it
$notice->selectAdd('id');
$notice->orderBy('created DESC, id DESC');
if (!is_null($offset)) {
$notice->limit($offset, $limit);
}
// This feed always gives only local activities.
$notice->whereAdd('is_local = ' . Notice::LOCAL_PUBLIC);
Notice::addWhereSinceId($notice, $since_id);
Notice::addWhereMaxId($notice, $max_id);
if (!empty($this->selectVerbs)) {
$notice->whereAddIn('verb', $this->selectVerbs, $notice->columnType('verb'));
}
$ids = array();
if ($notice->find()) {
while ($notice->fetch()) {
$ids[] = $notice->id;
}
}
$notice->free();
$notice = NULL;
return $ids;
}
示例5: getNoticeIds
function getNoticeIds($offset, $limit, $since_id, $max_id)
{
$notice = new Notice();
$notice->selectAdd();
// clears it
$notice->selectAdd('id');
$notice->orderBy('created DESC, id DESC');
if (!is_null($offset)) {
$notice->limit($offset, $limit);
}
if (common_config('public', 'localonly')) {
$notice->whereAdd('is_local = ' . Notice::LOCAL_PUBLIC);
} else {
// -1 == blacklisted, -2 == gateway (i.e. Twitter)
$notice->whereAdd('is_local !=' . Notice::LOCAL_NONPUBLIC);
$notice->whereAdd('is_local !=' . Notice::GATEWAY);
}
Notice::addWhereSinceId($notice, $since_id);
Notice::addWhereMaxId($notice, $max_id);
$strSql = sprintf('(content_type=%d or content_type=%d)', NOTICE::CONTENT_TYPE_POST, NOTICE::CONTENT_TYPE_REPEAT);
$strSql = sprintf('(content_type in (%d,%d,%d,%d))', NOTICE::CONTENT_TYPE_REPEAT, NOTICE::CONTENT_TYPE_REPEAT | NOTICE::CONTENT_TYPE_MENTIONS, NOTICE::CONTENT_TYPE_POST, NOTICE::CONTENT_TYPE_POST | NOTICE::CONTENT_TYPE_MENTIONS);
$notice->whereAdd($strSql);
$ids = array();
if ($notice->find()) {
while ($notice->fetch()) {
$ids[] = $notice->id;
}
}
$notice->free();
$notice = NULL;
return $ids;
}
示例6: getNotices
function getNotices($y, $m, $d, $i)
{
$n = Notice::cacheGet("sitemap:notice:{$y}:{$m}:{$d}:{$i}");
if ($n === false) {
$notice = new Notice();
$begindt = sprintf('%04d-%02d-%02d 00:00:00', $y, $m, $d);
// XXX: estimates 1d == 24h, which screws up days
// with leap seconds (1d == 24h + 1s). Thankfully they're
// few and far between.
$theend = strtotime($begindt) + 24 * 60 * 60;
$enddt = common_sql_date($theend);
$notice->selectAdd();
$notice->selectAdd('id, created');
$notice->whereAdd("created >= '{$begindt}'");
$notice->whereAdd("created < '{$enddt}'");
$notice->whereAdd('is_local = ' . Notice::LOCAL_PUBLIC);
$notice->orderBy('created');
$offset = ($i - 1) * SitemapPlugin::NOTICES_PER_MAP;
$limit = SitemapPlugin::NOTICES_PER_MAP;
$notice->limit($offset, $limit);
$notice->find();
$n = array();
while ($notice->fetch()) {
$n[] = array($notice->id, $notice->created);
}
$c = Cache::instance();
if (!empty($c)) {
$c->set(Cache::key("sitemap:notice:{$y}:{$m}:{$d}:{$i}"), $n, Cache::COMPRESSED, time() > $theend ? time() + 90 * 24 * 60 * 60 : time() + 5 * 60);
}
}
return $n;
}
示例7: getNoticeIds
function getNoticeIds($offset, $limit, $since_id, $max_id)
{
$notice = new Notice();
$notice->profile_id = $this->profile->id;
$notice->selectAdd();
$notice->selectAdd('id');
Notice::addWhereSinceId($notice, $since_id);
Notice::addWhereMaxId($notice, $max_id);
$notice->orderBy('created DESC, id DESC');
if (!is_null($offset)) {
$notice->limit($offset, $limit);
}
$notice->find();
$ids = array();
while ($notice->fetch()) {
$ids[] = $notice->id;
}
return $ids;
}
示例8: getNotices
function getNotices()
{
$notice = new Notice();
$notice->joinAdd(array('id', 'file_to_post:post_id'));
$notice->whereAdd(sprintf('file_to_post.file_id = %d', $this->out->attachment->id));
$notice->orderBy('created desc');
$notice->selectAdd('post_id as id');
$notice->find();
return $notice;
}
示例9: getNotices
function getNotices()
{
$notice = new Notice();
$f2p = new File_to_post();
$f2p->file_id = $this->out->attachment->id;
$notice->joinAdd($f2p);
$notice->orderBy('created desc');
$notice->selectAdd('post_id as id');
$notice->find();
return $notice;
}
示例10: getNoticeIds
function getNoticeIds($offset, $limit, $since_id, $max_id)
{
$notice = new Notice();
$notice->selectAdd();
$notice->selectAdd('id');
$notice->orderBy('id DESC');
if (!is_null($offset)) {
$notice->limit($offset, $limit);
}
$notice->whereAdd('is_local !=' . Notice::LOCAL_NONPUBLIC);
$notice->whereAdd('is_local !=' . Notice::GATEWAY);
$notice->whereAdd('repeat_of IS NULL');
Notice::addWhereSinceId($notice, $since_id);
Notice::addWhereMaxId($notice, $max_id);
$ids = array();
if ($notice->find()) {
while ($notice->fetch()) {
$ids[] = $notice->id;
}
}
$notice->free();
$notice = NULL;
return $ids;
}
示例11: initInbox
function initInbox()
{
printfnq("Ensuring all users have an inbox...");
$user = new User();
$user->whereAdd('not exists (select user_id from inbox where user_id = user.id)');
$user->orderBy('id');
if ($user->find()) {
while ($user->fetch()) {
try {
$notice = new Notice();
$notice->selectAdd();
$notice->selectAdd('id');
$notice->joinAdd(array('profile_id', 'subscription:subscribed'));
$notice->whereAdd('subscription.subscriber = ' . $user->id);
$notice->whereAdd('notice.created >= subscription.created');
$ids = array();
if ($notice->find()) {
while ($notice->fetch()) {
$ids[] = $notice->id;
}
}
$notice = null;
$inbox = new Inbox();
$inbox->user_id = $user->id;
$inbox->pack($ids);
$inbox->insert();
} catch (Exception $e) {
printv("Error initializing inbox: " . $e->getMessage());
}
}
}
printfnq("DONE.\n");
}
示例12: Notice
function _repeatStreamDirect($limit)
{
$notice = new Notice();
$notice->selectAdd();
// clears it
$notice->selectAdd('id');
$notice->repeat_of = $this->id;
$notice->orderBy('created, id');
// NB: asc!
if (!is_null($limit)) {
$notice->limit(0, $limit);
}
return $notice->fetchAll('id');
}
示例13: getNoticeIds
function getNoticeIds($offset, $limit, $since_id, $max_id)
{
$notice = new Notice();
$notice->profile_id = $this->profile->id;
$notice->selectAdd();
$notice->selectAdd('id');
Notice::addWhereSinceId($notice, $since_id);
Notice::addWhereMaxId($notice, $max_id);
$strSql = sprintf('(content_type in (%d,%d,%d,%d))', NOTICE::CONTENT_TYPE_REPEAT, NOTICE::CONTENT_TYPE_REPEAT | NOTICE::CONTENT_TYPE_MENTIONS, NOTICE::CONTENT_TYPE_POST, NOTICE::CONTENT_TYPE_POST | NOTICE::CONTENT_TYPE_MENTIONS);
$notice->whereAdd($strSql);
$notice->orderBy('created DESC, id DESC');
if (!is_null($offset)) {
$notice->limit($offset, $limit);
}
$notice->find();
$ids = array();
while ($notice->fetch()) {
$ids[] = $notice->id;
}
return $ids;
}
示例14: handle
/**
* Handle the request
*
* Check the format and show the user info
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
protected function handle()
{
parent::handle();
// favs
$fave = new Fave();
$fave->selectAdd();
$fave->selectAdd('user_id');
$fave->selectAdd('modified');
$fave->notice_id = $this->original->id;
$fave->orderBy('modified');
if (!is_null($this->cnt)) {
$fave->limit(0, $this->cnt);
}
$fav_ids = $fave->fetchAll('user_id', 'modified');
// get nickname and profile image
$fav_ids_with_profile_data = array();
$i = 0;
foreach ($fav_ids as $id => $time) {
$profile = Profile::getKV('id', $id);
$fav_ids_with_profile_data[$i]['user_id'] = $id;
$fav_ids_with_profile_data[$i]['nickname'] = $profile->nickname;
$fav_ids_with_profile_data[$i]['fullname'] = $profile->fullname;
$fav_ids_with_profile_data[$i]['profileurl'] = $profile->profileurl;
$fav_ids_with_profile_data[$i]['time'] = strtotime($time);
$profile = new Profile();
$profile->id = $id;
$avatarurl = $profile->avatarUrl(48);
$fav_ids_with_profile_data[$i]['avatarurl'] = $avatarurl;
$i++;
}
// repeats
$notice = new Notice();
$notice->selectAdd();
// clears it
$notice->selectAdd('profile_id');
$notice->selectAdd('created');
$notice->repeat_of = $this->original->id;
$notice->orderBy('created, id');
// NB: asc!
if (!is_null($this->cnt)) {
$notice->limit(0, $this->cnt);
}
$repeat_ids = $notice->fetchAll('profile_id', 'created');
// get nickname and profile image
$repeat_ids_with_profile_data = array();
$i = 0;
foreach ($repeat_ids as $id => $time) {
$profile = Profile::getKV('id', $id);
$repeat_ids_with_profile_data[$i]['user_id'] = $id;
$repeat_ids_with_profile_data[$i]['nickname'] = $profile->nickname;
$repeat_ids_with_profile_data[$i]['fullname'] = $profile->fullname;
$repeat_ids_with_profile_data[$i]['profileurl'] = $profile->profileurl;
$repeat_ids_with_profile_data[$i]['time'] = strtotime($time);
$profile = new Profile();
$profile->id = $id;
$avatarurl = $profile->avatarUrl(48);
$repeat_ids_with_profile_data[$i]['avatarurl'] = $avatarurl;
$i++;
}
$favs_and_repeats = array('favs' => $fav_ids_with_profile_data, 'repeats' => $repeat_ids_with_profile_data);
$this->initDocument('json');
$this->showJsonObjects($favs_and_repeats);
$this->endDocument('json');
}
示例15: getFirstDate
static function getFirstDate()
{
$n = new Notice();
$n->selectAdd();
$n->selectAdd('date(min(created)) as first_date');
if ($n->find(true)) {
return $n->first_date;
} else {
// Is this right?
return self::dateIntToStr(time());
}
}