This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
phptsmadmin/application/classes/Model/ACTSUM.php

64 lines
1.5 KiB
PHP
Raw Permalink Normal View History

2012-12-07 06:06:57 +00:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
*
* @package PTA
* @subpackage Activity Summary
* @category Models
* @author Deon George
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
class Model_ACTSUM extends ORM_TSM {
protected $_table_name = 'ACTIVITY_SUMMARY';
protected $_primary_key = 'START_TIME';
protected $_sorting = array(
'START_TIME'=>'ASC',
);
2012-12-12 10:39:00 +00:00
protected $_has_one = array(
'NODE'=>array('foreign_key'=>'NODE_NAME','far_key'=>'ENTITY'),
);
2012-12-07 06:06:57 +00:00
protected $_display_filters = array(
'START_TIME'=>array(
array('ORM_TSM::date',array(':value','d-M H:i')),
),
'END_TIME'=>array(
array('ORM_TSM::date',array(':value','d-M H:i')),
),
);
2012-12-12 04:00:03 +00:00
/**
* Return if this ACTIVITY SUMMARY would be still in the ACTIVITY LOG
*/
public function inActLog() {
return ORM_TSM::date(ORM::factory('ACTLOG')->FirstRec(),'U') <= $this->start();
}
2012-12-12 10:39:00 +00:00
/**
* Get the ACTIVITY LOG data for this SESSION
*/
public function actlog() {
if (! isset($this->ENTITY))
throw new Kohana_Exception('Activity Summary has no NODENAME data');
return $this->NODE->actlog_session($this->NUMBER,$this->start());
}
2012-12-12 04:00:03 +00:00
/**
* Return this ACTIVITY SUMMARY in GB
*/
2012-12-07 06:06:57 +00:00
public function bytes() {
return (real)number_format($this->BYTES/1024/1024,0,'','');
}
2012-12-12 04:00:03 +00:00
/**
* Return this ACTIVITY SUMMARY start time in seconds since epoch
*/
public function start() {
return ORM_TSM::date($this->START_TIME,'U');
}
2012-12-07 06:06:57 +00:00
}
?>