-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblock_simplehtml.php
More file actions
103 lines (88 loc) · 3.45 KB
/
block_simplehtml.php
File metadata and controls
103 lines (88 loc) · 3.45 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Descripción de block_simplehtml
*
* @author merma158 <jurbano@innodite.com en Innodite, C.A.> | javierurbano11@gmail.com
*/
class block_simplehtml extends block_base {
public function init() {
$this->title = get_string('simplehtml', 'block_simplehtml');
$this->version = 2013110500;
}
function get_required_javascript() {
parent::get_required_javascript();
$this->page->requires->jquery();
//$this->page->requires->jquery_plugin('ui');
//$this->page->requires->jquery_plugin('ui-css');
}
function get_content() {
global $USER;
$context = context_block::instance($this->instance->id);
if ($this->content !== NULL) {
return $this->content;
}
if (has_capability('block/simplehtml:viewlist', $context, $USER->id, false)) {
$this->content = new stdClass;
$this->content->text = '<input id="sendtoyii" type="button" value="Enviar Usuarios a Yii"/>';
$this->content->footer = '<p><br>Bloque de Prueba</p>'
. '<div id="resultset"></div>
<script>
$(function() {
$( "#sendtoyii" ).click(function() {
// Using YQL and JSONP
$.ajax({
url: "blocks/simplehtml/process/send.php",
jsonp: "callback",
dataType: "jsonp",
// work with the response
success: function( response ) {
document.getElementById("resultset").innerHTML = "Exito.!";
}
});
});
});
</script>';
}else{
$this->content->footer = '';
}
return $this->content;
}
function specialization() {
// Solo para asegurarse de que este método existe.
}
function instance_allow_config() {
return true;
}
function instance_allow_multiple() {
return true;
}
function has_config() {
return true;
}
function config_save($data) {
// Comportamiento por defecto: graba todas las variables como propiedades $CFG
foreach ($data as $name => $value) {
set_config($name, $value);
}
return true;
}
function hide_header() {
return false;
}
/*
function html_attributes() {
return array(
'onmouseover' => 'alert("Mouseover en simplehtml!");'
);
}*/
function applicable_formats() {
return array('site-index' => true,
'course-view' => true, 'course-view-social' => false,
'mod' => true, 'mod-quiz' => false);
}
}