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

57 lines
1.4 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';
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();
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')
->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();
}
}
?>