Changeset View
Changeset View
Standalone View
Standalone View
src/view/phui/PHUIObjectItemView.php
Show All 23 Lines | final class PHUIObjectItemView extends AphrontTagView { | ||||
private $titleText; | private $titleText; | ||||
private $badge; | private $badge; | ||||
private $countdownNum; | private $countdownNum; | ||||
private $countdownNoun; | private $countdownNoun; | ||||
private $sideColumn; | private $sideColumn; | ||||
private $coverImage; | private $coverImage; | ||||
private $description; | private $description; | ||||
private $selectableName; | |||||
private $selectableValue; | |||||
private $isSelected; | |||||
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 115 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) { | |||||
$this->selectableName = $name; | |||||
$this->selectableValue = $value; | |||||
$this->isSelected = $is_selected; | |||||
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; | ||||
} | } | ||||
public function addAction(PHUIListItemView $action) { | public function addAction(PHUIListItemView $action) { | ||||
if (count($this->actions) >= 3) { | if (count($this->actions) >= 3) { | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | public function setSideColumn($column) { | ||||
return $this; | return $this; | ||||
} | } | ||||
protected function getTagName() { | protected function getTagName() { | ||||
return 'li'; | return 'li'; | ||||
} | } | ||||
protected function getTagAttributes() { | protected function getTagAttributes() { | ||||
$sigils = array(); | |||||
$item_classes = array(); | $item_classes = array(); | ||||
$item_classes[] = 'phui-oi'; | $item_classes[] = 'phui-oi'; | ||||
if ($this->icons) { | if ($this->icons) { | ||||
$item_classes[] = 'phui-oi-with-icons'; | $item_classes[] = 'phui-oi-with-icons'; | ||||
} | } | ||||
if ($this->attributes) { | if ($this->attributes) { | ||||
Show All 31 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) { | |||||
$item_classes[] = 'phui-oi-selected'; | |||||
} | |||||
if ($this->selectableName !== null) { | |||||
$item_classes[] = 'phui-oi-selectable'; | |||||
$sigils[] = 'phui-oi-selectable'; | |||||
Javelin::initBehavior('phui-selectable-list'); | |||||
} | |||||
if ($this->getGrippable()) { | if ($this->getGrippable()) { | ||||
$item_classes[] = 'phui-oi-grippable'; | $item_classes[] = 'phui-oi-grippable'; | ||||
} | } | ||||
if ($this->getImageURI()) { | if ($this->getImageURI()) { | ||||
$item_classes[] = 'phui-oi-with-image'; | $item_classes[] = 'phui-oi-with-image'; | ||||
} | } | ||||
if ($this->getImageIcon()) { | if ($this->getImageIcon()) { | ||||
$item_classes[] = 'phui-oi-with-image-icon'; | $item_classes[] = 'phui-oi-with-image-icon'; | ||||
} | } | ||||
return array( | return array( | ||||
'class' => $item_classes, | 'class' => $item_classes, | ||||
'sigil' => $sigils, | |||||
); | ); | ||||
} | } | ||||
protected function getTagContent() { | protected function getTagContent() { | ||||
$viewer = $this->getUser(); | $viewer = $this->getUser(); | ||||
$content_classes = array(); | $content_classes = array(); | ||||
$content_classes[] = 'phui-oi-content'; | $content_classes[] = 'phui-oi-content'; | ||||
▲ Show 20 Lines • Show All 312 Lines • ▼ Show 20 Lines | if ($this->countdownNum) { | ||||
$column0 = phutil_tag( | $column0 = phutil_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
'class' => 'phui-oi-col0 phui-oi-countdown', | 'class' => 'phui-oi-col0 phui-oi-countdown', | ||||
), | ), | ||||
$countdown); | $countdown); | ||||
} | } | ||||
if ($this->selectableName !== null) { | |||||
$checkbox = phutil_tag( | |||||
'input', | |||||
array( | |||||
'type' => 'checkbox', | |||||
'name' => $this->selectableName, | |||||
'value' => $this->selectableValue, | |||||
'checked' => ($this->isSelected ? 'checked' : null), | |||||
)); | |||||
$column0 = phutil_tag( | |||||
'div', | |||||
array( | |||||
'class' => 'phui-oi-col0 phui-oi-checkbox', | |||||
), | |||||
$checkbox); | |||||
} | |||||
$column1 = phutil_tag( | $column1 = phutil_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
'class' => 'phui-oi-col1', | 'class' => 'phui-oi-col1', | ||||
), | ), | ||||
array( | array( | ||||
$header, | $header, | ||||
$content, | $content, | ||||
▲ Show 20 Lines • Show All 143 Lines • Show Last 20 Lines |