Dotclear

source: plugins/adminExample/_admin.php @ 3043

Revision 3043, 2.6 KB checked in by Moe, 12 years ago (diff)

Admin Example 0.2:

  • Dotclear 2.3:
    • added behaviours and images for the new dashboard
    • added required field
  • Property svn:executable set to *
Line 
1<?php
2# ***** BEGIN LICENSE BLOCK *****
3#
4# This program is free software. It comes without any warranty, to
5# the extent permitted by applicable law. You can redistribute it
6# and/or modify it under the terms of the Do What The Fuck You Want
7# To Public License, Version 2, as published by Sam Hocevar. See
8# http://sam.zoy.org/wtfpl/COPYING for more details.
9#
10# Icons by http://dryicons.com
11#
12# ***** END LICENSE BLOCK *****
13
14# add the plugin in the plugins list on the backend
15# ajouter le plugin dans la liste des plugins du menu de l'administration
16$_menu['Plugins']->addItem(
17     # link's name
18     # nom du lien (en anglais)
19     __('Admin example'),
20     # base URL of the administration page
21     # URL de base de la page d'administration
22     'plugin.php?p=adminExample',
23     # URL of the image used as icon
24     # URL de l'image utilisée comme icône
25     'index.php?pf=adminExample/icon.png',
26     # regular expression of the URL of the administration page
27     # expression régulière de l'URL de la page d'administration
28     preg_match('/plugin.php\?p=adminExample(&.*)?$/',
29          $_SERVER['REQUEST_URI']),
30     # required permissions to show the link
31     # permissions nécessaires pour afficher le lien
32     $core->auth->check('usage,contentadmin',$core->blog->id));
33
34$core->addBehavior('adminDashboardFavs',
35     array('adminExampleBehaviors','adminDashboardFavs'));
36
37$core->addBehavior('adminDashboardFavsIcon',
38     array('adminExampleBehaviors','adminDashboardFavsIcon'));
39 
40class adminExampleBehaviors
41{
42    public static function adminDashboardFavs($core,$favs)
43    {
44        $favs['adminExample'] = new ArrayObject(array(
45            'adminExample',
46            __('Admin example'),
47            'plugin.php?p=adminExample',
48            'index.php?pf=adminExample/icon.png',
49            'index.php?pf=adminExample/icon-big.png',
50            'usage,contentadmin',
51            null,
52            null));
53    }
54
55    public static function adminDashboardFavsIcon($core,$name,$icon)
56    {
57               if ($name == 'adminExample')
58               {
59                    # this is an example to show how the icon, the URL and the URL
60                    #  can be changed with a test
61                    # ceci est un un exemple pour montrer comment l'icône, l'URL et
62                    #  l'image peuvent être changées avec un test
63                    if ($core->blog->settings->adminExample->adminexample_active)
64                    {
65                         $icon[0] = __('Admin example: active');
66                         $icon[1] = 'plugin.php?p=adminExample&amp;tab=settings';
67                         $icon[2] = 'index.php?pf=adminExample/icon-big.png';
68                    }
69                    else
70                    {
71                         $icon[0] = __('Admin example: inactive');
72                         $icon[1] = 'plugin.php?p=adminExample';
73                         $icon[2] = 'index.php?pf=adminExample/icon-block.png';
74                    }
75               }
76    }
77}
78
79?>
Note: See TracBrowser for help on using the repository browser.

Sites map