本文整理汇总了PHP中Tracker_Artifact_Changeset类的典型用法代码示例。如果您正苦于以下问题:PHP Tracker_Artifact_Changeset类的具体用法?PHP Tracker_Artifact_Changeset怎么用?PHP Tracker_Artifact_Changeset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tracker_Artifact_Changeset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFullRESTValue
public function getFullRESTValue(PFUser $user, Tracker_Artifact_Changeset $changeset)
{
$classname_with_namespace = 'Tuleap\\Tracker\\REST\\Artifact\\ArtifactFieldValueFullRepresentation';
$artifact_field_value_full_representation = new $classname_with_namespace();
$artifact_field_value_full_representation->build($this->getId(), Tracker_FormElementFactory::instance()->getType($this), $this->getLabel(), (int) $changeset->getArtifact()->getPerTrackerArtifactId());
return $artifact_field_value_full_representation;
}
示例2: exportSnapshotWithoutComments
/**
* Same as exportFullHistory() but only the current state of the artifact
*/
public function exportSnapshotWithoutComments(SimpleXMLElement $artifacts_xml, Tracker_Artifact_Changeset $changeset)
{
$artifact_xml = $artifacts_xml->addChild('artifact');
$artifact_xml->addAttribute('id', $changeset->getArtifact()->getId());
$artifact_xml->addAttribute('tracker_id', $changeset->getArtifact()->getTrackerId());
$this->changeset_exporter->exportWithoutComments($artifact_xml, $changeset);
}
示例3: build
/**
* @return Tracker_Artifact_Changeset
*/
public function build()
{
$changeset = new Tracker_Artifact_Changeset($this->id, $this->artifact, $this->submitted_by, $this->submitted_on, $this->email);
if ($this->comment !== null) {
$changeset->setLatestComment($this->comment);
}
return $changeset;
}
示例4: getRawMailForChangeset
private function getRawMailForChangeset(Tracker_Artifact_Changeset $changeset)
{
$raw_mails = $this->getCachedRawMailByChangesetsForArtifact($changeset->getArtifact());
$changeset_id = $changeset->getId();
if (isset($raw_mails[$changeset_id])) {
return $raw_mails[$changeset_id];
}
return null;
}
示例5: hasChanges
private function hasChanges(Tracker_Artifact_Changeset $new_changeset, Tracker_Artifact_Changeset $previous_changeset = null)
{
if (!$previous_changeset) {
return true;
}
$new_value = $new_changeset->getValue($this->field);
$previous_value = $previous_changeset->getValue($this->field);
$diff = $new_value->getArtifactLinkInfoDiff($previous_value);
return $diff->hasChanges();
}
示例6: fetchRawValueFromChangeset
/**
* Fetch the value in a specific changeset
* @param Tracker_Artifact_Changeset $changeset
* @return string
*/
public function fetchRawValueFromChangeset($changeset)
{
$value = '';
if ($v = $changeset->getValue($this)) {
if ($row = $this->getValueDao()->searchById($v->getId(), $this->id)->getRow()) {
$value = $row['value'];
}
}
return $value;
}
示例7: exportFullHistory
public function exportFullHistory(SimpleXMLElement $artifact_xml, Tracker_Artifact_Changeset $changeset)
{
$changeset_xml = $artifact_xml->addChild('changeset');
if ($changeset->getSubmittedBy()) {
$this->user_xml_exporter->exportUserByUserId($changeset->getSubmittedBy(), $changeset_xml, 'submitted_by');
} elseif ($changeset->getEmail()) {
$this->user_xml_exporter->exportUserByMail($changeset->getEmail(), $changeset_xml, 'submitted_by');
}
$submitted_on = $changeset_xml->addChild('submitted_on', date('c', $changeset->getSubmittedOn()));
$submitted_on->addAttribute('format', 'ISO8601');
$comments_node = $changeset_xml->addChild('comments');
if ($changeset->getComment()) {
$changeset->getComment()->exportToXML($comments_node);
}
$this->values_exporter->exportChangedFields($artifact_xml, $changeset_xml, $changeset->getArtifact(), $changeset->getValues());
}
示例8: create
/**
* Add an artefact in the tracker
*
* @return Tracker_Artifact or false if an error occured
*/
public function create(Tracker $tracker, array $fields_data, PFUser $user, $submitted_on, $send_notification)
{
$artifact = $this->getBareArtifact($tracker, $user, $submitted_on);
if (!$this->fields_validator->validate($artifact, $fields_data)) {
return;
}
$use_artifact_permissions = 0;
$id = $this->artifact_dao->create($tracker->id, $user->getId(), $submitted_on, $use_artifact_permissions);
if (!$id) {
return;
}
$artifact->setId($id);
$changeset_id = $this->changeset_creator->create($artifact, $fields_data, $user, $submitted_on);
if (!$changeset_id) {
return;
}
$changeset = new Tracker_Artifact_Changeset($changeset_id, $artifact, $artifact->getSubmittedBy(), $artifact->getSubmittedOn(), $user->getEmail());
if ($send_notification) {
$changeset->notify();
}
return $artifact;
}
示例9: getCrossReferenceListForREST
private function getCrossReferenceListForREST(Tracker_Artifact_Changeset $changeset)
{
$crf = new CrossReferenceFactory($changeset->getArtifact()->getId(), Tracker_Artifact::REFERENCE_NATURE, $this->getTracker()->getGroupId());
$crf->fetchDatas();
$list = array();
$refs = $crf->getFormattedCrossReferences();
if (!empty($refs['target'])) {
foreach ($refs['target'] as $refTgt) {
$list[] = array(self::REST_REF_INDEX => $refTgt['ref'], self::REST_REF_URL => $refTgt['url'], self::REST_REF_DIRECTION => self::REST_REF_DIRECTION_OUT);
}
}
if (!empty($refs['source'])) {
foreach ($refs['source'] as $refSrc) {
$list[] = array(self::REST_REF_INDEX => $refSrc['ref'], self::REST_REF_URL => $refSrc['url'], self::REST_REF_DIRECTION => self::REST_REF_DIRECTION_IN);
}
}
if (!empty($refs['both'])) {
foreach ($refs['both'] as $refBoth) {
$list[] = array(self::REST_REF_INDEX => $refBoth['ref'], self::REST_REF_URL => $refBoth['url'], self::REST_REF_DIRECTION => self::REST_REF_DIRECTION_BOTH);
}
}
return $list;
}
示例10: extractArtifactDateFields
public function extractArtifactDateFields(Tracker_Artifact $artifact, Tracker_Artifact_Changeset $last_changeset, array &$properties)
{
$tracker = $artifact->getTracker();
$custom_date_fields = $this->form_element_factory->getUsedCustomDateFields($tracker);
foreach ($custom_date_fields as $date_field) {
$last_changeset_value = $last_changeset->getValue($date_field);
if ($last_changeset->getValue($date_field) && $last_changeset_value) {
$properties[$date_field->getName()] = date('c', $last_changeset_value->getTimestamp());
}
}
$core_date_fields = $this->form_element_factory->getCoreDateFields($tracker);
foreach ($core_date_fields as $date_field) {
if ($date_field instanceof Tracker_FormElement_Field_SubmittedOn) {
$properties[$date_field->getName()] = date('c', $artifact->getSubmittedOn());
} elseif ($date_field instanceof Tracker_FormElement_Field_LastUpdateDate) {
$properties[$date_field->getName()] = date('c', $artifact->getLastUpdateDate());
}
}
$last_modified = $artifact->getLastUpdateDate();
if ($last_modified === -1) {
$last_modified = $artifact->getSubmittedOn();
}
$properties[self::LAST_UPDATE_PROPERTY] = date('c', $last_modified);
}
示例11: testDisplayDiffShouldNotStripHtmlTagsInPlainTextFormat
public function testDisplayDiffShouldNotStripHtmlTagsInPlainTextFormat()
{
$diff = "@@ -1 +1 @@\n- Quelle est la couleur <b> du <i> cheval blanc d'Henri IV?\n+ Quelle est la couleur <b> du <i> <s> cheval blanc d'Henri IV?";
$format = 'text';
$field = new MockTracker_FormElement_Field_Date();
$field->setReturnValue('getLabel', 'Summary');
$changeset = new Tracker_Artifact_Changeset(null, null, null, null, null);
$result = $changeset->displayDiff($diff, $format, $field);
$this->assertPattern('%Quelle est la couleur <b> du <i> <s> cheval blanc%', $result);
$this->assertPattern('%Summary%', $result);
}
示例12: fetchRawValueFromChangeset
/**
* Fetch the value in a specific changeset
* @param Tracker_Artifact_Changeset $changeset
* @return string
*/
public function fetchRawValueFromChangeset($changeset)
{
$value = '';
if ($v = $changeset->getValue($this)) {
if (isset($v['value_id'])) {
$v = array($v);
}
foreach ($v as $val) {
if ($val['value_id'] != 100) {
if ($row = $this->getValueDao()->searchById($val['value_id'], $this->id)->getRow()) {
if ($value) {
$value .= ', ';
}
$value .= $row['filename'];
}
}
}
}
return $value;
}
示例13: getSlicedLinkedArtifacts
/**
* Retrieve sliced linked artifacts according to user's permissions
*
* This is nearly the same as a paginated list however, for performance
* reasons, the total size may be different than the sum of total paginated
* artifacts.
*
* Example to illustrate the difference between paginated and sliced:
*
* Given that artifact links are [12, 13, 24, 39, 65, 69]
* And that the user cannot see artifact #39
* When I request linked artifacts by bunchs of 2
* Then I get [[12, 13], [24], [65, 69]] # instead of [[12, 13], [24, 65], [69]]
* And total size will be 6 # instead of 5
*
* @param Tracker_Artifact_Changeset $changeset The changeset you want to retrieve artifact from
* @param PFUser $user The user who will see the artifacts
* @param int $limit The number of artifact to fetch
* @param int $offset The offset
*
* @return Tracker_Artifact_PaginatedArtifacts
*/
public function getSlicedLinkedArtifacts(Tracker_Artifact_Changeset $changeset, PFUser $user, $limit, $offset)
{
$changeset_value = $changeset->getValue($this);
if (!$changeset_value) {
return new Tracker_Artifact_PaginatedArtifacts(array(), 0);
}
$artifact_ids = $changeset_value->getArtifactIds();
$size = count($artifact_ids);
$artifacts = array();
foreach (array_slice($artifact_ids, $offset, $limit) as $id) {
$this->addArtifactUserCanViewFromId($artifacts, $id, $user);
}
return new Tracker_Artifact_PaginatedArtifacts($artifacts, $size);
}
示例14: getEmail
private function getEmail(PFUser $user, Tracker_Artifact $artifact, Tracker_Artifact_Changeset $changeset)
{
return "<" . $artifact->getId() . "-" . $this->getHash($user, $artifact) . "-" . $user->getId() . "-" . $changeset->getId() . "@" . $this->host . ">";
}
示例15: getRESTValue
/**
* Return REST value of a field for a given changeset
*
* @param PFUser $user
* @param Tracker_Artifact_Changeset $changeset
*
* @return mixed | null if no values
*/
public function getRESTValue(PFUser $user, Tracker_Artifact_Changeset $changeset)
{
$value = $changeset->getValue($this);
if ($value) {
return $value->getRESTValue($user);
}
}
开发者ID:uniteddiversity,项目名称:tuleap,代码行数:15,代码来源:Tracker_FormElement_Field_PermissionsOnArtifact.class.php