本文整理汇总了PHP中ProjectManager::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectManager::instance方法的具体用法?PHP ProjectManager::instance怎么用?PHP ProjectManager::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectManager
的用法示例。
在下文中一共展示了ProjectManager::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Docman_MetadataComparator
function Docman_MetadataComparator($srcGroupId, $dstGroupId, $themePath)
{
$this->docmanIcons = new Docman_Icons($themePath . '/images/ic/');
$pm = ProjectManager::instance();
$this->srcGo = $pm->getProject($srcGroupId);
$this->dstGo = $pm->getProject($dstGroupId);
}
示例2: __construct
/**
* Constructor
*/
public function __construct($params, ProjectManager $project_manager = null)
{
$this->params = $params;
$this->_validated_input = array();
$this->_last_access_to_input = array();
$this->project_manager = $project_manager ? $project_manager : ProjectManager::instance();
}
示例3: survey_header
function survey_header($params)
{
global $group_id, $is_admin_page, $Language;
$params['toptab'] = 'survey';
$params['group'] = $group_id;
$pm = ProjectManager::instance();
$project = $pm->getProject($group_id);
if (!$project->usesSurvey()) {
exit_error($Language->getText('global', 'error'), $Language->getText('survey_s_utils', 's_off'));
}
site_project_header($params);
echo "<P><B>";
// Admin link is displayed only if the user is a project administrator
if (user_ismember($group_id, 'A')) {
echo "<A HREF=\"/survey/admin/?group_id={$group_id}\">" . $Language->getText('survey_s_utils', 'admin') . "</A>";
}
if ($is_admin_page && $group_id && user_ismember($group_id, 'A')) {
echo " | <A HREF=\"/survey/admin/add_survey.php?group_id={$group_id}\">" . $Language->getText('survey_admin_index', 'add_s') . "</A>";
echo " | <A HREF=\"/survey/admin/edit_survey.php?func=browse&group_id={$group_id}\">" . $Language->getText('survey_admin_browse_survey', 'edit_s') . "</A>";
echo " | <A HREF=\"/survey/admin/add_question.php?group_id={$group_id}\">" . $Language->getText('survey_admin_index', 'add_q') . "</A>";
echo " | <A HREF=\"/survey/admin/edit_question.php?func=browse&group_id={$group_id}\">" . $Language->getText('survey_admin_browse_question', 'edit_q') . "</A>";
echo " | <A HREF=\"/survey/admin/show_results.php?group_id={$group_id}\">" . $Language->getText('survey_s_utils', 'show_r') . "</A>";
}
if (isset($params['help'])) {
if (user_ismember($group_id, 'A')) {
echo ' | ';
}
echo help_button($params['help'], false, $Language->getText('global', 'help'));
}
echo "</B><P>";
}
示例4: getContent
public function getContent()
{
$request =& HTTPRequest::instance();
$group_id = $request->get('group_id');
$pm = ProjectManager::instance();
$project = $pm->getProject($group_id);
$res_admin = db_query("SELECT user.user_id AS user_id,user.user_name AS user_name, user.realname as realname " . "FROM user,user_group " . "WHERE user_group.user_id=user.user_id AND user_group.group_id=" . db_ei($group_id) . " AND " . "user_group.admin_flags = 'A'");
if (db_numrows($res_admin) > 0) {
$user_helper = UserHelper::instance();
$hp = Codendi_HTMLPurifier::instance();
$em = EventManager::instance();
echo '<span class="develtitle">' . $GLOBALS['Language']->getText('include_project_home', 'proj_admins') . ':</span><br />';
while ($row_admin = db_fetch_array($res_admin)) {
$display_name = '';
$em->processEvent('get_user_display_name', array('user_id' => $row_admin['user_id'], 'user_name' => $row_admin['user_name'], 'realname' => $row_admin['realname'], 'user_display_name' => &$display_name));
if (!$display_name) {
$display_name = $hp->purify($user_helper->getDisplayNameFromUserId($row_admin['user_id']));
}
echo '<a href="/users/' . $row_admin['user_name'] . '/">' . $display_name . '</a><br />';
}
}
echo '<span class="develtitle">' . $GLOBALS['Language']->getText('include_project_home', 'proj_members') . ':</span><br />';
// count of developers on this project
$res_count = db_query("SELECT user_id FROM user_group WHERE group_id=" . db_ei($group_id));
echo db_numrows($res_count);
echo ' <a href="/project/memberlist.php?group_id=' . $group_id . '">[' . $GLOBALS['Language']->getText('include_project_home', 'view_members') . ']</a>';
}
示例5: generate
function generate()
{
global $Language;
$request =& HTTPRequest::instance();
if ($data = $request->get('data')) {
if (isset($data['users']['generate']) && $data['users']['generate']) {
$um = UserManager::instance();
$nb_wanted = isset($data['users']['nb']) ? (int) $data['users']['nb'] : 1;
$users = $this->_getUsersData();
reset($users);
$nb_done = 0;
while ((list(, $user) = each($users)) && $nb_wanted > $nb_done) {
if (!$um->getUserByUserName($user['name'])) {
require_once 'account.php';
account_create($user['name'], 'codendi', '', $user['realname'], '', '379fbec92fb84a72d6026a422@mailinator.com', 'A', '', 0, 0, 'Europe/Paris', 'en_US', 'A');
$nb_done++;
}
}
}
if (isset($data['projects']['generate']) && $data['projects']['generate']) {
$nb_wanted = isset($data['projects']['nb']) ? (int) $data['projects']['nb'] : 1;
$projects = $this->_getProjectsData();
reset($projects);
$nb_done = 0;
while ((list(, $project) = each($projects)) && $nb_wanted > $nb_done) {
if (!group_get_object_by_name($project['name'])) {
$projectCreator = new ProjectCreator(ProjectManager::instance(), ReferenceManager::instance());
$projectCreator->create(array('project' => array('form_unix_name' => $project['name'], 'form_full_name' => $project['name'], 'form_short_description' => $project['description'], 'form_purpose' => $project['description'], 'form_required_sw' => '', 'form_patents' => '', 'form_comments' => '', 'built_from_template' => 100, 'is_test' => false, 'is_public' => true, 'trove' => array())));
$nb_done++;
}
}
}
}
}
示例6: __construct
public function __construct()
{
$this->project_manager = ProjectManager::instance();
$this->user_manager = UserManager::instance();
$this->project_helper = new \DataInit\ProjectHelper();
$GLOBALS['Language'] = new BaseLanguage('en_US', 'en_US');
}
示例7: PHPWikiService
/**
* Constructor
*/
function PHPWikiService($id)
{
global $LANG, $is_wiki_page;
//used so the search box will add the necessary element to the pop-up box
$is_wiki_page = 1;
/*
* Check given id
*/
$this->gid = (int) $id;
if (empty($this->gid)) {
exit_no_group();
}
$pm = ProjectManager::instance();
$go = $pm->getProject($this->gid);
if (!$go) {
exit_no_group();
}
$this->wiki = new PHPWiki($this->gid);
// Check access right
$this->checkPermissions();
// If Wiki for project doesn't exist, propose creation ... if user is project admin or wiki admin
if (!$this->wiki->exist()) {
if (!user_ismember($this->gid, 'W2') && !user_ismember($this->gid, 'A')) {
exit_wiki_empty();
}
}
// Set language for phpWiki
if ($this->wiki->getLanguage_id()) {
define('DEFAULT_LANGUAGE', $this->wiki->getLanguage_id());
$LANG = $this->wiki->getLanguage_id();
}
}
示例8: getContent
function getContent()
{
$request = HTTPRequest::instance();
$user = UserManager::instance()->getCurrentUser();
//group id of the user is member
$projects_id_user = $user->getProjects();
$html = '';
$pm = ProjectManager::instance();
foreach ($projects_id_user as $project_id) {
$project = $pm->getProject($project_id);
$project_unix_name = $project->getUnixName();
$project_public_name = $project->getPublicName();
$members_id_array = $project->getMembersUserNames();
if (sizeof($members_id_array) > 1) {
list($hide_now, $count_diff, $hide_url) = my_hide_url('im_group', $project_id, $request->get('hide_item_id'), count($members_id_array), $request->get('hide_im_group'));
$html .= $hide_url;
$html .= '<b>' . $project_public_name . '</b><br>';
if (!$hide_now) {
$html .= '<div style="padding-left:20px;">';
foreach ($members_id_array as $member) {
$html .= $this->plugin->getDisplayPresence($member['user_id'], $member['user_name'], $member['realname']);
$html .= '<br>';
}
$html .= '</div>';
}
}
}
return $html;
}
示例9: _getItemVersionLink
function _getItemVersionLink($version, $noLink = false)
{
$html = '';
if ($version !== null) {
$title = '';
$url = '';
$itemType = Docman_ItemFactory::getItemTypeForItem($this->item);
if ($itemType == PLUGIN_DOCMAN_ITEM_TYPE_EMBEDDEDFILE || $itemType == PLUGIN_DOCMAN_ITEM_TYPE_FILE) {
$vFactory =& new Docman_VersionFactory();
$v = $vFactory->getSpecificVersion($this->item, $version);
if ($v) {
$url = Docman_View_View::buildUrl($this->url, array('action' => 'show', 'id' => $this->item->getId(), 'version_number' => $v->getNumber()));
if ($v->getLabel()) {
$title .= $this->hp->purify($v->getLabel()) . ' - ';
}
}
} elseif ($itemType == PLUGIN_DOCMAN_ITEM_TYPE_WIKI) {
$project_id = $this->item->getGroupId();
$project = ProjectManager::instance()->getProject($project_id);
$pagename = urlencode($this->item->getPagename());
if ($project && $project->usesService('plugin_phpwiki')) {
$url = '/plugins/phpwiki/index.php?group_id=' . $project_id . '&pagename=' . $pagename . '&version=' . $version;
} else {
$url = '/wiki/index.php?group_id=' . $project_id . '&pagename=' . $pagename . '&version=' . $version;
}
}
$title .= $GLOBALS['Language']->getText('plugin_docman', 'details_approval_version_link') . ' ' . $version;
if ($noLink) {
$html .= $title;
} else {
$html .= '<a href="' . $url . '">' . $title . '</a>';
}
}
return $html;
}
示例10: _title
function _title($params)
{
$pm = ProjectManager::instance();
$this->srcGo = $pm->getProject($params['sSrcGroupId']);
$this->dstGo = $pm->getProject($params['group_id']);
echo '<h2>' . $this->_getTitle($params) . ' - ' . $GLOBALS['Language']->getText('plugin_docman', 'admin_md_import_title', array($this->srcGo->getPublicName())) . '</h2>';
}
示例11: displayNotificationEmail
function displayNotificationEmail()
{
$html = '';
$html .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_email_title') . '</h3>';
$atsm = new Docman_ApprovalTableNotificationCycle();
$atsm->setItem($this->item);
$atf =& Docman_ApprovalTableFactoriesFactory::getFromItem($this->item);
$table = $atf->getTable(false);
$atsm->setTable($table);
$um =& UserManager::instance();
$owner =& $um->getUserById($table->getOwner());
$atsm->setOwner($owner);
$atsm->sendNotifReviewer($owner);
$html .= $GLOBALS['Language']->getText('plugin_docman', 'details_approval_email_subject') . ' ' . $atsm->getNotificationSubject() . "\n";
$html .= '<p class="docman_approval_email">';
if (ProjectManager::instance()->getProject($this->item->getGroupId())->getTruncatedEmailsUsage()) {
$html .= $GLOBALS['Language']->getText('plugin_docman', 'truncated_email');
} else {
$html .= htmlentities(quoted_printable_decode($atsm->getNotificationBodyText()), ENT_COMPAT, 'UTF-8');
}
$html .= '</p>';
$backurl = $this->url . '&action=approval_create&id=' . $this->item->getId();
$html .= '<a href="' . $backurl . '">' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_email_back') . '</a>';
return $html;
}
示例12: svn_data_get_revision_detail
function svn_data_get_revision_detail($group_id, $commit_id, $rev_id = 0, $order = '')
{
$order_str = "";
if ($order) {
if ($order != 'filename') {
// SQLi Warning: no real possibility to escape $order here.
// We rely on a proper filtering of user input by calling methods.
$order_str = " ORDER BY " . $order;
} else {
$order_str = " ORDER BY dir, file";
}
}
//check user access rights
$pm = ProjectManager::instance();
$project = $pm->getProject($group_id);
$forbidden = svn_utils_get_forbidden_paths(user_getname(), $project->getSVNRootPath());
$where_forbidden = "";
if (!empty($forbidden)) {
while (list($no_access, ) = each($forbidden)) {
$where_forbidden .= " AND svn_dirs.dir not like '%" . db_es(substr($no_access, 1)) . "%' ";
}
}
// if the subversion revision id is given then it akes precedence on
// the internal commit_id (this is to make it easy for users to build
// URL to access a revision
if ($rev_id) {
// To be done -> get the commit ID from the svn-commit table
$sql = "SELECT svn_commits.description, svn_commits.date, svn_commits.revision, svn_checkins.type,svn_checkins.commitid,svn_dirs.dir,svn_files.file " . "FROM svn_dirs, svn_files, svn_checkins, svn_commits " . "WHERE svn_checkins.fileid=svn_files.id " . "AND svn_checkins.dirid=svn_dirs.id " . "AND svn_checkins.commitid=svn_commits.id " . "AND svn_commits.revision=" . db_ei($rev_id) . " " . "AND svn_commits.group_id=" . db_ei($group_id) . " " . $where_forbidden . $order_str;
} else {
$sql = "SELECT svn_commits.description, svn_commits.date, svn_commits.revision, svn_checkins.type,svn_checkins.commitid,svn_dirs.dir,svn_files.file " . "FROM svn_dirs, svn_files, svn_checkins, svn_commits " . "WHERE svn_checkins.fileid=svn_files.id " . "AND svn_checkins.dirid=svn_dirs.id " . "AND svn_checkins.commitid=svn_commits.id " . "AND svn_commits.id=" . db_ei($commit_id) . " " . $where_forbidden . $order_str;
}
$result = db_query($sql);
return $result;
}
示例13: service_create_service
/**
* Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
*
*
*
*/
function service_create_service($arr, $group_id, $template, $force_enable = false)
{
// Convert link to real values
// NOTE: if you change link variables here, change them also in src/www/project/admin/servicebar.php and src/www/include/Layout.class.php
$link = $arr['link'];
$pm = ProjectManager::instance();
if ($template['system']) {
$link = str_replace('$projectname', $pm->getProject($group_id)->getUnixName(), $link);
$link = str_replace('$sys_default_domain', $GLOBALS['sys_default_domain'], $link);
$link = str_replace('$group_id', $group_id, $link);
if ($GLOBALS['sys_force_ssl']) {
$sys_default_protocol = 'https';
} else {
$sys_default_protocol = 'http';
}
$link = str_replace('$sys_default_protocol', $sys_default_protocol, $link);
} else {
//for non-system templates
$link = service_replace_template_name_in_link($link, $template, $pm->getProject($group_id));
}
$is_used = isset($template['is_used']) ? $template['is_used'] : $arr['is_used'];
$server_id = isset($template['server_id']) ? $template['server_id'] : $arr['server_id'];
$sql = "INSERT INTO service (group_id, label, description, short_name, link, is_active, is_used, scope, rank, location, server_id, is_in_iframe) VALUES (" . db_ei($group_id) . ", '" . db_es($arr['label']) . "', '" . db_es($arr['description']) . "', '" . db_es($arr['short_name']) . "', '" . db_es($link) . "', " . db_ei($arr['is_active']) . ", " . ($force_enable ? 1 : db_ei($is_used)) . ", '" . db_es($arr['scope']) . "', " . db_ei($arr['rank']) . ", '" . db_es($arr['location']) . "', " . db_ei($server_id) . ", " . db_ei($arr['is_in_iframe']) . ")";
$result = db_query($sql);
if ($result) {
// activate corresponding references
$reference_manager =& ReferenceManager::instance();
if ($arr['short_name'] != "") {
$reference_manager->addSystemReferencesForService($template['id'], $group_id, $arr['short_name']);
}
return true;
} else {
return false;
}
}
示例14: aCreationValidator
protected function aCreationValidator($request_data, $required_custom_descriptions) {
$request = aRequest()->withParams($request_data)->build();
$creation_request = new Project_OneStepCreation_OneStepCreationRequest($request, ProjectManager::instance());
$validator = new Project_OneStepCreation_OneStepCreationValidator($creation_request, $required_custom_descriptions);
return $validator;
}
示例15: __construct
/**
* Constructor.
*
* @param Integer $groupId Project Id
* @param Integer $weeksNumber Statistics duration in weeks
*
* @return Void
*/
public function __construct($groupId, $weeksNumber)
{
$dao = new GitDao();
// TODO: Optionally include presonal forks in repo list
$allRepositories = $dao->getProjectRepositoryList($groupId);
$um = UserManager::instance();
$user = $um->getCurrentUser();
$repoFactory = new GitRepositoryFactory($dao, ProjectManager::instance());
foreach ($allRepositories as $repo) {
$repository = $repoFactory->getRepositoryById($repo['repository_id']);
if ($repository->userCanRead($user)) {
$this->repoList[] = $repository;
}
}
$this->displayChart = false;
$this->weeksNumber = min($weeksNumber, self::MAX_WEEKSNUMBER);
// Init some class properties according to 'weeks number' parameter
$today = $_SERVER['REQUEST_TIME'];
$startPeriod = strtotime("-{$this->weeksNumber} weeks");
$weekInSeconds = self::WEEKS_IN_SECONDS;
for ($i = $startPeriod + $weekInSeconds; $i < $today + $weekInSeconds; $i += $weekInSeconds) {
$this->dates[] = date('M d', $i);
$this->weekNum[] = intval(date('W', $i));
$this->year[] = intval(date('Y', $i));
}
}