Пример #1
0
 protected function _populateMilestoneSwimlanes(\thebuggenie\core\entities\Milestone $milestone)
 {
     if (!array_key_exists($milestone->getID(), $this->_swimlanes)) {
         $this->_swimlanes[$milestone->getID()] = array();
         $swimlanes = array();
         if ($this->usesSwimlanes()) {
             switch ($this->getSwimlaneType()) {
                 case self::SWIMLANES_EXPEDITE:
                 case self::SWIMLANES_GROUPING:
                     switch ($this->getSwimlaneIdentifier()) {
                         case 'priority':
                             $items = \thebuggenie\core\entities\Priority::getAll();
                             break;
                         case 'severity':
                             $items = \thebuggenie\core\entities\Severity::getAll();
                             break;
                         case 'category':
                             $items = \thebuggenie\core\entities\Category::getAll();
                             break;
                         default:
                             $items = array();
                             break;
                     }
                     if ($this->getSwimlaneType() == self::SWIMLANES_EXPEDITE) {
                         $expedite_items = array();
                         foreach ($this->getSwimlaneFieldValues() as $value) {
                             if (array_key_exists($value, $items)) {
                                 $expedite_items[$items[$value]->getID()] = $items[$value];
                                 unset($items[$value]);
                             }
                         }
                         $swimlanes[] = array('identifiables' => $expedite_items);
                         $swimlanes[] = array('identifiables' => $items);
                         $swimlanes[] = array('identifiables' => 0);
                     } else {
                         foreach ($items as $item) {
                             $swimlanes[] = array('identifiables' => $item);
                         }
                         $swimlanes[] = array('identifiables' => 0);
                     }
                     break;
                 case self::SWIMLANES_ISSUES:
                     foreach ($milestone->getIssues() as $issue) {
                         if ($issue->isChildIssue()) {
                             foreach ($issue->getParentIssues() as $parent) {
                                 if ($parent->getIssueType()->getID() != $this->getEpicIssuetypeID()) {
                                     continue 2;
                                 }
                             }
                         }
                         if (in_array($issue->getIssueType()->getID(), $this->getSwimlaneFieldValues())) {
                             $swimlanes[] = array('identifiables' => $issue);
                         }
                     }
                     $swimlanes[] = array('identifiables' => 0);
                     break;
             }
         } else {
             $swimlanes[] = array('identifiables' => 0);
         }
         foreach ($swimlanes as $details) {
             $swimlane = new BoardSwimlane();
             $swimlane->setBoard($this);
             $swimlane->setIdentifiables($details['identifiables']);
             $swimlane->setMilestone($milestone);
             $this->_swimlanes[$milestone->getID()][] = $swimlane;
         }
     }
 }