[evolvis-commits] r17544: - Functionality from branch to trunk

papel at evolvis.org papel at evolvis.org
Fri Sep 9 16:07:03 CEST 2011


Author: papel
Date: 2011-09-09 16:07:03 +0200 (Fri, 09 Sep 2011)
New Revision: 17544

Modified:
   trunk/gforge_base/evolvisforge/gforge/www/my/index.php
Log:
- Functionality from branch to trunk

Modified: trunk/gforge_base/evolvisforge/gforge/www/my/index.php
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/www/my/index.php	2011-09-09 14:06:45 UTC (rev 17543)
+++ trunk/gforge_base/evolvisforge/gforge/www/my/index.php	2011-09-09 14:07:03 UTC (rev 17544)
@@ -26,6 +26,7 @@
 require_once('../env.inc.php');
 require_once $gfwww.'include/pre.php';
 require_once $gfwww.'include/vote_function.php';
+require_once $gfcommon.'include/minijson.php';
 require_once $gfcommon.'tracker/ArtifactsForUser.class.php';
 require_once $gfcommon.'forum/ForumsForUser.class.php';
 require_once $gfcommon.'pm/ProjectTasksForUser.class.php';
@@ -37,29 +38,46 @@
 
 } else {
 
+	$user = session_get_user();	
+
 	$requestedExtraFieldParams = array();
 	$requestedExtraFieldParams = getArrayFromRequest('extra_fields');
-
-			$requestedExtraField = array();
-			foreach($requestedExtraFieldParams as $requestedExtraFieldParam) {
-				foreach($requestedExtraFieldParam as $param) {
-					array_push($requestedExtraField, $param);
-				}
+	
+	$artifact_type_id = getIntFromRequest('artifact_type_id');
+	$requestedExtraField = array();
+	
+		foreach($requestedExtraFieldParams as $requestedExtraFieldParam) {
+			foreach($requestedExtraFieldParam as $param) {
+				array_push($requestedExtraField, $param);
 			}
+		}	
+	
+	$artifactsForUser = new ArtifactsForUser($user);
+	
+	$allAssignedArtifacts =& $artifactsForUser->getAssignedArtifactBugsGroups();
 
-	$artifactsForUser = new ArtifactsForUser(session_get_user());
-	$assignedArtifacts =& $artifactsForUser->getAssignedBugsByGroup($requestedExtraField);
+ 	$pref_ = minijson_encode($requestedExtraField, false);
+ 	if($artifact_type_id != 0) {
+ 		$user->setPreference('mypage_bug_res_'.$artifact_type_id,$pref_);
+ 	}
 
-	$allAssignedArtifacts =& $artifactsForUser->getAssignedArtifactBugsGroups();
 
-	$arrGroupProjectValues = array('group_id' => array(), 'group_artifact_id' => array(), 'group_public_name' => array(), 'group_artifact_name' => array(), 'artifact_extra_fields' => array(), 'group' => array());
-	$i = 0;
-
+	$arrGroupProjectValues = array('group_id' => array(), 'group_artifact_type_id' => array(), 'group_public_name' => array(), 'group_artifact_name' => array(), 'artifact_extra_fields' => array(), 'element_ids' => array(), 'group' => array());
+	
 	$tmpGroupId = null;
+	$arrTest = array();
+	$requestedExtraFieldIds = array();
 	foreach($allAssignedArtifacts as $thisArtifact) {
 		if($tmpGroupId != $thisArtifact->ArtifactType->Group->getID()) {
 			array_push($arrGroupProjectValues['group_id'], $thisArtifact->ArtifactType->Group->getID());
-			array_push($arrGroupProjectValues['group_artifact_id'], $thisArtifact->ArtifactType->getID());
+			array_push($arrGroupProjectValues['group_artifact_type_id'], $thisArtifact->ArtifactType->getID());
+			
+			$strJson=$user->getPreference('mypage_bug_res_'.$thisArtifact->ArtifactType->getID());
+			if($strJson != '') {
+				minijson_decode($strJson, &$requestedExtraFieldIds);
+				array_push($arrGroupProjectValues['element_ids'], $requestedExtraFieldIds);
+			}		
+			
 			array_push($arrGroupProjectValues['group_public_name'], $thisArtifact->ArtifactType->Group->getPublicName());
 			array_push($arrGroupProjectValues['group_artifact_name'], $thisArtifact->ArtifactType->getName());
 			array_push($arrGroupProjectValues['artifact_extra_fields'], $thisArtifact->ArtifactType->getExtraFields());
@@ -68,7 +86,17 @@
 		}
 		$tmpGroupId = $thisArtifact->ArtifactType->Group->getID();
 	}
+	
+	$requestedExtraFieldIds = array();
+	
+	foreach($arrGroupProjectValues['element_ids'] as $extraIds) {
+		foreach($extraIds as $id) {
+			array_push($requestedExtraFieldIds, $id);
+		}
+	}
 
+	$assignedArtifacts =& $artifactsForUser->getAssignedBugsByGroup($requestedExtraFieldIds);
+
 	/*
 	 * Only default tracker have a datatype bigger 0 in database table artifact_group_list.
 	 * There are four default tracker with the datatypes 1,2,3,4.
@@ -126,7 +154,7 @@
 
 		$j = 0;
 		foreach($arrGroupProjectValues['group_id'] as $thisGroupId) {
-		$artifactTypeId = $arrGroupProjectValues['group_artifact_id'][$j];
+		$artifactTypeId = $arrGroupProjectValues['group_artifact_type_id'][$j];
 		$publicName = $arrGroupProjectValues['group_public_name'][$j];
 		$group = $arrGroupProjectValues['group'][$j];
 		$groupName = $arrGroupProjectValues['group'][$j]->getPublicName();
@@ -135,8 +163,9 @@
 
 					echo '
 					<tr><td colspan="4" class="tablecontent myPageArtifactGroupHeader">'.
-					'<form action="'.getStringFromServer('PHP_SELF').'" method="post">'.
-					util_make_link ( '/tracker/?group_id='.$thisGroupId.'&atid='.$artifactTypeId, $groupName.' - '.$artifactTypeName);
+					'<form action="'.getStringFromServer('PHP_SELF').'" method="post">';
+					echo '<input type="hidden" name="artifact_type_id" value="'.$artifactTypeId.'" />';
+					echo util_make_link ( '/tracker/?group_id='.$thisGroupId.'&atid='.$artifactTypeId, $groupName.' - '.$artifactTypeName);
 
 					echo '   ';
 
@@ -146,7 +175,7 @@
 								$id = $extraFieldData['extra_field_id'];
 
 								$ath = new ArtifactTypeHtml($group);
-								echo $ath->renderCheckbox($id, $requestedExtraField, false, 'none', 'horizontal');
+									echo $ath->renderCheckbox($id, $requestedExtraFieldIds, false, 'none', 'horizontal');
 							}
 						}
 
@@ -158,7 +187,7 @@
 			$i=0;
 			foreach($assignedArtifacts as $art) {
 
-				$artifact_id = $art->ArtifactType->getID();
+				$artifact_type_id = $art->ArtifactType->getID();
 				$group_id = $art->ArtifactType->Group->getID();
 
 				if($group_id === $thisGroupId) {
@@ -191,13 +220,7 @@
 
 <div class="tabbertab myPageArtifactTaskDiv" title="<?php echo _('Assigned Artifacts'); ?>">
 	<?php
-	/*
-		Artifacts
-	*/
 
-	/* SELECT * FROM artifact_extra_field_list
-	 * */
-
 	$last_group=0;
 	$order_name_arr=array();
 	$order_name_arr[]=_('ID');
@@ -205,16 +228,16 @@
 	$order_name_arr[]=_('Summary');
 
 	echo $HTML->listTableTop($order_name_arr,'',$tabcnt);
-	$artifactsForUser = new ArtifactsForUser(session_get_user());
+	$artifactsForUser = new ArtifactsForUser($user);
 	$assignedArtifacts =& $artifactsForUser->getAssignedArtifactsWithoutBugsByGroup($requestedExtraField);
 
 	if (count($assignedArtifacts) > 0) {
 
 		$i=0;
 		foreach($assignedArtifacts as $art) {
-			$artifact_id = $art->ArtifactType->getID();
+			$artifact_type_id = $art->ArtifactType->getID();
 			$arrExtraFieldData = $art->ArtifactType->getExtraFields();
-			if ($artifact_id != $last_group) {
+			if ($artifact_type_id != $last_group) {
 
 				echo '
 				<tr><td colspan="3" class="tablecontent myPageArtifactGroupHeader">'.
@@ -261,7 +284,7 @@
 	$order_name_arr[]=_('Priority');
 	$order_name_arr[]=_('Summary');
 	echo $HTML->listTableTop($order_name_arr,'',$tabcnt);
-	$projectTasksForUser = new ProjectTasksForUser(session_get_user());
+	$projectTasksForUser = new ProjectTasksForUser($user);
 	$userTasks =& $projectTasksForUser->getTasksByGroupProjectName();
 
 	if (count($userTasks) > 0) {
@@ -315,9 +338,9 @@
 	$order_name_arr[]=_('Priority');
 	$order_name_arr[]=_('Summary');
 	echo $HTML->listTableTop($order_name_arr,'',$tabcnt);
-	$artifactsForUser = new ArtifactsForUser(session_get_user());
-	$submittedArtifacts =& $artifactsForUser->getSubmittedArtifactsByGroup();
-
+	$artifactsForUser = new ArtifactsForUser($user);
+	$submittedArtifacts =& $artifactsForUser->getSubmittedArtifactsByGroup(); 
+	
 	if (count($submittedArtifacts) > 0) {
 		$i=0;
 		foreach ($submittedArtifacts as $art) {
@@ -356,7 +379,7 @@
 		$order_name_arr[]=_('Remove');
 		$order_name_arr[]=_('Monitored Forums');
 		echo $HTML->listTableTop($order_name_arr,'',$tabcnt);
-		$forumsForUser = new ForumsForUser(session_get_user());
+		$forumsForUser = new ForumsForUser($user);
 		$forums = $forumsForUser->getMonitoredForums();
 		if (count($forums) < 1) {
 			echo '<tr><td colspan="2" bgcolor="#FFFFFF"><center><strong>'._('You are not monitoring any forums.').'</strong></center></td></tr>';



More information about the evolvis-commits mailing list