當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Db::exportArray方法代碼示例

本文整理匯總了PHP中Db::exportArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP Db::exportArray方法的具體用法?PHP Db::exportArray怎麽用?PHP Db::exportArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Db的用法示例。


在下文中一共展示了Db::exportArray方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Streams_message_response_messages

function Streams_message_response_messages()
{
    if (isset(Streams::$cache['message'])) {
        $message = Streams::$cache['message'];
        return Db::exportArray(array($message->ordinal => $message));
    }
    if (isset(Streams::$cache['messages'])) {
        return Db::exportArray(Streams::$cache['messages']);
    }
    $publisherId = Streams::requestedPublisherId(true);
    $streamName = Streams::requestedName(true);
    $type = Streams::requestedMessageType();
    $stream = Q::ifset(Streams::$cache, 'stream', Streams::fetchOne(null, $publisherId, $streamName, true));
    $maxLimit = Streams_Stream::getConfigField($type, 'getMessagesLimit', 100);
    $limit = min($maxLimit, Q::ifset($_REQUEST, 'limit', $maxLimit));
    if (isset($_REQUEST['ordinal'])) {
        $min = $_REQUEST['ordinal'];
        $limit = 1;
    }
    if (isset($_REQUEST['min'])) {
        $min = $_REQUEST['min'];
    }
    $max = isset($_REQUEST['max']) ? $_REQUEST['max'] : -1;
    if (isset($_REQUEST['ascending'])) {
        $ascending = $_REQUEST['ascending'];
    }
    if (!$stream->testReadLevel('messages')) {
        throw new Users_Exception_NotAuthorized();
    }
    $messages = $stream->getMessages(compact('type', 'min', 'max', 'limit', 'ascending'));
    return Db::exportArray($messages);
}
開發者ID:dmitriz,項目名稱:Platform,代碼行數:32,代碼來源:messages.php

示例2: Streams_after_Q_responseExtras

function Streams_after_Q_responseExtras()
{
    if ($preloaded = Streams_Stream::$preloaded) {
        $preloaded = Db::exportArray($preloaded);
        Q_Response::setScriptData('Q.plugins.Streams.Stream.preloaded', $preloaded);
    }
}
開發者ID:dmitriz,項目名稱:Platform,代碼行數:7,代碼來源:Q_responseExtras.php

示例3: Users_after_Q_responseExtras

function Users_after_Q_responseExtras()
{
    if ($preloaded = Users_User::$preloaded) {
        Q_Response::setScriptData('Q.plugins.Users.User.preloaded', Db::exportArray($preloaded, array('asAvatar' => true)));
    }
    Q_Response::setScriptData('Q.plugins.Users.roles', Users::roles());
}
開發者ID:dmitriz,項目名稱:Platform,代碼行數:7,代碼來源:Q_responseExtras.php

示例4: Streams_after_Q_objects

function Streams_after_Q_objects()
{
    $user = Users::loggedInUser();
    if (!$user) {
        return;
    }
    $invite = Streams::$followedInvite;
    if (!$invite) {
        return;
    }
    $displayName = $user->displayName();
    if ($displayName) {
        return;
    }
    $stream = new Streams_Stream();
    $stream->publisherId = $invite->publisherId;
    $stream->name = $invite->streamName;
    if (!$stream->retrieve()) {
        throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => 'with that name'), 'streamName');
    }
    // Prepare the complete invite dialog
    $invitingUser = Users_User::fetch($invite->invitingUserId);
    list($relations, $related) = Streams::related($user->id, $stream->publisherId, $stream->name, false);
    $params = array('displayName' => null, 'action' => 'Streams/basic', 'icon' => $user->iconUrl(), 'token' => $invite->token, 'user' => array('icon' => $invitingUser->iconUrl(), 'displayName' => $invitingUser->displayName(array('fullAccess' => true))), 'stream' => $stream->exportArray(), 'relations' => Db::exportArray($relations), 'related' => Db::exportArray($related));
    $config = Streams_Stream::getConfigField($stream->type, 'invite', array());
    $defaults = Q::ifset($config, 'dialog', array());
    $tree = new Q_Tree($defaults);
    if ($tree->merge($params)) {
        $dialogData = $tree->getAll();
        if ($dialogData) {
            Q_Response::setScriptData('Q.plugins.Streams.invite.dialog', $dialogData);
            Q_Response::addTemplate('Streams/invite/complete');
        }
    }
}
開發者ID:dmitriz,項目名稱:Platform,代碼行數:35,代碼來源:Q_objects.php

