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
00030
00031
00032
00033
00034
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
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
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
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
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
00199
00200
00201
00202
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 ?>