You are here

function janrain_capture_ui_block in Janrain Registration 6

Implements of hook_block().

File

./janrain_capture_ui.module, line 177
This module implements UI elements for Janrain Capture

Code

function janrain_capture_ui_block($op = 'list', $delta = 0, $edit = array()) {
  $janrain_capture_optional = variable_get('janrain_capture_optional', array());
  global $user;
  $items = array();
  if ($user->uid) {
    $items[] = l(t('View / Edit Profile'), 'janrain_capture/profile', array(
      'absolute' => TRUE,
      'attributes' => array(
        'class' => 'iframe fancy janrain_capture_anchor',
      ),
    ));
    if ($janrain_capture_optional['capture_sso_address']) {
      $items[] = '<a href="javascript:janrain_capture_logout()">' . t('Log out') . '</a>';
    }
    else {
      $items[] = l(t('Log out'), 'logout');
    }
  }
  else {
    $items[] = l(t('Register / Sign in'), janrain_capture_url(), array(
      'attributes' => array(
        'class' => 'iframe fancy janrain_capture_anchor janrain_capture_signin',
      ),
    ));
  }
  switch ($op) {
    case 'list':
      $block[0]['info'] = t('Janrain Capture user login');
      break;
    case 'view':
      $block['subject'] = t('Janrain Capture');
      $block['content'] = theme('item_list', $items);
      break;
  }
  return $block;
}