Screenshot   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
eloc 35
dl 0
loc 55
c 0
b 0
f 0
ccs 0
cts 36
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getPreview() 0 13 1
A getModal() 0 17 1
A run() 0 7 1
1
<?php
2
/**
3
 * Agency Theme for hiqdev/yii2-thememanager
4
 *
5
 * @link      https://github.com/hiqdev/yii2-theme-agency
6
 * @package   yii2-theme-agency
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2016-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\themes\agency\widgets;
12
13
use Yii;
14
use yii\base\Widget;
15
use yii\helpers\Html;
16
17
class Screenshot extends Widget
18
{
19
    public $header;
20
21
    public $subHeader;
22
23
    public $description;
24
25
    public $previewImage;
26
27
    public $fullImage;
28
29
    private $_modalId;
30
31
    public function run()
32
    {
33
        $this->_modalId = mt_rand();
34
        $modal = $this->getModal();
35
        $this->getView()->registerJs("$('{$modal}').appendTo('body')");
36
37
        return $this->getPreview();
38
    }
39
40
    protected function getPreview()
41
    {
42
        $out = '';
43
        $out .= Html::beginTag('a', ['href' => '#' . $this->_modalId, 'class' => 'portfolio-link', 'data-toggle' => 'modal']);
44
        $out .= '<div class="portfolio-hover"><div class="portfolio-hover-content"><i class="fa fa-plus fa-3x"></i></div></div>';
45
        $out .= Html::img($this->previewImage, ['class' => 'img-responsive']);
46
        $out .= Html::endTag('a');
47
        $out .= Html::beginTag('div', ['class' => 'portfoliy-caption']);
48
        $out .= Html::tag('h4', $this->header);
49
        $out .= Html::tag('p', $this->subHeader, ['class' => 'text-muted']);
50
        $out .= Html::endTag('div');
51
52
        return $out;
53
    }
54
55
    protected function getModal()
56
    {
57
        $out = '';
58
        $out .= Html::beginTag('div', ['class' => 'portfolio-modal modal fade', 'id' => $this->_modalId, 'role' => 'dialog']);
59
        $out .= Html::beginTag('div', ['class' => 'modal-content']);
60
        $out .= '<div class="close-modal" data-dismiss="modal"><div class="lr"><div class="rl"></div></div></div>';
61
        $out .= '<div class="container"><div class="row"><div class="col-lg-8 col-lg-offset-2"><div class="modal-body">';
62
        $out .= Html::tag('h2', $this->header);
63
        $out .= Html::tag('p', $this->subHeader, ['class' => 'item-intro text-muted']);
64
        $out .= Html::img($this->fullImage, ['class' => 'img-responsive']);
65
        $out .= Html::tag('p', $this->description);
66
        $out .= Html::button('<i class="fa fa-fw fa-close"></i> ' . Yii::t('hipanel:com', 'Close'), ['class' => 'btn btn-primary', 'data-dismiss' => 'modal']);
67
        $out .= '</div></div></div></div>';
68
        $out .= Html::endTag('div');
69
        $out .= Html::endTag('div');
70
71
        return $out;
72
    }
73
}
74