当前位置: 首页>>代码示例>>PHP>>正文


PHP AphrontTableView::makeSortable方法代码示例

本文整理汇总了PHP中AphrontTableView::makeSortable方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontTableView::makeSortable方法的具体用法?PHP AphrontTableView::makeSortable怎么用?PHP AphrontTableView::makeSortable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AphrontTableView的用法示例。


在下文中一共展示了AphrontTableView::makeSortable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderExample

 public function renderExample()
 {
     $rows = array(array('make' => 'Honda', 'model' => 'Civic', 'year' => 2004, 'price' => 3199, 'color' => pht('Blue')), array('make' => 'Ford', 'model' => 'Focus', 'year' => 2001, 'price' => 2549, 'color' => pht('Red')), array('make' => 'Toyota', 'model' => 'Camry', 'year' => 2009, 'price' => 4299, 'color' => pht('Black')), array('make' => 'NASA', 'model' => 'Shuttle', 'year' => 1998, 'price' => 1000000000, 'color' => pht('White')));
     $request = $this->getRequest();
     $orders = array('make', 'model', 'year', 'price');
     $sort = $request->getStr('sort');
     list($sort, $reverse) = AphrontTableView::parseSort($sort);
     if (!in_array($sort, $orders)) {
         $sort = 'make';
     }
     $rows = isort($rows, $sort);
     if ($reverse) {
         $rows = array_reverse($rows);
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array(pht('Make'), pht('Model'), pht('Year'), pht('Price'), pht('Color')));
     $table->setColumnClasses(array('', 'wide', 'n', 'n', ''));
     $table->makeSortable($request->getRequestURI(), 'sort', $sort, $reverse, $orders);
     $panel = new PHUIObjectBoxView();
     $panel->setHeaderText(pht('Sortable Table of Vehicles'));
     $panel->appendChild($table);
     return $panel;
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:23,代码来源:PhabricatorSortTableUIExample.php

示例2: renderOpenTasks


//.........这里部分代码省略.........
                 // If filtering by, e.g., "bugs", don't show a "bugs" group.
                 continue;
             }
             $tasks = idx($result, $handle->getPHID(), array());
             $name = phutil_render_tag('a', array('href' => $base_link . $handle->getPHID()), phutil_escape_html($handle->getName()));
             $closed = idx($result_closed, $handle->getPHID(), array());
         } else {
             $tasks = $leftover;
             $name = $leftover_name;
             $closed = $leftover_closed;
         }
         $taskv = $tasks;
         $tasks = mgroup($tasks, 'getPriority');
         $row = array();
         $row[] = $name;
         $total = 0;
         foreach (ManiphestTaskPriority::getTaskPriorityMap() as $pri => $label) {
             $n = count(idx($tasks, $pri, array()));
             if ($n == 0) {
                 $row[] = '-';
             } else {
                 $row[] = number_format($n);
             }
             $total += $n;
         }
         $row[] = number_format($total);
         list($link, $oldest_all) = $this->renderOldest($taskv);
         $row[] = $link;
         $normal_or_better = array();
         foreach ($taskv as $id => $task) {
             if ($task->getPriority() < ManiphestTaskPriority::PRIORITY_NORMAL) {
                 continue;
             }
             $normal_or_better[$id] = $task;
         }
         list($link, $oldest_pri) = $this->renderOldest($normal_or_better);
         $row[] = $link;
         if ($closed) {
             $task_ids = implode(',', mpull($closed, 'getID'));
             $row[] = phutil_render_tag('a', array('href' => '/maniphest/view/custom/?s=oc&tasks=' . $task_ids, 'target' => '_blank'), phutil_escape_html(number_format(count($closed))));
         } else {
             $row[] = '-';
         }
         switch ($order) {
             case 'total':
                 $row['sort'] = $total;
                 break;
             case 'oldest-all':
                 $row['sort'] = $oldest_all;
                 break;
             case 'oldest-pri':
                 $row['sort'] = $oldest_pri;
                 break;
             case 'closed':
                 $row['sort'] = count($closed);
                 break;
             case 'name':
             default:
                 $row['sort'] = $handle ? $handle->getName() : '~';
                 break;
         }
         $rows[] = $row;
     }
     $rows = isort($rows, 'sort');
     foreach ($rows as $k => $row) {
         unset($rows[$k]['sort']);
     }
     if ($reverse) {
         $rows = array_reverse($rows);
     }
     $cname = array($col_header);
     $cclass = array('pri right wide');
     $pri_map = ManiphestTaskPriority::getTaskBriefPriorityMap();
     foreach ($pri_map as $pri => $label) {
         $cname[] = $label;
         $cclass[] = 'n';
     }
     $cname[] = 'Total';
     $cclass[] = 'n';
     $cname[] = javelin_render_tag('span', array('sigil' => 'has-tooltip', 'meta' => array('tip' => 'Oldest open task.', 'size' => 200)), 'Oldest (All)');
     $cclass[] = 'n';
     $cname[] = javelin_render_tag('span', array('sigil' => 'has-tooltip', 'meta' => array('tip' => 'Oldest open task, excluding those with Low or Wishlist ' . 'priority.', 'size' => 200)), 'Oldest (Pri)');
     $cclass[] = 'n';
     list($ignored, $window_epoch) = $this->getWindow();
     $cname[] = javelin_render_tag('span', array('sigil' => 'has-tooltip', 'meta' => array('tip' => 'Closed after ' . phabricator_datetime($window_epoch, $user), 'size' => 260)), 'Recently Closed');
     $cclass[] = 'n';
     $table = new AphrontTableView($rows);
     $table->setHeaders($cname);
     $table->setColumnClasses($cclass);
     $table->makeSortable($request->getRequestURI(), 'order', $order, $reverse, array('name', null, null, null, null, null, null, 'total', 'oldest-all', 'oldest-pri', 'closed'));
     $panel = new AphrontPanelView();
     $panel->setHeader($header);
     $panel->appendChild($table);
     $tokens = array();
     if ($project_handle) {
         $tokens = array($project_handle->getPHID() => $project_handle->getFullName());
     }
     $filter = $this->renderReportFilters($tokens, $has_window = true);
     return array($filter, $panel);
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:101,代码来源:ManiphestReportController.php

