本文整理汇总了PHP中Tracker_Artifact类的典型用法代码示例。如果您正苦于以下问题:PHP Tracker_Artifact类的具体用法?PHP Tracker_Artifact怎么用?PHP Tracker_Artifact使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tracker_Artifact类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
$changeset_factory = mock('Tracker_Artifact_ChangesetFactory');
$this->tracker = aMockTracker()->withId(1)->build();
$this->new_artifact = partial_mock('Tracker_Artifact', array('createNewChangeset'));
$this->new_artifact->setId($this->new_artifact_id);
$this->layout = mock('Tracker_IDisplayTrackerLayout');
$this->user = mock('PFUser');
$this->xml_exporter = mock('Tracker_XML_Exporter_ArtifactXMLExporter');
$this->xml_importer = mock('Tracker_Artifact_XMLImport');
$this->xml_updater = mock('Tracker_XML_Updater_ChangesetXMLUpdater');
$this->file_updater = mock('Tracker_XML_Updater_TemporaryFileXMLUpdater');
$this->from_changeset = stub('Tracker_Artifact_Changeset')->getId()->returns($this->changeset_id);
$this->from_artifact = partial_mock('Tracker_Artifact', array('getChangesetFactory'));
$this->from_artifact->setId($this->artifact_id);
$this->from_artifact->setTracker($this->tracker);
$this->from_artifact->setChangesets(array($this->changeset_id => $this->from_changeset));
stub($this->from_artifact)->getChangesetFactory()->returns($changeset_factory);
stub($this->from_changeset)->getArtifact()->returns($this->from_artifact);
$this->children_xml_exporter = mock('Tracker_XML_Exporter_ChildrenXMLExporter');
$this->children_xml_importer = mock('Tracker_XML_Importer_ChildrenXMLImporter');
$this->artifacts_imported_mapping = mock('Tracker_XML_Importer_ArtifactImportedMapping');
$backend_logger = mock("BackendLogger");
$this->logger = new Tracker_XML_Importer_CopyArtifactInformationsAggregator($backend_logger);
$this->submitted_values = array();
$this->artifact_factory = mock('Tracker_ArtifactFactory');
stub($this->artifact_factory)->getArtifactByIdUserCanView($this->user, $this->artifact_id)->returns($this->from_artifact);
$this->request = aRequest()->with('from_artifact_id', $this->artifact_id)->with('from_changeset_id', $this->changeset_id)->with('artifact', $this->submitted_values)->build();
$this->action = new Tracker_Action_CopyArtifact($this->tracker, $this->artifact_factory, $this->xml_exporter, $this->xml_importer, $this->xml_updater, $this->file_updater, $this->children_xml_exporter, $this->children_xml_importer, $this->artifacts_imported_mapping, $this->logger);
$this->a_mocked_artifact = mock("Tracker_Artifact");
}
示例2: process
public function process(Tracker_Artifact $artifact, array $fields_data)
{
$tracker_data = array();
//only when a previous changeset exists
if (!$artifact->getLastChangeset() instanceof Tracker_Artifact_Changeset_Null) {
foreach ($artifact->getLastChangeset()->getValues() as $key => $field) {
if ($field instanceof Tracker_Artifact_ChangesetValue_Date || $field instanceof Tracker_Artifact_ChangesetValue_List) {
$tracker_data[$key] = $field->getValue();
}
}
}
//replace where appropriate with submitted values
foreach ($fields_data as $key => $value) {
$tracker_data[$key] = $value;
}
//addlastUpdateDate and submitted on if available
foreach ($this->formelement_factory->getAllFormElementsForTracker($artifact->getTracker()) as $field) {
if ($field instanceof Tracker_FormElement_Field_LastUpdateDate) {
$tracker_data[$field->getId()] = date("Y-m-d");
}
if ($field instanceof Tracker_FormElement_Field_SubmittedOn) {
$tracker_data[$field->getId()] = $artifact->getSubmittedOn();
}
if ($field instanceof Tracker_FormElement_Field_Date && !array_key_exists($field->getId(), $tracker_data)) {
//user doesn't have access to field
$tracker_data[$field->getId()] = $field->getValue($field->getId());
}
}
return $tracker_data;
}
示例3: setUp
public function setUp()
{
parent::setUp();
$tracker_user_story_id = 103;
$user_story_id = 107;
$submitted_by = 102;
$submitted_on = 1234567890;
$use_artifact_permissions = false;
$tracker = aMockTracker()->withId($this->tracker_id)->build();
$this->layout = mock('Tracker_IDisplayTrackerLayout');
$this->request = aRequest()->with('func', 'artifact-update')->build();
$this->user = mock('PFUser');
$this->formelement_factory = mock('Tracker_FormElementFactory');
$this->hierarchy_factory = mock('Tracker_HierarchyFactory');
$this->computed_field = mock('Tracker_FormElement_Field_Computed');
$this->us_computed_field = mock('Tracker_FormElement_Field_Computed');
$this->user_story = mock('Tracker_Artifact');
$tracker_user_story = aMockTracker()->withId($tracker_user_story_id)->build();
stub($this->user_story)->getTrackerId()->returns($tracker_user_story_id);
stub($this->user_story)->getTracker()->returns($tracker_user_story);
stub($this->user_story)->getId()->returns($user_story_id);
$this->task = partial_mock('Tracker_Artifact', array('createNewChangeset'), array($this->artifact_id, $this->tracker_id, $submitted_by, $submitted_on, $use_artifact_permissions));
$this->task->setHierarchyFactory($this->hierarchy_factory);
$this->task->setTracker($tracker);
$this->task->setFormElementFactory($this->formelement_factory);
stub($this->task)->createNewChangeset()->returns(true);
stub($this->formelement_factory)->getComputableFieldByNameForUser($tracker_user_story_id, Tracker::REMAINING_EFFORT_FIELD_NAME, $this->user)->returns($this->us_computed_field);
stub($this->computed_field)->fetchCardValue($this->task)->returns(42);
stub($this->us_computed_field)->fetchCardValue($this->user_story)->returns(23);
$this->event_manager = mock('EventManager');
$this->action = new Tracker_Action_UpdateArtifact($this->task, $this->formelement_factory, $this->event_manager);
}
示例4: artifactMatchTriggerValue
private function artifactMatchTriggerValue(Tracker_Artifact $sibling, Tracker_Workflow_Trigger_FieldValue $trigger)
{
if ($trigger->getField()->getTracker() == $sibling->getTracker()) {
return $trigger->isSetForArtifact($sibling);
}
return true;
}
示例5: getColumnIdOfKanbanItem
public function getColumnIdOfKanbanItem(Tracker_Artifact $artifact)
{
$row = $this->item_dao->getColumnIdOfKanbanItem($artifact->getTrackerId(), $artifact->getId())->getRow();
if (!$row) {
return null;
}
return (int) $row['bindvalue_id'];
}
示例6: exportFullHistory
/**
* Add to $artifacts_xml the xml structure of an artifact
*/
public function exportFullHistory(SimpleXMLElement $artifacts_xml, Tracker_Artifact $artifact)
{
$artifact_xml = $artifacts_xml->addChild('artifact');
$artifact_xml->addAttribute('id', $artifact->getId());
foreach ($artifact->getChangesets() as $changeset) {
$this->changeset_exporter->exportFullHistory($artifact_xml, $changeset);
}
}
示例7: getField
public function getField(Tracker_Artifact $artifact)
{
$mapping = $this->config->getMappingFor($artifact->getTracker());
if ($mapping) {
return $mapping->getField();
}
return $this->semantic_status_provider->getField($artifact);
}
示例8: getNewChangesetsFormattedForJson
/**
* Get all changesets in a format ready for json conversion
*
* @param Tracker_Artifact $artifact
* @param Integer $changeset_id
* @return array
*/
public function getNewChangesetsFormattedForJson(Tracker_Artifact $artifact, $changeset_id)
{
$changesets = array();
foreach ($this->dao->searchChangesetNewerThan($artifact->getId(), $changeset_id) as $row) {
$changesets[] = $this->json_formatter->format($this->getChangesetFromRow($artifact, $row));
}
return $changesets;
}
示例9: getCurrentComputedValue
/**
* @param PFUser $user
* @param Tracker_Artifact $artifact
*
* @return mixed
*/
private function getCurrentComputedValue(Tracker_Artifact $artifact)
{
$row = $this->getValueDao()->getLastValue($artifact->getId(), $this->getId());
if ($row) {
return $row['value'];
}
return 0;
}
示例10: getLastChangesetValue
private function getLastChangesetValue(Tracker_Artifact $artifact, Tracker_FormElement_Field $field)
{
$last_changeset = $artifact->getLastChangeset();
if (!$last_changeset) {
return null;
}
return $last_changeset->getValue($field);
}
示例11: getCurrentComputedValue
/**
* @param User $user
* @param Tracker_Artifact $artifact
*
* @return mixed
*/
private function getCurrentComputedValue(Tracker_Artifact $artifact)
{
$value = $artifact->getValue($this);
if ($value) {
return $value->getValue();
}
return null;
}
示例12: isSetForArtifact
/**
* Return true if given artifact has the same value than current object
*
* @param Tracker_Artifact $artifact
* @return boolean
*/
public function isSetForArtifact(Tracker_Artifact $artifact)
{
$artifact_value = $artifact->getValue($this->getField());
if ($artifact_value && $artifact_value->getValue() == array($this->getValue()->getId())) {
return true;
}
return false;
}
示例13: getFields
/**
*
* @param Tracker_Artifact $artifact
*
* @return Tracker_FormElement_Field[]
*/
public function getFields(Tracker_Artifact $artifact)
{
$diplayed_fields = array();
$tracker = $artifact->getTracker();
foreach ($this->getDisplayedFields($tracker) as $field) {
$diplayed_fields[] = $field;
}
return $diplayed_fields;
}
示例14: isArtifactInParentTracker
private function isArtifactInParentTracker(Tracker_Artifact $linked_artifact)
{
$linked_artifact_tracker_id = $linked_artifact->getTrackerId();
$parent_tracker = $this->tracker->getParent();
if ($parent_tracker) {
return $parent_tracker->getId() == $linked_artifact_tracker_id;
}
return false;
}
示例15: 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);
}