private function renderPager()

in web_ui/src/applications/bistro/controllers/BistroHTTPTaskLogViewController.php [284:345]


  private function renderPager($is_unbounded, $next_line_id) {
    $request = $this->getRequest();
    $is_ascending = $this->prefs->get(BistroTaskLogPrefs::PREF_ASCENDING);

    $oldest_text = "|\xe2\x97\x80";
    $fwd_text = "\xe2\x97\x80";
    $back_text = "\xe2\x96\xb6";
    $newest_text = "\xe2\x96\xb6|";

    // The action of the "older" & "newer" buttons is reversed by this flag.
    if ($is_ascending) {
      list($fwd_text, $back_text) = array($back_text, $fwd_text);
    }
    $showing_start = $next_line_id === self::NOT_A_LINE_ID;
    $showing_end = $is_unbounded;
    $fwd = $this->prefs->renderUpdateForm(
      $request,
      array(
        BistroTaskLogPrefs::PREF_TIME => null,  // Unset any timestamp
        BistroTaskLogPrefs::PREF_LINE_ID => $next_line_id),
      id(new AphrontFormSubmitControl())
        ->setValue($fwd_text)
        ->setDisabled($showing_start));
    $back = $this->prefs->renderUpdateForm(
      $request,
      array(BistroTaskLogPrefs::PREF_ASCENDING => !!!$is_ascending),
      id(new AphrontFormSubmitControl())
        ->setValue($back_text)
        ->setDisabled($showing_end));
    // Don't switch the button locations around when the direction changes.
    if ($is_ascending) {
      list($fwd, $back) = array($back, $fwd);
      list($showing_start, $showing_end) = array($showing_end, $showing_start);
    }

    // Getting "oldest" and "newest" does not depend on $is_ascending.
    $start = $this->prefs->renderUpdateForm(
      $request,
      array(
        BistroTaskLogPrefs::PREF_TIME => null,
        BistroTaskLogPrefs::PREF_LINE_ID => null,
        BistroTaskLogPrefs::PREF_ASCENDING => 1),
      id(new AphrontFormSubmitControl())
        ->setValue($oldest_text)
        ->setDisabled($showing_start));
    $end = $this->prefs->renderUpdateForm(
      $request,
      array(
        BistroTaskLogPrefs::PREF_TIME => null,
        BistroTaskLogPrefs::PREF_LINE_ID => null,
        BistroTaskLogPrefs::PREF_ASCENDING => 0),
      id(new AphrontFormSubmitControl())
        ->setValue($newest_text)
        ->setDisabled($showing_end));

    return phabricator_tag('div', array('class' => 'log-pager'), array(
      phabricator_tag('span', array('class' => 'log-pager-left'), array(
        phabricator_tag('span', array(), array($start)),
        phabricator_tag('span', array(), array($fwd)))),
      phabricator_tag('span', array(), array($back)),
      phabricator_tag('span', array(), array($end))));
  }