gforge-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gforge-commits] gforge/www/search/include ForumHtmlSearchRenderer.class


From: gsmet
Subject: [Gforge-commits] gforge/www/search/include ForumHtmlSearchRenderer.class, 1.1, 1.2 FrsHtmlSearchRenderer.class, NONE, 1.1 ArtifactHtmlSearchRenderer.class, 1.1, 1.2 HtmlGroupSearchRenderer.class, NONE, 1.1 DocsHtmlSearchRenderer.class, NONE, 1.1 TrackersHtmlSearchRenderer.class, NONE, 1.1 NewsHtmlSearchRenderer.class, NONE, 1.1 ForumsHtmlSearchRenderer.class, NONE, 1.1 TasksHtmlSearchRenderer.class, NONE, 1.1
Date: Tue, 12 Oct 2004 17:08:13 -0500

Update of /cvsroot/gforge/gforge/www/search/include
In directory db.perdue.net:/tmp/cvs-serv2602/www/search/include

Modified Files:
        ForumHtmlSearchRenderer.class ArtifactHtmlSearchRenderer.class 
Added Files:
        FrsHtmlSearchRenderer.class HtmlGroupSearchRenderer.class 
        DocsHtmlSearchRenderer.class TrackersHtmlSearchRenderer.class 
        NewsHtmlSearchRenderer.class ForumsHtmlSearchRenderer.class 
        TasksHtmlSearchRenderer.class 
Log Message:
first part of GUS heavily based on [#833] Grand Unified Search by Dominik Haas

Index: ForumHtmlSearchRenderer.class
===================================================================
RCS file: 
/cvsroot/gforge/gforge/www/search/include/ForumHtmlSearchRenderer.class,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ForumHtmlSearchRenderer.class       9 Feb 2004 10:22:19 -0000       1.1
+++ ForumHtmlSearchRenderer.class       12 Oct 2004 22:08:11 -0000      1.2
@@ -11,17 +11,10 @@
  * @version $Id$
  */
 
-require_once('www/search/include/HtmlSearchRenderer.class');
+require_once('www/search/include/HtmlGroupSearchRenderer.class');
 require_once('common/search/ForumSearchQuery.class');
 
-class ForumHtmlSearchRenderer extends HtmlSearchRenderer {
-       
-       /**
-        * group id
-        *
-        * @var int $groupId
-        */
-       var $groupId;
+class ForumHtmlSearchRenderer extends HtmlGroupSearchRenderer {
        
        /**
         * forum id
@@ -40,12 +33,11 @@
         * @param int $forumId forum id
         */
        function ForumHtmlSearchRenderer($words, $offset, $isExact, $groupId, 
$forumId) {
-               $this->groupId = $groupId;
                $this->forumId = $forumId;
                
                $searchQuery = new ForumSearchQuery($words, $offset, $isExact, 
$groupId, $forumId);
                
-               $this->HtmlSearchRenderer(SEARCH__TYPE_IS_FORUM, $words, 
$isExact, $searchQuery);
+               $this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_FORUM, $words, 
$isExact, $searchQuery, $groupId, 'forums');
                
                $this->tableHeaders = array(
                        $this->Language->getText('search', 'forum_thread'),
@@ -53,14 +45,6 @@
                        $this->Language->getText('search', 'forum_date')
                );
        }
-
-       /**
-        * writeHeader - write the header of the output
-        */
-       function writeHeader() {
-               site_project_header(array('title' => 
$this->Language->getText('search', 'project_search'), 'group' => 
$this->groupId, 'pagename' => 'search', 'toptab' => 'forums'));
-               parent::writeHeader();
-       }
        
        /**
         * getRows - get the html output for result rows
@@ -90,7 +74,7 @@
         * @return string url to previous results page
         */
        function getPreviousResultsUrl() {
-               return 
parent::getPreviousResultsUrl().'&group_id='.$this->groupId.'&forum_id='.$this->forumId;
+               return 
parent::getPreviousResultsUrl().'&forum_id='.$this->forumId;
        }
        
        /**
@@ -99,7 +83,7 @@
         * @return string url to next results page
         */
        function getNextResultsUrl() {
-               return 
parent::getNextResultsUrl().'&group_id='.$this->groupId.'&forum_id='.$this->forumId;
+               return 
parent::getNextResultsUrl().'&forum_id='.$this->forumId;
        }
 
        /**

--- NEW FILE: FrsHtmlSearchRenderer.class ---
<?php
/**
 * GForge Search Engine
 *
 * Copyright 2004 (c) Dominik Haas, GForge Team
 *
 * http://gforge.org
 *
 * @version $Id: FrsHtmlSearchRenderer.class,v 1.1 2004/10/12 22:08:11 gsmet 
Exp $
 */
 
require_once('www/search/include/HtmlGroupSearchRenderer.class');
require_once('common/search/FrsSearchQuery.class');
                          
class FrsHtmlSearchRenderer extends HtmlGroupSearchRenderer {
        
        /**
         * Constructor
         *
         * @param string $words words we are searching for
         * @param int $offset offset
         * @param boolean $isExact if we want to search for all the words or if 
only one matching the query is sufficient
         * @param int $groupId group id
         * @param array $sections array of all sections to search in (array of 
strings)
         *
         */
        function FrsHtmlSearchRenderer($words, $offset, $isExact, $groupId, 
$sections=SEARCH__ALL_SECTIONS) {
                $userIsGroupMember = $this->isGroupMember($groupId);
                
                $searchQuery = new FrsSearchQuery($words, $offset, $isExact, 
$groupId, $sections, $userIsGroupMember);
                
                $this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_FRS, $words, 
$isExact, $searchQuery, $groupId, 'frs');
                
                $this->tableHeaders = array(
                        '&nbsp;',
                        $this->Language->getText('search', 'frs_release_name'),
                        $this->Language->getText('search', 'frs_posted_by'),
                        $this->Language->getText('search', 'frs_post_date'),
                );
        }

        /**
         * getRows - get the html output for result rows
         *
         * @return string html output
         */
        function getRows() {
                $rowsCount = $this->searchQuery->getRowsCount();
                $result =& $this->searchQuery->getResult();
                $dateFormat = $GLOBALS['sys_datefmt'];
                
                $return = '';
                $rowColor = 0;
                $lastPackage = null;
                
                for($i = 0; $i < $rowsCount; $i++) {
                        //section changed
                        $currentPackage = db_result($result, $i, 
'package_name');
                        if ($lastPackage != $currentPackage) {
                                $return .= '<tr><td 
colspan="4">'.$currentPackage.'</td></tr>';
                                $lastPackage = $currentPackage;
                                $rowColor = 0;
                        }
                        $return .= '<tr '. 
$GLOBALS['HTML']->boxGetAltRowStyle($rowColor) .'>'
                                . '<td width="5%">&nbsp;</td>'
                                . '<td><a 
href="/frs/shownotes.php?release_id='.db_result($result, $i, 'release_id').'">'
                                . db_result($result, $i, 
'release_name').'</a></td>'
                                . '<td width="15%">'.db_result($result, $i, 
'realname').'</td>'
                                . '<td 
width="15%">'.date($dateFormat,db_result($result,$i, 
'release_date')).'</td></tr>';
                        $rowColor ++;
                }
                return $return;
        }
        
        /**
         * getSections - get the array of possible sections to search in
         * 
         * @return array sections
         */             
        function getSections($groupId) {
                $userIsGroupMember = $this->isGroupMember($groupId);
        
                return FilesSearchQuery::getSections($groupId, 
$userIsGroupMember);     
        }
}

?>
Index: ArtifactHtmlSearchRenderer.class
===================================================================
RCS file: 
/cvsroot/gforge/gforge/www/search/include/ArtifactHtmlSearchRenderer.class,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ArtifactHtmlSearchRenderer.class    9 Feb 2004 10:22:19 -0000       1.1
+++ ArtifactHtmlSearchRenderer.class    12 Oct 2004 22:08:11 -0000      1.2
@@ -11,17 +11,10 @@
  * @version $Id$
  */
 
-require_once('www/search/include/HtmlSearchRenderer.class');
+require_once('www/search/include/HtmlGroupSearchRenderer.class');
 require_once('common/search/ArtifactSearchQuery.class');
 
-class ArtifactHtmlSearchRenderer extends HtmlSearchRenderer {
-       
-       /**
-        * group id
-        *
-        * @var int $groupId
-        */
-       var $groupId;
+class ArtifactHtmlSearchRenderer extends HtmlGroupSearchRenderer {
        
        /**
         * artifact id
@@ -45,7 +38,7 @@
                
                $searchQuery = new ArtifactSearchQuery($words, $offset, 
$isExact, $groupId, $artifactId);
                
-               $this->HtmlSearchRenderer(SEARCH__TYPE_IS_ARTIFACT, $words, 
$isExact, $searchQuery);
+               $this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_ARTIFACT, 
$words, $isExact, $searchQuery, $groupId, 'tracker');
                
                $this->tableHeaders = array(
                        $this->Language->getText('search', 'artifact_id'),
@@ -54,15 +47,6 @@
                        $this->Language->getText('search', 'artifact_date')
                );
        }
-
-       /**
-        * writeHeader - write the header of the output
-        * artifact search has a specific header
-        */
-       function writeHeader() {
-               site_project_header(array('title' => 
$this->Language->getText('search', 'project_search'), 'group' => 
$this->groupId, 'pagename' => 'search', 'toptab' => 'tracker'));
-               parent::writeHeader();
-       }
        
        /**
         * getRows - get the html output for result rows
@@ -97,7 +81,7 @@
         * @return string url to previous results page
         */
        function getPreviousResultsUrl() {
-               return 
parent::getPreviousResultsUrl().'&amp;group_id='.$this->groupId.'&amp;atid='.$this->artifactId;
+               return 
parent::getPreviousResultsUrl().'&amp;atid='.$this->artifactId;
        }
        
        /**
@@ -106,7 +90,7 @@
         * @return string url to next results page
         */
        function getNextResultsUrl() {
-               return 
parent::getNextResultsUrl().'&amp;group_id='.$this->groupId.'&amp;atid='.$this->artifactId;
+               return 
parent::getNextResultsUrl().'&amp;atid='.$this->artifactId;
        }
        
        /**

--- NEW FILE: HtmlGroupSearchRenderer.class ---
<?php

/**
 * GForge Search Engine
 *
 * Portions Copyright 1999-2001 (c) VA Linux Systems
 * The rest Copyright 2004 (c) Guillaume Smet / Open Wide
 *
 * http://gforge.org
 *
 * @version $Id: HtmlGroupSearchRenderer.class,v 1.1 2004/10/12 22:08:11 gsmet 
Exp $
 */
 
require_once('www/search/include/HtmlSearchRenderer.class');

class HtmlGroupSearchRenderer extends HtmlSearchRenderer {
        
        /**
         * group id
         *
         * @var int $groupId
         */
        var $groupId;
        
        /**
         * selected top tab
         * @var string $topTab
         */
        var $topTab;

        /**
         * Constructor
         *
         * @param string $typeOfSearch type of the search (Software, Forum, 
People and so on)
         * @param string $words words we are searching for
         * @param int $offset offset
         * @param boolean $isExact if we want to search for all the words or if 
only one matching the query is sufficient
         * @param object $searchQuery SearchQuery instance
         * @param int $groupId group id
         */
        function HtmlGroupSearchRenderer($typeOfSearch, $words, $isExact, 
$searchQuery, $groupId, $topTab = '') {
                $this->HtmlSearchRenderer($typeOfSearch, $words, $isExact, 
$searchQuery);
                $this->groupId = $groupId;
                $this->topTab = $topTab;
        }
        
        /**
         * writeHeader - write the header of the output
         */
        function writeHeader() {
                site_project_header(array('title' => 
$this->Language->getText('search', 'title'), 'group' => $this->groupId, 
'pagename' => 'search', 'toptab' => $this->topTab));
                parent::writeHeader();
        }
        
        /**
         * getPreviousResultsUrl - get the url to go to see the previous results
         *
         * @return string url to previous results page
         */
        function getPreviousResultsUrl() {
                return 
parent::getPreviousResultsUrl().'&amp;group_id='.$this->groupId;
        }
        
        /**
         * getNextResultsUrl - get the url to go to see the next results
         *
         * @return string url to next results page
         */
        function getNextResultsUrl() {
                return 
parent::getNextResultsUrl().'&amp;group_id='.$this->groupId;
        }

        /**
         * isGroupMember - returns if the logged in user is member of the 
current group
         *
         * @param int $groupId group id
         */
        function isGroupMember($groupId) {
                $Group =& group_get_object($groupId);
                if($Group && is_object($Group) && !$Group->isError() && 
session_loggedin()) {
                        $perm =& $Group->getPermission(session_get_user());
                        if($perm && is_object($perm) && $perm->isMember()) {
                                return true;
                        }
                }
                return false;           
        }
}
?>
--- NEW FILE: DocsHtmlSearchRenderer.class ---
<?php
/**
 * GForge Search Engine
 *
 * Copyright 2004 (c) Dominik Haas, GForge Team
 *
 * http://gforge.org
 *
 * @version $Id: DocsHtmlSearchRenderer.class,v 1.1 2004/10/12 22:08:11 gsmet 
Exp $
 */
 
require_once('www/search/include/HtmlGroupSearchRenderer.class');
require_once('common/search/DocsSearchQuery.class');
                          
class DocsHtmlSearchRenderer extends HtmlGroupSearchRenderer {
        
        /**
         * Constructor
         *
         * @param string $words words we are searching for
         * @param int $offset offset
         * @param boolean $isExact if we want to search for all the words or if 
only one matching the query is sufficient
         * @param int $groupId group id
         * @param array $sections array of all sections to search in (array of 
strings)
         *
         */
        function DocsHtmlSearchRenderer($words, $offset, $isExact, $groupId, 
$sections=SEARCH__ALL_SECTIONS) {
                $userIsGroupMember = $this->isGroupMember($groupId);
                                        
                $searchQuery = new DocsSearchQuery($words, $offset, $isExact, 
$groupId, $sections, $userIsGroupMember);
                
                $this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_DOCS, $words, 
$isExact, $searchQuery, $groupId, 'docman');
                
                $this->tableHeaders = array(
                        '&nbsp;',
                        $this->Language->getText('search', 'docs_id'),
                        $this->Language->getText('search', 'docs_title'),
                        $this->Language->getText('search', 'docs_description'),
                );
        }

        /**
         * getRows - get the html output for result rows
         *
         * @return string html output
         */
        function getRows() {
                $rowsCount = $this->searchQuery->getRowsCount();
                $result =& $this->searchQuery->getResult();
                $dateFormat = $GLOBALS['sys_datefmt'];
                
                $return = '';
                
                $lastDocGroup = null;
                
                $rowColor = 0;
                for($i = 0; $i < $rowsCount; $i++) {
                        //section changed
                        $currentDocGroup = db_result($result, $i, 'groupname');
                        if ($lastDocGroup != $currentDocGroup) {
                                $return .= '<tr><td 
colspan="4">'.$currentDocGroup.'</td></tr>';
                                $lastDocGroup = $currentDocGroup;
                                $rowColor = 0;
                        }
                        $return .= '<tr '. 
$GLOBALS['HTML']->boxGetAltRowStyle($rowColor) .'>'
                                . '<td width="5%">&nbsp;</td>'
                                . '<td>'.db_result($result, $i, 'docid').'</td>'
                                . '<td><a 
href="/docman/view.php/'.$this->groupId
                                . '/'.db_result($result, $i, 
'docid').'/'.db_result($result, $i, 'title').'">'
                                . html_image('ic/msg.png', '10', '12', 
array('border' => '0'))
                                . ' '.db_result($result, $i, 
'title').'</a></td>'
                                . '<td>'.db_result($result, $i, 
'description').'</td></tr>';
                        $rowColor++;
                }
                return $return;
        }

        /**
         * getSections - get the array of possible sections to search in
         * 
         * @return array sections
         */             
        function getSections($groupId) {
                $userIsGroupMember = $this->isGroupMember($groupId);
                
                return $this->searchQuery->getSections($groupId, 
$userIsGroupMember);
        }
}

?>
--- NEW FILE: TrackersHtmlSearchRenderer.class ---
<?php
/**
 * GForge Search Engine
 *
 * Copyright 2004 (c) Dominik Haas, GForge Team
 *
 * http://gforge.org
 *
 * @version $Id: TrackersHtmlSearchRenderer.class,v 1.1 2004/10/12 22:08:11 
gsmet Exp $
 */

require_once('www/search/include/HtmlGroupSearchRenderer.class');
require_once('common/search/TrackersSearchQuery.class');
        
class TrackersHtmlSearchRenderer extends HtmlGroupSearchRenderer {

        /**
         * Constructor
         *
         * @param string $words words we are searching for
         * @param int $offset offset
         * @param boolean $isExact if we want to search for all the words or if 
only one matching the query is sufficient
         * @param int $groupId group id
         * @param array $sections array of all sections to search in (array of 
strings)
         *
         */
        function TrackersHtmlSearchRenderer($words, $offset, $isExact, 
$groupId, $sections=SEARCH__ALL_SECTIONS) {
                $userIsGroupMember = $this->isGroupMember($groupId);
                        
                $searchQuery = new TrackersSearchQuery($words, $offset, 
$isExact, $groupId, $sections, $userIsGroupMember);
                
                $this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_TRACKERS, 
$words, $isExact, $searchQuery, $groupId, 'tracker');
                
                $this->tableHeaders = array(
                        '&nbsp;',
                        $this->Language->getText('search', 'artifact_id'),
                        $this->Language->getText('search', 'artifact_summary'),
                        $this->Language->getText('search', 'artifact_author'),
                        $this->Language->getText('search', 'artifact_date')
                );
        }

        /**
         * getRows - get the html output for result rows
         *
         * @return string html output
         */
        function getRows() {
                $rowsCount = $this->searchQuery->getRowsCount();
                $result =& $this->searchQuery->getResult();
                $dateFormat = $GLOBALS['sys_datefmt'];
                        
                $return = '';
                $rowColor = 0;
                $lastTracker = null;
                
                for($i = 0; $i < $rowsCount; $i++) {
                        //section changed
                        $currentTracker = db_result($result, $i, 'name');
                        if ($lastTracker != $currentTracker) {
                                $return .= '<tr><td 
colspan="5">'.$currentTracker.'</td></tr>';
                                $lastTracker = $currentTracker;
                                $rowColor = 0;
                        }
                        $return .= '<tr '. 
$GLOBALS['HTML']->boxGetAltRowStyle($rowColor) .'>'
                                                . '<td width="5%">&nbsp;</td>'
                                                . '<td>'.db_result($result, $i, 
'artifact_id').'</td>'
                                                . '<td>'
                                                        . '<a 
href="/tracker/?func=detail&group_id='.$this->groupId.'&aid='.db_result($result,
 $i, 'artifact_id')
                                                        . 
'&atid='.db_result($result, $i, 'group_artifact_id').'">'
                                                        . 
html_image('ic/msg.png', '10', '12', array('border'=>'0')).' 
'.db_result($result, $i, 'summary')
                                                        . '</a></td>'           
                                                . '<td 
width="15%">'.db_result($result, $i, 'realname').'</td>'
                                                . '<td 
width="15%">'.date($dateFormat, db_result($result, $i, 
'open_date')).'</td></tr>';
                        $rowColor ++;
                }
                return $return;
        }

        /**
         * getSections - get the array of possible sections to search in
         * 
         * @return array sections
         */             
        function getSections($groupId) {
                $userIsGroupMember = $this->isGroupMember($groupId);
                
                return $this->searchQuery->getSections($groupId, 
$userIsGroupMember);
        }
}

?>
--- NEW FILE: NewsHtmlSearchRenderer.class ---
<?php
/**
 * GForge Search Engine
 *
 * Copyright 2004 (c) Dominik Haas, GForge Team
 *
 * http://gforge.org
 *
 * @version $Id: NewsHtmlSearchRenderer.class,v 1.1 2004/10/12 22:08:11 gsmet 
Exp $
 */
 
require_once('www/search/include/HtmlGroupSearchRenderer.class');
require_once('common/search/NewsSearchQuery.class');

class NewsHtmlSearchRenderer extends HtmlGroupSearchRenderer {
        
        /**
         * Constructor
         *
         * @param string $words words we are searching for
         * @param int $offset offset
         * @param boolean $isExact if we want to search for all the words or if 
only one matching the query is sufficient
         * @param int $groupId group id
         * @param array $sections array of all sections to search in (array of 
strings)
         *
         */
        function NewsHtmlSearchRenderer($words, $offset, $isExact, $groupId) {
                $this->groupId = $groupId;
        
                $searchQuery = new NewsSearchQuery($words, $offset, $isExact, 
$groupId);
                
                //init the searchrendererr
                $this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_NEWS, $words, 
$isExact, $searchQuery, $groupId, 'news');
                
                $this->tableHeaders = array(
                        $this->Language->getText('search', 'news_summary'),
                        $this->Language->getText('search', 'news_posted_by'),
                        $this->Language->getText('search', 'news_post_date'),
                );
        }
        
        /**
         * getRows - get the html output for result rows
         *
         * @return string html output
         */
        function getRows() {
                $rowsCount = $this->searchQuery->getRowsCount();
                $result =& $this->searchQuery->getResult();
                $dateFormat = $GLOBALS['sys_datefmt'];
                
                $return = '';
                for($i = 0; $i < $rowsCount; $i++) {
                        $return .= '<tr '. 
$GLOBALS['HTML']->boxGetAltRowStyle($i) .'>'
                                . '<td><a href="/forum/forum.php?forum_id='. 
db_result($result, $i, 'forum_id').'">'
                                . html_image('ic/msg.png', '10', '12', 
array('border' => '0'))
                                . ' '.db_result($result, $i, 
'summary').'</a></td>
                                <td width="15%">'.db_result($result, $i, 
'realname').'</td>
                                <td width="15%">'.date($dateFormat, 
db_result($result, $i, 'post_date')).'</td></tr>';
                }
                return $return;
        }
}

?>
--- NEW FILE: ForumsHtmlSearchRenderer.class ---
<?php
/**
 * GForge Search Engine
 *
 * Copyright 2004 (c) Dominik Haas, GForge Team
 *
 * http://gforge.org
 *
 * @version $Id: ForumsHtmlSearchRenderer.class,v 1.1 2004/10/12 22:08:11 gsmet 
Exp $
 */
 
require_once('www/search/include/HtmlGroupSearchRenderer.class');
require_once('common/search/ForumsSearchQuery.class');
        
class ForumsHtmlSearchRenderer extends HtmlGroupSearchRenderer {

        /**
         * Constructor
         *
         * @param string $words words we are searching for
         * @param int $offset offset
         * @param boolean $isExact if we want to search for all the words or if 
only one matching the query is sufficient
         * @param int $groupId group id
         * @param array $sections array of all sections to search in (array of 
strings)
         *
         */
        function ForumsHtmlSearchRenderer($words, $offset, $isExact, $groupId, 
$sections=SEARCH__ALL_SECTIONS) {
                $userIsGroupMember = $this->isGroupMember($groupId);
                
                $searchQuery = new ForumsSearchQuery($words, $offset, $isExact, 
$groupId, $sections, $userIsGroupMember);
                
                $this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_FORUMS, $words, 
$isExact, $searchQuery, $groupId, 'forums');
                
                $this->tableHeaders = array(
                        '',
                        $this->Language->getText('search', 'forum_thread'),
                        $this->Language->getText('search', 'forum_author'),
                        $this->Language->getText('search', 'forum_date')
                );
        }

        /**
         * getRows - get the html output for result rows
         *
         * @return string html output
         */
        function getRows() {
                $rowsCount = $this->searchQuery->getRowsCount();
                $result =& $this->searchQuery->getResult();
                $dateFormat = $GLOBALS['sys_datefmt'];

                $return = '';
                $rowColor = 0;
                $lastForumName = null;
                
                for($i = 0; $i < $rowsCount; $i++) {
                        //section changed
                        $currentForumName = db_result($result, $i, 
'forum_name');
                        if ($lastForumName != $currentForumName) {
                                $return .= '<tr><td 
colspan="4">'.$currentForumName.'</td></tr>';
                                $lastForumName = $currentForumName;
                                $rowColor = 0;
                        }
                        $return .= '<tr '. 
$GLOBALS['HTML']->boxGetAltRowStyle($rowColor) .'>'
                                                . '<td width="5%">&nbsp;</td>'
                                                . '<td><a 
href="/forum/message.php?msg_id='. db_result($result, $i, 'msg_id').'">'
                                                        . 
html_image('ic/msg.png', '10', '12', array('border' => '0')).' 
'.db_result($result, $i, 'subject')
                                                        .'</a></td>'            
        
                                                . '<td 
width="15%">'.db_result($result, $i, 'realname').'</td>'
                                                . '<td 
width="15%">'.date($dateFormat, db_result($result, $i, 
'post_date')).'</td></tr>';
                        $rowColor ++;
                }
                return $return;
        }
        
        /**
         * getSections - get the array of possible sections to search in
         * 
         * @return array sections
         */                             
        function getSections($groupId) {
                $userIsGroupMember = $this->isGroupMember($groupId);
                
                return $this->searchQuery->getSections($groupId, 
$userIsGroupMember);
        }
}

