You are here

function theme_open_readspeaker_ui in Open ReadSpeaker 7

ReadSpeaker button.

1 theme call to theme_open_readspeaker_ui()
open_readspeaker_block_view in ./open_readspeaker.module
Implements hook_block_view().

File

./open_readspeaker.module, line 146
Open ReadSpeaker

Code

function theme_open_readspeaker_ui() {

  // We don't use the $vars param.
  global $is_https;
  $output = '';
  $http = 'http';
  $accountid = variable_get('open_readspeaker_accountid', '');
  $open_readspeaker_i18n = variable_get('open_readspeaker_i18n', '');
  $custom_style = variable_get('open_readspeaker_buttonstyle', '');
  $custom_param = variable_get('open_readspeaker_customparam', '');
  if (empty($accountid)) {
    $output .= '<p>' . t('In order to ReadSpeaker work you whould need an <strong>account id</strong>.');
    $output .= t('Please go to @link and fill the account id.', array(
      '@link' => l(t('manage open ReadSpeaker'), 'admin/config/services/open-readspeaker'),
    ));
    $output .= '</p>';
    return $output;
  }
  if (empty($open_readspeaker_i18n)) {
    $output .= '<p>' . t('None language was selected please go to @link and select a language.', array(
      '@link' => l(t('manage open ReadSpeaker'), 'admin/config/services/open-readspeaker'),
    )) . '</p>';
    return $output;
  }
  if ($is_https) {
    $http = 'https';
  }
  drupal_add_js($http . "://f1.eu.readspeaker.com/script/{$accountid}/ReadSpeaker.js?pids=embhl{$custom_param}", 'external');
  drupal_add_css(drupal_get_path('module', 'open_readspeaker') . '/open_readspeaker.css', array(
    'group' => CSS_THEME,
    'media' => 'screen',
  ));
  $request_path = url(current_path(), array(
    'absolute' => TRUE,
  ));
  $output .= '<!-- RS_MODULE_CODE -->';
  $output .= '<div id="readspeaker_button1" class="rs_skip rsbtn rs_preserve"' . $custom_style . '>';
  $output .= '<a class="rsbtn_play" title="' . t('Listen to this page using ReadSpeaker') . '" accesskey="L" href="' . $http . '://app.eu.readspeaker.com/cgi-bin/rsent?customerid=' . $accountid . '&amp;lang=' . $open_readspeaker_i18n . '&amp;readid=' . variable_get('open_readspeaker_reading_area', 'rs_read_this') . '&amp;url=' . urlencode($request_path) . '">';
  $output .= '<span class="rsbtn_left rsimg rspart"><span class="rsbtn_text"><span>' . t('Listen') . '</span></span></span>';
  $output .= '<span class="rsbtn_right rsimg rsplay rspart"></span>';
  $output .= '</a></div>';
  $output .= '<div id="rs_read_this">';
  $output .= '</div>';
  return $output;
}