2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								< ? php 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ***** BEGIN LICENSE BLOCK *****
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# This file is part of InDefero, an open source project management application.
 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-02 21:37:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# Copyright (C) 2008-2011 Céondo Ltd and contributors.
 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								#
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# InDefero is free software; you can redistribute it and/or modify
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# it under the terms of the GNU General Public License as published by
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# the Free Software Foundation; either version 2 of the License, or
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# (at your option) any later version.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# InDefero is distributed in the hope that it will be useful,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# GNU General Public License for more details.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# You should have received a copy of the GNU General Public License
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# along with this program; if not, write to the Free Software
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ***** END LICENSE BLOCK ***** */
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Pluf :: loadFunction ( 'Pluf_HTTP_URL_urlForView' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Pluf :: loadFunction ( 'Pluf_Shortcuts_RenderToResponse' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Pluf :: loadFunction ( 'Pluf_Shortcuts_GetObjectOr404' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Pluf :: loadFunction ( 'Pluf_Shortcuts_GetFormForModel' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  Issues '  views . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								class  IDF_Views_Issue 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  View  list  of  issues  for  a  given  project . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     */ 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-07 15:35:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    public  $index_precond  =  array ( 'IDF_Precondition::accessIssues' ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-21 20:33:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    public  function  index ( $request ,  $match ,  $api = false ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $prj  =  $request -> project ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-08 20:34:40 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $title  =  sprintf ( __ ( '%s Open Issues' ),  ( string )  $prj ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        // Get stats about the issues
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $open  =  $prj -> getIssueCountByStatus ( 'open' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $closed  =  $prj -> getIssueCountByStatus ( 'closed' ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $overdue  =  $prj -> getIssueCountByDueDate ( 'overdue' ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        // Paginator to paginate the issues
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag  =  new  Pluf_Paginator ( new  IDF_Issue ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> class  =  'recent-issues' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> item_extra_props  =  array ( 'project_m'  =>  $prj , 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-12 12:46:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                       'shortname'  =>  $prj -> shortname , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                       'current_user'  =>  $request -> user ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-08 20:34:40 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> summary  =  __ ( 'This table shows the open issues.' ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $otags  =  $prj -> getTagIdsByStatus ( 'open' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( count ( $otags )  ==  0 )  $otags []  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> forced_where  =  new  Pluf_SQL ( 'project=%s AND status IN (' . implode ( ', ' ,  $otags ) . ')' ,  array ( $prj -> id )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> action  =  array ( 'IDF_Views_Issue::index' ,  array ( $prj -> shortname )); 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-14 09:33:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> sort_order  =  array ( 'modif_dtime' ,  'ASC' );  // will be reverted
 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-11 21:10:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> sort_reverse_order  =  array ( 'modif_dtime' ); 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-08 14:23:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> sort_link_title  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-02 14:06:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> extra_classes  =  array ( 'a-c' ,  '' ,  'a-c' ,  '' ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $list_display  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             'id'  =>  __ ( 'Id' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'summary' ,  'IDF_Views_Issue_SummaryAndLabels' ,  __ ( 'Summary' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'status' ,  'IDF_Views_Issue_ShowStatus' ,  __ ( 'Status' )), 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-11 01:15:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             array ( 'due_dtime' ,  'IDF_Views_Issue_DueDate' ,  __ ( 'Due Date' )), 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'modif_dtime' ,  'Pluf_Paginator_DateAgo' ,  __ ( 'Last Updated' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                              ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-11 01:15:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> configure ( $list_display ,  array (),  array ( 'id' ,  'status' ,  'due_dtime' ,  'modif_dtime' )); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> items_per_page  =  10 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> no_results_text  =  __ ( 'No issues were found.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> setFromRequest ( $request ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-21 20:33:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $params  =  array ( 'project'  =>  $prj , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        'page_title'  =>  $title , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        'open'  =>  $open , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        'closed'  =>  $closed , 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                        'overdue'  =>  $overdue , 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-02 00:05:08 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                        'issues'  =>  $pag , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        'cloud'  =>  'issues' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-21 20:33:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( $api )  return  $params ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-18 09:15:02 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  Pluf_Shortcuts_RenderToResponse ( 'idf/issues/index.html' , 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-21 20:33:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                               $params ,  $request ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 09:11:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  View  the  issue  summary . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  TODO  Add  thoses  data  in  cache ,  and  process  it  only  after  an  issue  update 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  $summary_precond  =  array ( 'IDF_Precondition::accessIssues' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  function  summary ( $request ,  $match ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 11:18:41 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $tagStatistics  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $ownerStatistics  =  array (); 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-13 10:55:49 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $duedateStatistics  =  array (); 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 11:18:41 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $status  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $isTrackerEmpty  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-02 00:05:08 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 09:11:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $prj  =  $request -> project ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $opened  =  $prj -> getIssueCountByStatus ( 'open' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $closed  =  $prj -> getIssueCountByStatus ( 'closed' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 11:18:41 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        // Check if the tracker is empty
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( $opened  ===  0  &&  $closed  ===  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $isTrackerEmpty  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  ( $opened  >  0  ||  $closed  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                // Issue status statistics
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $status [ 'Open' ]  =  array ( $opened ,  ( int )( 100  *  $opened  /  ( $opened  +  $closed ))); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $status [ 'Closed' ]  =  array ( $closed ,  ( int )( 100  *  $closed  /  ( $opened  +  $closed ))); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-02 00:05:08 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 11:18:41 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if  ( $opened  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                // Issue owner statistics
 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 17:30:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                $owners  =  $prj -> getIssueCountByOwner ( 'open' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                foreach  ( $owners  as  $user  =>  $nb )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    if  ( $user  ===  '' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        $key  =  __ ( 'Not assigned' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-04 10:05:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                        $login  =  null ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 17:30:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        $obj  =  Pluf :: factory ( 'Pluf_User' ) -> getOne ( array ( 'filter' => 'id=' . $user )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        $key  =  $obj -> first_name  .  ' '  .  $obj -> last_name ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-04 10:05:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                        $login  =  $obj -> login ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 17:30:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-04 10:05:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    $ownerStatistics [ $key ]  =  array ( $nb ,  ( int )( 100  *  $nb  /  $opened ),  $login ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 11:18:41 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                } 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-02 09:44:00 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                arsort ( $ownerStatistics ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 09:11:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-23 00:29:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                // Issue due date statistics
 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                $overdue  =  $prj -> getIssueCountByDueDate ( 'overdue' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $undue  =  $prj -> getIssueCountByDueDate ( 'undue' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $combined_opened  =  $overdue  +  $undue ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-23 17:03:17 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                $duedateStatistics  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                if ( $combined_opened  >  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    $duedateStatistics [ 'Overdue' ]  =  array ( $overdue ,  ( int )( 100  *  $overdue  /  $combined_opened ),  'Overdue' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    $duedateStatistics [ 'Undue' ]  =  array ( $undue ,  ( int )( 100  *  $undue  /  $combined_opened ),  'Undue' ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-23 17:03:17 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                } 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-23 00:29:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 11:18:41 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                // Issue class tag statistics
 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-04 00:46:48 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                $grouped_tags  =  $prj -> getTagCloud (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                foreach  ( $grouped_tags  as  $class  =>  $tags )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    foreach  ( $tags  as  $tag )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        $tagStatistics [ $class ][ $tag -> name ]  =  array ( $tag -> nb_use ,  $tag -> id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-02 09:44:00 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    uasort ( $tagStatistics [ $class ],  function  ( $a ,  $b )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        if  ( $a [ 0 ]  ===  $b [ 0 ]) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                            return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-02 09:44:00 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                        return  ( $a [ 0 ]  >  $b [ 0 ])  ?  - 1  :  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    }); 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 11:18:41 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                foreach ( $tagStatistics  as  $k  =>  $v )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    $nbIssueInClass  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    foreach  ( $v  as  $val )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        $nbIssueInClass  +=  $val [ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    foreach  ( $v  as  $kk  =>  $vv )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        $tagStatistics [ $k ][ $kk ]  =  array ( $vv [ 0 ],  ( int )( 100  *  $vv [ 0 ]  /  $nbIssueInClass ),  $vv [ 1 ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                } 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 09:11:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-02 00:05:08 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 09:11:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $title  =  sprintf ( __ ( 'Summary of tracked issues in %s.' ),  ( string )  $prj ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-02 00:05:08 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 09:11:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  Pluf_Shortcuts_RenderToResponse ( 'idf/issues/summary.html' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               array ( 'page_title'  =>  $title , 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 11:18:41 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'trackerEmpty'  =>  $isTrackerEmpty , 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 09:11:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'project'  =>  $prj , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'tagStatistics'  =>  $tagStatistics , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'ownerStatistics'  =>  $ownerStatistics , 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-23 00:29:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														   							 'duedateStatistics'  =>  $duedateStatistics , 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-15 09:11:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'status'  =>  $status , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               $request ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-02 00:05:08 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  View  the  issues  watch  list  of  a  given  user . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  Limited  to  a  specified  project 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  $watchList_precond  =  array ( 'IDF_Precondition::accessIssues' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                      'Pluf_Precondition::loginRequired' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  function  watchList ( $request ,  $match ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $prj  =  $request -> project ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $otags  =  $prj -> getTagIdsByStatus ( 'open' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $ctags  =  $prj -> getTagIdsByStatus ( 'closed' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( count ( $otags )  ==  0 )  $otags []  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( count ( $ctags )  ==  0 )  $ctags []  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 21:34:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								         // Get the id list of issue in the user watch list (for all projects !)
 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $db  =&  Pluf :: db (); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 21:34:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $sql_results  =  $db -> select ( 'SELECT idf_issue_id as id FROM ' . Pluf :: f ( 'db_table_prefix' ,  '' ) . 'idf_issue_pluf_user_assoc WHERE pluf_user_id=' . $request -> user -> id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $issue_ids  =  array ( 0 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        foreach  ( $sql_results  as  $id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								           $issue_ids []  =  $id [ 'id' ]; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 21:34:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $issue_ids  =  implode  ( ',' ,  $issue_ids ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        // Count open and close issues
 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 21:34:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $sql  =  new  Pluf_SQL ( 'project=%s AND id IN (' . $issue_ids . ') AND status IN (' . implode ( ', ' ,  $otags ) . ')' ,  array ( $prj -> id )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $nb_open  =  Pluf :: factory ( 'IDF_Issue' ) -> getCount ( array ( 'filter' => $sql -> gen ())); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 21:34:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $sql  =  new  Pluf_SQL ( 'project=%s AND id IN (' . $issue_ids . ') AND status IN (' . implode ( ', ' ,  $ctags ) . ')' ,  array ( $prj -> id )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $nb_closed  =  Pluf :: factory ( 'IDF_Issue' ) -> getCount ( array ( 'filter' => $sql -> gen ())); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $sql  =  new  Pluf_SQL ( 'project=%s AND id IN (' . $issue_ids . ') AND status IN (' . implode ( ', ' ,  $otags ) . ') AND due_dtime < NOW()' ,  array ( $prj -> id )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $nb_overdue  =  Pluf :: factory ( 'IDF_Issue' ) -> getCount ( array ( 'filter' => $sql -> gen ())); 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        // Generate a filter for the paginator
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        switch  ( $match [ 2 ])  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        case  'overdue' : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $title  =  sprintf ( __ ( 'Watch List: Overdue Issues for %s' ),  ( string )  $prj ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $summary  =  __ ( 'This table shows the overdue issues in your watch list for %s project.' ,  ( string )  $prj ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $f_sql  =  new  Pluf_SQL ( 'project=%s AND id IN (' . $issue_ids . ') AND status IN (' . implode ( ', ' ,  $otags ) . ') AND due_dtime < NOW()' ,  array ( $prj -> id )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        case  'closed' : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $title  =  sprintf ( __ ( 'Watch List: Closed Issues for %s' ),  ( string )  $prj ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $summary  =  __ ( 'This table shows the closed issues in your watch list for %s project.' ,  ( string )  $prj ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $f_sql  =  new  Pluf_SQL ( 'project=%s AND id IN (' . $issue_ids . ') AND status IN (' . implode ( ', ' ,  $ctags ) . ')' ,  array ( $prj -> id )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        case  'open' : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $title  =  sprintf ( __ ( 'Watch List: Open Issues for %s' ),  ( string )  $prj ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $summary  =  __ ( 'This table shows the open issues in your watch list for %s project.' ,  ( string )  $prj ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 21:34:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $f_sql  =  new  Pluf_SQL ( 'project=%s AND id IN (' . $issue_ids . ') AND status IN (' . implode ( ', ' ,  $otags ) . ')' ,  array ( $prj -> id )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        // Paginator to paginate the issues
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag  =  new  Pluf_Paginator ( new  IDF_Issue ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> class  =  'recent-issues' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> item_extra_props  =  array ( 'project_m'  =>  $prj , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                       'shortname'  =>  $prj -> shortname , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                       'current_user'  =>  $request -> user ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> summary  =  $summary ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> forced_where  =  $f_sql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> action  =  array ( 'IDF_Views_Issue::watchList' ,  array ( $prj -> shortname ,  $match [ 1 ])); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> sort_order  =  array ( 'modif_dtime' ,  'ASC' );  // will be reverted
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> sort_reverse_order  =  array ( 'modif_dtime' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> sort_link_title  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> extra_classes  =  array ( 'a-c' ,  '' ,  'a-c' ,  '' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $list_display  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             'id'  =>  __ ( 'Id' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'summary' ,  'IDF_Views_Issue_SummaryAndLabels' ,  __ ( 'Summary' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'status' ,  'IDF_Views_Issue_ShowStatus' ,  __ ( 'Status' )), 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-11 01:15:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             array ( 'due_dtime' ,  'IDF_Views_Issue_DueDate' ,  __ ( 'Due Date' )), 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             array ( 'modif_dtime' ,  'Pluf_Paginator_DateAgo' ,  __ ( 'Last Updated' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                              ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-11 01:15:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> configure ( $list_display ,  array (),  array ( 'id' ,  'status' ,  'due_dtime' ,  'modif_dtime' )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> items_per_page  =  10 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> no_results_text  =  __ ( 'No issues were found.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> setFromRequest ( $request ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  Pluf_Shortcuts_RenderToResponse ( 'idf/issues/project-watchlist.html' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               array ( 'project'  =>  $prj , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'page_title'  =>  $title , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'open'  =>  $nb_open , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'closed'  =>  $nb_closed , 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'overdue'  =>  $nb_overdue , 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'issues'  =>  $pag , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               $request ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  View  the  issues  watch  list  of  a  given  user . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  For  all  projects 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  $forgeWatchList_precond  =  array ( 'Pluf_Precondition::loginRequired' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  function  forgeWatchList ( $request ,  $match ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $otags  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $ctags  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // Note that this approach does not scale, we will need to add
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // a table to cache the meaning of the tags for large forges.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        foreach  ( IDF_Views :: getProjects ( $request -> user )  as  $project )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $otags  =  array_merge ( $otags ,  $project -> getTagIdsByStatus ( 'open' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        foreach  ( IDF_Views :: getProjects ( $request -> user )  as  $project )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $ctags  =  array_merge ( $ctags ,  $project -> getTagIdsByStatus ( 'closed' )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( count ( $otags )  ==  0 )  $otags []  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( count ( $ctags )  ==  0 )  $ctags []  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								         // Get the id list of issue in the user watch list (for all projects !)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $db  =&  Pluf :: db (); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-06 10:26:29 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $sql_results  =  $db -> select ( 'SELECT idf_issue_id as id FROM ' . Pluf :: f ( 'db_table_prefix' ,  '' ) . 'idf_issue_pluf_user_assoc WHERE pluf_user_id=' . $request -> user -> id ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 21:34:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $issue_ids  =  array ( 0 ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-06 10:26:29 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        foreach  ( $sql_results  as  $id )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 21:34:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								           $issue_ids []  =  $id [ 'id' ]; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 21:34:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $issue_ids  =  implode  ( ',' ,  $issue_ids ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // Count open and close issues
 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 21:34:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $sql  =  new  Pluf_SQL ( 'id IN (' . $issue_ids . ') AND status IN (' . implode ( ', ' ,  $otags ) . ')' ,  array ()); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $nb_open  =  Pluf :: factory ( 'IDF_Issue' ) -> getCount ( array ( 'filter' => $sql -> gen ())); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 21:34:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $sql  =  new  Pluf_SQL ( 'id IN (' . $issue_ids . ') AND status IN (' . implode ( ', ' ,  $ctags ) . ')' ,  array ()); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $nb_closed  =  Pluf :: factory ( 'IDF_Issue' ) -> getCount ( array ( 'filter' => $sql -> gen ())); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $sql  =  new  Pluf_SQL ( 'id IN (' . $issue_ids . ') AND status IN (' . implode ( ', ' ,  $otags ) . ') AND due_dtime < NOW()' ,  array ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $nb_overdue  =  Pluf :: factory ( 'IDF_Issue' ) -> getCount ( array ( 'filter' => $sql -> gen ())); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // Generate a filter for the paginator
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        switch  ( $match [ 1 ])  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        case  'overdue' : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $title  =  sprintf ( __ ( 'Watch List: Overdue Issues' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $summary  =  __ ( 'This table shows the overdue issues in your watch list.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $f_sql  =  new  Pluf_SQL ( 'id IN (' . $issue_ids . ') AND status IN (' . implode ( ', ' ,  $otags ) . ') AND due_dtime < NOW()' ,  array ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        case  'closed' : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $title  =  sprintf ( __ ( 'Watch List: Closed Issues' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $summary  =  __ ( 'This table shows the closed issues in your watch list.' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $f_sql  =  new  Pluf_SQL ( 'id IN (' . $issue_ids . ') AND status IN (' . implode ( ', ' ,  $ctags ) . ')' ,  array ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        case  'open' : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $title  =  sprintf ( __ ( 'Watch List: Open Issues' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $summary  =  __ ( 'This table shows the open issues in your watch list.' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 21:34:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $f_sql  =  new  Pluf_SQL ( 'id IN (' . $issue_ids . ') AND status IN (' . implode ( ', ' ,  $otags ) . ')' ,  array ()); 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        // Paginator to paginate the issues
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag  =  new  Pluf_Paginator ( new  IDF_Issue ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> class  =  'recent-issues' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> item_extra_props  =  array ( 'current_user'  =>  $request -> user ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> summary  =  $summary ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> forced_where  =  $f_sql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> action  =  array ( 'IDF_Views_Issue::forgeWatchList' ,  array ( $match [ 1 ])); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> sort_order  =  array ( 'modif_dtime' ,  'ASC' );  // will be reverted
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> sort_reverse_order  =  array ( 'modif_dtime' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> sort_link_title  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:51:34 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> extra_classes  =  array ( 'a-c' ,  '' ,  'a-c' ,  'a-c' ,  'a-c' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $list_display  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             'id'  =>  __ ( 'Id' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'summary' ,  'IDF_Views_Issue_SummaryAndLabelsUnknownProject' ,  __ ( 'Summary' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'project' ,  'Pluf_Paginator_FkToString' ,  __ ( 'Project' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'status' ,  'IDF_Views_Issue_ShowStatus' ,  __ ( 'Status' )), 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-11 01:15:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             array ( 'due_dtime' ,  'IDF_Views_Issue_DueDate' ,  __ ( 'Due Date' )), 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             array ( 'modif_dtime' ,  'Pluf_Paginator_DateAgo' ,  __ ( 'Last Updated' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                              ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-11 01:15:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> configure ( $list_display ,  array (),  array ( 'id' ,  'project' ,  'status' ,  'due_dtime' ,  'modif_dtime' )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> items_per_page  =  10 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> no_results_text  =  __ ( 'No issues were found.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> setFromRequest ( $request ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  Pluf_Shortcuts_RenderToResponse ( 'idf/issues/forge-watchlist.html' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               array ( 'page_title'  =>  $title , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'open'  =>  $nb_open , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'closed'  =>  $nb_closed , 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'overdue'  =>  $nb_overdue , 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'issues'  =>  $pag , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               $request ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    /** 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-02 01:50:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								     *  View  the  issues  of  a  given  user . 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								     * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  Only  open  issues  are  shown . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-04 10:05:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    public  $userIssues_precond  =  array ( 'IDF_Precondition::accessIssues' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  function  userIssues ( $request ,  $match ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $prj  =  $request -> project ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 10:00:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $sql  =  new  Pluf_SQL ( 'login=%s' ,  array ( $match [ 2 ])); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $user  =  Pluf :: factory ( 'Pluf_User' ) -> getOne ( array ( 'filter'  =>  $sql -> gen ())); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( $user  ===  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $url  =  Pluf_HTTP_URL_urlForView ( 'IDF_Views_Issue::index' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                            array ( $prj -> shortname )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            return  new  Pluf_HTTP_Response_Redirect ( $url ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $otags  =  $prj -> getTagIdsByStatus ( 'open' ); 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 15:08:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $ctags  =  $prj -> getTagIdsByStatus ( 'closed' ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        if  ( count ( $otags )  ==  0 )  $otags []  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 15:08:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( count ( $ctags )  ==  0 )  $ctags []  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 10:00:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        switch  ( $match [ 3 ])  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 15:08:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        case  'submit' : 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-02 01:13:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $titleFormat  =  __ ( '%1$s %2$s Submitted %3$s Issues' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 10:00:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $f_sql  =  new  Pluf_SQL ( 'project=%s AND submitter=%s AND status IN (' . implode ( ', ' ,  $otags ) . ')' ,  array ( $prj -> id ,  $user -> id )); 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 15:08:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        case  'submitclosed' : 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-02 01:13:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $titleFormat  =  __ ( '%1$s %2$s Closed Submitted %3$s Issues' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 10:00:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $f_sql  =  new  Pluf_SQL ( 'project=%s AND submitter=%s AND status IN (' . implode ( ', ' ,  $ctags ) . ')' ,  array ( $prj -> id ,  $user -> id )); 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 15:08:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        case  'ownerclosed' : 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-02 01:13:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $titleFormat  =  __ ( '%1$s %2$s Closed Working %3$s Issues' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 10:00:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $f_sql  =  new  Pluf_SQL ( 'project=%s AND owner=%s AND status IN (' . implode ( ', ' ,  $ctags ) . ')' ,  array ( $prj -> id ,  $user -> id )); 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 15:08:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        default : 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-02 01:13:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $titleFormat  =  __ ( '%1$s %2$s Working %3$s Issues' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 10:00:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $f_sql  =  new  Pluf_SQL ( 'project=%s AND owner=%s AND status IN (' . implode ( ', ' ,  $otags ) . ')' ,  array ( $prj -> id ,  $user -> id )); 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 15:08:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            break ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 10:17:10 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $title  =  sprintf ( $titleFormat , 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 10:00:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                         $user -> first_name , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                         $user -> last_name , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                         ( string )  $prj ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        // Get stats about the issues
 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 10:00:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $sql  =  new  Pluf_SQL ( 'project=%s AND submitter=%s AND status IN (' . implode ( ', ' ,  $otags ) . ')' ,  array ( $prj -> id ,  $user -> id )); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $nb_submit  =  Pluf :: factory ( 'IDF_Issue' ) -> getCount ( array ( 'filter' => $sql -> gen ())); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 10:00:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $sql  =  new  Pluf_SQL ( 'project=%s AND owner=%s AND status IN (' . implode ( ', ' ,  $otags ) . ')' ,  array ( $prj -> id ,  $user -> id )); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $nb_owner  =  Pluf :: factory ( 'IDF_Issue' ) -> getCount ( array ( 'filter' => $sql -> gen ())); 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 15:08:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        // Closed issues
 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 10:00:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $sql  =  new  Pluf_SQL ( 'project=%s AND submitter=%s AND status IN (' . implode ( ', ' ,  $ctags ) . ')' ,  array ( $prj -> id ,  $user -> id )); 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 15:08:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $nb_submit_closed  =  Pluf :: factory ( 'IDF_Issue' ) -> getCount ( array ( 'filter' => $sql -> gen ())); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 10:00:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $sql  =  new  Pluf_SQL ( 'project=%s AND owner=%s AND status IN (' . implode ( ', ' ,  $ctags ) . ')' ,  array ( $prj -> id ,  $user -> id )); 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 15:08:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $nb_owner_closed  =  Pluf :: factory ( 'IDF_Issue' ) -> getCount ( array ( 'filter' => $sql -> gen ())); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        // Paginator to paginate the issues
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag  =  new  Pluf_Paginator ( new  IDF_Issue ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> class  =  'recent-issues' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> item_extra_props  =  array ( 'project_m'  =>  $prj , 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-12 12:46:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                       'shortname'  =>  $prj -> shortname , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                       'current_user'  =>  $request -> user ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-08 20:34:40 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> summary  =  __ ( 'This table shows the open issues.' ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> forced_where  =  $f_sql ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-04 10:05:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> action  =  array ( 'IDF_Views_Issue::userIssues' ,  array ( $prj -> shortname ,  $match [ 2 ])); 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-14 09:33:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> sort_order  =  array ( 'modif_dtime' ,  'ASC' );  // will be reverted
 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-11 21:10:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> sort_reverse_order  =  array ( 'modif_dtime' ); 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-08 14:23:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> sort_link_title  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-02 14:06:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> extra_classes  =  array ( 'a-c' ,  '' ,  'a-c' ,  '' ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $list_display  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             'id'  =>  __ ( 'Id' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'summary' ,  'IDF_Views_Issue_SummaryAndLabels' ,  __ ( 'Summary' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'status' ,  'IDF_Views_Issue_ShowStatus' ,  __ ( 'Status' )), 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-11 01:15:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             array ( 'due_dtime' ,  'IDF_Views_Issue_DueDate' ,  __ ( 'Due Date' )), 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'modif_dtime' ,  'Pluf_Paginator_DateAgo' ,  __ ( 'Last Updated' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                              ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-11 01:15:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> configure ( $list_display ,  array (),  array ( 'id' ,  'status' ,  'due_dtime' ,  'modif_dtime' )); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> items_per_page  =  10 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> no_results_text  =  __ ( 'No issues were found.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> setFromRequest ( $request ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-04 10:05:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  Pluf_Shortcuts_RenderToResponse ( 'idf/issues/userIssues.html' , 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                                               array ( 'project'  =>  $prj , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'page_title'  =>  $title , 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 10:00:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'login'  =>  $user -> login , 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                                                     'nb_submit'  =>  $nb_submit , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'nb_owner'  =>  $nb_owner , 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 15:08:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'nb_submit_closed'  =>  $nb_submit_closed , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'nb_owner_closed'  =>  $nb_owner_closed , 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                                                     'issues'  =>  $pag , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               $request ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-08-07 15:35:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    public  $create_precond  =  array ( 'IDF_Precondition::accessIssues' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                   'Pluf_Precondition::loginRequired' ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-21 20:33:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    public  function  create ( $request ,  $match ,  $api = false ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $prj  =  $request -> project ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $title  =  __ ( 'Submit a new issue' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $params  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        'project'  =>  $prj , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                        'user'  =>  $request -> user ); 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 14:21:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $preview  =  ( isset ( $request -> POST [ 'preview' ]))  ? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $request -> POST [ 'content' ]  :  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        if  ( $request -> method  ==  'POST' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-12 20:40:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $form  =  new  IDF_Form_IssueCreate ( array_merge ( $request -> POST , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                         $request -> FILES ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                             $params ); 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 14:21:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if  ( ! isset ( $request -> POST [ 'preview' ])  and  $form -> isValid ())  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                $issue  =  $form -> save (); 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-26 12:04:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                $url  =  Pluf_HTTP_URL_urlForView ( 'IDF_Views_Issue::view' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                array ( $prj -> shortname ,  $issue -> id )); 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-08 11:23:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                $issue -> notify ( $request -> conf ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-21 20:33:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                if  ( $api )  return  $issue ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-02 01:13:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                $request -> user -> setMessage ( sprintf ( __ ( '<a href="%1$s">Issue %2$d</a> has been created.' ),  $url ,  $issue -> id )); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                return  new  Pluf_HTTP_Response_Redirect ( $url ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $form  =  new  IDF_Form_IssueCreate ( null ,  $params ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-21 20:33:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $params  =  array_merge ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                              array ( 'project'  =>  $prj , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                    'form'  =>  $form , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                    'page_title'  =>  $title , 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 14:21:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                    'preview'  =>  $preview , 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-10 16:21:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                    'issue'  =>  new  IDF_Issue (), 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-10 12:17:22 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                    'date_today'  =>  date ( 'Y-m-d' ), 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-10 21:46:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                    'date_tomorrow'  =>  date ( 'Y-m-d' ,  strtotime ( 'tomorrow' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                    'date_eow'  =>  date ( 'Y-m-d' ,  strtotime ( 'next friday' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                    'date_eom'  =>  date ( 'Y-m-d' ,  strtotime ( 'last day of this month' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                    'date_2_hours'  =>  date ( 'Y-m-d H:i' ,  strtotime ( '+2 hours' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                    'date_2_days'  =>  date ( 'Y-m-d' ,  strtotime ( '+2 days' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                    'date_1_week'  =>  date ( 'Y-m-d' ,  strtotime ( '+1 week' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                    'date_two_weeks'  =>  date ( 'Y-m-d' ,  strtotime ( '+2 week' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                    'date_one_month'  =>  date ( 'Y-m-d' ,  strtotime ( '+1 month' )), 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-10 12:17:22 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                    'default_time'  =>  Pluf :: f ( 'issue_default_due_date_time' ), 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-21 20:33:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                    ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                              self :: autoCompleteArrays ( $prj ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                              ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( $api  ==  true )  return  $params ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-18 09:15:02 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  Pluf_Shortcuts_RenderToResponse ( 'idf/issues/create.html' , 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-21 20:33:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                               $params ,  $request ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-08-13 18:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    public  $search_precond  =  array ( 'IDF_Precondition::accessIssues' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  function  search ( $request ,  $match ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 01:54:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $query  =  ! isset ( $request -> REQUEST [ 'q' ])  ?  ''  :  $request -> REQUEST [ 'q' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  $this -> doSearch ( $request ,  $query ,  'open' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  $searchStatus_precond  =  array ( 'IDF_Precondition::accessIssues' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  function  searchStatus ( $request ,  $match ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $query   =  ! isset ( $request -> REQUEST [ 'q' ])  ?  ''  :  $request -> REQUEST [ 'q' ]; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $status  =  in_array ( $match [ 2 ],  array ( 'open' ,  'closed' ,  'overdue' ))  ?  $match [ 2 ]  :  'open' ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 01:54:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  $this -> doSearch ( $request ,  $query ,  $status ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  $searchLabel_precond  =  array ( 'IDF_Precondition::accessIssues' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  function  searchLabel ( $request ,  $match ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $query   =  ! isset ( $request -> REQUEST [ 'q' ])  ?  ''  :  $request -> REQUEST [ 'q' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $tag_id  =  intval ( $match [ 2 ]); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $status  =  in_array ( $match [ 3 ],  array ( 'open' ,  'closed' ,  'overdue' ))  ?  $match [ 3 ]  :  'open' ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 01:54:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  $this -> doSearch ( $request ,  $query ,  $status ,  $tag_id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    private  function  doSearch ( $request ,  $query ,  $status ,  $tag_id = null ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-13 18:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-13 20:47:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $prj  =  $request -> project ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 01:54:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( trim ( $query )  ==  '' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $url  =   Pluf_HTTP_URL_urlForView ( 'IDF_Views_Issue::index' ,  array ( $prj -> shortname )); 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-13 18:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            return  new  Pluf_HTTP_Response_Redirect ( $url ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 01:54:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $tag  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( $tag_id  !==  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $tag  =  Pluf_Shortcuts_GetObjectOr404 ( 'IDF_Tag' ,  $tag_id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $title  =  sprintf ( __ ( 'Search issues - %s' ),  $query ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( $status  ===  'closed' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $title  =  sprintf ( __ ( 'Search closed issues - %s' ),  $query ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        }  elseif  ( $status  ===  'overdue' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $title  =  sprintf ( __ ( 'Search overdue issues - %s' ),  $query ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $status  =  'open' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $overdue_status  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 01:54:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // using Plufs ResultSet implementation here is inefficient, because
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // it makes a SELECT for each item and does not allow for further
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // filtering neither, so we just return the ids and filter by them
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // and other things in the next round
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $results  =  IDF_Search :: mySearch ( $query ,  $prj ,  'IDF_Issue' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-04 00:37:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $issue_ids  =  array ( 0 ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 01:54:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        foreach  ( $results  as  $result )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $issue_ids []  =  $result [ 'model_id' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $otags  =  $prj -> getTagIdsByStatus ( $status ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( count ( $otags )  ==  0 )  $otags []  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $sql  =  new  Pluf_SQL ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'id IN (' . implode ( ',' ,  $issue_ids ) . ') ' . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'AND status IN (' . implode ( ', ' ,  $otags ) . ') ' . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ( $tag_id  !==  null  ?  'AND idf_tag_id=' . $tag_id . ' '  :  '' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if ( isset ( $overdue_status ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $sql2  =  new  Pluf_SQL ( 'due_dtime < NOW()' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $sql -> SAnd ( $sql2 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 01:54:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $model  =  new  IDF_Issue (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $issues  =  $model -> getList ( array ( 'filter'  =>  $sql -> gen (),  'view'  =>  'join_tags' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // we unfortunately loose the original sort order,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // so we manually have to apply it here again
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $sorted_issues  =  new  ArrayObject (); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-04 00:37:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $filtered_issue_ids  =  array ( 0 ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 01:54:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        foreach  ( $issue_ids  as  $issue_id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            foreach  ( $issues  as  $issue )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                if  ( $issue -> id  !=  $issue_id ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                if  ( array_key_exists ( $issue_id ,  $sorted_issues )) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $sorted_issues [ $issue_id ]  =  $issue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $filtered_issue_ids []  =  $issue_id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-13 18:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 01:54:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-08-13 18:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag  =  new  Pluf_Paginator (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> class  =  'recent-issues' ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 01:54:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> items  =  $sorted_issues ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> item_extra_props  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'project_m'  =>  $prj , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'shortname'  =>  $prj -> shortname , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'current_user'  =>  $request -> user 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-13 18:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> summary  =  __ ( 'This table shows the found issues.' ); 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-02 14:06:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> extra_classes  =  array ( 'a-c' ,  '' ,  'a-c' ,  '' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 01:54:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> configure ( array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'id'  =>  __ ( 'Id' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            array ( 'summary' ,  'IDF_Views_Issue_SummaryAndLabels' ,  __ ( 'Summary' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            array ( 'status' ,  'IDF_Views_Issue_ShowStatus' ,  __ ( 'Status' )), 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-11 01:15:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            array ( 'due_dtime' ,  'IDF_Views_Issue_DueDate' ,  __ ( 'Due Date' )), 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 01:54:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            array ( 'modif_dtime' ,  'Pluf_Paginator_DateAgo' ,  __ ( 'Last Updated' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // disable paginating
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> items_per_page  =  PHP_INT_MAX ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-13 18:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> no_results_text  =  __ ( 'No issues were found.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> setFromRequest ( $request ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 01:54:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( $tag_id  ===  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $pag -> action  =  array ( 'IDF_Views_Issue::searchStatus' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                array ( $prj -> shortname ,  $status ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                array ( 'q' =>  $query ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $pag -> action  =  array ( 'IDF_Views_Issue::searchLabel' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                array ( $prj -> shortname ,  $tag_id ,  $status ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                array ( 'q' =>  $query ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // get stats about the issues
 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $overdue  =  $prj -> getIssueCountByDueDate ( 'overdue' ,  'open' ,  $tag ,  $issue_ids ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 01:54:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $open  =  $prj -> getIssueCountByStatus ( 'open' ,  $tag ,  $issue_ids ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $closed  =  $prj -> getIssueCountByStatus ( 'closed' ,  $tag ,  $issue_ids ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // query the available tags for this search result
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $all_tags  =  $prj -> getTagsByIssues ( $filtered_issue_ids ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $grouped_tags  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        foreach  ( $all_tags  as  $atag )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            // group by class
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  ( ! array_key_exists ( $atag -> class ,  $grouped_tags ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $grouped_tags [ $atag -> class ]  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $grouped_tags [ $atag -> class ][]  =  $atag ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $params  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'page_title'  =>  $title , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'issues'  =>  $pag , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'query'  =>  $query , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'status'  =>  $status , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'open'  =>  $open , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'closed'  =>  $closed , 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'overdue'  =>  $overdue , 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 01:54:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'tag'  =>  $tag , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'all_tags'  =>  $grouped_tags , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  Pluf_Shortcuts_RenderToResponse ( 'idf/issues/search.html' ,  $params ,  $request ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-13 18:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-08-07 15:35:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    public  $view_precond  =  array ( 'IDF_Precondition::accessIssues' ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    public  function  view ( $request ,  $match ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $prj  =  $request -> project ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $issue  =  Pluf_Shortcuts_GetObjectOr404 ( 'IDF_Issue' ,  $match [ 2 ]); 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-05 19:58:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $prj -> inOr404 ( $issue ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $comments  =  $issue -> get_comments_list ( array ( 'order'  =>  'id ASC' )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-30 14:02:10 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $related_issues  =  $issue -> getGroupedRelatedIssues ( array ( 'order'  =>  'other_issue ASC' )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-28 23:48:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $url  =  Pluf_HTTP_URL_urlForView ( 'IDF_Views_Issue::view' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                        array ( $prj -> shortname ,  $issue -> id )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-02 01:13:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $title  =  Pluf_Template :: markSafe ( sprintf ( __ ( 'Issue <a href="%1$s">%2$d</a>: %3$s' ),  $url ,  $issue -> id ,  $issue -> summary )); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $form  =  false ;  // The form is available only if logged in.
 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-12 12:46:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $starred  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-13 21:20:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $closed  =  in_array ( $issue -> status ,  $prj -> getTagIdsByStatus ( 'closed' )); 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-31 22:23:49 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $interested  =  $issue -> get_interested_list (); 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 14:21:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $preview  =  ( isset ( $request -> POST [ 'preview' ]))  ? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $request -> POST [ 'content' ]  :  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        if  ( ! $request -> user -> isAnonymous ())  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-12 12:46:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $starred  =  Pluf_Model_InArray ( $request -> user ,  $issue -> get_interested_list ()); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            $params  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                            'project'  =>  $prj , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                            'user'  =>  $request -> user , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                            'issue'  =>  $issue , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                            ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  ( $request -> method  ==  'POST' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-02 01:50:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                $form  =  new  IDF_Form_IssueUpdate ( array_merge ( $request -> POST , 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-12 20:40:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                             $request -> FILES ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                 $params ); 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 14:21:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                if  ( ! isset ( $request -> POST [ 'preview' ])  &&  $form -> isValid ())  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-08 11:23:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    $issue  =  $form -> save ();  // Note, should return the
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                            // last comment
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    $issue -> notify ( $request -> conf ,  false ); 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-26 12:04:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    $comments  =  $issue -> get_comments_list ( array ( 'order'  =>  'id DESC' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    $url  .=  '#ic'  .  $comments [ 0 ] -> id ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-02 01:13:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    $request -> user -> setMessage ( sprintf ( __ ( '<a href="%1$s">Issue %2$d</a> has been updated.' ),  $url ,  $issue -> id )); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                    return  new  Pluf_HTTP_Response_Redirect ( $url ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $form  =  new  IDF_Form_IssueUpdate ( null ,  $params ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-05 01:22:32 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-06 22:38:38 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        // Search previous and next issue id
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $octags  =  $prj -> getTagIdsByStatus (( $closed )  ?  'closed'  :  'open' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( count ( $octags )  ==  0 )  $octags []  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $sql_previous  =  new  Pluf_SQL ( 'project=%s AND status IN (' . implode ( ', ' ,  $octags ) . ') AND id<%s' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                     array ( $prj -> id ,  $match [ 2 ]) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                    ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $sql_next  =  new  Pluf_SQL ( 'project=%s AND status IN (' . implode ( ', ' ,  $octags ) . ') AND id>%s' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                     array ( $prj -> id ,  $match [ 2 ]) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $previous_issue  =  Pluf :: factory ( 'IDF_Issue' ) -> getList ( array ( 'filter'  =>  $sql_previous -> gen (), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                                    'order'  =>  'id DESC' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                                    'nb'  =>  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                                   )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $next_issue  =  Pluf :: factory ( 'IDF_Issue' ) -> getList ( array ( 'filter'  =>  $sql_next -> gen (), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                                'order'  =>  'id ASC' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                                'nb'  =>  1 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                               )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-06 22:38:38 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $previous_issue_id  =  ( isset ( $previous_issue [ 0 ]))  ?  $previous_issue [ 0 ] -> id  :  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $next_issue_id  =  ( isset ( $next_issue [ 0 ]))  ?  $next_issue [ 0 ] -> id  :  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $arrays  =  self :: autoCompleteArrays ( $prj ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-18 09:15:02 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  Pluf_Shortcuts_RenderToResponse ( 'idf/issues/view.html' , 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                                               array_merge ( 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-12 12:46:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                               array ( 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                                                     'issue'  =>  $issue , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'comments'  =>  $comments , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'form'  =>  $form , 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-12 12:46:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'starred'  =>  $starred , 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                                                     'page_title'  =>  $title , 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-13 21:20:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'closed'  =>  $closed , 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-27 14:21:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'preview'  =>  $preview , 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-05 01:22:32 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'interested'  =>  $interested -> count (), 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-06 22:38:38 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'previous_issue_id'  =>  $previous_issue_id , 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-28 23:48:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'next_issue_id'  =>  $next_issue_id , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'related_issues'  =>  $related_issues , 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-10 12:17:22 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'date_today'  =>  date ( 'Y-m-d' ), 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-10 21:46:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'date_tomorrow'  =>  date ( 'Y-m-d' ,  strtotime ( 'tomorrow' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'date_eow'  =>  date ( 'Y-m-d' ,  strtotime ( 'next friday' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'date_eom'  =>  date ( 'Y-m-d' ,  strtotime ( 'last day of this month' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'date_2_hours'  =>  date ( 'Y-m-d H:i' ,  strtotime ( '+2 hours' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'date_2_days'  =>  date ( 'Y-m-d' ,  strtotime ( '+2 days' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'date_1_week'  =>  date ( 'Y-m-d' ,  strtotime ( '+1 week' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'date_two_weeks'  =>  date ( 'Y-m-d' ,  strtotime ( '+2 week' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'date_one_month'  =>  date ( 'Y-m-d' ,  strtotime ( '+1 month' )), 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-10 12:17:22 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'default_time'  =>  Pluf :: f ( 'issue_default_due_date_time' ), 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                                                     ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               $arrays ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               $request ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-11-12 20:40:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  Download  a  given  attachment . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  $getAttachment_precond  =  array ( 'IDF_Precondition::accessIssues' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  function  getAttachment ( $request ,  $match ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $prj  =  $request -> project ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $attach  =  Pluf_Shortcuts_GetObjectOr404 ( 'IDF_IssueFile' ,  $match [ 2 ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $prj -> inOr404 ( $attach -> get_comment () -> get_issue ()); 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-02 01:50:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $info  =  IDF_FileUtil :: getMimeType ( $attach -> filename ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-30 18:00:59 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $mime  =  'application/octet-stream' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( strpos ( $info [ 0 ],  'image/' )  ===  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $mime  =  $info [ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-12 20:40:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $res  =  new  Pluf_HTTP_Response_File ( Pluf :: f ( 'upload_issue_path' ) . '/' . $attach -> attachment , 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-30 18:00:59 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                           $mime ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( $mime  ==  'application/octet-stream' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $res -> headers [ 'Content-Disposition' ]  =  'attachment; filename="' . $attach -> filename . '"' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-12 20:40:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  $res ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-30 18:00:59 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  View  a  given  attachment . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  $viewAttachment_precond  =  array ( 'IDF_Precondition::accessIssues' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  function  viewAttachment ( $request ,  $match ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $prj  =  $request -> project ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $attach  =  Pluf_Shortcuts_GetObjectOr404 ( 'IDF_IssueFile' ,  $match [ 2 ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $prj -> inOr404 ( $attach -> get_comment () -> get_issue ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // If one cannot see the attachement, redirect to the
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // getAttachment view.
 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-02 01:50:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $info  =  IDF_FileUtil :: getMimeType ( $attach -> filename ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( ! IDF_FileUtil :: isText ( $info ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-30 18:00:59 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            return  $this -> getAttachment ( $request ,  $match ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // Now we want to look at the file but with links back to the
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // issue.
 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-02 01:50:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $file  =  IDF_FileUtil :: highLight ( $info , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                        file_get_contents ( Pluf :: f ( 'upload_issue_path' ) . '/' . $attach -> attachment )); 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-30 18:00:59 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $title  =  sprintf ( __ ( 'View %s' ),  $attach -> filename ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  Pluf_Shortcuts_RenderToResponse ( 'idf/issues/attachment.html' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'attachment'  =>  $attach , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'page_title'  =>  $title , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'comment'  =>  $attach -> get_comment (), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'issue'  =>  $attach -> get_comment () -> get_issue (), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'file'  =>  $file , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               $request ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  View  list  of  issues  for  a  given  project  with  a  given  status . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     */ 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-07 15:35:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    public  $listStatus_precond  =  array ( 'IDF_Precondition::accessIssues' ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    public  function  listStatus ( $request ,  $match ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $prj  =  $request -> project ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $status  =  $match [ 2 ]; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-04 21:45:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( mb_strtolower ( $status )  ==  'open' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $url  =  Pluf_HTTP_URL_urlForView ( 'IDF_Views_Issue::index' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                            array ( $prj -> shortname )); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            return  new  Pluf_HTTP_Response_Redirect ( $url ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-04 21:45:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $title  =  sprintf ( __ ( '%s Closed Issues' ),  ( string )  $prj ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // Get stats about the issues
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $open  =  $prj -> getIssueCountByStatus ( 'open' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $closed  =  $prj -> getIssueCountByStatus ( 'closed' ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $overdue  =  $prj -> getIssueCountByDueDate ( 'overdue' ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        // Paginator to paginate the issues
 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-23 00:29:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag  =  new  Pluf_Paginator ( new  IDF_Issue ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> class  =  'recent-issues' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> item_extra_props  =  array ( 'project_m'  =>  $prj , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                       'shortname'  =>  $prj -> shortname , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                       'current_user'  =>  $request -> user ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> summary  =  __ ( 'This table shows the closed issues.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $otags  =  $prj -> getTagIdsByStatus ( 'closed' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( count ( $otags )  ==  0 )  $otags []  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> forced_where  =  new  Pluf_SQL ( 'project=%s AND status IN (' . implode ( ', ' ,  $otags ) . ')' ,  array ( $prj -> id )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> action  =  array ( 'IDF_Views_Issue::listStatus' ,  array ( $prj -> shortname ,  $status )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> sort_order  =  array ( 'modif_dtime' ,  'ASC' );  // will be reverted
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> sort_reverse_order  =  array ( 'modif_dtime' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> sort_link_title  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> extra_classes  =  array ( 'a-c' ,  '' ,  'a-c' ,  '' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $list_display  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             'id'  =>  __ ( 'Id' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'summary' ,  'IDF_Views_Issue_SummaryAndLabels' ,  __ ( 'Summary' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'status' ,  'IDF_Views_Issue_ShowStatus' ,  __ ( 'Status' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'due_dtime' ,  'IDF_Views_Issue_DueDate' ,  __ ( 'Due Date' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'modif_dtime' ,  'Pluf_Paginator_DateAgo' ,  __ ( 'Last Updated' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                              ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> configure ( $list_display ,  array (),  array ( 'id' ,  'status' ,  'due_dtime' ,  'modif_dtime' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> items_per_page  =  10 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> no_results_text  =  __ ( 'No issues were found.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> setFromRequest ( $request ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  Pluf_Shortcuts_RenderToResponse ( 'idf/issues/index.html' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               array ( 'project'  =>  $prj , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'page_title'  =>  $title , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'open'  =>  $open , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'closed'  =>  $closed , 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'overdue'  =>  $overdue , 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-23 00:29:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'issues'  =>  $pag , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'cloud'  =>  'closed_issues' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               $request ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  View  list  of  issues  for  a  given  project  with  a  given  status . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  $listOverdue_precond  =  array ( 'IDF_Precondition::accessIssues' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  function  listOverdue ( $request ,  $match ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $prj  =  $request -> project ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $status  =  $match [ 2 ]; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-23 17:03:17 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $title  =  sprintf ( __ ( '%s %s Issues' ),  ( string )  $prj ,  ( string )  $status ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-23 00:29:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        // Get stats about the issues
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $open  =  $prj -> getIssueCountByStatus ( 'open' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $closed  =  $prj -> getIssueCountByStatus ( 'closed' ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $overdue  =  $prj -> getIssueCountByDueDate ( 'overdue' ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-23 00:29:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        // Paginator to paginate the issues
 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $pag  =  new  Pluf_Paginator ( new  IDF_Issue ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> class  =  'recent-issues' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> item_extra_props  =  array ( 'project_m'  =>  $prj , 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-12 12:46:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                       'shortname'  =>  $prj -> shortname , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                       'current_user'  =>  $request -> user ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-23 17:03:17 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> summary  =  __ ( 'This table shows the overdue issues.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $otags  =  $prj -> getTagIdsByStatus ( 'open' ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        if  ( count ( $otags )  ==  0 )  $otags []  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-23 17:03:17 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( 'Undue'  ==  $status )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $where  =  'AND due_dtime >= NOW()' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $where  =  'AND due_dtime < NOW()' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> forced_where  =  new  Pluf_SQL ( 'project=%s '  .  $where  .  ' AND status IN (' . implode ( ', ' ,  $otags ) . ')' ,  array ( $prj -> id )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> action  =  array ( 'IDF_Views_Issue::listOverdue' ,  array ( $prj -> shortname ,  $status )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> sort_order  =  array ( 'due_dtime' ,  'DESC' );  // will be reverted
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> sort_reverse_order  =  array ( 'due_dtime' ); 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-08 14:23:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> sort_link_title  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-02 14:06:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> extra_classes  =  array ( 'a-c' ,  '' ,  'a-c' ,  '' ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $list_display  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             'id'  =>  __ ( 'Id' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'summary' ,  'IDF_Views_Issue_SummaryAndLabels' ,  __ ( 'Summary' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'status' ,  'IDF_Views_Issue_ShowStatus' ,  __ ( 'Status' )), 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-11 01:15:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             array ( 'due_dtime' ,  'IDF_Views_Issue_DueDate' ,  __ ( 'Due Date' )), 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'modif_dtime' ,  'Pluf_Paginator_DateAgo' ,  __ ( 'Last Updated' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                              ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-11 01:15:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> configure ( $list_display ,  array (),  array ( 'id' ,  'status' ,  'due_dtime' ,  'modif_dtime' )); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> items_per_page  =  10 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> no_results_text  =  __ ( 'No issues were found.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> setFromRequest ( $request ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-18 09:15:02 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  Pluf_Shortcuts_RenderToResponse ( 'idf/issues/index.html' , 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                                               array ( 'project'  =>  $prj , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'page_title'  =>  $title , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'open'  =>  $open , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'closed'  =>  $closed , 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'overdue'  =>  $overdue , 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                                                     'issues'  =>  $pag , 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-08 20:34:40 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'cloud'  =>  'closed_issues' , 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                                                     ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               $request ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  View  list  of  issues  for  a  given  project  with  a  given  label . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     */ 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-07 15:35:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    public  $listLabel_precond  =  array ( 'IDF_Precondition::accessIssues' ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    public  function  listLabel ( $request ,  $match ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $prj  =  $request -> project ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $tag  =  Pluf_Shortcuts_GetObjectOr404 ( 'IDF_Tag' ,  $match [ 2 ]); 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-02 01:50:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $status  =  $match [ 3 ]; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( $tag -> project  !=  $prj -> id  or  ! in_array ( $status ,  array ( 'open' ,  'closed' ,  'overdue' )))  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            throw  new  Pluf_HTTP_Error404 (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( $status  ==  'open' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $title  =  sprintf ( __ ( '%1$s Issues with Label %2$s' ),  ( string )  $prj , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                             ( string )  $tag ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        }  elseif  ( $status  ==  'overdue' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $title  =  sprintf ( __ ( '%1$s Overdue Issues with Label %2$s' ),  ( string )  $prj , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                             ( string )  $tag ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $overdue_status  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $status  =  'open' ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        }  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-02 01:50:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $title  =  sprintf ( __ ( '%1$s Closed Issues with Label %2$s' ), 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                             ( string )  $prj ,  ( string )  $tag ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // Get stats about the open/closed issues having this tag.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $open  =  $prj -> getIssueCountByStatus ( 'open' ,  $tag ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $closed  =  $prj -> getIssueCountByStatus ( 'closed' ,  $tag ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $overdue  =  $prj -> getIssueCountByDueDate ( 'overdue' ,  'open' ,  $tag ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        // Paginator to paginate the issues
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag  =  new  Pluf_Paginator ( new  IDF_Issue ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> model_view  =  'join_tags' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> class  =  'recent-issues' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> item_extra_props  =  array ( 'project_m'  =>  $prj , 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-12 12:46:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                       'shortname'  =>  $prj -> shortname , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                       'current_user'  =>  $request -> user ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> summary  =  sprintf ( __ ( 'This table shows the issues with label %s.' ),  ( string )  $tag ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $otags  =  $prj -> getTagIdsByStatus ( $status ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( count ( $otags )  ==  0 )  $otags []  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> forced_where  =  new  Pluf_SQL ( 'project=%s AND idf_tag_id=%s AND status IN (' . implode ( ', ' ,  $otags ) . ')' ,  array ( $prj -> id ,  $tag -> id )); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if ( isset ( $overdue_status ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $pag -> forced_where -> SAnd ( new  Pluf_SQL ( 'due_dtime < NOW()' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> action  =  array ( 'IDF_Views_Issue::listLabel' ,  array ( $prj -> shortname ,  $tag -> id ,  $status )); 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-14 09:33:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> sort_order  =  array ( 'modif_dtime' ,  'ASC' );  // will be reverted
 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-11 21:10:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> sort_reverse_order  =  array ( 'modif_dtime' ); 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-08 14:23:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> sort_link_title  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-02 14:06:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> extra_classes  =  array ( 'a-c' ,  '' ,  'a-c' ,  '' ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $list_display  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             'id'  =>  __ ( 'Id' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'summary' ,  'IDF_Views_Issue_SummaryAndLabels' ,  __ ( 'Summary' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'status' ,  'IDF_Views_Issue_ShowStatus' ,  __ ( 'Status' )), 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-11 01:15:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             array ( 'due_dtime' ,  'IDF_Views_Issue_DueDate' ,  __ ( 'Due Date' )), 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								             array ( 'modif_dtime' ,  'Pluf_Paginator_DateAgo' ,  __ ( 'Last Updated' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                              ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-11 01:15:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $pag -> configure ( $list_display ,  array (),  array ( 'id' ,  'status' ,  'due_dtime' ,  'modif_dtime' )); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> items_per_page  =  10 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> no_results_text  =  __ ( 'No issues were found.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $pag -> setFromRequest ( $request ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  (( $open + $closed )  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $completion  =  sprintf ( '%01.0f%%' ,  ( 100 * $closed ) / (( float )  $open + $closed )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $completion  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-18 09:15:02 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  Pluf_Shortcuts_RenderToResponse ( 'idf/issues/by-label.html' , 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                                               array ( 'project'  =>  $prj , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'completion'  =>  $completion , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'page_title'  =>  $title , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'open'  =>  $open , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'label'  =>  $tag , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     'closed'  =>  $closed , 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-30 15:20:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                     'overdue'  =>  $overdue , 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                                                     'issues'  =>  $pag , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               $request ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  Renders  a  JSON  string  containing  completed  issue  information 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  based  on  the  queried  /  partial  string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  $autoCompleteIssueList_precond  =  array ( 'IDF_Precondition::accessIssues' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  function  autoCompleteIssueList ( $request ,  $match ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $prj  =  $request -> project ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-10 16:21:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $issue_id  =  ! empty ( $match [ 2 ])  ?  intval ( $match [ 2 ])  :  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $query  =  trim ( $request -> REQUEST [ 'q' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $limit  =  ! empty ( $request -> REQUEST [ 'limit' ])  ?  intval ( $request -> REQUEST [ 'limit' ])  :  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $limit  =  max ( 10 ,  $limit ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $issues  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // empty search, return the most recently updated issues
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( empty ( $query ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $sql  =  new  Pluf_SQL ( 'project=%s' ,  array ( $prj -> id )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $tmp  =  Pluf :: factory ( 'IDF_Issue' ) -> getList ( array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    'filter'  =>  $sql -> gen (), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    'order'  =>  'modif_dtime DESC' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $issues  +=  $tmp -> getArrayCopy (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            // ID-based search
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  ( is_numeric ( $query ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-01 13:35:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                $sql  =  'project=%s AND CAST(id AS VARCHAR) LIKE %s' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                // MySQL can't cast to VARCHAR and a CAST to CHAR converts
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                // the whole number, not just the first digit
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                if  ( strtolower ( Pluf :: f ( 'db_engine' ))  ==  'mysql' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    $sql  =  'project=%s AND CAST(id AS CHAR) LIKE %s' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $sql  =  new  Pluf_SQL ( $sql ,  array ( $prj -> id ,  $query . '%' )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-10 16:21:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                $tmp  =  Pluf :: factory ( 'IDF_Issue' ) -> getList ( array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    'filter'  =>  $sql -> gen (), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    'order'  =>  'id ASC' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $issues  +=  $tmp -> getArrayCopy (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            // text-based search
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $res  =  new  Pluf_Search_ResultSet ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                IDF_Search :: mySearch ( $query ,  $prj ,  'IDF_Issue' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            foreach  ( $res  as  $issue ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $issues []  =  $issue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // Autocomplete from jQuery UI works with JSON, this old one still
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // expects a parsable string; since we'd need to bump jQuery beyond
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // 1.2.6 for this to use as well, we're trying to cope with the old format.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // see http://www.learningjquery.com/2010/06/autocomplete-migration-guide
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $out  =  '' ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-10 16:21:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $ids  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        foreach  ( $issues  as  $issue ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-10 16:21:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if  ( $issue -> id  ==  $issue_id ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  ( in_array ( $issue -> id ,  $ids )) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  ( -- $limit  <  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $out  .=  str_replace ( '|' ,  '|' ,  $issue -> summary )  . '|' . $issue -> id . " \n " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $ids []  =  $issue -> id ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  new  Pluf_HTTP_Response ( $out ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-08-12 12:46:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  Star / Unstar  an  issue . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  $star_precond  =  array ( 'IDF_Precondition::accessIssues' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                 'Pluf_Precondition::loginRequired' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  function  star ( $request ,  $match ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $prj  =  $request -> project ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $issue  =  Pluf_Shortcuts_GetObjectOr404 ( 'IDF_Issue' ,  $match [ 2 ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $prj -> inOr404 ( $issue ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( $request -> method  ==  'POST' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $starred  =  Pluf_Model_InArray ( $request -> user ,  $issue -> get_interested_list ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  ( $starred )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $issue -> delAssoc ( $request -> user ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $request -> user -> setMessage ( __ ( 'The issue has been removed from your watch list.' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $issue -> setAssoc ( $request -> user ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $request -> user -> setMessage ( __ ( 'The issue has been added to your watch list.' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $url  =  Pluf_HTTP_URL_urlForView ( 'IDF_Views_Issue::view' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                        array ( $prj -> shortname ,  $issue -> id )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  new  Pluf_HTTP_Response_Redirect ( $url ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     *  Create  the  autocomplete  arrays  for  the  little  AJAX  stuff . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  static  function  autoCompleteArrays ( $project ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $conf  =  new  IDF_Conf (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $conf -> setProject ( $project ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $auto  =  array ( 'auto_status'  =>  '' ,  'auto_labels'  =>  '' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $auto_raw  =  array ( 'auto_status'  =>  '' ,  'auto_labels'  =>  '' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $st  =  $conf -> getVal ( 'labels_issue_open' ,  IDF_Form_IssueTrackingConf :: init_open ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $st  .=  " \n " . $conf -> getVal ( 'labels_issue_closed' ,  IDF_Form_IssueTrackingConf :: init_closed ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $auto_raw [ 'auto_status' ]  =  $st ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $auto_raw [ 'auto_labels' ]  =  $conf -> getVal ( 'labels_issue_predefined' ,  IDF_Form_IssueTrackingConf :: init_predefined ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        foreach  ( $auto_raw  as  $key  =>  $st )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $st  =  preg_split ( " / \015 \012 | \015 | \012 / " ,  $st ,  - 1 ,  PREG_SPLIT_NO_EMPTY ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            foreach  ( $st  as  $s )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $v  =  '' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $d  =  '' ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-24 20:40:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                $_s  =  explode ( '=' ,  $s ,  2 ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                if  ( count ( $_s )  >  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    $v  =  trim ( $_s [ 0 ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    $d  =  trim ( $_s [ 1 ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    $v  =  trim ( $_s [ 0 ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $auto [ $key ]  .=  sprintf ( '{ name: "%s", to: "%s" }, ' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                       Pluf_esc ( $d ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                       Pluf_esc ( $v )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-01 09:54:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $auto [ $key ]  =  substr ( $auto [ $key ],  0 ,  - 2 ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 14:15:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        // Get the members/owners
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $m  =  $project -> getMembershipData (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $auto [ '_auto_owner' ]  =  $m [ 'members' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $auto [ 'auto_owner' ]  =  '' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        foreach  ( $m [ 'owners' ]  as  $owner )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  ( ! Pluf_Model_InArray ( $owner ,  $auto [ '_auto_owner' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                $auto [ '_auto_owner' ][]  =  $owner ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        foreach  ( $auto [ '_auto_owner' ]  as  $owner )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $auto [ 'auto_owner' ]  .=  sprintf ( '{ name: "%s", to: "%s" }, ' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                           Pluf_esc ( $owner ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                           Pluf_esc ( $owner -> login )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-01 09:54:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $auto [ 'auto_owner' ]  =  substr ( $auto [ 'auto_owner' ],  0 ,  - 2 ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 14:15:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        unset ( $auto [ '_auto_owner' ]); 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        // Get issue relations
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $r  =  $project -> getRelationsFromConfig (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $auto [ 'auto_relation_types' ]  =  '' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        foreach  ( $r  as  $rt )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $auto [ 'auto_relation_types' ]  .=  sprintf ( '{ name: "%s", to: "%s" }, ' , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-01 01:15:23 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                    Pluf_esc ( __ ( $rt )),  Pluf_esc ( $rt )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 13:52:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $auto [ 'auto_relation_types' ]  =  substr ( $auto [ 'auto_relation_types' ],  0 ,  - 2 ); 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        return  $auto ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  When  you  access  to  your  forge  watch  list ,  issue  don ' t  known 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  the  project  shortname . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								function  IDF_Views_Issue_SummaryAndLabelsUnknownProject ( $field ,  $issue ,  $extra = '' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    $shortname  =  $issue -> get_project () -> shortname ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    $issue -> __set ( 'shortname' ,  $shortname ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  IDF_Views_Issue_SummaryAndLabels  ( $field ,  $issue ,  $extra ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-11 01:15:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  Get  the  date  value  for  the  Due  Date  table  column 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								function  IDF_Views_Issue_DueDate ( $field ,  $issue ,  $extra = '' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  $issue -> $field ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  Display  the  summary  of  an  issue ,  then  on  a  new  line ,  display  the 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  list  of  labels  with  a  link  to  a  view  " by label only " . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  The  summary  of  the  issue  is  linking  to  the  issue . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								function  IDF_Views_Issue_SummaryAndLabels ( $field ,  $issue ,  $extra = '' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-02 01:50:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    $edit  =  Pluf_HTTP_URL_urlForView ( 'IDF_Views_Issue::view' , 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                                     array ( $issue -> shortname ,  $issue -> id )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    $tags  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    foreach  ( $issue -> get_tags_list ()  as  $tag )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-02 01:50:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $url  =  Pluf_HTTP_URL_urlForView ( 'IDF_Views_Issue::listLabel' , 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                                        array ( $issue -> shortname ,  $tag -> id ,  'open' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $tags []  =  sprintf ( '<a class="label" href="%s">%s</a>' ,  $url ,  Pluf_esc (( string )  $tag )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-12 12:46:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    $s  =  '' ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-12 12:48:24 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( ! $issue -> current_user -> isAnonymous ()  and 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        Pluf_Model_InArray ( $issue -> current_user ,  $issue -> get_interested_list ()))  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-12 12:49:59 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $s  =  '<img style="vertical-align: text-bottom;" src="' . Pluf_Template_Tag_MediaUrl :: url ( '/idf/img/star.png' ) . '" alt="' . __ ( 'On your watch list.' ) . '" /> ' ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-12 12:46:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    $out  =  '' ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 22:19:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if ( ''  !=  $issue -> due_dtime  and  ( time ()  >=  strtotime ( $issue -> due_dtime )) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									    and  in_array ( $issue -> status ,  $issue -> get_project () -> getTagIdsByStatus ( 'open' )))  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-11 01:15:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $out  =  ' <span class="overdue">overdue</span>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    if  ( count ( $tags ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-11 01:15:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $out  .=  '<br /><span class="note">' . implode ( ', ' ,  $tags ) . '</span>' ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-12 12:46:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  $s . sprintf ( '<a href="%s">%s</a>' ,  $edit ,  Pluf_esc ( $issue -> summary )) . $out ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-25 10:26:05 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  Display  the  status  in  the  issue  listings . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								function  IDF_Views_Issue_ShowStatus ( $field ,  $issue ,  $extra = '' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  Pluf_esc ( $issue -> get_status () -> name ); 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-02 01:50:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-05 17:02:06 +01:00