Autor Tópico: Tidy Child Boards - SubQuadros  (Lida 8231 vezes)

0 Membros e 3 Visitantes estão a ver este tópico.

Offline candidosa2

  • Suporte Tecnico
  • Fundador
  • *
  • Mensagens: 5073
  • Rank: 1658
  • Sexo: Masculino
  • Suporte
    • Hosting Moçambique
Tidy Child Boards - SubQuadros
« em: 26 de Setembro de 2010, 18:51 »

/Sources/BoardIndex.php

Código: [Seleccione]
?>
Código: [Seleccione]
//For tidying boards; examine the children and realign into groups for tidying
function tidyBoards(&$board) {
   global $modSettings, $context, $settings;
   
   $limit = ceil(count($board['children']) / $modSettings['tidy_child_boards']);
   $children = array();
   $this_count = $limit + 1;
   $this_division = 0;
   foreach($board['children'] as $child) {
      if($this_count >= $limit) {
         $this_division++;
         $this_count = 0;
      }
      $children[$this_division][] = $child;
      $this_count++;
   }
   
   $board['tidy_children'] = $children;
   
   // We don't need the original children (plus this means way less mess in templates)
   unset($board['children']);
}

Código: [Seleccione]
// Find all boards
Código: [Seleccione]
if(empty($context['added_tidy_header']) && !empty($modSettings['tidy_child_boards']) && $modSettings['tidy_child_boards'] > 1) {
      if(empty($context['html_headers']))
         $context['html_headers'] = '';
      $context['html_headers'] .= '
   <link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/tidyboards.css?1110" />
   <style type="text/css">.tidy_child { width:' . floor(100/$modSettings['tidy_child_boards']) . '%; }</style>';
      $context['added_tidy_header'] = 1;
   }


/Sources/MessageIndex.php

Código: [Seleccione]
?>
Código: [Seleccione]
//For tidying boards; examine the children and realign into groups for tidying
function tidyBoards(&$board) {
   global $modSettings, $context, $settings;
   
   $limit = ceil(count($board['children']) / $modSettings['tidy_child_boards']);
   $children = array();
   $this_count = $limit + 1;
   $this_division = 0;
   foreach($board['children'] as $child) {
      if($this_count >= $limit) {
         $this_division++;
         $this_count = 0;
      }
      $children[$this_division][] = $child;
      $this_count++;
   }
   
   $board['tidy_children'] = $children;
   
   // We don't need the original children (plus this means way less mess in templates)
   unset($board['children']);
}

Código: [Seleccione]
// Aren't children
Código: [Seleccione]
if(empty($context['added_tidy_header']) && !empty($modSettings['tidy_child_boards']) && $modSettings['tidy_child_boards'] > 1) {
      if(empty($context['html_headers']))
         $context['html_headers'] = '';
      $context['html_headers'] .= '
   <link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/tidyboards.css?1110" />
   <style type="text/css">.tidy_child { width:' . floor(100/$modSettings['tidy_child_boards']) . '%; }</style>';
      $context['added_tidy_header'] = 1;
   }


/Sources/ModSettings.php

Código: [Seleccione]
array('check', 'enableVBStyleLogin'),
Código: [Seleccione]
'',
      array('select', 'tidy_child_boards', array(1 => &$txt['tidy_child_boards_no'], 2 => &$txt['tidy_child_boards_2col'], 3 => &$txt['tidy_child_boards_3col'], 4 => &$txt['tidy_child_boards_4col'])),
      array('check', 'tidy_child_boards_bold'),
      array('check', 'tidy_child_boards_icon'),
      array('check', 'tidy_child_boards_new'),


BoardIndex.template.php

