Revize 1057
Přidáno uživatelem Michal Kliment před více než 13 roky(ů)
freenetis/branches/testing/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'author' => 'Autor',
|
||
'author fee' => 'Autorský poplatek',
|
||
'automatically import admins' => 'Automaticky přidat správce oblastí',
|
||
'avarage day download' => 'Průměrní denní download',
|
||
'avarage day upload' => 'Průměrní denní upload',
|
||
'back' => 'Zpět',
|
||
'back to account transfers' => 'Zpět na převody účtu',
|
||
'back to administration' => 'Zpět na administraci',
|
||
... | ... | |
'current credit' => 'Současný kredit',
|
||
'currently clean urls are turn off' => 'V současné době jsou čistá URL vypnuta.',
|
||
'czk' => 'Kč',
|
||
'daily' => 'denně',
|
||
'database' => 'Databáze',
|
||
'database has been successfully updated' => 'Databáze byla úspěšně upravena.',
|
||
'database host' => 'Hostitel databáze',
|
||
... | ... | |
'generation of configuration files' => 'Generování konfiguračních souborů',
|
||
'good' => 'Dobré',
|
||
'gps' => 'GPS souřadnice',
|
||
'graph of transmitted data of member' => 'Graf přenesených dat člena',
|
||
'group' => 'Skupina',
|
||
'group by' => 'Shlukovat',
|
||
'group selection by same phone number' => 'Sdružovat výběry dle telefonních čísel',
|
||
'groups of users' => 'Skupiny uživatelů',
|
||
'growth of members' => 'Růst členů',
|
||
... | ... | |
'import results' => 'Výsledky importu',
|
||
'import invoice' => 'Importovat fakturu',
|
||
'imported contacts' => 'Importované kontakty',
|
||
'in' => 'v',
|
||
'in normal' => 'v normálu',
|
||
'in hours' => 'V hodinách',
|
||
'inactive' => 'Neaktivní',
|
||
'inbound' => 'Příchozí',
|
||
... | ... | |
'incoming member payment' => 'Příchozí členské příspěvky',
|
||
'incoming member payment in the period' => 'Příchozí členské příspěvky v období',
|
||
'increase of members' => 'Přírůstek členů',
|
||
'increased activity' => 'Zvýšená aktivita',
|
||
'indefinitely' => 'Na neurčito',
|
||
'information' => 'Informace',
|
||
'information about main user' => 'Informace o hlavním uživateli',
|
||
... | ... | |
'monitor' => 'Sledovat',
|
||
'month' => 'Měsíc',
|
||
'month from' => 'Od měsíce (včetně)',
|
||
'monthly' => 'měsíčně',
|
||
'monthly instalment of entrance' => 'Měsíční splátka vstupního',
|
||
'monthly member payment' => 'Měsíční členské příspěvky',
|
||
'monthly member payment have to be a number' => 'Měsíční členské příspěvky musí být číslo',
|
||
... | ... | |
'show mail message' => 'Zobrazit poštovní zprávu',
|
||
'show member' => 'Zobrazit člena',
|
||
'show menu' => 'Zobrazit menu',
|
||
'show more information about traffic of this member' => 'Zobrazit více informací o provozu tohoto člena',
|
||
'show parent for this message' => 'Zobrazit rodiče této zprávy',
|
||
'show redirection' => 'Zobrazit přesměrování',
|
||
'show smokeping record' => 'Zobrazit záznam smokepingu',
|
||
... | ... | |
'show statements' => 'Zobrazit výpisy',
|
||
'show tariffs' => 'Zobrazit tarify',
|
||
'show this table' => 'Zobrazit tuto tabulku',
|
||
'show traffic' => 'Zobrazit provoz',
|
||
'show transfer' => 'ukaž transakci',
|
||
'show transfers' => 'Zobrazit převody',
|
||
'show transfers on this account' => 'Ukaž převody tohoto účtu',
|
||
... | ... | |
'this member has already set up this fee type for this interval' => 'Tento člen má již nastaven tento typ poplatku pro tento interval.',
|
||
'this member has default system member fee %d %s' => 'Tento člen má výchozí systémový členský příspěvek %d %s.',
|
||
'this month has been already deducted!' => 'Tento měsíc už byl stržen!',
|
||
'this month traffic' => 'Provoz za tento měsíc',
|
||
'this subnet is disabled' => 'Tato podsíť je zakázána.',
|
||
'this subnet is enabled' => 'Tato podsíť je povolena.',
|
||
'this week traffic' => 'Provoz za tento týden',
|
||
'time' => 'Čas',
|
||
'time constraints' => 'Časová omezení',
|
||
'time deposits' => 'Termínované vklady',
|
||
... | ... | |
'timestamp' => 'Čas',
|
||
'title' => 'Titul',
|
||
'to' => 'Komu',
|
||
'today traffic' => 'Dnešní provoz',
|
||
'too short' => 'Příliš krátké',
|
||
'tools' => 'Nástroje',
|
||
'total' => 'Celkem',
|
||
... | ... | |
'towns' => 'Města',
|
||
'trade name' => 'Výrobní název',
|
||
'traffic for the period' => 'Provoz za období',
|
||
'traffic of member' => 'Provoz člena',
|
||
'traffic of members in time' => 'Provoz členů v čase',
|
||
'traffic' => 'Provoz',
|
||
'transfer' => 'Převod',
|
||
... | ... | |
'warning' => 'Varování',
|
||
'weak' => 'Slabé',
|
||
'website after redirection' => 'Webová stránka po přesměrování',
|
||
'week' => 'Týden',
|
||
'weekly' => 'týdně',
|
||
'weekend' => 'Víkend',
|
||
'whole d' => 'Celé z.',
|
||
'without change' => 'Beze změny',
|
||
... | ... | |
'wrong phone number' => 'Špatné telefonní číslo',
|
||
'wrong date format' => 'Chybný formát dat',
|
||
'year' => 'Rok',
|
||
'yearly' => 'ročně',
|
||
'yes' => 'ano',
|
||
'you can simply open config-samplephp in a text editor, fill in your information, and save it as configphp' => 'Můžete jednoduše otevřít config-sample.php v textovém editoru, doplnit vaše údaje a uložit jej jako config.php.',
|
||
'you cannot vote twice about same work!' => 'Nemůžete hlasovat dvakrát o stejné práci!',
|
freenetis/branches/testing/application/helpers/date.php | ||
---|---|---|
else
|
||
return false;
|
||
}
|
||
|
||
/**
|
||
* Finds start of week and return it in given format
|
||
*
|
||
* @author Michal Kliment
|
||
* @param type $week
|
||
* @param type $year
|
||
* @param type $format
|
||
* @return type
|
||
*/
|
||
public function start_of_week ($week, $year = NULL, $format = 'Y-m-d')
|
||
{
|
||
if (!$year)
|
||
$year = date("Y");
|
||
|
||
$ts = strtotime($year."-01-04 + ".($week-1)." weeks");
|
||
|
||
while (date('l', $ts) != 'Monday')
|
||
{
|
||
$ts = strtotime('-1 day', $ts);
|
||
}
|
||
|
||
return date($format, $ts);
|
||
}
|
||
|
||
/**
|
||
* Finds end of week and return it in given format
|
||
*
|
||
* @author Michal Kliment
|
||
* @param type $week
|
||
* @param type $year
|
||
* @param type $format
|
||
* @return type
|
||
*/
|
||
public function end_of_week ($week, $year = NULL, $format = 'Y-m-d')
|
||
{
|
||
if (!$year)
|
||
$year = date("Y");
|
||
|
||
$ts = strtotime($year."-01-04 + ".($week-1)." weeks");
|
||
|
||
while (date('l', $ts) != 'Sunday')
|
||
{
|
||
$ts = strtotime('+1 day', $ts);
|
||
}
|
||
|
||
return date($format, $ts);
|
||
}
|
||
|
||
} // End date
|
freenetis/branches/testing/application/helpers/callback.php | ||
---|---|---|
break;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Callback function to print week
|
||
*
|
||
* @author Michal Kliment
|
||
* @param type $item
|
||
* @param type $name
|
||
*/
|
||
public static function week_field ($item, $name)
|
||
{
|
||
echo '<span title="'.date::start_of_week($item->week, $item->year). ' - ' . date::end_of_week($item->week, $item->year).'">'.$item->week.'.</span>';
|
||
}
|
||
|
||
/**
|
||
* Callback function to print name of month
|
||
*
|
||
* @author Michal Kliment
|
||
* @param type $item
|
||
* @param type $name
|
||
*/
|
||
public static function month_field ($item, $name)
|
||
{
|
||
echo strftime('%B', mktime(0,0,0,$item->month));
|
||
}
|
||
}
|
freenetis/branches/testing/application/models/members_traffics_daily.php | ||
---|---|---|
FROM members_traffics_daily d WHERE d.member_id = ?
|
||
", array($member_id))->current();
|
||
}
|
||
|
||
public function get_today_member_traffic ($member_id)
|
||
{
|
||
return $this->db->query("
|
||
SELECT
|
||
IFNULL(SUM(upload),0) AS upload,
|
||
IFNULL(SUM(download),0) AS download
|
||
FROM members_traffics_daily d WHERE d.member_id = ? AND day = CURDATE()
|
||
", array($member_id))->current();
|
||
}
|
||
|
||
public function get_week_member_traffic ($member_id)
|
||
{
|
||
return $this->db->query("
|
||
SELECT
|
||
IFNULL(SUM(upload),0) AS upload,
|
||
IFNULL(SUM(download),0) AS download
|
||
FROM members_traffics_daily d WHERE d.member_id = ? AND day BETWEEN ? AND CURDATE()
|
||
", array($member_id, date::start_of_week (date("W"))))->current();
|
||
}
|
||
|
||
public function get_month_member_traffic ($member_id)
|
||
{
|
||
return $this->db->query("
|
||
SELECT
|
||
IFNULL(SUM(upload),0) AS upload,
|
||
IFNULL(SUM(download),0) AS download
|
||
FROM members_traffics_daily d WHERE d.member_id = '?' AND day BETWEEN ? AND CURDATE()
|
||
", array($member_id, date("Y-m").'-01'))->current();
|
||
}
|
||
|
||
/**
|
||
* Returns all traffics of member
|
||
*
|
||
* @author Michal Kliment
|
||
* @param type $member_id
|
||
* @param type $type
|
||
* @param type $limit_from
|
||
* @param type $limit_results
|
||
* @param type $order_by
|
||
* @param type $order_by_direction
|
||
* @param type $filter_sql
|
||
* @return type
|
||
*/
|
||
public function get_member_traffics ($member_id, $type, $limit_from = 0, $limit_results = 50, $order_by = NULL, $order_by_direction = 'ASC', $filter_sql = '')
|
||
{
|
||
switch ($type)
|
||
{
|
||
case 'daily':
|
||
$group_by = 'GROUP BY day';
|
||
break;
|
||
case 'weekly':
|
||
$group_by = 'GROUP BY WEEK(day)';
|
||
break;
|
||
case 'monthly':
|
||
$group_by = 'GROUP BY MONTH(day)';
|
||
break;
|
||
case 'yearly':
|
||
$group_by = 'GROUP BY YEAR(day)';
|
||
break;
|
||
default:
|
||
$group_by = '';
|
||
break;
|
||
}
|
||
|
||
$where = '';
|
||
if ($filter_sql != '')
|
||
$where .= 'WHERE '.$filter_sql;
|
||
|
||
$limit = '';
|
||
if ($limit_results > 0)
|
||
$limit = "LIMIT $limit_from, $limit_results";
|
||
|
||
$order = '';
|
||
if ($order_by != '')
|
||
$order = "ORDER BY $order_by $order_by_direction";
|
||
|
||
return $this->db->query("
|
||
SELECT * FROM
|
||
(
|
||
SELECT
|
||
IFNULL(SUM(upload),0) AS upload,
|
||
IFNULL(SUM(download),0) AS download,
|
||
IFNULL(SUM(upload),0) + IFNULL(SUM(download),0) AS total,
|
||
IFNULL(AVG(upload),0) AS avg_upload,
|
||
IFNULL(AVG(download),0) AS avg_download,
|
||
day,
|
||
WEEK(day) AS week,
|
||
MONTH(day) AS month,
|
||
YEAR(day) AS year
|
||
FROM members_traffics_daily d
|
||
WHERE d.member_id = ?
|
||
$group_by
|
||
) d
|
||
$where
|
||
$order
|
||
$limit
|
||
", array($member_id));
|
||
}
|
||
|
||
/**
|
||
* Counts all traffics of member
|
||
*
|
||
* @author Michal Kliment
|
||
* @param type $member_id
|
||
* @param type $type
|
||
* @param type $filter_sql
|
||
* @return type
|
||
*/
|
||
public function count_member_traffics ($member_id, $type, $filter_sql = '')
|
||
{
|
||
switch ($type)
|
||
{
|
||
case 'daily':
|
||
$group_by = 'GROUP BY day';
|
||
break;
|
||
case 'weekly':
|
||
$group_by = 'GROUP BY WEEK(day)';
|
||
break;
|
||
case 'monthly':
|
||
$group_by = 'GROUP BY MONTH(day)';
|
||
break;
|
||
case 'yearly':
|
||
$group_by = 'GROUP BY YEAR(day)';
|
||
break;
|
||
default:
|
||
$group_by = '';
|
||
break;
|
||
}
|
||
|
||
$where = '';
|
||
if ($filter_sql != '')
|
||
$where .= 'WHERE '.$filter_sql;
|
||
|
||
return $this->db->query("
|
||
SELECT COUNT(*) AS count FROM
|
||
(
|
||
SELECT
|
||
IFNULL(SUM(upload),0) AS upload,
|
||
IFNULL(SUM(download),0) AS download,
|
||
IFNULL(SUM(upload),0) + IFNULL(SUM(download),0) AS total,
|
||
IFNULL(AVG(upload),0) AS avg_upload,
|
||
IFNULL(AVG(download),0) AS avg_download,
|
||
day,
|
||
WEEK(day) AS week,
|
||
MONTH(day) AS month,
|
||
YEAR(day) AS year
|
||
FROM members_traffics_daily d
|
||
WHERE d.member_id = ?
|
||
$group_by
|
||
) d
|
||
$where
|
||
", array($member_id))->current()->count;
|
||
}
|
||
|
||
/**
|
||
* Counts avarage of member's traffics
|
||
*
|
||
* @author Michal Kliment
|
||
* @param type $member_id
|
||
* @param type $type
|
||
* @return type
|
||
*/
|
||
public function avg_member_traffics ($member_id, $type)
|
||
{
|
||
switch ($type)
|
||
{
|
||
case 'daily':
|
||
$group_by = 'GROUP BY day';
|
||
break;
|
||
case 'weekly':
|
||
$group_by = 'GROUP BY WEEK(day)';
|
||
break;
|
||
case 'monthly':
|
||
$group_by = 'GROUP BY MONTH(day)';
|
||
break;
|
||
case 'yearly':
|
||
$group_by = 'GROUP BY YEAR(day)';
|
||
break;
|
||
default:
|
||
$group_by = '';
|
||
break;
|
||
}
|
||
|
||
$result = $this->db->query("
|
||
SELECT
|
||
AVG(upload) as upload,
|
||
AVG(download) AS download
|
||
FROM
|
||
(
|
||
SELECT
|
||
IFNULL(SUM(upload),0) AS upload,
|
||
IFNULL(SUM(download),0) AS download,
|
||
IFNULL(SUM(upload),0) + IFNULL(SUM(download),0) AS total,
|
||
IFNULL(AVG(upload),0) AS avg_upload,
|
||
IFNULL(AVG(download),0) AS avg_download,
|
||
day,
|
||
WEEK(day) AS week,
|
||
MONTH(day) AS month,
|
||
YEAR(day) AS year
|
||
FROM members_traffics_daily d
|
||
WHERE d.member_id = ?
|
||
$group_by
|
||
) d
|
||
", array($member_id));
|
||
|
||
return ($result && $result->current()) ? $result->current() : NULL;
|
||
}
|
||
|
||
/**
|
||
* Updates daily traffics of members
|
freenetis/branches/testing/application/controllers/members.php | ||
---|---|---|
// finds total traffic of member
|
||
$members_traffics_daily_model = new Members_traffics_daily_Model();
|
||
$total_traffic = $members_traffics_daily_model->get_total_member_traffic ($member->id);
|
||
$today_traffic = $members_traffics_daily_model->get_today_member_traffic($member->id);
|
||
$week_traffic = $members_traffics_daily_model->get_week_member_traffic($member->id);
|
||
$month_traffic = $members_traffics_daily_model->get_month_member_traffic($member->id);
|
||
|
||
// finds all contacts of main user
|
||
$contact_model = new Contact_Model();
|
||
... | ... | |
$view->content->count_voip = count($voip);
|
||
$view->content->actual_traffic = $actual_traffic;
|
||
$view->content->total_traffic = $total_traffic;
|
||
$view->content->today_traffic = $today_traffic;
|
||
$view->content->week_traffic = $week_traffic;
|
||
$view->content->month_traffic = $month_traffic;
|
||
$view->content->member_links = implode(' | ',$member_links);
|
||
$view->content->user_links = implode(' | ',$user_links);
|
||
$view->render(TRUE);
|
freenetis/branches/testing/application/controllers/ulogd.php | ||
---|---|---|
$view->content->current = 'time_members_traffic';
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
* Shows traffics of member
|
||
*
|
||
* @author Michal Kliment
|
||
* @param type $member_id
|
||
* @param type $type
|
||
* @param type $limit_results
|
||
* @param string $order_by
|
||
* @param type $order_by_direction
|
||
* @param type $page_word
|
||
* @param type $page
|
||
*/
|
||
public function show_by_member ($member_id = NULL, $type = 'daily', $limit_results = 50, $order_by = NULL, $order_by_direction = 'ASC', $page_word = null, $page = 1)
|
||
{
|
||
$allowed_types = array('daily', 'weekly', 'monthly', 'yearly');
|
||
$default_order_by = array('day', 'week', 'month', 'year');
|
||
|
||
// bad parameter
|
||
if (!$member_id || !is_numeric($member_id) || !in_array($type, $allowed_types))
|
||
Controller::warning(PARAMETER);
|
||
|
||
$member = new Member_Model($member_id);
|
||
|
||
// member doesn't exist
|
||
if (!$member->id)
|
||
Controller::error(RECORD);
|
||
|
||
// access control
|
||
if (!$this->acl_check_view(get_class($this),'member', $member->id))
|
||
Controller::error(ACCESS);
|
||
|
||
// get new selector
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
|
||
$type_number = array_search($type, $allowed_types);
|
||
|
||
// load default order by if is not set
|
||
if (!$order_by)
|
||
$order_by = $default_order_by[$type_number];
|
||
|
||
// filter
|
||
|
||
$filter_form = new Filter_form('d');
|
||
|
||
if ($type_number == 0)
|
||
$filter_form->add('day')->type('date');
|
||
if ($type_number == 1)
|
||
$filter_form->add('week')->type('number');
|
||
if ($type_number == 2)
|
||
$filter_form->add('month')->type('select_number')->values(array(1 => url_lang::lang('texts.January'), 2 => url_lang::lang('texts.February'), 3 => url_lang::lang('texts.March'), 4 => url_lang::lang('texts.April'), 5 => url_lang::lang('texts.May'), 6 => url_lang::lang('texts.June'), 7 => url_lang::lang('texts.July'), 8 => url_lang::lang('texts.August'), 9 => url_lang::lang('texts.September'), 10 => url_lang::lang('texts.October'), 11 => url_lang::lang('texts.November'), 12 => url_lang::lang('texts.December')));
|
||
if ($type_number == 3)
|
||
$filter_form->add('year')->type('number')->values(date::years());
|
||
|
||
$filter_form->add('upload')->type('number');
|
||
$filter_form->add('download')->type('number');
|
||
|
||
if ($type_number > 0)
|
||
{
|
||
$filter_form->add('avg_upload')->label(url_lang::lang('texts.Avarage day upload'))->type('number');
|
||
$filter_form->add('avg_download')->label(url_lang::lang('texts.Avarage day download'))->type('number');
|
||
}
|
||
|
||
$members_traffics_daily_model = new Members_traffics_daily_Model();
|
||
|
||
$total_traffics = $members_traffics_daily_model->count_member_traffics($member->id, $type, $filter_form->as_sql());
|
||
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_traffics)
|
||
$sql_offset = 0;
|
||
|
||
$traffics = $members_traffics_daily_model->get_member_traffics($member->id, $type, $sql_offset, $limit_results, $order_by, $order_by_direction, $filter_form->as_sql());
|
||
|
||
$grid = new Grid(url_lang::base().'members', null, array(
|
||
'current' => $limit_results, // current selected 'records_per_page' value
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'total_items' => $total_traffics,
|
||
'selector_increace' => 50, // increace
|
||
'selector_min' => 50, // minimum where selector start
|
||
'base_url' => Config::get('lang').'/ulogd/show_by_member/'.$member_id.'/'.$type.'/'.$limit_results.'/'.$order_by.'/'.$order_by_direction,
|
||
'uri_segment' => 'page',
|
||
'variables' => $member_id.'/'.$type.'/',
|
||
'url_array_ofset' => 2,
|
||
'style' => 'classic',
|
||
'total_items' => $total_traffics, // use db count query here of course
|
||
'items_per_page' => $limit_results, // it may be handy to set defaults for stuff like this in config/pagination.php
|
||
'filter' => $filter_form
|
||
));
|
||
|
||
if ($type_number == 0)
|
||
$grid->order_field('day')->label(url_lang::lang('texts.Day'))->class('center');
|
||
|
||
if ($type_number == 1)
|
||
$grid->order_callback_field('week')->label(url_lang::lang('texts.Week'))->callback('callback::week_field')->class('center');
|
||
|
||
if ($type_number == 2)
|
||
$grid->order_callback_field('month')->label(url_lang::lang('texts.Month'))->callback('callback::month_field')->class('center');
|
||
|
||
if ($type_number == 3)
|
||
$grid->order_field('year')->label(url_lang::lang('texts.Year'))->class('center');
|
||
|
||
$grid->order_callback_field('upload')->label(url_lang::lang('texts.Upload'))->callback('callback::traffic_field')->class('right');
|
||
$grid->order_callback_field('download')->label(url_lang::lang('texts.Download'))->callback('callback::traffic_field')->class('right');
|
||
$grid->order_callback_field('total')->label(url_lang::lang('texts.Total'))->callback('callback::traffic_field')->class('right');
|
||
|
||
if ($type_number > 0)
|
||
{
|
||
$grid->order_callback_field('avg_upload')->label(url_lang::lang('texts.Avarage day upload'))->callback('callback::traffic_field')->class('right');
|
||
$grid->order_callback_field('avg_download')->label(url_lang::lang('texts.Avarage day download'))->callback('callback::traffic_field')->class('right');
|
||
}
|
||
|
||
$grid->datasource($traffics);
|
||
|
||
$arr_types = array();
|
||
foreach ($allowed_types as $allowed_type)
|
||
$arr_types[] = url_lang::lang('texts.'.$allowed_type);
|
||
|
||
// form to group by type
|
||
$form = new Forge(url::base(TRUE).url::current(TRUE),'', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$form->dropdown('type')->label(url_lang::lang('texts.Group by').':')->options($arr_types)->selected($type_number);
|
||
$form->submit('submit')->value(url_lang::lang('texts.Submit'));
|
||
|
||
if ($form->validate())
|
||
url::redirect (url_lang::base()."ulogd/show_by_member/$member_id/".$allowed_types[$form->type->value]);
|
||
|
||
// breadcrumbs navigation
|
||
$breadcrumbs = array();
|
||
$breadcrumbs[] = ($this->acl_check_view('Members_Controller','members')) ? html::anchor (url_lang::base().'members/show_all', url_lang::lang('texts.Members')) : url_lang::lang('texts.Members');
|
||
$breadcrumbs[] = ($this->acl_check_view('Members_Controller','members',$member->id)) ? html::anchor (url_lang::base().'members/show/'.$member->id, "ID $member->id - $member->name") : "ID $member->id - $member->name";
|
||
$breadcrumbs[] = url_lang::lang('texts.Show traffic');
|
||
|
||
$view = new View('main');
|
||
|
||
// due to bug in Google Chart it draw graph only if there are more than 1 record
|
||
if ($total_traffics > 1)
|
||
{
|
||
$units = array('kB', 'MB', 'GB', 'TB');
|
||
|
||
$div = 1;
|
||
$current_unit_id = 0;
|
||
|
||
// finds ideal unit of transmitted data
|
||
if ($avg = $members_traffics_daily_model->avg_member_traffics($member->id, $type))
|
||
{
|
||
$val = ($avg->upload > $avg->download) ? $avg->upload : $avg->download;
|
||
|
||
while (($val /= $div) > 1024)
|
||
{
|
||
$div *= 1024;
|
||
$current_unit_id++;
|
||
}
|
||
}
|
||
|
||
$view->extra_scripts .= '
|
||
google.load("visualization", "1", {packages:["corechart"]});
|
||
google.setOnLoadCallback(drawChart);
|
||
function drawChart() {
|
||
var data = new google.visualization.DataTable();
|
||
data.addColumn("string", "Traffic");
|
||
data.addColumn("number", "Upload (v '.$units[$current_unit_id].')");
|
||
data.addColumn("number", "Download (v '.$units[$current_unit_id].')");
|
||
data.addRows([';
|
||
|
||
foreach ($members_traffics_daily_model->get_member_traffics($member->id, $type, 0, 0, '', '', $filter_form->as_sql()) as $traffic)
|
||
{
|
||
switch ($type)
|
||
{
|
||
case 'daily':
|
||
$text = $traffic->day;
|
||
$title = url_lang::lang('texts.Day');
|
||
break;
|
||
case 'weekly':
|
||
$text = $traffic->week.'/'.$traffic->year;
|
||
$title = url_lang::lang('texts.Week');
|
||
break;
|
||
case 'monthly':
|
||
$text = $traffic->month.'/'.$traffic->year;
|
||
$title = url_lang::lang('texts.Month');
|
||
break;
|
||
case 'yearly':
|
||
$text = $traffic->year;
|
||
$title = url_lang::lang('texts.Year');
|
||
break;
|
||
}
|
||
|
||
$view->extra_scripts .= "
|
||
['$text', ".num::decimal_point(round($traffic->upload/$div,2)).", ".num::decimal_point(round($traffic->download/$div,2))."],";
|
||
}
|
||
|
||
$view->extra_scripts .=
|
||
']);
|
||
|
||
var chart = new google.visualization.AreaChart(document.getElementById("chart"));
|
||
chart.draw(data, {width: 700, height: 640, title: "'.url_lang::lang('texts.Graph of transmitted data of member').'",
|
||
hAxis: {title: "'.$title.'"},
|
||
vAxis: {title: "Data ('.url_lang::lang('texts.in').' '.$units[$current_unit_id].')", format:"#,###"}
|
||
});
|
||
}';
|
||
}
|
||
|
||
$view->extra_scripts .=
|
||
'$(document).ready(function(){
|
||
$("#type").parent().parent().parent().parent().parent().children("button").hide();
|
||
$("#type").change(function() {
|
||
$("#type").parent().parent().parent().parent().parent().submit();
|
||
});
|
||
});';
|
||
|
||
$view->title = url_lang::lang('texts.Traffic of member').' '.$member->name;
|
||
$view->breadcrumbs = implode(' » ', $breadcrumbs);
|
||
$view->content = new View('ulogd_show_by_member');
|
||
$view->content->member = $member;
|
||
$view->content->grid = $grid;
|
||
$view->content->form = $form;
|
||
$view->render(TRUE);
|
||
}
|
||
}
|
||
|
||
?>
|
freenetis/branches/testing/application/libraries/Filter_form.php | ||
---|---|---|
'number' => array(5,6,7,8,9,10),
|
||
'bit' => array(11,12),
|
||
'date' => array(5,6,7,8,9,10),
|
||
'select_number' => array(3,4,5,6,7,8,9,10),
|
||
);
|
||
|
||
/**
|
||
... | ... | |
'select' => 0,
|
||
'text' => 1,
|
||
'bit' => 0,
|
||
'date' => 1
|
||
'date' => 1,
|
||
'select_number' => 0
|
||
);
|
||
|
||
/**
|
||
... | ... | |
'bit' => 'key',
|
||
'number' => 'value',
|
||
'date' => 'value',
|
||
'select_number' => 'key',
|
||
);
|
||
|
||
/**
|
freenetis/branches/testing/application/views/main.php | ||
---|---|---|
<?php echo html::script('media/js/highslide/highslide-with-html.js', FALSE) ?>
|
||
<?php echo html::script('media/js/php.min', FALSE) ?>
|
||
<?php echo html::script('media/js/tinymce/tiny_mce', FALSE) ?>
|
||
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
||
<?php if (!$this->popup): ?>
|
||
<script language="javascript" type="text/javascript">
|
||
tinyMCE.init({
|
freenetis/branches/testing/application/views/members_show.php | ||
---|---|---|
<?php if (Settings::get('ulogd_enabled') && $this->acl_check_view('Ulogd_Controller', 'member', $member->id)) { ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Actual traffic').' '.help::hint('actual_traffic %s', date('Y/m/d H:i:s', Settings::get('ulogd_update_last'))) ?></th>
|
||
<td><?php echo network::size(($actual_traffic) ? $actual_traffic->upload : 0) ?> / <?php echo network::size(($actual_traffic)? $actual_traffic->download : 0) ?></td>
|
||
<td>
|
||
<?php echo network::size(($actual_traffic) ? $actual_traffic->upload : 0) ?> / <?php echo network::size(($actual_traffic)? $actual_traffic->download : 0) ?>
|
||
<?php echo html::image (array('src' => url::base().'media/images/'.($actual_traffic && $actual_traffic->active ? 'active' : 'inactive'), 'title' => url_lang::lang('texts.'.($actual_traffic && $actual_traffic->active ? 'increased activity' : 'in normal')))) ?>
|
||
<?php echo help::hint ('ulogd_active') ?>
|
||
</td>
|
||
</tr>
|
||
<?php } ?>
|
||
<?php if (Settings::get('ulogd_enabled') && $this->acl_check_view('Ulogd_Controller', 'member', $member->id)) { ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Active member').' '.help::hint('ulogd_active') ?></th>
|
||
<td><?php echo ($actual_traffic && $actual_traffic->active) ? url_lang::lang('texts.Yes') : url_lang::lang('texts.No') ?></td>
|
||
<th><?php echo url_lang::lang('texts.Today traffic') ?></th>
|
||
<td><?php echo network::size($today_traffic->upload) ?> / <?php echo network::size($today_traffic->download) ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<?php if (Settings::get('ulogd_enabled') && $this->acl_check_view('Ulogd_Controller', 'member', $member->id)) { ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.This week traffic') ?></th>
|
||
<td><?php echo network::size($week_traffic->upload) ?> / <?php echo network::size($week_traffic->download) ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<?php if (Settings::get('ulogd_enabled') && $this->acl_check_view('Ulogd_Controller', 'member', $member->id)) { ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.This month traffic') ?></th>
|
||
<td><?php echo network::size($month_traffic->upload) ?> / <?php echo network::size($month_traffic->download) ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<?php if (Settings::get('ulogd_enabled') && $this->acl_check_view('Ulogd_Controller', 'member', $member->id)) { ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Total traffic').' '.help::hint('total_traffic') ?></th>
|
||
<td><?php echo network::size($total_traffic->upload) ?> / <?php echo network::size($total_traffic->download) ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<?php if (Settings::get('ulogd_enabled') && $this->acl_check_view('Ulogd_Controller', 'member', $member->id)) { ?>
|
||
<tr>
|
||
<td colspan="2"><?php echo html::anchor(url_lang::base().'ulogd/show_by_member/'.$member->id, url_lang::lang('texts.Show more information about traffic of this member')) ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
</table>
|
||
|
||
<br class="clear" /><br />
|
freenetis/branches/testing/application/views/ulogd_show_by_member.php | ||
---|---|---|
<h2><?php echo url_lang::lang('texts.Traffic of member') ?> <?php echo $member->name ?></h2><br />
|
||
|
||
<?php echo $form ?><br />
|
||
|
||
<?php echo $grid ?><br /><br />
|
||
|
||
<div id="chart"></div>
|
Také k dispozici: Unified diff
Vylepseny informace o provozu jednotlive clena.