Fixes for KH 3.3 - to do with case file names

This commit is contained in:
Deon George
2012-11-27 12:26:56 +11:00
parent fc2ffd7bad
commit ea1346447f
88 changed files with 21 additions and 20 deletions

View File

@@ -0,0 +1,90 @@
<?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 TSM_ORM {
protected $_table_name = 'LIBVOLUMES';
protected $_primary_key = 'HOME_ELEMENT';
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':
if ($this->VOLUME->STATUS == 'EMPTY')
return 'empty';
switch (strtolower($this->LAST_USE)) {
case 'dbbackup':
case 'data':
return strtolower($this->LAST_USE);
default: return 'unkown';
}
default: return 'notcheckedin';
}
}
public function volusage() {
switch ($this->usage()) {
case 'data':
case 'empty': return $this->VOLUME->STGPOOL_NAME;
case 'dbbackup': return $this->VOLHISTORY->lastuse()->TYPE;
case 'notcheckedin': return _('Not Checked In');
case 'scratch': return _('Scratch');
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();
case 'empty': return _('Empty');
default: return '';
}
}
public function access() {
if ($this->usage() == 'scratch')
return '';
elseif ($this->STATUS)
return sprintf('%s/%s',$this->display('STATUS'),$this->display('OWNER'));
else
return '';
}
public function lastwrite() {
switch ($this->usage()) {
case 'data':
case 'empty': return $this->VOLUME->display('LAST_WRITE_DATE');
case 'dbbackup': return $this->VOLHISTORY->lastuse()->display('DATE_TIME');
default: return '';
}
}
public function removable() {
return ($this->usage() == 'dbbackup' OR (! in_array($this->usage(),array('empty','scratch')) AND $this->VOLUME->STGPOOL->POOLTYPE != 'PRIMARY')) ? TRUE : FALSE;
}
}
?>