[Fusionforge-commits] r11686 - trunk/src/plugins/oslc/include/oslc-zend/application/controllers

Sabri LABBENE labbenes at libremir.placard.fr.eu.org
Wed Dec 1 17:54:44 CET 2010


Author: labbenes
Date: 2010-12-01 17:54:44 +0100 (Wed, 01 Dec 2010)
New Revision: 11686

Modified:
   trunk/src/plugins/oslc/include/oslc-zend/application/controllers/CodendiOSLCConnector.php
Log:
Add Project lists for service catalog creation in codendi.

Modified: trunk/src/plugins/oslc/include/oslc-zend/application/controllers/CodendiOSLCConnector.php
===================================================================
--- trunk/src/plugins/oslc/include/oslc-zend/application/controllers/CodendiOSLCConnector.php	2010-12-01 16:54:31 UTC (rev 11685)
+++ trunk/src/plugins/oslc/include/oslc-zend/application/controllers/CodendiOSLCConnector.php	2010-12-01 16:54:44 UTC (rev 11686)
@@ -264,7 +264,39 @@
 			throw new Exception($art_obj->getErrorMessage());
 		}
 	}
+
+    /**
+     * Returns the list of projects of the user.
+     * @todo fix this method.
+     */
+    public function getProjectsList() {
+        $uM = UserManager::instance();
+        $pM = ProjectManager::instance();
+        $user = $uM->getCurrentUser();
+        $project_ids = $user->getProjects();
+        foreach($project_ids as $id) {
+            $projects[$id] = $pm->getProject($id);
+        } 
+        return $this->createProjectsArray($projects);
+	}
 	
+    /**
+     *  Converts projects objects into a single projects array.
+     *  We only set the id and the public name of each project 
+     *  into the array.
+     *  @param array $projects array of projects indexed by their relative ids
+     */
+    private function createProjectsArray($projects) {
+        $return = array();
+        foreach($projects as $prj_idx => $project){
+            $return[$prj_idx] = array(
+                'id'                => $prj_idx, 
+                'name'              => $project->getPublicName()
+            );
+        }
+        return $return;
+    }
+
 /**
  * updateArtifact - update the artifact $artifact_id in tracker $tracker_id of the project $group_id with given values
  *
@@ -367,5 +399,6 @@
         return new SoapFault(invalid_session_fault,'Invalid Session ','updateArtifact');
     }
 }
+
 }
 ?>
\ No newline at end of file




More information about the Fusionforge-commits mailing list