本文整理汇总了PHP中Tracker_Artifact::getLastChangeset方法的典型用法代码示例。如果您正苦于以下问题:PHP Tracker_Artifact::getLastChangeset方法的具体用法?PHP Tracker_Artifact::getLastChangeset怎么用?PHP Tracker_Artifact::getLastChangeset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracker_Artifact
的用法示例。
在下文中一共展示了Tracker_Artifact::getLastChangeset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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);
}
示例3: fetchArtifactInformations
private function fetchArtifactInformations(Tracker_Artifact $artifact)
{
$html = "";
$html_purifier = Codendi_HTMLPurifier::instance();
$artifact_id = $html_purifier->purify($artifact->getId());
$changeset_id = $html_purifier->purify($artifact->getLastChangeset()->getId());
$html .= '<input type="hidden" id="artifact_informations" data-artifact-id="' . $artifact_id . '" data-changeset-id="' . $changeset_id . '">';
return $html;
}
示例4: getBaseArtifact
private function getBaseArtifact(Tracker_Artifact $artifact, array &$properties)
{
$last_changeset = $artifact->getLastChangeset();
$last_changeset_id = $last_changeset ? $last_changeset->getId() : -1;
$properties = array('id' => $artifact->getId(), 'group_id' => $artifact->getTracker()->getGroupId(), 'tracker_id' => $artifact->getTrackerId(), 'last_changeset_id' => $last_changeset_id);
$this->artifact_properties_extractor->extractTrackerUserGroups($artifact, $properties);
$this->artifact_properties_extractor->extractArtifactUserGroups($artifact, $properties);
if ($last_changeset) {
$this->artifact_properties_extractor->extractArtifactTextFields($artifact, $last_changeset, $properties);
$this->artifact_properties_extractor->extractArtifactDateFields($artifact, $last_changeset, $properties);
}
}
示例5: __construct
public function __construct($follow_ups, $artifact_links, $form_elements, Tracker_Artifact $artifact, PFUser $user)
{
$this->follow_ups = $follow_ups;
$this->artifact_links = $artifact_links;
$this->artifact = $artifact;
$this->artifact_id = $artifact->getId();
$this->artifact_title = $artifact->getTitle();
$this->artifact_uri = $artifact->getUri();
$this->last_changeset_id = $artifact->getLastChangeset()->getId();
$this->form_elements = $form_elements;
$this->user = $user;
}
示例6: updateParent
private function updateParent(Tracker_Artifact $parent, Tracker_Artifact $child, Tracker_Workflow_Trigger_TriggerRule $rule)
{
$target = $rule->getTarget();
try {
$comment = '<p>' . $GLOBALS['Language']->getText('workflow_trigger_rules_processor', 'parent_update', array('art #' . $child->getId(), $child->getLastChangeset()->getUri())) . '</p>';
$comment .= '<p>' . $rule->getAsChangesetComment() . '</p>';
$parent->createNewChangeset($target->getFieldData(), $comment, $this->workflow_user, true, Tracker_Artifact_Changeset_Comment::HTML_COMMENT);
$this->logger->debug('Parent successfully updated.');
} catch (Tracker_Exception $e) {
$this->logger->debug('Error while updating the parent artifact: ' . $e->getMessage());
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_artifact', 'error_processor_update', array($parent->fetchDirectLinkToArtifact(), $e->getMessage())), CODENDI_PURIFIER_DISABLED);
}
}
示例7: isCurrentChangesetTheLastChangeset
private function isCurrentChangesetTheLastChangeset(Tracker_Artifact $artifact, Tracker_Artifact_ChangesetValue $current_changeset_value)
{
$file_field = $current_changeset_value->getField();
$last_changeset = $artifact->getLastChangeset();
if (!$last_changeset) {
return false;
}
$last_changeset_value = $last_changeset->getValue($file_field);
if (!$last_changeset_value) {
return false;
}
return $last_changeset_value->getId() === $current_changeset_value->getId();
}
示例8: exportAttachmentsInArchive
public function exportAttachmentsInArchive(Tracker_Artifact $artifact, ZipArchive $archive)
{
$file_fields = $this->form_element_factory->getUsedFileFields($artifact->getTracker());
$last_changeset = $artifact->getLastChangeset();
if (!$last_changeset) {
return;
}
foreach ($file_fields as $field) {
$value = $last_changeset->getValue($field);
if ($value) {
$this->addFilesIntoArchive($value, $archive);
}
}
}
示例9: before
/**
* Execute actions before transition happens (if there is one)
*
* @param Array $fields_data Request field data (array[field_id] => data)
* @param User $current_user The user who are performing the update
*
* @return void
*/
public function before(array &$fields_data, User $current_user)
{
if (isset($fields_data[$this->getFieldId()])) {
$oldValues = $this->artifact->getLastChangeset()->getValue($this->getField());
$from = null;
if ($oldValues) {
if ($v = $oldValues->getValue()) {
// Todo: what about multiple values in the changeset?
list(, $from) = each($v);
$from = (int) $from;
}
}
$to = (int) $fields_data[$this->getFieldId()];
$transition = $this->getTransition($from, $to);
if ($transition) {
$transition->before($fields_data, $current_user);
}
}
}
示例10: getFieldJsonValue
public function getFieldJsonValue(PFUser $user, Tracker_FormElement_Field $field)
{
return $field->getJsonValue($user, $this->artifact->getLastChangeset());
}
示例11: getLastValue
/**
* Retreive The last date Field value
*
* @param Tracker_Artifact $artifact The artifact
*
* @return date
*/
public function getLastValue(Tracker_Artifact $artifact)
{
return date("Y-m-d", $artifact->getLastChangeset()->getSubmittedOn());
}
示例12: getFieldsValues
private function getFieldsValues(PFUser $user, Tracker_Artifact $artifact)
{
$changeset = $artifact->getLastChangeset();
return $this->mapAndFilter($this->formelement_factory->getUsedFieldsForREST($artifact->getTracker()), $this->getFieldsValuesFilter($user, $changeset));
}
示例13: isInColumn
public function isInColumn(Tracker_Artifact $artifact, Cardwall_FieldProviders_IProvideFieldGivenAnArtifact $field_provider, Cardwall_Column $column)
{
$artifact_status = null;
$field = $field_provider->getField($artifact->getTracker());
if ($field) {
$last_changeset = $artifact->getLastChangeset();
if ($last_changeset) {
$artifact_status = $field->getFirstValueFor($last_changeset);
}
}
return $column->canContainStatus($artifact_status, $this->getMappingFor($artifact->getTracker()));
}
示例14: validate
/**
* @throws Tracker_Workflow_PermissionTransitionViolationException
*
* @return void
*/
public function validate($fields_data, Tracker_Artifact $artifact)
{
if (!$this->is_used) {
return;
}
$transition = $this->getCurrentTransition($fields_data, $artifact->getLastChangeset());
if (isset($transition)) {
if (!$transition->validate($fields_data, $artifact)) {
throw new Tracker_Workflow_PermissionTransitionViolationException();
}
}
}
示例15: getLastChangesetArtifactIds
/**
* @return Array the ids
*/
private function getLastChangesetArtifactIds(Tracker_Artifact $artifact)
{
$lastChangeset = $artifact->getLastChangeset();
$ids = array();
if ($lastChangeset) {
$ids = $artifact->getLastChangeset()->getValue($this)->getArtifactIds();
}
return $ids;
}