本文整理汇总了PHP中Tracker_Artifact_Changeset::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Tracker_Artifact_Changeset::getValue方法的具体用法?PHP Tracker_Artifact_Changeset::getValue怎么用?PHP Tracker_Artifact_Changeset::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracker_Artifact_Changeset
的用法示例。
在下文中一共展示了Tracker_Artifact_Changeset::getValue方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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();
}
示例3: 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);
}
示例4: getLinkedArtifacts
/**
* Retrieve linked artifacts according to user's permissions
*
* @param Tracker_Artifact_Changeset $changeset The changeset you want to retrieve artifact from
* @param User $user The user who will see the artifacts
*
* @return array of Tracker_Artifact
*/
public function getLinkedArtifacts(Tracker_Artifact_Changeset $changeset, User $user)
{
$artifacts = array();
$changeset_value = $changeset->getValue($this);
if ($changeset_value) {
foreach ($changeset_value->getArtifactIds() as $id) {
$artifact = $this->getArtifactFactory()->getArtifactById($id);
if ($artifact && $artifact->userCanView($user)) {
$artifacts[] = $artifact;
}
}
}
return $artifacts;
}
示例5: 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);
}
示例6: fetchRawValueFromChangeset
/**
* Fetch the value in a specific changeset
* @param Tracker_Artifact_Changeset $changeset
* @return string
*/
public function fetchRawValueFromChangeset($changeset)
{
$value = '';
$values_array = array();
if ($v = $changeset->getValue($this->field)) {
$values = $v->getListValues();
foreach ($values as $val) {
$values_array[] = $val->getLabel();
}
}
return implode(",", $values_array);
}
示例7: getFirstValueFor
/**
*
* @param Tracker_Artifact_Changeset $changeset
* @return string
*/
public function getFirstValueFor(Tracker_Artifact_Changeset $changeset)
{
if ($this->userCanRead()) {
$value = $changeset->getValue($this);
if ($value && ($last_values = $value->getListValues())) {
// let's assume there is no more that one status
if ($label = array_shift($last_values)->getLabel()) {
return $label;
}
}
}
}
示例8: 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->field)) {
if (isset($v['value_id'])) {
$v = array($v);
}
foreach ($v as $val) {
$value .= $this->values[$val['value_id']]['value'];
}
}
return $value;
}
示例9: 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
示例10: getJsonValue
public function getJsonValue(PFUser $user, Tracker_Artifact_Changeset $changeset)
{
if ($this->userCanRead($user)) {
$value = $changeset->getValue($this);
return $value ? $value->getJsonValue() : '';
}
return null;
}
示例11: 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;
}
示例12: getCurrentTransition
private function getCurrentTransition($fields_data, Tracker_Artifact_Changeset $changeset = null)
{
$oldValues = null;
if ($changeset) {
$oldValues = $changeset->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;
}
}
if (isset($fields_data[$this->getFieldId()])) {
$to = (int) $fields_data[$this->getFieldId()];
$transition = $this->getTransition($from, $to);
return $transition;
}
return null;
}