]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/ListRelations.php
function run: @return mixed
[SourceForge/phpwiki.git] / lib / plugin / ListRelations.php
1 <?php
2
3 /*
4  * Copyright 2006 Reini Urban
5  *
6  * This file is part of PhpWiki.
7  *
8  * PhpWiki is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * PhpWiki is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 require_once 'lib/PageList.php';
24
25 /**
26  * Display the list of all relations and optionally attributes in the wiki.
27  *
28  * @author: Reini Urban
29  */
30 class WikiPlugin_ListRelations
31     extends WikiPlugin
32 {
33     function getDescription()
34     {
35         return _("Display the list of all defined relations and optionnally attributes in this entire wiki.");
36     }
37
38     function getDefaultArguments()
39     {
40         return array_merge
41         (
42             PageList::supportedArgs(), // paging and more.
43             array(
44                 'mode' => "relations" // or "attributes" or "all"
45             ));
46     }
47
48     /**
49      * @param WikiDB $dbi
50      * @param string $argstr
51      * @param WikiRequest $request
52      * @param string $basepage
53      * @return mixed
54      */
55     function run($dbi, $argstr, &$request, $basepage)
56     {
57         $args = $this->getArgs($argstr, $request);
58         extract($args);
59         $pagelist = new PageList($info, $exclude, $args);
60         // should attributes be listed as pagename here?
61         $pagelist->addPageList($dbi->listRelations($mode == 'all', $mode == 'attributes', !empty($sortby)));
62         return $pagelist;
63     }
64
65 }
66
67 // Local Variables:
68 // mode: php
69 // tab-width: 8
70 // c-basic-offset: 4
71 // c-hanging-comment-ender-p: nil
72 // indent-tabs-mode: nil
73 // End: