-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactivecampaign_menu.php
103 lines (72 loc) · 2.24 KB
/
activecampaign_menu.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
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
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2016 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* activecampaign menu file.
*
*/
if (!defined('e107_INIT')) { exit; }
if(!e107::isInstalled('activecampaign'))
{
return null;
}
/*
if(!ADMIN)
{
return null;
}*/
/*
if(!empty($parm) )
{
$text = print_a($parm,true); // e_menu.php form data.
}*/
$apref = e107::pref('activecampaign');
$frm = e107::getForm();
$text = '<div id="form_result_message"></div>';
$text .= "<div class='ac-subscribe-menu'>";
$text .= $frm->open('ac-subscribe-form');
$text .= '<div class="mt-3">'.$frm->text('first_name', '', 80, ['placeholder'=>'First name']).'</div>';
$text .= '<div class="mt-3">'.$frm->text('last_name', '', 80, ['placeholder'=>'Last name']).'</div>';
$text .= '<div class="mt-3">'.$frm->text('email', '', 80, ['id'=>'ac-email', 'placeholder'=>'your@email.com']).'</div>';
$text .= '<div class="mt-3">'.$frm->button('subscribe',1,'button','Subscribe!',['class'=>'btn btn-dark']).'</div>'; //,
$text .= $frm->close();
$text .= "</div>";
$js = '
$(document).ready(function()
{
$("#ac-subscribe-form button#subscribe").click(function() {
var buttonLabel = $(this).text();
$(this).text("Saving...");
$(this).prop("disabled",true);
var form_data = {};
$("#ac-subscribe-form").each(function() {
form_data = $(this).serialize();
});
var geturl;
geturl = $.ajax({
url: "'.e_PLUGIN_ABS.'activecampaign/subscribe.php", // the URL to this page.
type: "POST",
//dataType: "json",
data: form_data,
error: function(jqXHR, textStatus, errorThrown) {
console.log("Error: " + textStatus);
},
success: function(data) {
// console.log(data);
$("#form_result_message").html(data);
$("#ac-subscribe-form *").filter(":input").each(function(){
$(this).val("");
});
$("#ac-subscribe-form button#subscribe").text(buttonLabel);
$("#ac-subscribe-form button#subscribe").prop("disabled",false);
}
});
});
});
';
e107::js('footer-inline', $js);
e107::getRender()->tablerender(varset($apref['caption'], "Subscribe"), $text);