Autor Tópico: Child boards as dropdown menu  (Lida 4819 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Offline candidosa2

  • Suporte Tecnico
  • Fundador
  • *
  • Mensagens: 5072
  • Rank: 1658
  • Sexo: Masculino
  • Suporte
    • Hosting Moçambique
Child boards as dropdown menu
« em: 09 de Janeiro de 2011, 17:17 »
Link Original: http://custom.simplemachines.org/mods/index.php?mod=1691
Modo Nome: Child boards as dropdown menu
Created By:   Rumbaar
Última versão: 1.1
Versão compatíveis: 1.1.8, 2.0 RC1
Instalação Manual: Sim / / Por Candidosa2

./Themes/default/BoardIndex.template.php

Código: [Seleccione]
// Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
            if (!empty($board['children']))
            {
               // Sort the links into an array with new boards bold so it can be imploded.
               $children = array();
               /* Each child in each board's children has:
                     id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
               foreach ($board['children'] as $child)
               {
                  if (!$child['is_redirect'])
                     $child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . $child['topics'] . ', ' . $txt['posts'] . ': ' . $child['posts'] . ')">' . $child['name'] . '</a>';
                  else
                     $child['link'] = '<a href="' . $child['href'] . '" title="' . $child['posts'] . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';

                  // Has it posts awaiting approval?
                  if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']))
                     $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > $child['unapproved_posts'] ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';

                  $children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];
               }
               echo '
         <tr>
            <td class="windowbg3 smalltext largepadding"><strong>', $txt['parent_boards'], '</strong>: ', implode(', ', $children), '</td>
         </tr>';
            }


Código: [Seleccione]
// Show the Child Boards as drop-down menu
            if (!empty($board['children']))
            {
               echo '
         <tr>
            <td class="windowbg3 smalltext">
               <form action="', $scripturl, '" method="get" accept-charset="', $context['character_set'], '" name="jumptoForm">
                  <span class="smalltext"><label for="jumpto"><strong>', $txt['parent_boards'], '</strong></label>:</span>
               <select name="jumpto" id="jumpto" onchange="if (this.selectedIndex > 0 &amp;&amp; this.options[this.selectedIndex].value) window.location.href = smf_scripturl + this.options[this.selectedIndex].value.substr(smf_scripturl.indexOf(\'?\') == -1 || this.options[this.selectedIndex].value.substr(0, 1) != \'?\' ? 0 : 1);">
               <option value="">' . $txt['select_destination'] . '</option>';

            // Populate the dropdown with child boards
               foreach ($board['children'] as $child)
               {
                  // Has it posts awaiting approval?
                  if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']) && $child['new'])
               echo '
                     <option value="?board=', $child['id'], '.0">' , $child['name'] , ' (' , $txt['new'] , ') (!)</option>';
               elseif ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']))
               echo '
                     <option value="?board=', $child['id'], '.0">' , $child['name'] , ' (!)</option>';
               elseif ($child['new'])
               echo '
                     <option value="?board=', $child['id'], '.0">' , $child['name'] , ' (' , $txt['new'] , ')</option>';
               else
               echo '
                     <option value="?board=', $child['id'], '.0">' , $child['name'] , '</option>';
               }

               echo '
               </select>&nbsp;
               </form>
            </td>
         </tr>';
            }