本文整理汇总了PHP中Notice::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Notice::find方法的具体用法?PHP Notice::find怎么用?PHP Notice::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notice
的用法示例。
在下文中一共展示了Notice::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare
/**
* For initializing members of the class.
*
* @param array $argarray misc. arguments
*
* @return boolean true
*/
function prepare($argarray)
{
parent::prepare($argarray);
$convId = $this->trimmed('id');
if (empty($convId)) {
// TRANS: Client exception thrown when no conversation ID is given.
throw new ClientException(_('No conversation ID.'));
}
$this->conversation = Conversation::staticGet('id', $convId);
if (empty($this->conversation)) {
// TRANS: Client exception thrown when referring to a non-existing conversation ID (%d).
$this->clientError(_('No conversation ID found'), 404);
return false;
}
$profile = Profile::current();
$stream = new ConversationNoticeStream($convId, $profile);
$notice = $stream->getNotices(($this->page - 1) * $this->count, $this->count, $this->since_id, $this->max_id);
$this->notices = $notice->fetchAll();
$originalConversation = new Notice();
$originalConversation->whereAdd('conversation=' . $convId);
$originalConversation->limit(1);
$originalConversation->orderBy('created');
$originalConversation->find();
if ($originalConversation->fetch()) {
$this->originalNotice = $originalConversation;
}
return true;
}
示例2: showNoticePlus
function showNoticePlus($item)
{
$replies = new Notice();
$replies->reply_to = $item->notice->id;
// We take responsibility for doing the li
$this->out->elementStart('li', array('class' => 'h-entry notice', 'id' => 'notice-' . $item->notice->id));
$item->show();
if ($replies->find()) {
$this->out->elementStart('ol', array('class' => 'notices'));
$replieslist = array();
while ($replies->fetch()) {
$replieslist[] = $this->newListItem(clone $replies);
}
//Sorting based on url argument
if ($_GET['sort'] == 'faves') {
usort($replieslist, array($this, '_cmpFav'));
} else {
usort($replieslist, array($this, '_cmpDate'));
}
foreach ($replieslist as $reply) {
$this->showNoticePlus($reply);
}
$this->out->elementEnd('ol');
}
$this->out->elementEnd('li');
}
示例3: getStreamByIds
static function getStreamByIds($ids)
{
$cache = Cache::instance();
if (!empty($cache)) {
$notices = array();
foreach ($ids as $id) {
$n = Notice::staticGet('id', $id);
if (!empty($n)) {
$notices[] = $n;
}
}
return new ArrayWrapper($notices);
} else {
$notice = new Notice();
if (empty($ids)) {
//if no IDs requested, just return the notice object
return $notice;
}
$notice->whereAdd('id in (' . implode(', ', $ids) . ')');
$notice->find();
$temp = array();
while ($notice->fetch()) {
$temp[$notice->id] = clone $notice;
}
$wrapped = array();
foreach ($ids as $id) {
if (array_key_exists($id, $temp)) {
$wrapped[] = $temp[$id];
}
}
return new ArrayWrapper($wrapped);
}
}
示例4: getNextBatch
/**
* Fetch the next self::DELETION_WINDOW messages for this user.
* @return Notice
*/
protected function getNextBatch(User $user)
{
$notice = new Notice();
$notice->profile_id = $user->id;
$notice->limit(self::DELETION_WINDOW);
$notice->find();
return $notice;
}
示例5: postDelete
public function postDelete()
{
$query = Notice::find(Input::get("id"));
NoticeUserAssociate::where("notice_id", $query->notice_id)->delete();
if ($query->delete()) {
return Redirect::back()->with("event", "<p class='alert alert-success'><span class='glyphicon glyphicon-ok'></span> Notice deleted.</p>");
}
return Redirect::back()->with("event", "<p class='alert alert-danger'><span class='glyphicon glyphicon-remove'></span> Error occured. Please try after sometime.</p>");
}
示例6: 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;
}
示例7: 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;
}
示例8: handle
function handle($args)
{
parent::handle($args);
$notice = new Notice();
$notice->source = 'activity';
$notice->find();
while ($notice->fetch()) {
$data = Notice::staticGet('id', $notice->id);
$orign = clone $data;
$data->content_type = NOTICE::CONTENT_TYPE_ACTIVITY;
if (!$data->update($orign)) {
echo 'profile update error' . $data->id;
echo '<br>';
}
}
}
示例9: getNoticeIds
function getNoticeIds($offset, $limit, $since_id, $max_id)
{
$notice = new Notice();
$search_engine = $notice->getSearchEngine('notice');
$search_engine->set_sort_mode('chron');
$search_engine->limit($offset, $limit);
$ids = array();
// wtf?
$search_engine->query($this->q);
if ($notice->find()) {
while ($notice->fetch()) {
$ids[] = $notice->id;
}
}
return $ids;
}
示例10: getNotices
function getNotices($limit = 0)
{
$q = $this->trimmed('q');
$notices = array();
$notice = new Notice();
$search_engine = $notice->getSearchEngine('identica_notices');
$search_engine->set_sort_mode('chron');
if (!$limit) {
$limit = 20;
}
$search_engine->limit(0, $limit, true);
$search_engine->query($q);
$notice->find();
while ($notice->fetch()) {
$notices[] = clone $notice;
}
return $notices;
}
示例11: getNotices
protected function getNotices()
{
$q = $this->trimmed('q');
$notices = array();
$notice = new Notice();
$search_engine = $notice->getSearchEngine('notice');
$search_engine->set_sort_mode('chron');
$search_engine->limit(0, $this->limit, true);
if (false === $search_engine->query($q)) {
$cnt = 0;
} else {
$cnt = $notice->find();
}
if ($cnt > 0) {
while ($notice->fetch()) {
$notices[] = clone $notice;
}
}
return $notices;
}
示例12: detail
public function detail()
{
$notice_id = Input::get('notice_id');
$notice = Notice::find(Input::get('notice_id'));
if (!isset($notice)) {
return View::make('errors.missing');
}
// 用户登陆,标记为已读
if (Sentry::check()) {
$user_id = Sentry::getUser()->user_id;
// 先查询是否已标记为已读
if (UserReadNotice::where('user_id', $user_id)->where('notice_id', $notice_id)->count() == 0) {
$user_read_notice = new UserReadNotice();
$user_read_notice->user_id = $user_id;
$user_read_notice->notice_id = $notice_id;
// 保存。不成功,下次读取依旧判断
// 需改进 ???
$user_read_notice->save();
}
}
return View::make('pages.message-center.message.detail', ['notice' => $notice]);
}
示例13: getRead
public function getRead($NoticeId)
{
$notice = Notice::find($NoticeId);
$notice->read = '1';
$notice->save();
// 转跳到不同地址
//
switch ($notice->type) {
case '1':
break;
case '2':
break;
case '3':
break;
case '4':
break;
case '5':
$data = json_decode($notice->data);
return Redirect::to('picking/view/' . $data->delivery_id)->with('warning', $notice->content);
break;
}
return Redirect::to('notice');
}
示例14: onEndUpgrade
function onEndUpgrade()
{
// Version 0.9.x of the plugin didn't stamp notices
// with verb and object-type (for obvious reasons). Update
// those notices here.
$notice = new Notice();
$notice->whereAdd('exists (select uri from bookmark where bookmark.uri = notice.uri)');
$notice->whereAdd('((object_type is null) or (object_type = "' . ActivityObject::NOTE . '"))');
$notice->find();
while ($notice->fetch()) {
$original = clone $notice;
$notice->verb = ActivityVerb::POST;
$notice->object_type = ActivityObject::BOOKMARK;
$notice->update($original);
}
}
示例15: getNoticeIds
/**
* Get IDs in a range
*
* @param int $offset Offset from start
* @param int $limit Limit of number to get
* @param int $since_id Since this notice
* @param int $max_id Before this notice
*
* @return Array IDs found
*/
function getNoticeIds($offset, $limit, $since_id, $max_id)
{
$notice = new Notice();
$notice->selectAdd();
$notice->selectAdd('id');
$notice->whereAdd(sprintf('notice.created > "%s"', $notice->escape($this->target->created)));
// Reply:: is a table of mentions
// Subscription:: is a table of subscriptions (every user is subscribed to themselves)
$notice->whereAdd(sprintf('( notice.profile_id IN (SELECT subscribed FROM subscription WHERE subscriber=%1$d) ' . 'OR notice.id IN (SELECT notice_id FROM group_inbox WHERE group_id IN (SELECT group_id FROM group_member WHERE profile_id=%1$d))' . 'OR notice.id IN (SELECT notice_id FROM attention WHERE profile_id=%1$d) ) ' . 'AND (notice.reply_to IS NULL ' . 'OR notice.profile_id=%1$d ' . 'OR notice.reply_to IN (SELECT id FROM notice as noticereplies WHERE noticereplies.profile_id IN (SELECT subscribed FROM subscription WHERE subscriber=%1$d))) ' . 'OR (notice.id IN (SELECT notice_id FROM reply WHERE profile_id=%1$d) ' . 'AND notice.profile_id IN (SELECT subscribed FROM subscription WHERE subscriber=%1$d))', $this->target->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 (!empty($this->selectVerbs)) {
$notice->whereAddIn('verb', $this->selectVerbs, $notice->columnType('verb'));
}
$notice->limit($offset, $limit);
// notice.id will give us even really old posts, which were
// recently imported. For example if a remote instance had
// problems and just managed to post here. Another solution
// would be to have a 'notice.imported' field and order by it.
$notice->orderBy('notice.id DESC');
if (!$notice->find()) {
return array();
}
$ids = $notice->fetchAll('id');
return $ids;
}