source: extensions/UserStat/userstat_aim.class.inc.php @ 4499

Last change on this file since 4499 was 4270, checked in by grum, 15 years ago

[UserStat] Adding a directory for the plugin UserStat

  • Property svn:executable set to *
File size: 3.6 KB
Line 
1<?php
2/* -----------------------------------------------------------------------------
3  Plugin     : UserStat
4  Author     : Grum
5    email    : grum@piwigo.org
6    website  : http://photos.grum.fr
7
8    << May the Little SpaceFrog be with you ! >>
9  ------------------------------------------------------------------------------
10  See main.inc.php for release information
11
12  UserStat_AIM : classe to manage plugin integration into plugin menu
13
14  --------------------------------------------------------------------------- */
15
16if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
17
18include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php');
19include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/css.class.inc.php');
20
21class UserStat_AIM extends common_plugin
22{
23  protected $css = null;
24
25  function UserStat_AIM($prefixeTable, $filelocation)
26  {
27    $this->plugin_name="UserStat";
28    $this->plugin_name_files="userstat";
29    parent::__construct($prefixeTable, $filelocation);
30    $this->css = new css(dirname($this->filelocation).'/'.$this->plugin_name_files.".css");
31  }
32
33  /*
34    initialize events call for the plugin
35  */
36  function init_events()
37  {
38    add_event_handler('get_admin_plugin_menu_links', array(&$this, 'plugin_admin_menu') );
39  }
40
41
42  /*
43    initialization of config properties
44  */
45  function init_config()
46  {
47    $this->my_config=array(
48      'UserStat_MouseOverColor' => '303030',
49      /*'AStat_BarColor_Pages' => '6666ff',
50      'AStat_BarColor_Img' => '66ff66',
51      'AStat_BarColor_IP' => 'ff6666',
52      'AStat_NpIPPerPages' => '25',
53      'AStat_NpCatPerPages' => '50',
54      'AStat_MaxBarWidth' => '400',
55      'AStat_default_period' => 'global', //global, all, year, month, day
56      'AStat_ShowThumbCat' => 'true',
57      'AStat_DefaultSortCat' => 'page', //page, picture, nbpicture
58      'AStat_ShowThumbImg' => 'true',
59      'AStat_DefaultSortImg' => 'picture',  //picture, catname
60      'AStat_NbImgPerPages' => '100',
61      'AStat_BarColor_Cat' => 'fff966',
62      'AStat_DefaultSortIP' => 'page',    //page, ip, picture
63      'AStat_SeeTimeRequests' => 'false',
64      'AStat_BlackListedIP' => '',    // ip blacklisted (separator : ",")
65      'AStat_UseBlackList' => 'false'    // if false, blacklist usage is disabled, if "invert" then result are inverted*/
66      );
67
68  }
69
70  /*
71    surchage of common_plugin->save_config function
72  */
73  function load_config()
74  {
75    parent::load_config();
76    if(!$this->css->css_file_exists())
77    {
78      $this->css->make_CSS($this->generate_CSS());
79    }
80  }
81
82  /*
83    surchage of common_plugin->save_config function
84  */
85  function save_config()
86  {
87    if(parent::save_config())
88    {
89      $this->css->make_CSS($this->generate_CSS());
90      return(true);
91    }
92    return(false);
93  }
94
95  /*
96    generate the css code
97  */
98  function generate_CSS()
99  {
100    $text = "
101.StatTableRow:hover { background-color:#".$this->my_config['UserStat_MouseOverColor']."; }
102.formtable, .formtable P { text-align:left; display:block; }
103.formtable tr { vertical-align:top; }
104.invisible { visibility:hidden; display:none; }
105.littlefont { font-size:90%; }
106table.table2.littlefont td { text-align:center;padding:0px;padding-left:3px;padding-right:3px; }
107.throw { line-height:auto; font-size:100%; }
108table.table2 tr.throw { height:26px; }
109table.table2 td.toLeft  { text-align:left; }
110div.table { margin-bottom:15px; }
111pointerHand { cursor:pointer; }
112    ";
113
114    return($text);
115  }
116
117  /* ---------------------------------------------------------------------------
118  Function needed for plugin activation
119  --------------------------------------------------------------------------- */
120
121
122
123} // UserStat_Plugin class
124
125
126?>
Note: See TracBrowser for help on using the repository browser.