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
2011-05-01 13:55:57 +10:00

57 lines
1.4 KiB
PHP

<?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';
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'),
);
protected $_formats = array(
'BACKUP_END'=>array('ORMTSM::date'=>array('d-M-Y')),
);
protected $_sorting = array(
'NODE_NAME'=>'ASC',
);
public function utilsation() {
return $this->CAPACITY * ($this->PCT_UTIL/100);
}
public function storagepools($dtype) {
$pool = array();
foreach ($this->OCCUPANCY
->select('STGPOOL_NAME')
->where('TYPE','=',$dtype)
->group_by('STGPOOL_NAME')
->order_by('STGPOOL_NAME')
->find_all() as $vo) {
array_push($pool,$vo->STGPOOL_NAME);
}
return $pool;
}
public function pool_logical_util($pool) {
return $this->OCCUPANCY->where('STGPOOL_NAME','=',$pool)->find()->LOGICAL_MB;
}
public function pool_numvols($pool) {
return $this->VOLUMEUSAGE->where('STGPOOL_NAME','=',$pool)->find_all()->count();
}
}
?>