示例5: Streams_after_Users_Contact_removeExecute

function Streams_after_Users_Contact_removeExecute($params)
{
    // Update avatar as viewed by everyone who was in that contacts list
    $contacts = Streams::$cache['contacts_removed'];
    foreach ($contacts as $contact) {
        Streams::updateAvatar($contact->contactUserId, $contact->userId);
    }
    Streams_Message::post(null, $contact->userId, 'Streams/contacts', array('type' => 'Streams/contacts/removed', 'instructions' => array('contacts' => Db::exportArray($contacts))), true);
}
開發者ID:dmitriz,項目名稱:Platform,代碼行數:9,代碼來源:Users_Contact_removeExecute.php

示例6: Users_after_Q_responseExtras

function Users_after_Q_responseExtras()
{
    if ($preloaded = Users_User::$preloaded) {
        Q_Response::setScriptData('Q.plugins.Users.User.preloaded', Db::exportArray($preloaded, array('asAvatar' => true)));
    }
    Q_Response::setScriptData('Q.plugins.Users.roles', Users::roles());
    $user = Users::loggedInUser();
    Q_Response::addHtmlCssClass($user ? 'Users_loggedIn' : 'Users_loggedOut');
}
開發者ID:AndreyTepaykin,項目名稱:Platform,代碼行數:9,代碼來源:Q_responseExtras.php

示例7: Users_contact_post

/**
 * Adds contacts to the system. Fills the "contacts" slot.
 * @param {array} $_REQUEST
 * @param {string} $_REQUEST.label The label of the contact
 * @param {string} $_REQUEST.contactUserId The contactUserId of the contact
 * @param {string} [$_REQUEST.nickname] The nickname of the contact
 * @param {string} [$_REQUEST.userId=Users::loggedInUser(true)->id] You can override the user id, if another plugin adds a hook that allows you to do this
 */
function Users_contact_post($params = array())
{
    $req = array_merge($_REQUEST, $params);
    Q_Request::requireFields(array('label', 'contactUserId'), $req, true);
    $loggedInUserId = Users::loggedInUser(true)->id;
    $userId = Q::ifset($req, 'userId', $loggedInUserId);
    $contactUserId = $req['contactUserId'];
    $nickname = Q::ifset($req, 'nickname', null);
    $contacts = Users_Contact::addContact($userId, $req['label'], $contactUserId, $nickname);
    Q_Response::setSlot('contacts', Db::exportArray($contacts));
}
開發者ID:dmitriz,項目名稱:Platform,代碼行數:19,代碼來源:post.php

示例8: Users_user_response_users

function Users_user_response_users($params = array())
{
    $req = array_merge($_REQUEST, $params);
    Q_Valid::requireFields(array('userIds'), $req, true);
    $userIds = $req['userIds'];
    if (is_string($userIds)) {
        $userIds = explode(",", $userIds);
    }
    $fields = Q_Config::expect('Users', 'avatarFields');
    $users = Users_User::select($fields)->where(array('id' => $userIds))->fetchDbRows(null, null, 'id');
    return Q_Response::setSlot('users', Db::exportArray($users, array('asAvatar' => true)));
}
開發者ID:AndreyTepaykin,項目名稱:Platform,代碼行數:12,代碼來源:users.php

示例9: Streams_stream_response_streams

function Streams_stream_response_streams()
{
    // happens only during non-GET requests
    $publisherId = Streams::requestedPublisherId(true);
    $name = Streams::requestedName(true);
    $fields = Streams::requestedFields();
    $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : null;
    $user = Users::loggedInUser();
    $userId = $user ? $user->id : "";
    $streams = Streams::fetch($userId, $publisherId, $name, $fields ? $fields : '*', $limit ? compact('limit') : array());
    return Streams::$cache['streams'] = Db::exportArray($streams);
}
開發者ID:dmitriz,項目名稱:Platform,代碼行數:12,代碼來源:streams.php

示例10: Streams_stream_response_streams

