More work on library display
This commit is contained in:
@@ -19,6 +19,7 @@ class Model_VOLUME extends ORMTSM {
|
||||
|
||||
protected $_has_one = array(
|
||||
'MEDIA'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'),
|
||||
'STGPOOL'=>array('foreign_key'=>'STGPOOL_NAME','far_key'=>'STGPOOL_NAME'),
|
||||
);
|
||||
protected $_has_many = array(
|
||||
'VOLUMEUSAGE'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'),
|
||||
@@ -52,5 +53,17 @@ class Model_VOLUME extends ORMTSM {
|
||||
public function location() {
|
||||
return $this->display('LOCATION');
|
||||
}
|
||||
|
||||
// Age of a volume, based on last read/write access.
|
||||
public function age() {
|
||||
if (! $this->LAST_READ_DATE AND ! $this->LAST_WRITE_DATE)
|
||||
return 0;
|
||||
else
|
||||
return (int)((time()-(strtotime(strtotime($this->LAST_READ_DATE) > strtotime($this->LAST_WRITE_DATE) ? $this->LAST_WRITE_DATE : $this->LAST_READ_DATE)))/86400);
|
||||
}
|
||||
|
||||
public function recycle() {
|
||||
return Kohana::config('config.tsmtapeage') < $this->age() ? TRUE : FALSE;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user