3 * Copyright 2011, Sabri LABBENE - Institut Télécom
5 * This file is part of FusionForge. FusionForge is free software;
6 * you can redistribute it and/or modify it under the terms of the
7 * GNU General Public License as published by the Free Software
8 * Foundation; either version 2 of the Licence, or (at your option)
11 * FusionForge is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
18 * 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 globalDashboard_Widget_MyArtifacts extends Widget {
27 function __construct($owner_type, $plugin) {
28 $this->plugin = $plugin;
29 $this->Widget('plugin_globalDashboard_MyArtifacts');
33 return _("User artiacts from other remote Forges");
36 function getCategory() {
37 return _('Global Dashboard Plugin');
40 function getDescription() {
41 return _("Displays user artifacts that lives in remote Tracking systems");
44 function getContent() {
47 $MyProjects = $this->plugin->getMyProjects();
50 if(is_array($MyProjects)) {
51 $tablearr = array(_('My Projects'),'');
52 $html .= $HTML->listTableTop($tablearr);
54 foreach ($MyProjects as $url) {
55 include_once("arc/ARC2.php");
56 require_once('plugins/extsubproj/include/Graphite.php');
58 $parser = ARC2::getRDFParser();
59 //$parser->parse('https://vm2.localdomain/projects/coinsuper/');
62 $triples = $parser->getTriples();
64 $turtle = $parser->toTurtle($triples);
65 $datauri = $parser->toDataURI($turtle);
69 $graph = new Graphite();
70 //$graph->setDebug(1);
71 $graph->ns( "doap", "http://usefulinc.com/ns/doap#" );
72 $graph->load( $datauri );
73 //print $graph->resource('https://vm2.localdomain/projects/coinsuper/')->dumpText();
74 $projname = $graph->resource( $url )->get( "doap:name" );
78 <td><a href="'.$url.'">'.$projname.'</a>
82 $html .= $HTML->listTableBottom();
85 $user = UserManager::instance()->getCurrentUser();
86 $scmgitplugin = plugin_get_object('scmgit');
87 $GitRepositories = $this->getMyRepositoriesList();
88 if (count($GitRepositories)) {
89 $returnhtml = '<table>';
90 foreach ($GitRepositories as $GitRepository) {
91 $project = group_get_object($GitRepository);
92 $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>';
94 $returnhtml .= '</table>';
98 return '<p class="information">'._('No personal git repository').'</p>';
104 function getMyRepositoriesList() {
105 $returnedArray = array();
106 $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',
107 array('A',$this->owner_id));
109 return $returnedArray;
111 $rows = db_numrows($res);
112 for ($i=0; $i<$rows; $i++) {
113 $returnedArray[] = db_result($res,$i,'group_id');
116 return $returnedArray;