. */ require_once('Widget.class.php'); require_once('common/rss/RSS.class.php'); /** * Widget_MyProjects * * PROJECT LIST */ class Widget_MyProjects extends Widget { function Widget_MyProjects() { $this->Widget('myprojects'); } function getTitle() { return _("My Projects"); } function getContent() { global $HTML; $html_my_projects = ''; $user = session_get_user(); $groups = $user->getGroups(); sortProjectList($groups); $roles = RBACEngine::getInstance()->getAvailableRolesForUser($user); sortRoleList ($roles) ; if (count ($groups) < 1) { $html_my_projects .= '
'. _("You're not a member of any project") .'
'; } else { $html_my_projects .= ''; $i = 0; $ra = RoleAnonymous::getInstance(); foreach ($groups as $g) { $i++; $html_my_projects .= ' boxGetAltRowStyle($i) .'">'. ''; } else { $html_my_projects .= ''; } } if (isset($private_shown) && $private_shown) { $html_my_projects .= ' boxGetAltRowStyle($i) .'">'; } $html_my_projects .= '
'. ''. $g->getPublicName().''; $isadmin = false; $role_names = array(); foreach ($roles as $r) { if ($r instanceof RoleExplicit && $r->getHomeProject() != NULL && $r->getHomeProject()->getID() == $g->getID()) { $role_names[] = $r->getName(); if ($r->hasPermission('project_admin', $g->getID())) { $isadmin = true; } } } if ($isadmin) { $html_my_projects .= ' ['._("Admin").']'; } $html_my_projects .= ' ('.htmlspecialchars (implode (', ', $role_names)).')'; if (!$ra->hasPermission('project_read', $g->getID())) { $html_my_projects .= ' (*)'; $private_shown = true; } if (!$isadmin) { $html_my_projects .= ''. '
 
'. '(*) '._("Private project").'
'; } return $html_my_projects; } function hasRss() { return true; } function displayRss() { $rss = new RSS(array( 'title' => forge_get_config('forge_name').' - MyProjects', 'description' => 'My projects', 'link' => get_server_url(), 'language' => 'en-us', 'copyright' => 'Copyright Xerox', 'pubDate' => gmdate('D, d M Y G:i:s',time()).' GMT', )); $projects = UserManager::instance()->getCurrentUser()->getGroups(); sortProjectList($projects); if (!$result || $rows < 1) { $rss->addItem(array( 'title' => 'Error', 'description' => _("You're not a member of any project") . db_error(), 'link' => util_make_url() )); $rss->display(); return ; } foreach ($projects as $project) { $pid = $project->getID(); $title = $project->getPublicName(); $url = util_make_url('/projects/' . $project->getUnixName()); if ( !RoleAnonymous::getInstance()->hasPermission('project_read',$pid)) { $title .= ' (*)'; } $desc = "Project: $url\n"; if (forge_check_perm ('project_admin', $pid)) { $desc .= '
Admin: '. util_make_url('/project/admin/?group_id='.$pid); } $rss->addItem(array( 'title' => $title, 'description' => $desc, 'link' => $url) ); } } function getDescription() { return _("List the projects you belong to. Selecting any of these projects brings you to the corresponding Project Summary page."); } } // Local Variables: // mode: php // c-file-style: "bsd" // End: ?>