當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AphrontTableView::parseSort方法代碼示例

本文整理匯總了PHP中AphrontTableView::parseSort方法的典型用法代碼示例。如果您正苦於以下問題:PHP AphrontTableView::parseSort方法的具體用法?PHP AphrontTableView::parseSort怎麽用?PHP AphrontTableView::parseSort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AphrontTableView的用法示例。


在下文中一共展示了AphrontTableView::parseSort方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: render

 public function render()
 {
     $project_phid = $this->request->getStr('project');
     $project_handle = null;
     if ($project_phid) {
         $phids = array($project_phid);
         $project_handle = $this->getProjectHandle($phids, $project_phid, $this->request);
         $tasks = $this->getOpenTasksforProject($this->user, $phids);
     } else {
         $tasks = $this->getOpenTasks($this->user);
     }
     $recently_closed = $this->loadRecentlyClosedTasks();
     $date = phabricator_date(time(), $this->user);
     $viewer_task_view = new UserOpenTasksView();
     $project_task_view = new ProjectOpenTasksView();
     if ($this->view == 'user') {
         list($leftover, $leftover_closed, $base_link, $leftover_name, $col_header, $header, $result_closed, $result) = $viewer_task_view->execute($tasks, $recently_closed, $date);
     } else {
         if ($this->view == 'project') {
             list($leftover, $base_link, $leftover_name, $col_header, $header, $result_closed, $leftover_closed, $result) = $project_task_view->execute($tasks, $recently_closed, $date);
         } else {
             $result = array();
             $result_closed = array();
             $base_link = null;
             $leftover = array();
             $leftover_closed = array();
             $leftover_name = null;
             $col_header = '';
             $header = '';
         }
     }
     $order = $this->request->getStr('order', 'name');
     list($order, $reverse) = AphrontTableView::parseSort($order);
     require_celerity_resource('aphront-tooltip-css');
     Javelin::initBehavior('phabricator-tooltips', array());
     $rows = $this->buildRowsfromResult($project_handle, $result, $result_closed, $base_link, $leftover, $leftover_name, $leftover_closed, $order, $reverse);
     list($cname, $cclass) = $this->buildTableColumns($col_header);
     $table = $this->buildOpenTasksTable($rows, $cname, $cclass, $order, $reverse);
     $panel = new PHUIObjectBoxView();
     $panel->setHeaderText($header);
     $panel->setTable($table);
     $tokens = array();
     if ($project_handle) {
         $tokens = array($project_handle);
     }
     $filter = $this->renderReportFilters($tokens, $has_window = false, $this->request, $this->user);
     return array($filter, $panel);
 }
開發者ID:yangming85,項目名稱:phabricator-extensions-Sprint,代碼行數:48,代碼來源:SprintReportOpenTasksView.php

示例2: 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

