本文整理匯總了PHP中Tracker_ArtifactFactory類的典型用法代碼示例。如果您正苦於以下問題:PHP Tracker_ArtifactFactory類的具體用法?PHP Tracker_ArtifactFactory怎麽用?PHP Tracker_ArtifactFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Tracker_ArtifactFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getCards
/**
* @return array
*/
public function getCards(array $artifact_ids, Tracker_ArtifactFactory $artifact_factory)
{
$cards = array();
foreach ($artifact_ids as $id) {
$cards[] = new ArtifactNode($artifact_factory->getArtifactById($id));
}
return $cards;
}
示例2: tearDown
public function tearDown()
{
parent::tearDown();
$_SERVER['REQUEST_URI'] = $this->saved_request_uri;
Tracker_ArtifactFactory::clearInstance();
Tracker_Hierarchy_HierarchicalTrackerFactory::clearInstance();
TrackerFactory::clearInstance();
}
示例3: process
public function process(Tracker_IDisplayTrackerLayout $layout, Codendi_Request $request, PFUser $current_user)
{
if (!$this->tracker->userCanSubmitArtifact($current_user)) {
$this->logsErrorAndRedirectToTracker('plugin_tracker_admin', 'access_denied');
return;
}
$from_artifact = $this->artifact_factory->getArtifactByIdUserCanView($current_user, $request->get('from_artifact_id'));
if (!$from_artifact || $from_artifact->getTracker() !== $this->tracker) {
$this->logsErrorAndRedirectToTracker('plugin_tracker_include_type', 'error_missing_param');
return;
}
$from_changeset = $from_artifact->getChangeset($request->get('from_changeset_id'));
if (!$from_changeset) {
$this->logsErrorAndRedirectToTracker('plugin_tracker_include_type', 'error_missing_param');
return;
}
$submitted_values = $request->get('artifact');
if (!is_array($submitted_values)) {
$this->logsErrorAndRedirectToTracker('plugin_tracker_include_type', 'error_missing_param');
return;
}
try {
$this->processCopy($from_changeset, $current_user, $submitted_values);
} catch (Tracker_XML_Exporter_TooManyChildrenException $exception) {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_artifact', 'copy_too_many_children', array(Tracker_XML_ChildrenCollector::MAX)));
$this->redirectToArtifact($from_artifact);
}
}
示例4: getArtifactsFromArtifactInfo
private function getArtifactsFromArtifactInfo($artifacts_info)
{
$artifacts = array();
foreach ($artifacts_info as $artifact_info) {
$artifacts[] = $this->artifact_factory->getArtifactById($artifact_info['id']);
}
return $artifacts;
}
示例5: getReference
/**
* @return mixed Tracker_Reference || null
*/
public function getReference($keyword, $artifact_id)
{
$artifact = $this->artifact_factory->getArtifactById($artifact_id);
if (!$artifact) {
return null;
}
return $this->getTrackerReference($artifact, $keyword);
}
示例6: createWithValuesIndexedByFieldName
/**
*
* @param PFUser $user
* @param Tuleap\Tracker\REST\TrackerReference $tracker_reference
* @param array $values
* @return Tuleap\Tracker\REST\Artifact\ArtifactReference
* @throws \Luracast\Restler\RestException
*/
public function createWithValuesIndexedByFieldName(PFUser $user, Tuleap\Tracker\REST\TrackerReference $tracker_reference, array $values)
{
$tracker = $this->getTracker($tracker_reference);
$fields_data = $this->artifact_validator->getFieldsDataOnCreateFromValuesByField($values, $tracker);
$fields_data = $this->artifact_validator->getUsedFieldsWithDefaultValue($tracker, $fields_data, $user);
$this->checkUserCanSubmit($user, $tracker);
return $this->returnReferenceOrError($this->artifact_factory->createArtifact($tracker, $fields_data, $user, ''), 'by_field');
}
示例7: linkArtifact
private function linkArtifact(PFUser $current_user, Tracker_Artifact $new_artifact)
{
$artifact_link_id = $this->request->get('artifact-link-id');
$source_artifact = $this->tracker_artifact_factory->getArtifactById($artifact_link_id);
if (!$source_artifact) {
return;
}
$source_artifact->linkArtifact($new_artifact->getId(), $current_user);
}
示例8: getCardsPresenters
protected function getCardsPresenters(array $artifact_ids)
{
$cards = array();
foreach ($artifact_ids as $id) {
$artifact = $this->artifact_factory->getArtifactById($id);
$cards[] = $this->presenter_builder->getCardInCellPresenter($artifact, Cardwall_SwimlineTrackerRenderer::FAKE_SWIMLINE_ID_FOR_TRACKER_RENDERER);
}
return $cards;
}
示例9: getSourceArtifact
private function getSourceArtifact()
{
$source_artifact = null;
if ($this->request->get('func') == 'new-artifact-link') {
$source_artifact = $this->artifact_factory->getArtifactById($this->request->get('id'));
} elseif ($this->request->get('child_milestone')) {
$source_artifact = $this->artifact_factory->getArtifactById($this->request->get('child_milestone'));
}
return $source_artifact;
}
示例10: export
public function export(Tracker $tracker, SimpleXMLElement $xml_content, PFUser $user, ZipArchive $archive)
{
$artifacts_node = $xml_content->addChild('artifacts');
$all_artifacts = $this->artifact_factory->getArtifactsByTrackerId($tracker->getId());
$this->checkThreshold(count($all_artifacts));
foreach ($all_artifacts as $artifact) {
$artifact->exportToXML($artifacts_node, $user, $archive);
}
$this->rng_validator->validate($artifacts_node, realpath(dirname(TRACKER_BASE_DIR) . self::ARTIFACTS_RNG_PATH));
}
示例11: saveArtifactAfterNewChangeset
/**
* Should we move this method outside of changeset creation
* so that we can remove the dependency on artifact factory
* and enforce SRP ?
*/
protected function saveArtifactAfterNewChangeset(Tracker_Artifact $artifact, array $fields_data, PFUser $submitter, Tracker_Artifact_Changeset $new_changeset, Tracker_Artifact_Changeset $previous_changeset = null)
{
if ($this->artifact_factory->save($artifact)) {
$used_fields = $this->formelement_factory->getUsedFields($artifact->getTracker());
foreach ($used_fields as $field) {
$field->postSaveNewChangeset($artifact, $submitter, $new_changeset, $previous_changeset);
}
$artifact->getWorkflow()->after($fields_data, $new_changeset, $previous_changeset);
return true;
}
return false;
}
示例12: getPossibleArtifactParents
public function getPossibleArtifactParents(Tracker $parent_tracker, PFUser $user, $limit, $offset)
{
$label = '';
$possible_parents = array();
$display_selector = true;
EventManager::instance()->processEvent(TRACKER_EVENT_ARTIFACT_PARENTS_SELECTOR, array('user' => $user, 'parent_tracker' => $parent_tracker, 'possible_parents' => &$possible_parents, 'label' => &$label, 'display_selector' => &$display_selector));
if (!$possible_parents) {
$label = $GLOBALS['Language']->getText('plugin_tracker_artifact', 'formelement_artifactlink_open_parent', array($parent_tracker->getName()));
$possible_parents = $this->artifact_factory->getPaginatedPossibleParentArtifactsUserCanView($user, $parent_tracker->getId(), $limit, $offset);
}
return array($label, $possible_parents, $display_selector);
}
示例13: exportChildren
public function exportChildren(SimpleXMLElement $xml)
{
while ($artifact_id = $this->children_collector->pop()) {
$artifact = $this->artifact_factory->getArtifactById($artifact_id);
if (!$artifact) {
continue;
}
$last_changeset = $artifact->getLastChangeset();
$this->artifact_xml_updater->exportSnapshotWithoutComments($xml, $last_changeset);
$index_last_artifact = count($xml->artifact) - 1;
$this->file_xml_updater->update($xml->artifact[$index_last_artifact]);
}
}
示例14: getArtifactLinkTitle
private function getArtifactLinkTitle($id)
{
if ($artifact = $this->artifact_factory->getArtifactByIdUserCanView($this->user, $id)) {
return $artifact->getTitle();
}
return '';
}
示例15: getArtifact
private function getArtifact($artifact_id)
{
$artifact = $this->artifact_factory->getArtifactById($artifact_id);
if (!$artifact) {
throw new Tracker_Artifact_MailGateway_RecipientArtifactDoesNotExistException();
}
return $artifact;
}