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';
24 class extsubproj_Widget_SubProjects extends Widget {
25 function extsubproj_Widget_SubProjects($owner_type, $plugin) {
26 $this->plugin = $plugin;
27 $this->Widget('plugin_extsubproj_project_subprojects');
31 return _("Project external subprojects");
34 function getCategory() {
35 return _('Plugin (project)');
38 function getDescription() {
39 return _("Displays links to external subprojects of the project");
42 function getContent() {
43 global $pluginExtSubProj;
47 $subProjects = $this->plugin->getSubProjects($group_id);
50 if(is_array($subProjects)) {
51 $tablearr = array(_('Subprojects'),'');
52 $html .= $HTML->listTableTop($tablearr);
54 foreach ($subProjects as $url) {
56 include_once 'arc/ARC2.php';
57 require_once 'plugins/extsubproj/include/Graphite.php';
59 $reader = ARC2::getComponent('Reader');
61 $parser = ARC2::getRDFParser();
63 $reader->setAcceptHeader('Accept: application/rdf+xml');
64 $parser->setReader($reader);
66 //$parser->parse('https://vm2.localdomain/projects/coinsuper/');
69 if(! $parser->reader->errors) {
71 $triples = $parser->getTriples();
73 $turtle = $parser->toTurtle($triples);
74 $datauri = $parser->toDataURI($turtle);
76 $graph = new Graphite();
77 //$graph->setDebug(1);
78 $graph->ns( "doap", "http://usefulinc.com/ns/doap#" );
79 $graph->load( $datauri );
80 //print $graph->resource('https://vm2.localdomain/projects/coinsuper/')->dumpText();
81 $projname = $graph->resource( $url )->get( "doap:name" );
85 foreach ($parser->reader->errors as $error) {
92 //@TODO: check plugin compactpreview is installed through the right functions...
93 require_once 'plugins/compactpreview/include/CompactResource.class.php';
94 $params = array('name' => $projname,
97 $cR = new OslcGroupCompactResource($params);
102 //<a href="'.$url.'">'.$projname.'</a>
103 $html .= $cR->getResourceLink();
104 $html = $html . '</td>
108 $html .= $HTML->listTableBottom();