You are here

function _smiley_select_table in Smiley 6

2 calls to _smiley_select_table()
smiley_list in ./smiley.module
theme_smiley_select_table in ./smiley.module

File

./smiley.module, line 152

Code

function _smiley_select_table($promoted = false) {
  $content = '';
  $show_titles = variable_get('smiley_dialog_titles', TRUE) && !$promoted;
  if ($promoted == true) {
    $list = _smiley_list(1, " WHERE promote_to_box='1' ORDER BY weight");
    _smiley_list(1);
  }
  else {
    $list = _smiley_list(0, " WHERE promote_to_box='0' ORDER by weight");
  }
  $first_package = NULL;
  if (!empty($show_titles)) {
    $first_package = $list[0]->package;
    $content .= '<fieldset><legend class="smileyPackageTitle">' . check_plain($first_package) . '</legend>';
  }
  foreach ($list as $smiley) {
    $acronyms = explode(' ', $smiley->acronyms);
    if ($smiley->package != $first_package && !empty($show_titles)) {
      $content .= '</fieldset><fieldset><legend class="smileyPackageTitle">' . check_plain($smiley->package) . '</legend>';
      $first_package = $smiley->package;
    }
    $content .= '<span>';
    $content .= theme_image($smiley->image, $acronyms[0], $smiley->description . '  —  ' . $smiley->acronyms, array(
      'class' => 'smiley-class',
    ));
    $content .= '</span>';
  }
  $content .= !empty($show_titles) ? '</fieldset>' : '';
  return $content . (!$promoted ? '<br /><br />' : '');
}