You are here

function cas_block in CAS 6.2

Same name and namespace in other branches
  1. 5.4 cas.module \cas_block()
  2. 5 cas.module \cas_block()
  3. 5.3 cas.module \cas_block()
  4. 6.3 cas.module \cas_block()
  5. 6 cas.module \cas_block()

Provides login blog that only shows up when the user logs in.

File

./cas.module, line 879

Code

function cas_block($op = 'list', $delta = 0, $edit = array()) {
  global $user;
  if ($op == 'list') {
    $blocks[0]['info'] = t('CAS User login');
    return $blocks;
  }
  elseif ($op == 'view') {
    $block = array();
    switch ($delta) {
      case 0:

        // For usability's sake, avoid showing two login forms on one page.
        if (!$user->uid && !(arg(0) == 'user' && !is_numeric(arg(1)))) {
          $edit = $_POST['edit'];
          $output = "<div class=\"user-login-block\">\n";
          $output .= drupal_get_form('cas_login_form');
          $output .= "</div>\n";
          $block['subject'] = t('User Login');
          $block['content'] = $output;
        }
        return $block;
    }
  }
}