You are here

function cas_block in CAS 5.4

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

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

File

./cas.module, line 785

Code

function cas_block($op = 'list', $delta = 0, $edit = array()) {
  global $user;
  if ($op == 'list') {
    $blocks[0]['info'] = t('CAS User login');
    return $blocks;
  }
  else {
    if ($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;
      }
    }
  }
}