function count()
 {
     if ($this->revisionCounter === null) {
         $this->getId();
         $waIter =& PHPWikiAttachmentRevision::getRevisionIterator($this->gid, $this->id);
         $this->revisionCounter = $waIter->count();
     }
     return $this->revisionCounter;
 }
 /**
  * @access public static
  * @param  Iterator
  */
 function &getRevisionIterator($gid = null, $id = null)
 {
     $warArray = array();
     if ($id !== null) {
         $id = (int) $id;
         $gid = (int) $gid;
     } else {
         $gid = $this->gid;
         $id = $this->attachmentId;
     }
     $dao =& PHPWikiAttachmentRevision::getDao();
     $dar = $dao->getAllRevisions($id);
     while ($row =& $dar->getRow()) {
         $war = new PHPWikiAttachmentRevision($gid);
         $war->setFromRow($row);
         $warArray[] =& $war;
         unset($war);
     }
     $ai = new ArrayIterator($warArray);
     return $ai;
 }
    /**
     * @access public
     */
    function browseAttachment()
    {
        $attachmentId = (int) $_GET['id'];
        $wa = new PHPWikiAttachment($this->gid);
        $wa->initWithId($attachmentId);
        echo $GLOBALS['Language']->getText('plugin_phpwiki_views_wkserviews', 'browse_attachment_title', array($this->wikiname, $wa->getFilename()));
        // if($wari->exist()) {
        print html_build_list_table_top(array($GLOBALS['Language']->getText('plugin_phpwiki_views_wkserviews', 'attachment_revision'), $GLOBALS['Language']->getText('plugin_phpwiki_views_wkserviews', 'attachment_date'), $GLOBALS['Language']->getText('plugin_phpwiki_views_wkserviews', 'attachment_author'), $GLOBALS['Language']->getText('plugin_phpwiki_views_wkserviews', 'attachment_size')));
        $wari =& PHPWikiAttachmentRevision::getRevisionIterator($this->gid, $attachmentId);
        $wari->rewind();
        while ($wari->valid()) {
            $war =& $wari->current();
            print '
             <tr>
	       <td><a href="' . PHPWIKI_PLUGIN_BASE_URL . '/uploads/' . $this->gid . '/' . $wa->getFilename() . '/' . ($war->getRevision() + 1) . '">' . ($war->getRevision() + 1) . '</a></td>
	       <td>' . strftime("%e %b %Y %H:%M", $war->getDate()) . '</td>
               <td><a href="/users/' . user_getname($war->getOwnerId()) . '/">' . user_getname($war->getOwnerId()) . '</td>
	       <td>' . $war->getSize() . '</td>
	     </tr>';
            $wari->next();
        }
        print '</table>';
        // }
        // else {
        //   print 'not found';
        // }
        print '<hr/><p><a href="' . $this->wikiAdminLink . '&view=wikiAttachments">' . $GLOBALS['Language']->getText('plugin_phpwiki_views_wkserviews', 'back_admin') . '</a></p>' . "\n";
    }