-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblock_banckle_live_chat.php
66 lines (51 loc) · 1.67 KB
/
block_banckle_live_chat.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
class block_banckle_live_chat extends block_base {
function init() {
$this->title = get_string('bancklelivechat', 'block_banckle_live_chat');
}
function has_config() {
return true;
}
function config_save($data) {
// Default behavior: save all variables as $CFG properties
foreach ($data as $name => $value) {
set_config($name, $value);
}
return true;
}
function instance_allow_multiple() {
// Are you going to allow multiple instances of each block?
// If yes, then it is assumed that the block WILL USE per-instance configuration
return FALSE;
}
//function preferred_width() {
// // Default case: the block wants to be 180 pixels wide
// return 180;
//}
function get_content() {
global $CFG;
$widthBlock = $this->preferred_width();
if ($this->content !== NULL) {
return $this->content;
}
$css = '<style type="text/css">
#banckleLiveChatButton{width: '.($widthBlock-10).'px;}
#banckleLiveChatButton img{width:'.($widthBlock-10).'px;}
</style>';
$script = "";
if (isset($CFG->blc_script)) {
$script = $CFG->blc_script;
}
$this->content = new stdClass;
$this->content->text = $css . "<div id='banckleLiveChatButton'>" . $script. "</div>";
//$this->content->footer = 'Footer here...';
return $this->content;
}
// function html_attributes() {
// return array(
// 'class' => 'sideblock block_'. $this->name(),
// 'onmouseover' => "alert('Mouseover on our block!');"
// );
//}
}
?>