You are here

function _simplesamlphp_auth_generate_block_text in simpleSAMLphp Authentication 7.2

Same name and namespace in other branches
  1. 6.3 simplesamlphp_auth.module \_simplesamlphp_auth_generate_block_text()
  2. 6.2 simplesamlphp_auth.module \_simplesamlphp_auth_generate_block_text()
  3. 7.3 simplesamlphp_auth.module \_simplesamlphp_auth_generate_block_text()
  4. 7 simplesamlphp_auth.module \_simplesamlphp_auth_generate_block_text()

Generates the text for the log in block.

1 call to _simplesamlphp_auth_generate_block_text()
simplesamlphp_auth_block_view in ./simplesamlphp_auth.module
Implements hook_block_view().

File

./simplesamlphp_auth.module, line 672
simpleSAMLphp authentication module for Drupal.

Code

function _simplesamlphp_auth_generate_block_text() {
  global $_simplesamlphp_auth_as;
  $block_content = '';
  global $user;
  if (!_simplesamlphp_auth_isEnabled()) {

    // Exit without executing.
    return;
  }

  // Check if valid local session exists..
  if ($_simplesamlphp_auth_as
    ->isAuthenticated()) {
    $block_content .= '<p>' . t('Logged in as: @username', array(
      '@username' => $user->name,
    )) . '<br />' . l(t('Log Out'), 'user/logout') . '</p>';
  }
  else {
    $block_content .= '<p>' . l(t('Federated Log In'), 'saml_login') . '</p>';
  }
  return $block_content;
}