/** * @param Tracker_Artifact $artifact The child * @param Tracker_Artifact $parent The parent * @param Tracker_Semantic_Status $semantic The status semantic used by the corresponding tracker */ public function __construct(Tracker_Artifact $artifact, Tracker_Artifact $parent, Tracker_Semantic_Status $semantic) { $base_url = get_server_url(); $this->xref = $artifact->getXRef(); $this->title = $artifact->getTitle(); $this->id = $artifact->getId(); $this->url = $base_url . $artifact->getUri(); $this->status = $semantic->getStatus($artifact); $this->parent_id = $parent->getId(); $this->has_children = $artifact->hasChildren(); }
private function checkAllColumnsAreProvided(Tracker_Semantic_Status $semantic, array $column_ids) { $all_open_values = $semantic->getOpenValues(); $values_not_provided = array_diff($all_open_values, $column_ids); $values_not_open = array_diff($column_ids, $all_open_values); if (!empty($values_not_provided)) { throw new Kanban_SemanticStatusAllColumnIdsNotProvidedException(); } if (!empty($values_not_open)) { throw new Kanban_SemanticStatusColumnIdsNotInOpenSemanticException(); } }
public function testExport() { $GLOBALS['Language'] = new MockBaseLanguage($this); $GLOBALS['Language']->setReturnValue('getText', 'Status', array('plugin_tracker_admin_semantic', 'status_label')); $GLOBALS['Language']->setReturnValue('getText', 'Define the status of an artifact', array('plugin_tracker_admin_semantic', 'status_description')); $xml = simplexml_load_file(dirname(__FILE__) . '/_fixtures/ImportTrackerSemanticStatusTest.xml'); $tracker = new MockTracker(); $f = new MockTracker_FormElement_Field_List(); $f->setReturnValue('getId', 103); $tst = new Tracker_Semantic_Status($tracker, $f, array(806, 807, 808, 809)); $root = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><tracker xmlns="http://codendi.org/tracker" />'); $array_xml_mapping = array('F14' => 103, 'values' => array('F14-V66' => 806, 'F14-V67' => 807, 'F14-V68' => 808, 'F14-V69' => 809)); $tst->exportToXML($root, $array_xml_mapping); $this->assertEqual((string) $xml->shortname, (string) $root->semantic->shortname); $this->assertEqual((string) $xml->label, (string) $root->semantic->label); $this->assertEqual((string) $xml->description, (string) $root->semantic->description); $this->assertEqual((string) $xml->field['REF'], (string) $root->semantic->field['REF']); $this->assertEqual(count($xml->open_values), count($root->semantic->open_values)); }
/** @return Tracker_ArtifactChildPresenter[] */ private function getChildPresenterCollection(PFUser $current_user) { $presenters = array(); foreach ($this->getChildrenForUser($current_user) as $child) { $tracker = $child->getTracker(); $semantics = Tracker_Semantic_Status::load($tracker); $has_children = $child->hasChildren(); $presenters[] = new Tracker_ArtifactChildPresenter($child, $this, $semantics); } return $presenters; }
/** * Get the artifact status, or null if no status defined in semantics * * @return string the status of the artifact, or null if no status defined in semantics */ public function getStatus() { if ($status_field = Tracker_Semantic_Status::load($this->getTracker())->getField()) { return $status_field->getFirstValueFor($this->getLastChangeset()); } return null; }
/** * Return the status field, or null if no status field defined * * @return Tracker_FormElement_List the status field, or null if not defined */ public function getStatusField() { $status_field = Tracker_Semantic_Status::load($this)->getField(); if ($status_field) { return $status_field; } else { return null; } }
/** * @return Tracker_SemanticCollection */ public function getSemantics() { $semantics = new Tracker_SemanticCollection(); $title_semantic = Tracker_Semantic_Title::load($this->tracker); $semantics->add($title_semantic->getShortName(), $title_semantic); $status_semantic = Tracker_Semantic_Status::load($this->tracker); $semantics->add($status_semantic->getShortName(), $status_semantic); $contributor_semantic = Tracker_Semantic_Contributor::load($this->tracker); $semantics->add($contributor_semantic->getShortName(), $contributor_semantic); $tooltip_semantic = $this->tracker->getTooltip(); $semantics->add($tooltip_semantic->getShortName(), $tooltip_semantic); $this->addOtherSemantics($semantics); return $semantics; }
private function getSemanticStatus(AgileDashboard_Kanban $kanban) { $tracker = TrackerFactory::instance()->getTrackerById($kanban->getTrackerId()); if (!$tracker) { return; } $semantic = Tracker_Semantic_Status::forceLoad($tracker); if (!$semantic->getFieldId()) { return; } return $semantic; }
public function getByTracker(Tracker $tracker) { return Tracker_Semantic_Status::load($tracker); }
private function getCardStatus(Cardwall_CardInCellPresenter $card) { $semantic = Tracker_Semantic_Status::load($card->getArtifact()->getTracker()); return $semantic->getNormalizedStatusLabel($card->getArtifact()); }
public function getSemanticStatus(Tracker $tracker) { $semantic = Tracker_Semantic_Status::load($tracker); if (!$semantic->getFieldId()) { throw new Kanban_SemanticStatusNotDefinedException(); } return $semantic; }
/** * @return Tracker_Semantic_Status */ private function getSemanticStatus(AgileDashboard_Kanban $kanban) { $tracker = $this->getTrackerForKanban($kanban); if (!$tracker) { return; } $semantic = Tracker_Semantic_Status::load($tracker); if (!$semantic->getFieldId()) { return; } return $semantic; }
/** * @return array of Tracker_Semantic */ public function getSemantics() { $semantics = array(); $t = Tracker_Semantic_Title::load($this->tracker); $semantics[$t->getShortName()] = $t; $t = Tracker_Semantic_Status::load($this->tracker); $semantics[$t->getShortName()] = $t; $t = Tracker_Semantic_Contributor::load($this->tracker); $semantics[$t->getShortName()] = $t; $t = $this->tracker->getTooltip(); $semantics[$t->getShortName()] = $t; return $semantics; }
protected function userCanReadBacklogStatusField(PFUser $user, Tracker $tracker) { if (!isset($this->cache_read_status[$tracker->getId()])) { $this->cache_read_status[$tracker->getId()] = false; $field = Tracker_Semantic_Status::load($tracker)->getField(); if ($field) { $this->cache_read_status[$tracker->getId()] = $field->userCanRead($user); } } return $this->cache_read_status[$tracker->getId()]; }