Overview

Packages

  • None
  • Wicked

Classes

  • Text_Wiki_Parse_Heading2
  • Text_Wiki_Parse_Toc2
  • Text_Wiki_Render_Latex_Heading2
  • Text_Wiki_Render_Latex_Toc2
  • Text_Wiki_Render_Plain_Heading2
  • Text_Wiki_Render_Plain_Toc2
  • Text_Wiki_Render_Rst
  • Text_Wiki_Render_Rst_Blockquote
  • Text_Wiki_Render_Rst_Bold
  • Text_Wiki_Render_Rst_Code
  • Text_Wiki_Render_Rst_Deflist
  • Text_Wiki_Render_Rst_Emphasis
  • Text_Wiki_Render_Rst_Freelink
  • Text_Wiki_Render_Rst_Heading2
  • Text_Wiki_Render_Rst_Links
  • Text_Wiki_Render_Rst_List
  • Text_Wiki_Render_Rst_Newline
  • Text_Wiki_Render_Rst_Paragraph
  • Text_Wiki_Render_Rst_Raw
  • Text_Wiki_Render_Rst_Toc2
  • Text_Wiki_Render_Rst_Tt
  • Text_Wiki_Render_Rst_Url
  • Text_Wiki_Render_Xhtml_Attribute
  • Text_Wiki_Render_Xhtml_Code2
  • Text_Wiki_Render_Xhtml_Freelink2
  • Text_Wiki_Render_Xhtml_Heading2
  • Text_Wiki_Render_Xhtml_Image2
  • Text_Wiki_Render_Xhtml_Interwiki
  • Text_Wiki_Render_Xhtml_Registrylink
  • Text_Wiki_Render_Xhtml_Toc2
  • Text_Wiki_Render_Xhtml_Url
  • Text_Wiki_Render_Xhtml_Wickedblock
  • Text_Wiki_Render_Xhtml_Wikilink2
  • Wicked
  • Wicked_Api
  • Wicked_Driver
  • Wicked_Driver_Sql
  • Wicked_Exception
  • Wicked_Factory_Driver
  • Wicked_Page
  • Wicked_Page_AddPage
  • Wicked_Page_AllPages
  • Wicked_Page_AttachedFiles
  • Wicked_Page_BackLinks
  • Wicked_Page_DeletePage
  • Wicked_Page_EditPage
  • Wicked_Page_LeastPopular
  • Wicked_Page_LikePages
  • Wicked_Page_MergeOrRename
  • Wicked_Page_MostPopular
  • Wicked_Page_NewPage
  • Wicked_Page_RecentChanges
  • Wicked_Page_RevertPage
  • Wicked_Page_Search
  • Wicked_Page_StandardHistoryPage
  • Wicked_Page_StandardPage
  • Wicked_Page_SyncDiff
  • Wicked_Page_SyncPages
  • Wicked_Sync
  • Wicked_Sync_Wicked
  • Wicked_Test
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Wicked RecentChanges class.
  4:  *
  5:  * Copyright 2003-2012 Horde LLC (http://www.horde.org/)
  6:  *
  7:  * See the enclosed file COPYING for license information (GPL). If you
  8:  * did not receive this file, see http://www.horde.org/licenses/gpl.
  9:  *
 10:  * @author  Tyler Colbert <tyler@colberts.us>
 11:  * @package Wicked
 12:  */
 13: class Wicked_Page_RecentChanges extends Wicked_Page {
 14: 
 15:     /**
 16:      * Display modes supported by this page.
 17:      *
 18:      * @var array
 19:      */
 20:     public $supportedModes = array(
 21:         Wicked::MODE_CONTENT => true,
 22:         Wicked::MODE_DISPLAY => true);
 23: 
 24:     /**
 25:      * Renders this page in content mode.
 26:      *
 27:      * @return string  The page content.
 28:      * @throws Wicked_Exception
 29:      */
 30:     public function content()
 31:     {
 32:         global $wicked;
 33: 
 34:         $days = (int)Horde_Util::getGet('days', 3);
 35:         $summaries = $wicked->getRecentChanges($days);
 36: 
 37:         $bydate = array();
 38:         $changes = array();
 39:         foreach ($summaries as $page) {
 40:             $page = new Wicked_Page_StandardPage($page);
 41: 
 42:             $createDate = $page->versionCreated();
 43:             $tm = localtime($createDate, true);
 44:             $createDate = mktime(0, 0, 0, $tm['tm_mon'], $tm['tm_mday'],
 45:                                  $tm['tm_year'], $tm['tm_isdst']);
 46: 
 47:             $version_url = Horde_Util::addParameter($page->pageUrl(), 'version',
 48:                                               $page->version());
 49:             $diff_url = Horde_Util::addParameter(Horde::url('diff.php'),
 50:                                            array('page' => $page->pageName(),
 51:                                                  'v1' => '?',
 52:                                                  'v2' => $page->version()));
 53:             $diff_alt = sprintf(_("Show changes for %s"), $page->version());
 54:             $diff_img = Horde::img('diff.png', $diff_alt);
 55:             $pageInfo = array('author' => $page->author(),
 56:                               'name' => $page->pageName(),
 57:                               'url' => $page->pageUrl(),
 58:                               'version' => $page->version(),
 59:                               'version_url' => $version_url,
 60:                               'version_alt' => sprintf(_("Show version %s"),
 61:                                                        $page->version()),
 62:                               'diff_url' => $diff_url,
 63:                               'diff_alt' => $diff_alt,
 64:                               'diff_img' => $diff_img,
 65:                               'created' => $page->formatVersionCreated(),
 66:                               'change_log' => $page->changeLog());
 67:             $bydate[$createDate][$page->versionCreated()] = $pageInfo;
 68:         }
 69:         krsort($bydate);
 70: 
 71:         foreach ($bydate as $pageList) {
 72:             krsort($pageList);
 73:             $pageList = array_values($pageList);
 74:             $changes[] = array('date' => $pageList[0]['created'],
 75:                                'pages' => $pageList);
 76:         }
 77: 
 78:         return $changes;
 79:     }
 80: 
 81:     /**
 82:      * Renders this page in display or block mode.
 83:      *
 84:      * @return string  The contents.
 85:      * @throws Wicked_Exception
 86:      */
 87:     public function displayContents($isBlock)
 88:     {
 89:         $template = $GLOBALS['injector']->createInstance('Horde_Template');
 90:         $template->set('changes', $this->content());
 91:         return $template->fetch(WICKED_TEMPLATES . '/display/RecentChanges.html');
 92:     }
 93: 
 94:     public function pageName()
 95:     {
 96:         return 'RecentChanges';
 97:     }
 98: 
 99:     public function pageTitle()
100:     {
101:         return _("Recent Changes");
102:     }
103: 
104: }
105: 
API documentation generated by ApiGen