lists/list_project_team.inc.php

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 
00017 class ListBlock_projectTeam extends ListBlock
00018 {
00019 
00020     public function __construct($args=NULL)
00021     {
00022         parent::__construct($args);
00023 
00024         $this->id='projectpersons';
00025         $this->bg_style='bg_people';
00026         $this->title=__("Your related persons");
00027 
00028         $this->add_col( new ListBlockColSelect());
00029         /*$this->add_col( new ListBlockColFormat(array(
00030             'key'=>'nickname',
00031             'name'=>"Name Short",
00032             'tooltip'=>"Shortnames used in other lists",
00033             'sort'=>0,
00034             'format'=>'<nobr><a href="index.php?go=personView&amp;person={?id}">{?nickname}</a></nobr>'
00035         )));*/
00036 
00037         $this->add_col( new ListBlockCol_ProjectPersonName());
00038         $this->add_col( new ListBlockCol_ProjectJob());
00039         $this->add_col( new ListBlockCol_ProjectPersonLastLogin());
00040         #$this->add_col( new ListBlockColFormat(array(
00041         #   'key'=>'role',
00042         #   'name'=>__("Rights"),
00043         #   'tooltip'=>__("Persons rights in this project"),
00044         #   'format'=>'{?role}'
00045         #)));
00046         /*
00047         $this->add_col( new ListBlockColFormat(array(
00048             'key'=>'phone_personal',
00049             'name'=>"Private",
00050             'format'=>'<nobr>{?phone_personal}</nobr>'
00051         )));
00052         $this->add_col( new ListBlockColFormat(array(
00053             'key'=>'mobile',
00054             'name'=>"Mobil",
00055             'format'=>'<nobr>{?phone_mobile}</nobr>'
00056         )));
00057         $this->add_col( new ListBlockColFormat(array(
00058             'key'=>'office',
00059             'name'=>"Office",
00060             'format'=>'<nobr>{?phone_office}</nobr>'
00061         )));
00062         $this->add_col( new ListBlockColFormat(array(
00063             'key'=>'tagline',
00064             'name'=>"Tagline",
00065             'format'=>'{?tagline}'
00066         )));
00067         $this->add_col( new ListBlockColMethod(array(
00068             'name'=>"Companies",
00069             'sort'=>0,
00070             'func'=>'getCompanyLinks',
00071         )));
00072 
00073         /*$this->add_col( new ListBlockCol_ProjectEffortSum);
00074 
00075         $this->add_col( new ListBlockColMethod(array(
00076             'name'=>"Tasks",
00077             'tooltip'=>"Number of open Tasks",
00078             'sort'=>0,
00079             'func'=>'getNumTasks',
00080             'style'=>'right'
00081         )));
00082         $this->add_col( new ListBlockColDate(array(
00083             'key'=>'date_start',
00084             'name'=>"Opened",
00085             'tooltip'=>"Day the Project opened",
00086             'sort'=>0,
00087         )));
00088         $this->add_col( new ListBlockColDate(array(
00089             'key'=>'date_closed',
00090             'name'=>"Closed",
00091             'tooltip'=>"Day the Project state changed to closed",
00092             'sort'=>0,
00093         )));
00094         */
00095 
00096         #---- functions ----
00097         global $PH;
00098         $this->add_function(new ListFunction(array(
00099             'target'=>$PH->getPage('projectPersonEdit')->id,
00100             'name'  =>__('Edit team member'),
00101             'id'    =>'projectPersonEdit',
00102             'icon'  =>'edit',
00103             'context_menu'=>'submit',
00104         )));
00105         $this->add_function(new ListFunction(array(
00106             'target'=>$PH->getPage('projAddPerson')->id,
00107             'name'  =>__('Add team member'),
00108             'id'    =>'projectPersonAdd',
00109             'icon'  =>'add',
00110             'context_menu'=>'submit',
00111         )));
00112         $this->add_function(new ListFunction(array(
00113             'target'=>$PH->getPage('projectPersonDelete')->id,
00114             'name'  =>__('Remove person from team'),
00115             'id'    =>'projectPersonDelete',
00116             'icon'  =>'sub',
00117             'context_menu'=>'submit',
00118         )));
00119         /*$this->add_function(new ListFunction(array(
00120             'target'=>$PH->getPage('personDelete')->id,
00121             'name'  =>'Delete person',
00122             'id'    =>'personDelete',
00123             'icon'  =>'delete'
00124         )));
00125         $this->add_function(new ListFunction(array(
00126             'target'=>$PH->getPage('personNew')->id,
00127             'name'  =>'Create new person',
00128             'id'    =>'personNew',
00129             'icon'  =>'new',
00130             'context_menu'=>'submit',
00131         )));
00132         */
00133     }
00134 
00135     public function print_automatic(&$project)
00136     {
00137         global $PH;
00138         global $auth;
00139 
00140         if(!$this->active_block_function=$this->getBlockStyleFromCookie()) {
00141             $this->active_block_function = 'list';
00142         }
00143 
00144         $this->group_by= get("blockstyle_{$PH->cur_page->id}_{$this->id}_grouping");
00145 
00146         $s_cookie= "sort_{$PH->cur_page->id}_{$this->id}_{$this->active_block_function}";
00147         if($sort= get($s_cookie)) {
00148             $this->query_options['order_by']= $sort;
00149         }
00150 
00151         if($auth->cur_user->user_rights & RIGHT_VIEWALL) {
00152             $this->query_options['alive_only'] = true;
00153             $this->query_options['visible_only'] = false;
00154         }
00155         else {
00156             $this->query_options['alive_only'] = true;
00157             $this->query_options['visible_only'] = true;
00158         }
00159 
00160         #$team_members = &$project->getProjectPersons($this->query_options['order_by'], $this->query_options['alive_only'], $this->query_options['visible_only']);
00161         $team_members = &$project->getProjectPersons($this->query_options);
00162         $this->render_list(&$team_members);
00163     }
00164 }
00165 
00166 class ListBlockCol_ProjectPersonName extends ListBlockCol
00167 {
00168     public $name;
00169     public $key='pp.person';
00170 
00171     public function __construct($args=NULL) {
00172         parent::__construct($args);
00173         $this->name=__('Team members');
00174         $this->id= 'member';
00175     }
00176 
00177     function render_tr(&$pp, $style="") {
00178 
00179         if($person= $pp->getPerson()) {
00180 
00181             print "<td>".$person->getLink()."</td>";
00182         }
00183     }
00184 }
00185 
00186 
00187 class ListBlockCol_ProjectRole extends ListBlockCol
00188 {
00189     public $name;
00190     public $key='view_level';
00191 
00192     public function __construct($args=NULL) {
00193         parent::__construct($args);
00194         $this->name=__('Role');
00195         $this->id='role';
00196     }
00197 
00198     /*function render_tr(&$obj, $style="")
00199     {
00200 
00201 
00202         print "<td><span class=small>$obj->name</span></td>";
00203     }*/
00204     function render_tr(&$pp, $style="")
00205     {
00206         global $g_user_profile_names;
00207 
00208         print "<td><span class=small>". $g_user_profile_names[intval($pp->role)] . "</span></td>";
00209     }
00210 }
00211 
00212 class ListBlockCol_ProjectJob extends ListBlockCol
00213 {
00214     public $name;
00215     public $key='pp.name';
00216 
00217     public function __construct($args=NULL) {
00218         parent::__construct($args);
00219         $this->name=__('job');
00220         $this->id='name';
00221     }
00222 
00223     function render_tr(&$pp, $style="")
00224     {
00225         print "<td><span class=small>$pp->name</span></td>";
00226     }
00227 }
00228 
00229 class ListBlockCol_ProjectPersonLastLogin extends ListBlockCol
00230 {
00231 
00232     public function __construct($args=NULL) {
00233         parent::__construct($args);
00234         $this->name=__('last Login','column header');
00235     }
00236 
00237     function render_tr(&$pp, $style="")
00238     {
00239 
00240         if($person= $pp->getPerson()) {
00241 
00242             print "<td class=small>".renderDateHtml($person->last_login)."</td>";
00243         }
00244     }
00245 }
00246 ?>

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