pages/custom_projView.inc.php

00001 <?php if(!function_exists('startedIndexPhp')) { header("location:../index.php"); exit();}
00002 # streber - a php5 based project management system  (c) 2005-2007  / www.streber-pm.org
00003 # Distributed under the terms and conditions of the GPL as stated in lang/license.html
00004 
00009 require_once(confGet('DIR_STREBER') . "db/class_task.inc.php");
00010 require_once(confGet('DIR_STREBER') . "db/class_project.inc.php");
00011 require_once(confGet('DIR_STREBER') . "db/class_projectperson.inc.php");
00012 require_once(confGet('DIR_STREBER') . "db/db_itemperson.inc.php");
00013 require_once(confGet('DIR_STREBER') . "render/render_list.inc.php");
00014 require_once(confGet('DIR_STREBER') . "lists/list_taskfolders.inc.php");
00015 require_once(confGet('DIR_STREBER') . "lists/list_comments.inc.php");
00016 require_once(confGet('DIR_STREBER') . "lists/list_tasks.inc.php");
00017 require_once(confGet('DIR_STREBER') . "lists/list_project_team.inc.php");
00018 
00019 
00020 
00021 
00022 #---------------------------------------------------------------------------
00023 # view Project
00024 #---------------------------------------------------------------------------
00025 function ProjView()
00026 {
00027     global $PH;
00028     global $auth;
00029     require_once(confGet('DIR_STREBER') . "render/render_wiki.inc.php");
00030 
00031 
00032     ### get current project ###
00033     $id=getOnePassedId('prj','projects_*');
00034     $project= Project::getVisibleById($id);
00035     if(!$project || !$project->id) {
00036         $PH->abortWarning(__("invalid project-id"));
00037         return;
00038     }
00039 
00040     ### define from-handle ###
00041     $PH->defineFromHandle(array('prj'=>$project->id));
00042 
00043     ## is viewed by user ##
00044     $project->nowViewedByUser();
00045 
00046     ## next milestone ##
00047     $next=$project->getNextMilestone();
00048 
00049     ### set up page ####
00050     {
00051         $page= new Page();
00052 
00053         $page->crumbs= build_project_crumbs($project);
00054         $page->options= build_projView_options($project);
00055 
00056         $page->cur_tab='projects';
00057         $page->title=$project->name;
00058         $page->title_minor=__("Overview");
00059 
00060         if($project->status == STATUS_TEMPLATE) {
00061             $page->type=__("Project Template");
00062         }
00063         else if ($project->status >= STATUS_COMPLETED){
00064             $page->type=__("Inactive Project");
00065         }
00066         else {
00067             $page->type=__("Project","Page Type");
00068         }
00069 
00070         ### page functions ###
00071         $page->add_function(new PageFunction(array(
00072             'target'    =>'projEdit',
00073             'params'    =>array('prj'=>$project->id),
00074             'icon'      =>'edit',
00075             'tooltip'   =>__('Edit this project'),
00076             'name'      => __('Edit Project')
00077 
00078         )));
00079 
00080         if($project->state == 1) {
00081                 $page->add_function(new PageFunction(array(
00082                     'target'=>'projDelete',
00083                     'params'=>array('prj'=>$project->id),
00084                     'icon'=>'delete',
00085                     'tooltip'=>__('Delete this project'),
00086                     'name'=>__('Delete')
00087                 )));
00088         }
00089 
00090 
00091         $page->add_function(new PageFunctionGroup(array(
00092             'name'      => __('new:')
00093         )));
00094         $page->add_function(new PageFunction(array(
00095             'target'    =>'projAddPerson',
00096             'params'    =>array('prj'=>$project->id),
00097             'icon'      =>'add',
00098             'tooltip'   =>__('Add person as team-member to project'),
00099             'name'      =>__('Team member')
00100         )));
00101         $page->add_function(new PageFunction(array(
00102             'target'    =>'taskNew',
00103             'params'    =>array('prj'=>$project->id),
00104             'icon'      =>'new',
00105             'tooltip'   =>__('Create task'),
00106             'name'      =>__('Task')
00107         )));
00108         $page->add_function(new PageFunction(array(
00109             'target'    =>'taskNewBug',
00110             'params'    =>array('prj'=>$project->id,'add_issue'=>1),
00111             'icon'      =>'new',
00112             'tooltip'   =>__('Create task with issue-report'),
00113             'name'      =>__('Bug'),
00114         )));
00115 
00116         $url= $PH->getUrl("projViewAsRSS", array('prj' => $project->id));
00117 
00118         $page->extra_header_html.=
00119                 '<link rel="alternate" type="application/rss+xml" title="' .asHtml($project->name) .' '. __("News")  . '"'
00120                 .' href="' . $url . '" />';
00121 
00122         ### render title ###
00123         echo(new PageHeader);
00124     }
00125     echo (new PageContentOpen_Columns);
00126 
00127     measure_stop('init2');
00128     measure_start('info');
00129 
00130 
00131     #--- description ----------------------------------------------------------------
00132     if($project->description!="") {
00133         $block=new PageBlock(array(
00134             'title'=>__('Description'),
00135             'id'=>'description',
00136             #'reduced_header'=>true,
00137 
00138         ));
00139         $block->render_blockStart();
00140 
00141         #echo $str;
00142 
00143 
00144         echo "<div class=text>";
00145 
00146         echo wiki2html($project->description, $project);
00147 
00148         ### update task if relative links have been converted to ids ###
00149         global $g_wiki_auto_adjusted;
00150         if(isset($g_wiki_auto_adjusted) && $g_wiki_auto_adjusted) {
00151             $project->description= $g_wiki_auto_adjusted;
00152             $project->update(array('description'),false);
00153         }
00154 
00155         echo "</div>";
00156 
00157         $block->render_blockEnd();
00158     }
00159 
00160     #--- supported by  ------------
00161     {
00162         $block=new PageBlock(array('title'=>"Supported by",'id'=>'support'));
00163         $block->render_blockStart();
00164         echo "<div class=text>";
00165         #echo "<ul><a href='phpBB2/index.php'>Forum</a>";
00166         #echo "<ul><a href=''>Forum</a>";
00167 
00168         echo '<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=145255&amp;type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a>';
00169 
00170         echo "</div>";
00171 
00172         $block->render_blockEnd();
00173 
00174         
00175     }
00176 
00177     echo(new PageContentNextCol);
00178     measure_stop('team');
00179 
00180 
00181 
00182     
00183     
00184     #--- news -----------------------------------------------------------
00185     {
00186         if($news= Task::getAll(array(
00187             'category'  => TCATEGORY_DOCU,
00188             'label'     => 1,
00189             'order_by'  => 'created DESC',
00190         ))) {
00191             
00192             $block=new PageBlock(array(
00193                 'title'=>__('News'),
00194                 'id'=>'news',
00195                 #'reduced_header'=>true,
00196     
00197             ));
00198             $block->render_blockStart();
00199     
00200             #echo $str;
00201     
00202             echo "<div class='text'>";
00203             
00204             $count = 0;
00205             foreach($news as $n) {
00206                 if($count++ > 3) {
00207                     break;
00208                 };
00209                 echo "<div class='newsBlock'>";
00210                 if($creator= Person::getVisibleById($n->created_by)) {
00211                     $link_creator= ' by '. $creator->getLink();
00212                 }
00213                 echo "<div class=newsTitle><h3>".$PH->getLink('taskViewAsDocu', $n->name , array('tsk' => $n->id)) ."</h3><span class=author>". renderDateHtml($n->created) . $link_creator . "</span></div>";
00214                 echo wiki2html($n->description, $project);
00215                 
00216                 echo "<span class=comments>";
00217                 if($comments= $n->getComments()) {
00218                      echo  $PH->getLink('taskViewAsDocu', sprintf(__("%s comments"),count($comments)), array('tsk'=> $n->id));
00219                 }
00220                 echo " | ";
00221                 echo $PH->getLink("commentNew", __("Add comment"), array('parent_task' => $n->id) );
00222                 echo "</span>";
00223                 
00224                 echo "</div>";                
00225             }   
00226             echo "</div>";
00227     
00228             $block->render_blockEnd();
00229         }
00230 
00231     }
00232     
00233 
00234 
00235     #--- list changes (new) -----------------------------------------------------------
00236     measure_start('changes');
00237     if(!Auth::isAnonymousUser()) {
00238         require_once(confGet('DIR_STREBER') . './lists/list_changes.inc.php');
00239 
00240         $list= new ListBlock_changes();
00241         $list->query_options['date_min']= $auth->cur_user->last_logout;
00242         $list->query_options['not_modified_by']= $auth->cur_user->id;
00243         $list->print_automatic($project);
00244     }
00245     measure_stop('changes');
00246 
00247 
00248     echo "<br><br>";                                        # @@@ hack for firefox overflow problems
00249 
00250     ### HACKING: 'add new task'-field ###
00251     $PH->go_submit='taskNew';
00252     #echo '<input type="hidden" name="prj" value="'.$project->id.'">';
00253     echo (new PageContentClose);
00254     echo (new PageHtmlEnd());
00255 }
00256 
00257 
00258 
00259 
00260 
00261 ?>

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