2011-04-07 05:03:05 +00:00
|
|
|
<?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
|
|
|
|
*/
|
2012-11-26 05:57:18 +00:00
|
|
|
class Model_STGPOOL extends TSM_ORM {
|
2011-04-07 05:03:05 +00:00
|
|
|
protected $_table_name = 'STGPOOLS';
|
|
|
|
protected $_primary_key = 'STGPOOL_NAME';
|
|
|
|
protected $_sorting = array(
|
|
|
|
'STGPOOL_NAME'=>'ASC',
|
|
|
|
);
|
2011-05-23 15:04:40 +00:00
|
|
|
|
|
|
|
protected $_has_one = array(
|
|
|
|
'DEVCLASSES'=>array('foreign_key'=>'DEVCLASS_NAME','far_key'=>'DEVCLASS'),
|
|
|
|
);
|
2011-06-23 07:03:41 +00:00
|
|
|
protected $_has_many = array(
|
2012-11-27 05:46:43 +00:00
|
|
|
'COPYGROUP_AR'=>array('foreign_key'=>'DESTINATION','far_key'=>'STGPOOL_NAME'),
|
|
|
|
'COPYGROUP_BU'=>array('foreign_key'=>'DESTINATION','far_key'=>'STGPOOL_NAME'),
|
|
|
|
'MGMTCLASS'=>array('foreign_key'=>'MIGDESTINATION','far_key'=>'STGPOOL_NAME'),
|
2011-06-23 07:03:41 +00:00
|
|
|
'VOLUME'=>array('foreign_key'=>'STGPOOL_NAME','far_key'=>'STGPOOL_NAME'),
|
2012-11-28 02:34:39 +00:00
|
|
|
'OCC'=>array('foreign_key'=>'STGPOOL_NAME','far_key'=>'STGPOOL_NAME'),
|
2011-06-23 07:03:41 +00:00
|
|
|
);
|
2011-06-26 12:20:12 +00:00
|
|
|
|
|
|
|
// 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) {
|
2011-06-26 12:47:20 +00:00
|
|
|
$state = $vo->MEDIA->inlib() ? 'in' : 'out';
|
2011-06-26 12:20:12 +00:00
|
|
|
|
|
|
|
$result[$state][$vo->STATUS][] = $vo;
|
|
|
|
}
|
|
|
|
|
|
|
|
return isset($result[$inout][$status]) ? $result[$inout][$status] : array();
|
|
|
|
}
|
2011-04-07 05:03:05 +00:00
|
|
|
}
|
|
|
|
?>
|