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
00025 class ListBlock_versions extends ListBlock
00026 {
00027
00028 public function __construct($args=NULL)
00029 {
00030 parent::__construct($args);
00031
00032 $this->id='tasks';
00033 $this->bg_style='bg_projects';
00034 $this->title="Versions";
00035
00036
00037 $this->add_col( new ListBlockColSelect());
00038 #$this->add_col( new ListBlockColPrio());
00039 #$this->add_col( new ListBlockColStatus());
00040 $this->add_col( new ListBlockCol_VersionName());
00041 $this->add_col( new ListBlockCol_TimeReleased());
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 #---- functions ------------------------
00062 global $PH;
00063
00064 ### functions ###
00065 $this->add_function(new ListFunction(array(
00066 'target'=>$PH->getPage('taskEdit')->id,
00067 'name' =>__('Edit'),
00068 'id' =>'taskEdit',
00069 'icon' =>'edit',
00070 'context_menu'=>'submit',
00071 )));
00072 $this->add_function(new ListFunction(array(
00073 'target'=>$PH->getPage('itemsAsBookmark')->id,
00074 'name' =>__('Mark as bookmark'),
00075 'id' =>'itemsAsBookmark',
00076 'context_menu'=>'submit',
00077 )));
00078
00079 ### block style functions ###
00080 $this->add_blockFunction(new BlockFunction(array(
00081 'target'=>'changeBlockStyle',
00082 'key'=>'list',
00083 'name'=>'List',
00084 'params'=>array(
00085 'style'=>'list',
00086 'block_id'=>$this->id,
00087 'page_id'=>$PH->cur_page->id,
00088 # 'use_collapsed'=>true, @@@ this parameter seems useless
00089 ),
00090 'default'=>true,
00091 )));
00092 $this->groupings= new BlockFunction_grouping(array(
00093 'target'=>'changeBlockStyle',
00094 'key'=>'grouped',
00095 'name'=>'Grouped',
00096 'params'=>array(
00097 'style'=>'grouped',
00098 'block_id'=>$this->id,
00099 'page_id'=>$PH->cur_page->id,
00100 ),
00101 ));
00102
00103 $this->add_blockFunction($this->groupings);
00104
00105
00106 ### list groupings ###
00107
00108 $this->groupings->groupings= array(
00109 new ListGroupingStatus(),
00110 new ListGroupingPrio(),
00111 );
00112
00113 $this->query_options['is_milestone']= true;
00114 $this->query_options['is_released_min']= RELEASED_UPCOMMING;
00115 $this->query_options['status_min']= 0;
00116 $this->query_options['status_max']= 200;
00117 $this->query_options['order_by']= 'created DESC';
00118 }
00119
00120
00130 public function print_automatic()
00131 {
00132 require_once(confGet('DIR_STREBER') . 'render/render_wiki.inc.php');
00133
00134 global $PH;
00135
00136 if(!$this->active_block_function=$this->getBlockStyleFromCookie()) {
00137 $this->active_block_function = 'list';
00138 }
00139
00140
00141 $this->initOrderQueryOption();
00142
00143 ### grouped view ###
00144 if($this->active_block_function == 'grouped') {
00145 $this->group_by= get("blockstyle_{$PH->cur_page->id}_{$this->id}_grouping");
00146
00152 if(isset($this->columns[ $this->group_by ])) {
00153 unset($this->columns[$this->group_by]);
00154 }
00155
00156 ### prepend key to sorting ###
00157 if(isset($this->query_options['order_by'])) {
00158 $this->query_options['order_by'] = $this->groupings->getActiveFromCookie() . ",".$this->query_options['order_by'];
00159
00160 }
00161 else {
00162 $this->query_options['order_by'] = $this->groupings->getActiveFromCookie();
00163 }
00164 }
00165
00166 $versions= Task::getAll($this->query_options);
00167
00168 $this->render_list(&$versions);
00169 }
00170 }
00171
00172
00173
00174 class ListBlockCol_VersionName extends ListBlockCol
00175 {
00176 public $key='name';
00177
00178 public function __construct($args=NULL) {
00179 parent::__construct($args);
00180 $this->width='90%';
00181 $this->name=__('Released Milestone');
00182 $this->id='name';
00183 }
00184
00185 function render_tr(&$task, $style="")
00186 {
00187
00188 global $PH;
00189 global $g_resolve_reason_names;
00190 if(!isset($task) || !is_object($task)) {
00191 trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING);
00192 return;
00193 }
00194 $buffer='';
00195
00196 ### collapsed view ###
00197 $html_link= '<b>'. $task->getLink(false) .'</b>';
00198 if($task->view_collapsed) {
00199 $buffer.= $PH->getLink('taskToggleViewCollapsed',"<img src=\"". getThemeFile("img/toggle_folder_closed.gif") ."\">",array('tsk'=>$task->id),NULL, true)
00200 . $html_link;
00201 }
00202 ### detailed view with change log ###
00203 else {
00204 $buffer.= $PH->getLink('taskToggleViewCollapsed',"<img src=\"".getThemeFile("img/toggle_folder_open.gif") ."\">",array('tsk'=>$task->id),NULL, true)
00205 . $html_link
00206 . '<br>';
00207
00208 $editable= false;
00209 if(Task::getEditableById($task->id)) {
00210 $editable= true;
00211 }
00212
00213
00214 $buffer.= "<div class=description>";
00215 if($editable) {
00216 $buffer.= wiki2html($task->description, $task->project, $task->id, 'description');
00217 }
00218 else {
00219 $buffer.= wiki2html($task->description, $task->project);
00220 }
00221 $buffer.= "</div>";
00222
00223
00224
00225
00226 }
00227 echo '<td>'. $buffer .'</td>';
00228 }
00229 }
00230
00231
00232 class ListBlockCol_TimeReleased extends ListBlockCol
00233 {
00234 public $key='time_released';
00235
00236 public function __construct($args=NULL) {
00237 parent::__construct($args);
00238 $this->width='15%';
00239 $this->name=__('Release Date');
00240 $this->id='time_released';
00241 }
00242
00243 function render_tr(&$task, $style="")
00244 {
00245
00246 global $PH;
00247 if(!isset($task) || !is_object($task)) {
00248 trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING);
00249 return;
00250 }
00251
00252
00253 $buffer = renderDateHtml($task->time_released);
00254
00255 #if($html_due && $task->status < STATUS_CLOSED) {
00256 # $buffer.= '<br><span class=sub>('. $html_due .')</span>';
00257 #}
00258
00259 #if($this->parent_block->sum_estimated_max) {
00260 # $buffer.= '<br><span class=sub>'
00261 # . sprintf(__('%s required'), renderEstimatedDuration(($this->parent_block->sum_estimated_max + $this->parent_block->sum_estimated_min) /2))
00262 # . '</span>';
00263 #}
00264
00265 echo '<td class=nowrap>'. $buffer .'</td>';
00266 }
00267 }
00268
00269
00270
00271 ?>