本文整理匯總了PHP中Tracker_ArtifactFactory::instance方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tracker_ArtifactFactory::instance方法的具體用法?PHP Tracker_ArtifactFactory::instance怎麽用?PHP Tracker_ArtifactFactory::instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tracker_ArtifactFactory
的用法示例。
在下文中一共展示了Tracker_ArtifactFactory::instance方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: instance
/**
* Returns an instance of Tracker_HierarchyFactory (creating it when needed).
*
* We should usually prefer dependency injection over static methods, but
* there are some cases in Tuleap legacy code where injection would require
* a lot of refactoring (e.g. Tracker/FormElement).
*
* @return Tracker_HierarchyFactory
*/
public static function instance()
{
if (!self::$_instance) {
self::$_instance = new Tracker_HierarchyFactory(new Tracker_Hierarchy_Dao(), TrackerFactory::instance(), Tracker_ArtifactFactory::instance());
}
return self::$_instance;
}
示例2: activatePlugins
public function activatePlugins()
{
$this->activatePlugin('tracker');
$this->activatePlugin('agiledashboard');
$this->activatePlugin('cardwall');
PluginManager::instance()->loadPlugins();
$this->tracker_artifact_factory = Tracker_ArtifactFactory::instance();
$this->tracker_formelement_factory = Tracker_FormElementFactory::instance();
$this->tracker_factory = TrackerFactory::instance();
return $this;
}
示例3: build
/**
* @return Tracker_CrossSearch_SearchView
*/
public function build(User $user, Project $project, Tracker_CrossSearch_Query $cross_search_query)
{
$report = $this->getReport($user);
$service = $this->getService($project);
$criteria = $this->getCriteria($user, $project, $report, $cross_search_query);
$trackers = $this->tracker_factory->getTrackersByGroupIdUserCanView($project->getGroupId(), $user);
$tracker_ids = $this->getTrackersIds($trackers);
$artifacts = $this->getHierarchicallySortedArtifacts($user, $project, $tracker_ids, $cross_search_query);
$content_view = new Tracker_CrossSearch_SearchContentView($report, $criteria, $artifacts, Tracker_ArtifactFactory::instance(), $this->form_element_factory, $user);
return new Tracker_CrossSearch_SearchView($project, $service, $criteria, $trackers, $content_view);
}
示例4: __construct
public function __construct(Cardwall_PaneInfo $info, Planning_Milestone $milestone, Cardwall_OnTop_Config $config, PFUser $user, Planning_MilestoneFactory $milestone_factory)
{
$this->info = $info;
$this->milestone = $milestone;
$this->config = $config;
$this->user = $user;
$this->milestone_factory = $milestone_factory;
$this->artifact_factory = Tracker_ArtifactFactory::instance();
$this->tracker_form_element_factory = Tracker_FormElementFactory::instance();
$this->user_manager = UserManager::instance();
$this->planning_factory = PlanningFactory::build();
}
示例5: 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);
}
示例6: activatePlugins
public function activatePlugins()
{
$this->activatePlugin('tracker');
$this->activatePlugin('agiledashboard');
$this->activatePlugin('cardwall');
PluginManager::instance()->invalidateCache();
PluginManager::instance()->loadPlugins();
$this->tracker_artifact_factory = Tracker_ArtifactFactory::instance();
$this->tracker_formelement_factory = Tracker_FormElementFactory::instance();
$this->tracker_factory = TrackerFactory::instance();
$this->hierarchy_checker = new AgileDashboard_HierarchyChecker(PlanningFactory::build(), new AgileDashboard_KanbanFactory($this->tracker_factory, new AgileDashboard_KanbanDao()), $this->tracker_factory);
return $this;
}
示例7: buildData
/**
* build bar chart data
*
* @param Gantt_Engine object
* @return array data array
*/
function buildData($engine)
{
$engine->data = array();
$ff = Tracker_FormElementFactory::instance();
$field_start = $this->chart->getField_start() ? $ff->getFormElementById($this->chart->getField_start()) : null;
$field_due = $this->chart->getField_due() ? $ff->getFormElementById($this->chart->getField_due()) : null;
$field_finish = $this->chart->getField_finish() ? $ff->getFormElementById($this->chart->getField_finish()) : null;
$field_percentage = $this->chart->getField_percentage() ? $ff->getFormElementById($this->chart->getField_percentage()) : null;
$field_righttext = $this->chart->getField_righttext() ? $ff->getFormElementById($this->chart->getField_righttext()) : null;
$field_summary = $this->chart->getSummary() ? $ff->getFormElementById($this->chart->getSummary()) : null;
$af = Tracker_ArtifactFactory::instance();
$changesets = explode(',', $this->artifacts['last_changeset_id']);
foreach (explode(',', $this->artifacts['id']) as $i => $aid) {
if ($artifact = $af->getArtifactByid($aid)) {
if ($changeset = $artifact->getChangeset($changesets[$i])) {
$data = array('id' => $aid, 'summary' => '#' . $aid, 'start' => 0, 'due' => 0, 'finish' => 0, 'progress' => 0, 'right' => '', 'hint' => '#' . $aid, 'links' => TRACKER_BASE_URL . '/?aid=' . $aid);
if ($field_start) {
$data['start'] = $field_start->fetchRawValueFromChangeset($changeset);
}
if ($field_due) {
$data['due'] = $field_due->fetchRawValueFromChangeset($changeset);
}
if ($field_finish) {
$data['finish'] = $field_finish->fetchRawValueFromChangeset($changeset);
}
if ($field_percentage) {
$data['progress'] = $field_percentage->fetchRawValueFromChangeset($changeset);
}
if ($field_righttext) {
$data['right'] = $field_righttext->fetchRawValueFromChangeset($changeset);
}
if ($field_summary) {
$data['hint'] = $data['summary'] = $field_summary->fetchRawValueFromChangeset($changeset);
}
if ($data['progress'] < 0) {
$data['progress'] = 0;
} else {
if ($data['progress'] > 100) {
$data['progress'] = 1;
} else {
$data['progress'] = $data['progress'] / 100;
}
}
$engine->data[] = $data;
}
}
}
usort($engine->data, array($this, 'sortByDate'));
return $engine->data;
}
示例8: build
public function build(User $user, Project $project, Tracker_CrossSearch_Query $cross_search_query, array $already_planned_artifact_ids, array $backlog_tracker_ids, Planning $planning, Planning_BacklogActionsPresenter $backlog_actions_presenter, $planning_redirect_parameter)
{
$report = $this->getReport($user);
$criteria = $this->getCriteria($user, $project, $report, $cross_search_query);
$artifacts = $this->getHierarchicallySortedArtifacts($user, $project, $backlog_tracker_ids, $cross_search_query, $already_planned_artifact_ids);
// The following lines allows to tailor/rebuild the result before display
// As of today (aug-12), we decided to display everything and to wait for
// user feedback to see if we need to enable one of them.
//$visitor = new Planning_BacklogItemFilterVisitor($backlog_tracker_id, $this->hierarchy_factory, $already_planned_artifact_ids);
//$artifacts = $artifacts->accept($visitor);
//$visitor = new Planning_GroupByParentsVisitor($user);
//$artifacts->accept($visitor);
return new Planning_SearchContentView($report, $criteria, $artifacts, Tracker_ArtifactFactory::instance(), $this->form_element_factory, $user, $backlog_actions_presenter, $planning, $planning_redirect_parameter);
}
示例9: fetchCSVChangesetValue
/**
* Display the field for CSV export
* Used in CSV data export
*
* @param int $artifact_id the corresponding artifact id
* @param int $changeset_id the corresponding changeset
* @param mixed $value the value of the field
*
* @return string
*/
public function fetchCSVChangesetValue($artifact_id, $changeset_id, $value, $report)
{
$values = array();
$artifact = Tracker_ArtifactFactory::instance()->getArtifactById($artifact_id);
if ($artifact->useArtifactPermissions()) {
$dao = new Tracker_Artifact_Changeset_ValueDao();
$row = $dao->searchByFieldId($changeset_id, $this->id)->getRow();
$changeset_value_id = $row['id'];
foreach ($this->getValueDao()->searchByChangesetValueId($changeset_value_id) as $value) {
$name = $this->getUGroupDao()->searchByUGroupId($value['ugroup_id'])->getRow();
$values[] = util_translate_name_ugroup($name['name']);
}
return implode(',', $values);
}
return '';
}
開發者ID:uniteddiversity,項目名稱:tuleap,代碼行數:26,代碼來源:Tracker_FormElement_Field_PermissionsOnArtifact.class.php
示例10: ajax_reference_tooltip
public function ajax_reference_tooltip($params)
{
require_once 'Tracker/Artifact/Tracker_ArtifactFactory.class.php';
if ($params['reference']->getServiceShortName() == 'plugin_tracker') {
if ($params['reference']->getNature() == Tracker_Artifact::REFERENCE_NATURE) {
$user = UserManager::instance()->getCurrentUser();
$aid = $params['val'];
require_once 'Tracker/Artifact/Tracker_ArtifactFactory.class.php';
if ($artifact = Tracker_ArtifactFactory::instance()->getArtifactByid($aid)) {
if ($artifact && $artifact->getTracker()->isActive()) {
echo $artifact->fetchTooltip($user);
} else {
echo $GLOBALS['Language']->getText('plugin_tracker_common_type', 'artifact_not_exist');
}
}
}
}
}
示例11: indexAllArtifacts
private function indexAllArtifacts(Tracker $tracker)
{
$tracker_id = $tracker->getId();
$tracker_artifact_factory = Tracker_ArtifactFactory::instance();
$tracker_artifact_iterator = new Tracker_Artifact_BatchIterator($tracker_artifact_factory, $tracker_id);
$this->logger->debug('[Tracker] ElasticSearch: indexing all artifacts of tracker #' . $tracker_id);
$tracker_artifact_iterator->rewind();
while ($batch = $tracker_artifact_iterator->next()) {
foreach ($batch as $artifact) {
$this->indexArtifactUpdate($artifact);
}
}
}
示例12: getArtifactFactory
public function getArtifactFactory()
{
return Tracker_ArtifactFactory::instance();
}
示例13: clearInstance
/**
* Allows clear factory instance for test. DO NOT USE IT IN PRODUCTION!
*
* @param Tracker_ArtifactFactory $factory
*/
public static function clearInstance()
{
self::$instance = null;
}
示例14: fetchChangesetValue
public function fetchChangesetValue($artifact_id, $changeset_id, $value, $report = null, $from_aid = null)
{
$current_user = UserManager::instance()->getCurrentUser();
$artifact = Tracker_ArtifactFactory::instance()->getArtifactById($artifact_id);
return $this->getComputedValue($current_user, $artifact);
}
示例15: getSearchResults
public function getSearchResults(array $result)
{
$results = array();
$validator = new ElasticSearch_1_2_ResultValidator();
if (!isset($result['hits']['hits'])) {
return $results;
}
$user = $this->user_manager->getCurrentUser();
foreach ($result['hits']['hits'] as $hit) {
$project = $this->project_manager->getProject($this->extractGroupIdFromHit($hit));
$index = $this->extractIndexFromHit($hit);
if ($project->isError()) {
continue;
}
try {
$this->url_verification->userCanAccessProject($user, $project);
} catch (Project_AccessPrivateException $exception) {
continue;
}
switch ($index) {
case fulltextsearchPlugin::SEARCH_DOCMAN_TYPE:
if (!$validator->isDocmanResultValid($hit)) {
continue;
}
$results[] = new ElasticSearch_SearchResultDocman($hit, $project);
break;
case fulltextsearchPlugin::SEARCH_WIKI_TYPE:
if (!$validator->isWikiResultValid($hit)) {
continue;
}
$wiki = new Wiki($project->getID());
if ($wiki->isAutorized($user->getId())) {
$results[] = new ElasticSearch_SearchResultWiki($hit, $project);
}
break;
case fulltextsearchPlugin::SEARCH_TRACKER_TYPE:
if (!$validator->isArtifactResultValid($hit)) {
continue;
}
$artifact = Tracker_ArtifactFactory::instance()->getArtifactById($hit['fields']['id'][0]);
if ($artifact->userCanView($user)) {
$results[] = new ElasticSearch_SearchResultTracker($hit, $project, $artifact);
}
break;
default:
}
}
return $results;
}