Passed
Push — master ( 34bdad...b152c5 )
by Julito
20:20
created

Block::getDeleteLink()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 13
rs 10
c 0
b 0
f 0
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
/**
5
 * Class Block
6
 * This file contains class used parent class for blocks plugins
7
 * Parent class for controller Blocks from dashboard plugin.
8
 *
9
 * @author Christian Fasanando <[email protected]>
10
 *
11
 * @package chamilo.dashboard
12
 */
13
class Block
14
{
15
    protected $path;
16
17
    /**
18
     * Constructor.
19
     */
20
    public function __construct()
21
    {
22
    }
23
24
    /**
25
     * @return string
26
     */
27
    public function getDeleteLink(): string
28
    {
29
        global $charset;
30
        $closeLink = '<a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\''.addslashes(
31
                api_htmlentities(
32
                    get_lang('ConfirmYourChoice'),
33
                    ENT_QUOTES,
34
                    $charset
35
                )
36
            ).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'"> 
37
                <em class="fa fa-times"></em>
38
            </a>';
39
        return $closeLink;
40
    }
41
42
    /**
43
     * @param string $title
44
     * @param string $content
45
     *
46
     * @return string
47
     */
48
    public function getBlockCard($title, $content): string
49
    {
50
        $html = Display::panel(
51
            $title,
52
            $content,
53
            '',
54
            'default',
55
            '',
56
            '',
57
            '',
58
            $this->getDeleteLink()
59
        );
60
61
        return $html;
62
    }
63
}
64