Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/engine/PhabricatorBoardLayoutEngine.php
Show First 20 Lines • Show All 360 Lines • ▼ Show 20 Lines | private function loadColumns(array $boards) { | ||||
$columns = mgroup($columns, 'getProjectPHID'); | $columns = mgroup($columns, 'getProjectPHID'); | ||||
foreach ($boards as $board_phid => $board) { | foreach ($boards as $board_phid => $board) { | ||||
$board_columns = idx($columns, $board_phid, array()); | $board_columns = idx($columns, $board_phid, array()); | ||||
// If the project has milestones, create any missing columns. | // If the project has milestones, create any missing columns. | ||||
if ($board->getHasMilestones() || $board->getHasSubprojects()) { | if ($board->getHasMilestones() || $board->getHasSubprojects()) { | ||||
$child_projects = idx($children, $board_phid, array()); | $child_projects = idx($children, $board_phid, array()); | ||||
if ($board_columns) { | |||||
$next_sequence = last($board_columns)->getSequence() + 1; | $next_sequence = last($board_columns)->getSequence() + 1; | ||||
} else { | |||||
$next_sequence = 1; | |||||
} | |||||
$proxy_columns = mpull($board_columns, null, 'getProxyPHID'); | $proxy_columns = mpull($board_columns, null, 'getProxyPHID'); | ||||
foreach ($child_projects as $child_phid => $child) { | foreach ($child_projects as $child_phid => $child) { | ||||
if (isset($proxy_columns[$child_phid])) { | if (isset($proxy_columns[$child_phid])) { | ||||
continue; | continue; | ||||
} | } | ||||
$new_column = PhabricatorProjectColumn::initializeNewColumn($viewer) | $new_column = PhabricatorProjectColumn::initializeNewColumn($viewer) | ||||
->attachProject($board) | ->attachProject($board) | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | private function layoutBoard( | ||||
array $positions) { | array $positions) { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$board_phid = $board->getPHID(); | $board_phid = $board->getPHID(); | ||||
$position_groups = mgroup($positions, 'getObjectPHID'); | $position_groups = mgroup($positions, 'getObjectPHID'); | ||||
$layout = array(); | $layout = array(); | ||||
$default_phid = null; | |||||
foreach ($columns as $column) { | foreach ($columns as $column) { | ||||
$column_phid = $column->getPHID(); | $column_phid = $column->getPHID(); | ||||
$layout[$column_phid] = array(); | $layout[$column_phid] = array(); | ||||
if ($column->isDefaultColumn()) { | if ($column->isDefaultColumn()) { | ||||
$default_phid = $column_phid; | $default_phid = $column_phid; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | foreach ($object_phids as $object_phid) { | ||||
// there's no real need to destroy the data. | // there's no real need to destroy the data. | ||||
foreach ($positions as $key => $position) { | foreach ($positions as $key => $position) { | ||||
$column_phid = $position->getColumnPHID(); | $column_phid = $position->getColumnPHID(); | ||||
if (empty($columns[$column_phid])) { | if (empty($columns[$column_phid])) { | ||||
unset($positions[$key]); | unset($positions[$key]); | ||||
} | } | ||||
} | } | ||||
// If the object has no position, put it on the default column. | // If the object has no position, put it on the default column if | ||||
if (!$positions) { | // one exists. | ||||
if (!$positions && $default_phid) { | |||||
$new_position = id(new PhabricatorProjectColumnPosition()) | $new_position = id(new PhabricatorProjectColumnPosition()) | ||||
->setBoardPHID($board_phid) | ->setBoardPHID($board_phid) | ||||
->setColumnPHID($default_phid) | ->setColumnPHID($default_phid) | ||||
->setObjectPHID($object_phid) | ->setObjectPHID($object_phid) | ||||
->setSequence(0); | ->setSequence(0); | ||||
$this->addQueue[] = $new_position; | $this->addQueue[] = $new_position; | ||||
Show All 25 Lines |