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/filespace.php

60 lines
1.6 KiB
PHP
Raw Normal View History

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';
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(
2011-06-24 23:46:26 +00:00
'VOLUMEUSAGE'=>array('foreign_key'=>array('NODE_NAME'=>'NODE_NAME','FILESPACE_NAME'=>'FILESPACE_NAME')),
'OCCUPANCY'=>array('foreign_key'=>array('NODE_NAME'=>'NODE_NAME','FILESPACE_NAME'=>'FILESPACE_NAME')),
2011-04-07 05:03:05 +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
array_push($pool,$oo->STGPOOL);
2011-04-07 05:03:05 +00:00
return $pool;
}
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
}
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
}
}
?>