2009年11月17日星期二

Re: [fw-gdata] Working with Multi-page Feeds Google Provisioning API

Hello again Ryan.

I decided to leave this issue until the end because it was difficult to
perform. I have now reached the point where this is the only thing missing
to complete the system.

I did what you suggested:

while ($feed !== null) {
foreach ($feed as $user) {
echo "<tr>";
echo "<td>".$user->login->username."</td>";
echo ""</tr>; }
* $feed = **$feed->getNextFeed();**
}

And what it does is that it shows all records of the feed exactly as
retrieveAllEntriesForFeed() instruction. But what I want to do is break them
into pages.

Are there some examples for this task?

Best regards.
Hugo


Ryan Boyd-3 wrote:
>
> When you echo out the previous and next URLs, what do you get? You won't
> be
> able to click on it and see it (because you wouldn't be sending the
> appropriate auth credentials), but you should be able to retrieve that
> feed.
>
> The following two blocks of code should be identical:
> ---
> while ($feed !== null) {
> foreach ($feed as $user) {
> echo "<tr>";
> echo "<td>".$user->login->username."</td>";
> echo ""</tr>; }
> * $feed = **$feed->getNextFeed();**
> }*----
> ---
> while ($feed !== null) {
> foreach ($feed as $user) {
> echo "<tr>";
> echo "<td>".$user->login->usern"</td>";
> echo ""</tr>; }
> * $feed = **$feed->getUserFeed($nextLink);*
> }----
>
> On Wed, Oct 21, 2009 at 4:34 PM, Hugo León <hugolec@gmail.com> wrote:
>
>>
>> Hello Ryan.
>>
>> For now I'm getting in the same manner the feed to the next page, but the
>> URL that I've got is
>>
>> https://apps-apis.google.com/a/feeds/domain.com/user/2.0?startUsername=username
>> and when I click it can't see the next page of the feed.
>>
>> What I do not want to do is show all the entries because we have one
>> GApps
>> domain with about 2,000 users, just as you recommended me.
>>
>> Here is the code:
>>
>> Zend_Loader::loadClass('Zend_Gdata');
>> Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
>> Zend_Loader::loadClass('Zend_Gdata_Gapps');
>> Zend_Loader::loadClass('Zend_Gdata_Feed');
>>
>> //ClientLogin
>> function getClientLoginHttpClient($user, $pass)
>> {
>> try{
>> $service = Zend_Gdata_Gapps::AUTH_SERVICE_NAME;
>> $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass,
>> $service);
>> return $client;
>> } catch (Zend_Gdata_App_AuthException $e) {
>>
>> }
>> }
>>
>> $client = getClientLoginHttpClient($admin."@".$domain, $gappspass);
>> $gapps = new Zend_Gdata_Gapps($client, $domain);
>> $feed = $gapps->getUserFeed();
>> $previousLink = $feed->getLink("previous");
>> $nextLink = $feed->getLink("next");
>>
>> foreach ($feed as $user) {
>> echo "<tr>";
>> echo "<td>".$user->login->username."</td>";
>> echo ""</tr>;
>> }
>> if ($previousLink !== null) {
>> echo "previous url: " . $previousLink->href . "<br />";
>> $previousFeed = $gapps->getUserFeed($previousLink->href);
>> }
>> if ($nextLink !== null) {
>> echo "next url: " . $nextLink->href . "<br />";
>> $nextFeed = $gapps->getUserFeed($nextLink->href);
>> }
>>
>> Where should I put '$feedWithNextPageOfEntries = $feed->getNextFeed();' ?
>> or
>> how should I call it?.
>>
>> Thanks in advance.
>> Hugo
>>
>>
>> Ryan Boyd (Google) wrote:
>> >
>> > You probably have an existing $feed variable with the feed of results.
>> >
>> > Try:$feedWithNextPageOfEntries = $feed->getNextFeed();
>> > If you have a $service and an existing $feed and want to retrieve ALL
>> > entries (can be expensive), you can do:
>> > $feedWithAllEntries = $service->retrieveAllEntriesForFeed($feed);
>> >
>> > Cheers,
>> > -Ryan
>> >
>> > On Tue, Oct 13, 2009 at 2:56 PM, Hugo León <hugolec@gmail.com> wrote:
>> >
>> >>
>> >> Hello everyone.
>> >> I'm trying to get all users of a Google Apps domain and does it well.
>> >> But when there are domains with more than 100 users appear only the
>> first
>> >> 100, and with the function that comes into Zend website gives me the
>> link
>> >>
>> >>
>> https://apps-apis.google.com/a/feeds/domain.com/user/2.0?startUsername=username
>> >> ,
>> >> but obviously when I click on that link it does not work because I
>> need
>> >> authorization via ClientLogin again. And what I want to do is that it
>> >> only
>> >> shows me the next 100 users.
>> >>
>> >> How can I do this?
>> >> Thanks in advance.
>> >>
>> >> Hugo
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Working-with-Multi-page-Feeds-Google-Provisioning-API-tp25881614p25881614.html
>> >> Sent from the Zend gdata mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Working-with-Multi-page-Feeds-Google-Provisioning-API-tp25881614p26001897.html
>> Sent from the Zend gdata mailing list archive at Nabble.com.
>>
>>
>
>

--
View this message in context: http://old.nabble.com/Working-with-Multi-page-Feeds-Google-Provisioning-API-tp25881614p26396478.html
Sent from the Zend gdata mailing list archive at Nabble.com.

没有评论: