public static function SendinblueManager::generateHomeLogin in SendinBlue 7
Same name and namespace in other branches
- 7.2 includes/sendinblue.manage.inc \SendinblueManager::generateHomeLogin()
Generate Home layout of Log out.
Return value
string A html of home page when login.
1 call to SendinblueManager::generateHomeLogin()
- sendinblue_home_page in includes/
sendinblue_home.admin.inc - Display Home page of module.
File
- includes/
sendinblue.manage.inc, line 122 - Manage class file.
Class
- SendinblueManager
- Basic manager of module.
Code
public static function generateHomeLogin() {
$accesss_key = variable_get(self::ACCESS_KEY, '');
$mailin = new SendinblueMailin(self::API_URL, $accesss_key);
// Calculate total count of subscribers.
$list_response = $mailin
->getLists();
if ($list_response['code'] != 'success') {
$total_subscribers = 0;
}
else {
$list_datas = $list_response['data'];
$list_ids = array();
foreach ($list_datas as $list_data) {
$list_ids[] = $list_data['id'];
}
$user_response = $mailin
->displayListUsers($list_ids, 1, 500);
$total_subscribers = intval($user_response['data']['total_list_records']);
}
// Get account details.
$account_email = variable_get(self::ACCOUNT_EMAIL, '');
$account_username = variable_get(self::ACCOUNT_USERNAME, '');
$account_data = variable_get(self::ACCOUNT_DATA, array());
$print_html = '<div id="main-content">';
$print_html .= '<div class="panel panel-default row small-content">';
$print_html .= '<div class="page-header">';
$print_html .= '<strong>' . t('My Account') . '</strong>';
$print_html .= '</div><div class="panel-body"><span class="col-md-12"><b>' . t('You are currently logged in as :') . '</b></span>';
$print_html .= '<div class="col-md-8 row" style="margin-bottom: 10px;"><p class="col-md-12" style="margin-top: 5px;">';
$print_html .= check_plain($account_username) . ' - ' . check_plain($account_email) . '<br />';
$count = count($account_data);
for ($i = 0; $i < $count - 1; $i++) {
$print_html .= check_plain($account_data[$i]['plan_type']) . ' - ' . check_plain($account_data[$i]['credits']) . ' ' . t('credits') . '<br />';
}
$print_html .= '</p></div>';
$print_html .= '<span class="col-md-12"><b>' . t('Contacts') . '</b></span><div class="col-md-8 row" style="margin-bottom: 10px;">';
$print_html .= '<p class="col-md-7" style="margin-top: 5px;">' . t('You have') . '<span id="sendinblue_total_contacts">';
$print_html .= check_plain($total_subscribers) . '</span> ' . t('contacts.') . '<br />';
$print_html .= t('<a id="sendinblue_list_link" href="@sendinblue_list" target="_blank">> Access to the list of all my contacts</a>', array(
'@sendinblue_list' => 'https://my.sendinblue.com/users/list/?utm_source=drupal_plugin&utm_medium=plugin&utm_campaign=module_link',
));
$print_html .= '</p></div></div></div>';
$print_html .= '<div class="panel panel-default row small-content"><div class="page-header">';
$print_html .= '<strong>' . t('Transactional emails') . '</strong></div>';
$print_html .= '<div class="panel-body">';
$form = drupal_get_form('sendinblue_send_email_form');
$print_html .= drupal_render($form);
$print_html .= '</div></div></div>';
return $print_html;
}