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


PHP isort函数代码示例

本文整理汇总了PHP中isort函数的典型用法代码示例。如果您正苦于以下问题:PHP isort函数的具体用法?PHP isort怎么用?PHP isort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: run

 public function run()
 {
     static $color_map = array('Closed' => 'cyan', 'Needs Review' => 'magenta', 'Needs Revision' => 'red', 'Changes Planned' => 'red', 'Accepted' => 'green', 'No Revision' => 'blue', 'Abandoned' => 'default');
     $revisions = $this->getConduit()->callMethodSynchronous('differential.query', array('authors' => array($this->getUserPHID()), 'status' => 'status-open'));
     if (!$revisions) {
         echo pht('You have no open Differential revisions.') . "\n";
         return 0;
     }
     $repository_api = $this->getRepositoryAPI();
     $info = array();
     foreach ($revisions as $key => $revision) {
         $revision_path = Filesystem::resolvePath($revision['sourcePath']);
         $current_path = Filesystem::resolvePath($repository_api->getPath());
         if ($revision_path == $current_path) {
             $info[$key]['exists'] = 1;
         } else {
             $info[$key]['exists'] = 0;
         }
         $info[$key]['sort'] = sprintf('%d%04d%08d', $info[$key]['exists'], $revision['status'], $revision['id']);
         $info[$key]['statusName'] = $revision['statusName'];
         $info[$key]['color'] = idx($color_map, $revision['statusName'], 'default');
     }
     $table = id(new PhutilConsoleTable())->setShowHeader(false)->addColumn('exists', array('title' => ''))->addColumn('status', array('title' => pht('Status')))->addColumn('title', array('title' => pht('Title')));
     $info = isort($info, 'sort');
     foreach ($info as $key => $spec) {
         $revision = $revisions[$key];
         $table->addRow(array('exists' => $spec['exists'] ? phutil_console_format('**%s**', '*') : '', 'status' => phutil_console_format("<fg:{$spec['color']}>%s</fg>", $spec['statusName']), 'title' => phutil_console_format('**D%d:** %s', $revision['id'], $revision['title'])));
     }
     $table->draw();
     return 0;
 }
开发者ID:lewisf,项目名称:arcanist,代码行数:31,代码来源:ArcanistListWorkflow.php

示例2: sortAndGroupInlines

 public static function sortAndGroupInlines(array $inlines, array $changesets)
 {
     assert_instances_of($inlines, 'DifferentialTransaction');
     assert_instances_of($changesets, 'DifferentialChangeset');
     $changesets = mpull($changesets, null, 'getID');
     $changesets = msort($changesets, 'getFilename');
     // Group the changesets by file and reorder them by display order.
     $inline_groups = array();
     foreach ($inlines as $inline) {
         $changeset_id = $inline->getComment()->getChangesetID();
         $inline_groups[$changeset_id][] = $inline;
     }
     $inline_groups = array_select_keys($inline_groups, array_keys($changesets));
     foreach ($inline_groups as $changeset_id => $group) {
         // Sort the group of inlines by line number.
         $items = array();
         foreach ($group as $inline) {
             $comment = $inline->getComment();
             $num = $comment->getLineNumber();
             $len = $comment->getLineLength();
             $id = $comment->getID();
             $items[] = array('inline' => $inline, 'sort' => sprintf('~%010d%010d%010d', $num, $len, $id));
         }
         $items = isort($items, 'sort');
         $items = ipull($items, 'inline');
         $inline_groups[$changeset_id] = $items;
     }
     return $inline_groups;
 }
开发者ID:sethkontny,项目名称:phabricator,代码行数:29,代码来源:DifferentialTransactionComment.php

