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


PHP Notice::fetch方法代码示例

本文整理汇总了PHP中Notice::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP Notice::fetch方法的具体用法?PHP Notice::fetch怎么用?PHP Notice::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Notice的用法示例。


在下文中一共展示了Notice::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

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

示例2: 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);
     }
 }
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:33,代码来源:noticestream.php

示例3: 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;
 }
开发者ID:jianoll,项目名称:SpeakEnglish_Server,代码行数:35,代码来源:apiconversation.php

示例4: getNoticeIds

 function getNoticeIds($offset, $limit, $since_id, $max_id)
 {
     $notice = new Notice();
     $qry = null;
     $qry = 'SELECT notice.* FROM notice ';
     $qry .= 'INNER JOIN happening ON happening.uri = notice.uri ';
     $qry .= 'AND notice.is_local != ' . Notice::GATEWAY . ' ';
     if ($since_id != 0) {
         $qry .= 'AND notice.id > ' . $since_id . ' ';
     }
     if ($max_id != 0) {
         $qry .= 'AND notice.id <= ' . $max_id . ' ';
     }
     // NOTE: we sort by event time, not by notice time!
     $qry .= 'ORDER BY happening.created DESC ';
     if (!is_null($offset)) {
         $qry .= "LIMIT {$limit} OFFSET {$offset}";
     }
     $notice->query($qry);
     $ids = array();
     while ($notice->fetch()) {
         $ids[] = $notice->id;
     }
     $notice->free();
     unset($notice);
     return $ids;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:27,代码来源:eventsnoticestream.php

示例5: getUpdates

 function getUpdates($seconds)
 {
     $notice = new Notice();
     # XXX: cache this. Depends on how big this protocol becomes;
     # Re-doing this query every 15 seconds isn't the end of the world.
     $notice->query('SELECT profile_id, max(id) AS max_id ' . 'FROM notice ' . (common_config('db', 'type') == 'pgsql' ? 'WHERE extract(epoch from created) > (extract(epoch from now()) - ' . $seconds . ') ' : 'WHERE created > (now() - ' . $seconds . ') ') . 'GROUP BY profile_id');
     $updates = array();
     while ($notice->fetch()) {
         $updates[] = array($notice->profile_id, $notice->max_id);
     }
     return $updates;
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:12,代码来源:sup.php

示例6: 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>';
         }
     }
 }
开发者ID:jianoll,项目名称:SpeakEnglish_Server,代码行数:16,代码来源:changedatabase.php

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

示例8: 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;
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:18,代码来源:noticesearchrss.php

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

示例10: checkDupe

 /**
  * Check to see if this Twitter status has already been imported
  *
  * @param Profile $profile   Twitter user's local profile
  * @param string  $statusUri URI of the status on Twitter
  *
  * @return mixed value a matching Notice or null
  */
 function checkDupe($profile, $statusUri)
 {
     $notice = new Notice();
     $notice->uri = $statusUri;
     $notice->profile_id = $profile->id;
     $notice->limit(1);
     if ($notice->find()) {
         $notice->fetch();
         return $notice;
     }
     return null;
 }
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:20,代码来源:twitterimport.php

示例11: beforeSchemaUpdate

 public static function beforeSchemaUpdate()
 {
     $table = strtolower(get_called_class());
     $schema = Schema::get();
     $schemadef = $schema->getTableDef($table);
     // 2015-09-04 We move Notice location data to Notice_location
     // First we see if we have to do this at all
     if (!isset($schemadef['fields']['lat']) && !isset($schemadef['fields']['lon']) && !isset($schemadef['fields']['location_id']) && !isset($schemadef['fields']['location_ns'])) {
         // We have already removed the location fields, so no need to migrate.
         return;
     }
     // Then we make sure the Notice_location table is created!
     $schema->ensureTable('notice_location', Notice_location::schemaDef());
     // Then we continue on our road to migration!
     echo "\nFound old {$table} table, moving location data to 'notice_location' table... (this will probably take a LONG time, but can be aborted and continued)";
     $notice = new Notice();
     $notice->query(sprintf('SELECT id, lat, lon, location_id, location_ns FROM %1$s ' . 'WHERE lat IS NOT NULL ' . 'OR lon IS NOT NULL ' . 'OR location_id IS NOT NULL ' . 'OR location_ns IS NOT NULL', $schema->quoteIdentifier($table)));
     print "\nFound {$notice->N} notices with location data, inserting";
     while ($notice->fetch()) {
         $notloc = Notice_location::getKV('notice_id', $notice->id);
         if ($notloc instanceof Notice_location) {
             print "-";
             continue;
         }
         $notloc = new Notice_location();
         $notloc->notice_id = $notice->id;
         $notloc->lat = $notice->lat;
         $notloc->lon = $notice->lon;
         $notloc->location_id = $notice->location_id;
         $notloc->location_ns = $notice->location_ns;
         $notloc->insert();
         print ".";
     }
     print "\n";
 }
开发者ID:a780201,项目名称:gnu-social,代码行数:35,代码来源:Notice.php

示例12: getNoticesBetween

 /**
  *
  * @param int $start unix timestamp for earliest
  * @param int $end unix timestamp for latest
  * @return array of Notice objects
  */
 function getNoticesBetween($start = 0, $end = 0)
 {
     $notices = array();
     $notice = new Notice();
     $notice->profile_id = $this->user->id;
     // Only stuff after $this->after
     if (!empty($this->after)) {
         if ($start) {
             $start = max($start, $this->after);
         }
         if ($end) {
             $end = max($end, $this->after);
         }
     }
     if ($start) {
         $tsstart = common_sql_date($start);
         $notice->whereAdd("created >= '{$tsstart}'");
     }
     if ($end) {
         $tsend = common_sql_date($end);
         $notice->whereAdd("created < '{$tsend}'");
     }
     $notice->orderBy('created DESC');
     if ($notice->find()) {
         while ($notice->fetch()) {
             $notices[] = clone $notice;
         }
     }
     return $notices;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:36,代码来源:useractivitystream.php

示例13: getNoticeIds

 /**
  * Query notices by users associated with this tag from the database.
  *
  * @param integer $offset   offset
  * @param integer $limit    maximum no of results
  * @param integer $since_id=null    since this id
  * @param integer $max_id=null  maximum id in result
  *
  * @return array array of notice ids.
  */
 function getNoticeIds($offset, $limit, $since_id, $max_id)
 {
     $notice = new Notice();
     $notice->selectAdd();
     $notice->selectAdd('notice.id');
     $ptag = new Profile_tag();
     $ptag->tag = $this->profile_list->tag;
     $ptag->tagger = $this->profile_list->tagger;
     $notice->joinAdd(array('profile_id', 'profile_tag:tagged'));
     $notice->whereAdd('profile_tag.tagger = ' . $this->profile_list->tagger);
     $notice->whereAdd(sprintf('profile_tag.tag = "%s"', $this->profile_list->tag));
     if ($since_id != 0) {
         $notice->whereAdd('notice.id > ' . $since_id);
     }
     if ($max_id != 0) {
         $notice->whereAdd('notice.id <= ' . $max_id);
     }
     $notice->orderBy('notice.id DESC');
     if (!is_null($offset)) {
         $notice->limit($offset, $limit);
     }
     $ids = array();
     if ($notice->find()) {
         while ($notice->fetch()) {
             $ids[] = $notice->id;
         }
     }
     return $ids;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:39,代码来源:peopletagnoticestream.php

示例14: getNotices

 function getNotices()
 {
     $notices = array();
     $notice = new Notice();
     $notice->profile_id = $this->user->id;
     if ($notice->find()) {
         while ($notice->fetch()) {
             $notices[] = clone $notice;
         }
     }
     return $notices;
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:12,代码来源:useractivitystream.php

示例15: getNoticeIds

 function getNoticeIds($offset, $limit, $since_id, $max_id)
 {
     // XXX It would be nice to do this without a join
     // (necessary to do it efficiently on accounts with long history)
     $notice = new Notice();
     $query = "select id from notice join notice_tag on id=notice_id where tag='" . $notice->escape($this->tag) . "' and profile_id=" . intval($this->profile->id);
     $since = Notice::whereSinceId($since_id, 'id', 'notice.created');
     if ($since) {
         $query .= " and ({$since})";
     }
     $max = Notice::whereMaxId($max_id, 'id', 'notice.created');
     if ($max) {
         $query .= " and ({$max})";
     }
     $query .= ' order by notice.created DESC, id DESC';
     if (!is_null($offset)) {
         $query .= " LIMIT " . intval($limit) . " OFFSET " . intval($offset);
     }
     $notice->query($query);
     $ids = array();
     while ($notice->fetch()) {
         $ids[] = $notice->id;
     }
     return $ids;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:25,代码来源:taggedprofilenoticestream.php


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