-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformezauth_block.inc
executable file
·70 lines (53 loc) · 1.63 KB
/
formezauth_block.inc
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
<?php
/**
* ---------------------------------------
* BLOCCO FORMEZ AUTH per la connessione
* ---------------------------------------
*/
/**
* Implements hook_block_info().
*/
function formezauth_block_info() {
$blocks = array();
$blocks['formezauth_login'] = array(
'info' => t('FormezAuth Login'),
'cache' => DRUPAL_NO_CACHE,
);
return $blocks;
}
/**
* Implements hook_block_view().
*/
function formezauth_block_view($delta='') {
$block = array();
switch($delta) {
case 'formezauth_login' :
$block['content'] = _formezauth_block_login();
break;
}
return $block;
}
/**
* Contenuto del blocco FormezAuth Login
* Crea anche un punto di alter per permettere
* personalizzazioni su
* hook_formezauth_block_login_alter
*/
function _formezauth_block_login(){
global $base_url;
$label_submit=variable_get('formezauth_block_submit_label', 'Accedi con FormezAuth');
$out="<div class=\"formezauth-block-login\">";
if(variable_get('formezauth_open_in_popup', TRUE) == TRUE){
$js_button="window.open('".$base_url."/connect/oauthconnector_formezauth','','scrollbars=yes,resizable=yes,width=800,height=800', 'formezauth');";
$out.="<input type=\"button\" value=\"".$label_submit."\" class=\"form-submit\" onclick=\"" . $js_button . "\" />\n";
}
else{
$out.="<form method=\"post\" action=\"".$base_url."/connect/oauthconnector_formezauth\">\n";
$out.="<input type=\"submit\" value=\"".$label_submit."\" class=\"form-submit\" />\n";
$out.="</form>\n";
}
$out.="</div>\n";
$vars=array($base_url, $label_submit);
drupal_alter('formezauth_block_login', $out, $vars);
return $out;
}