示例3: renderOpenTasks


//.........这里部分代码省略.........
             $tasks = idx($result, $handle->getPHID(), array());
             $name = phutil_tag('a', array('href' => $base_link . $handle->getPHID()), $handle->getName());
             $closed = idx($result_closed, $handle->getPHID(), array());
         } else {
             $tasks = $leftover;
             $name = $leftover_name;
             $closed = $leftover_closed;
         }
         $taskv = $tasks;
         $tasks = mgroup($tasks, 'getPriority');
         $row = array();
         $row[] = $name;
         $total = 0;
         foreach (ManiphestTaskPriority::getTaskPriorityMap() as $pri => $label) {
             $n = count(idx($tasks, $pri, array()));
             if ($n == 0) {
                 $row[] = '-';
             } else {
                 $row[] = number_format($n);
             }
             $total += $n;
         }
         $row[] = number_format($total);
         list($link, $oldest_all) = $this->renderOldest($taskv);
         $row[] = $link;
         $normal_or_better = array();
         foreach ($taskv as $id => $task) {
             // TODO: This is sort of a hard-code for the default "normal" status.
             // When reports are more powerful, this should be made more general.
             if ($task->getPriority() < 50) {
                 continue;
             }
             $normal_or_better[$id] = $task;
         }
         list($link, $oldest_pri) = $this->renderOldest($normal_or_better);
         $row[] = $link;
         if ($closed) {
             $task_ids = implode(',', mpull($closed, 'getID'));
             $row[] = phutil_tag('a', array('href' => '/maniphest/?ids=' . $task_ids, 'target' => '_blank'), number_format(count($closed)));
         } else {
             $row[] = '-';
         }
         switch ($order) {
             case 'total':
                 $row['sort'] = $total;
                 break;
             case 'oldest-all':
                 $row['sort'] = $oldest_all;
                 break;
             case 'oldest-pri':
                 $row['sort'] = $oldest_pri;
                 break;
             case 'closed':
                 $row['sort'] = count($closed);
                 break;
             case 'name':
             default:
                 $row['sort'] = $handle ? $handle->getName() : '~';
                 break;
         }
         $rows[] = $row;
     }
     $rows = isort($rows, 'sort');
     foreach ($rows as $k => $row) {
         unset($rows[$k]['sort']);
     }
     if ($reverse) {
         $rows = array_reverse($rows);
     }
     $cname = array($col_header);
     $cclass = array('pri right wide');
     $pri_map = ManiphestTaskPriority::getShortNameMap();
     foreach ($pri_map as $pri => $label) {
         $cname[] = $label;
         $cclass[] = 'n';
     }
     $cname[] = pht('Total');
     $cclass[] = 'n';
     $cname[] = javelin_tag('span', array('sigil' => 'has-tooltip', 'meta' => array('tip' => pht('Oldest open task.'), 'size' => 200)), pht('Oldest (All)'));
     $cclass[] = 'n';
     $cname[] = javelin_tag('span', array('sigil' => 'has-tooltip', 'meta' => array('tip' => pht('Oldest open task, excluding those with Low or Wishlist priority.'), 'size' => 200)), pht('Oldest (Pri)'));
     $cclass[] = 'n';
     list($ignored, $window_epoch) = $this->getWindow();
     $edate = phabricator_datetime($window_epoch, $viewer);
     $cname[] = javelin_tag('span', array('sigil' => 'has-tooltip', 'meta' => array('tip' => pht('Closed after %s', $edate), 'size' => 260)), pht('Recently Closed'));
     $cclass[] = 'n';
     $table = new AphrontTableView($rows);
     $table->setHeaders($cname);
     $table->setColumnClasses($cclass);
     $table->makeSortable($request->getRequestURI(), 'order', $order, $reverse, array('name', null, null, null, null, null, null, 'total', 'oldest-all', 'oldest-pri', 'closed'));
     $panel = new PHUIObjectBoxView();
     $panel->setHeaderText($header);
     $panel->setTable($table);
     $tokens = array();
     if ($project_handle) {
         $tokens = array($project_handle);
     }
     $filter = $this->renderReportFilters($tokens, $has_window = true);
     return array($filter, $panel);
 }
开发者ID:truSense,项目名称:phabricator,代码行数:101,代码来源:ManiphestReportController.php

示例4: buildOpenTasksTable

 /**
  * @param string[] $cclass
  * @param string $order
  * @param integer $reverse
  */
 private function buildOpenTasksTable($rows, $cname, $cclass, $order, $reverse)
 {
     $table = new AphrontTableView($rows);
     $table->setHeaders($cname);
     $table->setColumnClasses($cclass);
     $table->makeSortable($this->request->getRequestURI(), 'order', $order, $reverse, array('name', null, null, null, null, null, null, 'total', 'oldest-all', 'oldest-pri', 'closed'));
     return $table;
 }
开发者ID:yangming85,项目名称:phabricator-extensions-Sprint,代码行数:13,代码来源:SprintReportOpenTasksView.php


注:本文中的AphrontTableView::makeSortable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。