本文整理汇总了PHP中ReferenceManager::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP ReferenceManager::instance方法的具体用法?PHP ReferenceManager::instance怎么用?PHP ReferenceManager::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReferenceManager
的用法示例。
在下文中一共展示了ReferenceManager::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doCreate
private function doCreate()
{
$projectCreator = new ProjectCreator($this->project_manager, ReferenceManager::instance());
$data = $this->creation_request->getProjectValues();
$creationData = ProjectCreationData::buildFromFormArray($data);
return $projectCreator->build($creationData);
}
示例2: 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;
}
}
示例3: GivenAProjectCreator
/**
* @return ProjectCreator
*/
private function GivenAProjectCreator()
{
$projectManager = new MockProjectManager();
$creator = TestHelper::getPartialMock('ProjectCreator', array('createProject'));
$creator->__construct($projectManager, ReferenceManager::instance());
return $creator;
}
示例4: 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++;
}
}
}
}
}
示例5: onOutputPageBeforeHTML
public static function onOutputPageBeforeHTML(OutputPage &$out, &$text)
{
global $wgTuleapArtLinksGroupId;
$reference_manager = ReferenceManager::instance();
$reference_manager->insertReferences($text, $wgTuleapArtLinksGroupId);
return true;
}
示例6: itCreatesAProject
public function itCreatesAProject()
{
$projectCreator = new ProjectCreator(ProjectManager::instance(), ReferenceManager::instance());
$projectCreator->create('short-name', 'Long name', array('project' => array('form_short_description' => '', 'is_test' => false, 'is_public' => false, 'services' => array(), 'built_from_template' => 100)));
ProjectManager::clearInstance();
$project = ProjectManager::instance()->getProjectByUnixName('short-name');
$this->assertEqual($project->getPublicName(), 'Long name');
}
示例7: __construct
public function __construct(EventManager $event_manager, ProjectManager $project_manager, XML_RNGValidator $xml_validator, UGroupManager $ugroup_manager, User\XML\Import\IFindUserFromXMLReference $user_finder, Logger $logger)
{
$this->event_manager = $event_manager;
$this->project_manager = $project_manager;
$this->xml_validator = $xml_validator;
$this->ugroup_manager = $ugroup_manager;
$this->user_finder = $user_finder;
$this->logger = $logger;
$this->project_creator = new ProjectCreator($this->project_manager, ReferenceManager::instance(), true);
}
示例8: build
/**
* @return Tracker_Artifact_XMLImport
*/
public function build(User\XML\Import\IFindUserFromXMLReference $user_finder)
{
$artifact_factory = Tracker_ArtifactFactory::instance();
$formelement_factory = Tracker_FormElementFactory::instance();
$fields_validator = new Tracker_Artifact_Changeset_AtGivenDateFieldsValidator($formelement_factory);
$changeset_dao = new Tracker_Artifact_ChangesetDao();
$changeset_comment_dao = new Tracker_Artifact_Changeset_CommentDao();
$logger = new Log_ConsoleLogger();
$send_notifications = false;
$artifact_creator = new Tracker_ArtifactCreator($artifact_factory, $fields_validator, new Tracker_Artifact_Changeset_InitialChangesetAtGivenDateCreator($fields_validator, $formelement_factory, $changeset_dao, $artifact_factory, EventManager::instance()));
$new_changeset_creator = new Tracker_Artifact_Changeset_NewChangesetAtGivenDateCreator($fields_validator, $formelement_factory, $changeset_dao, $changeset_comment_dao, $artifact_factory, EventManager::instance(), ReferenceManager::instance());
return new Tracker_Artifact_XMLImport(new XML_RNGValidator(), $artifact_creator, $new_changeset_creator, Tracker_FormElementFactory::instance(), $user_finder, new Tracker_FormElement_Field_List_Bind_Static_ValueDao(), $logger, $send_notifications);
}
示例9: getReferencesTable
function getReferencesTable($groupId)
{
$html = '';
$html .= '<h3>' . $GLOBALS['Language']->getText('project_showdetails', 'references') . '</h3>';
$title_arr[] = $GLOBALS['Language']->getText('project_reference', 'r_keyword');
$title_arr[] = $GLOBALS['Language']->getText('project_reference', 'r_desc');
$title_arr[] = $GLOBALS['Language']->getText('project_reference', 'r_link');
$html .= html_build_list_table_top($title_arr, false, false, true);
$referenceManager =& ReferenceManager::instance();
$references =& $referenceManager->getReferencesByGroupId($groupId);
// References are sorted by scope first
$row_num = 0;
foreach ($references as $ref) {
$html .= getReferenceRow($ref, $row_num);
$row_num++;
}
$html .= '</table>';
return $html;
}
示例10: create
/**
* create - use this to create a new ArtifactType in the database.
*
* @param group_id: the group id of the new tracker
* @param group_id_template: the template group id (used for the copy)
* @param atid_template: the template artfact type id
* @param name: the name of the new tracker
* @param description: the description of the new tracker
* @param itemname: the itemname of the new tracker
* @return id on success, false on failure.
*/
function create($group_id, $group_id_template, $atid_template, $name, $description, $itemname, $ugroup_mapping = false, &$report_mapping = array())
{
global $Language;
if (!$name || !$description || !$itemname || trim($name) == "" || trim($description) == "" || trim($itemname) == "") {
$this->setError('ArtifactTypeFactory: ' . $Language->getText('tracker_common_type', 'name_requ'));
return false;
}
// Necessary test to avoid issues when exporting the tracker to a DB (e.g. '-' not supported as table name)
if (!eregi("^[a-zA-Z0-9_]+\$", $itemname)) {
$this->setError($Language->getText('tracker_common_type', 'invalid_shortname', $itemname));
return false;
}
$reference_manager = ReferenceManager::instance();
if ($reference_manager->_isKeywordExists($itemname, $group_id)) {
$this->setError($Language->getText('tracker_common_type', 'shortname_already_exists', $itemname));
return false;
}
if ($this->isNameExists($name, $group_id)) {
$this->setError($Language->getText('tracker_common_type', 'name_already_exists', $name));
return false;
}
// get the template Group object
$pm = ProjectManager::instance();
$template_group = $pm->getProject($group_id_template);
if (!$template_group || !is_object($template_group) || $template_group->isError()) {
$this->setError('ArtifactTypeFactory: ' . $Language->getText('tracker_common_type', 'invalid_templ'));
}
// get the Group object of the new tracker
$pm = ProjectManager::instance();
$group = $pm->getProject($group_id);
if (!$group || !is_object($group) || $group->isError()) {
$this->setError('ArtifactTypeFactory: ' . $Language->getText('tracker_common_type', 'invalid_templ'));
}
// We retrieve allow_copy from template
$at_template = new ArtifactType($template_group, $atid_template);
$id_sharing = new TrackerIdSharingDao();
if ($id = $id_sharing->generateTrackerId()) {
// First, we create a new ArtifactType into artifact_group_list
// By default, set 'instantiate_for_new_projects' to '1', so that a project that is not yet a
// template will be able to have its trackers cloned by default when it becomes a template.
$sql = "INSERT INTO \n artifact_group_list \n (group_artifact_id, group_id, name, description, item_name, allow_copy,\n submit_instructions,browse_instructions,instantiate_for_new_projects,stop_notification\n ) \n VALUES \n ({$id},\n '" . db_ei($group_id) . "',\n '" . db_es($name) . "',\n '" . db_es($description) . "',\n '" . db_es($itemname) . "',\n '" . db_ei($at_template->allowsCopy()) . "',\n '" . db_es($at_template->getSubmitInstructions()) . "',\n '" . db_es($at_template->getBrowseInstructions()) . "',1,0)";
//echo $sql;
$res = db_query($sql);
if (!$res || db_affected_rows($res) <= 0) {
$this->setError('ArtifactTypeFactory: ' . db_error());
return false;
} else {
//No need to get the last insert id since we already know the id : $id
//$id = db_insertid($res,'artifact_group_list','group_artifact_id');
$at_new = new ArtifactType($group, $id);
if (!$at_new->fetchData($id)) {
$this->setError('ArtifactTypeFactory: ' . $Language->getText('tracker_common_type', 'load_fail'));
return false;
} else {
//create global notifications
$sql = "INSERT INTO artifact_global_notification (tracker_id, addresses, all_updates, check_permissions)\n SELECT " . db_ei($id) . ", addresses, all_updates, check_permissions\n FROM artifact_global_notification\n WHERE tracker_id = " . db_ei($atid_template);
$res = db_query($sql);
if (!$res || db_affected_rows($res) <= 0) {
$this->setError('ArtifactTypeFactory: ' . db_error());
}
// Create fieldset factory
$art_fieldset_fact = new ArtifactFieldSetFactory($at_template);
// Then copy all the field sets.
$mapping_field_set_array = $art_fieldset_fact->copyFieldSets($atid_template, $id);
if (!$mapping_field_set_array) {
$this->setError('ArtifactTypeFactory: ' . $art_fieldset_fact->getErrorMessage());
return false;
}
// Create field factory
$art_field_fact = new ArtifactFieldFactory($at_template);
// Then copy all the fields informations
if (!$art_field_fact->copyFields($id, $mapping_field_set_array, $ugroup_mapping)) {
$this->setError('ArtifactTypeFactory: ' . $art_field_fact->getErrorMessage());
return false;
}
// Then copy all the reports informations
// Create field factory
$art_report_fact = new ArtifactReportFactory();
if (!($report_mapping = $art_report_fact->copyReports($atid_template, $id))) {
$this->setError('ArtifactTypeFactory: ' . $art_report_fact->getErrorMessage());
return false;
}
$em =& EventManager::instance();
$pref_params = array('atid_source' => $atid_template, 'atid_dest' => $id);
$em->processEvent('artifactType_created', $pref_params);
// Copy artifact_notification_event and artifact_notification_role
if (!$at_new->copyNotificationEvent($id)) {
return false;
}
//.........这里部分代码省略.........
示例11: getHTMLDisplayCrossRefs
function getHTMLDisplayCrossRefs($with_links = true, $condensed = false, $isBrowser = true)
{
global $Language;
/**
* Array of cross references grouped by nature (to easy cross reference display)
* Array has the form:
* ['nature1'] => array (
* ['both'] => array (
* CrossReference1,
* CrossReference2,
* ...)
* ['source'] => array (
* CrossReference3,
* CrossReference4,
* ...)
* ['target'] => array (
* CrossReference3,
* CrossReference4,
* ...)
* ['nature2'] => array (
* ['both'] => array (
* CrossReference5,
* CrossReference6,
* ...)
* ['source'] => array (
* CrossReference7,
* CrossReference8,
* ...)
* ['target'] => array (
* CrossReference9,
* CrossReference10,
* ...)
* ...
*/
$crossRefArray = $this->getCrossReferences();
$reference_manager = ReferenceManager::instance();
$available_natures = $reference_manager->getAvailableNatures();
$user = UserManager::instance()->getCurrentUser();
$itemIsReferenced = false;
if ($isBrowser && ($user->isSuperUser() || $user->isMember($this->entity_gid, 'A'))) {
$can_delete = true;
} else {
$can_delete = false;
}
$classes = array('both' => 'cross_reference', 'source' => 'referenced_by', 'target' => 'reference_to');
$img = array('both' => array('both_arrows', 'cross_referenced'), 'source' => array('left_arrow', 'referenced_in'), 'target' => array('right_arrow', 'reference_to'));
$message = addslashes($GLOBALS['Language']->getText('cross_ref_fact_include', 'confirm_delete'));
// HTML part (stored in $display)
$display = '';
if (!$condensed) {
$display .= '<p id="cross_references_legend">' . $Language->getText('cross_ref_fact_include', 'legend') . '</p>';
}
// loop through natures
foreach ($crossRefArray as $nature => $refArraySourceTarget) {
$display .= '<div class="nature">';
if (!$condensed) {
$display .= "<p><b>" . $available_natures[$nature]['label'] . "</b>";
}
// loop through each type of target
$display .= '<ul class="cross_reference_list">';
foreach (array('both', 'target', 'source') as $key) {
if (array_key_exists($key, $refArraySourceTarget)) {
// one li for one type of ref (both, target, source)
$display .= '<li class="' . $classes[$key] . '">';
$display .= $GLOBALS['HTML']->getImage('ic/' . $img[$key][0] . '.png', array('alt' => $Language->getText('cross_ref_fact_include', $img[$key][1]), 'align' => 'top-left', 'hspace' => '5', 'title' => $Language->getText('cross_ref_fact_include', $img[$key][1])));
// the refs
$spans = array();
foreach ($refArraySourceTarget[$key] as $currRef) {
$span = '';
if ($key === 'source') {
$id = $currRef->getRefSourceKey() . "_" . $currRef->getRefSourceId();
$ref = $currRef->getRefSourceKey() . " #" . $currRef->getRefSourceId();
$url = $currRef->getRefSourceUrl();
} else {
$id = $currRef->getRefTargetKey() . "_" . $currRef->getRefTargetId();
$ref = $currRef->getRefTargetKey() . " #" . $currRef->getRefTargetId();
$url = $currRef->getRefTargetUrl();
}
$span .= '<span id="' . $id . '" class="link_to_ref">';
if ($with_links) {
$span .= '<a class="cross-reference"
title="' . $available_natures[$nature]['label'] . '"
href="' . $url . '">';
$span .= $ref . '</a>';
} else {
$span .= $ref;
}
if ($with_links && $can_delete && !$condensed) {
$params = $this->getParams($currRef);
$span .= '<a class="delete_ref"
href="/reference/rmreference.php' . $params . '"
onClick="return delete_ref(\'' . $id . '\', \'' . $message . '\');">';
$span .= $GLOBALS['HTML']->getImage('ic/cross.png', array('alt' => $Language->getText('cross_ref_fact_include', 'delete'), 'title' => $Language->getText('cross_ref_fact_include', 'delete')));
$span .= '</a>';
}
$spans[] = $span;
}
$display .= implode(', </span>', $spans) . '</span>';
$display .= '</li>';
}
//.........这里部分代码省略.........
示例12: frs_process_release_form
function frs_process_release_form($is_update, $request, $group_id, $title, $url)
{
global $frspf, $frsrf, $frsff;
$pm = ProjectManager::instance();
//get and filter all inputs from $request
$release = array();
$res = $request->get('release');
$vName = new Valid_String();
$vPackage_id = new Valid_UInt();
$vStatus_id = new Valid_UInt();
if ($vName->validate($res['name']) && $vPackage_id->validate($res['package_id']) && $vStatus_id->validate($res['status_id'])) {
$release['status_id'] = $res['status_id'];
$release['name'] = $res['name'];
$release['package_id'] = $res['package_id'];
} else {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('file_admin_editreleases', 'rel_update_failed'));
$GLOBALS['Response']->redirect('/file/showfiles.php?group_id=' . $group_id);
}
$um = UserManager::instance();
$user = $um->getCurrentUser();
$vDate = new Valid_String();
if ($vDate->validate($res['date'])) {
$release['date'] = $res['date'];
} else {
$release['date'] = "";
}
$vRelease_notes = new Valid_Text();
if ($vRelease_notes->validate($res['release_notes'])) {
$release['release_notes'] = $res['release_notes'];
} else {
$release['release_notes'] = "";
}
$vChange_log = new Valid_Text();
if ($vChange_log->validate($res['change_log'])) {
$release['change_log'] = $res['change_log'];
} else {
$release['change_log'] = "";
}
if ($request->valid(new Valid_String('js'))) {
$js = $request->get('js');
} else {
$js = "";
}
if ($request->validArray(new Valid_String('ftp_file'))) {
$ftp_file = $request->get('ftp_file');
} else {
$ftp_file = array();
}
if ($request->validArray(new Valid_UInt('file_processor'))) {
$file_processor = $request->get('file_processor');
} else {
$file_processor = array();
}
if ($request->validArray(new Valid_UInt('file_type'))) {
$file_type = $request->get('file_type');
} else {
$file_type = array();
}
if ($request->validArray(new Valid_String('reference_md5'))) {
$reference_md5 = $request->get('reference_md5');
} else {
$reference_md5 = array();
}
if ($request->validArray(new Valid_String('comment'))) {
$comment = $request->get('comment');
} else {
$comment = array();
}
if ($request->validArray(new Valid_UInt('ftp_file_processor'))) {
$ftp_file_processor = $request->get('ftp_file_processor');
} else {
$ftp_file_processor = array();
}
if ($request->validArray(new Valid_UInt('ftp_file_type'))) {
$ftp_file_type = $request->get('ftp_file_type');
} else {
$ftp_file_type = array();
}
if ($request->validArray(new Valid_String('ftp_reference_md5'))) {
$ftp_reference_md5 = $request->get('ftp_reference_md5');
} else {
$ftp_reference_md5 = array();
}
if ($request->valid(new Valid_String('release_news_subject'))) {
$release_news_subject = $request->get('release_news_subject');
} else {
$release_news_subject = "";
}
if ($request->valid(new Valid_Text('release_news_details'))) {
$release_news_details = $request->get('release_news_details');
} else {
$release_news_details = "";
}
if ($request->valid(new Valid_WhiteList('private_news', array(0, 1)))) {
$private_news = $request->get('private_news');
} else {
$private_news = 0;
}
if ($request->validArray(new Valid_UInt('ugroups'))) {
$ugroups = $request->get('ugroups');
//.........这里部分代码省略.........
示例13: GitDao
* along with Tuleap. If not, see <http://www.gnu.org/licenses/>.
*/
require_once 'pre.php';
$git_dao = new GitDao();
$user_manager = UserManager::instance();
$git_repository_factory = new GitRepositoryFactory($git_dao, ProjectManager::instance());
$system_event_manager = new Git_SystemEventManager(SystemEventManager::instance(), $git_repository_factory);
$git_plugin = PluginManager::instance()->getPluginByName('git');
$logger = $git_plugin->getLogger();
if ($argv[1] == "--init") {
$repository_path = $argv[2];
$user_name = $argv[3];
$repository = $git_repository_factory->getFromFullPath($repository_path);
if ($repository) {
$system_event_manager->queueGrokMirrorManifestFollowingAGitPush($repository);
}
} else {
$repository_path = $argv[1];
$user_name = $argv[2];
$old_rev = $argv[3];
$new_rev = $argv[4];
$refname = $argv[5];
try {
$git_exec = new Git_Exec($repository_path, $repository_path);
$post_receive = new Git_Hook_PostReceive(new Git_Hook_LogAnalyzer($git_exec, $logger), $git_repository_factory, $user_manager, new Git_Ci_Launcher(new Jenkins_Client(new Http_Client()), new Git_Ci_Dao(), $logger), new Git_Hook_ParseLog(new Git_Hook_LogPushes($git_dao), new Git_Hook_ExtractCrossReferences($git_exec, ReferenceManager::instance()), $logger));
$post_receive->execute($repository_path, $user_name, $old_rev, $new_rev, $refname);
} catch (Exception $exception) {
$logger->error("[git post-receive] {$repository_path} {$user_name} {$refname} {$old_rev} {$new_rev} " . $exception->getMessage());
exit(1);
}
}
示例14: extractCrossRefs
protected function extractCrossRefs($artifact, $content)
{
return ReferenceManager::instance()->extractCrossRef($content, $artifact->getId(), Tracker_Artifact::REFERENCE_NATURE, $this->getTracker()->getGroupID(), UserManager::instance()->getCurrentUser()->getId(), $this->getTracker()->getItemName());
}
示例15: getReferenceManager
/**
* @return ReferenceManager
*/
protected function getReferenceManager()
{
return ReferenceManager::instance();
}