-
Notifications
You must be signed in to change notification settings - Fork 23
/
Telegram.php
48 lines (40 loc) · 989 Bytes
/
Telegram.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* @copyright Copyright © Alexandr Kozhevnikov (onmotion)
* @package yii2-telegram
* Date: 02.08.2016
*/
namespace onmotion\telegram;
use yii\helpers\Html;
use yii\web\Cookie;
use yii\widgets\ActiveForm;
use Yii;
/**
* Class Telegram
* @package onmotion\telegram
*/
class Telegram extends \yii\base\Widget
{
public static $tlgrmChatId = null;
public function init()
{
if (empty(\Yii::$app->i18n->translations['tlgrm'])) {
\Yii::$app->i18n->translations['tlgrm'] = [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => __DIR__ . '/messages',
//'forceTranslation' => true,
];
}
parent::init();
}
public function run()
{
$view = $this->getView();
TelegramAsset::register($view);
$this->renderInitiateBtn();
}
private function renderInitiateBtn()
{
echo $this->render('default/button.php');
}
}