public function renderExample()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     // Icon Buttons
     $icons = array('Go Back' => 'fa-chevron-left bluegrey', 'Choose Date' => 'fa-calendar bluegrey', 'Edit View' => 'fa-pencil bluegrey', 'Go Forward' => 'fa-chevron-right bluegrey');
     $button_bar1 = new PHUIButtonBarView();
     foreach ($icons as $text => $icon) {
         $image = id(new PHUIIconView())->setIconFont($icon);
         $button = id(new PHUIButtonView())->setTag('a')->setColor(PHUIButtonView::GREY)->setTitle($text)->setIcon($image);
         $button_bar1->addButton($button);
     }
     $button_bar2 = new PHUIButtonBarView();
     foreach ($icons as $text => $icon) {
         $image = id(new PHUIIconView())->setIconFont($icon);
         $button = id(new PHUIButtonView())->setTag('a')->setColor(PHUIButtonView::SIMPLE)->setTitle($text)->setText($text);
         $button_bar2->addButton($button);
     }
     $button_bar3 = new PHUIButtonBarView();
     foreach ($icons as $text => $icon) {
         $image = id(new PHUIIconView())->setIconFont($icon);
         $button = id(new PHUIButtonView())->setTag('a')->setColor(PHUIButtonView::SIMPLE)->setTitle($text)->setTooltip($text)->setIcon($image);
         $button_bar3->addButton($button);
     }
     $layout1 = id(new PHUIBoxView())->appendChild($button_bar1)->addClass('ml');
     $layout2 = id(new PHUIBoxView())->appendChild($button_bar2)->addClass('mlr mll mlb');
     $layout3 = id(new PHUIBoxView())->appendChild($button_bar3)->addClass('mlr mll mlb');
     $wrap1 = id(new PHUIObjectBoxView())->setHeaderText(pht('Button Bar Example'))->appendChild($layout1)->appendChild($layout2)->appendChild($layout3);
     return array($wrap1);
 }
 public function renderExample()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     // Icon Buttons
     $icons = array('Go Back' => 'fa-chevron-left bluegrey', 'Choose Date' => 'fa-calendar bluegrey', 'Edit View' => 'fa-pencil bluegrey', 'Go Forward' => 'fa-chevron-right bluegrey');
     $button_bar = new PHUIButtonBarView();
     foreach ($icons as $text => $icon) {
         $image = id(new PHUIIconView())->setIconFont($icon);
         $button = id(new PHUIButtonView())->setTag('a')->setColor(PHUIButtonView::GREY)->setTitle($text)->setIcon($image);
         $button_bar->addButton($button);
     }
     $layout = id(new PHUIBoxView())->appendChild($button_bar)->addPadding(PHUI::PADDING_LARGE);
     $wrap1 = id(new PHUIObjectBoxView())->setHeaderText('Button Bar Example')->appendChild($layout);
     return array($wrap1);
 }
 public function render()
 {
     require_celerity_resource('phui-inline-comment-view-css');
     $inline = $this->inlineComment;
     $classes = array('differential-inline-comment');
     $metadata = array('id' => $inline->getID(), 'phid' => $inline->getPHID(), 'changesetID' => $inline->getChangesetID(), 'number' => $inline->getLineNumber(), 'length' => $inline->getLineLength(), 'isNewFile' => (bool) $inline->getIsNewFile(), 'on_right' => $this->getIsOnRight(), 'original' => $inline->getContent(), 'replyToCommentPHID' => $inline->getReplyToCommentPHID());
     $sigil = 'differential-inline-comment';
     if ($this->preview) {
         $sigil = $sigil . ' differential-inline-comment-preview';
     }
     $classes = array('differential-inline-comment');
     $content = $inline->getContent();
     $handles = $this->handles;
     $links = array();
     $is_synthetic = false;
     if ($inline->getSyntheticAuthor()) {
         $is_synthetic = true;
     }
     $draft_text = null;
     if (!$is_synthetic) {
         // This display is controlled by CSS
         $draft_text = id(new PHUITagView())->setType(PHUITagView::TYPE_SHADE)->setName(pht('Unsubmitted'))->setSlimShady(true)->setShade(PHUITagView::COLOR_RED)->addClass('mml inline-draft-text');
     }
     $ghost_tag = null;
     $ghost = $inline->getIsGhost();
     $ghost_id = null;
     if ($ghost) {
         if ($ghost['new']) {
             $ghosticon = 'fa-fast-forward';
             $reason = pht('View on forward revision');
         } else {
             $ghosticon = 'fa-fast-backward';
             $reason = pht('View on previous revision');
         }
         $ghost_icon = id(new PHUIIconView())->setIconFont($ghosticon)->addSigil('has-tooltip')->setMetadata(array('tip' => $reason, 'size' => 300));
         $ghost_tag = phutil_tag('a', array('class' => 'ghost-icon', 'href' => $ghost['href'], 'target' => '_blank'), $ghost_icon);
         $classes[] = 'inline-comment-ghost';
     }
     // I think this is unused
     if ($inline->getHasReplies()) {
         $classes[] = 'inline-comment-has-reply';
     }
     // I think this is unused
     if ($inline->getReplyToCommentPHID()) {
         $classes[] = 'inline-comment-is-reply';
     }
     $viewer_phid = $this->getUser()->getPHID();
     $owner_phid = $this->getObjectOwnerPHID();
     if ($viewer_phid) {
         if ($viewer_phid == $owner_phid) {
             $classes[] = 'viewer-is-object-owner';
         }
     }
     $nextprev = null;
     if (!$this->preview) {
         $nextprev = new PHUIButtonBarView();
         $nextprev->setBorderless(true);
         $nextprev->addClass('inline-button-divider');
         $up = id(new PHUIButtonView())->setTag('a')->setTooltip(pht('Previous'))->setIconFont('fa-chevron-up')->addSigil('differential-inline-prev')->setMustCapture(true);
         $down = id(new PHUIButtonView())->setTag('a')->setTooltip(pht('Next'))->setIconFont('fa-chevron-down')->addSigil('differential-inline-next')->setMustCapture(true);
         if ($this->canHide()) {
             $hide = id(new PHUIButtonView())->setTag('a')->setTooltip(pht('Hide Comment'))->setIconFont('fa-times')->addSigil('hide-inline')->setMustCapture(true);
             $nextprev->addButton($hide);
         }
         $nextprev->addButton($up);
         $nextprev->addButton($down);
         $action_buttons = array();
         if ($this->allowReply) {
             if (!$is_synthetic) {
                 // NOTE: No product reason why you can't reply to these, but the reply
                 // mechanism currently sends the inline comment ID to the server, not
                 // file/line information, and synthetic comments don't have an inline
                 // comment ID.
                 $action_buttons[] = id(new PHUIButtonView())->setTag('a')->setIconFont('fa-reply')->setTooltip(pht('Reply'))->addSigil('differential-inline-reply')->setMustCapture(true);
             }
         }
     }
     $anchor_name = $this->getAnchorName();
     if ($this->editable && !$this->preview) {
         $action_buttons[] = id(new PHUIButtonView())->setTag('a')->setIconFont('fa-pencil')->setTooltip(pht('Edit'))->addSigil('differential-inline-edit')->setMustCapture(true);
         $action_buttons[] = id(new PHUIButtonView())->setTag('a')->setIconFont('fa-trash-o')->setTooltip(pht('Delete'))->addSigil('differential-inline-delete')->setMustCapture(true);
     } else {
         if ($this->preview) {
             $links[] = javelin_tag('a', array('class' => 'inline-button-divider pml msl', 'meta' => array('anchor' => $anchor_name), 'sigil' => 'differential-inline-preview-jump'), pht('Not Visible'));
             $action_buttons[] = id(new PHUIButtonView())->setTag('a')->setTooltip(pht('Delete'))->setIconFont('fa-trash-o')->addSigil('differential-inline-delete')->setMustCapture(true);
         }
     }
     $done_button = null;
     if (!$is_synthetic) {
         $draft_state = false;
         switch ($inline->getFixedState()) {
             case PhabricatorInlineCommentInterface::STATE_DRAFT:
                 $is_done = $this->getCanMarkDone();
                 $draft_state = true;
                 break;
             case PhabricatorInlineCommentInterface::STATE_UNDRAFT:
                 $is_done = !$this->getCanMarkDone();
                 $draft_state = true;
                 break;
             case PhabricatorInlineCommentInterface::STATE_DONE:
                 $is_done = true;
                 break;
             default:
             case PhabricatorInlineCommentInterface::STATE_UNDONE:
                 $is_done = false;
                 break;
         }
         // If you don't have permission to mark the comment as "Done", you also
         // can not see the draft state.
         if (!$this->getCanMarkDone()) {
             $draft_state = false;
         }
         if ($is_done) {
             $classes[] = 'inline-is-done';
         }
         if ($draft_state) {
             $classes[] = 'inline-state-is-draft';
         }
         if ($this->getCanMarkDone()) {
             $done_input = javelin_tag('input', array('type' => 'checkbox', 'checked' => $is_done ? 'checked' : null, 'disabled' => $this->getCanMarkDone() ? null : 'disabled', 'class' => 'differential-inline-done', 'sigil' => 'differential-inline-done'));
             $done_button = phutil_tag('label', array('class' => 'differential-inline-done-label ' . ($this->getCanMarkDone() ? null : 'done-is-disabled')), array($done_input, pht('Done')));
         } else {
             if ($is_done) {
                 $icon = id(new PHUIIconView())->setIconFont('fa-check sky msr');
                 $label = pht('Done');
                 $class = 'button-done';
             } else {
                 $icon = null;
                 $label = pht('Not Done');
                 $class = 'button-not-done';
             }
             $done_button = phutil_tag('div', array('class' => 'done-label ' . $class), array($icon, $label));
         }
     }
     $content = $this->markupEngine->getOutput($inline, PhabricatorInlineCommentInterface::MARKUP_FIELD_BODY);
     if ($this->preview) {
         $anchor = null;
     } else {
         $anchor = phutil_tag('a', array('name' => $anchor_name, 'id' => $anchor_name, 'class' => 'differential-inline-comment-anchor'), '');
     }
     if ($inline->isDraft() && !$is_synthetic) {
         $classes[] = 'inline-state-is-draft';
     }
     if ($is_synthetic) {
         $classes[] = 'differential-inline-comment-synthetic';
     }
     $classes = implode(' ', $classes);
     $author_owner = null;
     if ($is_synthetic) {
         $author = $inline->getSyntheticAuthor();
     } else {
         $author = $handles[$inline->getAuthorPHID()]->getName();
         if ($inline->getAuthorPHID() == $this->objectOwnerPHID) {
             $author_owner = id(new PHUITagView())->setType(PHUITagView::TYPE_SHADE)->setName(pht('Author'))->setSlimShady(true)->setShade(PHUITagView::COLOR_YELLOW)->addClass('mml');
         }
     }
     $actions = null;
     if ($action_buttons) {
         $actions = new PHUIButtonBarView();
         $actions->setBorderless(true);
         $actions->addClass('inline-button-divider');
         foreach ($action_buttons as $button) {
             $actions->addButton($button);
         }
     }
     $group_left = phutil_tag('div', array('class' => 'inline-head-left'), array($author, $author_owner, $draft_text, $ghost_tag));
     $group_right = phutil_tag('div', array('class' => 'inline-head-right'), array($anchor, $done_button, $links, $actions, $nextprev));
     $markup = javelin_tag('div', array('class' => $classes, 'sigil' => $sigil, 'meta' => $metadata), array(phutil_tag_div('differential-inline-comment-head grouped', array($group_left, $group_right)), phutil_tag_div('differential-inline-comment-content', phutil_tag_div('phabricator-remarkup', $content))));
     return $markup;
 }
 private function renderCalendarHeader(DateTime $date)
 {
     $button_bar = null;
     // check for a browseURI, which means we need "fancy" prev / next UI
     $uri = $this->getBrowseURI();
     if ($uri) {
         list($prev_year, $prev_month) = $this->getPrevYearAndMonth();
         $prev_uri = $uri . $prev_year . '/' . $prev_month . '/';
         list($next_year, $next_month) = $this->getNextYearAndMonth();
         $next_uri = $uri . $next_year . '/' . $next_month . '/';
         $button_bar = new PHUIButtonBarView();
         $left_icon = id(new PHUIIconView())->setIcon('fa-chevron-left bluegrey');
         $left = id(new PHUIButtonView())->setTag('a')->setColor(PHUIButtonView::GREY)->setHref($prev_uri)->setTitle(pht('Previous Month'))->setIcon($left_icon);
         $right_icon = id(new PHUIIconView())->setIcon('fa-chevron-right bluegrey');
         $right = id(new PHUIButtonView())->setTag('a')->setColor(PHUIButtonView::GREY)->setHref($next_uri)->setTitle(pht('Next Month'))->setIcon($right_icon);
         $button_bar->addButton($left);
         $button_bar->addButton($right);
     }
     $header = id(new PHUIHeaderView());
     if ($button_bar) {
         $header->setButtonBar($button_bar);
     }
     if ($this->image) {
         $header->setImage($this->image);
     }
     return $header;
 }
 private function renderDayViewHeader()
 {
     $button_bar = null;
     $uri = $this->getBrowseURI();
     if ($uri) {
         list($prev_year, $prev_month, $prev_day) = $this->getPrevDay();
         $prev_uri = $uri . $prev_year . '/' . $prev_month . '/' . $prev_day . '/';
         list($next_year, $next_month, $next_day) = $this->getNextDay();
         $next_uri = $uri . $next_year . '/' . $next_month . '/' . $next_day . '/';
         $button_bar = new PHUIButtonBarView();
         $left_icon = id(new PHUIIconView())->setIconFont('fa-chevron-left bluegrey');
         $left = id(new PHUIButtonView())->setTag('a')->setColor(PHUIButtonView::GREY)->setHref($prev_uri)->setTitle(pht('Previous Day'))->setIcon($left_icon);
         $right_icon = id(new PHUIIconView())->setIconFont('fa-chevron-right bluegrey');
         $right = id(new PHUIButtonView())->setTag('a')->setColor(PHUIButtonView::GREY)->setHref($next_uri)->setTitle(pht('Next Day'))->setIcon($right_icon);
         $button_bar->addButton($left);
         $button_bar->addButton($right);
     }
     $display_day = $this->getDateTime();
     $header_text = $display_day->format('l, F j, Y');
     $header = id(new PHUIHeaderView())->setHeader($header_text);
     if ($button_bar) {
         $header->setButtonBar($button_bar);
     }
     return $header;
 }
 private function renderCalendarHeader(DateTime $date)
 {
     $button_bar = null;
     // check for a browseURI, which means we need "fancy" prev / next UI
     $uri = $this->getBrowseURI();
     if ($uri) {
         $uri = new PhutilURI($uri);
         list($prev_year, $prev_month) = $this->getPrevYearAndMonth();
         $query = array('year' => $prev_year, 'month' => $prev_month);
         $prev_uri = (string) $uri->setQueryParams($query);
         list($next_year, $next_month) = $this->getNextYearAndMonth();
         $query = array('year' => $next_year, 'month' => $next_month);
         $next_uri = (string) $uri->setQueryParams($query);
         $button_bar = new PHUIButtonBarView();
         $left_icon = id(new PHUIIconView())->setIconFont('fa-chevron-left bluegrey');
         $left = id(new PHUIButtonView())->setTag('a')->setColor(PHUIButtonView::GREY)->setHref($prev_uri)->setTitle(pht('Previous Month'))->setIcon($left_icon);
         $right_icon = id(new PHUIIconView())->setIconFont('fa-chevron-right bluegrey');
         $right = id(new PHUIButtonView())->setTag('a')->setColor(PHUIButtonView::GREY)->setHref($next_uri)->setTitle(pht('Next Month'))->setIcon($right_icon);
         $button_bar->addButton($left);
         $button_bar->addButton($right);
     }
     $header = id(new PHUIHeaderView())->setHeader($date->format('F Y'));
     if ($button_bar) {
         $header->setButtonBar($button_bar);
     }
     if ($this->image) {
         $header->setImage($this->image);
     }
     return $header;
 }