45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
/**
|
|
*
|
|
* @package PTA
|
|
* @subpackage Storage Pools
|
|
* @category Models
|
|
* @author Deon George
|
|
* @copyright (c) 2010 phpTSMadmin Development Team
|
|
* @license http://phptsmadmin.sf.net/license.html
|
|
*/
|
|
class Model_STGPOOL extends ORMTSM {
|
|
protected $_table_name = 'STGPOOLS';
|
|
protected $_primary_key = 'STGPOOL_NAME';
|
|
protected $_sorting = array(
|
|
'STGPOOL_NAME'=>'ASC',
|
|
);
|
|
|
|
protected $_has_one = array(
|
|
'DEVCLASSES'=>array('foreign_key'=>'DEVCLASS_NAME','far_key'=>'DEVCLASS'),
|
|
);
|
|
protected $_has_many = array(
|
|
'VOLUME'=>array('foreign_key'=>'STGPOOL_NAME','far_key'=>'STGPOOL_NAME'),
|
|
);
|
|
|
|
// Return a list of volumes
|
|
// @param $inout IN|OUT of the library
|
|
// @param $status volume status FULL|FILLING|PENDING|EMPTY
|
|
public function libvolstype($inout,$status) {
|
|
$inout = strtolower($inout);
|
|
$status = strtoupper($status);
|
|
$result = array();
|
|
|
|
if (! isset($result[$inout]))
|
|
foreach ($this->VOLUME->find_all() as $vo) {
|
|
$state = $vo->MEDIA->inlib() ? 'in' : 'out';
|
|
|
|
$result[$state][$vo->STATUS][] = $vo;
|
|
}
|
|
|
|
return isset($result[$inout][$status]) ? $result[$inout][$status] : array();
|
|
}
|
|
}
|
|
?>
|