Enabled turning off left and right column in portal.php

This commit is contained in:
Marc Alexander
2011-01-01 14:07:35 +00:00
parent 36c63d41ff
commit 2f15bde4cc
2 changed files with 40 additions and 7 deletions

View File

@@ -40,6 +40,19 @@ if (!isset($config['board3_enable']) || !$config['board3_enable'] || !$auth->acl
$portal_config = obtain_portal_config();
/*
* set up column_count array
*/
$module_count = array(
'total' => 0,
'top' => 0,
'left' => 0,
'center' => 0,
'right' => 0,
'bottom' => 0,
);
$sql = 'SELECT *
FROM ' . PORTAL_MODULES_TABLE . '
ORDER BY module_order ASC';
@@ -70,30 +83,35 @@ while ($row = $db->sql_fetchrow($result))
{
$user->add_lang('mods/portal/' . $module->language);
}
if ($row['module_column'] == 1)
if ($row['module_column'] == 1 && $config['board3_left_column'])
{
$template_module = $module->get_template_side($row['module_id']);
$template_column = 'left';
++$module_count['left'];
}
if ($row['module_column'] == 2)
{
$template_module = $module->get_template_center($row['module_id']);
$template_column = 'center';
++$module_count['center'];
}
if ($row['module_column'] == 3)
if ($row['module_column'] == 3 && $config['board3_right_column'])
{
$template_module = $module->get_template_side($row['module_id']);
$template_column = 'right';
++$module_count['right'];
}
if ($row['module_column'] == 4)
{
$template_module = $module->get_template_center($row['module_id']);
++$module_count['top'];
}
if ($row['module_column'] == 5)
{
$template_module = $module->get_template_center($row['module_id']);
++$module_count['bottom'];
}
if (!$template_module)
if (!isset($template_module))
{
continue;
}
@@ -119,11 +137,11 @@ while ($row = $db->sql_fetchrow($result))
}
unset($template_module);
}
$module_count = $db->sql_affectedrows();
$module_count['total'] = $db->sql_affectedrows();
$db->sql_freeresult($result);
// Redirect to index if there are currently no active modules
if($module_count < 1)
if($module_count['total'] < 1)
{
redirect(reapply_sid($phpbb_root_path . 'index.' . $phpEx));
}
@@ -133,6 +151,11 @@ $template->assign_vars(array(
'S_SMALL_BLOCK' => true,
'S_PORTAL_LEFT_COLUMN' => $config['board3_left_column_width'],
'S_PORTAL_RIGHT_COLUMN' => $config['board3_right_column_width'],
'S_LEFT_COLUMN' => ($module_count['left'] > 0) ? true : false,
'S_CENTER_COLUMN' => ($module_count['center'] > 0) ? true : false,
'S_RIGHT_COLUMN' => ($module_count['right'] > 0) ? true : false,
'S_TOP_COLUMN' => ($module_count['top'] > 0) ? true : false,
'S_BOTTOM_COLUMN' => ($module_count['bottom'] > 0) ? true : false,
));
// Output page

View File

@@ -11,6 +11,7 @@
<!-- ENDIF -->
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<!-- IF S_TOP_COLUMN -->
<tr>
<!-- [+] top module area -->
<td colspan="3">
@@ -25,8 +26,10 @@
</td>
<!-- [-] top module area -->
</tr>
<!-- ENDIF -->
<tr>
<!-- [+] left module area -->
<!-- IF S_LEFT_COLUMN -->
<td valign="top" style="width: {S_PORTAL_LEFT_COLUMN}px; padding-right: {$BLOCK_DISTANCE};">
<!-- BEGIN modules_left -->
<!-- DEFINE $TEMPLATE_FILE = '{modules_left.TEMPLATE_FILE}' -->
@@ -37,9 +40,11 @@
<!-- INCLUDE {$TEMPLATE_FILE} -->
<!-- END modules_left -->
</td>
<!-- ENDIF -->
<!-- [-] left module area -->
<!-- [+] center module area -->
<!-- IF S_CENTER_COLUMN -->
<td valign="top">
<!-- BEGIN modules_center -->
<!-- DEFINE $TEMPLATE_FILE = '{modules_center.TEMPLATE_FILE}' -->
@@ -54,9 +59,11 @@
<!-- INCLUDE portal/modules/jumpbox.html -->
<!-- ENDIF -->
</td>
<!-- ENDIF -->
<!-- [-] center module area -->
<!-- [+] right module area -->
<!-- IF S_RIGHT_COLUMN -->
<td valign="top" style="width: {S_PORTAL_RIGHT_COLUMN}px; padding-left: {$BLOCK_DISTANCE};">
<!-- BEGIN modules_right -->
<!-- DEFINE $TEMPLATE_FILE = '{modules_right.TEMPLATE_FILE}' -->
@@ -67,8 +74,10 @@
<!-- INCLUDE {$TEMPLATE_FILE} -->
<!-- END modules_right -->
</td>
<!-- ENDIF -->
<!-- [-] right module area -->
</tr>
<!-- IF S_BOTTOM_COLUMN -->
<tr>
<!-- [+] bottom module area -->
<td colspan="3">
@@ -83,6 +92,7 @@
</td>
<!-- [-] bottom module area -->
</tr>
<!-- ENDIF -->
</table>
<!--// board3 Portal by www.board3.de //-->