Changeset 5549
- Timestamp:
- Apr 1, 2010, 9:06:01 PM (15 years ago)
- Location:
- extensions/UserStat
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserStat/admin/plugin_admin.php
r4270 r5549 22 22 $main_plugin_object = get_plugin_data($plugin_id); 23 23 24 $plugin_ai = new UserStat_AIP($prefixeTable, $main_plugin_object->get _filelocation());24 $plugin_ai = new UserStat_AIP($prefixeTable, $main_plugin_object->getFileLocation()); 25 25 $plugin_ai->manage(); 26 26 -
extensions/UserStat/language/fr_FR/plugin.lang.php
r4270 r5549 50 50 $lang['us_withMail'] = 'Avec eMail'; 51 51 52 //1.1.0 53 $lang['To install this plugin, you need to install Grum Plugin Classes %s before'] = 'Pour installer ce plugin, vous devez au préalable, installer le plugin Grum Plugin Classes %s'; 54 52 55 53 56 ?> -
extensions/UserStat/main.inc.php
r5433 r5549 54 54 define('USERSTAT_PATH' , PHPWG_PLUGINS_PATH . USERSTAT_DIR . '/'); 55 55 56 define('USERSTAT_VERSION' , '1.1.0'); // => ne pas oublier la version dans l'entête !!56 include_once('userstat_version.inc.php'); // => Don't forget to update this file !! 57 57 58 58 global $prefixeTable; … … 64 64 65 65 $obj = new UserStat_AIM($prefixeTable, __FILE__); 66 $obj->init _events();66 $obj->initEvents(); 67 67 set_plugin_data($plugin['id'], $obj); 68 68 } -
extensions/UserStat/maintain.inc.php
r5433 r5549 14 14 //ini_set('display_errors', true); 15 15 16 include_once('userstat_version.inc.php'); // => Don't forget to update this file !! 17 16 18 if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } 17 19 … … 20 22 21 23 22 global $gpc_installed, $ lang; //needed for plugin manager compatibility24 global $gpc_installed, $gpcNeeded, $lang; //needed for plugin manager compatibility 23 25 24 26 /* ----------------------------------------------------------------------------- … … 26 28 ----------------------------------------------------------------------------- */ 27 29 $gpc_installed=false; 28 if(file_exists(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php')) 30 $gpcNeeded="3.0.0"; 31 if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php')) 29 32 { 30 @include_once(PHPWG_PLUGINS_PATH.' grum_plugins_classes-2/main.inc.php');31 // need GPC release greater or equal than 2.0.532 if( checkGPCRelease(2,0,5))33 @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); 34 // need GPC release greater or equal than 3.0.0 35 if(CommonPlugin::checkGPCRelease(3,0,0)) 33 36 { 34 37 @include_once("userstat_aim.class.inc.php"); … … 39 42 function gpcMsgError(&$errors) 40 43 { 41 array_push($errors, sprintf(l10n('us_gpc2_not_installed'), "2.0.5")); 44 global $gpcNeeded; 45 $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), $gpcNeeded); 46 if(is_array($errors)) 47 { 48 array_push($errors, $msg); 49 } 50 else 51 { 52 $errors=Array($msg); 53 } 42 54 } 43 55 // ----------------------------------------------------------------------------- … … 48 60 function plugin_install($plugin_id, $plugin_version, &$errors) 49 61 { 50 global $prefixeTable, $gpc_installed ;62 global $prefixeTable, $gpc_installed, $gpcNeeded; 51 63 if($gpc_installed) 52 64 { 53 65 $obj = new UserStat_AIM($prefixeTable, __FILE__); 54 $obj->delete_config(); 55 $obj->init_config(); 56 $obj->save_config(); 66 $obj->deleteConfig(); 67 $obj->initConfig(); 68 $obj->my_config['installed']=USERSTAT_VERSION2; 69 $obj->saveConfig(); 70 GPCCore::register($obj->getPluginName(), USERSTAT_VERSION, $gpcNeeded); 57 71 } 58 72 else … … 64 78 function plugin_activate($plugin_id, $plugin_version, &$errors) 65 79 { 66 global $prefixeTable, $gpc_installed ;80 global $prefixeTable, $gpc_installed, $gpcNeeded; 67 81 if($gpc_installed) 68 82 { 69 83 $obj = new UserStat_AIM($prefixeTable, __FILE__); 70 $obj->init_config(); 71 $obj->load_config(); 72 $obj->save_config(); 84 $obj->initConfig(); 85 $obj->loadConfig(); 86 $obj->my_config['installed']=USERSTAT_VERSION2; 87 $obj->saveConfig(); 73 88 } 74 89 else … … 88 103 { 89 104 $obj = new UserStat_AIM($prefixeTable, __FILE__); 90 $obj->delete_config(); 105 $obj->deleteConfig(); 106 GPCCore::unregister($obj->getPluginName()); 91 107 } 92 108 else -
extensions/UserStat/userstat_aim.class.inc.php
r4270 r5549 16 16 if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } 17 17 18 include_once(PHPWG_PLUGINS_PATH.' grum_plugins_classes-2/common_plugin.class.inc.php');19 include_once(PHPWG_PLUGINS_PATH.' grum_plugins_classes-2/css.class.inc.php');18 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); 19 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCss.class.inc.php'); 20 20 21 class UserStat_AIM extends common_plugin21 class UserStat_AIM extends CommonPlugin 22 22 { 23 23 protected $css = null; 24 24 25 function UserStat_AIM($prefixeTable, $filelocation)25 public function __construct($prefixeTable, $filelocation) 26 26 { 27 $this-> plugin_name="UserStat";28 $this-> plugin_name_files="userstat";27 $this->setPluginName("UserStat"); 28 $this->setPluginNameFiles("userstat"); 29 29 parent::__construct($prefixeTable, $filelocation); 30 $this->css = new css(dirname($this->filelocation).'/'.$this->plugin_name_files.".css"); 30 $this->css = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles().".css"); 31 } 32 33 public function __destruct() 34 { 35 unset($this->css); 36 parent::__destruct(); 31 37 } 32 38 … … 34 40 initialize events call for the plugin 35 41 */ 36 function init _events()42 function initEvents() 37 43 { 38 add_event_handler('get_admin_plugin_menu_links', array(&$this, 'plugin _admin_menu') );44 add_event_handler('get_admin_plugin_menu_links', array(&$this, 'pluginAdminMenu') ); 39 45 } 40 46 … … 43 49 initialization of config properties 44 50 */ 45 function init _config()51 function initConfig() 46 52 { 47 $this-> my_config=array(53 $this->config=array( 48 54 'UserStat_MouseOverColor' => '303030', 49 55 /*'AStat_BarColor_Pages' => '6666ff', … … 69 75 70 76 /* 71 surchage of common_plugin->save_config function77 surchage of CommonPlugin->saveConfig function 72 78 */ 73 function load _config()79 function loadConfig() 74 80 { 75 parent::load _config();76 if(!$this->css-> css_file_exists())81 parent::loadConfig(); 82 if(!$this->css->fileExists()) 77 83 { 78 $this->css->make _CSS($this->generate_CSS());84 $this->css->makeCSS($this->generate_CSS()); 79 85 } 80 86 } 81 87 82 88 /* 83 surchage of common_plugin->save_config function89 surchage of CommonPlugin->saveConfig function 84 90 */ 85 function save _config()91 function saveConfig() 86 92 { 87 if(parent::save _config())93 if(parent::saveConfig()) 88 94 { 89 $this->css->make _CSS($this->generate_CSS());95 $this->css->makeCSS($this->generate_CSS()); 90 96 return(true); 91 97 } … … 99 105 { 100 106 $text = " 101 .StatTableRow:hover { background-color:#".$this-> my_config['UserStat_MouseOverColor']."; }107 .StatTableRow:hover { background-color:#".$this->config['UserStat_MouseOverColor']."; } 102 108 .formtable, .formtable P { text-align:left; display:block; } 103 109 .formtable tr { vertical-align:top; } -
extensions/UserStat/userstat_aip.class.inc.php
r5433 r5549 17 17 include_once('userstat_aim.class.inc.php'); 18 18 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 19 include_once(PHPWG_PLUGINS_PATH.' grum_plugins_classes-2/ajax.class.inc.php');19 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCAjax.class.inc.php'); 20 20 21 21 class UserStat_AIP extends UserStat_AIM 22 22 { 23 23 protected $tabsheet; 24 protected $ajax; 25 26 function UserStat_AIP($prefixeTable, $filelocation) 24 25 public function __construct($prefixeTable, $filelocation) 27 26 { 28 27 parent::__construct($prefixeTable, $filelocation); 29 28 30 $this->load _config();31 $this->init _events();29 $this->loadConfig(); 30 $this->initEvents(); 32 31 33 32 $this->tabsheet = new tabsheet(); 34 33 $this->tabsheet->add('global_stats', 35 34 l10n('us_tsGlobal'), 36 $this-> page_link.'&fUserStat_tabsheet=global_stats');35 $this->getAdminLink().'&fUserStat_tabsheet=global_stats'); 37 36 $this->tabsheet->add('users_stats', 38 37 l10n('us_tsUsers'), 39 $this->page_link.'&fUserStat_tabsheet=users_stats'); 40 41 $this->ajax = new Ajax(); 38 $this->getAdminLink().'&fUserStat_tabsheet=users_stats'); 39 } 40 41 public function __destruct() 42 { 43 unset($this->tabsheet); 44 parent::__destruct(); 42 45 } 43 46 … … 45 48 initialize events call for the plugin 46 49 */ 47 function init _events()48 { 49 add_event_handler('loc_end_page_header', array(&$this->css, 'apply _CSS'));50 function initEvents() 51 { 52 add_event_handler('loc_end_page_header', array(&$this->css, 'applyCSS')); 50 53 } 51 54 … … 112 115 break; 113 116 } 114 //$template-> 115 $this->ajax->return_result($result); 117 GPCAjax::returnResult($result); 116 118 } 117 119 } … … 154 156 $template_datas = array(); 155 157 156 $template_datas["ajaxUrl"] = $this-> page_link;158 $template_datas["ajaxUrl"] = $this->getAdminLink(); 157 159 $template_datas["users"] = $this->getUsersGlobalStats(); 158 160 … … 526 528 $local_tpl = new Template(USERSTAT_PATH."admin/", ""); 527 529 $local_tpl->set_filename('body_page', 528 dirname($this-> filelocation).'/admin/userstat_userstat.tpl');530 dirname($this->getFileLocation()).'/admin/userstat_userstat.tpl'); 529 531 530 532 $template_datas["list"] = $this->makeUserStats($userId);
Note: See TracChangeset
for help on using the changeset viewer.