type = $_type; $desc = $banana->nntp->xgtitle(); $this->load(); if (empty($this->overview) && $_type == BANANA_GROUP_SUB) { $this->type = BANANA_GROUP_ALL; $this->load(); } } /** Load overviews */ function load() { global $banana; if ($this->type == BANANA_GROUP_NEW) { $list = $banana->nntp->newgroups($banana->profile['lastnews']); } else { $list = $banana->nntp->liste(); if ($this->type == BANANA_GROUP_SUB) { $mylist = Array(); foreach ($banana->profile['subscribe'] as $g) { if (isset($list[$g])) { $mylist[$g] = $list[$g]; } } $list = $mylist; } } foreach ($list as $g=>$l) { $this->overview[$g][0] = isset($desc[$g]) ? $desc[$g] : '-'; $this->overview[$g][1] = $l[0]; } ksort($this->overview); } /** updates overview * @param date INTEGER date of last update */ function update($_date) { global $banana; $serverdate = $banana->nntp->date(); if (!$serverdate) $serverdate=time(); $newlist = $banana->nntp->newgroups($_date); if (!$newlist) return false; $this->date = $serverdate; foreach (array_keys($newlist) as $g) { $groupstat = $banana->nntp->group($g); $groupdesc = $banana->nntp->xgtitle($g); $this->overview[$g][0]=($groupdesc?$groupdesc:"-"); $this->overview[$g][1]=$groupstat[0]; } return true; } function to_html($show_form = false) { global $banana; if (empty($this->overview)) { return; } $html = ''."\n"; $html .= ''."\n"; $b = true; foreach ($this->overview as $g => $d) { $b = !$b; $ginfo = $banana->nntp->group($g); $new = count($banana->nntp->newnews($banana->profile['lastnews'],$g)); $html .= ''."\n"; $html .= ""; if ($show_form) { $html .= ''; } elseif ($this->type == BANANA_GROUP_SUB) { $html .= ''; } $html .= ''; } $html .= '
'._b_('Total').''; if ($show_form) { $html .= _b_('Abo.').''; } elseif ($this->type == BANANA_GROUP_SUB) { $html .= _b_('Nouveaux').''; } $html .= _b_('Nom').''._b_('Description').'
{$ginfo[0]}profile['subscribe'])) { $html .= ' checked="checked"'; } $html .= ' />'.($new ? $new : '-').'' . makeHREF(Array('group' => $g), $g) . '' . $d[0] . '
'; if ($show_form) { return '
' . '
' . $html . '
'; } return $html; } } // vim:set et sw=4 sts=4 ts=4 ?>