Changeset View
Changeset View
Standalone View
Standalone View
src/applications/fact/controller/PhabricatorFactChartController.php
<?php | <?php | ||||
final class PhabricatorFactChartController extends PhabricatorFactController { | final class PhabricatorFactChartController extends PhabricatorFactController { | ||||
public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
$viewer = $request->getViewer(); | $viewer = $request->getViewer(); | ||||
$chart_key = $request->getURIData('chartKey'); | $chart_key = $request->getURIData('chartKey'); | ||||
if ($chart_key === null) { | if ($chart_key === null) { | ||||
return $this->newDemoChart(); | return $this->newDemoChart(); | ||||
} | } | ||||
$engine = id(new PhabricatorChartEngine()) | $engine = id(new PhabricatorChartRenderingEngine()) | ||||
->setViewer($viewer); | ->setViewer($viewer); | ||||
$chart = $engine->loadChart($chart_key); | $chart = $engine->loadChart($chart_key); | ||||
if (!$chart) { | if (!$chart) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
// When drawing a chart, we send down a placeholder piece of HTML first, | // When drawing a chart, we send down a placeholder piece of HTML first, | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | foreach ($argvs as $argv) { | ||||
array( | array( | ||||
'function' => $argv, | 'function' => $argv, | ||||
)); | )); | ||||
} | } | ||||
$chart = id(new PhabricatorFactChart()) | $chart = id(new PhabricatorFactChart()) | ||||
->setDatasets($datasets); | ->setDatasets($datasets); | ||||
$engine = id(new PhabricatorChartEngine()) | $engine = id(new PhabricatorChartRenderingEngine()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->setChart($chart); | ->setChart($chart); | ||||
$chart = $engine->getStoredChart(); | $chart = $engine->getStoredChart(); | ||||
return id(new AphrontRedirectResponse())->setURI($chart->getURI()); | return id(new AphrontRedirectResponse())->setURI($chart->getURI()); | ||||
} | } | ||||
} | } |