3 * Copyright 2011, Franck Villaume - Capgemini
4 * http://fusionforge.org
6 * This file is part of FusionForge. FusionForge is free software;
7 * you can redistribute it and/or modify it under the terms of the
8 * GNU General Public License as published by the Free Software
9 * Foundation; either version 2 of the Licence, or (at your option)
12 * FusionForge is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 require_once('common/widget/Widget.class.php');
22 require_once('common/widget/WidgetLayoutManager.class.php');
25 class extsubproj_Widget_SubProjects extends Widget {
26 function extsubproj_Widget_SubProjects($owner_type, $plugin) {
27 $this->plugin = $plugin;
28 $this->Widget('plugin_extsubproj_project_subprojects');
32 return _("Project external subprojects");
35 function getCategory() {
36 return _('Plugin (project)');
39 function getDescription() {
40 return _("Displays links to external subprojects of the project");
43 function getContent() {
44 global $pluginExtSubProj;
48 $subProjects = $this->plugin->getSubProjects($group_id);
51 if(is_array($subProjects)) {
52 $tablearr = array(_('Sub projects'),'');
53 $html .= $HTML->listTableTop($tablearr);
55 foreach ($subProjects as $url) {
57 include_once("arc/ARC2.php");
58 require_once('plugins/extsubproj/include/Graphite.php');
61 $parser = ARC2::getRDFParser();
62 //$parser->parse('https://vm2.localdomain/projects/coinsuper/');
65 $triples = $parser->getTriples();
67 $turtle = $parser->toTurtle($triples);
68 $datauri = $parser->toDataURI($turtle);
71 $graph = new Graphite();
72 //$graph->setDebug(1);
73 $graph->ns( "doap", "http://usefulinc.com/ns/doap#" );
74 $graph->load( $datauri );
75 //print $graph->resource('https://vm2.localdomain/projects/coinsuper/')->dumpText();
76 $projname = $graph->resource( $url )->get( "doap:name" );
81 <td><a href="'.$url.'">'.$projname.'</a>
86 $html .= $HTML->listTableBottom();
89 $user = UserManager::instance()->getCurrentUser();
90 $scmgitplugin = plugin_get_object('scmgit');
91 $GitRepositories = $this->getMyRepositoriesList();
92 if (count($GitRepositories)) {
93 $returnhtml = '<table>';
94 foreach ($GitRepositories as $GitRepository) {
95 $project = group_get_object($GitRepository);
96 $returnhtml .= '<tr><td><tt>git clone git+ssh://'.$user->getUnixName().'@' . $scmgitplugin->getBoxForProject($project) . forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/users/'. $user->getUnixName() .'.git</tt></p></td><tr>';
98 $returnhtml .= '</table>';
101 return '<p class="information">'._('No personal git repository').'</p>';
107 function getMyRepositoriesList() {
108 $returnedArray = array();
109 $res = db_query_params('SELECT p.group_id FROM plugin_scmgit_personal_repos p, users u WHERE u.user_id=p.user_id AND u.unix_status = $1 AND u.user_id = $2',
110 array('A',$this->owner_id));
112 return $returnedArray;
114 $rows = db_numrows($res);
115 for ($i=0; $i<$rows; $i++) {
116 $returnedArray[] = db_result($res,$i,'group_id');
119 return $returnedArray;