示例3: executeQuery

 protected function executeQuery()
 {
     $drequest = $this->getRequest();
     $repository = $drequest->getRepository();
     $commit = $drequest->loadCommit();
     $raw_changes = queryfx_all($repository->establishConnection('r'), 'SELECT c.*, p.path pathName, t.path targetPathName
     FROM %T c
       LEFT JOIN %T p ON c.pathID = p.id
       LEFT JOIN %T t on c.targetPathID = t.id
     WHERE c.commitID = %d AND isDirect = 1', PhabricatorRepository::TABLE_PATHCHANGE, PhabricatorRepository::TABLE_PATH, PhabricatorRepository::TABLE_PATH, $commit->getID());
     $changes = array();
     $raw_changes = isort($raw_changes, 'pathName');
     foreach ($raw_changes as $raw_change) {
         $type = $raw_change['changeType'];
         if ($type == DifferentialChangeType::TYPE_CHILD) {
             continue;
         }
         $change = new DiffusionPathChange();
         $change->setPath(ltrim($raw_change['pathName'], '/'));
         $change->setChangeType($raw_change['changeType']);
         $change->setFileType($raw_change['fileType']);
         $change->setCommitIdentifier($commit->getCommitIdentifier());
         $changes[] = $change;
     }
     return $changes;
 }
开发者ID:hunterbridges,项目名称:phabricator,代码行数:26,代码来源:DiffusionPathChangeQuery.php

示例4: getPatchList

 public static function getPatchList()
 {
     $root = dirname(phutil_get_library_root('phabricator'));
     // Find the patch files
     $patches_dir = $root . '/resources/sql/patches/';
     $finder = new FileFinder($patches_dir);
     $results = $finder->find();
     $versions = array();
     $patches = array();
     foreach ($results as $path) {
         $matches = array();
         if (!preg_match('/(\\d+)\\..*\\.(sql|php)$/', $path, $matches)) {
             continue;
         }
         $version = (int) $matches[1];
         $patches[] = array('version' => $version, 'path' => $patches_dir . $path);
         if (empty($versions[$version])) {
             $versions[$version] = true;
         } else {
             throw new Exception("Two patches have version {$version}!");
         }
     }
     // Files are in some 'random' order returned by the operating system
     // We need to apply them in proper order
     $patches = isort($patches, 'version');
     return $patches;
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:27,代码来源:PhabricatorSQLPatchList.php

示例5: run

 public function run()
 {
     $revisions = $this->getConduit()->callMethodSynchronous('differential.query', array('authors' => array($this->getUserPHID()), 'status' => 'status-open'));
     if (!$revisions) {
         echo "You have no open Differential revisions.\n";
         return 0;
     }
     $repository_api = $this->getRepositoryAPI();
     $info = array();
     $status_len = 0;
     foreach ($revisions as $key => $revision) {
         $revision_path = Filesystem::resolvePath($revision['sourcePath']);
         $current_path = Filesystem::resolvePath($repository_api->getPath());
         if ($revision_path == $current_path) {
             $info[$key]['here'] = 1;
         } else {
             $info[$key]['here'] = 0;
         }
         $info[$key]['sort'] = sprintf('%d%04d%08d', $info[$key]['here'], $revision['status'], $revision['id']);
         $info[$key]['statusColorized'] = BranchInfo::renderColorizedRevisionStatus($revision['statusName']);
         $status_len = max($status_len, strlen($info[$key]['statusColorized']));
     }
     $info = isort($info, 'sort');
     foreach ($info as $key => $spec) {
         $revision = $revisions[$key];
         printf("%s %-" . ($status_len + 4) . "s D%d: %s\n", $spec['here'] ? phutil_console_format('**%s**', '*') : ' ', $spec['statusColorized'], $revision['id'], $revision['title']);
     }
     return 0;
 }
开发者ID:nik-kor,项目名称:arcanist,代码行数:29,代码来源:ArcanistListWorkflow.php

示例6: processRequest

 public function processRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $user = $this->getUser();
     $preferences = $this->getPreferences();
     $value_email = PhabricatorEmailTagsSetting::VALUE_EMAIL;
     $errors = array();
     if ($request->isFormPost()) {
         $new_tags = $request->getArr('mailtags');
         $mailtags = $preferences->getPreference('mailtags', array());
         $all_tags = $this->getAllTags($user);
         foreach ($all_tags as $key => $label) {
             $mailtags[$key] = (int) idx($new_tags, $key, $value_email);
         }
         $this->writeSetting($preferences, PhabricatorEmailTagsSetting::SETTINGKEY, $mailtags);
         return id(new AphrontRedirectResponse())->setURI($this->getPanelURI('?saved=true'));
     }
     $mailtags = $preferences->getSettingValue(PhabricatorEmailTagsSetting::SETTINGKEY);
     $form = id(new AphrontFormView())->setUser($viewer);
     $form->appendRemarkupInstructions(pht('You can adjust **Application Settings** here to customize when ' . 'you are emailed and notified.' . "\n\n" . "| Setting | Effect\n" . "| ------- | -------\n" . "| Email | You will receive an email and a notification, but the " . "notification will be marked \"read\".\n" . "| Notify | You will receive an unread notification only.\n" . "| Ignore | You will receive nothing.\n" . "\n\n" . 'If an update makes several changes (like adding CCs to a task, ' . 'closing it, and adding a comment) you will receive the strongest ' . 'notification any of the changes is configured to deliver.' . "\n\n" . 'These preferences **only** apply to objects you are connected to ' . '(for example, Revisions where you are a reviewer or tasks you are ' . 'CC\'d on). To receive email alerts when other objects are created, ' . 'configure [[ /herald/ | Herald Rules ]].'));
     $editors = $this->getAllEditorsWithTags($user);
     // Find all the tags shared by more than one application, and put them
     // in a "common" group.
     $all_tags = array();
     foreach ($editors as $editor) {
         foreach ($editor->getMailTagsMap() as $tag => $name) {
             if (empty($all_tags[$tag])) {
                 $all_tags[$tag] = array('count' => 0, 'name' => $name);
             }
             $all_tags[$tag]['count'];
         }
     }
     $common_tags = array();
     foreach ($all_tags as $tag => $info) {
         if ($info['count'] > 1) {
             $common_tags[$tag] = $info['name'];
         }
     }
     // Build up the groups of application-specific options.
     $tag_groups = array();
     foreach ($editors as $editor) {
         $tag_groups[] = array($editor->getEditorObjectsDescription(), array_diff_key($editor->getMailTagsMap(), $common_tags));
     }
     // Sort them, then put "Common" at the top.
     $tag_groups = isort($tag_groups, 0);
     if ($common_tags) {
         array_unshift($tag_groups, array(pht('Common'), $common_tags));
     }
     // Finally, build the controls.
     foreach ($tag_groups as $spec) {
         list($label, $map) = $spec;
         $control = $this->buildMailTagControl($label, $map, $mailtags);
         $form->appendChild($control);
     }
     $form->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Save Preferences')));
     $form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Email Preferences'))->setFormSaved($request->getStr('saved'))->setFormErrors($errors)->setForm($form);
     return $form_box;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:58,代码来源:PhabricatorEmailPreferencesSettingsPanel.php

示例7: renderValueForRevisionView

 public function renderValueForRevisionView()
 {
     $diff = $this->getDiff();
     $ustar = DifferentialRevisionUpdateHistoryView::renderDiffUnitStar($diff);
     $umsg = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff);
     $rows = array();
     $rows[] = array('style' => 'star', 'name' => $ustar, 'value' => $umsg, 'show' => true);
     $excuse = $this->getUnitExcuse();
     if ($excuse) {
         $rows[] = array('style' => 'excuse', 'name' => 'Excuse', 'value' => nl2br(phutil_escape_html($excuse)), 'show' => true);
     }
     $show_limit = 10;
     $hidden = array();
     $udata = $this->getDiffProperty('arc:unit');
     if ($udata) {
         $sort_map = array(ArcanistUnitTestResult::RESULT_BROKEN => 0, ArcanistUnitTestResult::RESULT_FAIL => 1, ArcanistUnitTestResult::RESULT_UNSOUND => 2, ArcanistUnitTestResult::RESULT_SKIP => 3, ArcanistUnitTestResult::RESULT_POSTPONED => 4, ArcanistUnitTestResult::RESULT_PASS => 5);
         foreach ($udata as $key => $test) {
             $udata[$key]['sort'] = idx($sort_map, idx($test, 'result'));
         }
         $udata = isort($udata, 'sort');
         foreach ($udata as $test) {
             $result = idx($test, 'result');
             $default_hide = false;
             switch ($result) {
                 case ArcanistUnitTestResult::RESULT_POSTPONED:
                 case ArcanistUnitTestResult::RESULT_PASS:
                     $default_hide = true;
                     break;
             }
             if ($show_limit && !$default_hide) {
                 --$show_limit;
                 $show = true;
             } else {
                 $show = false;
                 if (empty($hidden[$result])) {
                     $hidden[$result] = 0;
                 }
                 $hidden[$result]++;
             }
             $rows[] = array('style' => $this->getResultStyle($result), 'name' => phutil_escape_html(ucwords($result)), 'value' => phutil_escape_html(idx($test, 'name')), 'show' => $show);
             $userdata = idx($test, 'userdata');
             if ($userdata) {
                 $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
                 $userdata = $engine->markupText($userdata);
                 $rows[] = array('style' => 'details', 'value' => $userdata, 'show' => false);
                 if (empty($hidden['details'])) {
                     $hidden['details'] = 0;
                 }
                 $hidden['details']++;
             }
         }
     }
     $show_string = $this->renderShowString($hidden);
     $view = new DifferentialResultsTableView();
     $view->setRows($rows);
     $view->setShowMoreString($show_string);
     return $view->render();
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:58,代码来源:DifferentialUnitFieldSpecification.php

示例8: executeQuery

 protected function executeQuery()
 {
     $drequest = $this->getRequest();
     $repository = $drequest->getRepository();
     $commit = $drequest->loadCommit();
     $conn_r = $repository->establishConnection('r');
     $limit = '';
     if ($this->limit) {
         $limit = qsprintf($conn_r, 'LIMIT %d', $this->limit + 1);
     }
     $raw_changes = queryfx_all($conn_r, 'SELECT c.*, p.path pathName, t.path targetPathName,
       i.commitIdentifier targetCommitIdentifier
     FROM %T c
       LEFT JOIN %T p ON c.pathID = p.id
       LEFT JOIN %T t ON c.targetPathID = t.id
       LEFT JOIN %T i ON c.targetCommitID = i.id
     WHERE c.commitID = %d AND isDirect = 1 %Q', PhabricatorRepository::TABLE_PATHCHANGE, PhabricatorRepository::TABLE_PATH, PhabricatorRepository::TABLE_PATH, $commit->getTableName(), $commit->getID(), $limit);
     $limited = $this->limit && count($raw_changes) > $this->limit;
     if ($limited) {
         $raw_changes = array_slice($raw_changes, 0, $this->limit);
     }
     $changes = array();
     $raw_changes = isort($raw_changes, 'pathName');
     foreach ($raw_changes as $raw_change) {
         $type = $raw_change['changeType'];
         if ($type == DifferentialChangeType::TYPE_CHILD) {
             continue;
         }
         $change = new DiffusionPathChange();
         $change->setPath(ltrim($raw_change['pathName'], '/'));
         $change->setChangeType($raw_change['changeType']);
         $change->setFileType($raw_change['fileType']);
         $change->setCommitIdentifier($commit->getCommitIdentifier());
         $change->setTargetPath(ltrim($raw_change['targetPathName'], '/'));
         $change->setTargetCommitIdentifier($raw_change['targetCommitIdentifier']);
         $id = $raw_change['pathID'];
         $changes[$id] = $change;
     }
     // Deduce the away paths by examining all the changes, if we loaded them
     // all.
     if (!$limited) {
         $away = array();
         foreach ($changes as $change) {
             if ($change->getTargetPath()) {
                 $away[$change->getTargetPath()][] = $change->getPath();
             }
         }
         foreach ($changes as $change) {
             if (isset($away[$change->getPath()])) {
                 $change->setAwayPaths($away[$change->getPath()]);
             }
         }
     }
     return $changes;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:55,代码来源:DiffusionPathChangeQuery.php

示例9: start

 function start()
 {
     $this->tpl->setBlock("breadcrumb", '<a href="/parser">Freelance.ru parser</a>');
     $pQ = new Engine\pQuery();
     $pages = 5;
     $host = "https://freelance.ru";
     $main_url = "https://freelance.ru/projects/";
     $url = "https://freelance.ru/projects/?spec=4";
     $only_pub = true;
     $dom = $pQ->file_get_html($url);
     $pagination = $dom->find("ul.pagination li a");
     $array = [];
     for ($i = 0; $i <= $pages; $i++) {
         $array[] = $main_url . str_replace(".", "", $pagination[$i]->href);
     }
     $dom = null;
     $info_array = [];
     foreach ($array as $url) {
         $array = "";
         $str = file_get_contents($url);
         $str = iconv('cp1251', 'utf-8', $str);
         $dom = $pQ->str_get_html($str);
         $proj_list = $dom->find("div.projects .proj");
         foreach ($proj_list as $value) {
             $type = str_replace("proj ", "", $value->class);
             if ($type == "public" and $only_pub === true or $only_pub === false) {
             } else {
                 continue;
             }
             $array[] = ["id" => str_replace(" ", "", str_replace("/", "", str_replace("projects", "", $value->find("a.descr")[0]->href))), "title" => $value->find("a.ptitle span")[0]->plaintext, "avatr" => $host . $value->find("a.avatr img")[0]->src, "cost" => $value->find("span.cost")[0]->plaintext, "href" => $host . $value->find("a.descr")[0]->href, "date" => $value->find("ul li.pdata")[0]->title, "replies" => $value->find("ul li.messages a i")[0]->plaintext, "descr" => $value->find("a.descr")[0]->plaintext, "type" => $type];
         }
         $dom = null;
         $info_array = array_merge($info_array, $array);
     }
     function isort(&$a, $field, $dir = true)
     {
         $t = call_user_func_array('array_merge_recursive', $a);
         asort($t[$field]);
         $so = array_keys($t[$field]);
         asort($so);
         # исправлено 2012-08-31
         $so = array_keys($so);
         $a = array_combine($so, $a);
         $dir ? ksort($a) : krsort($a);
     }
     isort($info_array, 'date', false);
     $content = "";
     foreach ($info_array as $val) {
         $this->tpl->setAll(['avatr' => $val['avatr'], 'title' => $val['title'], 'cost' => $val['cost'], 'href' => $val['href'], 'date' => $val['date'], 'reply' => $val['replies'], 'descr' => $val['descr']]);
         $content .= $this->tpl->subLoad('parser.tpl');
     }
     $this->tpl->setBlock('content', $content);
 }
开发者ID:mops1k,项目名称:NextFW,代码行数:53,代码来源:parser.php

示例10: render

 public function render()
 {
     DarkConsoleXHProfPluginAPI::includeXHProfLib();
     $data = $this->profileData;
     $GLOBALS['display_calls'] = true;
     $totals = array();
     $flat = xhprof_compute_flat_info($data, $totals);
     unset($GLOBALS['display_calls']);
     $symbol = $this->symbol;
     $children = array();
     $parents = array();
     foreach ($this->profileData as $key => $counters) {
         if (strpos($key, '==>') !== false) {
             list($parent, $child) = explode('==>', $key, 2);
         } else {
             continue;
         }
         if ($parent == $symbol) {
             $children[$key] = $child;
         } else {
             if ($child == $symbol) {
                 $parents[$key] = $parent;
             }
         }
     }
     $base_uri = $this->baseURI;
     $rows = array();
     $rows[] = array('Metrics for this Call', '', '', '');
     $rows[] = array(phutil_render_tag('a', array('href' => $base_uri . '?symbol=' . $symbol), phutil_escape_html($symbol)), $flat[$symbol]['ct'], $flat[$symbol]['wt'], '100%');
     $rows[] = array('Parent Calls', '', '', '');
     foreach ($parents as $key => $name) {
         $rows[] = array(phutil_render_tag('a', array('href' => $base_uri . '?symbol=' . $name), phutil_escape_html($name)), $data[$key]['ct'], $data[$key]['wt'], '');
     }
     $rows[] = array('Child Calls', '', '', '');
     $child_rows = array();
     foreach ($children as $key => $name) {
         $child_rows[] = array($name, $data[$key]['ct'], $data[$key]['wt'], $data[$key]['wt'] / $flat[$symbol]['wt']);
     }
     $child_rows = isort($child_rows, 2);
     $child_rows = array_reverse($child_rows);
     $rows = array_merge($rows, $this->formatRows($child_rows));
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('Symbol', 'Count', 'Wall Time', '%'));
     $table->setColumnClasses(array('wide pri', 'n', 'n', 'n'));
     $panel = new AphrontPanelView();
     $panel->setHeader('XHProf Profile');
     $panel->appendChild($table);
     return $panel->render();
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:49,代码来源:PhabricatorXHProfProfileSymbolView.php

示例11: render

 public function render()
 {
     DarkConsoleXHProfPluginAPI::includeXHProfLib();
     $data = $this->profileData;
     $GLOBALS['display_calls'] = true;
     $totals = array();
     $flat = xhprof_compute_flat_info($data, $totals);
     unset($GLOBALS['display_calls']);
     $symbol = $this->symbol;
     $children = array();
     $parents = array();
     foreach ($this->profileData as $key => $counters) {
         if (strpos($key, '==>') !== false) {
             list($parent, $child) = explode('==>', $key, 2);
         } else {
             continue;
         }
         if ($parent == $symbol) {
             $children[$key] = $child;
         } else {
             if ($child == $symbol) {
                 $parents[$key] = $parent;
             }
         }
     }
     $rows = array();
     $rows[] = array(pht('Metrics for this Call'), '', '', '');
     $rows[] = $this->formatRow(array($symbol, $flat[$symbol]['ct'], $flat[$symbol]['wt'], 1.0));
     $rows[] = array(pht('Parent Calls'), '', '', '');
     foreach ($parents as $key => $name) {
         $rows[] = $this->formatRow(array($name, $data[$key]['ct'], $data[$key]['wt'], ''));
     }
     $rows[] = array(pht('Child Calls'), '', '', '');
     $child_rows = array();
     foreach ($children as $key => $name) {
         $child_rows[] = array($name, $data[$key]['ct'], $data[$key]['wt'], $data[$key]['wt'] / $flat[$symbol]['wt']);
     }
     $child_rows = isort($child_rows, 2);
     $child_rows = array_reverse($child_rows);
     $rows = array_merge($rows, array_map(array($this, 'formatRow'), $child_rows));
     $table = new AphrontTableView($rows);
     $table->setHeaders(array(pht('Symbol'), pht('Count'), pht('Wall Time'), '%'));
     $table->setColumnClasses(array('wide pri', 'n', 'n', 'n'));
     $panel = new PHUIObjectBoxView();
     $panel->setHeaderText(pht('XHProf Profile'));
     $panel->setTable($table);
     return $panel->render();
 }
开发者ID:truSense,项目名称:phabricator,代码行数:48,代码来源:PhabricatorXHProfProfileSymbolView.php

示例12: render

 public function render()
 {
     DarkConsoleXHProfPluginAPI::includeXHProfLib();
     $GLOBALS['display_calls'] = true;
     $totals = array();
     $flat = xhprof_compute_flat_info($this->profileData, $totals);
     unset($GLOBALS['display_calls']);
     $aggregated = array();
     foreach ($flat as $call => $counters) {
         $parts = explode('@', $call, 2);
         $agg_call = reset($parts);
         if (empty($aggregated[$agg_call])) {
             $aggregated[$agg_call] = $counters;
         } else {
             foreach ($aggregated[$agg_call] as $key => $val) {
                 if ($key != 'wt') {
                     $aggregated[$agg_call][$key] += $counters[$key];
                 }
             }
         }
     }
     $flat = $aggregated;
     $flat = isort($flat, 'wt');
     $flat = array_reverse($flat);
     $rows = array();
     $rows[] = array(pht('Total'), number_format($totals['ct']), number_format($totals['wt']) . ' us', '100.0%', number_format($totals['wt']) . ' us', '100.0%');
     if ($this->limit) {
         $flat = array_slice($flat, 0, $this->limit);
     }
     foreach ($flat as $call => $counters) {
         $rows[] = array($this->renderSymbolLink($call), number_format($counters['ct']), number_format($counters['wt']) . ' us', sprintf('%.1f%%', 100 * $counters['wt'] / $totals['wt']), number_format($counters['excl_wt']) . ' us', sprintf('%.1f%%', 100 * $counters['excl_wt'] / $totals['wt']));
     }
     Javelin::initBehavior('phabricator-tooltips');
     $table = new AphrontTableView($rows);
     $table->setHeaders(array(pht('Symbol'), pht('Count'), javelin_tag('span', array('sigil' => 'has-tooltip', 'meta' => array('tip' => pht('Total wall time spent in this function and all of ' . 'its children (children are other functions it called ' . 'while executing).'), 'size' => 200)), pht('Wall Time (Inclusive)')), '%', javelin_tag('span', array('sigil' => 'has-tooltip', 'meta' => array('tip' => pht('Wall time spent in this function, excluding time ' . 'spent in children (children are other functions it ' . 'called while executing).'), 'size' => 200)), pht('Wall Time (Exclusive)')), '%'));
     $table->setColumnClasses(array('wide pri', 'n', 'n', 'n', 'n', 'n'));
     $panel = new PHUIObjectBoxView();
     $header = id(new PHUIHeaderView())->setHeader(pht('XHProf Profile'));
     if ($this->file) {
         $button = id(new PHUIButtonView())->setHref($this->file->getBestURI())->setText(pht('Download %s Profile', '.xhprof'))->setTag('a');
         $header->addActionLink($button);
     }
     $panel->setHeader($header);
     $panel->appendChild($table);
     return $panel->render();
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:46,代码来源:PhabricatorXHProfProfileTopLevelView.php

示例13: renderDataBox

 private function renderDataBox()
 {
     $cache = PhabricatorDataCacheSpec::getActiveCacheSpec();
     $properties = id(new PHUIPropertyListView());
     $this->renderCommonProperties($properties, $cache);
     $table = null;
     if ($cache->getName() !== null) {
         $total_memory = $cache->getTotalMemory();
         $summary = $cache->getCacheSummary();
         $summary = isort($summary, 'total');
         $summary = array_reverse($summary, true);
         $rows = array();
         foreach ($summary as $key => $info) {
             $rows[] = array($key, pht('%s', new PhutilNumber($info['count'])), phutil_format_bytes($info['max']), phutil_format_bytes($info['total']), sprintf('%.1f%%', 100 * ($info['total'] / $total_memory)));
         }
         $table = id(new AphrontTableView($rows))->setHeaders(array(pht('Pattern'), pht('Count'), pht('Largest'), pht('Total'), pht('Usage')))->setColumnClasses(array('wide', 'n', 'n', 'n', 'n'));
     }
     return id(new PHUIObjectBoxView())->setHeaderText(pht('Data Cache'))->addPropertyList($properties)->setTable($table);
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:19,代码来源:PhabricatorConfigCacheController.php

示例14: renderTable

 private function renderTable()
 {
     $rows = array();
     foreach ($this->groups as $group => $items) {
         $has_where = false;
         foreach ($items as $item) {
             if (!empty($item['where'])) {
                 $has_where = true;
                 break;
             }
         }
         $rows[] = '<tr>' . '<th colspan="3">' . phutil_escape_html($group) . '</th>' . '</tr>';
         foreach ($items as $item) {
             $items = isort($items, 'line');
             $line = $item['line'];
             $length = $item['length'];
             if ($length) {
                 $lines = $line . "–" . ($line + $length);
             } else {
                 $lines = $line;
             }
             if (isset($item['href'])) {
                 $href = $item['href'];
                 $target = '_blank';
                 $tail = " ↗";
             } else {
                 $href = '#inline-' . $item['id'];
                 $target = null;
                 $tail = null;
             }
             $lines = phutil_escape_html($lines);
             if ($href) {
                 $lines = phutil_render_tag('a', array('href' => $href, 'target' => $target, 'class' => 'num'), $lines . $tail);
             }
             $where = idx($item, 'where');
             $colspan = $has_where ? '' : ' colspan="2"';
             $rows[] = '<tr>' . '<td class="inline-line-number">' . $lines . '</td>' . ($has_where ? '<td class="inline-which-diff">' . phutil_escape_html($where) . '</td>' : null) . '<td class="inline-summary-content"' . $colspan . '>' . '<div class="phabricator-remarkup">' . $item['content'] . '</div>' . '</td>' . '</tr>';
         }
     }
     return phutil_render_tag('table', array('class' => 'phabricator-inline-summary-table'), implode("\n", $rows));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:41,代码来源:PhabricatorInlineSummaryView.php

示例15: execute

 public function execute(PhutilArgumentParser $args)
 {
     $console = PhutilConsole::getConsole();
     $console->writeErr("%s\n", pht('Analyzing table sizes (this may take a moment)...'));
     $api = $this->getAPI();
     $patches = $this->getPatches();
     $databases = $api->getDatabaseList($patches, $only_living = true);
     $conn_r = $api->getConn(null);
     $data = array();
     foreach ($databases as $database) {
         queryfx($conn_r, 'USE %C', $database);
         $tables = queryfx_all($conn_r, 'SHOW TABLE STATUS');
         $tables = ipull($tables, null, 'Name');
         $data[$database] = $tables;
     }
     $totals = array_fill_keys(array_keys($data), 0);
     $overall = 0;
     foreach ($data as $db => $tables) {
         foreach ($tables as $table => $info) {
             $table_size = $info['Data_length'] + $info['Index_length'];
             $data[$db][$table]['_totalSize'] = $table_size;
             $totals[$db] += $table_size;
             $overall += $table_size;
         }
     }
     asort($totals);
     $table = id(new PhutilConsoleTable())->setShowHeader(false)->setPadding(2)->addColumn('name', array('title' => pht('Database / Table')))->addColumn('size', array('title' => pht('Size')))->addColumn('percentage', array('title' => pht('Percentage')));
     foreach ($totals as $db => $size) {
         list($database_size, $database_percentage) = $this->formatSize($totals[$db], $overall);
         $table->addRow(array('name' => tsprintf('**%s**', $db), 'size' => tsprintf('**%s**', $database_size), 'percentage' => tsprintf('**%s**', $database_percentage)));
         $data[$db] = isort($data[$db], '_totalSize');
         foreach ($data[$db] as $table_name => $info) {
             list($table_size, $table_percentage) = $this->formatSize($info['_totalSize'], $overall);
             $table->addRow(array('name' => '    ' . $table_name, 'size' => $table_size, 'percentage' => $table_percentage));
         }
     }
     list($overall_size, $overall_percentage) = $this->formatSize($overall, $overall);
     $table->addRow(array('name' => tsprintf('**%s**', pht('TOTAL')), 'size' => tsprintf('**%s**', $overall_size), 'percentage' => tsprintf('**%s**', $overall_percentage)));
     $table->draw();
     return 0;
 }
开发者ID:nilsdornblut,项目名称:phabricator,代码行数:41,代码来源:PhabricatorStorageManagementProbeWorkflow.php


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