承接 machour/yii2-google-gmail 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

machour/yii2-google-gmail

Composer 安装命令:

composer require machour/yii2-google-gmail

包简介

Data providers, widgets and helpers suited for the official GMail Api v1

README 文档

README

Data providers, widgets and helpers suited for the official GMail Api v1.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist machour/yii2-google-gmail "*"

or add

"machour/yii2-google-gmail": "*"

to the require section of your composer.json file.

Usage

Displaying your latest threads in a grid

Controller :

public function actionIndex()
{
    $pagination = new Pagination();
    $dataProvider = new GmailThreadDataProvider([
        // Service must be a Google_Service_Gmail instance
        // Here, machour/yii2-google-apiclient is used to get that instance
        'service' => Yii::$app->gmail->getService(),
        'pagination' => $pagination,
    ]);
    $pagination->totalCount = $dataProvider->getTotalCount();

    return $this->render('index', [
        'dataProvider' => $dataProvider
    ]);
}

View file :

use machour\yii2\google\gmail\widgets\GmailGridView;
use machour\yii2\google\gmail\helpers\GmailHelper as GH;
use yii\bootstrap\Html;

echo GmailGridView::widget([
    'dataProvider' => $dataProvider,
    'columns' => [
        [
            'attribute' => 'date',
            'value' => function ($thread, $key, $index, $widget) {
                /** @var Google_Service_Gmail_Thread $thread */
                return GH::getMessageHeader(GH::getThreadLastMessage($thread), 'Date');
            }
        ],
        [
            'attribute' => 'sender',
            'value' => function ($thread, $key, $index, $widget) {
                /** @var Google_Service_Gmail_Thread $thread */
                return GH::getThreadLastParticipant($thread);
            }
        ],
        [
            'attribute' => 'subject',
            'value' => function ($thread, $key, $index, $widget) {
                /** @var Google_Service_Gmail_Thread $thread */
                $subject = GH::getThreadSubject($thread);
                if (!$subject) {
                    $subject = '<i>' . Yii::t('app', 'No subject') . '</i>';
                }
                return $subject;
            },
            'format' => 'html',
        ],
        [
            'attribute' => 'Number of messages',
            'value' => function ($thread, $key, $index, $widget) {
                /** @var Google_Service_Gmail_Thread $thread */
                return GH::getThreadMessagesCount($thread);
            }
        ],
        [
            'attribute' => 'Actions',
            'value' => function ($thread, $key, $index, $widget) {
                /** @var Google_Service_Gmail_Thread $thread */
                return Html::a('View thread', ['gmail/thread', 'id' => $thread->getId()]);
            },
            'format' => 'html',
        ]

    ],
]);

统计信息

  • 总下载量: 98
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 10
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固