'', 'order' => 'reverse', // latest first 'info' => 'month,numpages', // ignored 'month' => false, 'noheader' => 0 ); } function run($dbi, $argstr, &$request, $basepage) { if (is_array($argstr)) { // can do with array also. $args =& $argstr; if (!isset($args['order'])) $args['order'] = 'reverse'; } else { $args = $this->getArgs($argstr, $request); } if (empty($args['user'])) { $user = $request->getUser(); if ($user->isAuthenticated()) { $args['user'] = $user->UserName(); } else { $args['user'] = ''; } } if (!$args['user'] or $args['user'] == ADMIN_USER) { if (BLOG_DEFAULT_EMPTY_PREFIX) $args['user'] = ''; // "Blogs/day" pages else $args['user'] = ADMIN_USER; // "Admin/Blogs/day" pages } $parent = (empty($args['user']) ? '' : $args['user'] . SUBPAGE_SEPARATOR); //$info = explode(',', $args['info']); //$pagelist = new PageList($args['info'], $args['exclude'], $args); //if (!is_array('pagename'), explode(',', $info)) // unset($pagelist->_columns['pagename']); if (!empty($args['month'])) { $prefix = $parent . $this->_blogPrefix('wikiblog') . SUBPAGE_SEPARATOR . $args['month']; $pages = $dbi->titleSearch(new TextSearchQuery("^" . $prefix, true, 'posix')); $html = HTML::ul(); while ($page = $pages->next()) { $rev = $page->getCurrentRevision(false); if ($rev->get('pagetype') != 'wikiblog') continue; $blog = $this->_blog($rev); $html->pushContent(HTML::li(WikiLink($page, 'known', $rev->get('summary')))); } if (!$args['noheader']) return HTML(HTML::h3(sprintf(_("Blog Entries for %s:"), $this->_monthTitle($args['month']))), $html); else return $html; } $blogs = $this->findBlogs($dbi, $args['user'], 'wikiblog'); if ($blogs) { if (!$basepage) $basepage = _("BlogArchives"); $html = HTML::ul(); usort($blogs, array("WikiPlugin_WikiBlog", "cmp")); if ($args['order'] == 'reverse') $blogs = array_reverse($blogs); // collapse pagenames by month $months = array(); foreach ($blogs as $rev) { $blog = $this->_blog($rev); $mon = $blog['month']; if (empty($months[$mon])) $months[$mon] = array('title' => $this->_monthTitle($mon), 'num' => 1, 'month' => $mon, 'link' => WikiURL($basepage, $this->_nonDefaultArgs(array('month' => $mon)))); else $months[$mon]['num']++; } foreach ($months as $m) { $html->pushContent(HTML::li(HTML::a(array('href' => $m['link'], 'class' => 'named-wiki'), $m['title'] . " (" . $m['num'] . ")"))); } if (!$args['noheader']) return HTML(HTML::h3(_("Blog Archives:")), $html); else return $html; } else return ''; } // box is used to display a fixed-width, narrow version with common header function box($args = false, $request = false, $basepage = false) { if (!$request) $request =& $GLOBALS['request']; if (!$args or empty($args['limit'])) $args['limit'] = 10; $args['noheader'] = 1; return $this->makeBox(_("Archives"), $this->run($request->_dbi, $args, $request, $basepage)); } } // Local Variables: // mode: php // tab-width: 8 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: