lists/list_searchresults.inc.php

Go to the documentation of this file.
00001 <?php if(!function_exists('startedIndexPhp')) { header("location:../index.php"); exit();}
00002 # streber - a php based project management system
00003 # Copyright (c) 2005 Thomas Mann - thomas@pixtur.de
00004 # Distributed under the terms and conditions of the GPL as stated in docs/license.txt
00005 
00006 
00011 require_once(confGet('DIR_STREBER') . './render/render_list.inc.php');
00012 
00018 class ListBlock_searchresults extends ListBlock
00019 {
00020     public  $bg_style="bg_misc";
00021     private  $list_changes_newer_than= '';                      # timestamp
00022 
00023     public function __construct() {
00024 
00025         global $PH;
00026         global $auth;
00027 
00028         $this->id='changes';
00029         $this->reduced_header=true;
00030 
00031         $this->title=__("Changes");
00032         $this->id="changes";
00033         $this->no_items_html= sprintf(__('Other team members changed nothing since last logout (%s)'), renderDate($auth->cur_user->last_logout));
00034 
00035         $this->add_col( new ListBlockCol_SearchResultType());
00036         $this->add_col( new ListBlockCol_SearchResultName());
00037         $this->add_col( new ListBlockCol_SearchResultModified());
00038         #$this->add_col( new ListBlockCol_ChangesDate());
00039 
00040         /*
00041        ### block style functions ###
00042         $this->add_blockFunction(new BlockFunction(array(
00043             'target'=>'changeBlockStyle',
00044             'key'=>'list',
00045             'name'=>'List',
00046             'params'=>array(
00047                 'style'=>'list',
00048                 'block_id'=>$this->id,
00049                 'page_id'=>$PH->cur_page->id,
00050                 'use_collapsed'=>true,
00051              ),
00052              'default'=>true,
00053         )));
00054         */
00055     }
00056 
00057 
00058 
00059     public function print_automatic(&$results)
00060     {
00061         global $PH;
00062         global $auth;
00063 
00064         #$changes= ChangeLine::getChangeLinesForPerson($auth->cur_user, $project);
00065 
00066         $this->render_list(&$results);
00067 
00068     }
00069 
00070 
00071 
00075     public function render_list(&$changes=NULL)
00076     {
00077         global $PH;
00078 
00079 
00080 
00081         $this->render_header();
00082 
00083         if(!$changes && $this->no_items_html) {
00084             $this->render_tfoot_empty();
00085         }
00086         else {
00087 
00088             $style='searchresults';
00089 
00090             ### render table lines ###
00091             $this->render_thead();
00092 
00093 
00094             $last_group= NULL;
00095             foreach($changes as $c) {
00096                 $this->render_trow(&$c,$style);
00097             }
00098 
00099             $this->render_tfoot();
00100         }
00101     }
00102 }
00103 
00104 
00108 class ListBlockCol_SearchResultModified extends ListBlockCol
00109 {
00110 
00111     public function __construct($args=NULL) {
00112         parent::__construct($args);
00113         $this->name     =__('Modified');
00114         $this->tooltip=__("Who changed what when...");
00115     }
00116 
00117     function render_tr(&$r, $style="")
00118     {
00119         if($r instanceof SearchResult) {
00120             if(isset($r->item)) {
00121                 if($r->item->modified_by) {
00122 
00123                     if($person= Person::getVisibleById($r->item->modified_by)) {
00124 
00125                         print '<td><span class=date>'.renderDateHtml($r->item->modified) .'</span><br><span class="sub who">by '. $person->getLink() .'</span></td>';
00126                         return;
00127                     }
00128 
00129                 }
00130                 else {
00131                     print '<td><span class=date>'.renderDateHtml($r->item->modified) .'</span></td>';
00132                 }
00133             }
00134             print "<td></td>";
00135         }
00136         else {
00137             trigger_error('ListBlockCol_ChangesDate() requires instance of SearchResult',E_USER_WARNING);
00138             print "<td></td>";
00139         }
00140     }
00141 }
00142 
00143 
00144 
00145 
00150 class ListBlockCol_SearchResultType extends ListBlockCol
00151 {
00152 
00153     public function __construct($args=NULL) {
00154         parent::__construct($args);
00155         $this->name     =__('Type');
00156     }
00157 
00158     function render_tr(&$r, $style="")
00159     {
00160         if(!$r instanceof SearchResult) {
00161             trigger_error('ListBlockCol_SearchResultName() requires instance of SearchResult',E_USER_WARNING);
00162             print "<td></td>";
00163             return;
00164         }
00165         echo "<td>";
00166         echo $r->type;
00167         if($r->status) {
00168             echo "<br>";
00169             echo "<span class=sub>";
00170             echo $r->status;
00171             echo "</span>";
00172         }
00173         echo "</td>";
00174 
00175     }
00176 }
00177 
00182 class ListBlockCol_SearchResultName extends ListBlockCol
00183 {
00184 
00185     public function __construct($args=NULL) {
00186         parent::__construct($args);
00187         $this->name     =__('Name');
00188         $this->width ='80%';
00189     }
00190 
00191     function render_tr(&$r, $style="")
00192     {
00193         global $PH;
00194         if(!$r instanceof SearchResult) {
00195             trigger_error('ListBlockCol_SearchResultName() requires instance of SearchResult',E_USER_WARNING);
00196             print "<td></td>";
00197             return;
00198         }
00199 
00200         $isDone= $r->is_done
00201                ? 'isDone'
00202                : '';
00203 
00204         echo "<td>";
00205         echo "<span class='name $isDone'>";
00206         echo $PH->getLink($r->jump_id, $r->name, $r->jump_params);
00207         echo "</span>";
00208         if($r->html_location) {
00209             echo "<br>";
00210 
00211             echo "<span class=sub>";
00212             echo $r->html_location;
00213             echo "</span>";
00214 
00215         }
00216         if($r->extract) {
00217             echo "<br>";
00218 
00219             echo "<span class=extract>";
00220             echo $r->extract;
00221             echo "</span>";
00222         }
00223         echo "</td>";
00224 
00225     }
00226 }
00227 
00228 
00229 
00230 
00231 
00232 
00233 ?>

Generated on Sun Mar 4 17:19:30 2007 for streber by  doxygen 1.5.1-p1