3 * Copyright 2011, Olivier Berger - Institut Telecom
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';
60 $reader = ARC2::getComponent('Reader');
62 $parser = ARC2::getRDFParser();
64 $reader->setAcceptHeader('Accept: application/rdf+xml');
65 $parser->setReader($reader);
67 //$parser->parse('https://vm2.localdomain/projects/coinsuper/');
70 if(! $parser->reader->errors) {
72 $triples = $parser->getTriples();
74 $turtle = $parser->toTurtle($triples);
75 $datauri = $parser->toDataURI($turtle);
78 $graph = new Graphite();
79 //$graph->setDebug(1);
80 $graph->ns( "doap", "http://usefulinc.com/ns/doap#" );
81 $graph->load( $datauri );
82 //print $graph->resource('https://vm2.localdomain/projects/coinsuper/')->dumpText();
83 $projname = $graph->resource( $url )->get( "doap:name" );
87 foreach ($parser->reader->errors as $error) {
94 //@TODO: check plugin compactpreview is installed through the right functions...
95 require_once 'plugins/compactpreview/include/CompactResource.class.php';
96 $params = array('name' => $projname,
99 $cR = new OslcGroupCompactResource($params);
104 //<a href="'.$url.'">'.$projname.'</a>
105 $html .= $cR->getResourceLink();
106 $html = $html . '</td>
110 $html .= $HTML->listTableBottom();