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

82 lines
1.9 KiB
PHP
Raw Normal View History

2011-06-24 01:27:21 +00:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
*
* @package PTA
* @subpackage Library Volumes
* @category Models
* @author Deon George
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
class Model_LIBVOLUME extends ORMTSM {
protected $_table_name = 'LIBVOLUMES';
protected $_primary_key = 'VOLUME_NAME';
protected $_sorting = array(
'VOLUME_NAME'=>'ASC',
);
protected $_has_one = array(
'VOLUME'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'),
);
protected $_has_many = array(
'VOLHISTORY'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'),
);
public function usage() {
switch (strtolower($this->STATUS)) {
case 'scratch': return strtolower($this->STATUS);
case 'private':
switch (strtolower($this->LAST_USE)) {
case 'dbbackup':
case 'data':
return strtolower($this->LAST_USE);
default: return 'unknown';
}
}
}
public function volusage() {
switch ($this->usage()) {
case 'scratch': return _('Scratch');
case 'dbbackup': return $this->VOLHISTORY->lastuse()->TYPE;
case 'data': return $this->VOLUME->STGPOOL_NAME;
default: return _('Unknown');
}
}
public function status() {
switch ($this->usage()) {
case 'data': return sprintf('%s/%s',$this->VOLUME->display('STATUS'),$this->VOLUME->display('ACCESS'));
case 'dbbackup': return $this->VOLHISTORY->lastuse()->backupid();
default: return '';
}
}
public function access() {
switch ($this->usage()) {
case 'data':
case 'dbbackup':
return sprintf('%s/%s',$this->display('STATUS'),$this->display('OWNER'));
default: return '';
}
}
public function lastwrite() {
switch ($this->usage()) {
case 'data':
return $this->VOLUME->display('LAST_WRITE_DATE');
case 'dbbackup':
return $this->VOLHISTORY->lastuse()->display('DATE_TIME');
default: return '';
}
}
}
?>