2014-10-03 16:39:21 -07:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* e107 website system
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008-2014 e107 Inc (e107.org)
|
|
|
|
* Released under the terms and conditions of the
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!defined('e107_INIT')) { exit; }
|
|
|
|
|
|
|
|
// v2.x Standard
|
|
|
|
class chatbox_menu_user // plugin-folder + '_user'
|
2015-02-20 10:25:33 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
function profile($udata)
|
2014-10-03 16:39:21 -07:00
|
|
|
{
|
2015-02-20 10:25:33 +01:00
|
|
|
$pref = e107::getPref();
|
|
|
|
|
2015-02-20 12:15:04 +01:00
|
|
|
if (!$pref['cb_user_addon'])
|
2015-02-20 10:25:33 +01:00
|
|
|
{
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
2014-10-03 16:39:21 -07:00
|
|
|
if(!$chatposts = e107::getRegistry('total_chatposts'))
|
|
|
|
{
|
|
|
|
$chatposts = 0; // In case plugin not installed
|
|
|
|
if(e107::isInstalled("chatbox_menu"))
|
|
|
|
{
|
|
|
|
$chatposts = e107::getDb()->count("chatbox");
|
|
|
|
}
|
|
|
|
e107::setRegistry('total_chatposts', $chatposts);
|
|
|
|
}
|
2015-02-20 10:25:33 +01:00
|
|
|
|
2014-10-14 12:51:51 -07:00
|
|
|
$perc = ($chatposts > 0) ? round(($udata['user_chats']/$chatposts) * 100, 2) : 0;
|
2015-02-20 10:25:33 +01:00
|
|
|
|
|
|
|
|
2014-10-03 16:39:21 -07:00
|
|
|
$var = array(
|
2014-10-14 12:51:51 -07:00
|
|
|
0 => array('label' => LAN_PLUGIN_CHATBOX_MENU_POSTS, 'text' => $udata['user_chats']." ( ".$perc."% )")
|
2014-10-03 16:39:21 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
return $var;
|
|
|
|
}
|
2015-02-20 10:25:33 +01:00
|
|
|
|
2014-10-03 16:39:21 -07:00
|
|
|
}
|