1<?php
2/**
3 * Federated Login for DokuWiki - move up a provider class
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @link       http://www.dokuwiki.org/plugin:fedauth
7 * @author     Aoi Karasu <aoikarasu@gmail.com>
8 */
9
10/**
11 * Authorization providers management class responsible
12 * for moving a provider item up in the list order.
13 *
14 * @author     Aoi Karasu <aoikarasu@gmail.com>
15 */
16class fa_moveup extends fa_manage {
17
18    /**
19     * Creates the class instance bound with the admin plugin and an authorization provider.
20     *
21     * @param objref $manager object reference to the admin plugin
22     * @param string $cmd name of the command to handle
23     * @param string $provid (optional) an authorization provider id
24     */
25    function __construct(&$manager, $cmd, $provid='') {
26        parent::__construct(&$manager, $cmd, $provid);
27    }
28
29    /**
30     * Performs the move up action in the providers list order.
31     *
32     * @return string the processing result message
33     */
34    function process_moveup() {
35        if ($this->manager->providers->moveUp($this->provid)) {
36            $this->saveConfig();
37            $this->success = true;
38            return 'Your changes have been saved.';
39        }
40        return '';
41    }
42
43    /**
44     * Handles AJAX call to return the result in JSON format.
45     *
46     * @return bool true on success
47     */
48    function handle_ajax_moveup() {
49        print '{"success":' . (int)$this->success . '}';
50        return true;
51    }
52
53} /* fa_moveup */
54
55/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
56