2011-04-07 05:03:05 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @package PTA
|
|
|
|
* @subpackage File Spaces
|
|
|
|
* @category Models
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) 2010 phpTSMadmin Development Team
|
|
|
|
* @license http://phptsmadmin.sf.net/license.html
|
|
|
|
*/
|
|
|
|
class Model_FILESPACE extends ORMTSM {
|
|
|
|
protected $_table_name = 'FILESPACES';
|
2011-05-23 15:04:40 +00:00
|
|
|
protected $_primary_key = 'FILESPACE_NAME'; // We need a primary key to detect that the object is loaded.
|
|
|
|
protected $_sorting = array(
|
|
|
|
'NODE_NAME'=>'ASC',
|
|
|
|
'FILESPACE_NAME'=>'ASC',
|
|
|
|
);
|
|
|
|
|
2011-04-07 05:03:05 +00:00
|
|
|
protected $_has_many = array(
|
|
|
|
'VOLUMEUSAGE'=>array('foreign_key'=>array('NODE_NAME','FILESPACE_NAME'),'far_key'=>'FILESPACE_NAME'),
|
|
|
|
'OCCUPANCY'=>array('foreign_key'=>array('NODE_NAME','FILESPACE_NAME'),'far_key'=>'FILESPACE_NAME'),
|
|
|
|
);
|
|
|
|
|
2011-05-23 15:04:40 +00:00
|
|
|
protected $_display_filters = array(
|
|
|
|
'BACKUP_END'=>array(
|
|
|
|
array('ORMTSM::date',array(':value','d-M-Y')),
|
|
|
|
),
|
2011-04-07 05:03:05 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
public function utilsation() {
|
|
|
|
return $this->CAPACITY * ($this->PCT_UTIL/100);
|
|
|
|
}
|
|
|
|
|
2011-05-30 09:27:08 +00:00
|
|
|
// $dtype must be Bkup or Arch
|
2011-04-07 05:03:05 +00:00
|
|
|
public function storagepools($dtype) {
|
|
|
|
$pool = array();
|
|
|
|
|
2011-04-08 05:34:04 +00:00
|
|
|
foreach ($this->OCCUPANCY
|
2011-04-07 05:03:05 +00:00
|
|
|
->select('STGPOOL_NAME')
|
2011-04-08 05:34:04 +00:00
|
|
|
->where('TYPE','=',$dtype)
|
2011-04-07 05:03:05 +00:00
|
|
|
->group_by('STGPOOL_NAME')
|
|
|
|
->order_by('STGPOOL_NAME')
|
2011-05-30 09:27:08 +00:00
|
|
|
->find_all() as $oo)
|
2011-04-07 05:03:05 +00:00
|
|
|
|
2011-05-23 15:04:40 +00:00
|
|
|
array_push($pool,$oo->STGPOOL);
|
2011-04-07 05:03:05 +00:00
|
|
|
|
|
|
|
return $pool;
|
|
|
|
}
|
|
|
|
|
2011-05-23 15:04:40 +00:00
|
|
|
public function pool_logical_util($pool,$btype) {
|
|
|
|
return $this->OCCUPANCY->where('STGPOOL_NAME','=',$pool)->where('TYPE','=',$btype)->find()->LOGICAL_MB;
|
2011-04-07 05:03:05 +00:00
|
|
|
}
|
|
|
|
|
2011-05-23 15:04:40 +00:00
|
|
|
public function pool_numvols($pool,$ctype) {
|
|
|
|
return $this->VOLUMEUSAGE->where('STGPOOL_NAME','=',$pool)->where('COPY_TYPE','=',$ctype)->find_all()->count();
|
2011-04-07 05:03:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|