function Streams_stream_response_streams()
{
    // happens only during non-GET requests
    $publisherId = Streams::requestedPublisherId(true);
    $name = Streams::requestedName(true);
    $fields = Streams::requestedFields();
    $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : null;
    $user = Users::loggedInUser();
    $userId = $user ? $user->id : "";
    $options = array('withParticipant' => true);
    if (isset($limit)) {
        $options['limit'] = $limit;
    }
    $streams = Streams::fetch($userId, $publisherId, $name, $fields ? $fields : '*', $options);
    return Streams::$cache['streams'] = Db::exportArray($streams);
}
開發者ID:AndreyTepaykin,項目名稱:Platform,代碼行數:16,代碼來源:streams.php

示例11: Streams_avatar_response

function Streams_avatar_response()
{
    $prefix = $limit = $userIds = $batch = $public = null;
    extract($_REQUEST, EXTR_IF_EXISTS);
    $user = Users::loggedInUser();
    $asUserId = $user ? $user->id : "";
    if (isset($prefix)) {
        $avatars = Streams_Avatar::fetchByPrefix($asUserId, $prefix, compact('limit', 'public'));
    } else {
        if (isset($batch)) {
            $batch = json_decode($batch, true);
            if (!isset($batch)) {
                throw new Q_Exception_WrongValue(array('field' => 'batch', 'range' => '{userIds: [userId1, userId2, ...]}'));
            }
            if (!isset($batch['userIds'])) {
                throw new Q_Exception_RequiredField(array('field' => 'userIds'));
            }
            $userIds = $batch['userIds'];
        }
        if (!isset($userIds)) {
            throw new Q_Exception_RequiredField(array('field' => 'userIds'));
        }
        if (is_string($userIds)) {
            $userIds = explode(",", $userIds);
        }
        $avatars = Streams_Avatar::fetch($asUserId, $userIds);
    }
    $avatars = Db::exportArray($avatars);
    if (isset($batch)) {
        $result = array();
        foreach ($userIds as $userId) {
            $result[] = array('slots' => array('avatar' => isset($avatars[$userId]) ? $avatars[$userId] : null));
        }
        Q_Response::setSlot('batch', $result);
    } else {
        Q_Response::setSlot('avatars', $avatars);
    }
    return $avatars;
}
開發者ID:dmitriz,項目名稱:Platform,代碼行數:39,代碼來源:response.php

示例12: Users_contact_post

/**
 * Adds contacts to the system. Fills the "contacts" slot.
 * @param {array} $_REQUEST
 * @param {string} $_REQUEST.label The label of the contact
 * @param {string} $_REQUEST.contactUserId The contactUserId of the contact
 * @param {string} [$_REQUEST.nickname] The nickname of the contact
 * @param {string} [$_REQUEST.userId=Users::loggedInUser(true)->id] You can override the user id, if another plugin adds a hook that allows you to do this
 */
function Users_contact_post($params = array())
{
    $req = array_merge($_REQUEST, $params);
    Q_Request::requireFields(array('label', 'contactUserId'), $req, true);
    $loggedInUserId = Users::loggedInUser(true)->id;
    $userId = Q::ifset($req, 'userId', $loggedInUserId);
    $contactUserId = $req['contactUserId'];
    $nickname = Q::ifset($req, 'nickname', null);
    $l = $req['label'];
    if ($userId !== $loggedInUserId) {
        Users_User::fetch($userId, true);
    }
    Users_User::fetch($contactUserId, true);
    Users::canManageContacts($loggedInUserId, $userId, $l, true);
    $label = new Users_Label();
    $label->userId = $userId;
    $label->label = $l;
    if (!$label->retrieve()) {
        throw new Q_Exception_MissingRow(array('table' => 'Users_Label', 'criteria' => json_encode($label->fields)));
    }
    $contacts = Users_Contact::addContact($userId, $l, $contactUserId, $nickname);
    Q_Response::setSlot('contacts', Db::exportArray($contacts));
}
開發者ID:atirjavid,項目名稱:Platform,代碼行數:31,代碼來源:post.php

示例13: Streams_participant_response_participants

