1<?php
2/**
3 * A data object that indicates to the HordeCore javascript framework that
4 * the action was successful, but the page needs to be reloaded.
5 *
6 * Copyright 2012-2017 Horde LLC (http://www.horde.org/)
7 *
8 * See the enclosed file COPYING for license information (LGPL). If you
9 * did not receive this file, see http://www.horde.org/licenses/lgpl21.
10 *
11 * @author   Michael Slusarz <slusarz@horde.org>
12 * @category Horde
13 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
14 * @package  Core
15 */
16class Horde_Core_Ajax_Response_HordeCore_Reload extends Horde_Core_Ajax_Response_HordeCore
17{
18
19    /**
20     * Constructor.
21     *
22     * @param mixed $data  Response data to send to browser. For this class,
23     *                     this can be the URL to redirect to. If null, will
24     *                     reload the current URL of the browser.
25     */
26    public function __construct($data = null)
27    {
28        parent::__construct($data);
29    }
30
31    /**
32     * Return a single property, 'reload', which indicates to the HordeCore
33     * framework that the page should be immediately reloaded.
34     */
35    protected function _jsonData()
36    {
37        $ob = new stdClass;
38        $ob->reload = is_null($this->data)
39            ? true
40            : $this->data;
41
42        return $ob;
43    }
44
45}
46