Changeset View
Changeset View
Standalone View
Standalone View
src/view/phui/PHUIObjectItemView.php
| Show All 26 Lines | final class PHUIObjectItemView extends AphrontTagView { | ||||
| private $countdownNoun; | private $countdownNoun; | ||||
| private $sideColumn; | private $sideColumn; | ||||
| private $coverImage; | private $coverImage; | ||||
| private $description; | private $description; | ||||
| private $selectableName; | private $selectableName; | ||||
| private $selectableValue; | private $selectableValue; | ||||
| private $isSelected; | private $isSelected; | ||||
| private $isForbidden; | |||||
| public function setDisabled($disabled) { | public function setDisabled($disabled) { | ||||
| $this->disabled = $disabled; | $this->disabled = $disabled; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getDisabled() { | public function getDisabled() { | ||||
| return $this->disabled; | return $this->disabled; | ||||
| ▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | public function setCoverImage($image) { | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setDescription($description) { | public function setDescription($description) { | ||||
| $this->description = $description; | $this->description = $description; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setSelectable($name, $value, $is_selected) { | public function setSelectable( | ||||
| $name, | |||||
| $value, | |||||
| $is_selected, | |||||
| $is_forbidden = false) { | |||||
| $this->selectableName = $name; | $this->selectableName = $name; | ||||
| $this->selectableValue = $value; | $this->selectableValue = $value; | ||||
| $this->isSelected = $is_selected; | $this->isSelected = $is_selected; | ||||
| $this->isForbidden = $is_forbidden; | |||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setEpoch($epoch) { | public function setEpoch($epoch) { | ||||
| $date = phabricator_datetime($epoch, $this->getUser()); | $date = phabricator_datetime($epoch, $this->getUser()); | ||||
| $this->addIcon('none', $date); | $this->addIcon('none', $date); | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | switch ($this->effect) { | ||||
| $item_classes[] = 'phui-oi-visited'; | $item_classes[] = 'phui-oi-visited'; | ||||
| break; | break; | ||||
| case null: | case null: | ||||
| break; | break; | ||||
| default: | default: | ||||
| throw new Exception(pht('Invalid effect!')); | throw new Exception(pht('Invalid effect!')); | ||||
| } | } | ||||
| if ($this->isSelected) { | if ($this->isForbidden) { | ||||
| $item_classes[] = 'phui-oi-forbidden'; | |||||
| } else if ($this->isSelected) { | |||||
| $item_classes[] = 'phui-oi-selected'; | $item_classes[] = 'phui-oi-selected'; | ||||
| } | } | ||||
| if ($this->selectableName !== null) { | if ($this->selectableName !== null && !$this->isForbidden) { | ||||
| $item_classes[] = 'phui-oi-selectable'; | $item_classes[] = 'phui-oi-selectable'; | ||||
| $sigils[] = 'phui-oi-selectable'; | $sigils[] = 'phui-oi-selectable'; | ||||
| Javelin::initBehavior('phui-selectable-list'); | Javelin::initBehavior('phui-selectable-list'); | ||||
| } | } | ||||
| if ($this->getGrippable()) { | if ($this->getGrippable()) { | ||||
| $item_classes[] = 'phui-oi-grippable'; | $item_classes[] = 'phui-oi-grippable'; | ||||
| ▲ Show 20 Lines • Show All 334 Lines • ▼ Show 20 Lines | if ($this->countdownNum) { | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'phui-oi-col0 phui-oi-countdown', | 'class' => 'phui-oi-col0 phui-oi-countdown', | ||||
| ), | ), | ||||
| $countdown); | $countdown); | ||||
| } | } | ||||
| if ($this->selectableName !== null) { | if ($this->selectableName !== null) { | ||||
| if (!$this->isForbidden) { | |||||
| $checkbox = phutil_tag( | $checkbox = phutil_tag( | ||||
| 'input', | 'input', | ||||
| array( | array( | ||||
| 'type' => 'checkbox', | 'type' => 'checkbox', | ||||
| 'name' => $this->selectableName, | 'name' => $this->selectableName, | ||||
| 'value' => $this->selectableValue, | 'value' => $this->selectableValue, | ||||
| 'checked' => ($this->isSelected ? 'checked' : null), | 'checked' => ($this->isSelected ? 'checked' : null), | ||||
| )); | )); | ||||
| } else { | |||||
| $checkbox = null; | |||||
| } | |||||
| $column0 = phutil_tag( | $column0 = phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'phui-oi-col0 phui-oi-checkbox', | 'class' => 'phui-oi-col0 phui-oi-checkbox', | ||||
| ), | ), | ||||
| $checkbox); | $checkbox); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 152 Lines • Show Last 20 Lines | |||||