codeigniter中的Gmail API上一页令牌

时间:2016-07-07 06:09:26

标签: php codeigniter gmail-api

无论如何我可以在gmail api分页中获取上一页的内容吗?我已经在下一页完成了它的工作,但我的问题是查看上一页?

这是我的控制者:

 $newToken = '';


    if(isset($_GET['token'])) {
        $newToken = $_GET['token'];

    }
    $cur_link='msg_inbox';

 $pageToken=NULL;
    $message = array();
    $opt_param = array(

        'maxResults'=>5,
        'labelIds'=>'INBOX',
        'pageToken'=> $newToken
    );


    $msg_response = $service->users_messages->listUsersMessages('me',$opt_param);
    $list = $msg_response->getMessages();
     foreach ($list as $lists){
    $id = $lists->id;
    $msg[] = $service->users_messages->get('me',$id);
    }
    $nxtpageToken = $msg_response->getNextPageToken();
    $prevpageToken = $_GET['token'];

    $wew['nxtpage']= $nxtpageToken;
    $wew['inbox']= $msg;
    $wew['try']=$cur_link;

    $wew['ptoken']= $prevpageToken;
    $content = $this->load->view('tenant/gmail/inbox_list',$wew,TRUE);
    $data['content'] = $content;
    $data['curpage'] = $this->curpage;
    $this->load->view('template1', $data);

这是我的观点:

<div class="ibox float-e-margins">
    <div class="ibox-title">
        <div class="pull-right">
            <a href="http://localhost/tenant/message/?ptoken=<?php echo $prevtoken; ?>"> <i class="fa fa-chevron-left" aria-hidden="true"></i></a>
            <a href="http://localhost/tenant/message/?token=<?php echo $nxtpage; ?>"> <i class="fa fa-chevron-right" aria-hidden="true"></i></a>
        </div>

        <h5>INBOX <?php echo $nxtpage; ?> </h5>
    </div>
    <div class="ibox-content clearfix divider">
        <div>
            <table class="table messageTable">
                <tbody>
                <?php
                    foreach ($inbox as $row){
                        echo'<tr>';
                        echo '<td class="col-md-2">
                                <input type="checkbox" class="i-checks chkbox ">
                                <i class="fa fa-star-o" aria-hidden="true"></i>
                                <a href = "delete/?message_id='.$row->id.'"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
                              </td>';
                        echo '<td><a href="view_page/?message_id='.$row->id.'">' . $row->snippet. '</td>';
                        echo'<tr>';
                        }
                    ?>
                </tbody>
            </table>
        </div>
    </div>
</div>

0 个答案:

没有答案