本文整理汇总了PHP中Streams::requestedField方法的典型用法代码示例。如果您正苦于以下问题:PHP Streams::requestedField方法的具体用法?PHP Streams::requestedField怎么用?PHP Streams::requestedField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Streams
的用法示例。
在下文中一共展示了Streams::requestedField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Streams_invite_response_data
function Streams_invite_response_data()
{
if (isset(Streams::$cache['invited'])) {
return Streams::$cache['invited'];
}
$user = Users::loggedInUser(true);
$publisherId = Streams::requestedPublisherId();
$streamType = Streams::requestedType();
$invitingUserId = Streams::requestedField('invitingUserId');
$limit = Q::ifset($_REQUEST, 'limit', Q_Config::get('Streams', 'invites', 'limit', 100));
$invited = Streams_Invited::select('*')->where(array('userId' => $user->id, 'state' => 'pending', 'expireTime <' => new Db_Expression('CURRENT_TIMESTAMP')))->limit($limit)->fetchDbRows(null, null, 'token');
$query = Streams_Invite::select('*')->where(array('token' => array_keys($invited)));
if (isset($publisherId)) {
$query = $query->where(array('publisherId' => $publisherId));
}
if (isset($streamType)) {
$query = $query->where(array('streamName' => new Db_Range($streamType . '/', true, false, true)));
}
if (isset($invitingUserId)) {
$query = $query->where(array('invitingUserId' => $invitingUserId));
}
$invites = $query->fetchDbRows();
$streams = array();
foreach ($invites as $invite) {
$stream = new Streams_Stream();
$stream->publisherId = $invite->publisherId;
$stream->name = $invite->streamName;
if ($stream->retrieve()) {
$streams[$invite->token] = $stream->exportArray();
$streams[$invite->token]['displayName'] = $invite->displayName;
}
}
return compact('streams', 'invites');
}
示例2: Streams_participating_response
function Streams_participating_response()
{
if (!Q_Request::isAjax()) {
return;
}
$max_limit = Q_Config::expect('Streams', 'db', 'limits', 'participating');
$user = Users::loggedInUser(true);
$type = Streams::requestedType();
$limit = Streams::requestedField('limit', false, $max_limit);
if ($limit > $max_limit) {
throw new Q_Exception("limit is too large, must be <= {$max_limit}");
}
$offset = Streams::requestedField('offset', false, 0);
$order = Streams::requestedField('order', false, true);
$participating = array();
$q = Streams_Participating::select('*')->where(array('userId' => $user->id));
if ($type) {
$q = $q->where(array('streamName' => new Db_Range($type . '/', true, false, true)));
}
if ($limit) {
$q = $q->limit($limit, $offset);
}
if ($order) {
$q = $q->orderBy('updatedTime', false);
}
$res_participating = $q->fetchDbRows();
foreach ($res_participating as $part) {
$part_safe = $part->exportArray();
if (isset($part_safe)) {
$participating[] = $part_safe;
}
}
Q_Response::setSlot('participating', $participating);
if (!Q_Request::slotName('streams')) {
return;
}
$res_streams = array();
$streamNames = array();
foreach ($res_participating as $p) {
$streamNames[$p->publisherId][] = $p->streamName;
}
foreach ($streamNames as $p_id => $names) {
$res_streams[$p_id] = Streams::fetch($user->id, $p_id, $names);
}
$streams = array();
$o = array('asUserId' => $user->id);
foreach ($res_streams as $publisherId => $streams_array) {
if (!empty($streams_array)) {
$streams[$publisherId] = array();
foreach ($streams_array as $streamName => $stream) {
$streams[$publisherId][$streamName] = $stream->exportArray($o);
}
}
}
Q_Response::setSlot('streams', $streams);
}