function template_preview_adkblock() { global $scripturl, $context, $txt, $boarddir, $boardurl, $adkportal, $adkFolder; $width = 100; if ($context['adkportal']['blocks']['columna'] == 1) { $width = $adkportal['wleft']; } elseif ($context['adkportal']['blocks']['columna'] == 3) { $width = $adkportal['wright']; } echo ' <div class="cat_bar"> <h3 class="catbg"> <img class="adk_vertical_align" alt="" src="' . $adkFolder['images'] . '/search.png" /> ' . $txt['adkblock_preview'] . ' </h3> </div> <span class="clear upperframe"> <span> </span> </span> <div class="roundframe"> <div> <div style="margin: 0 auto; width: ' . $width . ';">'; adk_create_block($context['adkportal']['blocks'], false); echo ' </div> </div> </div> <span class="lowerframe"> <span> </span> </span>'; }
function load_multi_blocks($id, $initial_id) { global $smcFunc, $user_info; //wrongs id? if (empty($id)) { return; } $multi_id = explode(',', $id); $sql = $smcFunc['db_query']('', ' SELECT id, echo, name, img, type, empty_body, empty_title, empty_collapse, permissions, other_style FROM {db_prefix}adk_blocks WHERE id IN ({array_string:settings})', array('settings' => $multi_id)); $blocks = array(); $to_count = count($multi_id); //Algunas variables $i = 0; $to_use = ''; while ($row = $smcFunc['db_fetch_assoc']($sql)) { while ($i < $to_count) { if ($row['id'] == $multi_id[$i]) { $to_use = $i; } $i++; } $blocks[$to_use] = array('id' => $row['id'], 'echo' => un_htmlspecialchars($row['echo']), 'title' => $row['name'], 'img' => $row['img'], 'type' => $row['type'], 'b' => $row['empty_body'], 't' => $row['empty_title'], 'c' => $row['empty_collapse'], 'p' => $row['permissions'], 'other_style' => $row['other_style']); $i = 0; } ksort($blocks); $smcFunc['db_free_result']($sql); $total_blocks = count($blocks); if (empty($blocks)) { return; } //Count -1 if that user does not have permissions to see this block foreach ($blocks as $block) { $true = true; $explode = explode(',', $block['p']); if ($user_info['is_guest'] && in_array(-1, $explode)) { $true = false; } if ($user_info['groups'][0] == 0 && in_array(-2, $explode)) { $true = false; } if (in_array($user_info['groups'][0], $explode) && $user_info['groups'][0] != 0) { $true = false; } if (!$true) { $total_blocks--; } } if (!empty($total_blocks)) { //Widths :) $widths = 100 / $total_blocks; echo ' <table style="width: 100%;" align="center"> <tr>'; foreach ($blocks as $block) { $true = true; $explode = explode(',', $block['p']); if ($user_info['is_guest'] && in_array(-1, $explode)) { $true = false; } if ($user_info['groups'][0] == 0 && in_array(-2, $explode)) { $true = false; } if (in_array($user_info['groups'][0], $explode) && $user_info['groups'][0] != 0) { $true = false; } if ($true) { $block['id'] = $block['id'] . '_prima_' . $initial_id; echo ' <td valign="top" style="width: ', $widths, '%;">'; adk_create_block($block); echo ' </td>'; } } echo ' </tr> </table>'; } }