if (db_numrows($admin_group) > 0) {
$idadmin_group = db_result($admin_group,0,'user_id');
} else {
- $idadmin_group = 1;
+ $idadmin_group = $user->getID();
+ db_query_params ('INSERT INTO user_group (user_id, group_id, admin_flags) VALUES ($1, $2, $3)',
+ array ($idadmin_group,
+ $this->getID(),
+ 'A')) ;
}
$role = new Role($this);
if ($count < 1) {
return;
}
- // The width for each tab is given in percent. Note
- // that an integer value is used as Opera doesn't seem
- // to interpret fractional percentage values:
- // http://www.christianmontoya.com/2007/06/26/fluid-widths-and-point-nine-nine-percent/
- $width=intval((100/$count));
- $rest_width=100-$count*$width;
-
$return = '
<!-- start tabs -->
<table class="tabGenerator width-100p100" summary="" ';
$folder = $this->imgurl.($nested ? 'bottomtab-new/' : 'toptab-new/');
+ $accumulated_width = 0;
+ for ($i=0; $i<$count; $i++) {
+ $tabwidth = intval(ceil(($i+1)*100/$count)) - $accumulated_width ;
+ $accumulated_width += $tabwidth ;
+
for ($i=0; $i<$count; $i++) {
if ($selected == $i) {
$left_img = $folder.'selected-left.gif';
$return .= '</td>' . "\n";
// middle part
- $return .= '<td class="tg-middle" style="width:'.$width.'%;">' . "\n";
+ $return .= '<td class="tg-middle" style="width:'.$tabwidth.'%;">' . "\n";
$return .= '<div';
if ($selected == $i) {
$return .= ' class="selected"';
}
}
- // create a partial tab if there is any rest-width
- if ($rest_width > 0) {
- // left part
- $return .= '<td class="tg-left">' . "\n";
- $return .= '<div><div' . ($nested ? ' class="nested"' : '') . ">\n";
- $return .= '</div></div>' . "\n";
- $return .= '</td>' . "\n";
-
- $return .= '<td class="tg-middle" style="width:'.$rest_width.'%;">' . "\n";
- $return .= '<div><div' . ($nested ? ' class="nested"' : '') . ">\n";
- $return .= '</div></div>' . "\n";
- $return .= '</td>' . "\n";
- }
-
$return .= '</tr>
</table>
<!-- end tabs -->';