Código: [Seleccione]
foreach ($category['boards'] as $board)
         {

Código: [Seleccione]
if(!empty($board['children']) && !empty($modSettings['tidy_child_boards']) && $modSettings['tidy_child_boards'] > 1)
               tidyBoards($board);

Código: [Seleccione]
  // Show some basic

Código: [Seleccione]
if(!empty($board['tidy_children'])) {
               $context['tidy_board'] = $board;
               template_tidy_children();
            }

Código: [Seleccione]
?>

Código: [Seleccione]
function template_tidy_children() {
   global $context, $settings, $txt, $modSettings;
   echo '
                  <div class="board_children">';
   foreach($context['tidy_board']['tidy_children'] as $key => $child_block) {
      echo '
                     <div class="tidy_child">
                        <ul>';
      foreach($child_block as $child) {
         echo '
                           <li>';

         if(!empty($modSettings['tidy_child_boards_icon']))
            echo '<img src="', $settings['images_url'], '/', ($child['new'] ? 'on' : 'off'), '.gif" width="12" height="12" alt=""> ';
         
         $child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="new_posts" ' : '') . 'title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . comma_format($child['topics']) . ', ' . $txt[21] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';

         if (!empty($modSettings['tidy_child_boards_new']) && $child['new'])
            $child['link'] .= ' <a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . comma_format($child['topics']) . ', ' . $txt[21] . ': ' . comma_format($child['posts']) . ')"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" class="new_posts" alt="" /></a>';

         if(!empty($modSettings['tidy_child_boards_bold']) && $child['new'])
            $child['link'] = '<strong>' . $child['link'] . '</strong>';

         echo $child['link'], '</li>';
      }
      echo '
                        </ul>
                     </div>';
   }
   echo '
                  </div>';
}


MessageIndex.template.php

Código: [Seleccione]
foreach ($context['boards'] as $board)
      {

Código: [Seleccione]
if(!empty($board['children']) && !empty($modSettings['tidy_child_boards']) && $modSettings['tidy_child_boards'] > 1)
               tidyBoards($board);


Código: [Seleccione]
// Show some basic
Código: [Seleccione]
if(!empty($board['tidy_children'])) {
               $context['tidy_board'] = $board;
               template_tidy_children();
            }


Código: [Seleccione]
?>
Código: [Seleccione]
function template_tidy_children() {
   global $context, $settings, $txt, $modSettings;
   echo '
                  <div class="board_children">';
   foreach($context['tidy_board']['tidy_children'] as $key => $child_block) {
      echo '
                     <div class="tidy_child">
                        <ul>';
      foreach($child_block as $child) {
         echo '
                           <li>';

         if(!empty($modSettings['tidy_child_boards_icon']))
            echo '<img src="', $settings['images_url'], '/', ($child['new'] ? 'on' : 'off'), '.gif" width="12" height="12" alt=""> ';
         
         $child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="new_posts" ' : '') . 'title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . comma_format($child['topics']) . ', ' . $txt[21] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';

         if (!empty($modSettings['tidy_child_boards_new']) && $child['new'])
            $child['link'] .= ' <a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . comma_format($child['topics']) . ', ' . $txt[21] . ': ' . comma_format($child['posts']) . ')"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" class="new_posts" alt="" /></a>';

         if(!empty($modSettings['tidy_child_boards_bold']) && $child['new'])
            $child['link'] = '<strong>' . $child['link'] . '</strong>';

         echo $child['link'], '</li>';
      }
      echo '
                        </ul>
                     </div>';
   }
   echo '
                  </div>';
}



Modifications.teuidioma.php

Código: [Seleccione]
?>
Código: [Seleccione]
// Smfpt Suporte translate candidosa2
$txt['tidy_child_boards'] = 'Organizar os Sub-quadros em colunas';
$txt['tidy_child_boards_no'] = 'Não coloque nas colunas';
$txt['tidy_child_boards_2col'] = 'Duas colunas';
$txt['tidy_child_boards_3col'] = 'Três colunas';
$txt['tidy_child_boards_4col'] = 'Quatro coluna';
$txt['tidy_child_boards_icon'] = 'Exibe o ícone de pequena do quadro ao lado do Sub-quadro';
$txt['tidy_child_boards_bold'] = 'Mostrar os sub-quadro não lidas em negrito';
$txt['tidy_child_boards_new'] = 'Mostrar imagem [novo] ao lado de sub-quadro  não lida.';