7 * Execute the controller and display the output.
9 * Note: This is really just an example which handles input and output using
10 * stock PHP variables and functions. Depending on the environment,
11 * it may be easier to work directly with `getCtrl()->run(...)` which
12 * handles inputs/outputs in a more abstract fashion.
14 * @param \Civi\Setup\UI\SetupController $ctrl
17 public static function run($ctrl) {
18 $method = $_SERVER['REQUEST_METHOD'];
20 /** @var \Civi\Setup\UI\SetupResponse $response */
21 $response = $ctrl->run($method, ($method === 'GET' ?
$_GET : $_POST));
23 self
::send($ctrl, $response);
27 * @param \Civi\Setup\UI\SetupController $ctrl
28 * @param \Civi\Setup\UI\SetupResponse $response
30 public static function send($ctrl, $response) {
31 http_response_code($response->code
);
32 foreach ($response->headers
as $k => $v) {
36 /** @var \Civi\Setup\Model $model */
37 $model = \Civi\Setup
::instance()->getModel();
39 if ($response->isComplete
) {
44 'pageAssets' => $response->assets
,
45 'pageTitle' => $response->title
,
46 'pageBody' => $response->body
,
47 'shortLangCode' => \CRM_Core_I18n_PseudoConstant
::shortForLong($model->lang
),
48 'textDirection' => (\CRM_Core_I18n
::isLanguageRTL($model->lang
) ?
'rtl' : 'ltr'),
51 echo $ctrl->render($ctrl->getResourcePath('page.tpl.php'), $pageVars);