示例3: renderOpenTasks

 public function renderOpenTasks()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $query = id(new ManiphestTaskQuery())->withStatus(ManiphestTaskQuery::STATUS_OPEN);
     $project_phid = $request->getStr('project');
     $project_handle = null;
     if ($project_phid) {
         $phids = array($project_phid);
         $handles = $this->loadViewerHandles($phids);
         $project_handle = $handles[$project_phid];
         $query->withAnyProjects($phids);
     }
     $tasks = $query->execute();
     $recently_closed = $this->loadRecentlyClosedTasks();
     $date = phabricator_date(time(), $user);
     switch ($this->view) {
         case 'user':
             $result = mgroup($tasks, 'getOwnerPHID');
             $leftover = idx($result, '', array());
             unset($result['']);
             $result_closed = mgroup($recently_closed, 'getOwnerPHID');
             $leftover_closed = idx($result_closed, '', array());
             unset($result_closed['']);
             $base_link = '/maniphest/?users=';
             $leftover_name = phutil_render_tag('a', array('href' => $base_link . ManiphestTaskOwner::OWNER_UP_FOR_GRABS), '<em>(Up For Grabs)</em>');
             $col_header = 'User';
             $header = 'Open Tasks by User and Priority (' . $date . ')';
             break;
         case 'project':
             $result = array();
             $leftover = array();
             foreach ($tasks as $task) {
                 $phids = $task->getProjectPHIDs();
                 if ($phids) {
                     foreach ($phids as $project_phid) {
                         $result[$project_phid][] = $task;
                     }
                 } else {
                     $leftover[] = $task;
                 }
             }
             $result_closed = array();
             $leftover_closed = array();
             foreach ($recently_closed as $task) {
                 $phids = $task->getProjectPHIDs();
                 if ($phids) {
                     foreach ($phids as $project_phid) {
                         $result_closed[$project_phid][] = $task;
                     }
                 } else {
                     $leftover_closed[] = $task;
                 }
             }
             $base_link = '/maniphest/view/all/?projects=';
             $leftover_name = phutil_render_tag('a', array('href' => $base_link . ManiphestTaskOwner::PROJECT_NO_PROJECT), '<em>(No Project)</em>');
             $col_header = 'Project';
             $header = 'Open Tasks by Project and Priority (' . $date . ')';
             break;
     }
     $phids = array_keys($result);
     $handles = $this->loadViewerHandles($phids);
     $handles = msort($handles, 'getName');
     $order = $request->getStr('order', 'name');
     list($order, $reverse) = AphrontTableView::parseSort($order);
     require_celerity_resource('aphront-tooltip-css');
     Javelin::initBehavior('phabricator-tooltips', array());
     $rows = array();
     $pri_total = array();
     foreach (array_merge($handles, array(null)) as $handle) {
         if ($handle) {
             if ($project_handle && $project_handle->getPHID() == $handle->getPHID()) {
                 // 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;
//.........這裏部分代碼省略.........
開發者ID:rudimk,項目名稱:phabricator,代碼行數:101,代碼來源:ManiphestReportController.php

示例4: renderOpenTasks

 public function renderOpenTasks()
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $query = id(new ManiphestTaskQuery())->setViewer($viewer)->withStatuses(ManiphestTaskStatus::getOpenStatusConstants());
     switch ($this->view) {
         case 'project':
             $query->needProjectPHIDs(true);
             break;
     }
     $project_phid = $request->getStr('project');
     $project_handle = null;
     if ($project_phid) {
         $phids = array($project_phid);
         $handles = $this->loadViewerHandles($phids);
         $project_handle = $handles[$project_phid];
         $query->withEdgeLogicPHIDs(PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, PhabricatorQueryConstraint::OPERATOR_OR, $phids);
     }
     $tasks = $query->execute();
     $recently_closed = $this->loadRecentlyClosedTasks();
     $date = phabricator_date(time(), $viewer);
     switch ($this->view) {
         case 'user':
             $result = mgroup($tasks, 'getOwnerPHID');
             $leftover = idx($result, '', array());
             unset($result['']);
             $result_closed = mgroup($recently_closed, 'getOwnerPHID');
             $leftover_closed = idx($result_closed, '', array());
             unset($result_closed['']);
             $base_link = '/maniphest/?assigned=';
             $leftover_name = phutil_tag('em', array(), pht('(Up For Grabs)'));
             $col_header = pht('User');
             $header = pht('Open Tasks by User and Priority (%s)', $date);
             break;
         case 'project':
             $result = array();
             $leftover = array();
             foreach ($tasks as $task) {
                 $phids = $task->getProjectPHIDs();
                 if ($phids) {
                     foreach ($phids as $project_phid) {
                         $result[$project_phid][] = $task;
                     }
                 } else {
                     $leftover[] = $task;
                 }
             }
             $result_closed = array();
             $leftover_closed = array();
             foreach ($recently_closed as $task) {
                 $phids = $task->getProjectPHIDs();
                 if ($phids) {
                     foreach ($phids as $project_phid) {
                         $result_closed[$project_phid][] = $task;
                     }
                 } else {
                     $leftover_closed[] = $task;
                 }
             }
             $base_link = '/maniphest/?projects=';
             $leftover_name = phutil_tag('em', array(), pht('(No Project)'));
             $col_header = pht('Project');
             $header = pht('Open Tasks by Project and Priority (%s)', $date);
             break;
     }
     $phids = array_keys($result);
     $handles = $this->loadViewerHandles($phids);
     $handles = msort($handles, 'getName');
     $order = $request->getStr('order', 'name');
     list($order, $reverse) = AphrontTableView::parseSort($order);
     require_celerity_resource('aphront-tooltip-css');
     Javelin::initBehavior('phabricator-tooltips', array());
     $rows = array();
     $pri_total = array();
     foreach (array_merge($handles, array(null)) as $handle) {
         if ($handle) {
             if ($project_handle && $project_handle->getPHID() == $handle->getPHID()) {
                 // If filtering by, e.g., "bugs", don't show a "bugs" group.
                 continue;
             }
             $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);
             }
//.........這裏部分代碼省略.........
開發者ID:truSense,項目名稱:phabricator,代碼行數:101,代碼來源:ManiphestReportController.php


注:本文中的AphrontTableView::parseSort方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。