?>
--- NEW FILE: TasksHtmlSearchRenderer.class ---
<?php
/**
 * GForge Search Engine
 *
 * Copyright 2004 (c) Dominik Haas, GForge Team
 *
 * http://gforge.org
 *
 * @version $Id: TasksHtmlSearchRenderer.class,v 1.1 2004/10/12 22:08:11 gsmet 
Exp $
 */

require_once('www/search/include/HtmlGroupSearchRenderer.class');
require_once('common/search/TasksSearchQuery.class');
        
class TasksHtmlSearchRenderer extends HtmlGroupSearchRenderer {
        
        /**
         * Constructor
         *
         * @param string $words words we are searching for
         * @param int $offset offset
         * @param boolean $isExact if we want to search for all the words or if 
only one matching the query is sufficient
         * @param int $groupId group id
         * @param array $sections array of all sections to search in (array of 
strings)
         *
         */
        function TasksHtmlSearchRenderer($words, $offset, $isExact, $groupId, 
$sections=SEARCH__ALL_SECTIONS) {
                $userIsGroupMember = $this->isGroupMember($groupId);
                
                $searchQuery = new TasksSearchQuery($words, $offset, $isExact, 
$groupId, $sections, $userIsGroupMember);

                $this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_TASKS, $words, 
$isExact, $searchQuery, $groupId, 'pm');
                
                $this->tableHeaders = array(
                        '&nbsp;',
                        $this->Language->getText('search', 'tasks_id'),
                        $this->Language->getText('search', 'tasks_summary'),
                        $this->Language->getText('search', 'tasks_start_date'),
                        $this->Language->getText('search', 'tasks_end_date'),
                        $this->Language->getText('search', 'tasks_created_by'),
                        $this->Language->getText('search', 'tasks_completed')
                );
        }

        /**
         * getRows - get the html output for result rows
         *
         * @return string html output
         */     
        function getRows() {
                $rowsCount = $this->searchQuery->getRowsCount();
                $result =& $this->searchQuery->getResult();
                $dateFormat = $GLOBALS['sys_datefmt'];
                
                $return = '';
                $rowColor = 0;
                $lastProjectName = null;
                
                for($i = 0; $i < $rowsCount; $i++) {
                        //section changed
                        $currentProjectName = db_result($result, $i, 
'project_name');
                        if ($lastProjectName != $currentProjectName) {
                                $return .= '<tr><td 
colspan="7">'.$currentProjectName.'</td></tr>';
                                $lastProjectName = $currentProjectName;
                                $rowColor = 0;
                        }
                        $return .= '<tr '. 
$GLOBALS['HTML']->boxGetAltRowStyle($rowColor) .'>'
                                                . ' <td width="5%">&nbsp;</td>'
                                                . ' <td>'.db_result($result, 
$i, 'project_task_id').'</td>'
                                                . ' <td>'
                                                        . '<a 
href="/pm/task.php?func=detailtask&project_task_id='
                                                        . db_result($result, 
$i, 'project_task_id').'&group_id='.$this->groupId
                                                        . 
'&group_project_id='.db_result($result, $i, 'group_project_id').'">'
                                                        . 
html_image('ic/msg.png', '10', '12', array('border'=>'0')).' '
                                                        . db_result($result, 
$i, 'summary').'</a></td>'
                                                . ' <td 
width="15%">'.date($dateFormat, db_result($result, $i, 'start_date')).'</td>'
                                                . ' <td 
width="15%">'.date($dateFormat, db_result($result, $i, 'end_date')).'</td>'
                                                . ' <td 
width="15%">'.db_result($result, $i, 'realname').'</td>'
                                                . ' <td 
width="8%">'.db_result($result, $i, 'percent_complete').' %</td></tr>';
                        $rowColor ++;
                }
                return $return;
        }
                
        /**
         * getSections - get the array of possible sections to search in
         * 
         * @return array sections
         */             
        function getSections($groupId) {
                $userIsGroupMember = $this->isGroupMember($groupId);
                
                return TasksSearchQuery::getSections($groupId, 
$userIsGroupMember);             
        }
}

?>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]