function Streams_participant_response_participants()
{
    if (isset(Streams::$cache['participant'])) {
        $participant = Streams::$cache['participant'];
        return Db::exportArray(array($participant->userId => $participant));
    }
    $publisherId = Streams::requestedPublisherId(true);
    $streamName = Streams::requestedName(true);
    $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : 10;
    $offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : -1;
    $state = isset($_REQUEST['state']) ? $_REQUEST['state'] : null;
    $user = Users::loggedInUser();
    $userId = $user ? $user->id : "";
    $stream = Streams::fetchOne($userId, $publisherId, $streamName);
    if (empty($stream)) {
        throw new Q_Exception_MissingRow(array('table' => 'Stream', 'criteria' => "{publisherId: '{$publisherId}', name: '{$streamName}'}"));
    }
    if (!$stream->testReadLevel('participants')) {
        throw new Users_Exception_NotAuthorized();
    }
    $participants = $stream->getParticipants(compact('limit', 'offset', 'state'));
    Db::exportArray($participants);
}
開發者ID:dmitriz,項目名稱:Platform,代碼行數:23,代碼來源:participants.php

示例14: Users_avatar_response

function Users_avatar_response($params)
{
    $userIds = $batch = null;
    extract($_REQUEST, EXTR_IF_EXISTS);
    if ($batch) {
        $batch = json_decode($batch, true);
        if (!isset($batch)) {
            throw new Q_Exception_WrongValue(array('field' => 'batch', 'range' => '{userIds: [userId1, userId2, ...]}'));
        }
        if (!isset($batch['userIds'])) {
            throw new Q_Exception_RequiredField(array('field' => 'userIds'));
        }
        $userIds = $batch['userIds'];
    } else {
        if (!isset($userIds)) {
            throw new Q_Exception_RequiredField(array('field' => 'userIds'), 'userIds');
        }
    }
    if (is_string($userIds)) {
        $userIds = explode(",", $userIds);
    }
    $fields = Q_Config::expect('Users', 'avatarFields');
    $users = Users_User::select($fields)->where(array('id' => $userIds))->fetchDbRows(null, null, 'id');
    $avatars = Db::exportArray($users);
    if (!isset($batch)) {
        Q_Response::setSlot('avatars', $avatars);
        return $avatars;
    }
    if ($batch) {
        $result = array();
        foreach ($userIds as $userId) {
            $result[] = array('slots' => array('avatar' => isset($avatars[$userId]) ? $avatars[$userId] : null));
        }
        Q_Response::setSlot('batch', $result);
    }
    return $avatars;
}
開發者ID:dmitriz,項目名稱:Platform,代碼行數:37,代碼來源:response.php

示例15: Streams_message_response_messages

function Streams_message_response_messages()
{
    if (isset(Streams::$cache['message'])) {
        $message = Streams::$cache['message'];
        return Db::exportArray(array($message->ordinal => $message));
    }
    if (isset(Streams::$cache['messages'])) {
        return Db::exportArray(Streams::$cache['messages']);
    }
    $publisherId = Streams::requestedPublisherId(true);
    $streamName = Streams::requestedName(true);
    $type = Streams::requestedMessageType();
    $maxLimit = Q_Config::get('Streams', 'defaults', 'getMessagesLimit', 100);
    $limit = min($maxLimit, Q::ifset($_REQUEST, 'limit', $maxLimit));
    if (isset($_REQUEST['ordinal'])) {
        $min = $_REQUEST['ordinal'];
        $limit = 1;
    }
    if (isset($_REQUEST['min'])) {
        $min = $_REQUEST['min'];
    }
    $max = isset($_REQUEST['max']) ? $_REQUEST['max'] : -1;
    if (isset($_REQUEST['ascending'])) {
        $ascending = $_REQUEST['ascending'];
    }
    $user = Users::loggedInUser();
    $userId = $user ? $user->id : "";
    $stream = isset(Streams::$cache['stream']) ? Streams::$cache['stream'] : Streams::fetchOne($userId, $publisherId, $streamName);
    if (!$stream) {
        throw new Q_Exception_MissingRow(array('table' => 'Stream', 'criteria' => "{publisherId: '{$publisherId}', name: '{$streamName}'}"));
    }
    if (!$stream->testReadLevel('messages')) {
        throw new Users_Exception_NotAuthorized();
    }
    $messages = $stream->getMessages(compact('type', 'min', 'max', 'limit', 'ascending'));
    return Db::exportArray($messages);
}
開發者ID:atirjavid,項目名稱:Platform,代碼行數:37,代碼來源:messages.php


注:本文中的Db::exportArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。